[ONOS-2096]Revert useless modifies
Change-Id: I5d6df8690a95ffb36b656a39a45a07d2955a9693
[ONOS-2096]Revert useless modifies
Change-Id: I5d6df8690a95ffb36b656a39a45a07d2955a9693
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java
index 3cce69b..1216cc6 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java
@@ -20,6 +20,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.incubator.net.tunnel.Tunnel.Type;
import org.onosproject.net.Annotations;
+import org.onosproject.net.DeviceId;
/**
* Service for interacting with the inventory of tunnels.
@@ -186,6 +187,14 @@
int tunnelCount();
/**
+ * Returns the collection of tunnels applied on the specified device.
+ *
+ * @param deviceId device identifier
+ * @return collection of tunnels
+ */
+ Iterable<Tunnel> getTunnels(DeviceId deviceId);
+
+ /**
* Adds the specified tunnel listener.
*
* @param listener tunnel listener
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java
index 3350cd1..bb344b7 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java
@@ -19,6 +19,7 @@
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Collection;
+import java.util.Collections;
import java.util.Set;
import org.apache.felix.scr.annotations.Activate;
@@ -48,6 +49,7 @@
import org.onosproject.incubator.net.tunnel.TunnelStoreDelegate;
import org.onosproject.incubator.net.tunnel.TunnelSubscription;
import org.onosproject.net.Annotations;
+import org.onosproject.net.DeviceId;
import org.onosproject.net.Path;
import org.onosproject.net.provider.AbstractProviderRegistry;
import org.onosproject.net.provider.AbstractProviderService;
@@ -373,4 +375,9 @@
}
}
+ @Override
+ public Iterable<Tunnel> getTunnels(DeviceId deviceId) {
+ return Collections.emptyList();
+ }
+
}
diff --git a/web/gui/pom.xml b/web/gui/pom.xml
index 5e4b148..76176c4 100644
--- a/web/gui/pom.xml
+++ b/web/gui/pom.xml
@@ -53,6 +53,10 @@
<classifier>tests</classifier>
</dependency>
<dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-incubator-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
</dependency>
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
index 0c466f8..534c8bc 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
@@ -27,6 +27,9 @@
import org.onosproject.cluster.NodeId;
import org.onosproject.core.CoreService;
import org.onosproject.incubator.net.PortStatisticsService;
+import org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint;
+import org.onosproject.incubator.net.tunnel.Tunnel;
+import org.onosproject.incubator.net.tunnel.TunnelService;
import org.onosproject.mastership.MastershipService;
import org.onosproject.net.Annotated;
import org.onosproject.net.AnnotationKeys;
@@ -143,6 +146,7 @@
protected StatisticService flowStatsService;
protected PortStatisticsService portStatsService;
protected TopologyService topologyService;
+ protected TunnelService tunnelService;
protected enum StatsType {
FLOW, PORT
@@ -176,6 +180,7 @@
flowStatsService = directory.get(StatisticService.class);
portStatsService = directory.get(PortStatisticsService.class);
topologyService = directory.get(TopologyService.class);
+ tunnelService = directory.get(TunnelService.class);
String ver = directory.get(CoreService.class).version().toString();
version = ver.replace(".SNAPSHOT", "*").replaceFirst("~.*$", "");
@@ -446,6 +451,7 @@
new Prop("Topology SCCs", format(topology.clusterCount())),
new Separator(),
new Prop("Intents", format(intentService.getIntentCount())),
+ new Prop("Tunnels", format(tunnelService.tunnelCount())),
new Prop("Flows", format(flowService.getFlowRuleCount())),
new Prop("Version", version)));
}
@@ -457,6 +463,7 @@
String name = annot.value(AnnotationKeys.NAME);
int portCount = deviceService.getPorts(deviceId).size();
int flowCount = getFlowCount(deviceId);
+ int tunnelCount = getTunnelCount(deviceId);
return JsonUtils.envelope("showDetails", sid,
json(isNullOrEmpty(name) ? deviceId.toString() : name,
device.type().toString().toLowerCase(),
@@ -472,7 +479,9 @@
new Prop("Longitude", annot.value(AnnotationKeys.LONGITUDE)),
new Separator(),
new Prop("Ports", Integer.toString(portCount)),
- new Prop("Flows", Integer.toString(flowCount))));
+ new Prop("Flows", Integer.toString(flowCount)),
+ new Prop("Tunnels", Integer.toString(tunnelCount))
+ ));
}
protected int getFlowCount(DeviceId deviceId) {
@@ -485,6 +494,22 @@
return count;
}
+ protected int getTunnelCount(DeviceId deviceId) {
+ int count = 0;
+ Collection<Tunnel> tunnels = tunnelService.queryAllTunnels();
+ for (Tunnel tunnel : tunnels) {
+ OpticalTunnelEndPoint src = (OpticalTunnelEndPoint) tunnel.src();
+ OpticalTunnelEndPoint dst = (OpticalTunnelEndPoint) tunnel.dst();
+ DeviceId srcDevice = (DeviceId) src.elementId().get();
+ DeviceId dstDevice = (DeviceId) dst.elementId().get();
+ if (srcDevice.toString().equals(deviceId.toString())
+ || dstDevice.toString().equals(deviceId.toString())) {
+ count++;
+ }
+ }
+ return count;
+ }
+
// Counts all entries that egress on the given device links.
protected Map<Link, Integer> getFlowCounts(DeviceId deviceId) {
List<FlowEntry> entries = new ArrayList<>();