Implement SFC integration
[groupbasedpolicy.git] / renderers / ofoverlay / src / main / java / org / opendaylight / groupbasedpolicy / renderer / ofoverlay / node / SwitchManager.java
index f3b39c3e19609fc87dc765a7798ca6efeb7d8068..8b4c8b59758fdda3b6acef92674ee767f4197452 100644 (file)
@@ -22,6 +22,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
 
 import javax.annotation.Nullable;
 
+import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.node.SwitchListener;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
@@ -82,14 +83,14 @@ public class SwitchManager implements AutoCloseable {
     }
 
     // When first endpoint is attached to switch, it can be ready
-    public static void activateEndpoint(NodeId nodeId) {
-        switches.get(nodeId).hasEndpoints=true;
+    public static void activatingSwitch(NodeId nodeId) {
+        switches.get(nodeId).setHasEndpoints(true);
         switches.get(nodeId).updateStatus();
     }
 
     // When last endpoint is removed from switch, it is no longer ready
-    public static void deactivateEndpoint(NodeId nodeId) {
-        switches.get(nodeId).hasEndpoints=false;
+    public static void deactivatingSwitch(NodeId nodeId) {
+        switches.get(nodeId).setHasEndpoints(false);;
         switches.get(nodeId).updateStatus();
     }
 
@@ -256,6 +257,16 @@ public class SwitchManager implements AutoCloseable {
         private Map<InstanceIdentifier<NodeConnector>, FlowCapableNodeConnector> fcncByNcIid = Maps.newHashMap();
         private boolean hasEndpoints=false;
 
+
+        public boolean isHasEndpoints() {
+            return hasEndpoints;
+        }
+
+
+        public void setHasEndpoints(boolean hasEndpoints) {
+            this.hasEndpoints = hasEndpoints;
+        }
+
         Map<Class<? extends TunnelTypeBase>, TunnelBuilder> tunnelBuilderByType = new HashMap<>();
         Set<NodeConnectorId> externalPorts = new HashSet<>();
 
@@ -327,7 +338,7 @@ public class SwitchManager implements AutoCloseable {
         private void updateStatus() {
             boolean tunnelWithIpAndNcExists = tunnelWithIpAndNcExists();
             if (fcNode != null) {
-                if (tunnelWithIpAndNcExists && hasEndpoints) {
+                if (tunnelWithIpAndNcExists && isHasEndpoints()) {
                     setStatus(SwitchStatus.READY);
                 } else {
                     setStatus(SwitchStatus.PREPARING);
@@ -418,4 +429,6 @@ public class SwitchManager implements AutoCloseable {
         READY
     }
 
+
+
 }