public abstract class TopologySimulator extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.onosproject.cluster.ClusterService |
clusterService |
protected int |
deviceCount |
protected List<org.onosproject.net.DeviceId> |
deviceIds |
protected CountDownLatch |
deviceLatch |
protected org.onosproject.net.device.DeviceProviderService |
deviceProviderService |
protected org.onosproject.net.device.DeviceAdminService |
deviceService |
protected org.onlab.osgi.ServiceDirectory |
directory |
protected int |
hostCount |
protected org.onosproject.net.host.HostProviderService |
hostProviderService |
protected org.onosproject.net.host.HostService |
hostService |
protected int |
infrastructurePorts |
protected org.onosproject.net.link.LinkProviderService |
linkProviderService |
protected org.onosproject.net.link.LinkService |
linkService |
protected org.onosproject.cluster.NodeId |
localNode |
protected org.slf4j.Logger |
log |
protected org.onosproject.mastership.MastershipService |
mastershipService |
protected int |
maxWaitSeconds |
protected String[] |
topoShape |
| Constructor and Description |
|---|
TopologySimulator() |
| Modifier and Type | Method and Description |
|---|---|
protected List<org.onosproject.net.device.PortDescription> |
buildPorts(int portCount)
Generates a list of a configured number of ports.
|
boolean |
contains(org.onosproject.net.DeviceId deviceId)
Indicates whether or not the simulation deeps the device as available.
|
void |
createDevice(org.onosproject.net.DeviceId id,
int chassisId)
Creates simulated device.
|
void |
createDevice(org.onosproject.net.DeviceId id,
int chassisId,
org.onosproject.net.Device.Type type,
int portCount)
Creates simulated device.
|
protected void |
createDevice(int i)
Creates simulated device and adds its id to the list of devices ids.
|
protected void |
createDevices()
Creates simulated devices.
|
protected abstract void |
createHosts()
Creates simulated hosts.
|
void |
createHosts(org.onosproject.net.DeviceId deviceId,
int portOffset)
Creates simularted hosts for the specified device.
|
void |
createLink(org.onosproject.net.ConnectPoint one,
org.onosproject.net.ConnectPoint two)
Creates simulated link between two connection points.
|
void |
createLink(org.onosproject.net.ConnectPoint one,
org.onosproject.net.ConnectPoint two,
org.onosproject.net.Link.Type type,
boolean isBidirectional)
Creates simulated link between two connection points.
|
void |
createLink(int i,
int j,
int pi,
int pj)
Creates simulated link between two devices.
|
protected abstract void |
createLinks()
Creates simulated links.
|
protected void |
init(String topoShape,
int deviceCount,
int hostCount,
org.onlab.osgi.ServiceDirectory directory,
org.onosproject.net.device.DeviceProviderService deviceProviderService,
org.onosproject.net.host.HostProviderService hostProviderService,
org.onosproject.net.link.LinkProviderService linkProviderService)
Initializes a new topology simulator with access to the specified service
directory and various provider services.
|
protected void |
prepareForDeviceEvents(int count)
Prepares to count device added/available/removed events.
|
protected void |
processTopoShape(String shape)
Processes the topology shape specifier.
|
protected void |
removeDevices()
Removes any devices previously advertised by this provider.
|
protected void |
removeHosts()
Removes any hosts previously advertised by this provider.
|
protected void |
removeLinks()
Removes any links previously advertised by this provider.
|
void |
setUpTopology()
Sets up network topology simulation.
|
void |
tearDownTopology()
Tears down network topology simulation.
|
protected void |
waitForDeviceEvents()
Waits for all expected device added/available/removed events.
|
protected final org.slf4j.Logger log
protected String[] topoShape
protected int deviceCount
protected int hostCount
protected org.onlab.osgi.ServiceDirectory directory
protected org.onosproject.cluster.NodeId localNode
protected org.onosproject.cluster.ClusterService clusterService
protected org.onosproject.mastership.MastershipService mastershipService
protected org.onosproject.net.device.DeviceAdminService deviceService
protected org.onosproject.net.host.HostService hostService
protected org.onosproject.net.link.LinkService linkService
protected org.onosproject.net.device.DeviceProviderService deviceProviderService
protected org.onosproject.net.host.HostProviderService hostProviderService
protected org.onosproject.net.link.LinkProviderService linkProviderService
protected int maxWaitSeconds
protected int infrastructurePorts
protected CountDownLatch deviceLatch
protected final List<org.onosproject.net.DeviceId> deviceIds
protected void init(String topoShape, int deviceCount, int hostCount, org.onlab.osgi.ServiceDirectory directory, org.onosproject.net.device.DeviceProviderService deviceProviderService, org.onosproject.net.host.HostProviderService hostProviderService, org.onosproject.net.link.LinkProviderService linkProviderService)
topoShape - topology shape specifierdeviceCount - number of devices in the topologyhostCount - number of hosts per devicedirectory - service directorydeviceProviderService - device provider servicehostProviderService - host provider servicelinkProviderService - link provider serviceprotected void processTopoShape(String shape)
shape - topology shape specifierpublic void setUpTopology()
protected void createDevices()
protected abstract void createLinks()
protected abstract void createHosts()
protected void createDevice(int i)
i - index of the device id in the list.public void createDevice(org.onosproject.net.DeviceId id,
int chassisId)
id - device identifierchassisId - chassis identifier numberpublic void createDevice(org.onosproject.net.DeviceId id,
int chassisId,
org.onosproject.net.Device.Type type,
int portCount)
id - device identifierchassisId - chassis identifier numbertype - device typeportCount - number of device portspublic void createLink(int i,
int j,
int pi,
int pj)
i - index of one simulated devicej - index of another simulated devicepi - port number of i-th devicepj - port number of j-th devicepublic void createLink(org.onosproject.net.ConnectPoint one,
org.onosproject.net.ConnectPoint two)
one - one connection pointtwo - another connection pointpublic void createLink(org.onosproject.net.ConnectPoint one,
org.onosproject.net.ConnectPoint two,
org.onosproject.net.Link.Type type,
boolean isBidirectional)
one - one connection pointtwo - another connection pointtype - link typeisBidirectional - true if link is bidirectionalpublic void createHosts(org.onosproject.net.DeviceId deviceId,
int portOffset)
deviceId - device identifierportOffset - port offset where to start attaching hostsprotected void prepareForDeviceEvents(int count)
count - number of events to countprotected void waitForDeviceEvents()
public void tearDownTopology()
protected void removeHosts()
protected void removeLinks()
protected void removeDevices()
protected List<org.onosproject.net.device.PortDescription> buildPorts(int portCount)
portCount - number of portspublic boolean contains(org.onosproject.net.DeviceId deviceId)
deviceId - device identifier