[WIP] CORD-129 Support access agent in VTN

- Add ACCESS_AGENT type instance based on the access agent location
- Populate flow rules to provider L2 connectivity with OLTs
- Don't check "tap" port name prefix considering container instance
- Changed table name ACCESS_TYPE to ACCESS, DST_IP to DST

Change-Id: Ibcf7ea97cd5e16e15d6deff1c8579a83ac9e13f8
diff --git a/src/main/java/org/opencord/cordvtn/impl/CordVtnNodeManager.java b/src/main/java/org/opencord/cordvtn/impl/CordVtnNodeManager.java
index c45fef3..5ccfbf7 100644
--- a/src/main/java/org/opencord/cordvtn/impl/CordVtnNodeManager.java
+++ b/src/main/java/org/opencord/cordvtn/impl/CordVtnNodeManager.java
@@ -429,7 +429,8 @@
 
         // adds existing instances to the host list
         deviceService.getPorts(node.integrationBridgeId()).stream()
-                .filter(port -> portName(port).startsWith(VPORT_PREFIX) &&
+                .filter(port -> !node.systemIfaces().contains(portName(port)) &&
+                        !port.number().equals(PortNumber.LOCAL) &&
                         port.isEnabled())
                 .forEach(port -> instanceService.addInstance(connectPoint(port)));
 
@@ -749,14 +750,12 @@
 
             log.info("Port {} is added to {}", portName, node.hostname());
 
-            if (portName.startsWith(VPORT_PREFIX)) {
-                if (isNodeStateComplete(node)) {
-                    instanceService.addInstance(connectPoint(port));
-                } else {
-                    log.warn("VM is detected on incomplete node, ignore it.", portName);
-                }
-            } else if (node.systemIfaces().contains(portName)) {
+            if (node.systemIfaces().contains(portName)) {
                 setNodeState(node, getNodeState(node));
+            } else if (isNodeStateComplete(node)) {
+                instanceService.addInstance(connectPoint(port));
+            } else {
+                log.warn("Instance is detected on incomplete node, ignore it.", portName);
             }
         }
 
@@ -777,14 +776,12 @@
 
             log.info("Port {} is removed from {}", portName, node.hostname());
 
-            if (portName.startsWith(VPORT_PREFIX)) {
-                if (isNodeStateComplete(node)) {
-                    instanceService.removeInstance(connectPoint(port));
-                } else {
-                    log.warn("VM is vanished from incomplete node, ignore it.", portName);
-                }
-            } else if (node.systemIfaces().contains(portName)) {
+            if (node.systemIfaces().contains(portName)) {
                 setNodeState(node, NodeState.INCOMPLETE);
+            } else if (isNodeStateComplete(node)) {
+                instanceService.removeInstance(connectPoint(port));
+            } else {
+                log.warn("VM is vanished from incomplete node, ignore it.", portName);
             }
         }
     }