Renamed *NetworkGraph* references to *Topology*.
Change-Id: Iec01c47086e1518592c0753e75395d3fe5abcde3
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();
}
}
}