Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Jonathan Hart
2014-09-23 08:55:17 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ac60c089d24472f2b0fadfb2e7b94cc6e3b80a16
ac60c089
1 parent
f6509f63
Added APIs for binding address information to ports and for monitoring hosts/ips
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
190 additions
and
11 deletions
core/api/src/main/java/org/onlab/onos/net/host/HostAdminService.java
core/api/src/main/java/org/onlab/onos/net/host/HostService.java
core/api/src/main/java/org/onlab/onos/net/host/HostStore.java
core/api/src/main/java/org/onlab/onos/net/host/PortAddresses.java
core/api/src/test/java/org/onlab/onos/net/host/HostServiceAdapter.java
core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
core/api/src/main/java/org/onlab/onos/net/host/HostAdminService.java
View file @
ac60c08
package
org
.
onlab
.
onos
.
net
.
host
;
import
java.util.Set
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.HostId
;
import
org.onlab.packet.IpAddress
;
import
org.onlab.packet.MacAddress
;
/**
* Service for administering the inventory of end-station hosts.
...
...
@@ -14,4 +19,42 @@ public interface HostAdminService {
*/
void
removeHost
(
HostId
hostId
);
/**
* Binds an IP address and optional MAC address to the given connection
* point.
* <p/>
* This method will overwrite any previously held address information for
* the connection point.
*
* @param ip the IP address to bind to the connection point. This parameter
* is mandatory and cannot be null.
* @param mac the optional MAC address to bind to the connection point. Can
* be set to null if no MAC address needs to be bound.
* @param connectPoint the connection point to bind the addresses to
*/
void
bindAddressesToPort
(
IpAddress
ip
,
MacAddress
mac
,
ConnectPoint
connectPoint
);
/**
* Removes all address information for the given connection point.
*
* @param connectPoint the connection point to remove address information
*/
void
unbindAddressesFromPort
(
ConnectPoint
connectPoint
);
/**
* Returns the addresses information for all connection points.
*
* @return the set of address bindings for all connection points
*/
Set
<
PortAddresses
>
getAddressBindings
();
/**
* Retrieves the addresses that have been bound to the given connection
* point.
*
* @param connectPoint the connection point to retrieve address bindings
* for
* @return addresses bound to the port
*/
PortAddresses
getAddressBindingsForPort
(
ConnectPoint
connectPoint
);
}
...
...
core/api/src/main/java/org/onlab/onos/net/host/HostService.java
View file @
ac60c08
...
...
@@ -6,6 +6,7 @@ import org.onlab.onos.net.ConnectPoint;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.Host
;
import
org.onlab.onos.net.HostId
;
import
org.onlab.packet.IpAddress
;
import
org.onlab.packet.IpPrefix
;
import
org.onlab.packet.MacAddress
;
import
org.onlab.packet.VlanId
;
...
...
@@ -87,7 +88,7 @@ public interface HostService {
*
* @param ip IP address of the host to monitor
*/
void
monitorIp
(
IpPrefix
ip
);
void
startMonitoringIp
(
IpAddress
ip
);
/**
* Stops the host service from monitoring an IP address.
...
...
@@ -95,7 +96,18 @@ public interface HostService {
* @param ip IP address to stop monitoring
*/
// TODO clients can cancel other client's requests
void
stopMonitoringIp
(
IpPrefix
ip
);
void
stopMonitoringIp
(
IpAddress
ip
);
/**
* Requests the host service to resolve the MAC address for the given IP
* address.
* <p/>
* This will trigger a notification to the host listeners if the MAC
* address is found.
*
* @param ip IP address to find the MAC address for
*/
void
requestMac
(
IpAddress
ip
);
/**
* Adds the specified host listener.
...
...
core/api/src/main/java/org/onlab/onos/net/host/HostStore.java
View file @
ac60c08
package
org
.
onlab
.
onos
.
net
.
host
;
import
java.util.Set
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.Host
;
...
...
@@ -9,8 +11,6 @@ import org.onlab.packet.IpPrefix;
import
org.onlab.packet.MacAddress
;
import
org.onlab.packet.VlanId
;
import
java.util.Set
;
/**
* Manages inventory of end-station hosts; not intended for direct use.
*/
...
...
@@ -98,4 +98,34 @@ public interface HostStore {
*/
Set
<
Host
>
getConnectedHosts
(
DeviceId
deviceId
);
/**
* Updates the address information for a given port.
*
* @param addresses the port and address information
*/
void
updateAddressBindings
(
PortAddresses
addresses
);
/**
* Removes any previously stored address information for a given connection
* point.
*
* @param connectPoint the connection point
*/
void
removeAddressBindings
(
ConnectPoint
connectPoint
);
/**
* Returns the address bindings stored for all connection points.
*
* @return the set of address bindings
*/
Set
<
PortAddresses
>
getAddressBindings
();
/**
* Returns the address bindings for a particular connection point.
*
* @param connectPoint the connection point to return address information
* for
* @return address information for the connection point
*/
PortAddresses
getAddressBindingsForPort
(
ConnectPoint
connectPoint
);
}
...
...
core/api/src/main/java/org/onlab/onos/net/host/PortAddresses.java
0 → 100644
View file @
ac60c08
package
org
.
onlab
.
onos
.
net
.
host
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.packet.IpAddress
;
import
org.onlab.packet.MacAddress
;
/**
* Represents address information bound to a port.
*/
public
interface
PortAddresses
{
/**
* Returns the connection point this address information is bound to.
*
* @return the connection point
*/
ConnectPoint
connectPoint
();
/**
* Returns the IP address bound to the port.
*
* @return the IP address
*/
IpAddress
ip
();
/**
* Returns the MAC address bound to the port.
*
* @return the MAC address if one is bound, otherwise null
*/
MacAddress
mac
();
}
core/api/src/test/java/org/onlab/onos/net/host/HostServiceAdapter.java
View file @
ac60c08
...
...
@@ -6,6 +6,7 @@ import org.onlab.onos.net.ConnectPoint;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.Host
;
import
org.onlab.onos.net.HostId
;
import
org.onlab.packet.IpAddress
;
import
org.onlab.packet.IpPrefix
;
import
org.onlab.packet.MacAddress
;
import
org.onlab.packet.VlanId
;
...
...
@@ -55,11 +56,15 @@ public class HostServiceAdapter implements HostService {
}
@Override
public
void
monitorIp
(
IpPrefix
ip
)
{
public
void
startMonitoringIp
(
IpAddress
ip
)
{
}
@Override
public
void
stopMonitoringIp
(
IpPrefix
ip
)
{
public
void
stopMonitoringIp
(
IpAddress
ip
)
{
}
@Override
public
void
requestMac
(
IpAddress
ip
)
{
}
@Override
...
...
core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
View file @
ac60c08
...
...
@@ -26,8 +26,10 @@ import org.onlab.onos.net.host.HostProviderRegistry;
import
org.onlab.onos.net.host.HostProviderService
;
import
org.onlab.onos.net.host.HostService
;
import
org.onlab.onos.net.host.HostStore
;
import
org.onlab.onos.net.host.PortAddresses
;
import
org.onlab.onos.net.provider.AbstractProviderRegistry
;
import
org.onlab.onos.net.provider.AbstractProviderService
;
import
org.onlab.packet.IpAddress
;
import
org.onlab.packet.IpPrefix
;
import
org.onlab.packet.MacAddress
;
import
org.onlab.packet.VlanId
;
...
...
@@ -118,13 +120,18 @@ public class HostManager
}
@Override
public
void
monitorIp
(
IpPrefix
ip
)
{
// TODO pass through to
Simple
HostMonitor
public
void
startMonitoringIp
(
IpAddress
ip
)
{
// TODO pass through to HostMonitor
}
@Override
public
void
stopMonitoringIp
(
IpPrefix
ip
)
{
// TODO pass through to SimpleHostMonitor
public
void
stopMonitoringIp
(
IpAddress
ip
)
{
// TODO pass through to HostMonitor
}
@Override
public
void
requestMac
(
IpAddress
ip
)
{
// TODO Auto-generated method stub
}
@Override
...
...
@@ -147,6 +154,31 @@ public class HostManager
}
}
@Override
public
void
bindAddressesToPort
(
IpAddress
ip
,
MacAddress
mac
,
ConnectPoint
connectPoint
)
{
// TODO Auto-generated method stub
}
@Override
public
void
unbindAddressesFromPort
(
ConnectPoint
connectPoint
)
{
// TODO Auto-generated method stub
}
@Override
public
Set
<
PortAddresses
>
getAddressBindings
()
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
PortAddresses
getAddressBindingsForPort
(
ConnectPoint
connectPoint
)
{
// TODO Auto-generated method stub
return
null
;
}
// Personalized host provider service issued to the supplied provider.
private
class
InternalHostProviderService
extends
AbstractProviderService
<
HostProvider
>
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
View file @
ac60c08
...
...
@@ -24,15 +24,16 @@ import org.onlab.onos.net.HostId;
import
org.onlab.onos.net.host.HostDescription
;
import
org.onlab.onos.net.host.HostEvent
;
import
org.onlab.onos.net.host.HostStore
;
import
org.onlab.onos.net.host.PortAddresses
;
import
org.onlab.onos.net.provider.ProviderId
;
import
org.onlab.packet.IpPrefix
;
import
org.onlab.packet.MacAddress
;
import
org.onlab.packet.VlanId
;
import
org.slf4j.Logger
;
import
com.google.common.collect.HashMultimap
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.common.collect.Multimap
;
import
org.slf4j.Logger
;
/**
* Manages inventory of end-station hosts using trivial in-memory
...
...
@@ -192,4 +193,28 @@ public class SimpleHostStore implements HostStore {
return
hostset
;
}
@Override
public
void
updateAddressBindings
(
PortAddresses
addresses
)
{
// TODO Auto-generated method stub
}
@Override
public
void
removeAddressBindings
(
ConnectPoint
connectPoint
)
{
// TODO Auto-generated method stub
}
@Override
public
Set
<
PortAddresses
>
getAddressBindings
()
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
PortAddresses
getAddressBindingsForPort
(
ConnectPoint
connectPoint
)
{
// TODO Auto-generated method stub
return
null
;
}
}
...
...
Please
register
or
login
to post a comment