From a0bd99e921881025f8826b56ea1a8c69a9068863 Mon Sep 17 00:00:00 2001 From: Ryan Izard <ryan.izard@bigswitch.com> Date: Fri, 15 Jul 2016 10:14:35 -0400 Subject: [PATCH] Refactor path and routing APIs into their own web-routable. Add archipelago support to REST API. --- .../flowcache/PortDownReconciliation.java | 2 +- .../linkdiscovery/ILinkDiscoveryService.java | 1 - .../{routing => linkdiscovery}/Link.java | 2 +- .../internal/LinkDiscoveryManager.java | 2 +- .../web/DirectedLinksResource.java | 2 +- .../web/ExternalLinksResource.java | 2 +- .../linkdiscovery/web/LinkWithType.java | 4 +- .../linkdiscovery/web/LinksResource.java | 2 +- .../routing/BroadcastTree.java | 4 +- .../web/PathMetrics.java | 2 +- .../web/PathResource.java | 2 +- .../web/PathsResource.java | 2 +- .../routing/web/RoutingWebRoutable.java | 50 +++++++++++++ .../topology/Cluster.java | 4 +- .../topology/ITopologyService.java | 9 ++- .../topology/TopologyInstance.java | 6 +- .../topology/TopologyManager.java | 10 ++- .../web/SwitchArchipelagosResource.java | 54 ++++++++++++++ .../topology/web/SwitchClustersResource.java | 70 ------------------- .../topology/web/TopologyWebRoutable.java | 7 +- .../internal/LinkDiscoveryManagerTest.java | 2 +- 21 files changed, 144 insertions(+), 95 deletions(-) rename src/main/java/net/floodlightcontroller/{routing => linkdiscovery}/Link.java (98%) rename src/main/java/net/floodlightcontroller/{topology => routing}/web/PathMetrics.java (98%) rename src/main/java/net/floodlightcontroller/{topology => routing}/web/PathResource.java (98%) rename src/main/java/net/floodlightcontroller/{topology => routing}/web/PathsResource.java (98%) create mode 100644 src/main/java/net/floodlightcontroller/routing/web/RoutingWebRoutable.java create mode 100644 src/main/java/net/floodlightcontroller/topology/web/SwitchArchipelagosResource.java delete mode 100644 src/main/java/net/floodlightcontroller/topology/web/SwitchClustersResource.java diff --git a/src/main/java/net/floodlightcontroller/flowcache/PortDownReconciliation.java b/src/main/java/net/floodlightcontroller/flowcache/PortDownReconciliation.java index 0278ab554..adb849814 100644 --- a/src/main/java/net/floodlightcontroller/flowcache/PortDownReconciliation.java +++ b/src/main/java/net/floodlightcontroller/flowcache/PortDownReconciliation.java @@ -52,7 +52,7 @@ import net.floodlightcontroller.linkdiscovery.ILinkDiscovery; import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LDUpdate; import net.floodlightcontroller.linkdiscovery.internal.LinkInfo; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService; -import net.floodlightcontroller.routing.Link; +import net.floodlightcontroller.linkdiscovery.Link; import net.floodlightcontroller.topology.ITopologyListener; import net.floodlightcontroller.topology.ITopologyService; import net.floodlightcontroller.util.OFMatchWithSwDpid; diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryService.java b/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryService.java index ed0d4a4db..0c1e0d07e 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryService.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryService.java @@ -29,7 +29,6 @@ import net.floodlightcontroller.core.IOFSwitch; import net.floodlightcontroller.core.module.IFloodlightService; import net.floodlightcontroller.core.types.NodePortTuple; import net.floodlightcontroller.linkdiscovery.internal.LinkInfo; -import net.floodlightcontroller.routing.Link; public interface ILinkDiscoveryService extends IFloodlightService { diff --git a/src/main/java/net/floodlightcontroller/routing/Link.java b/src/main/java/net/floodlightcontroller/linkdiscovery/Link.java similarity index 98% rename from src/main/java/net/floodlightcontroller/routing/Link.java rename to src/main/java/net/floodlightcontroller/linkdiscovery/Link.java index 349fb3c81..9b8ffa614 100755 --- a/src/main/java/net/floodlightcontroller/routing/Link.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/Link.java @@ -15,7 +15,7 @@ * under the License. **/ -package net.floodlightcontroller.routing; +package net.floodlightcontroller.linkdiscovery; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java index 7e9330003..802700c42 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java @@ -69,13 +69,13 @@ import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.SwitchType; import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.UpdateOperation; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService; +import net.floodlightcontroller.linkdiscovery.Link; import net.floodlightcontroller.linkdiscovery.web.LinkDiscoveryWebRoutable; import net.floodlightcontroller.packet.BSN; import net.floodlightcontroller.packet.Ethernet; import net.floodlightcontroller.packet.LLDP; import net.floodlightcontroller.packet.LLDPTLV; import net.floodlightcontroller.restserver.IRestApiService; -import net.floodlightcontroller.routing.Link; import net.floodlightcontroller.storage.IResultSet; import net.floodlightcontroller.storage.IStorageSourceListener; import net.floodlightcontroller.storage.IStorageSourceService; diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/DirectedLinksResource.java b/src/main/java/net/floodlightcontroller/linkdiscovery/web/DirectedLinksResource.java index c6262ef6f..50c4f9f83 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/DirectedLinksResource.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/web/DirectedLinksResource.java @@ -25,7 +25,7 @@ import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkDirection; import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType; import net.floodlightcontroller.linkdiscovery.internal.LinkInfo; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService; -import net.floodlightcontroller.routing.Link; +import net.floodlightcontroller.linkdiscovery.Link; import org.restlet.resource.Get; import org.restlet.resource.ServerResource; diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/ExternalLinksResource.java b/src/main/java/net/floodlightcontroller/linkdiscovery/web/ExternalLinksResource.java index d25c69346..63e388594 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/ExternalLinksResource.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/web/ExternalLinksResource.java @@ -25,7 +25,7 @@ import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkDirection; import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType; import net.floodlightcontroller.linkdiscovery.internal.LinkInfo; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService; -import net.floodlightcontroller.routing.Link; +import net.floodlightcontroller.linkdiscovery.Link; import org.projectfloodlight.openflow.types.DatapathId; import org.projectfloodlight.openflow.types.OFPort; diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java b/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java index 8be807236..e02180290 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java @@ -21,9 +21,11 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import net.floodlightcontroller.linkdiscovery.Link; import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkDirection; import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType; -import net.floodlightcontroller.routing.Link; + import org.projectfloodlight.openflow.types.DatapathId; import org.projectfloodlight.openflow.types.OFPort; import org.projectfloodlight.openflow.types.U64; diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java b/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java index aa52be4a7..ee55538c3 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java @@ -25,7 +25,7 @@ import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkDirection; import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType; import net.floodlightcontroller.linkdiscovery.internal.LinkInfo; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService; -import net.floodlightcontroller.routing.Link; +import net.floodlightcontroller.linkdiscovery.Link; import org.projectfloodlight.openflow.types.DatapathId; import org.projectfloodlight.openflow.types.OFPort; diff --git a/src/main/java/net/floodlightcontroller/routing/BroadcastTree.java b/src/main/java/net/floodlightcontroller/routing/BroadcastTree.java index 28ca79f84..1862ba3f9 100644 --- a/src/main/java/net/floodlightcontroller/routing/BroadcastTree.java +++ b/src/main/java/net/floodlightcontroller/routing/BroadcastTree.java @@ -18,10 +18,10 @@ package net.floodlightcontroller.routing; import java.util.HashMap; -import net.floodlightcontroller.routing.Link; - import org.projectfloodlight.openflow.types.DatapathId; +import net.floodlightcontroller.linkdiscovery.Link; + public class BroadcastTree { protected HashMap<DatapathId, Link> links; protected HashMap<DatapathId, Integer> costs; diff --git a/src/main/java/net/floodlightcontroller/topology/web/PathMetrics.java b/src/main/java/net/floodlightcontroller/routing/web/PathMetrics.java similarity index 98% rename from src/main/java/net/floodlightcontroller/topology/web/PathMetrics.java rename to src/main/java/net/floodlightcontroller/routing/web/PathMetrics.java index 64e2ea1af..9996bff18 100644 --- a/src/main/java/net/floodlightcontroller/topology/web/PathMetrics.java +++ b/src/main/java/net/floodlightcontroller/routing/web/PathMetrics.java @@ -14,7 +14,7 @@ * under the License. **/ -package net.floodlightcontroller.topology.web; +package net.floodlightcontroller.routing.web; import net.floodlightcontroller.routing.IRoutingService; import net.floodlightcontroller.routing.IRoutingService.PATH_METRIC; diff --git a/src/main/java/net/floodlightcontroller/topology/web/PathResource.java b/src/main/java/net/floodlightcontroller/routing/web/PathResource.java similarity index 98% rename from src/main/java/net/floodlightcontroller/topology/web/PathResource.java rename to src/main/java/net/floodlightcontroller/routing/web/PathResource.java index fafc3fe15..689a39949 100644 --- a/src/main/java/net/floodlightcontroller/topology/web/PathResource.java +++ b/src/main/java/net/floodlightcontroller/routing/web/PathResource.java @@ -14,7 +14,7 @@ * under the License. **/ -package net.floodlightcontroller.topology.web; +package net.floodlightcontroller.routing.web; import net.floodlightcontroller.routing.IRoutingService; import net.floodlightcontroller.routing.Route; diff --git a/src/main/java/net/floodlightcontroller/topology/web/PathsResource.java b/src/main/java/net/floodlightcontroller/routing/web/PathsResource.java similarity index 98% rename from src/main/java/net/floodlightcontroller/topology/web/PathsResource.java rename to src/main/java/net/floodlightcontroller/routing/web/PathsResource.java index fb09285a6..28f84c966 100644 --- a/src/main/java/net/floodlightcontroller/topology/web/PathsResource.java +++ b/src/main/java/net/floodlightcontroller/routing/web/PathsResource.java @@ -14,7 +14,7 @@ * under the License. **/ -package net.floodlightcontroller.topology.web; +package net.floodlightcontroller.routing.web; import net.floodlightcontroller.routing.IRoutingService; import net.floodlightcontroller.routing.Route; diff --git a/src/main/java/net/floodlightcontroller/routing/web/RoutingWebRoutable.java b/src/main/java/net/floodlightcontroller/routing/web/RoutingWebRoutable.java new file mode 100644 index 000000000..a1bb84f80 --- /dev/null +++ b/src/main/java/net/floodlightcontroller/routing/web/RoutingWebRoutable.java @@ -0,0 +1,50 @@ +/** + * Copyright 2013, Big Switch Networks, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + +package net.floodlightcontroller.routing.web; + +import org.restlet.Context; +import org.restlet.routing.Router; + +import net.floodlightcontroller.restserver.RestletRoutable; +import net.floodlightcontroller.routing.web.PathMetrics; +import net.floodlightcontroller.routing.web.PathResource; +import net.floodlightcontroller.routing.web.PathsResource; + +public class RoutingWebRoutable implements RestletRoutable { + /** + * Create the Restlet router and bind to the proper resources. + */ + @Override + public Router getRestlet(Context context) { + Router router = new Router(context); + router.attach("/path/{src-dpid}/{src-port}/{dst-dpid}/{dst-port}/json", PathResource.class); + router.attach("/paths/{src-dpid}/{dst-dpid}/{num-paths}/json", PathsResource.class); + router.attach("/paths/fast/{src-dpid}/{dst-dpid}/{num-paths}/json", PathsResource.class); + router.attach("/paths/slow/{src-dpid}/{dst-dpid}/{num-paths}/json", PathsResource.class); + router.attach("/setpathmetric/{metric}/json", PathMetrics.class); + + return router; + } + + /** + * Set the base path for routing service + */ + @Override + public String basePath() { + return "/wm/routing"; + } +} diff --git a/src/main/java/net/floodlightcontroller/topology/Cluster.java b/src/main/java/net/floodlightcontroller/topology/Cluster.java index a9be8a36c..8156f16fc 100644 --- a/src/main/java/net/floodlightcontroller/topology/Cluster.java +++ b/src/main/java/net/floodlightcontroller/topology/Cluster.java @@ -21,10 +21,10 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import net.floodlightcontroller.routing.Link; - import org.projectfloodlight.openflow.types.DatapathId; +import net.floodlightcontroller.linkdiscovery.Link; + public class Cluster { protected DatapathId id; // the lowest id of the nodes protected Map<DatapathId, Set<Link>> links; // set of links connected to a node. diff --git a/src/main/java/net/floodlightcontroller/topology/ITopologyService.java b/src/main/java/net/floodlightcontroller/topology/ITopologyService.java index 7ce647008..35f66eb48 100644 --- a/src/main/java/net/floodlightcontroller/topology/ITopologyService.java +++ b/src/main/java/net/floodlightcontroller/topology/ITopologyService.java @@ -18,7 +18,8 @@ package net.floodlightcontroller.topology; import net.floodlightcontroller.core.module.IFloodlightService; import net.floodlightcontroller.core.types.NodePortTuple; -import net.floodlightcontroller.routing.Link; +import net.floodlightcontroller.linkdiscovery.Link; + import org.projectfloodlight.openflow.types.DatapathId; import org.projectfloodlight.openflow.types.OFPort; @@ -179,6 +180,12 @@ public interface ITopologyService extends IFloodlightService { * @return */ public DatapathId getArchipelagoId(DatapathId switchId); + + /** + * Return all archipelagos + * @return + */ + public Set<DatapathId> getArchipelagoIds(); /** * Determines if two switches are in the same domain/island/cluster. diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java index 98532652e..318ba2352 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java @@ -17,8 +17,8 @@ package net.floodlightcontroller.topology; import net.floodlightcontroller.core.types.NodePortTuple; +import net.floodlightcontroller.linkdiscovery.Link; import net.floodlightcontroller.routing.BroadcastTree; -import net.floodlightcontroller.routing.Link; import net.floodlightcontroller.routing.Route; import net.floodlightcontroller.routing.RouteId; import net.floodlightcontroller.util.ClusterDFS; @@ -1413,4 +1413,8 @@ public class TopologyInstance { } return ImmutableSet.of(); } + + protected Set<DatapathId> getArchipelagoIds() { + return archipelagos.stream().map(a -> a.getId()).collect(Collectors.toSet()); + } } \ No newline at end of file diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java index 44839418e..f5ad1592d 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java @@ -28,13 +28,14 @@ import net.floodlightcontroller.debugcounter.IDebugCounter; import net.floodlightcontroller.debugcounter.IDebugCounterService; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService; +import net.floodlightcontroller.linkdiscovery.Link; import net.floodlightcontroller.packet.BSN; import net.floodlightcontroller.packet.Ethernet; import net.floodlightcontroller.packet.LLDP; import net.floodlightcontroller.restserver.IRestApiService; import net.floodlightcontroller.routing.IRoutingService; -import net.floodlightcontroller.routing.Link; import net.floodlightcontroller.routing.Route; +import net.floodlightcontroller.routing.web.RoutingWebRoutable; import net.floodlightcontroller.statistics.IStatisticsService; import net.floodlightcontroller.threadpool.IThreadPoolService; import net.floodlightcontroller.topology.web.TopologyWebRoutable; @@ -708,6 +709,7 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo protected void addRestletRoutable() { restApiService.addRestletRoutable(new TopologyWebRoutable()); + restApiService.addRestletRoutable(new RoutingWebRoutable()); } // **************** @@ -1346,4 +1348,10 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo TopologyInstance ti = getCurrentInstance(); return ti.getAllBroadcastPorts(); } + + @Override + public Set<DatapathId> getArchipelagoIds() { + TopologyInstance ti = getCurrentInstance(); + return ti.getArchipelagoIds(); + } } \ No newline at end of file diff --git a/src/main/java/net/floodlightcontroller/topology/web/SwitchArchipelagosResource.java b/src/main/java/net/floodlightcontroller/topology/web/SwitchArchipelagosResource.java new file mode 100644 index 000000000..ee2849212 --- /dev/null +++ b/src/main/java/net/floodlightcontroller/topology/web/SwitchArchipelagosResource.java @@ -0,0 +1,54 @@ +/** + * Copyright 2011, Big Switch Networks, Inc. + * Originally created by David Erickson, Stanford University + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + **/ + +package net.floodlightcontroller.topology.web; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import net.floodlightcontroller.topology.ITopologyService; + +import org.projectfloodlight.openflow.types.DatapathId; +import org.restlet.resource.Get; +import org.restlet.resource.ServerResource; + +/** + * Returns a JSON map of <Archipelago-ID, List<Cluster-IDs>> + */ +public class SwitchArchipelagosResource extends ServerResource { + @Get("json") + public Map<String, Map<String, Set<String>>> retrieve() { + ITopologyService topologyService = + (ITopologyService) getContext().getAttributes(). + get(ITopologyService.class.getCanonicalName()); + + Map<String, Map<String, Set<String>>> switchArchMap = new HashMap<String, Map<String, Set<String>>>(); + for (DatapathId a : topologyService.getArchipelagoIds()) { + switchArchMap.put(a.toString(), new HashMap<String, Set<String>>()); + for (DatapathId c : topologyService.getClusterIdsInArchipelago(a)) { + switchArchMap.get(a.toString()).put(c.toString(), new HashSet<String>()); + for (DatapathId s : topologyService.getSwitchesInCluster(c)) { + switchArchMap.get(a.toString()).get(c.toString()).add(s.toString()); + } + } + } + + return switchArchMap; + } +} diff --git a/src/main/java/net/floodlightcontroller/topology/web/SwitchClustersResource.java b/src/main/java/net/floodlightcontroller/topology/web/SwitchClustersResource.java deleted file mode 100644 index 1b373cac2..000000000 --- a/src/main/java/net/floodlightcontroller/topology/web/SwitchClustersResource.java +++ /dev/null @@ -1,70 +0,0 @@ -/** -* Copyright 2011, Big Switch Networks, Inc. -* Originally created by David Erickson, Stanford University -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may -* not use this file except in compliance with the License. You may obtain -* a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -* License for the specific language governing permissions and limitations -* under the License. -**/ - -package net.floodlightcontroller.topology.web; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.floodlightcontroller.core.internal.IOFSwitchService; -import net.floodlightcontroller.topology.ITopologyService; - -import org.projectfloodlight.openflow.types.DatapathId; -import org.restlet.data.Form; -import org.restlet.resource.Get; -import org.restlet.resource.ServerResource; - -/** - * Returns a JSON map of <ClusterId, List<SwitchDpids>> - */ -public class SwitchClustersResource extends ServerResource { - @Get("json") - public Map<String, List<String>> retrieve() { - IOFSwitchService switchService = - (IOFSwitchService) getContext().getAttributes(). - get(IOFSwitchService.class.getCanonicalName()); - ITopologyService topologyService = - (ITopologyService) getContext().getAttributes(). - get(ITopologyService.class.getCanonicalName()); - - Form form = getQuery(); - String queryType = form.getFirstValue("type", true); - boolean openflowDomain = true; - if (queryType != null && "l2".equals(queryType)) { - openflowDomain = false; - } - - Map<String, List<String>> switchClusterMap = new HashMap<String, List<String>>(); - for (DatapathId dpid: switchService.getAllSwitchDpids()) { - DatapathId clusterDpid = - (openflowDomain - ? topologyService.getClusterId(dpid) - :topologyService.getClusterId(dpid)); - List<String> switchesInCluster = switchClusterMap.get(clusterDpid.toString()); - if (switchesInCluster != null) { - switchesInCluster.add(dpid.toString()); - } else { - List<String> l = new ArrayList<String>(); - l.add(dpid.toString()); - switchClusterMap.put(clusterDpid.toString(), l); - } - } - return switchClusterMap; - } -} diff --git a/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java b/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java index 23b085c53..ff5dc3a53 100644 --- a/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java +++ b/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java @@ -35,15 +35,10 @@ public class TopologyWebRoutable implements RestletRoutable { router.attach("/directed-links/json", DirectedLinksResource.class); router.attach("/external-links/json", ExternalLinksResource.class); router.attach("/tunnellinks/json", TunnelLinksResource.class); - router.attach("/switchclusters/json", SwitchClustersResource.class); + router.attach("/archipelagos/json", SwitchArchipelagosResource.class); router.attach("/broadcastports/json", AllBroadcastPortsResource.class); router.attach("/enabledports/json", EnabledPortsResource.class); router.attach("/blockedports/json", BlockedPortsResource.class); - router.attach("/path/{src-dpid}/{src-port}/{dst-dpid}/{dst-port}/json", PathResource.class); - router.attach("/paths/{src-dpid}/{dst-dpid}/{num-paths}/json", PathsResource.class); - router.attach("/paths/fast/{src-dpid}/{dst-dpid}/{num-paths}/json", PathsResource.class); - router.attach("/paths/slow/{src-dpid}/{dst-dpid}/{num-paths}/json", PathsResource.class); - router.attach("/setpathmetric/{metric}/json", PathMetrics.class); return router; } diff --git a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java index 7ba7ee0d4..8d5ea89b7 100644 --- a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java +++ b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java @@ -48,6 +48,7 @@ import net.floodlightcontroller.debugcounter.IDebugCounterService; import net.floodlightcontroller.debugcounter.MockDebugCounterService; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService; +import net.floodlightcontroller.linkdiscovery.Link; import net.floodlightcontroller.packet.Data; import net.floodlightcontroller.packet.Ethernet; import net.floodlightcontroller.packet.IPacket; @@ -56,7 +57,6 @@ import net.floodlightcontroller.packet.UDP; import net.floodlightcontroller.restserver.IRestApiService; import net.floodlightcontroller.restserver.RestApiServer; import net.floodlightcontroller.routing.IRoutingService; -import net.floodlightcontroller.routing.Link; import net.floodlightcontroller.storage.IStorageSourceService; import net.floodlightcontroller.storage.memory.MemoryStorageSource; import net.floodlightcontroller.test.FloodlightTestCase; -- GitLab