Renamed *NetworkGraph* references to *Topology*.
Change-Id: Iec01c47086e1518592c0753e75395d3fe5abcde3
diff --git a/conf/onos.properties b/conf/onos.properties
index 20d90c4..0235dc0 100644
--- a/conf/onos.properties
+++ b/conf/onos.properties
@@ -1,6 +1,6 @@
floodlight.modules = net.floodlightcontroller.core.FloodlightProvider,\
net.floodlightcontroller.threadpool.ThreadPool,\
-net.onrc.onos.core.topology.NetworkGraphPublisher, \
+net.onrc.onos.core.topology.TopologyPublisher, \
net.onrc.onos.core.datagrid.HazelcastDatagrid,\
net.onrc.onos.core.flowprogrammer.FlowProgrammer,\
net.onrc.onos.core.intent.runtime.PathCalcRuntimeModule,\
diff --git a/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
index e9a29c0..9dc840b 100644
--- a/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
+++ b/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
@@ -33,9 +33,9 @@
import net.onrc.onos.core.packet.Ethernet;
import net.onrc.onos.core.registry.IControllerRegistryService;
import net.onrc.onos.core.topology.Device;
-import net.onrc.onos.core.topology.INetworkGraphService;
+import net.onrc.onos.core.topology.ITopologyService;
import net.onrc.onos.core.topology.LinkEvent;
-import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.Topology;
import net.onrc.onos.core.topology.Port;
import net.onrc.onos.core.topology.Switch;
import net.onrc.onos.core.util.Dpid;
@@ -65,8 +65,8 @@
private IPacketService packetService;
private IControllerRegistryService controllerRegistryService;
- private INetworkGraphService networkGraphService;
- private NetworkGraph networkGraph;
+ private ITopologyService topologyService;
+ private Topology topology;
private IPathCalcRuntimeService pathRuntime;
private IntentMap intentMap;
@@ -154,7 +154,7 @@
dependencies.add(IControllerRegistryService.class);
dependencies.add(IOnosDeviceService.class);
dependencies.add(IDatagridService.class);
- dependencies.add(INetworkGraphService.class);
+ dependencies.add(ITopologyService.class);
dependencies.add(IPathCalcRuntimeService.class);
// We don't use the IProxyArpService directly, but reactive forwarding
// requires it to be loaded and answering ARP requests
@@ -167,7 +167,7 @@
public void init(FloodlightModuleContext context) {
datagrid = context.getServiceImpl(IDatagridService.class);
controllerRegistryService = context.getServiceImpl(IControllerRegistryService.class);
- networkGraphService = context.getServiceImpl(INetworkGraphService.class);
+ topologyService = context.getServiceImpl(ITopologyService.class);
pathRuntime = context.getServiceImpl(IPathCalcRuntimeService.class);
packetService = context.getServiceImpl(IPacketService.class);
@@ -179,7 +179,7 @@
public void startUp(FloodlightModuleContext context) {
packetService.registerPacketListener(this);
- networkGraph = networkGraphService.getNetworkGraph();
+ topology = topologyService.getTopology();
intentMap = pathRuntime.getPathIntents();
datagrid.addListener("onos.pathintent_state", this, Long.class, IntentStateList.class);
}
@@ -217,7 +217,7 @@
HexString.toHexString(eth.getDestinationMACAddress());
//FIXME getDeviceByMac() is a blocking call, so it may be better way to handle it to avoid the condition.
- Device deviceObject = networkGraph.getDeviceByMac(MACAddress.valueOf(destinationMac));
+ Device deviceObject = topology.getDeviceByMac(MACAddress.valueOf(destinationMac));
if (deviceObject == null) {
log.debug("No device entry found for {}",
@@ -245,7 +245,7 @@
@Override
public void run() {
- Device deviceObject = networkGraph.getDeviceByMac(MACAddress.valueOf(eth.getDestinationMACAddress()));
+ Device deviceObject = topology.getDeviceByMac(MACAddress.valueOf(eth.getDestinationMACAddress()));
if (deviceObject == null) {
log.debug("wait {}ms and device was not found. Send broadcast packet and the thread finish.", SLEEP_TIME_FOR_DB_DEVICE_INSTALLED);
handleBroadcast(sw, inPort, eth);
diff --git a/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
index a148f0a..90ec662 100644
--- a/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
@@ -31,8 +31,8 @@
import net.onrc.onos.core.packet.Ethernet;
import net.onrc.onos.core.packet.IPv4;
import net.onrc.onos.core.topology.Device;
-import net.onrc.onos.core.topology.INetworkGraphService;
-import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.ITopologyService;
+import net.onrc.onos.core.topology.Topology;
import net.onrc.onos.core.topology.Port;
import net.onrc.onos.core.topology.Switch;
import net.onrc.onos.core.util.SwitchPort;
@@ -65,8 +65,8 @@
private IConfigInfoService configService;
private IRestApiService restApi;
- private INetworkGraphService networkGraphService;
- private NetworkGraph networkGraph;
+ private ITopologyService topologyService;
+ private Topology topology;
private IOnosDeviceService onosDeviceService;
private IPacketService packetService;
@@ -246,7 +246,7 @@
dependencies.add(IRestApiService.class);
dependencies.add(IDatagridService.class);
dependencies.add(IConfigInfoService.class);
- dependencies.add(INetworkGraphService.class);
+ dependencies.add(ITopologyService.class);
dependencies.add(IOnosDeviceService.class);
dependencies.add(IPacketService.class);
return dependencies;
@@ -257,7 +257,7 @@
this.configService = context.getServiceImpl(IConfigInfoService.class);
this.restApi = context.getServiceImpl(IRestApiService.class);
this.datagrid = context.getServiceImpl(IDatagridService.class);
- this.networkGraphService = context.getServiceImpl(INetworkGraphService.class);
+ this.topologyService = context.getServiceImpl(ITopologyService.class);
this.onosDeviceService = context.getServiceImpl(IOnosDeviceService.class);
this.packetService = context.getServiceImpl(IPacketService.class);
@@ -292,7 +292,7 @@
restApi.addRestletRoutable(new ArpWebRoutable());
packetService.registerPacketListener(this);
- networkGraph = networkGraphService.getNetworkGraph();
+ topology = topologyService.getTopology();
//
// Event notification setup: channels and event handlers
@@ -353,9 +353,9 @@
// If the ARP request is expired and then delete the device
HostArpRequester requester = (HostArpRequester) request.requester;
ARP req = requester.getArpRequest();
- networkGraph.acquireReadLock();
- Device targetDev = networkGraph.getDeviceByMac(MACAddress.valueOf(req.getTargetHardwareAddress()));
- networkGraph.releaseReadLock();
+ topology.acquireReadLock();
+ Device targetDev = topology.getDeviceByMac(MACAddress.valueOf(req.getTargetHardwareAddress()));
+ topology.releaseReadLock();
if (targetDev != null) {
onosDeviceService.deleteOnosDeviceByMac(MACAddress.valueOf(req.getTargetHardwareAddress()));
if (log.isDebugEnabled()) {
@@ -453,10 +453,10 @@
arpRequests.put(target, new ArpRequest(
new HostArpRequester(arp, dpid, inPort), false));
- networkGraph.acquireReadLock();
- Device targetDevice = networkGraph.getDeviceByMac(
+ topology.acquireReadLock();
+ Device targetDevice = topology.getDeviceByMac(
MACAddress.valueOf(arp.getTargetHardwareAddress()));
- networkGraph.releaseReadLock();
+ topology.releaseReadLock();
if (targetDevice == null) {
if (log.isTraceEnabled()) {
diff --git a/src/main/java/net/onrc/onos/core/datagrid/web/GetNGEventsResource.java b/src/main/java/net/onrc/onos/core/datagrid/web/GetNGEventsResource.java
index 3191762..00b7c68 100644
--- a/src/main/java/net/onrc/onos/core/datagrid/web/GetNGEventsResource.java
+++ b/src/main/java/net/onrc/onos/core/datagrid/web/GetNGEventsResource.java
@@ -23,7 +23,7 @@
get(IDatagridService.class.getCanonicalName());
- log.debug("Get network graph events");
+ log.debug("Get topology events");
IEventChannel<byte[], TopologyEvent> channel = datagridService.createChannel(TopologyManager.EVENT_CHANNEL_NAME,
byte[].class, TopologyEvent.class);
diff --git a/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java b/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java
index 3177f61..38a8746 100644
--- a/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java
+++ b/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java
@@ -32,8 +32,8 @@
import net.onrc.onos.core.packet.Ethernet;
import net.onrc.onos.core.packet.IPv4;
import net.onrc.onos.core.packet.UDP;
-import net.onrc.onos.core.topology.INetworkGraphService;
-import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.ITopologyService;
+import net.onrc.onos.core.topology.Topology;
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.OFPacketIn;
@@ -59,8 +59,8 @@
private IEventChannel<Long, OnosDevice> eventChannel;
private static final String DEVICE_CHANNEL_NAME = "onos.device";
private Map<Long, OnosDevice> mapDevice = new ConcurrentHashMap<Long, OnosDevice>();
- private INetworkGraphService networkGraphService;
- private NetworkGraph networkGraph;
+ private ITopologyService topologyService;
+ private Topology topology;
public enum OnosDeviceUpdateType {
ADD, DELETE, UPDATE;
@@ -166,7 +166,7 @@
}
//If the switch port we try to attach a new device already has a link, then stop adding device
- if (networkGraph.getOutgoingLink(dpid, (long) portId) != null) {
+ if (topology.getOutgoingLink(dpid, (long) portId) != null) {
if (log.isTraceEnabled()) {
log.trace("Stop adding OnosDevice {} due to there is a link to: dpid {} port {}",
srcDevice.getMacAddress(), dpid, portId);
@@ -292,7 +292,7 @@
List<Class<? extends IFloodlightService>> dependencies =
new ArrayList<Class<? extends IFloodlightService>>();
dependencies.add(IFloodlightProviderService.class);
- dependencies.add(INetworkGraphService.class);
+ dependencies.add(ITopologyService.class);
dependencies.add(IDatagridService.class);
return dependencies;
}
@@ -303,8 +303,8 @@
floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
deviceListeners = new CopyOnWriteArrayList<IOnosDeviceListener>();
datagrid = context.getServiceImpl(IDatagridService.class);
- networkGraphService = context.getServiceImpl(INetworkGraphService.class);
- networkGraph = networkGraphService.getNetworkGraph();
+ topologyService = context.getServiceImpl(ITopologyService.class);
+ topology = topologyService.getTopology();
setOnosDeviceManagerProperty(context);
}
diff --git a/src/main/java/net/onrc/onos/core/intent/PathIntent.java b/src/main/java/net/onrc/onos/core/intent/PathIntent.java
index 2e1f6a6..cc00979 100644
--- a/src/main/java/net/onrc/onos/core/intent/PathIntent.java
+++ b/src/main/java/net/onrc/onos/core/intent/PathIntent.java
@@ -25,7 +25,6 @@
}
/**
- * @param graph
* @param path
* @param bandwidth bandwidth which should be allocated for the path.
* If 0, no intent for bandwidth allocation (best effort).
diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntime.java b/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntime.java
index 4939f90..c900698 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntime.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntime.java
@@ -17,8 +17,8 @@
import net.onrc.onos.core.intent.PathIntent;
import net.onrc.onos.core.intent.PathIntentMap;
import net.onrc.onos.core.intent.ShortestPathIntent;
-import net.onrc.onos.core.topology.NetworkGraph;
import net.onrc.onos.core.topology.Switch;
+import net.onrc.onos.core.topology.Topology;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -27,11 +27,11 @@
* @author Toshio Koide (t-koide@onlab.us)
*/
public class PathCalcRuntime implements IFloodlightService {
- private NetworkGraph graph;
+ private Topology topology;
private static final Logger log = LoggerFactory.getLogger(PathCalcRuntime.class);
- public PathCalcRuntime(NetworkGraph g) {
- this.graph = g;
+ public PathCalcRuntime(Topology topology) {
+ this.topology = topology;
}
/**
@@ -45,9 +45,9 @@
IntentOperationList pathIntentOpList = new IntentOperationList();
HashMap<Switch, ConstrainedBFSTree> spfTrees = new HashMap<>();
- // TODO optimize locking of NetworkGraph
- graph.acquireReadLock();
- log.debug("NetworkGraph: {}", graph.getLinks());
+ // TODO optimize locking of Topology
+ topology.acquireReadLock();
+ log.debug("Topology: {}", topology.getLinks());
for (IntentOperation intentOp : intentOpList) {
switch (intentOp.operator) {
@@ -62,13 +62,13 @@
}
ShortestPathIntent spIntent = (ShortestPathIntent) intentOp.intent;
- Switch srcSwitch = graph.getSwitch(spIntent.getSrcSwitchDpid());
- Switch dstSwitch = graph.getSwitch(spIntent.getDstSwitchDpid());
+ Switch srcSwitch = topology.getSwitch(spIntent.getSrcSwitchDpid());
+ Switch dstSwitch = topology.getSwitch(spIntent.getDstSwitchDpid());
if (srcSwitch == null || dstSwitch == null) {
- log.error("Switch not found. src:{}, dst:{}, NetworkGraph:{}",
+ log.error("Switch not found. src:{}, dst:{}, Topology:{}",
spIntent.getSrcSwitchDpid(),
spIntent.getDstSwitchDpid(),
- graph.getLinks());
+ topology.getLinks());
pathIntentOpList.add(Operator.ERROR, new ErrorIntent(
ErrorType.SWITCH_NOT_FOUND,
"Switch not found.",
@@ -90,7 +90,7 @@
}
Path path = tree.getPath(dstSwitch);
if (path == null) {
- log.error("Path not found. Intent: {}, NetworkGraph:{}", spIntent.toString(), graph.getLinks());
+ log.error("Path not found. Intent: {}, Topology: {}", spIntent.toString(), topology.getLinks());
pathIntentOpList.add(Operator.ERROR, new ErrorIntent(
ErrorType.PATH_NOT_FOUND,
"Path not found.",
@@ -137,8 +137,8 @@
break;
}
}
- // TODO optimize locking of NetworkGraph
- graph.releaseReadLock();
+ // TODO optimize locking of Topology
+ topology.releaseReadLock();
return pathIntentOpList;
}
diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModule.java b/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModule.java
index 1e6ae00..76fa263 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModule.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModule.java
@@ -15,7 +15,6 @@
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.restserver.IRestApiService;
-
import net.onrc.onos.core.datagrid.IDatagridService;
import net.onrc.onos.core.datagrid.IEventChannel;
import net.onrc.onos.core.datagrid.IEventChannelListener;
@@ -31,8 +30,8 @@
import net.onrc.onos.core.intent.runtime.web.IntentWebRoutable;
import net.onrc.onos.core.registry.IControllerRegistryService;
import net.onrc.onos.core.topology.DeviceEvent;
-import net.onrc.onos.core.topology.INetworkGraphListener;
-import net.onrc.onos.core.topology.INetworkGraphService;
+import net.onrc.onos.core.topology.ITopologyListener;
+import net.onrc.onos.core.topology.ITopologyService;
import net.onrc.onos.core.topology.LinkEvent;
import net.onrc.onos.core.topology.PortEvent;
import net.onrc.onos.core.topology.SwitchEvent;
@@ -43,7 +42,7 @@
/**
* @author Toshio Koide (t-koide@onlab.us)
*/
-public class PathCalcRuntimeModule implements IFloodlightModule, IPathCalcRuntimeService, INetworkGraphListener, IEventChannelListener<Long, IntentStateList> {
+public class PathCalcRuntimeModule implements IFloodlightModule, IPathCalcRuntimeService, ITopologyListener, IEventChannelListener<Long, IntentStateList> {
static class PerfLog {
private String step;
private long time;
@@ -80,7 +79,7 @@
private PathCalcRuntime runtime;
private IDatagridService datagridService;
- private INetworkGraphService networkGraphService;
+ private ITopologyService topologyService;
private IntentMap highLevelIntents;
private PathIntentMap pathIntents;
private IControllerRegistryService controllerRegistry;
@@ -140,15 +139,15 @@
public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
Collection<Class<? extends IFloodlightService>> l = new ArrayList<>(2);
l.add(IDatagridService.class);
- l.add(INetworkGraphService.class);
l.add(IRestApiService.class);
+ l.add(ITopologyService.class);
return l;
}
@Override
public void init(FloodlightModuleContext context) throws FloodlightModuleException {
datagridService = context.getServiceImpl(IDatagridService.class);
- networkGraphService = context.getServiceImpl(INetworkGraphService.class);
+ topologyService = context.getServiceImpl(ITopologyService.class);
controllerRegistry = context.getServiceImpl(IControllerRegistryService.class);
restApi = context.getServiceImpl(IRestApiService.class);
}
@@ -156,11 +155,11 @@
@Override
public void startUp(FloodlightModuleContext context) {
highLevelIntents = new IntentMap();
- runtime = new PathCalcRuntime(networkGraphService.getNetworkGraph());
+ runtime = new PathCalcRuntime(topologyService.getTopology());
pathIntents = new PathIntentMap();
opEventChannel = datagridService.createChannel(INTENT_OP_EVENT_CHANNEL_NAME, Long.class, IntentOperationList.class);
datagridService.addListener(INTENT_STATE_EVENT_CHANNEL_NAME, this, Long.class, IntentStateList.class);
- networkGraphService.registerNetworkGraphListener(this);
+ topologyService.registerTopologyListener(this);
persistIntent = new PersistIntent(controllerRegistry);
restApi.addRestletRoutable(new IntentWebRoutable());
}
@@ -287,12 +286,12 @@
}
// ================================================================================
- // INetworkGraphListener implementations
+ // ITopologyListener implementations
// ================================================================================
// CHECKSTYLE:OFF suppress warning about too many parameters
@Override
- public void networkGraphEvents(Collection<SwitchEvent> addedSwitchEvents,
+ public void topologyEvents(Collection<SwitchEvent> addedSwitchEvents,
Collection<SwitchEvent> removedSwitchEvents,
Collection<PortEvent> addedPortEvents,
Collection<PortEvent> removedPortEvents,
diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/PlanCalcRuntime.java b/src/main/java/net/onrc/onos/core/intent/runtime/PlanCalcRuntime.java
index 436edaf..087bff8 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/PlanCalcRuntime.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/PlanCalcRuntime.java
@@ -19,7 +19,7 @@
import net.onrc.onos.core.intent.PathIntent;
import net.onrc.onos.core.intent.ShortestPathIntent;
import net.onrc.onos.core.topology.LinkEvent;
-//import net.onrc.onos.core.topology.NetworkGraph;
+//import net.onrc.onos.core.topology.Topology;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -30,10 +30,10 @@
public class PlanCalcRuntime {
- // NetworkGraph graph;
+ // Topology graph;
private static final Logger log = LoggerFactory.getLogger(PlanCalcRuntime.class);
- public PlanCalcRuntime(/*NetworkGraph graph*/) {
+ public PlanCalcRuntime(/*Topology graph*/) {
// this.graph = graph;
}
diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/PlanInstallModule.java b/src/main/java/net/onrc/onos/core/intent/runtime/PlanInstallModule.java
index 6afe6b0..15230ec 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/PlanInstallModule.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/PlanInstallModule.java
@@ -21,15 +21,15 @@
import net.onrc.onos.core.intent.Intent.IntentState;
import net.onrc.onos.core.intent.IntentOperation;
import net.onrc.onos.core.intent.IntentOperationList;
-import net.onrc.onos.core.topology.INetworkGraphService;
-//import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.ITopologyService;
+//import net.onrc.onos.core.topology.Topology;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PlanInstallModule implements IFloodlightModule {
protected volatile IFloodlightProviderService floodlightProvider;
- protected volatile INetworkGraphService networkGraph;
+ protected volatile ITopologyService topologyService;
protected volatile IDatagridService datagridService;
protected volatile IFlowPusherService flowPusher;
private PlanCalcRuntime planCalc;
@@ -47,10 +47,9 @@
public void init(FloodlightModuleContext context)
throws FloodlightModuleException {
floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
- networkGraph = context.getServiceImpl(INetworkGraphService.class);
+ topologyService = context.getServiceImpl(ITopologyService.class);
datagridService = context.getServiceImpl(IDatagridService.class);
flowPusher = context.getServiceImpl(IFlowPusherService.class);
-// NetworkGraph graph = networkGraph.getNetworkGraph();
planCalc = new PlanCalcRuntime();
planInstall = new PlanInstallRuntime(floodlightProvider, flowPusher);
eventListener = new EventListener();
@@ -175,7 +174,7 @@
Collection<Class<? extends IFloodlightService>> l =
new ArrayList<Class<? extends IFloodlightService>>();
l.add(IFloodlightProviderService.class);
- l.add(INetworkGraphService.class);
+ l.add(ITopologyService.class);
l.add(IDatagridService.class);
l.add(IFlowPusherService.class);
return l;
diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/PlanInstallRuntime.java b/src/main/java/net/onrc/onos/core/intent/runtime/PlanInstallRuntime.java
index 4805f51..a807bc8 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/PlanInstallRuntime.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/PlanInstallRuntime.java
@@ -13,7 +13,7 @@
import net.floodlightcontroller.core.internal.OFMessageFuture;
import net.onrc.onos.core.flowprogrammer.IFlowPusherService;
import net.onrc.onos.core.intent.FlowEntry;
-//import net.onrc.onos.core.topology.NetworkGraph;
+//import net.onrc.onos.core.topology.Topology;
import net.onrc.onos.core.util.Pair;
import org.openflow.protocol.OFBarrierReply;
@@ -25,12 +25,12 @@
*/
public class PlanInstallRuntime {
- // NetworkGraph graph;
+ // Topology graph;
IFlowPusherService pusher;
IFloodlightProviderService provider;
private static final Logger log = LoggerFactory.getLogger(PlanInstallRuntime.class);
- public PlanInstallRuntime(//NetworkGraph graph,
+ public PlanInstallRuntime(//Topology graph,
IFloodlightProviderService provider,
IFlowPusherService pusher) {
// this.graph = graph;
diff --git a/src/main/java/net/onrc/onos/core/intent/runtime/web/ShortestPathResource.java b/src/main/java/net/onrc/onos/core/intent/runtime/web/ShortestPathResource.java
index 6338d52..4989d6d 100644
--- a/src/main/java/net/onrc/onos/core/intent/runtime/web/ShortestPathResource.java
+++ b/src/main/java/net/onrc/onos/core/intent/runtime/web/ShortestPathResource.java
@@ -6,11 +6,11 @@
import net.onrc.onos.core.intent.ConstrainedBFSTree;
import net.onrc.onos.core.intent.Path;
-import net.onrc.onos.core.topology.INetworkGraphService;
+import net.onrc.onos.core.topology.ITopologyService;
import net.onrc.onos.core.topology.Link;
import net.onrc.onos.core.topology.LinkEvent;
-import net.onrc.onos.core.topology.NetworkGraph;
import net.onrc.onos.core.topology.Switch;
+import net.onrc.onos.core.topology.Topology;
import net.onrc.onos.core.topology.serializers.LinkSerializer;
import net.onrc.onos.core.util.Dpid;
@@ -38,11 +38,11 @@
*/
@Get("json")
public String retrieve() {
- INetworkGraphService networkGraphService =
- (INetworkGraphService) getContext().getAttributes().
- get(INetworkGraphService.class.getCanonicalName());
+ ITopologyService topologyService =
+ (ITopologyService) getContext().getAttributes().
+ get(ITopologyService.class.getCanonicalName());
- NetworkGraph graph = networkGraphService.getNetworkGraph();
+ Topology topology = topologyService.getTopology();
//
// Prepare the JSON serializer
@@ -65,10 +65,10 @@
// Do the Shortest Path computation and return the result: a list of
// links.
//
- graph.acquireReadLock();
+ topology.acquireReadLock();
try {
- Switch srcSwitch = graph.getSwitch(srcDpid.value());
- Switch dstSwitch = graph.getSwitch(dstDpid.value());
+ Switch srcSwitch = topology.getSwitch(srcDpid.value());
+ Switch dstSwitch = topology.getSwitch(dstDpid.value());
if ((srcSwitch == null) || (dstSwitch == null)) {
return "";
}
@@ -76,7 +76,7 @@
Path path = bfsTree.getPath(dstSwitch);
List<Link> links = new LinkedList<>();
for (LinkEvent linkEvent : path) {
- Link link = graph.getLink(linkEvent.getSrc().getDpid(),
+ Link link = topology.getLink(linkEvent.getSrc().getDpid(),
linkEvent.getSrc().getNumber(),
linkEvent.getDst().getDpid(),
linkEvent.getDst().getNumber());
@@ -90,7 +90,7 @@
log.error("Error writing Shortest Path to JSON", e);
return "";
} finally {
- graph.releaseReadLock();
+ topology.releaseReadLock();
}
}
}
diff --git a/src/main/java/net/onrc/onos/core/packetservice/BroadcastPacketOutNotification.java b/src/main/java/net/onrc/onos/core/packetservice/BroadcastPacketOutNotification.java
index e2f9d21..c1c631c 100644
--- a/src/main/java/net/onrc/onos/core/packetservice/BroadcastPacketOutNotification.java
+++ b/src/main/java/net/onrc/onos/core/packetservice/BroadcastPacketOutNotification.java
@@ -2,7 +2,7 @@
import java.util.Map;
-import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.Topology;
import net.onrc.onos.core.topology.Port;
import com.google.common.collect.HashMultimap;
@@ -82,17 +82,17 @@
@Override
public Multimap<Long, Short> calculateOutPorts(
- Multimap<Long, Short> localPorts, NetworkGraph networkGraph) {
+ Multimap<Long, Short> localPorts, Topology topology) {
Multimap<Long, Short> outPorts = HashMultimap.create();
for (Map.Entry<Long, Short> entry : localPorts.entries()) {
Port globalPort;
- networkGraph.acquireReadLock();
+ topology.acquireReadLock();
try {
- globalPort = networkGraph.getPort(entry.getKey(),
+ globalPort = topology.getPort(entry.getKey(),
entry.getValue().longValue());
} finally {
- networkGraph.releaseReadLock();
+ topology.releaseReadLock();
}
if ((!entry.getKey().equals(inSwitch) ||
diff --git a/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java b/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java
index 6bdf874..2bed639 100644
--- a/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java
+++ b/src/main/java/net/onrc/onos/core/packetservice/PacketModule.java
@@ -22,10 +22,10 @@
import net.onrc.onos.core.datagrid.IEventChannelListener;
import net.onrc.onos.core.flowprogrammer.IFlowPusherService;
import net.onrc.onos.core.packet.Ethernet;
-import net.onrc.onos.core.topology.INetworkGraphService;
-import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.ITopologyService;
import net.onrc.onos.core.topology.Port;
import net.onrc.onos.core.topology.Switch;
+import net.onrc.onos.core.topology.Topology;
import net.onrc.onos.core.util.SwitchPort;
import org.openflow.protocol.OFMessage;
@@ -49,7 +49,7 @@
private final CopyOnWriteArrayList<IPacketListener> listeners;
private IFloodlightProviderService floodlightProvider;
- private NetworkGraph networkGraph;
+ private Topology topology;
private IDatagridService datagrid;
private IFlowPusherService flowPusher;
@@ -74,7 +74,7 @@
}
}
Multimap<Long, Short> outPorts = value.calculateOutPorts(
- localPorts, networkGraph);
+ localPorts, topology);
sendPacketToSwitches(outPorts, value.getPacketData());
}
@@ -159,24 +159,24 @@
Ethernet eth = IFloodlightProviderService.bcStore.
get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
- Switch networkGraphSwitch;
+ Switch topologySwitch;
Port inPort;
try {
- networkGraph.acquireReadLock();
- networkGraphSwitch = networkGraph.getSwitch(sw.getId());
- inPort = networkGraph.getPort(sw.getId(), (long) pi.getInPort());
+ topology.acquireReadLock();
+ topologySwitch = topology.getSwitch(sw.getId());
+ inPort = topology.getPort(sw.getId(), (long) pi.getInPort());
} finally {
- networkGraph.releaseReadLock();
+ topology.releaseReadLock();
}
- if (networkGraphSwitch == null || inPort == null) {
+ if (topologySwitch == null || inPort == null) {
// We can't send packets for switches or ports that aren't in the
- // network graph yet
+ // topology yet
return Command.CONTINUE;
}
for (IPacketListener listener : listeners) {
- listener.receive(networkGraphSwitch, inPort, eth);
+ listener.receive(topologySwitch, inPort, eth);
}
return Command.CONTINUE;
@@ -202,7 +202,7 @@
public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
List<Class<? extends IFloodlightService>> dependencies = new ArrayList<>();
dependencies.add(IFloodlightProviderService.class);
- dependencies.add(INetworkGraphService.class);
+ dependencies.add(ITopologyService.class);
dependencies.add(IDatagridService.class);
dependencies.add(IFlowPusherService.class);
return dependencies;
@@ -213,8 +213,8 @@
throws FloodlightModuleException {
floodlightProvider =
context.getServiceImpl(IFloodlightProviderService.class);
- networkGraph = context.getServiceImpl(INetworkGraphService.class)
- .getNetworkGraph();
+ topology = context.getServiceImpl(ITopologyService.class)
+ .getTopology();
datagrid = context.getServiceImpl(IDatagridService.class);
flowPusher = context.getServiceImpl(IFlowPusherService.class);
}
diff --git a/src/main/java/net/onrc/onos/core/packetservice/PacketOutNotification.java b/src/main/java/net/onrc/onos/core/packetservice/PacketOutNotification.java
index 0307d2f..b92518a 100644
--- a/src/main/java/net/onrc/onos/core/packetservice/PacketOutNotification.java
+++ b/src/main/java/net/onrc/onos/core/packetservice/PacketOutNotification.java
@@ -3,7 +3,7 @@
import java.io.Serializable;
import java.util.Arrays;
-import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.Topology;
import com.google.common.collect.Multimap;
@@ -54,11 +54,11 @@
* instance.
*
* @param localPorts the map of locally-controlled ports
- * @param networkGraph an instance of the global network graph
+ * @param topology an instance of the global topology
* @return a multimap of ports that the packet should be sent out,
* in the form
* {@code {dpid1 => {portnum1, portnum2, ...}, dpid2 => {portnum1}, ...}}
*/
public abstract Multimap<Long, Short> calculateOutPorts(
- Multimap<Long, Short> localPorts, NetworkGraph networkGraph);
+ Multimap<Long, Short> localPorts, Topology topology);
}
diff --git a/src/main/java/net/onrc/onos/core/packetservice/SinglePacketOutNotification.java b/src/main/java/net/onrc/onos/core/packetservice/SinglePacketOutNotification.java
index edf017b..0521434 100644
--- a/src/main/java/net/onrc/onos/core/packetservice/SinglePacketOutNotification.java
+++ b/src/main/java/net/onrc/onos/core/packetservice/SinglePacketOutNotification.java
@@ -1,6 +1,6 @@
package net.onrc.onos.core.packetservice;
-import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.Topology;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
@@ -72,7 +72,7 @@
@Override
public Multimap<Long, Short> calculateOutPorts(
- Multimap<Long, Short> localPorts, NetworkGraph networkGraph) {
+ Multimap<Long, Short> localPorts, Topology topology) {
Multimap<Long, Short> outPorts = HashMultimap.create();
if (localPorts.containsEntry(outSwitch, outPort)) {
diff --git a/src/main/java/net/onrc/onos/core/topology/DeviceImpl.java b/src/main/java/net/onrc/onos/core/topology/DeviceImpl.java
index d070570..6bb133a 100644
--- a/src/main/java/net/onrc/onos/core/topology/DeviceImpl.java
+++ b/src/main/java/net/onrc/onos/core/topology/DeviceImpl.java
@@ -8,14 +8,14 @@
/**
* @author Toshio Koide (t-koide@onlab.us)
*/
-public class DeviceImpl extends NetworkGraphObject implements Device {
+public class DeviceImpl extends TopologyObject implements Device {
private final MACAddress macAddr;
protected LinkedList<Port> attachmentPoints;
private long lastSeenTime;
- public DeviceImpl(NetworkGraph graph, MACAddress mac) {
- super(graph);
+ public DeviceImpl(Topology topology, MACAddress mac) {
+ super(topology);
this.macAddr = mac;
this.attachmentPoints = new LinkedList<>();
}
diff --git a/src/main/java/net/onrc/onos/core/topology/INetworkGraphService.java b/src/main/java/net/onrc/onos/core/topology/INetworkGraphService.java
deleted file mode 100644
index 18eb785..0000000
--- a/src/main/java/net/onrc/onos/core/topology/INetworkGraphService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package net.onrc.onos.core.topology;
-
-import net.floodlightcontroller.core.module.IFloodlightService;
-
-/**
- * Interface for providing the Network Graph Service to other modules.
- */
-public interface INetworkGraphService extends IFloodlightService {
- /**
- * Allows a module to get a reference to the global network graph object.
- *
- * @return
- */
- public NetworkGraph getNetworkGraph();
-
- public void registerNetworkGraphListener(INetworkGraphListener listener);
-
- public void deregisterNetworkGraphListener(INetworkGraphListener listener);
-
- /**
- * Allows a module to get a reference to the southbound interface to
- * the network graph.
- * TODO Figure out how to hide the southbound interface from
- * applications/modules that shouldn't touch it
- *
- * @return
- */
- public NetworkGraphDiscoveryInterface getNetworkGraphDiscoveryInterface();
-}
diff --git a/src/main/java/net/onrc/onos/core/topology/INetworkGraphListener.java b/src/main/java/net/onrc/onos/core/topology/ITopologyListener.java
similarity index 92%
rename from src/main/java/net/onrc/onos/core/topology/INetworkGraphListener.java
rename to src/main/java/net/onrc/onos/core/topology/ITopologyListener.java
index 6132fbb..889db03 100644
--- a/src/main/java/net/onrc/onos/core/topology/INetworkGraphListener.java
+++ b/src/main/java/net/onrc/onos/core/topology/ITopologyListener.java
@@ -4,11 +4,11 @@
/**
* Interface which needs to be implemented to receive Topology events from
- * the NetworkGraph.
+ * the Topology.
*/
-public interface INetworkGraphListener {
+public interface ITopologyListener {
/**
- * Network Graph events.
+ * Topology events.
* <p/>
* The recommended ordering rules for applying/processing the events is:
* (a) Process "added" events before "removed" events.
@@ -34,7 +34,7 @@
* @param removedDeviceEvents the Removed Device Events.
*/
// CHECKSTYLE:OFF suppress warning about too many parameters
- public void networkGraphEvents(Collection<SwitchEvent> addedSwitchEvents,
+ public void topologyEvents(Collection<SwitchEvent> addedSwitchEvents,
Collection<SwitchEvent> removedSwitchEvents,
Collection<PortEvent> addedPortEvents,
Collection<PortEvent> removedPortEvents,
diff --git a/src/main/java/net/onrc/onos/core/topology/ITopologyService.java b/src/main/java/net/onrc/onos/core/topology/ITopologyService.java
new file mode 100644
index 0000000..b6280bc
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/topology/ITopologyService.java
@@ -0,0 +1,40 @@
+package net.onrc.onos.core.topology;
+
+import net.floodlightcontroller.core.module.IFloodlightService;
+
+/**
+ * Interface for providing the topology service to other modules.
+ */
+public interface ITopologyService extends IFloodlightService {
+ /**
+ * Allows a module to get a reference to the global topology object.
+ *
+ * @return the global Topology object
+ */
+ public Topology getTopology();
+
+ /**
+ * Registers a listener for topology events.
+ *
+ * @param listener the listener to register
+ */
+ public void registerTopologyListener(ITopologyListener listener);
+
+ /**
+ * Deregisters a listener for topology events. The listener will no longer
+ * receive topology events after this call.
+ *
+ * @param listener the listener to deregister
+ */
+ public void deregisterTopologyListener(ITopologyListener listener);
+
+ /**
+ * Allows a module to get a reference to the southbound interface to
+ * the topology.
+ * TODO Figure out how to hide the southbound interface from
+ * applications/modules that shouldn't touch it
+ *
+ * @return the TopologyDiscoveryInterface object
+ */
+ public TopologyDiscoveryInterface getTopologyDiscoveryInterface();
+}
diff --git a/src/main/java/net/onrc/onos/core/topology/Link.java b/src/main/java/net/onrc/onos/core/topology/Link.java
index 8715b12..2bd9cef 100644
--- a/src/main/java/net/onrc/onos/core/topology/Link.java
+++ b/src/main/java/net/onrc/onos/core/topology/Link.java
@@ -3,7 +3,7 @@
// TODO Everything returned by these interfaces must be either Unmodifiable view,
// immutable object, or a copy of the original "SB" In-memory Topology.
/**
- * Interface of Link object in Network Graph topology.
+ * Interface of Link object in the topology.
*/
public interface Link {
/**
diff --git a/src/main/java/net/onrc/onos/core/topology/LinkImpl.java b/src/main/java/net/onrc/onos/core/topology/LinkImpl.java
index bf66100..7347172 100644
--- a/src/main/java/net/onrc/onos/core/topology/LinkImpl.java
+++ b/src/main/java/net/onrc/onos/core/topology/LinkImpl.java
@@ -8,7 +8,7 @@
* TODO REMOVE following design memo: This object itself may hold the DBObject,
* but this Object itself will not issue any read/write to the DataStore.
*/
-public class LinkImpl extends NetworkGraphObject implements Link {
+public class LinkImpl extends TopologyObject implements Link {
private SwitchPort srcPort;
private SwitchPort dstPort;
@@ -20,36 +20,36 @@
/**
* Constructor for when a link is read from the database and the Ports
- * already exist in the in-memory network graph.
+ * already exist in the in-memory topology.
*
- * @param graph
+ * @param topology
* @param srcPort
* @param dstPort
*/
- public LinkImpl(NetworkGraph graph, Port srcPort, Port dstPort) {
- super(graph);
+ public LinkImpl(Topology topology, Port srcPort, Port dstPort) {
+ super(topology);
this.srcPort = srcPort.asSwitchPort();
this.dstPort = dstPort.asSwitchPort();
}
@Override
public Switch getSrcSwitch() {
- return graph.getSwitch(srcPort.dpid().value());
+ return topology.getSwitch(srcPort.dpid().value());
}
@Override
public Port getSrcPort() {
- return graph.getPort(srcPort.dpid().value(), (long) srcPort.port().value());
+ return topology.getPort(srcPort.dpid().value(), (long) srcPort.port().value());
}
@Override
public Switch getDstSwitch() {
- return graph.getSwitch(dstPort.dpid().value());
+ return topology.getSwitch(dstPort.dpid().value());
}
@Override
public Port getDstPort() {
- return graph.getPort(dstPort.dpid().value(), (long) dstPort.port().value());
+ return topology.getPort(dstPort.dpid().value(), (long) dstPort.port().value());
}
@Override
diff --git a/src/main/java/net/onrc/onos/core/topology/NetworkGraphObject.java b/src/main/java/net/onrc/onos/core/topology/NetworkGraphObject.java
deleted file mode 100644
index bef0e11..0000000
--- a/src/main/java/net/onrc/onos/core/topology/NetworkGraphObject.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package net.onrc.onos.core.topology;
-
-
-public class NetworkGraphObject {
-
- protected final NetworkGraph graph;
-
- public NetworkGraphObject(NetworkGraph graph) {
- this.graph = graph;
- }
-
-}
diff --git a/src/main/java/net/onrc/onos/core/topology/Port.java b/src/main/java/net/onrc/onos/core/topology/Port.java
index 44f4bcf..9a0c06e 100644
--- a/src/main/java/net/onrc/onos/core/topology/Port.java
+++ b/src/main/java/net/onrc/onos/core/topology/Port.java
@@ -6,7 +6,7 @@
//immutable object, or a copy of the original "SB" In-memory Topology.
/**
- * Interface of Port object in Network Graph topology.
+ * Interface of Port object in the topology.
*/
public interface Port {
diff --git a/src/main/java/net/onrc/onos/core/topology/PortImpl.java b/src/main/java/net/onrc/onos/core/topology/PortImpl.java
index 1f6946a..e88d23b 100644
--- a/src/main/java/net/onrc/onos/core/topology/PortImpl.java
+++ b/src/main/java/net/onrc/onos/core/topology/PortImpl.java
@@ -12,7 +12,7 @@
* TODO REMOVE following design memo: This object itself may hold the DBObject,
* but this Object itself will not issue any read/write to the DataStore.
*/
-public class PortImpl extends NetworkGraphObject implements Port {
+public class PortImpl extends TopologyObject implements Port {
private Switch sw;
@@ -21,11 +21,12 @@
private final SwitchPort switchPort;
- // These needs to be ConcurrentCollecton if allowing Graph to be accessed Concurrently
+ // These needs to be ConcurrentCollecton if allowing the topology to be
+ // accessed concurrently
protected Set<Device> devices;
- public PortImpl(NetworkGraph graph, Switch parentSwitch, Long number) {
- super(graph);
+ public PortImpl(Topology topology, Switch parentSwitch, Long number) {
+ super(topology);
this.sw = parentSwitch;
this.number = number;
this.devices = new HashSet<>();
@@ -70,13 +71,13 @@
@Override
public Link getOutgoingLink() {
- return graph.getOutgoingLink(switchPort.dpid().value(),
+ return topology.getOutgoingLink(switchPort.dpid().value(),
(long) switchPort.port().value());
}
@Override
public Link getIncomingLink() {
- return graph.getIncomingLink(switchPort.dpid().value(),
+ return topology.getIncomingLink(switchPort.dpid().value(),
(long) switchPort.port().value());
}
diff --git a/src/main/java/net/onrc/onos/core/topology/Switch.java b/src/main/java/net/onrc/onos/core/topology/Switch.java
index 5f635df..32dedd8 100644
--- a/src/main/java/net/onrc/onos/core/topology/Switch.java
+++ b/src/main/java/net/onrc/onos/core/topology/Switch.java
@@ -5,7 +5,7 @@
// TOOD Everything returned by these interfaces must be either Unmodifiable view,
// immutable object, or a copy of the original "SB" In-memory Topology.
/**
- * Interface of Switch object in Network Graph topology.
+ * Interface of Switch object in the topology.
*/
public interface Switch {
diff --git a/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java b/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java
index 1e5e1e2..5d287a8 100644
--- a/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java
+++ b/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java
@@ -16,14 +16,15 @@
* TODO REMOVE following design memo: This object itself may hold the DBObject,
* but this Object itself will not issue any read/write to the DataStore.
*/
-public class SwitchImpl extends NetworkGraphObject implements Switch {
+public class SwitchImpl extends TopologyObject implements Switch {
private Long dpid;
- // These needs to be ConcurrentCollecton if allowing Graph to be accessed Concurrently
+ // These needs to be ConcurrentCollecton if allowing the topology to be
+ // accessed concurrently
private final Map<Long, Port> ports;
- public SwitchImpl(NetworkGraph graph, Long dpid) {
- super(graph);
+ public SwitchImpl(Topology topology, Long dpid) {
+ super(topology);
this.dpid = dpid;
ports = new HashMap<Long, Port>();
}
@@ -91,7 +92,7 @@
}
public Port addPort(Long portNumber) {
- PortImpl port = new PortImpl(graph, this, portNumber);
+ PortImpl port = new PortImpl(topology, this, portNumber);
ports.put(port.getNumber(), port);
return port;
}
diff --git a/src/main/java/net/onrc/onos/core/topology/NetworkGraph.java b/src/main/java/net/onrc/onos/core/topology/Topology.java
similarity index 96%
rename from src/main/java/net/onrc/onos/core/topology/NetworkGraph.java
rename to src/main/java/net/onrc/onos/core/topology/Topology.java
index 6133bb6..3b90f89 100644
--- a/src/main/java/net/onrc/onos/core/topology/NetworkGraph.java
+++ b/src/main/java/net/onrc/onos/core/topology/Topology.java
@@ -3,11 +3,11 @@
import net.floodlightcontroller.util.MACAddress;
/**
- * The northbound interface to the topology network graph. This interface
+ * The northbound interface to the topology. This interface
* is presented to the rest of ONOS. It is currently read-only, as we want
* only the discovery modules to be allowed to modify the topology.
*/
-public interface NetworkGraph {
+public interface Topology {
/**
* Get the switch for a given switch DPID.
*
diff --git a/src/main/java/net/onrc/onos/core/topology/NetworkGraphDatastore.java b/src/main/java/net/onrc/onos/core/topology/TopologyDatastore.java
similarity index 88%
rename from src/main/java/net/onrc/onos/core/topology/NetworkGraphDatastore.java
rename to src/main/java/net/onrc/onos/core/topology/TopologyDatastore.java
index 08eb061..5067666 100644
--- a/src/main/java/net/onrc/onos/core/topology/NetworkGraphDatastore.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyDatastore.java
@@ -19,22 +19,10 @@
import org.slf4j.LoggerFactory;
/**
- * The southbound interface to the network graph which allows clients to
- * mutate the graph. This class will maintain the invariants of the network
- * graph. The southbound discovery modules will use this interface to update
- * the network graph as they learn about the state of the network.
- * <p/>
- * Modification to the Network Map by this module will:
- * 1. Writes to Cluster-wide DataStore.
- * 2. Update ONOS instance In-memory Network Map.
- * 3. Send-out Notification. (TBD)
- * (XXX: To update other instances In-memory Network Map,
- * notification should be triggered here.
- * But if we want to aggregate notification to minimize notification,
- * It might be better for the caller to trigger notification.)
+ * Contains methods which write topology events into the key-value data store.
*/
-public class NetworkGraphDatastore {
- private static final Logger log = LoggerFactory.getLogger(NetworkGraphDatastore.class);
+public class TopologyDatastore {
+ private static final Logger log = LoggerFactory.getLogger(TopologyDatastore.class);
/**
* Add a switch to the database.
diff --git a/src/main/java/net/onrc/onos/core/topology/NetworkGraphDiscoveryInterface.java b/src/main/java/net/onrc/onos/core/topology/TopologyDiscoveryInterface.java
similarity index 96%
rename from src/main/java/net/onrc/onos/core/topology/NetworkGraphDiscoveryInterface.java
rename to src/main/java/net/onrc/onos/core/topology/TopologyDiscoveryInterface.java
index 219417f..16d8af1 100644
--- a/src/main/java/net/onrc/onos/core/topology/NetworkGraphDiscoveryInterface.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyDiscoveryInterface.java
@@ -6,7 +6,7 @@
* Interface used by the Topology Discovery module to write topology-related
* events.
*/
-public interface NetworkGraphDiscoveryInterface {
+public interface TopologyDiscoveryInterface {
/**
* Switch discovered event.
*
diff --git a/src/main/java/net/onrc/onos/core/topology/NetworkGraphImpl.java b/src/main/java/net/onrc/onos/core/topology/TopologyImpl.java
similarity index 95%
rename from src/main/java/net/onrc/onos/core/topology/NetworkGraphImpl.java
rename to src/main/java/net/onrc/onos/core/topology/TopologyImpl.java
index 395f2af..d48e222 100644
--- a/src/main/java/net/onrc/onos/core/topology/NetworkGraphImpl.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyImpl.java
@@ -13,9 +13,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NetworkGraphImpl implements NetworkGraph {
+public class TopologyImpl implements Topology {
@SuppressWarnings("unused")
- private static final Logger log = LoggerFactory.getLogger(NetworkGraphImpl.class);
+ private static final Logger log = LoggerFactory.getLogger(TopologyImpl.class);
// DPID -> Switch
private final ConcurrentMap<Long, Switch> switches;
@@ -29,7 +29,7 @@
// TODO use the write lock after refactor
private Lock writeLock = readWriteLock.writeLock();
- public NetworkGraphImpl() {
+ public TopologyImpl() {
// TODO: Does these object need to be stored in Concurrent Collection?
switches = new ConcurrentHashMap<>();
mac2Device = new ConcurrentHashMap<>();
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyManager.java b/src/main/java/net/onrc/onos/core/topology/TopologyManager.java
index 67e8e5d..ffad050 100644
--- a/src/main/java/net/onrc/onos/core/topology/TopologyManager.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyManager.java
@@ -29,7 +29,9 @@
import org.slf4j.LoggerFactory;
/**
- * The "NB" read-only Network Map.
+ * The TopologyManager receives topology updates from the southbound discovery
+ * modules and from other ONOS instances. These updates are processed and
+ * applied to the in-memory topology instance.
* <p/>
* - Maintain Invariant/Relationships between Topology Objects.
* <p/>
@@ -41,7 +43,7 @@
* TODO TBD: This class may delay the requested change to handle event
* re-ordering. e.g.) Link Add came in, but Switch was not there.
*/
-public class TopologyManager implements NetworkGraphDiscoveryInterface {
+public class TopologyManager implements TopologyDiscoveryInterface {
private static final Logger log = LoggerFactory
.getLogger(TopologyManager.class);
@@ -50,10 +52,10 @@
public static final String EVENT_CHANNEL_NAME = "onos.topology";
private EventHandler eventHandler = new EventHandler();
- private final NetworkGraphDatastore datastore;
- private final NetworkGraphImpl networkGraph = new NetworkGraphImpl();
+ private final TopologyDatastore datastore;
+ private final TopologyImpl topology = new TopologyImpl();
private final IControllerRegistryService registryService;
- private CopyOnWriteArrayList<INetworkGraphListener> networkGraphListeners;
+ private CopyOnWriteArrayList<ITopologyListener> topologyListeners;
//
// Local state for keeping track of reordered events.
@@ -98,24 +100,23 @@
/**
* Constructor.
*
- * @param registryService the Registry Service to use.
- * @param networkGraphListeners the collection of Network Graph Listeners
- * to use.
+ * @param registryService the Registry Service to use.
+ * @param topologyListeners the collection of topology listeners to use.
*/
public TopologyManager(IControllerRegistryService registryService,
- CopyOnWriteArrayList<INetworkGraphListener> networkGraphListeners) {
- datastore = new NetworkGraphDatastore();
+ CopyOnWriteArrayList<ITopologyListener> topologyListeners) {
+ datastore = new TopologyDatastore();
this.registryService = registryService;
- this.networkGraphListeners = networkGraphListeners;
+ this.topologyListeners = topologyListeners;
}
/**
- * Get the Network Graph.
+ * Get the Topology.
*
- * @return the Network Graph.
+ * @return the Topology.
*/
- NetworkGraph getNetworkGraph() {
- return networkGraph;
+ Topology getTopology() {
+ return topology;
}
/**
@@ -271,9 +272,9 @@
}
//
- // Lock the Network Graph while it is modified
+ // Lock the topology while it is modified
//
- networkGraph.acquireWriteLock();
+ topology.acquireWriteLock();
try {
//
@@ -319,15 +320,15 @@
} finally {
//
- // Network Graph modifications completed: Release the lock
+ // Topology modifications completed: Release the lock
//
- networkGraph.releaseWriteLock();
+ topology.releaseWriteLock();
}
//
// Dispatch the Topology Notification Events to the applications
//
- dispatchNetworkGraphEvents();
+ dispatchTopologyEvents();
}
/**
@@ -382,9 +383,9 @@
}
/**
- * Dispatch Network Graph Events to the listeners.
+ * Dispatch Topology Events to the listeners.
*/
- private void dispatchNetworkGraphEvents() {
+ private void dispatchTopologyEvents() {
if (apiAddedSwitchEvents.isEmpty() &&
apiRemovedSwitchEvents.isEmpty() &&
apiAddedPortEvents.isEmpty() &&
@@ -402,35 +403,35 @@
// TODO: Those statements should be removed in the future
//
for (SwitchEvent switchEvent : apiAddedSwitchEvents) {
- log.debug("Dispatch Network Graph Event: ADDED {}", switchEvent);
+ log.debug("Dispatch Topology Event: ADDED {}", switchEvent);
}
for (SwitchEvent switchEvent : apiRemovedSwitchEvents) {
- log.debug("Dispatch Network Graph Event: REMOVED {}", switchEvent);
+ log.debug("Dispatch Topology Event: REMOVED {}", switchEvent);
}
for (PortEvent portEvent : apiAddedPortEvents) {
- log.debug("Dispatch Network Graph Event: ADDED {}", portEvent);
+ log.debug("Dispatch Topology Event: ADDED {}", portEvent);
}
for (PortEvent portEvent : apiRemovedPortEvents) {
- log.debug("Dispatch Network Graph Event: REMOVED {}", portEvent);
+ log.debug("Dispatch Topology Event: REMOVED {}", portEvent);
}
for (LinkEvent linkEvent : apiAddedLinkEvents) {
- log.debug("Dispatch Network Graph Event: ADDED {}", linkEvent);
+ log.debug("Dispatch Topology Event: ADDED {}", linkEvent);
}
for (LinkEvent linkEvent : apiRemovedLinkEvents) {
- log.debug("Dispatch Network Graph Event: REMOVED {}", linkEvent);
+ log.debug("Dispatch Topology Event: REMOVED {}", linkEvent);
}
for (DeviceEvent deviceEvent : apiAddedDeviceEvents) {
- log.debug("Dispatch Network Graph Event: ADDED {}", deviceEvent);
+ log.debug("Dispatch Topology Event: ADDED {}", deviceEvent);
}
for (DeviceEvent deviceEvent : apiRemovedDeviceEvents) {
- log.debug("Dispatch Network Graph Event: REMOVED {}", deviceEvent);
+ log.debug("Dispatch Topology Event: REMOVED {}", deviceEvent);
}
}
// Deliver the events
- for (INetworkGraphListener listener : this.networkGraphListeners) {
+ for (ITopologyListener listener : this.topologyListeners) {
// TODO: Should copy before handing them over to listener?
- listener.networkGraphEvents(apiAddedSwitchEvents,
+ listener.topologyEvents(apiAddedSwitchEvents,
apiRemovedSwitchEvents,
apiAddedPortEvents,
apiRemovedPortEvents,
@@ -747,7 +748,7 @@
// Send out notification
TopologyEvent topologyEvent = new TopologyEvent(deviceEvent);
eventChannel.addEntry(topologyEvent.getID(), topologyEvent);
- log.debug("Put the device info into the cache of the graph. mac {}", deviceEvent.getMac());
+ log.debug("Put the device info into the cache of the topology. mac {}", deviceEvent.getMac());
// Store the new Device Event in the local cache
// TODO: The implementation below is probably wrong
@@ -775,7 +776,7 @@
if (datastore.removeDevice(deviceEvent)) {
// Send out notification
eventChannel.removeEntry(deviceEvent.getID());
- log.debug("Remove the device info into the cache of the graph. mac {}", deviceEvent.getMac());
+ log.debug("Remove the device info into the cache of the topology. mac {}", deviceEvent.getMac());
// Cleanup the Device Event from the local cache
// TODO: The implementation below is probably wrong
@@ -791,15 +792,15 @@
}
/**
- * Add a switch to the Network Graph.
+ * Add a switch to the topology.
*
* @param switchEvent the Switch Event with the switch to add.
*/
private void addSwitch(SwitchEvent switchEvent) {
- Switch sw = networkGraph.getSwitch(switchEvent.getDpid());
+ Switch sw = topology.getSwitch(switchEvent.getDpid());
if (sw == null) {
- sw = new SwitchImpl(networkGraph, switchEvent.getDpid());
- networkGraph.putSwitch(sw);
+ sw = new SwitchImpl(topology, switchEvent.getDpid());
+ topology.putSwitch(sw);
} else {
// TODO: Update the switch attributes
// TODO: Nothing to do for now
@@ -809,12 +810,12 @@
}
/**
- * Remove a switch from the Network Graph.
+ * Remove a switch from the topology.
*
* @param switchEvent the Switch Event with the switch to remove.
*/
private void removeSwitch(SwitchEvent switchEvent) {
- Switch sw = networkGraph.getSwitch(switchEvent.getDpid());
+ Switch sw = topology.getSwitch(switchEvent.getDpid());
if (sw == null) {
log.warn("Switch {} already removed, ignoring", switchEvent);
return;
@@ -835,17 +836,17 @@
removePort(portEvent);
}
- networkGraph.removeSwitch(switchEvent.getDpid());
+ topology.removeSwitch(switchEvent.getDpid());
apiRemovedSwitchEvents.add(switchEvent);
}
/**
- * Add a port to the Network Graph.
+ * Add a port to the topology.
*
* @param portEvent the Port Event with the port to add.
*/
private void addPort(PortEvent portEvent) {
- Switch sw = networkGraph.getSwitch(portEvent.getDpid());
+ Switch sw = topology.getSwitch(portEvent.getDpid());
if (sw == null) {
// Reordered event: delay the event in local cache
ByteBuffer id = portEvent.getIDasByteBuffer();
@@ -856,7 +857,7 @@
Port port = sw.getPort(portEvent.getNumber());
if (port == null) {
- port = new PortImpl(networkGraph, sw, portEvent.getNumber());
+ port = new PortImpl(topology, sw, portEvent.getNumber());
switchImpl.addPort(port);
} else {
// TODO: Update the port attributes
@@ -866,12 +867,12 @@
}
/**
- * Remove a port from the Network Graph.
+ * Remove a port from the topology.
*
* @param portEvent the Port Event with the port to remove.
*/
private void removePort(PortEvent portEvent) {
- Switch sw = networkGraph.getSwitch(portEvent.getDpid());
+ Switch sw = topology.getSwitch(portEvent.getDpid());
if (sw == null) {
log.warn("Parent Switch for Port {} already removed, ignoring",
portEvent);
@@ -930,14 +931,14 @@
}
/**
- * Add a link to the Network Graph.
+ * Add a link to the topology.
*
* @param linkEvent the Link Event with the link to add.
*/
private void addLink(LinkEvent linkEvent) {
- Port srcPort = networkGraph.getPort(linkEvent.getSrc().dpid,
+ Port srcPort = topology.getPort(linkEvent.getSrc().dpid,
linkEvent.getSrc().number);
- Port dstPort = networkGraph.getPort(linkEvent.getDst().dpid,
+ Port dstPort = topology.getPort(linkEvent.getDst().dpid,
linkEvent.getDst().number);
if ((srcPort == null) || (dstPort == null)) {
// Reordered event: delay the event in local cache
@@ -950,8 +951,8 @@
Link link = dstPort.getIncomingLink();
assert (link == srcPort.getOutgoingLink());
if (link == null) {
- link = new LinkImpl(networkGraph, srcPort, dstPort);
- networkGraph.putLink(link);
+ link = new LinkImpl(topology, srcPort, dstPort);
+ topology.putLink(link);
// Remove all Devices attached to the Ports
ArrayList<DeviceEvent> devicesToRemove = new ArrayList<>();
@@ -983,12 +984,12 @@
}
/**
- * Remove a link from the Network Graph.
+ * Remove a link from the topology.
*
* @param linkEvent the Link Event with the link to remove.
*/
private void removeLink(LinkEvent linkEvent) {
- Port srcPort = networkGraph.getPort(linkEvent.getSrc().dpid,
+ Port srcPort = topology.getPort(linkEvent.getSrc().dpid,
linkEvent.getSrc().number);
if (srcPort == null) {
log.warn("Src Port for Link {} already removed, ignoring",
@@ -996,7 +997,7 @@
return;
}
- Port dstPort = networkGraph.getPort(linkEvent.getDst().dpid,
+ Port dstPort = topology.getPort(linkEvent.getDst().dpid,
linkEvent.getDst().number);
if (dstPort == null) {
log.warn("Dst Port for Link {} already removed, ignoring",
@@ -1019,14 +1020,14 @@
// TODO should we check that we get the same link from each port?
if (link != null) {
- networkGraph.removeLink(link);
+ topology.removeLink(link);
}
apiRemovedLinkEvents.add(linkEvent);
}
/**
- * Add a device to the Network Graph.
+ * Add a device to the topology.
* <p/>
* TODO: Device-related work is incomplete.
* TODO: Eventually, we might need to consider reordering
@@ -1035,12 +1036,12 @@
* @param deviceEvent the Device Event with the device to add.
*/
private void addDevice(DeviceEvent deviceEvent) {
- log.debug("Adding a device to the Network Graph with mac {}", deviceEvent.getMac());
- Device device = networkGraph.getDeviceByMac(deviceEvent.getMac());
+ log.debug("Adding a device to the topology with mac {}", deviceEvent.getMac());
+ Device device = topology.getDeviceByMac(deviceEvent.getMac());
if (device == null) {
- log.debug("Existing device was not found in the NetworkGraph: Adding new device: mac {}", deviceEvent.getMac());
- device = new DeviceImpl(networkGraph, deviceEvent.getMac());
+ log.debug("Existing device was not found in the Topology: Adding new device: mac {}", deviceEvent.getMac());
+ device = new DeviceImpl(topology, deviceEvent.getMac());
}
DeviceImpl deviceImpl = getDeviceImpl(device);
@@ -1049,7 +1050,7 @@
boolean attachmentFound = false;
for (SwitchPort swp : deviceEvent.getAttachmentPoints()) {
// Attached Ports must exist
- Port port = networkGraph.getPort(swp.dpid, swp.number);
+ Port port = topology.getPort(swp.dpid, swp.number);
if (port == null) {
// Reordered event: delay the event in local cache
ByteBuffer id = deviceEvent.getIDasByteBuffer();
@@ -1072,24 +1073,24 @@
attachmentFound = true;
}
- // Update the device in the Network Graph
+ // Update the device in the topology
if (attachmentFound) {
- log.debug("Storing the device info into the NetworkGraph: mac {}", deviceEvent.getMac());
- networkGraph.putDevice(device);
+ log.debug("Storing the device info into the Topology: mac {}", deviceEvent.getMac());
+ topology.putDevice(device);
apiAddedDeviceEvents.add(deviceEvent);
}
}
/**
- * Remove a device from the Network Graph.
+ * Remove a device from the topology.
* <p/>
* TODO: Device-related work is incomplete.
*
* @param deviceEvent the Device Event with the device to remove.
*/
private void removeDevice(DeviceEvent deviceEvent) {
- log.debug("Removing a device to the Network Graph: mac {}", deviceEvent.getMac());
- Device device = networkGraph.getDeviceByMac(deviceEvent.getMac());
+ log.debug("Removing a device to the topology: mac {}", deviceEvent.getMac());
+ Device device = topology.getDeviceByMac(deviceEvent.getMac());
if (device == null) {
log.warn("Device {} already removed, ignoring", deviceEvent);
return;
@@ -1099,7 +1100,7 @@
// Process each attachment point
for (SwitchPort swp : deviceEvent.getAttachmentPoints()) {
// Attached Ports must exist
- Port port = networkGraph.getPort(swp.dpid, swp.number);
+ Port port = topology.getPort(swp.dpid, swp.number);
if (port == null) {
log.warn("Port for the attachment point {} did not exist. skipping attachment point mutation", swp);
continue;
@@ -1111,8 +1112,8 @@
deviceImpl.removeAttachmentPoint(port);
}
- log.debug("Removing the device info into the NetworkGraph: mac {}", deviceEvent.getMac());
- networkGraph.removeDevice(device);
+ log.debug("Removing the device info into the Topology: mac {}", deviceEvent.getMac());
+ topology.removeDevice(device);
apiRemovedDeviceEvents.add(deviceEvent);
}
diff --git a/src/main/java/net/onrc/onos/core/topology/NetworkGraphModule.java b/src/main/java/net/onrc/onos/core/topology/TopologyModule.java
similarity index 68%
rename from src/main/java/net/onrc/onos/core/topology/NetworkGraphModule.java
rename to src/main/java/net/onrc/onos/core/topology/TopologyModule.java
index 77981d6..657682f 100644
--- a/src/main/java/net/onrc/onos/core/topology/NetworkGraphModule.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyModule.java
@@ -14,18 +14,17 @@
import net.floodlightcontroller.restserver.IRestApiService;
import net.onrc.onos.core.datagrid.IDatagridService;
import net.onrc.onos.core.registry.IControllerRegistryService;
-import net.onrc.onos.core.topology.web.NetworkGraphWebRoutable;
+import net.onrc.onos.core.topology.web.TopologyWebRoutable;
-public class NetworkGraphModule implements IFloodlightModule, INetworkGraphService {
+public class TopologyModule implements IFloodlightModule, ITopologyService {
// This is initialized as a module for now
private TopologyManager topologyManager;
- //private NetworkGraphDatastore southboundNetworkGraph;
private IDatagridService datagridService;
private IControllerRegistryService registryService;
- private CopyOnWriteArrayList<INetworkGraphListener> networkGraphListeners;
+ private CopyOnWriteArrayList<ITopologyListener> topologyListeners;
private IRestApiService restApi;
@@ -33,7 +32,7 @@
public Collection<Class<? extends IFloodlightService>> getModuleServices() {
List<Class<? extends IFloodlightService>> services =
new ArrayList<Class<? extends IFloodlightService>>();
- services.add(INetworkGraphService.class);
+ services.add(ITopologyService.class);
return services;
}
@@ -42,7 +41,7 @@
getServiceImpls() {
Map<Class<? extends IFloodlightService>, IFloodlightService> impls =
new HashMap<Class<? extends IFloodlightService>, IFloodlightService>();
- impls.put(INetworkGraphService.class, this);
+ impls.put(ITopologyService.class, this);
return impls;
}
@@ -63,35 +62,34 @@
datagridService = context.getServiceImpl(IDatagridService.class);
registryService = context.getServiceImpl(IControllerRegistryService.class);
- networkGraphListeners = new CopyOnWriteArrayList<>();
- topologyManager = new TopologyManager(registryService, networkGraphListeners);
- //southboundNetworkGraph = new NetworkGraphDatastore(networkGraph);
+ topologyListeners = new CopyOnWriteArrayList<>();
+ topologyManager = new TopologyManager(registryService, topologyListeners);
}
@Override
public void startUp(FloodlightModuleContext context) {
- restApi.addRestletRoutable(new NetworkGraphWebRoutable());
+ restApi.addRestletRoutable(new TopologyWebRoutable());
topologyManager.startup(datagridService);
}
@Override
- public NetworkGraph getNetworkGraph() {
- return topologyManager.getNetworkGraph();
+ public Topology getTopology() {
+ return topologyManager.getTopology();
}
@Override
- public NetworkGraphDiscoveryInterface getNetworkGraphDiscoveryInterface() {
+ public TopologyDiscoveryInterface getTopologyDiscoveryInterface() {
return topologyManager;
}
@Override
- public void registerNetworkGraphListener(INetworkGraphListener listener) {
- networkGraphListeners.addIfAbsent(listener);
+ public void registerTopologyListener(ITopologyListener listener) {
+ topologyListeners.addIfAbsent(listener);
}
@Override
- public void deregisterNetworkGraphListener(INetworkGraphListener listener) {
- networkGraphListeners.remove(listener);
+ public void deregisterTopologyListener(ITopologyListener listener) {
+ topologyListeners.remove(listener);
}
}
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyObject.java b/src/main/java/net/onrc/onos/core/topology/TopologyObject.java
new file mode 100644
index 0000000..fd2d0ce
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyObject.java
@@ -0,0 +1,12 @@
+package net.onrc.onos.core.topology;
+
+
+public class TopologyObject {
+
+ protected final Topology topology;
+
+ public TopologyObject(Topology topology) {
+ this.topology = topology;
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/core/topology/NetworkGraphPublisher.java b/src/main/java/net/onrc/onos/core/topology/TopologyPublisher.java
similarity index 86%
rename from src/main/java/net/onrc/onos/core/topology/NetworkGraphPublisher.java
rename to src/main/java/net/onrc/onos/core/topology/TopologyPublisher.java
index 6f9b332..6c90003 100644
--- a/src/main/java/net/onrc/onos/core/topology/NetworkGraphPublisher.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyPublisher.java
@@ -31,27 +31,27 @@
import org.slf4j.LoggerFactory;
/**
- * The NetworkGraphPublisher subscribes to topology network events from the
- * discovery modules. These events are reformatted and relayed to the topology
- * part of the network graph
+ * The TopologyPublisher subscribes to topology network events from the
+ * discovery modules. These events are reformatted and relayed to the in-memory
+ * topology instance.
*/
-public class NetworkGraphPublisher implements /*IOFSwitchListener,*/
+public class TopologyPublisher implements /*IOFSwitchListener,*/
IOFSwitchPortListener,
ILinkDiscoveryListener,
IFloodlightModule,
IOnosDeviceListener {
private static final Logger log =
- LoggerFactory.getLogger(NetworkGraphPublisher.class);
+ LoggerFactory.getLogger(TopologyPublisher.class);
private IFloodlightProviderService floodlightProvider;
private ILinkDiscoveryService linkDiscovery;
private IControllerRegistryService registryService;
- private INetworkGraphService networkGraphService;
+ private ITopologyService topologyService;
private IOnosDeviceService onosDeviceService;
- private NetworkGraph networkGraph;
- private NetworkGraphDiscoveryInterface networkGraphDiscoveryInterface;
+ private Topology topology;
+ private TopologyDiscoveryInterface topologyDiscoveryInterface;
private static final String ENABLE_CLEANUP_PROPERTY = "EnableCleanup";
private boolean cleanupEnabled = true;
@@ -59,7 +59,7 @@
private SingletonTask cleanupTask;
/**
- * Cleanup old switches from the network graph. Old switches are those
+ * Cleanup old switches from the topology. Old switches are those
* which have no controller in the registry.
*/
private class SwitchCleanup implements ControlChangeCallback, Runnable {
@@ -86,7 +86,7 @@
* registry.
*/
private void switchCleanup() {
- Iterable<Switch> switches = networkGraph.getSwitches();
+ Iterable<Switch> switches = topology.getSwitches();
if (log.isTraceEnabled()) {
log.trace("Checking for inactive switches");
@@ -110,7 +110,7 @@
/**
* Second half of the switch cleanup operation. If the registry grants
* control of a switch, we can be sure no other instance is writing
- * this switch to the network graph, so we can remove it now.
+ * this switch to the topology, so we can remove it now.
*
* @param dpid the dpid of the switch we requested control for
* @param hasControl whether we got control or not
@@ -122,7 +122,7 @@
HexString.toHexString(dpid));
SwitchEvent switchEvent = new SwitchEvent(dpid);
- networkGraphDiscoveryInterface.
+ topologyDiscoveryInterface.
removeSwitchDiscoveryEvent(switchEvent);
registryService.releaseControl(dpid);
}
@@ -137,13 +137,13 @@
switch (update.getOperation()) {
case LINK_ADDED:
- networkGraphDiscoveryInterface.putLinkDiscoveryEvent(linkEvent);
+ topologyDiscoveryInterface.putLinkDiscoveryEvent(linkEvent);
break;
case LINK_UPDATED:
// We don't use the LINK_UPDATED event (unsure what it means)
break;
case LINK_REMOVED:
- networkGraphDiscoveryInterface.removeLinkDiscoveryEvent(linkEvent);
+ topologyDiscoveryInterface.removeLinkDiscoveryEvent(linkEvent);
break;
default:
break;
@@ -153,14 +153,14 @@
@Override
public void switchPortAdded(Long switchId, OFPhysicalPort port) {
PortEvent portEvent = new PortEvent(switchId, (long) port.getPortNumber());
- networkGraphDiscoveryInterface.putPortDiscoveryEvent(portEvent);
+ topologyDiscoveryInterface.putPortDiscoveryEvent(portEvent);
linkDiscovery.removeFromSuppressLLDPs(switchId, port.getPortNumber());
}
@Override
public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
PortEvent portEvent = new PortEvent(switchId, (long) port.getPortNumber());
- networkGraphDiscoveryInterface.removePortDiscoveryEvent(portEvent);
+ topologyDiscoveryInterface.removePortDiscoveryEvent(portEvent);
}
@Override
@@ -176,7 +176,7 @@
for (OFPhysicalPort port : sw.getPorts()) {
portEvents.add(new PortEvent(sw.getId(), (long) port.getPortNumber()));
}
- networkGraphDiscoveryInterface
+ topologyDiscoveryInterface
.putSwitchDiscoveryEvent(switchEvent, portEvents);
for (OFPhysicalPort port : sw.getPorts()) {
@@ -226,7 +226,7 @@
l.add(ILinkDiscoveryService.class);
l.add(IThreadPoolService.class);
l.add(IControllerRegistryService.class);
- l.add(INetworkGraphService.class);
+ l.add(ITopologyService.class);
l.add(IOnosDeviceService.class);
return l;
}
@@ -239,7 +239,7 @@
registryService = context.getServiceImpl(IControllerRegistryService.class);
onosDeviceService = context.getServiceImpl(IOnosDeviceService.class);
- networkGraphService = context.getServiceImpl(INetworkGraphService.class);
+ topologyService = context.getServiceImpl(ITopologyService.class);
}
@Override
@@ -248,9 +248,9 @@
linkDiscovery.addListener(this);
onosDeviceService.addOnosDeviceListener(this);
- networkGraph = networkGraphService.getNetworkGraph();
- networkGraphDiscoveryInterface =
- networkGraphService.getNetworkGraphDiscoveryInterface();
+ topology = topologyService.getTopology();
+ topologyDiscoveryInterface =
+ topologyService.getTopologyDiscoveryInterface();
// Run the cleanup thread
String enableCleanup =
@@ -285,13 +285,13 @@
event.setLastSeenTime(device.getLastSeenTimestamp().getTime());
// Does not use vlan info now.
- networkGraphDiscoveryInterface.putDeviceDiscoveryEvent(event);
+ topologyDiscoveryInterface.putDeviceDiscoveryEvent(event);
}
@Override
public void onosDeviceRemoved(OnosDevice device) {
log.debug("Called onosDeviceRemoved");
DeviceEvent event = new DeviceEvent(device.getMacAddress());
- networkGraphDiscoveryInterface.removeDeviceDiscoveryEvent(event);
+ topologyDiscoveryInterface.removeDeviceDiscoveryEvent(event);
}
}
diff --git a/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphDevicesResource.java b/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphDevicesResource.java
deleted file mode 100644
index 84aaeba..0000000
--- a/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphDevicesResource.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.onrc.onos.core.topology.web;
-
-import java.io.IOException;
-
-import net.onrc.onos.core.topology.INetworkGraphService;
-import net.onrc.onos.core.topology.NetworkGraph;
-import net.onrc.onos.core.topology.serializers.DeviceSerializer;
-
-import org.codehaus.jackson.Version;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.module.SimpleModule;
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NetworkGraphDevicesResource extends ServerResource {
- private static final Logger log = LoggerFactory.getLogger(NetworkGraphDevicesResource.class);
-
- @Get("json")
- public String retrieve() {
- INetworkGraphService networkGraphService = (INetworkGraphService) getContext().getAttributes().
- get(INetworkGraphService.class.getCanonicalName());
-
- NetworkGraph graph = networkGraphService.getNetworkGraph();
-
- ObjectMapper mapper = new ObjectMapper();
- SimpleModule module = new SimpleModule("module", new Version(1, 0, 0, null));
- module.addSerializer(new DeviceSerializer());
- mapper.registerModule(module);
-
- graph.acquireReadLock();
- try {
- return mapper.writeValueAsString(graph.getDevices());
- } catch (IOException e) {
- log.error("Error writing device list to JSON", e);
- return "";
- } finally {
- graph.releaseReadLock();
- }
- }
-
-}
diff --git a/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphLinksResource.java b/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphLinksResource.java
deleted file mode 100644
index 8d4bc93..0000000
--- a/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphLinksResource.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.onrc.onos.core.topology.web;
-
-import java.io.IOException;
-
-import net.onrc.onos.core.topology.INetworkGraphService;
-import net.onrc.onos.core.topology.NetworkGraph;
-import net.onrc.onos.core.topology.serializers.LinkSerializer;
-
-import org.codehaus.jackson.Version;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.module.SimpleModule;
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NetworkGraphLinksResource extends ServerResource {
-
- private static final Logger log = LoggerFactory.getLogger(NetworkGraphLinksResource.class);
-
- @Get("json")
- public String retrieve() {
- INetworkGraphService networkGraphService = (INetworkGraphService) getContext().getAttributes().
- get(INetworkGraphService.class.getCanonicalName());
-
- NetworkGraph graph = networkGraphService.getNetworkGraph();
-
- ObjectMapper mapper = new ObjectMapper();
- SimpleModule module = new SimpleModule("module", new Version(1, 0, 0, null));
- module.addSerializer(new LinkSerializer());
- mapper.registerModule(module);
-
- try {
- graph.acquireReadLock();
- return mapper.writeValueAsString(graph.getLinks());
- } catch (IOException e) {
- log.error("Error writing link list to JSON", e);
- return "";
- } finally {
- graph.releaseReadLock();
- }
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/topology/web/TopologyDevicesResource.java b/src/main/java/net/onrc/onos/core/topology/web/TopologyDevicesResource.java
new file mode 100644
index 0000000..23f86e8
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/topology/web/TopologyDevicesResource.java
@@ -0,0 +1,43 @@
+package net.onrc.onos.core.topology.web;
+
+import java.io.IOException;
+
+import net.onrc.onos.core.topology.ITopologyService;
+import net.onrc.onos.core.topology.Topology;
+import net.onrc.onos.core.topology.serializers.DeviceSerializer;
+
+import org.codehaus.jackson.Version;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.module.SimpleModule;
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TopologyDevicesResource extends ServerResource {
+ private static final Logger log = LoggerFactory.getLogger(TopologyDevicesResource.class);
+
+ @Get("json")
+ public String retrieve() {
+ ITopologyService topologyService = (ITopologyService) getContext().getAttributes().
+ get(ITopologyService.class.getCanonicalName());
+
+ Topology topology = topologyService.getTopology();
+
+ ObjectMapper mapper = new ObjectMapper();
+ SimpleModule module = new SimpleModule("module", new Version(1, 0, 0, null));
+ module.addSerializer(new DeviceSerializer());
+ mapper.registerModule(module);
+
+ topology.acquireReadLock();
+ try {
+ return mapper.writeValueAsString(topology.getDevices());
+ } catch (IOException e) {
+ log.error("Error writing device list to JSON", e);
+ return "";
+ } finally {
+ topology.releaseReadLock();
+ }
+ }
+
+}
diff --git a/src/main/java/net/onrc/onos/core/topology/web/TopologyLinksResource.java b/src/main/java/net/onrc/onos/core/topology/web/TopologyLinksResource.java
new file mode 100644
index 0000000..b1b6de0
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/topology/web/TopologyLinksResource.java
@@ -0,0 +1,43 @@
+package net.onrc.onos.core.topology.web;
+
+import java.io.IOException;
+
+import net.onrc.onos.core.topology.ITopologyService;
+import net.onrc.onos.core.topology.Topology;
+import net.onrc.onos.core.topology.serializers.LinkSerializer;
+
+import org.codehaus.jackson.Version;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.module.SimpleModule;
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TopologyLinksResource extends ServerResource {
+
+ private static final Logger log = LoggerFactory.getLogger(TopologyLinksResource.class);
+
+ @Get("json")
+ public String retrieve() {
+ ITopologyService topologyService = (ITopologyService) getContext().getAttributes().
+ get(ITopologyService.class.getCanonicalName());
+
+ Topology topology = topologyService.getTopology();
+
+ ObjectMapper mapper = new ObjectMapper();
+ SimpleModule module = new SimpleModule("module", new Version(1, 0, 0, null));
+ module.addSerializer(new LinkSerializer());
+ mapper.registerModule(module);
+
+ try {
+ topology.acquireReadLock();
+ return mapper.writeValueAsString(topology.getLinks());
+ } catch (IOException e) {
+ log.error("Error writing link list to JSON", e);
+ return "";
+ } finally {
+ topology.releaseReadLock();
+ }
+ }
+}
diff --git a/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphShortestPathResource.java b/src/main/java/net/onrc/onos/core/topology/web/TopologyShortestPathResource.java
similarity index 74%
rename from src/main/java/net/onrc/onos/core/topology/web/NetworkGraphShortestPathResource.java
rename to src/main/java/net/onrc/onos/core/topology/web/TopologyShortestPathResource.java
index d513804..29fd716 100644
--- a/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphShortestPathResource.java
+++ b/src/main/java/net/onrc/onos/core/topology/web/TopologyShortestPathResource.java
@@ -6,10 +6,10 @@
import net.onrc.onos.core.intent.ConstrainedBFSTree;
import net.onrc.onos.core.intent.Path;
-import net.onrc.onos.core.topology.INetworkGraphService;
+import net.onrc.onos.core.topology.ITopologyService;
import net.onrc.onos.core.topology.Link;
import net.onrc.onos.core.topology.LinkEvent;
-import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.Topology;
import net.onrc.onos.core.topology.Switch;
import net.onrc.onos.core.topology.serializers.LinkSerializer;
import net.onrc.onos.core.util.Dpid;
@@ -22,17 +22,17 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NetworkGraphShortestPathResource extends ServerResource {
+public class TopologyShortestPathResource extends ServerResource {
- private static final Logger log = LoggerFactory.getLogger(NetworkGraphShortestPathResource.class);
+ private static final Logger log = LoggerFactory.getLogger(TopologyShortestPathResource.class);
@Get("json")
public String retrieve() {
- INetworkGraphService networkGraphService =
- (INetworkGraphService) getContext().getAttributes().
- get(INetworkGraphService.class.getCanonicalName());
+ ITopologyService topologyService =
+ (ITopologyService) getContext().getAttributes().
+ get(ITopologyService.class.getCanonicalName());
- NetworkGraph graph = networkGraphService.getNetworkGraph();
+ Topology topology = topologyService.getTopology();
ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule("module", new Version(1, 0, 0, null));
@@ -53,9 +53,9 @@
// links.
//
try {
- graph.acquireReadLock();
- Switch srcSwitch = graph.getSwitch(srcDpid.value());
- Switch dstSwitch = graph.getSwitch(dstDpid.value());
+ topology.acquireReadLock();
+ Switch srcSwitch = topology.getSwitch(srcDpid.value());
+ Switch dstSwitch = topology.getSwitch(dstDpid.value());
if ((srcSwitch == null) || (dstSwitch == null)) {
return "";
}
@@ -63,7 +63,7 @@
Path path = bfsTree.getPath(dstSwitch);
List<Link> links = new LinkedList<>();
for (LinkEvent linkEvent : path) {
- Link link = graph.getLink(linkEvent.getSrc().getDpid(),
+ Link link = topology.getLink(linkEvent.getSrc().getDpid(),
linkEvent.getSrc().getNumber(),
linkEvent.getDst().getDpid(),
linkEvent.getDst().getNumber());
@@ -77,7 +77,7 @@
log.error("Error writing Shortest Path to JSON", e);
return "";
} finally {
- graph.releaseReadLock();
+ topology.releaseReadLock();
}
}
}
diff --git a/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphSwitchesResource.java b/src/main/java/net/onrc/onos/core/topology/web/TopologySwitchesResource.java
similarity index 60%
rename from src/main/java/net/onrc/onos/core/topology/web/NetworkGraphSwitchesResource.java
rename to src/main/java/net/onrc/onos/core/topology/web/TopologySwitchesResource.java
index 3a053e5..0ac8321 100644
--- a/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphSwitchesResource.java
+++ b/src/main/java/net/onrc/onos/core/topology/web/TopologySwitchesResource.java
@@ -2,8 +2,8 @@
import java.io.IOException;
-import net.onrc.onos.core.topology.INetworkGraphService;
-import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.ITopologyService;
+import net.onrc.onos.core.topology.Topology;
import net.onrc.onos.core.topology.serializers.PortSerializer;
import net.onrc.onos.core.topology.serializers.SwitchSerializer;
@@ -15,16 +15,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NetworkGraphSwitchesResource extends ServerResource {
+public class TopologySwitchesResource extends ServerResource {
- private static final Logger log = LoggerFactory.getLogger(NetworkGraphSwitchesResource.class);
+ private static final Logger log = LoggerFactory.getLogger(TopologySwitchesResource.class);
@Get("json")
public String retrieve() {
- INetworkGraphService networkGraphService = (INetworkGraphService) getContext().getAttributes().
- get(INetworkGraphService.class.getCanonicalName());
+ ITopologyService topologyService = (ITopologyService) getContext().getAttributes().
+ get(ITopologyService.class.getCanonicalName());
- NetworkGraph graph = networkGraphService.getNetworkGraph();
+ Topology topology = topologyService.getTopology();
ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule("module", new Version(1, 0, 0, null));
@@ -33,13 +33,13 @@
mapper.registerModule(module);
try {
- graph.acquireReadLock();
- return mapper.writeValueAsString(graph.getSwitches());
+ topology.acquireReadLock();
+ return mapper.writeValueAsString(topology.getSwitches());
} catch (IOException e) {
log.error("Error writing switch list to JSON", e);
return "";
} finally {
- graph.releaseReadLock();
+ topology.releaseReadLock();
}
}
}
diff --git a/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphWebRoutable.java b/src/main/java/net/onrc/onos/core/topology/web/TopologyWebRoutable.java
similarity index 72%
rename from src/main/java/net/onrc/onos/core/topology/web/NetworkGraphWebRoutable.java
rename to src/main/java/net/onrc/onos/core/topology/web/TopologyWebRoutable.java
index c0cf272..cef3ac3 100644
--- a/src/main/java/net/onrc/onos/core/topology/web/NetworkGraphWebRoutable.java
+++ b/src/main/java/net/onrc/onos/core/topology/web/TopologyWebRoutable.java
@@ -6,7 +6,7 @@
import org.restlet.Restlet;
import org.restlet.routing.Router;
-public class NetworkGraphWebRoutable implements RestletRoutable {
+public class TopologyWebRoutable implements RestletRoutable {
@Override
public Restlet getRestlet(Context context) {
@@ -17,11 +17,11 @@
router.attach("/ds/ports/json", DatastorePortsResource.class);
// Topology API
- router.attach("/switches/json", NetworkGraphSwitchesResource.class);
- router.attach("/links/json", NetworkGraphLinksResource.class);
- router.attach("/devices/json", NetworkGraphDevicesResource.class);
+ router.attach("/switches/json", TopologySwitchesResource.class);
+ router.attach("/links/json", TopologyLinksResource.class);
+ router.attach("/devices/json", TopologyDevicesResource.class);
// TODO: Move the Shortest Path REST API to the Intent framework
- router.attach("/shortest-path/{src-dpid}/{dst-dpid}/json", NetworkGraphShortestPathResource.class);
+ router.attach("/shortest-path/{src-dpid}/{dst-dpid}/json", TopologyShortestPathResource.class);
return router;
}
diff --git a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
index 3365c59..190c425 100644
--- a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
+++ b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
@@ -1,5 +1,5 @@
net.floodlightcontroller.core.FloodlightProvider
-net.onrc.onos.core.topology.NetworkGraphPublisher
+net.onrc.onos.core.topology.TopologyPublisher
net.onrc.onos.core.linkdiscovery.internal.LinkDiscoveryManager
net.floodlightcontroller.topology.TopologyManager
net.floodlightcontroller.forwarding.Forwarding
@@ -18,7 +18,7 @@
net.onrc.onos.apps.proxyarp.ProxyArpManager
net.onrc.onos.core.main.config.DefaultConfiguration
net.onrc.onos.core.devicemanager.OnosDeviceManager
-net.onrc.onos.core.topology.NetworkGraphModule
+net.onrc.onos.core.topology.TopologyModule
net.onrc.onos.core.intent.runtime.PathCalcRuntimeModule
net.onrc.onos.core.intent.runtime.PlanInstallModule
net.onrc.onos.core.packetservice.PacketModule
diff --git a/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java b/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java
index 13385f4..7453a68 100644
--- a/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java
+++ b/src/test/java/net/onrc/onos/apps/proxyarp/ProxyArpManagerTest.java
@@ -29,8 +29,8 @@
import net.onrc.onos.core.packet.IPv4;
import net.onrc.onos.core.packetservice.SinglePacketOutNotification;
import net.onrc.onos.core.topology.Device;
-import net.onrc.onos.core.topology.INetworkGraphService;
-import net.onrc.onos.core.topology.NetworkGraph;
+import net.onrc.onos.core.topology.ITopologyService;
+import net.onrc.onos.core.topology.Topology;
import net.onrc.onos.core.topology.Port;
import net.onrc.onos.core.topology.Switch;
@@ -56,7 +56,7 @@
IRestApiService restApiService;
IDatagridService datagridService;
IFlowPusherService flowPusherService;
- INetworkGraphService networkGraphService;
+ ITopologyService topologyService;
IOnosDeviceService onosDeviceService;
IPacketService packetService;
Map<String, String> config;
@@ -71,7 +71,7 @@
ARP arpRequest, arpReply, rarpRequest;
Ethernet ethArpRequest, ethArpReply, ethRarpRequest, ethArpOtherOp;
- NetworkGraph ng;
+ Topology topology;
IEventChannel eg;
IEventChannelListener el;
Device dev1;
@@ -212,14 +212,14 @@
restApiService = EasyMock.createMock(IRestApiService.class);
datagridService = EasyMock.createMock(IDatagridService.class);
flowPusherService = EasyMock.createMock(IFlowPusherService.class);
- networkGraphService = EasyMock.createMock(INetworkGraphService.class);
+ topologyService = EasyMock.createMock(ITopologyService.class);
onosDeviceService = EasyMock.createMock(IOnosDeviceService.class);
packetService = EasyMock.createMock(IPacketService.class);
eg = EasyMock.createMock(IEventChannel.class);
el = EasyMock.createMock(IEventChannelListener.class);
- //Mock NetworkGraph related data
- ng = EasyMock.createMock(NetworkGraph.class);
+ //Mock Topology related data
+ topology = EasyMock.createMock(Topology.class);
dev1 = EasyMock.createMock(Device.class);
inPort1 = EasyMock.createMock(Port.class);
outPort1 = EasyMock.createMock(Port.class);
@@ -241,7 +241,7 @@
EasyMock.expect(context.getServiceImpl(IRestApiService.class)).andReturn(restApiService);
EasyMock.expect(context.getServiceImpl(IDatagridService.class)).andReturn(datagridService);
EasyMock.expect(context.getServiceImpl(IFlowPusherService.class)).andReturn(flowPusherService);
- EasyMock.expect(context.getServiceImpl(INetworkGraphService.class)).andReturn(networkGraphService);
+ EasyMock.expect(context.getServiceImpl(ITopologyService.class)).andReturn(topologyService);
EasyMock.expect(context.getServiceImpl(IOnosDeviceService.class)).andReturn(onosDeviceService);
EasyMock.expect(context.getServiceImpl(IPacketService.class)).andReturn(packetService);
}
@@ -258,7 +258,7 @@
EasyMock.expectLastCall();
packetService.registerPacketListener(arpManager);
EasyMock.expectLastCall();
- EasyMock.expect(networkGraphService.getNetworkGraph()).andReturn(ng);
+ EasyMock.expect(topologyService.getTopology()).andReturn(topology);
EasyMock.expect(datagridService.addListener((String)EasyMock.anyObject(), EasyMock.isA(IEventChannelListener.class),
(Class)EasyMock.anyObject(), (Class)EasyMock.anyObject())).andReturn(eg).anyTimes();
List<ArpCacheNotification> list = new ArrayList<ArpCacheNotification>();
@@ -281,7 +281,7 @@
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- networkGraphService, onosDeviceService, packetService, ng, eg, el, dev1, inPort1, sw1);
+ topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
assertEquals(defaultStrAgingMsec, String.valueOf(arpManager.getArpEntryTimeout()));
@@ -298,7 +298,7 @@
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- networkGraphService, onosDeviceService, packetService, ng, eg, el, dev1, inPort1, sw1);
+ topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
assertEquals(defaultStrAgingMsec, String.valueOf(arpManager.getArpEntryTimeout()));
@@ -314,7 +314,7 @@
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- networkGraphService, onosDeviceService, packetService, ng, eg, el, dev1, inPort1, sw1);
+ topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
assertEquals(strAgingMsec, String.valueOf(arpManager.getArpEntryTimeout()));
@@ -327,7 +327,7 @@
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- networkGraphService, onosDeviceService, packetService, ng, eg, el, dev1, inPort1, sw1);
+ topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
MACAddress mac = arpManager.getMacAddress(cachedIp1);
@@ -340,7 +340,7 @@
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- networkGraphService, onosDeviceService, packetService, ng, eg, el, dev1, inPort1, sw1);
+ topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
List<String> list = arpManager.getMappings();
@@ -355,7 +355,7 @@
EasyMock.expect(context.getConfigParams(arpManager)).andReturn(config);
EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- networkGraphService, onosDeviceService, packetService, ng, eg, el, dev1, inPort1, sw1);
+ topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
arpManager.receive(sw1, inPort1, ethRarpRequest);
@@ -369,7 +369,7 @@
prepareExpectForLearnArp();
EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- networkGraphService, onosDeviceService, packetService, ng, eg, el, dev1, inPort1, sw1);
+ topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
arpManager.receive(sw1, inPort1, ethArpOtherOp);
@@ -389,7 +389,7 @@
EasyMock.expect(context.getServiceImpl(IDatagridService.class)).andReturn(datagridService);
EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- networkGraphService, onosDeviceService, packetService, ng, eg, el, dev1, inPort1, sw1);
+ topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
arpManager.receive(sw1, inPort1, ethArpReply);
@@ -406,7 +406,7 @@
EasyMock.expect(configInfoService.isInterfaceAddress(dstIp)).andReturn(false);
EasyMock.replay(context, floodligthProviderService, configInfoService, restApiService, datagridService, flowPusherService,
- networkGraphService, onosDeviceService, packetService, ng, eg, el, dev1, inPort1, sw1);
+ topologyService, onosDeviceService, packetService, topology, eg, el, dev1, inPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
arpManager.receive(sw1, inPort1, ethArpRequest);
@@ -423,17 +423,17 @@
prepareExpectForLearnArp();
EasyMock.expect(configInfoService.fromExternalNetwork(EasyMock.anyLong(), EasyMock.anyShort())).andReturn(false);
- ng.acquireReadLock();
+ topology.acquireReadLock();
EasyMock.expectLastCall();
- EasyMock.expect(ng.getDeviceByMac(dstMac)).andReturn(dev1);
- ng.releaseReadLock();
+ EasyMock.expect(topology.getDeviceByMac(dstMac)).andReturn(dev1);
+ topology.releaseReadLock();
EasyMock.expectLastCall();
EasyMock.expect(dev1.getAttachmentPoints()).andReturn(portList);
eg.addTransientEntry(EasyMock.anyLong(), (SinglePacketOutNotification)EasyMock.anyObject());
EasyMock.expectLastCall();
EasyMock.replay(context, configInfoService, restApiService, floodligthProviderService,
- networkGraphService, datagridService, eg, ng, dev1, inPort1, outPort1, sw1);
+ topologyService, datagridService, eg, topology, dev1, inPort1, outPort1, sw1);
arpManager.init(context);
arpManager.startUp(context);
arpManager.receive(sw1, inPort1, ethArpRequest);
diff --git a/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java b/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java
index a99fc10..8d5a6d6 100644
--- a/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/ConstrainedBFSTreeTest.java
@@ -26,81 +26,81 @@
@Test
public void testCreate() {
- MockNetworkGraph graph = new MockNetworkGraph();
- graph.createSampleTopology1();
- ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L));
+ MockTopology topology = new MockTopology();
+ topology.createSampleTopology1();
+ ConstrainedBFSTree tree = new ConstrainedBFSTree(topology.getSwitch(1L));
assertNotNull(tree);
}
@Test
public void testCreateConstrained() {
- MockNetworkGraph graph = new MockNetworkGraph();
- graph.createSampleTopology1();
+ MockTopology topology = new MockTopology();
+ topology.createSampleTopology1();
PathIntentMap intents = new PathIntentMap();
- ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 1000.0);
+ ConstrainedBFSTree tree = new ConstrainedBFSTree(topology.getSwitch(1L), intents, 1000.0);
assertNotNull(tree);
}
@Test
public void testGetPath() {
- MockNetworkGraph graph = new MockNetworkGraph();
- graph.createSampleTopology1();
- ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L));
- Path path11 = tree.getPath(graph.getSwitch(1L));
- Path path12 = tree.getPath(graph.getSwitch(2L));
- Path path13 = tree.getPath(graph.getSwitch(3L));
- Path path14 = tree.getPath(graph.getSwitch(4L));
+ MockTopology topology = new MockTopology();
+ topology.createSampleTopology1();
+ ConstrainedBFSTree tree = new ConstrainedBFSTree(topology.getSwitch(1L));
+ Path path11 = tree.getPath(topology.getSwitch(1L));
+ Path path12 = tree.getPath(topology.getSwitch(2L));
+ Path path13 = tree.getPath(topology.getSwitch(3L));
+ Path path14 = tree.getPath(topology.getSwitch(4L));
assertNotNull(path11);
assertEquals(0, path11.size());
assertNotNull(path12);
assertEquals(1, path12.size());
- assertEquals(new LinkEvent(graph.getOutgoingLink(1L, 12L)), path12.get(0));
+ assertEquals(new LinkEvent(topology.getOutgoingLink(1L, 12L)), path12.get(0));
assertNotNull(path13);
assertEquals(2, path13.size());
if (path13.get(0).getDst().getDpid() == 2L) {
- assertEquals(new LinkEvent(graph.getOutgoingLink(1L, 12L)), path13.get(0));
- assertEquals(new LinkEvent(graph.getOutgoingLink(2L, 23L)), path13.get(1));
+ assertEquals(new LinkEvent(topology.getOutgoingLink(1L, 12L)), path13.get(0));
+ assertEquals(new LinkEvent(topology.getOutgoingLink(2L, 23L)), path13.get(1));
} else {
- assertEquals(new LinkEvent(graph.getOutgoingLink(1L, 14L)), path13.get(0));
- assertEquals(new LinkEvent(graph.getOutgoingLink(4L, 43L)), path13.get(1));
+ assertEquals(new LinkEvent(topology.getOutgoingLink(1L, 14L)), path13.get(0));
+ assertEquals(new LinkEvent(topology.getOutgoingLink(4L, 43L)), path13.get(1));
}
assertNotNull(path14);
assertEquals(1, path14.size());
- assertEquals(new LinkEvent(graph.getOutgoingLink(1L, 14L)), path14.get(0));
+ assertEquals(new LinkEvent(topology.getOutgoingLink(1L, 14L)), path14.get(0));
}
@Test
public void testGetPathNull() {
- MockNetworkGraph graph = new MockNetworkGraph();
- graph.createSampleTopology1();
- graph.removeLink(1L, 12L, 2L, 21L);
- graph.removeLink(1L, 14L, 4L, 41L);
+ MockTopology topology = new MockTopology();
+ topology.createSampleTopology1();
+ topology.removeLink(1L, 12L, 2L, 21L);
+ topology.removeLink(1L, 14L, 4L, 41L);
// now, there is no path from switch 1, but to switch1
- ConstrainedBFSTree tree1 = new ConstrainedBFSTree(graph.getSwitch(1L));
- Path path12 = tree1.getPath(graph.getSwitch(2L));
- Path path13 = tree1.getPath(graph.getSwitch(3L));
- Path path14 = tree1.getPath(graph.getSwitch(4L));
+ ConstrainedBFSTree tree1 = new ConstrainedBFSTree(topology.getSwitch(1L));
+ Path path12 = tree1.getPath(topology.getSwitch(2L));
+ Path path13 = tree1.getPath(topology.getSwitch(3L));
+ Path path14 = tree1.getPath(topology.getSwitch(4L));
- ConstrainedBFSTree tree2 = new ConstrainedBFSTree(graph.getSwitch(2L));
- Path path21 = tree2.getPath(graph.getSwitch(1L));
+ ConstrainedBFSTree tree2 = new ConstrainedBFSTree(topology.getSwitch(2L));
+ Path path21 = tree2.getPath(topology.getSwitch(1L));
assertNull(path12);
assertNull(path13);
assertNull(path14);
assertNotNull(path21);
assertEquals(1, path21.size());
- assertEquals(new LinkEvent(graph.getOutgoingLink(2L, 21L)), path21.get(0));
+ assertEquals(new LinkEvent(topology.getOutgoingLink(2L, 21L)), path21.get(0));
}
@Test
public void testGetConstrainedPath() {
- MockNetworkGraph graph = new MockNetworkGraph();
- graph.createSampleTopology1();
+ MockTopology topology = new MockTopology();
+ topology.createSampleTopology1();
PathIntentMap intents = new PathIntentMap();
IntentOperationList intentOps = new IntentOperationList();
@@ -111,33 +111,33 @@
"2", 1L, LOCAL_PORT, 0x333L, 2L, LOCAL_PORT, 0x444L, 600.0);
// calculate path of the intent1
- ConstrainedBFSTree tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 600.0);
- Path path1 = tree.getPath(graph.getSwitch(2L));
+ ConstrainedBFSTree tree = new ConstrainedBFSTree(topology.getSwitch(1L), intents, 600.0);
+ Path path1 = tree.getPath(topology.getSwitch(2L));
assertNotNull(path1);
assertEquals(1, path1.size());
- assertEquals(new LinkEvent(graph.getOutgoingLink(1L, 12L)), path1.get(0));
+ assertEquals(new LinkEvent(topology.getOutgoingLink(1L, 12L)), path1.get(0));
PathIntent pathIntent1 = new PathIntent("pi1", path1, 600.0, intent1);
intentOps.add(Operator.ADD, pathIntent1);
intents.executeOperations(intentOps);
// calculate path of the intent2
- tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 600.0);
- Path path2 = tree.getPath(graph.getSwitch(2L));
+ tree = new ConstrainedBFSTree(topology.getSwitch(1L), intents, 600.0);
+ Path path2 = tree.getPath(topology.getSwitch(2L));
assertNotNull(path2);
assertEquals(2, path2.size());
- assertEquals(new LinkEvent(graph.getOutgoingLink(1L, 14L)), path2.get(0));
- assertEquals(new LinkEvent(graph.getOutgoingLink(4L, 42L)), path2.get(1));
+ assertEquals(new LinkEvent(topology.getOutgoingLink(1L, 14L)), path2.get(0));
+ assertEquals(new LinkEvent(topology.getOutgoingLink(4L, 42L)), path2.get(1));
PathIntent pathIntent2 = new PathIntent("pi2", path2, 600.0, intent2);
intentOps.add(Operator.ADD, pathIntent2);
intents.executeOperations(intentOps);
// calculate path of the intent3
- tree = new ConstrainedBFSTree(graph.getSwitch(1L), intents, 600.0);
- Path path3 = tree.getPath(graph.getSwitch(2L));
+ tree = new ConstrainedBFSTree(topology.getSwitch(1L), intents, 600.0);
+ Path path3 = tree.getPath(topology.getSwitch(2L));
assertNull(path3);
}
diff --git a/src/test/java/net/onrc/onos/core/intent/MockNetworkGraph.java b/src/test/java/net/onrc/onos/core/intent/MockTopology.java
similarity index 84%
rename from src/test/java/net/onrc/onos/core/intent/MockNetworkGraph.java
rename to src/test/java/net/onrc/onos/core/intent/MockTopology.java
index d481182..680acc2 100644
--- a/src/test/java/net/onrc/onos/core/intent/MockNetworkGraph.java
+++ b/src/test/java/net/onrc/onos/core/intent/MockTopology.java
@@ -2,22 +2,22 @@
import net.onrc.onos.core.topology.Link;
import net.onrc.onos.core.topology.LinkImpl;
-import net.onrc.onos.core.topology.NetworkGraphImpl;
import net.onrc.onos.core.topology.Switch;
import net.onrc.onos.core.topology.SwitchImpl;
+import net.onrc.onos.core.topology.TopologyImpl;
/**
- * A mock class of NetworkGraph.
+ * A mock class of Topology.
* This class should be used only by test codes.
*
* @author Toshio Koide (t-koide@onlab.us)
*/
-public class MockNetworkGraph extends NetworkGraphImpl {
- // TODO this class doesn't seem like it should extend NetworkGraphImpl. It
- // isn't a NetworkGraph, it's more of a NetworkGraphBuilder - methods to
- // create an populate a fake network graph that's not based on discovery
+public class MockTopology extends TopologyImpl {
+ // TODO this class doesn't seem like it should extend TopologyImpl. It
+ // isn't a Topology, it's more of a TopologyBuilder - methods to
+ // create an populate a fake topology that's not based on discovery
// data from the driver modules.
- // We may well need a MockNetworkGraph, but that's not what this class is
+ // We may well need a MockTopology, but that's not what this class is
// doing.
public static Long LOCAL_PORT = 0xFFFEL;
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
index 5e1a11d..2d57cfe 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
@@ -20,7 +20,6 @@
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.restserver.IRestApiService;
-
import net.onrc.onos.core.datagrid.IDatagridService;
import net.onrc.onos.core.datagrid.IEventChannel;
import net.onrc.onos.core.datagrid.IEventChannelListener;
@@ -29,13 +28,13 @@
import net.onrc.onos.core.intent.IntentMap;
import net.onrc.onos.core.intent.IntentOperation.Operator;
import net.onrc.onos.core.intent.IntentOperationList;
-import net.onrc.onos.core.intent.MockNetworkGraph;
+import net.onrc.onos.core.intent.MockTopology;
import net.onrc.onos.core.intent.ShortestPathIntent;
import net.onrc.onos.core.intent.runtime.web.IntentWebRoutable;
import net.onrc.onos.core.registry.IControllerRegistryService;
import net.onrc.onos.core.topology.DeviceEvent;
-import net.onrc.onos.core.topology.INetworkGraphListener;
-import net.onrc.onos.core.topology.INetworkGraphService;
+import net.onrc.onos.core.topology.ITopologyListener;
+import net.onrc.onos.core.topology.ITopologyService;
import net.onrc.onos.core.topology.LinkEvent;
import net.onrc.onos.core.topology.PortEvent;
import net.onrc.onos.core.topology.SwitchEvent;
@@ -58,7 +57,7 @@
* <p/>
* Unit tests for the Path Calculation Runtime module (PathCalcRuntimeModule).
* These test cases check the results of creating paths, deleting paths, and
- * rerouting paths. The network graph, controller registry, and data grid are
+ * rerouting paths. The topology, controller registry, and data grid are
* mocked out. The individual tests check the high level intents and the
* resulting operation lists to be sure they match the intended APIs.
*/
@@ -69,22 +68,22 @@
private FloodlightModuleContext modContext;
private IDatagridService datagridService;
- private INetworkGraphService networkGraphService;
+ private ITopologyService topologyService;
private IControllerRegistryService controllerRegistryService;
private PersistIntent persistIntent;
private IRestApiService restApi;
- private MockNetworkGraph graph;
+ private MockTopology topology;
private IEventChannel<Long, IntentOperationList> intentOperationChannel;
private IEventChannel<Long, IntentStateList> intentStateChannel;
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
- graph = new MockNetworkGraph();
- graph.createSampleTopology1();
+ topology = new MockTopology();
+ topology.createSampleTopology1();
datagridService = createMock(IDatagridService.class);
- networkGraphService = createMock(INetworkGraphService.class);
+ topologyService = createMock(ITopologyService.class);
controllerRegistryService = createMock(IControllerRegistryService.class);
modContext = createMock(FloodlightModuleContext.class);
intentOperationChannel = createMock(IEventChannel.class);
@@ -97,8 +96,8 @@
expect(modContext.getServiceImpl(IDatagridService.class))
.andReturn(datagridService).once();
- expect(modContext.getServiceImpl(INetworkGraphService.class))
- .andReturn(networkGraphService).once();
+ expect(modContext.getServiceImpl(ITopologyService.class))
+ .andReturn(topologyService).once();
expect(modContext.getServiceImpl(IControllerRegistryService.class))
.andReturn(controllerRegistryService).once();
expect(persistIntent.getKey()).andReturn(1L).anyTimes();
@@ -108,10 +107,10 @@
expect(modContext.getServiceImpl(IRestApiService.class))
.andReturn(restApi).once();
- expect(networkGraphService.getNetworkGraph()).andReturn(graph)
+ expect(topologyService.getTopology()).andReturn(topology)
.anyTimes();
- networkGraphService.registerNetworkGraphListener(
- anyObject(INetworkGraphListener.class));
+ topologyService.registerTopologyListener(
+ anyObject(ITopologyListener.class));
expectLastCall();
expect(datagridService.createChannel("onos.pathintent",
@@ -127,7 +126,7 @@
restApi.addRestletRoutable(anyObject(IntentWebRoutable.class));
replay(datagridService);
- replay(networkGraphService);
+ replay(topologyService);
replay(modContext);
replay(controllerRegistryService);
PowerMock.replay(persistIntent, PersistIntent.class);
@@ -240,7 +239,7 @@
@After
public void tearDown() {
verify(datagridService);
- verify(networkGraphService);
+ verify(topologyService);
verify(modContext);
verify(controllerRegistryService);
PowerMock.verify(persistIntent, PersistIntent.class);
@@ -494,13 +493,13 @@
final List<LinkEvent> addedLinkEvents = new LinkedList<>();
final List<LinkEvent> removedLinkEvents = new LinkedList<>();
- graph.removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
- graph.removeLink(2L, 21L, 1L, 12L);
+ topology.removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
+ topology.removeLink(2L, 21L, 1L, 12L);
LinkEvent linkEvent1 = new LinkEvent(1L, 12L, 2L, 21L);
LinkEvent linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
removedLinkEvents.add(linkEvent1);
removedLinkEvents.add(linkEvent2);
- runtime.networkGraphEvents(
+ runtime.topologyEvents(
emptySwitchEvents,
emptySwitchEvents,
emptyPortEvents,
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
index f3c9aaa..8cacabc 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
@@ -25,19 +25,19 @@
import net.onrc.onos.core.intent.Intent.IntentState;
import net.onrc.onos.core.intent.IntentOperation.Operator;
import net.onrc.onos.core.intent.IntentOperationList;
-import net.onrc.onos.core.intent.MockNetworkGraph;
+import net.onrc.onos.core.intent.MockTopology;
import net.onrc.onos.core.intent.PathIntent;
import net.onrc.onos.core.intent.PathIntentMap;
import net.onrc.onos.core.intent.ShortestPathIntent;
import net.onrc.onos.core.intent.runtime.web.IntentWebRoutable;
import net.onrc.onos.core.registry.IControllerRegistryService;
import net.onrc.onos.core.topology.DeviceEvent;
-import net.onrc.onos.core.topology.INetworkGraphListener;
-import net.onrc.onos.core.topology.INetworkGraphService;
+import net.onrc.onos.core.topology.ITopologyListener;
+import net.onrc.onos.core.topology.ITopologyService;
import net.onrc.onos.core.topology.LinkEvent;
-import net.onrc.onos.core.topology.NetworkGraph;
import net.onrc.onos.core.topology.PortEvent;
import net.onrc.onos.core.topology.SwitchEvent;
+import net.onrc.onos.core.topology.Topology;
import org.junit.After;
import org.junit.Before;
@@ -57,10 +57,10 @@
@RunWith(PowerMockRunner.class)
@PrepareForTest(PathCalcRuntimeModule.class)
public class UseCaseTest {
- private NetworkGraph g;
+ private Topology topology;
private FloodlightModuleContext modContext;
private IDatagridService datagridService;
- private INetworkGraphService networkGraphService;
+ private ITopologyService topologyService;
private IControllerRegistryService controllerRegistryService;
private PersistIntent persistIntent;
private IRestApiService restApi;
@@ -72,12 +72,12 @@
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
- MockNetworkGraph graph = new MockNetworkGraph();
- graph.createSampleTopology1();
- g = graph;
+ MockTopology topology = new MockTopology();
+ topology.createSampleTopology1();
+ this.topology = topology;
datagridService = createMock(IDatagridService.class);
- networkGraphService = createMock(INetworkGraphService.class);
+ topologyService = createMock(ITopologyService.class);
controllerRegistryService = createMock(IControllerRegistryService.class);
modContext = createMock(FloodlightModuleContext.class);
intentOperationChannel = createMock(IEventChannel.class);
@@ -90,8 +90,8 @@
expect(modContext.getServiceImpl(IDatagridService.class))
.andReturn(datagridService).once();
- expect(modContext.getServiceImpl(INetworkGraphService.class))
- .andReturn(networkGraphService).once();
+ expect(modContext.getServiceImpl(ITopologyService.class))
+ .andReturn(topologyService).once();
expect(modContext.getServiceImpl(IControllerRegistryService.class))
.andReturn(controllerRegistryService).once();
expect(persistIntent.getKey()).andReturn(1L).anyTimes();
@@ -100,8 +100,8 @@
expect(modContext.getServiceImpl(IRestApiService.class))
.andReturn(restApi).once();
- expect(networkGraphService.getNetworkGraph()).andReturn(g).anyTimes();
- networkGraphService.registerNetworkGraphListener(anyObject(INetworkGraphListener.class));
+ expect(topologyService.getTopology()).andReturn(topology).anyTimes();
+ topologyService.registerTopologyListener(anyObject(ITopologyListener.class));
expectLastCall();
expect(datagridService.createChannel("onos.pathintent", Long.class, IntentOperationList.class))
@@ -116,7 +116,7 @@
restApi.addRestletRoutable(anyObject(IntentWebRoutable.class));
replay(datagridService);
- replay(networkGraphService);
+ replay(topologyService);
replay(modContext);
replay(controllerRegistryService);
PowerMock.replay(persistIntent, PersistIntent.class);
@@ -126,7 +126,7 @@
@After
public void tearDown() {
verify(datagridService);
- verify(networkGraphService);
+ verify(topologyService);
verify(modContext);
verify(controllerRegistryService);
PowerMock.verify(persistIntent, PersistIntent.class);
@@ -258,14 +258,14 @@
runtime1.getPathIntents().changeStates(states);
// link down
- ((MockNetworkGraph) g).removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
- ((MockNetworkGraph) g).removeLink(2L, 21L, 1L, 12L);
+ ((MockTopology) topology).removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
+ ((MockTopology) topology).removeLink(2L, 21L, 1L, 12L);
LinkEvent linkEvent1 = new LinkEvent(1L, 12L, 2L, 21L);
LinkEvent linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
removedLinkEvents.clear();
removedLinkEvents.add(linkEvent1);
removedLinkEvents.add(linkEvent2);
- runtime1.networkGraphEvents(
+ runtime1.topologyEvents(
addedSwitchEvents,
removedSwitchEvents,
addedPortEvents,