ONOS-5305 TunnelAdminService needs extensions to manage the state of a tunnel
Change-Id: I1f3793a11e8ffc025d03b931b46513a7ce96f918
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java
index 3e6725a..936749a 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java
@@ -62,4 +62,11 @@
*/
void updateTunnel(Tunnel tunnel, Path path);
+ /**
+ * Updates the state of a tunnel.
+ *
+ * @param tunnel tunnel to be changed
+ * @param state new state of the tunnel
+ */
+ void updateTunnelState(Tunnel tunnel, Tunnel.State state);
}
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 3c846a6..281f1e8 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
@@ -130,6 +130,12 @@
}
@Override
+ public void updateTunnelState(Tunnel tunnel, State state) {
+ Tunnel storedTunnel = store.queryTunnel(tunnel.tunnelId());
+ store.createOrUpdateTunnel(storedTunnel, state);
+ }
+
+ @Override
public void removeTunnels(TunnelEndPoint src, TunnelEndPoint dst,
ProviderId producerName) {
Collection<Tunnel> setTunnels = store.queryTunnel(src, dst);
diff --git a/providers/pcep/tunnel/src/test/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelAddedTest.java b/providers/pcep/tunnel/src/test/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelAddedTest.java
index 17a62d8..f6b876e 100644
--- a/providers/pcep/tunnel/src/test/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelAddedTest.java
+++ b/providers/pcep/tunnel/src/test/java/org/onosproject/provider/pcep/tunnel/impl/PcepTunnelAddedTest.java
@@ -147,6 +147,11 @@
tunnelService.tunnelIdAsKeyStore.replace(tunnel.tunnelId(), tunnel);
}
}
+
+ @Override
+ public void updateTunnelState(Tunnel tunnel, State state) {
+ // TODO Auto-generated method stub
+ }
}
private class MockMasterShipService extends MastershipServiceAdapter {