Using Table Ids from NwConstants.java 76/42776/4
authorSuraj Ranjan <suraj.ranjan@ericsson.com>
Fri, 29 Jul 2016 10:19:09 +0000 (15:49 +0530)
committerSuraj Ranjan <suraj.ranjan@ericsson.com>
Sun, 31 Jul 2016 13:16:36 +0000 (18:46 +0530)
This review includes changes in entire netvirt module, to use table ids
from NwConstants.java.

Change-Id: I8eb854efffee776b1cfe644e52fb2ba65bcb3a20
Signed-off-by: Suraj Ranjan <suraj.ranjan@ericsson.com>
32 files changed:
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/EgressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/IngressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/listeners/AclNodeListener.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/utils/AclConstants.java
vpnservice/cloud-servicechain/cloud-servicechain-impl/src/main/java/org/opendaylight/netvirt/cloudservicechain/CloudServiceChainConstants.java
vpnservice/cloud-servicechain/cloud-servicechain-impl/src/main/java/org/opendaylight/netvirt/cloudservicechain/VPNServiceChainHandler.java
vpnservice/cloud-servicechain/cloud-servicechain-impl/src/main/java/org/opendaylight/netvirt/cloudservicechain/listeners/ElanDpnInterfacesListener.java
vpnservice/cloud-servicechain/cloud-servicechain-impl/src/main/java/org/opendaylight/netvirt/cloudservicechain/utils/ElanServiceChainUtils.java
vpnservice/cloud-servicechain/cloud-servicechain-impl/src/main/java/org/opendaylight/netvirt/cloudservicechain/utils/VpnServiceChainUtils.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanInterfaceManager.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanNodeListener.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanPacketInHandler.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanSmacFlowEventListener.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/statisitcs/ElanStatisticsImpl.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/utils/ElanConstants.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/utils/ElanUtils.java
vpnservice/fibmanager/fibmanager-impl/src/main/java/org/opendaylight/netvirt/fibmanager/FibManager.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalNetworkListener.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalNetworksChangeListener.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalRoutersListener.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/FloatingIPListener.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/InterfaceStateEventListener.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptEventHandler.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptFlowRemovedEventHandler.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptPacketInHandler.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptSwitchHA.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NatConstants.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/SNATDefaultRouteProgrammer.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/VpnFloatingIpHandler.java
vpnservice/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnConstants.java
vpnservice/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnInterfaceManager.java
vpnservice/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/netvirt/vpnmanager/intervpnlink/InterVpnLinkUtil.java

index 637ae9d041cff9e38c3a4ef3fef5862690f3b2fc..00ac62b1c1b9b72f10cb47d9e26eb5f592e2ad0a 100644 (file)
@@ -74,12 +74,12 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
 
         int instructionKey = 0;
         List<Instruction> instructions = new ArrayList<>();
-        instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(AclConstants.EGRESS_ACL_TABLE_ID, ++instructionKey));
+        instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.EGRESS_ACL_TABLE_ID, ++instructionKey));
         BoundServices serviceInfo = AclServiceUtils.getBoundServices(
-                String.format("%s.%s.%s", "vpn", "egressacl", interfaceName), AclConstants.EGRESS_ACL_SERVICE_PRIORITY,
+                String.format("%s.%s.%s", "vpn", "egressacl", interfaceName), NwConstants.ACL_SERVICE_INDEX,
                 flowPriority, AclConstants.COOKIE_ACL_BASE, instructions);
         InstanceIdentifier<BoundServices> path = AclServiceUtils.buildServiceId(interfaceName,
-                AclConstants.EGRESS_ACL_SERVICE_PRIORITY, ServiceModeIngress.class);
+                NwConstants.ACL_SERVICE_INDEX, ServiceModeIngress.class);
         MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, path, serviceInfo);
     }
 
@@ -90,7 +90,7 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
      */
     protected void unbindService(String interfaceName) {
         InstanceIdentifier<BoundServices> path = AclServiceUtils.buildServiceId(interfaceName,
-                AclConstants.EGRESS_ACL_SERVICE_PRIORITY, ServiceModeIngress.class);
+                NwConstants.ACL_SERVICE_INDEX, ServiceModeIngress.class);
         MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, path);
     }
 
@@ -174,8 +174,8 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
             instructions.add(new InstructionInfo(InstructionType.apply_actions,
                 actionsInfos));
             instructions.add(new InstructionInfo(InstructionType.goto_table,
-                new long[] { AclConstants.EGRESS_ACL_NEXT_TABLE_ID }));
-            syncFlow(dpId, AclConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY,
+                new long[] { NwConstants.EGRESS_ACL_NEXT_TABLE_ID }));
+            syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY,
                 "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE, flows, instructions, addOrRemove);
         }
     }
@@ -199,7 +199,7 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
         actionsInfos.add(new ActionInfo(ActionType.drop_action,
             new String[] {}));
         String flowName = "Egress_DHCP_Server_v4" + dpId + "_" + attachMac + "_" + dhcpMacAddress + "_Drop_";
-        syncFlow(dpId, AclConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -222,7 +222,7 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
         actionsInfos.add(new ActionInfo(ActionType.drop_action,
             new String[] {}));
         String flowName = "Egress_DHCP_Server_v6" + "_" + dpId + "_" + attachMac + "_" + dhcpMacAddress + "_Drop_";
-        syncFlow(dpId, AclConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -251,9 +251,9 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
 
 
         instructions.add(new InstructionInfo(InstructionType.goto_table,
-            new long[] { AclConstants.EGRESS_ACL_NEXT_TABLE_ID }));
+            new long[] { NwConstants.EGRESS_ACL_NEXT_TABLE_ID }));
         String flowName = "Egress_DHCP_Client_v4" + dpId + "_" + attachMac + "_" + dhcpMacAddress + "_Permit_";
-        syncFlow(dpId, AclConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -281,9 +281,9 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
             actionsInfos));
 
         instructions.add(new InstructionInfo(InstructionType.goto_table,
-            new long[] { AclConstants.EGRESS_ACL_NEXT_TABLE_ID }));
+            new long[] { NwConstants.EGRESS_ACL_NEXT_TABLE_ID }));
         String flowName = "Egress_DHCP_Client_v6" + "_" + dpId + "_" + attachMac + "_" + dhcpMacAddress + "_Permit_";
-        syncFlow(dpId, AclConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -311,11 +311,11 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
         List<ActionInfo> actionsInfos = new ArrayList<>();
 
         actionsInfos.add(new ActionInfo(ActionType.nx_conntrack,
-            new String[] {"0", "0", "0", Short.toString(AclConstants.EGRESS_ACL_TABLE_ID)}, 2));
+            new String[] {"0", "0", "0", Short.toString(NwConstants.EGRESS_ACL_TABLE_ID)}, 2));
         instructions.add(new InstructionInfo(InstructionType.apply_actions,
             actionsInfos));
         String flowName = "Egress_Fixed_Conntrk_Untrk_" + dpId + "_" + attachMac + "_" + flowId;
-        syncFlow(dpId, AclConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -346,9 +346,9 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
             new String[] {}));
 
         instructions.add(new InstructionInfo(InstructionType.goto_table,
-            new long[] { AclConstants.EGRESS_ACL_NEXT_TABLE_ID }));
+            new long[] { NwConstants.EGRESS_ACL_NEXT_TABLE_ID }));
         String flowName = "Egress_Fixed_Conntrk_Untrk_" + dpId + "_" + attachMac + "_" + flowId;
-        syncFlow(dpId, AclConstants.EGRESS_ACL_TABLE_ID, flowName, priority, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE_ID, flowName, priority, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -378,7 +378,7 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
         actionsInfos.add(new ActionInfo(ActionType.drop_action,
             new String[] {}));
         String flowName = "Egress_Fixed_Conntrk_NewDrop_" + dpId + "_" + attachMac + "_" + flowId;
-        syncFlow(dpId, AclConstants.EGRESS_ACL_TABLE_ID, flowName, priority, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE_ID, flowName, priority, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -403,9 +403,9 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
                 new String[] {}));
 
         instructions.add(new InstructionInfo(InstructionType.goto_table,
-            new long[] { AclConstants.EGRESS_ACL_NEXT_TABLE_ID }));
+            new long[] { NwConstants.EGRESS_ACL_NEXT_TABLE_ID }));
         String flowName = "Egress_ARP_" + dpId + "_" + attachMac ;
-        syncFlow(dpId, AclConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
index 29446e746f583296084a73a641f6f26101b7dcc2..eb88f86a04286cc0a29efd97549d25fce82b973e 100644 (file)
@@ -76,7 +76,7 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
         int instructionKey = 0;
         List<Instruction> instructions = new ArrayList<>();
         instructions
-                .add(MDSALUtil.buildAndGetGotoTableInstruction(AclConstants.INGRESS_ACL_TABLE_ID, ++instructionKey));
+                .add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.INGRESS_ACL_TABLE_ID, ++instructionKey));
         BoundServices serviceInfo = AclServiceUtils.getBoundServices(
                 String.format("%s.%s.%s", "vpn", "ingressacl", interfaceName),
                 AclConstants.INGRESS_ACL_SERVICE_PRIORITY, flowPriority, AclConstants.COOKIE_ACL_BASE, instructions);
@@ -174,8 +174,8 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
             instructions.add(new InstructionInfo(InstructionType.apply_actions,
                 actionsInfos));
             instructions.add(new InstructionInfo(InstructionType.goto_table,
-                new long[] { AclConstants.INGRESS_ACL_NEXT_TABLE_ID }));
-            syncFlow(dpId, AclConstants.INGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY,
+                new long[] { NwConstants.INGRESS_ACL_NEXT_TABLE_ID }));
+            syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY,
                 "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE, flows, instructions, addOrRemove);
         }
     }
@@ -206,9 +206,9 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
 
 
         instructions.add(new InstructionInfo(InstructionType.goto_table,
-            new long[] { AclConstants.INGRESS_ACL_NEXT_TABLE_ID }));
+            new long[] { NwConstants.INGRESS_ACL_NEXT_TABLE_ID }));
         String flowName = "Ingress_DHCP_Server_v4" + dpId + "_" + attachMac + "_" + dhcpMacAddress + "_Permit_";
-        syncFlow(dpId, AclConstants.INGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -239,10 +239,10 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
             actionsInfos));
 
         instructions.add(new InstructionInfo(InstructionType.goto_table,
-            new long[] { AclConstants.INGRESS_ACL_NEXT_TABLE_ID }));
+            new long[] { NwConstants.INGRESS_ACL_NEXT_TABLE_ID }));
         String flowName = "Ingress_DHCP_Server_v6" + "_" + dpId + "_" + attachMac + "_" + "_"
                 + dhcpMacAddress + "_Permit_";
-        syncFlow(dpId, AclConstants.INGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -270,11 +270,11 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
         List<ActionInfo> actionsInfos = new ArrayList<>();
 
         actionsInfos.add(new ActionInfo(ActionType.nx_conntrack,
-            new String[] {"0", "0", "0", Short.toString(AclConstants.INGRESS_ACL_TABLE_ID)}, 2));
+            new String[] {"0", "0", "0", Short.toString(NwConstants.INGRESS_ACL_TABLE_ID)}, 2));
         instructions.add(new InstructionInfo(InstructionType.apply_actions,
             actionsInfos));
         String flowName = "Ingress_Fixed_Conntrk_Untrk_" + dpId + "_" + attachMac + "_" + flowId;
-        syncFlow(dpId, AclConstants.INGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -306,9 +306,9 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
                 new String[] {}));
 
         instructions.add(new InstructionInfo(InstructionType.goto_table,
-            new long[] { AclConstants.INGRESS_ACL_NEXT_TABLE_ID }));
+            new long[] { NwConstants.INGRESS_ACL_NEXT_TABLE_ID }));
         String flowName = "Ingress_Fixed_Conntrk_Untrk_" + dpId + "_" + attachMac + "_" + flowId;
-        syncFlow(dpId, AclConstants.INGRESS_ACL_TABLE_ID, flowName, priority, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE_ID, flowName, priority, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -338,7 +338,7 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
         actionsInfos.add(new ActionInfo(ActionType.drop_action,
                 new String[] {}));
         String flowName = "Ingress_Fixed_Conntrk_NewDrop_" + dpId + "_" + attachMac + "_" + flowId;
-        syncFlow(dpId, AclConstants.INGRESS_ACL_TABLE_ID, flowName, priority, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE_ID, flowName, priority, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
@@ -363,9 +363,9 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
                 new String[] {}));
 
         instructions.add(new InstructionInfo(InstructionType.goto_table,
-            new long[] { AclConstants.INGRESS_ACL_NEXT_TABLE_ID }));
+            new long[] { NwConstants.INGRESS_ACL_NEXT_TABLE_ID }));
         String flowName = "Ingress_ARP_" + dpId + "_" + attachMac;
-        syncFlow(dpId, AclConstants.INGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
+        syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE_ID, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
     }
 
index 11d2ec3fd962fcbce6653416aca5328400f56304..b26cd794450a28f208f0b0631885beb2dad97477 100644 (file)
@@ -19,6 +19,7 @@ import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.InstructionType;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
+import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
 import org.opendaylight.netvirt.aclservice.utils.AclConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
@@ -133,13 +134,13 @@ public class AclNodeListener extends AsyncDataTreeChangeListenerBase<FlowCapable
         actionsInfos.add(new ActionInfo(ActionType.drop_action, new String[] {}));
         mkInstructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos));
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, AclConstants.INGRESS_ACL_TABLE_ID,
-                getTableMissFlowId(AclConstants.INGRESS_ACL_TABLE_ID), 0, "Ingress ACL Table Miss Flow", 0, 0,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.INGRESS_ACL_TABLE_ID,
+                getTableMissFlowId(NwConstants.INGRESS_ACL_TABLE_ID), 0, "Ingress ACL Table Miss Flow", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, mkMatches, mkInstructions);
         mdsalManager.installFlow(flowEntity);
 
-        FlowEntity nextTblFlowEntity = MDSALUtil.buildFlowEntity(dpId, AclConstants.INGRESS_ACL_NEXT_TABLE_ID,
-                getTableMissFlowId(AclConstants.INGRESS_ACL_NEXT_TABLE_ID), 0, "Ingress ACL Table Miss Flow", 0, 0,
+        FlowEntity nextTblFlowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.INGRESS_ACL_NEXT_TABLE_ID,
+                getTableMissFlowId(NwConstants.INGRESS_ACL_NEXT_TABLE_ID), 0, "Ingress ACL Table Miss Flow", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, mkMatches, mkInstructions);
         mdsalManager.installFlow(nextTblFlowEntity);
 
@@ -158,13 +159,13 @@ public class AclNodeListener extends AsyncDataTreeChangeListenerBase<FlowCapable
         actionsInfos.add(new ActionInfo(ActionType.drop_action, new String[] {}));
         mkInstructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos));
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, AclConstants.EGRESS_ACL_TABLE_ID,
-                getTableMissFlowId(AclConstants.EGRESS_ACL_TABLE_ID), 0, "Egress ACL Table Miss Flow", 0, 0,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.EGRESS_ACL_TABLE_ID,
+                getTableMissFlowId(NwConstants.EGRESS_ACL_TABLE_ID), 0, "Egress ACL Table Miss Flow", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, mkMatches, mkInstructions);
         mdsalManager.installFlow(flowEntity);
 
-        FlowEntity nextTblFlowEntity = MDSALUtil.buildFlowEntity(dpId, AclConstants.EGRESS_ACL_NEXT_TABLE_ID,
-                getTableMissFlowId(AclConstants.EGRESS_ACL_NEXT_TABLE_ID), 0, "Egress ACL Table Miss Flow", 0, 0,
+        FlowEntity nextTblFlowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.EGRESS_ACL_NEXT_TABLE_ID,
+                getTableMissFlowId(NwConstants.EGRESS_ACL_NEXT_TABLE_ID), 0, "Egress ACL Table Miss Flow", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, mkMatches, mkInstructions);
         mdsalManager.installFlow(nextTblFlowEntity);
 
index e708c31cbe89986319ffb1ed9fd19226cfd60bf1..33f45da0a8811bebe3e799672d2072b2ed043f51 100644 (file)
@@ -17,13 +17,8 @@ public final class AclConstants {
 
     // TODO: Move all service related constants across all modules to a common
     // place
-    public static final short EGRESS_ACL_TABLE_ID = 40;
-    public static final short EGRESS_ACL_NEXT_TABLE_ID = 41;
-    public static final short EGRESS_ACL_SERVICE_PRIORITY = 2;
     public static final short EGRESS_ACL_DEFAULT_FLOW_PRIORITY = 11;
 
-    public static final short INGRESS_ACL_TABLE_ID = 251;
-    public static final short INGRESS_ACL_NEXT_TABLE_ID = 252;
     public static final short INGRESS_ACL_SERVICE_PRIORITY = 10;
     public static final short INGRESS_ACL_DEFAULT_FLOW_PRIORITY = 1;
 
index 516f07f444d9cfef83af87ffd68d377bf072ed96..83969f27ae7c0d6ab7206c41575425344999752b 100644 (file)
@@ -16,22 +16,11 @@ public class CloudServiceChainConstants {
     public static final BigInteger COOKIE_LPORT_DISPATCHER_BASE = new BigInteger("6000000", 16);
     public static final BigInteger METADATA_MASK_SCF_WRITE = new BigInteger("000000FF00000000", 16);
     public static final BigInteger COOKIE_L3_BASE = new BigInteger("8000000", 16);
-    public static final BigInteger COOKIE_VM_LFIB_TABLE = new BigInteger("8000002", 16);
-    public static final BigInteger COOKIE_VM_FIB_TABLE =  new BigInteger("8000003", 16);
-    public static final short L3_LFIB_TABLE = 20;
     public static final int DEFAULT_LPORT_DISPATCHER_FLOW_PRIORITY = 1;
     public static final int DEFAULT_SCF_FLOW_PRIORITY = 20;
     public static final String FLOWID_PREFIX_SCF = "SCF.";
     public static final String FLOWID_PREFIX_L3 = "L3.";
 
-    public static final short SCF_SERVICE_INDEX = 1;
-    public static final short ELAN_SERVICE_INDEX = 3;
-    public static final short LPORT_DISPATCHER_TABLE = 17;
-    public static final short ELAN_DMAC_TABLE = 51;
-    public static final short FIB_TABLE = 21;
-    public static final short SCF_UP_SUB_FILTER_TCP_BASED_TABLE = 70;
-    public static final short SCF_DOWN_SUB_FILTER_TCP_BASED_TABLE = 72;
-    public static final short SCF_CHAIN_FWD_TABLE = 75;
     public static final String FLOWID_PREFIX = "L3.";
     public static final String L2_FLOWID_PREFIX = "L2.";
     public static final String VPN_PSEUDO_PORT_FLOWID_PREFIX = "VpnPseudoPort.";
@@ -43,7 +32,6 @@ public class CloudServiceChainConstants {
     public static final String SCF_L3VPN_IDPOOL_NAME = "l3vpnscf";
     public static final long SCF_L3VPN_ID_POOL_START = 20000;
     public static final long SCF_L3VPN_ID_POOL_END = 65535;
-    public static final short L3VPN_SERVICE_IDENTIFIER = 2;
     public static final long ETHERTYPE_IPV4 = 0x0800L;
 
 }
index bd8435e416df1e108804a4bcf56c21ff61ff0aae..a739f73c2fe027e815211fa75302eea36239cae5 100644 (file)
@@ -298,11 +298,11 @@ public class VPNServiceChainHandler implements AutoCloseable {
             }
 
             String vpnToScfflowRef = VpnServiceChainUtils.getL3VpnToScfLportDispatcherFlowRef(vpnPseudoLportTag);
-            Flow vpnToScfFlow = new FlowBuilder().setTableId(CloudServiceChainConstants.LPORT_DISPATCHER_TABLE)
+            Flow vpnToScfFlow = new FlowBuilder().setTableId(NwConstants.LPORT_DISPATCHER_TABLE)
                     .setId(new FlowId(vpnToScfflowRef)).build();
             mdsalManager.removeFlow(dpnId, vpnToScfFlow);
             String scfToVpnFlowRef = VpnServiceChainUtils.getScfToL3VpnLportDispatcherFlowRef(vpnPseudoLportTag);
-            Flow scfToVpnFlow = new FlowBuilder().setTableId(CloudServiceChainConstants.LPORT_DISPATCHER_TABLE)
+            Flow scfToVpnFlow = new FlowBuilder().setTableId(NwConstants.LPORT_DISPATCHER_TABLE)
                     .setId(new FlowId(scfToVpnFlowRef)).build();
             mdsalManager.removeFlow(dpnId, scfToVpnFlow);
         }
index 884ade19fea8205f736eaffc845dc0c41010f96e..150a937640f1dab9d9714d58ce45991c02df9de5 100644 (file)
@@ -69,7 +69,7 @@ public class ElanDpnInterfacesListener extends AbstractDataChangeListener<DpnInt
             int scfTag = elanLPortListOpc.get().getScfTag();
             Long elanLportTag = elanLPortListOpc.get().getElanLportTag();
             if ( elanLportTag != null ) {
-                short tableId = CloudServiceChainConstants.SCF_DOWN_SUB_FILTER_TCP_BASED_TABLE;
+                short tableId = NwConstants.SCF_DOWN_SUB_FILTER_TCP_BASED_TABLE;
                 handleUpdate(addDpnId, elanName, tableId, elanLportTag.intValue(), scfTag, NwConstants.ADD_FLOW);
             } else {
                 logger.debug("Could not find lportTag for elan={}", elanName);
index ef7726885dac4cada72898ea7ff630eb2fd8f739..5a319b9749ad33c88fa840affcbace5a91072223 100644 (file)
@@ -107,7 +107,7 @@ public class ElanServiceChainUtils {
             List<MatchInfo> matches = Arrays.asList(
                     new MatchInfo(MatchFieldType.metadata,
                             new BigInteger[] { MetaDataUtil.getMetaDataForLPortDispatcher(elanLportTag,
-                                    CloudServiceChainConstants.SCF_SERVICE_INDEX),
+                                    NwConstants.SCF_SERVICE_INDEX),
                                     MetaDataUtil.getMetaDataMaskForLPortDispatcher() }));
             int instructionKey = 0;
             List<Instruction> instructions = Arrays.asList(
@@ -148,7 +148,7 @@ public class ElanServiceChainUtils {
             List<MatchInfo> matches = Arrays.asList(
                     new MatchInfo(MatchFieldType.metadata,
                                   new BigInteger[] { MetaDataUtil.getMetaDataForLPortDispatcher(elanLportTag,
-                                                                             CloudServiceChainConstants.ELAN_SERVICE_INDEX)
+                                                                             NwConstants.ELAN_SERVICE_INDEX)
                                                                   .or(BigInteger.ONE),  // SH FLag
                                                      MetaDataUtil.getMetaDataMaskForLPortDispatcher()
                                                                  .or(BigInteger.ONE) })); // Bit mask for SH Flag
@@ -157,8 +157,7 @@ public class ElanServiceChainUtils {
                     MDSALUtil.buildAndGetWriteMetadaInstruction(ElanServiceChainUtils.getElanMetadataLabel(elanTag),
                             ElanServiceChainUtils.getElanMetadataMask(),
                             instructionKey++),
-                    MDSALUtil.buildAndGetGotoTableInstruction(CloudServiceChainConstants.ELAN_DMAC_TABLE,
-                            instructionKey++) );
+                    MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.ELAN_DMAC_TABLE, instructionKey++) );
 
             Flow flow = MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, flowRef,
                     CloudServiceChainConstants.DEFAULT_LPORT_DISPATCHER_FLOW_PRIORITY,
index 0e5ceb8087ece03ff12a02b3bff738a4e86c0ffd..f44ef59bfa5519c6461a1797b3322de19951f39c 100644 (file)
@@ -189,21 +189,20 @@ public class VpnServiceChainUtils {
                                                         int addOrRemove) {
         logger.info("buildLPortDispFlowForScf vpnId={} dpId={} lportTag={} addOrRemove={} ",
                     vpnId, dpId, lportTag, addOrRemove);
-        List<MatchInfo> matches = buildMatchOnLportTagAndSI(lportTag,
-                                                            CloudServiceChainConstants.L3VPN_SERVICE_IDENTIFIER);
+        List<MatchInfo> matches = buildMatchOnLportTagAndSI(lportTag, NwConstants.L3VPN_SERVICE_INDEX);
         List<Instruction> instructions = buildSetVrfTagAndGotoFibInstructions(vpnId.intValue());
 
         String flowRef = getScfToL3VpnLportDispatcherFlowRef(lportTag);
 
         Flow result;
         if (addOrRemove == NwConstants.ADD_FLOW) {
-            result = MDSALUtil.buildFlowNew(CloudServiceChainConstants.LPORT_DISPATCHER_TABLE, flowRef,
+            result = MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, flowRef,
                                             CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, flowRef,
                                             0, 0, VpnServiceChainUtils.getCookieL3(vpnId.intValue()),
                                             matches, instructions);
 
         } else {
-            result = new FlowBuilder().setTableId(CloudServiceChainConstants.LPORT_DISPATCHER_TABLE)
+            result = new FlowBuilder().setTableId(NwConstants.LPORT_DISPATCHER_TABLE)
                                       .setId(new FlowId(flowRef))
                                       .build();
         }
@@ -264,17 +263,16 @@ public class VpnServiceChainUtils {
         List<InstructionInfo> instructions = new ArrayList<>();
         instructions.add(new InstructionInfo(InstructionType.write_metadata,
                 new BigInteger[]{
-                       MetaDataUtil.getMetaDataForLPortDispatcher(lportTag,
-                                                                  CloudServiceChainConstants.SCF_SERVICE_INDEX),
+                       MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, NwConstants.SCF_SERVICE_INDEX),
                        MetaDataUtil.getMetaDataMaskForLPortDispatcher()
                 }));
 
         instructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos));
         instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] {NwConstants.L3_INTERFACE_TABLE}));
         String flowRef = getLFibVpnPseudoPortFlowRef(lportTag, label, nextHop);
-        return MDSALUtil.buildFlowEntity(dpId, CloudServiceChainConstants.L3_LFIB_TABLE, flowRef,
+        return MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_LFIB_TABLE, flowRef,
                                          CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, flowRef, 0, 0,
-                                         CloudServiceChainConstants.COOKIE_VM_LFIB_TABLE, matches, instructions);
+                                         NwConstants.COOKIE_VM_LFIB_TABLE, matches, instructions);
     }
 
 
@@ -344,7 +342,7 @@ public class VpnServiceChainUtils {
      */
     public static FlowEntity buildLportFlowDispForVpnToScf(BigInteger dpId, Integer lportTag, int scfTag,
                                                            short gotoTableId) {
-        List<MatchInfo> matches = buildMatchOnLportTagAndSI(lportTag, CloudServiceChainConstants.SCF_SERVICE_INDEX);
+        List<MatchInfo> matches = buildMatchOnLportTagAndSI(lportTag, NwConstants.SCF_SERVICE_INDEX);
         List<InstructionInfo> instructions = new ArrayList<InstructionInfo>();
         instructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[] {
                 VpnServiceChainUtils.getMetadataSCF(scfTag), CloudServiceChainConstants.METADATA_MASK_SCF_WRITE
@@ -352,7 +350,7 @@ public class VpnServiceChainUtils {
         instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { gotoTableId }));
         String flowRef = getL3VpnToScfLportDispatcherFlowRef(lportTag);
         FlowEntity flowEntity =
-            MDSALUtil.buildFlowEntity(dpId, CloudServiceChainConstants.LPORT_DISPATCHER_TABLE, flowRef,
+            MDSALUtil.buildFlowEntity(dpId, NwConstants.LPORT_DISPATCHER_TABLE, flowRef,
                                       CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, flowRef, 0, 0,
                                       getCookieSCHop(scfTag), matches, instructions);
         return flowEntity;
@@ -398,11 +396,10 @@ public class VpnServiceChainUtils {
      * @return
      */
     public static Flow buildLPortDispFlowForVpntoVpn(Integer dstLportTag, Integer vpnTag) {
-        List<MatchInfo> matches = buildMatchOnLportTagAndSI(dstLportTag,
-                                                                 CloudServiceChainConstants.L3VPN_SERVICE_IDENTIFIER);
+        List<MatchInfo> matches = buildMatchOnLportTagAndSI(dstLportTag, NwConstants.L3VPN_SERVICE_INDEX);
         List<Instruction> instructions = buildSetVrfTagAndGotoFibInstructions(vpnTag);
         String flowRef = getL3VpnToL3VpnLportDispFlowRef(dstLportTag, vpnTag);
-        Flow result = MDSALUtil.buildFlowNew(CloudServiceChainConstants.LPORT_DISPATCHER_TABLE, flowRef,
+        Flow result = MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, flowRef,
                                              CloudServiceChainConstants.DEFAULT_LPORT_DISPATCHER_FLOW_PRIORITY, flowRef,
                                              0, 0, VpnServiceChainUtils.getCookieL3(vpnTag),
                                              matches, instructions);
index 85129175a16329e2e8edca05924e2801f731e918..b713f0ba14c84c211ee7ccb50fcb996e76424e79 100644 (file)
@@ -294,8 +294,8 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
                         continue;
                     }
                     for (MacEntry mac : macs.getMacEntry())
-                        elanServiceProvider.getMdsalManager().removeFlow(dpId, MDSALUtil.buildFlow(ElanConstants.ELAN_DMAC_TABLE,
-                            ElanUtils.getKnownDynamicmacFlowRef(ElanConstants.ELAN_DMAC_TABLE, dpId, currentDpId, mac.getMacAddress().getValue(), elanTag)));
+                        elanServiceProvider.getMdsalManager().removeFlow(dpId, MDSALUtil.buildFlow(NwConstants.ELAN_DMAC_TABLE,
+                            ElanUtils.getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, currentDpId, mac.getMacAddress().getValue(), elanTag)));
                 }
             }
         }
@@ -598,12 +598,12 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
 
     public void setupFilterEqualsTable(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction writeFlowGroupTx) {
         int ifTag = interfaceInfo.getInterfaceTag();
-        Flow flow = MDSALUtil.buildFlowNew(ElanConstants.ELAN_FILTER_EQUALS_TABLE, getFlowRef(ElanConstants.ELAN_FILTER_EQUALS_TABLE, ifTag),
+        Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_FILTER_EQUALS_TABLE, getFlowRef(NwConstants.ELAN_FILTER_EQUALS_TABLE, ifTag),
             9, elanInfo.getElanInstanceName(), 0, 0, ElanConstants.COOKIE_ELAN_FILTER_EQUALS.add(BigInteger.valueOf(ifTag)), getTunnelIdMatchForFilterEqualsLPortTag(ifTag), ElanUtils.getInstructionsInPortForOutGroup(interfaceInfo.getInterfaceName()));
 
         elanServiceProvider.getMdsalManager().addFlowToTx(interfaceInfo.getDpId(), flow, writeFlowGroupTx);
 
-        Flow flowEntry = MDSALUtil.buildFlowNew(ElanConstants.ELAN_FILTER_EQUALS_TABLE, getFlowRef(ElanConstants.ELAN_FILTER_EQUALS_TABLE, 1000+ifTag),
+        Flow flowEntry = MDSALUtil.buildFlowNew(NwConstants.ELAN_FILTER_EQUALS_TABLE, getFlowRef(NwConstants.ELAN_FILTER_EQUALS_TABLE, 1000+ifTag),
             10, elanInfo.getElanInstanceName(), 0, 0, ElanConstants.COOKIE_ELAN_FILTER_EQUALS.add(BigInteger.valueOf(ifTag)), getMatchesForFilterEqualsLPortTag(ifTag),
             MDSALUtil.buildInstructionsDrop());
 
@@ -612,12 +612,12 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
 
     public void removeFilterEqualsTable(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
         int ifTag = interfaceInfo.getInterfaceTag();
-        Flow flow = MDSALUtil.buildFlowNew(ElanConstants.ELAN_FILTER_EQUALS_TABLE, getFlowRef(ElanConstants.ELAN_FILTER_EQUALS_TABLE, ifTag),
+        Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_FILTER_EQUALS_TABLE, getFlowRef(NwConstants.ELAN_FILTER_EQUALS_TABLE, ifTag),
             9, elanInfo.getElanInstanceName(), 0, 0, ElanConstants.COOKIE_ELAN_FILTER_EQUALS.add(BigInteger.valueOf(ifTag)), getTunnelIdMatchForFilterEqualsLPortTag(ifTag), ElanUtils.getInstructionsInPortForOutGroup(interfaceInfo.getInterfaceName()));
 
         elanServiceProvider.getMdsalManager().removeFlowToTx(interfaceInfo.getDpId(), flow, deleteFlowGroupTx);
 
-        Flow flowEntity = MDSALUtil.buildFlowNew(ElanConstants.ELAN_FILTER_EQUALS_TABLE, getFlowRef(ElanConstants.ELAN_FILTER_EQUALS_TABLE, 1000+ifTag),
+        Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.ELAN_FILTER_EQUALS_TABLE, getFlowRef(NwConstants.ELAN_FILTER_EQUALS_TABLE, 1000+ifTag),
             10, elanInfo.getElanInstanceName(), 0, 0, ElanConstants.COOKIE_ELAN_FILTER_EQUALS.add(BigInteger.valueOf(ifTag)), getMatchesForFilterEqualsLPortTag(ifTag),
             MDSALUtil.buildInstructionsDrop());
 
@@ -806,7 +806,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
         // TODO: We should point to SMAC or DMAC depending on a configuration property to enable
         // mac learning
         mkInstructions.add(new InstructionInfo(InstructionType.goto_table,
-            new long[] { ElanConstants.ELAN_DMAC_TABLE }));
+            new long[] { NwConstants.ELAN_DMAC_TABLE }));
 
         return mkInstructions;
     }
@@ -961,7 +961,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
 
     public void setupUnknownDMacTable(ElanInstance elanInfo, BigInteger dpId, WriteTransaction writeFlowGroupTx) {
         long elanTag = elanInfo.getElanTag();
-        Flow flowEntity = MDSALUtil.buildFlowNew(ElanConstants.ELAN_UNKNOWN_DMAC_TABLE, getUnknownDmacFlowRef(ElanConstants.ELAN_UNKNOWN_DMAC_TABLE, elanTag, /*SH flag*/false),
+        Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.ELAN_UNKNOWN_DMAC_TABLE, getUnknownDmacFlowRef(NwConstants.ELAN_UNKNOWN_DMAC_TABLE, elanTag, /*SH flag*/false),
             5, elanInfo.getElanInstanceName(), 0, 0, ElanConstants.COOKIE_ELAN_UNKNOWN_DMAC.add(BigInteger.valueOf(elanTag)), getMatchesForElanTag(elanTag, /*SH flag*/false),
             getInstructionsForOutGroup(ElanUtils.getElanRemoteBCGID(elanTag)));
 
@@ -969,7 +969,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
 
         // only if ELAN can connect to external network, perform the following
         if (ElanUtils.isVxlan(elanInfo) || ElanUtils.isVlan(elanInfo) || ElanUtils.isFlat(elanInfo)) {
-            Flow flowEntity2 = MDSALUtil.buildFlowNew(ElanConstants.ELAN_UNKNOWN_DMAC_TABLE, getUnknownDmacFlowRef(ElanConstants.ELAN_UNKNOWN_DMAC_TABLE, elanTag, /*SH flag*/true),
+            Flow flowEntity2 = MDSALUtil.buildFlowNew(NwConstants.ELAN_UNKNOWN_DMAC_TABLE, getUnknownDmacFlowRef(NwConstants.ELAN_UNKNOWN_DMAC_TABLE, elanTag, /*SH flag*/true),
                 5, elanInfo.getElanInstanceName(), 0, 0, ElanConstants.COOKIE_ELAN_UNKNOWN_DMAC.add(BigInteger.valueOf(elanTag)), getMatchesForElanTag(elanTag, /*SH flag*/true),
                 getInstructionsForOutGroup(ElanUtils.getElanLocalBCGID(elanTag)));
             elanServiceProvider.getMdsalManager().addFlowToTx(dpId, flowEntity2, writeFlowGroupTx);
@@ -980,16 +980,16 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
     private void removeUnknownDmacFlow(BigInteger dpId, ElanInstance elanInfo, WriteTransaction deleteFlowGroupTx) {
         //        Flow flow = getUnknownDmacFlowEntity(dpId, elanInfo);
         //        mdsalManager.removeFlow(dpId, flow);
-        Flow flow = new FlowBuilder().setId(new FlowId(getUnknownDmacFlowRef(ElanConstants.ELAN_UNKNOWN_DMAC_TABLE,
+        Flow flow = new FlowBuilder().setId(new FlowId(getUnknownDmacFlowRef(NwConstants.ELAN_UNKNOWN_DMAC_TABLE,
             elanInfo.getElanTag(), /*SH flag*/ false)))
-            .setTableId(ElanConstants.ELAN_UNKNOWN_DMAC_TABLE)
+            .setTableId(NwConstants.ELAN_UNKNOWN_DMAC_TABLE)
             .build();
         elanServiceProvider.getMdsalManager().removeFlowToTx(dpId, flow, deleteFlowGroupTx);
 
         if (ElanUtils.isVxlan(elanInfo)) {
-            Flow flow2 = new FlowBuilder().setId(new FlowId(getUnknownDmacFlowRef(ElanConstants.ELAN_UNKNOWN_DMAC_TABLE,
+            Flow flow2 = new FlowBuilder().setId(new FlowId(getUnknownDmacFlowRef(NwConstants.ELAN_UNKNOWN_DMAC_TABLE,
                 elanInfo.getElanTag(), /*SH flag*/ true)))
-                .setTableId(ElanConstants.ELAN_UNKNOWN_DMAC_TABLE)
+                .setTableId(NwConstants.ELAN_UNKNOWN_DMAC_TABLE)
                 .build();
             elanServiceProvider.getMdsalManager().removeFlowToTx(dpId, flow2, deleteFlowGroupTx);
         }
@@ -1008,18 +1008,18 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
         int instructionKey = 0;
         List<Instruction> instructions = new ArrayList<Instruction>();
         instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(ElanUtils.getElanMetadataLabel(elanInfo.getElanTag()), MetaDataUtil.METADATA_MASK_SERVICE, ++instructionKey));
-        instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(ElanConstants.ELAN_SMAC_TABLE, ++instructionKey));
+        instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.ELAN_SMAC_TABLE, ++instructionKey));
         BoundServices
             serviceInfo =
             ElanUtils.getBoundServices(String.format("%s.%s.%s", "vpn",elanInfo.getElanInstanceName(), interfaceName),
-                ElanConstants.ELAN_SERVICE_INDEX, priority,
-                ElanConstants.COOKIE_ELAN_INGRESS_TABLE, instructions);
+                NwConstants.ELAN_SERVICE_INDEX, priority,
+                NwConstants.COOKIE_ELAN_INGRESS_TABLE, instructions);
         tx.put(LogicalDatastoreType.CONFIGURATION,
-            ElanUtils.buildServiceId(interfaceName, ElanConstants.ELAN_SERVICE_INDEX), serviceInfo, true);
+            ElanUtils.buildServiceId(interfaceName, NwConstants.ELAN_SERVICE_INDEX), serviceInfo, true);
     }
 
     private void unbindService(ElanInstance elanInfo, String interfaceName, WriteTransaction tx) {
-        tx.delete(LogicalDatastoreType.CONFIGURATION, ElanUtils.buildServiceId(interfaceName,ElanConstants.ELAN_SERVICE_INDEX));
+        tx.delete(LogicalDatastoreType.CONFIGURATION, ElanUtils.buildServiceId(interfaceName,NwConstants.ELAN_SERVICE_INDEX));
     }
 
     private String getFlowRef(long tableId, long elanTag) {
@@ -1036,7 +1036,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
         listAction.add((new ActionInfo(ActionType.set_field_tunnel_id, new BigInteger[] {BigInteger.valueOf(interfaceInfo.getInterfaceTag())}, actionKey)).buildAction());
         actionKey++;
         listAction.add((new ActionInfo(ActionType.nx_resubmit,
-            new String[] {String.valueOf(ElanConstants.ELAN_FILTER_EQUALS_TABLE)}, actionKey)).buildAction());
+            new String[] {String.valueOf(NwConstants.ELAN_FILTER_EQUALS_TABLE)}, actionKey)).buildAction());
         return listAction;
     }
 
index 8758cfca69978febfa9fdf642963c0d0847a8466..146318c7b8c248bd15aa4bdec913682ed4cd9ba0 100644 (file)
@@ -100,9 +100,9 @@ public class ElanNodeListener extends AbstractDataChangeListener<Node> {
         List <ActionInfo> actionsInfos = new ArrayList <ActionInfo> ();
         actionsInfos.add(new ActionInfo(ActionType.punt_to_controller, new String[] {}));
         mkInstructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos));
-        mkInstructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { ElanConstants.ELAN_DMAC_TABLE }));
+        mkInstructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.ELAN_DMAC_TABLE }));
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, ElanConstants.ELAN_SMAC_TABLE, getTableMissFlowRef(ElanConstants.ELAN_SMAC_TABLE),
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_SMAC_TABLE, getTableMissFlowRef(NwConstants.ELAN_SMAC_TABLE),
             0, "ELAN sMac Table Miss Flow", 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_SMAC,
             mkMatches, mkInstructions);
         this.elanServiceProvider.getMdsalManager().installFlow(flowEntity);
@@ -112,9 +112,9 @@ public class ElanNodeListener extends AbstractDataChangeListener<Node> {
         List<MatchInfo> mkMatches = new ArrayList<MatchInfo>();
 
         List<InstructionInfo> mkInstructions = new ArrayList<InstructionInfo>();
-        mkInstructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { ElanConstants.ELAN_UNKNOWN_DMAC_TABLE }));
+        mkInstructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.ELAN_UNKNOWN_DMAC_TABLE }));
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, ElanConstants.ELAN_DMAC_TABLE, getTableMissFlowRef(ElanConstants.ELAN_DMAC_TABLE),
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_DMAC_TABLE, getTableMissFlowRef(NwConstants.ELAN_DMAC_TABLE),
             0, "ELAN dMac Table Miss Flow", 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC,
             mkMatches, mkInstructions);
         this.elanServiceProvider.getMdsalManager().installFlow(flowEntity);
index 24cf44ef6a315b391b909f407fa91568f5426d42..31074722462e9881a0c9dfa82f2da2c14608f515 100755 (executable)
@@ -13,6 +13,7 @@ import org.opendaylight.controller.liblldp.NetUtils;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
 import org.opendaylight.netvirt.elan.utils.ElanConstants;
 import org.opendaylight.netvirt.elan.utils.ElanUtils;
@@ -72,7 +73,7 @@ public class ElanPacketInHandler implements PacketProcessingListener {
     public void onPacketReceived(PacketReceived notification) {
         Class<? extends PacketInReason>  pktInReason =  notification.getPacketInReason();
         short tableId = notification.getTableId().getValue();
-        if (pktInReason == NoMatch.class && tableId == ElanConstants.ELAN_SMAC_TABLE) {
+        if (pktInReason == NoMatch.class && tableId == NwConstants.ELAN_SMAC_TABLE) {
             try {
                 byte[] data = notification.getPayload();
                 Ethernet res = new Ethernet();
index 63701aa9818f456777d70539d39f1bd38209868c..df426b1e8f9d9161b789a65c07e12d99aaf17b5c 100644 (file)
@@ -12,6 +12,7 @@ import java.math.BigInteger;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.netvirt.elan.utils.ElanConstants;
 import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
@@ -72,7 +73,7 @@ public class ElanSmacFlowEventListener implements SalFlowListener {
     @Override
     public void onFlowRemoved(FlowRemoved flowRemoved) {
         short tableId = flowRemoved.getTableId();
-        if (tableId == ElanConstants.ELAN_SMAC_TABLE) {
+        if (tableId == NwConstants.ELAN_SMAC_TABLE) {
             BigInteger metadata = flowRemoved.getMatch().getMetadata().getMetadata();
             long elanTag = MetaDataUtil.getElanTagFromMetadata(metadata);
             ElanTagName elanTagInfo = ElanUtils.getElanInfoByElanTag(elanTag);
index 7bb8bdfb7b776f660402ec5abf68a0d0cd50c18b..8ad86f1e0db533cc18d1378347c4903b2b2549c8 100755 (executable)
@@ -10,6 +10,7 @@ package org.opendaylight.netvirt.elan.statisitcs;
 import com.google.common.util.concurrent.Futures;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.netvirt.elan.internal.ElanServiceProvider;
 import org.opendaylight.netvirt.elan.utils.ElanConstants;
 import org.opendaylight.netvirt.elan.utils.ElanUtils;
@@ -115,7 +116,7 @@ public class ElanStatisticsImpl implements ElanStatisticsService {
             matches = InterfaceServiceUtil.getMatchInfoForVlanLPort(dpId, interfaceInfo.getPortNo(),
                 InterfaceServiceUtil.getVlanId(interfaceName, elanServiceProvider.getBroker()), vlanInterfaceInfo.isVlanTransparent());
         } else {
-            matches = InterfaceServiceUtil.getLPortDispatcherMatches(ElanConstants.ELAN_SERVICE_INDEX, interfaceInfo.getInterfaceTag());
+            matches = InterfaceServiceUtil.getLPortDispatcherMatches(NwConstants.ELAN_SERVICE_INDEX, interfaceInfo.getInterfaceTag());
         }
         long groupId = interfaceInfo.getGroupId();
         Set<Object> statRequestKeys = InterfaceServiceUtil.getStatRequestKeys(dpId, tableId, matches, String.format("%s.%s", elanInstanceName, interfaceName), groupId);
index 4b61400cc65d156eeb17141e5cc62cd220780dcf..1edad59562e720f1c29430dc3b8e505517b16928 100755 (executable)
@@ -18,10 +18,6 @@ public class ElanConstants {
     public static final long ELAN_ID_LOW_VALUE = 5000L;
     public static final long ELAN_ID_HIGH_VALUE = 10000L;
     public static final int ELAN_GID_MIN = 200000;
-    public static final short ELAN_SMAC_TABLE = 50;
-    public static final short ELAN_DMAC_TABLE = 51;
-    public static final short ELAN_UNKNOWN_DMAC_TABLE = 52;
-    public static final short ELAN_SERVICE_INDEX = 4;
     public static final int ELAN_SERVICE_PRIORITY = 5;
     public static final int STATIC_MAC_TIMEOUT = 0;
     public static final long DELAY_TIME_IN_MILLISECOND = 5000;
@@ -29,9 +25,7 @@ public class ElanConstants {
     public static final BigInteger COOKIE_ELAN_UNKNOWN_DMAC = new BigInteger("8700000", 16);
     public static final BigInteger COOKIE_ELAN_KNOWN_SMAC = new BigInteger("8050000", 16);
     public static final BigInteger COOKIE_ELAN_KNOWN_DMAC = new BigInteger("8030000", 16);
-    public static final BigInteger COOKIE_ELAN_INGRESS_TABLE = new BigInteger("8040000", 16);
        public static final long DEFAULT_MAC_TIME_OUT = 30;
-    public static final short ELAN_FILTER_EQUALS_TABLE = 55;
     public static final BigInteger COOKIE_ELAN_FILTER_EQUALS = new BigInteger("8800000", 16);
 
     public static final String L2GATEWAY_DS_JOB_NAME = "L2GW";
index 6ab9de86cabb8102318a21376ae027544ec7c65f..5889e948cfcb2133c40b75a53ecd7e1adb5aefb3 100644 (file)
@@ -610,10 +610,10 @@ public class ElanUtils {
             ElanUtils.getElanMetadataMask() }));
         mkMatches.add(new MatchInfo(MatchFieldType.eth_src, new String[] { macAddress }));
         List<InstructionInfo> mkInstructions = new ArrayList<InstructionInfo>();
-        mkInstructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { ElanConstants.ELAN_DMAC_TABLE }));
+        mkInstructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.ELAN_DMAC_TABLE }));
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, ElanConstants.ELAN_SMAC_TABLE,
-            getKnownDynamicmacFlowRef(ElanConstants.ELAN_SMAC_TABLE, dpId, lportTag, macAddress, elanTag),
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_SMAC_TABLE,
+            getKnownDynamicmacFlowRef(NwConstants.ELAN_SMAC_TABLE, dpId, lportTag, macAddress, elanTag),
             20, elanInfo.getDescription(), (int)macTimeout, 0, ElanConstants.COOKIE_ELAN_KNOWN_SMAC.add(BigInteger.valueOf(elanTag)),
             mkMatches, mkInstructions);
         flowEntity.setStrictFlag(true);
@@ -845,8 +845,8 @@ public class ElanUtils {
         List<Instruction> mkInstructions = new ArrayList<Instruction>();
         List<Action> actions = getEgressActionsForInterface(ifName, /* tunnelKey */ null);
         mkInstructions.add(MDSALUtil.buildApplyActionsInstruction(actions));
-        Flow flow = MDSALUtil.buildFlowNew(ElanConstants.ELAN_DMAC_TABLE,
-            getKnownDynamicmacFlowRef(ElanConstants.ELAN_DMAC_TABLE, dpId, ifTag, macAddress, elanTag), 20,
+        Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_DMAC_TABLE,
+            getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, ifTag, macAddress, elanTag), 20,
             displayName, 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC.add(BigInteger.valueOf(elanTag)), mkMatches,
             mkInstructions);
 
@@ -902,8 +902,8 @@ public class ElanUtils {
         }
 
 
-        Flow flow = MDSALUtil.buildFlowNew(ElanConstants.ELAN_DMAC_TABLE,
-            getKnownDynamicmacFlowRef(ElanConstants.ELAN_DMAC_TABLE, srcDpId, destDpId, macAddress, elanTag),
+        Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_DMAC_TABLE,
+            getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, srcDpId, destDpId, macAddress, elanTag),
             20,  /* prio */
             displayName, 0,   /* idleTimeout */
             0,   /* hardTimeout */
@@ -936,8 +936,8 @@ public class ElanUtils {
                 isFlowsRemovedInSrcDpn = true;
                 deleteSmacAndDmacFlows(elanInfo, interfaceInfo, macAddress, deleteSmac, deleteFlowGroupTx);
             } else if (isDpnPresent(dstDpId)) {
-                elanServiceProvider.getMdsalManager().removeFlowToTx(dstDpId, MDSALUtil.buildFlow(ElanConstants.ELAN_DMAC_TABLE,
-                    getKnownDynamicmacFlowRef(ElanConstants.ELAN_DMAC_TABLE, dstDpId, srcdpId, macAddress, elanTag)), deleteFlowGroupTx);
+                elanServiceProvider.getMdsalManager().removeFlowToTx(dstDpId, MDSALUtil.buildFlow(NwConstants.ELAN_DMAC_TABLE,
+                    getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dstDpId, srcdpId, macAddress, elanTag)), deleteFlowGroupTx);
                 if (logger.isDebugEnabled()) {
                     logger.debug("Dmac flow entry deleted for elan:{}, logical interface port:{} and mac address:{} on dpn:{}", elanInstanceName, interfaceInfo.getPortName(), macAddress, dstDpId);
                 }
@@ -955,11 +955,11 @@ public class ElanUtils {
         BigInteger srcdpId = interfaceInfo.getDpId();
         Long elanTag = elanInfo.getElanTag();
         if (deleteSmac) {
-            elanServiceProvider.getMdsalManager().removeFlowToTx(srcdpId, MDSALUtil.buildFlow(ElanConstants.ELAN_SMAC_TABLE,
-                getKnownDynamicmacFlowRef(ElanConstants.ELAN_SMAC_TABLE, srcdpId, ifTag, macAddress, elanTag)), deleteFlowGroupTx);
+            elanServiceProvider.getMdsalManager().removeFlowToTx(srcdpId, MDSALUtil.buildFlow(NwConstants.ELAN_SMAC_TABLE,
+                getKnownDynamicmacFlowRef(NwConstants.ELAN_SMAC_TABLE, srcdpId, ifTag, macAddress, elanTag)), deleteFlowGroupTx);
         }
-        elanServiceProvider.getMdsalManager().removeFlowToTx(srcdpId, MDSALUtil.buildFlow(ElanConstants.ELAN_DMAC_TABLE,
-            getKnownDynamicmacFlowRef(ElanConstants.ELAN_DMAC_TABLE, srcdpId, ifTag, macAddress, elanTag)), deleteFlowGroupTx);
+        elanServiceProvider.getMdsalManager().removeFlowToTx(srcdpId, MDSALUtil.buildFlow(NwConstants.ELAN_DMAC_TABLE,
+            getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, srcdpId, ifTag, macAddress, elanTag)), deleteFlowGroupTx);
         if (logger.isDebugEnabled()) {
             logger.debug("All the required flows deleted for elan:{}, logical Interface port:{} and mac address:{} on dpn:{}", elanInstanceName, interfaceInfo.getPortName(), macAddress, srcdpId);
         }
@@ -1024,10 +1024,10 @@ public class ElanUtils {
         int instructionKey = 0;
         List<Instruction> instructions = new ArrayList<Instruction>();
         instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(ElanUtils.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE, ++instructionKey));
-        instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(ElanConstants.ELAN_SMAC_TABLE, ++instructionKey));
+        instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.ELAN_SMAC_TABLE, ++instructionKey));
 
-        ServicesInfo serviceInfo = InterfaceServiceUtil.buildServiceInfo(String.format("%s.%s", elanInstanceName, interfaceName), ElanConstants.ELAN_SERVICE_INDEX,
-            priority, ElanConstants.COOKIE_ELAN_INGRESS_TABLE, instructions);
+        ServicesInfo serviceInfo = InterfaceServiceUtil.buildServiceInfo(String.format("%s.%s", elanInstanceName, interfaceName), NwConstants.ELAN_SERVICE_INDEX,
+            priority, NwConstants.COOKIE_ELAN_INGRESS_TABLE, instructions);
         return serviceInfo;
     }
 
@@ -1406,8 +1406,8 @@ public class ElanUtils {
             logger.error("Could not get Egress Actions for DpId={}  externalNode={}", dpId, extDeviceNodeId );
         }
 
-        Flow flow = MDSALUtil.buildFlowNew(ElanConstants.ELAN_DMAC_TABLE,
-            getKnownDynamicmacFlowRef(ElanConstants.ELAN_DMAC_TABLE, dpId, extDeviceNodeId, dstMacAddress, elanTag,
+        Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_DMAC_TABLE,
+            getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, extDeviceNodeId, dstMacAddress, elanTag,
                 false),
             20,  /* prio */
             displayName, 0,   /* idleTimeout */
@@ -1432,9 +1432,9 @@ public class ElanUtils {
                                                                   Long elanTag, String dstMacAddress) {
         List<MatchInfo> mkMatches = buildMatchesForElanTagShFlagAndDstMac(elanTag, /*shFlag*/ true, dstMacAddress);
         List<Instruction> mkInstructions = MDSALUtil.buildInstructionsDrop();
-        String flowId = getKnownDynamicmacFlowRef(ElanConstants.ELAN_DMAC_TABLE, dpnId, extDeviceNodeId, dstMacAddress,
+        String flowId = getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpnId, extDeviceNodeId, dstMacAddress,
             elanTag, true);
-        Flow flow = MDSALUtil.buildFlowNew(ElanConstants.ELAN_DMAC_TABLE, flowId, 20,  /* prio */
+        Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_DMAC_TABLE, flowId, 20,  /* prio */
             "Drop", 0,   /* idleTimeout */
             0,   /* hardTimeout */
             ElanConstants.COOKIE_ELAN_KNOWN_DMAC.add(BigInteger.valueOf(elanTag)), mkMatches, mkInstructions);
@@ -1443,7 +1443,7 @@ public class ElanUtils {
     }
 
     private static String getDmacDropFlowId(Long elanTag, String dstMacAddress) {
-        return new StringBuilder(ElanConstants.ELAN_DMAC_TABLE).append(elanTag).append(dstMacAddress).append("Drop")
+        return new StringBuilder(NwConstants.ELAN_DMAC_TABLE).append(elanTag).append(dstMacAddress).append("Drop")
             .toString();
     }
 
@@ -1482,8 +1482,8 @@ public class ElanUtils {
                 localDpId, remoteDpId, lportTag);
         }
 
-        Flow flow = MDSALUtil.buildFlowNew(ElanConstants.ELAN_DMAC_TABLE,
-            getKnownDynamicmacFlowRef(ElanConstants.ELAN_DMAC_TABLE, localDpId, remoteDpId, macAddress, elanTag),
+        Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_DMAC_TABLE,
+            getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, localDpId, remoteDpId, macAddress, elanTag),
             20,  /* prio */
             displayName, 0,   /* idleTimeout */
             0,   /* hardTimeout */
@@ -1541,16 +1541,16 @@ public class ElanUtils {
         List<ListenableFuture<Void>> futures = new ArrayList<>();
         synchronized (macToRemove) {
             // Removing the flows that sends the packet on an external tunnel
-            String flowId = getKnownDynamicmacFlowRef(ElanConstants.ELAN_DMAC_TABLE, dpId, extDeviceNodeId,
+            String flowId = getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, extDeviceNodeId,
                 macToRemove, elanTag, false);
-            Flow flowToRemove = new FlowBuilder().setId(new FlowId(flowId)).setTableId(ElanConstants.ELAN_DMAC_TABLE)
+            Flow flowToRemove = new FlowBuilder().setId(new FlowId(flowId)).setTableId(NwConstants.ELAN_DMAC_TABLE)
                 .build();
             futures.add(elanServiceProvider.getMdsalManager().removeFlow(dpId, flowToRemove));
 
             // And now removing the drop flow
-            flowId = getKnownDynamicmacFlowRef(ElanConstants.ELAN_DMAC_TABLE, dpId, extDeviceNodeId, macToRemove,
+            flowId = getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, extDeviceNodeId, macToRemove,
                 elanTag, true);
-            flowToRemove = new FlowBuilder().setId(new FlowId(flowId)).setTableId(ElanConstants.ELAN_DMAC_TABLE)
+            flowToRemove = new FlowBuilder().setId(new FlowId(flowId)).setTableId(NwConstants.ELAN_DMAC_TABLE)
                 .build();
             futures.add(elanServiceProvider.getMdsalManager().removeFlow(dpId, flowToRemove));
         }
index c269a0343c1f22dc74bed9520f7fae038402b216..7f5f5b216630cd554579d6a723fad8c05ebb1671 100644 (file)
@@ -127,7 +127,6 @@ public class FibManager extends AbstractDataChangeListener<VrfEntry> implements
 
   private OdlInterfaceRpcService interfaceManager;
   private IdManagerService idManager;
-  private static final BigInteger COOKIE_VM_LFIB_TABLE = new BigInteger("8000002", 16);
   private static final BigInteger COOKIE_VM_FIB_TABLE =  new BigInteger("8000003", 16);
   private static final int DEFAULT_FIB_FLOW_PRIORITY = 10;
   private static final int LFIB_INTERVPN_PRIORITY = 1;
@@ -1626,7 +1625,7 @@ public class FibManager extends AbstractDataChangeListener<VrfEntry> implements
 
         FlowEntity flowEntity;
         flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_LFIB_TABLE, flowRef, priority, flowRef, 0, 0,
-                                               COOKIE_VM_LFIB_TABLE, matches, instructions);
+                                               NwConstants.COOKIE_VM_LFIB_TABLE, matches, instructions);
         Flow flow = flowEntity.getFlowBuilder().build();
         String flowId = flowEntity.getFlowId();
         FlowKey flowKey = new FlowKey( new FlowId(flowId));
index f8c44a4d7efcb42c58f3f2abffeca05c256267b0..b1c179c302937f8d3756ce62b7ce02a710998611 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.netvirt.natservice.internal;
 
+import org.opendaylight.genius.mdsalutil.*;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExternalNetworks;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.networks.Networks;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
-import org.opendaylight.genius.mdsalutil.AbstractDataChangeListener;
-import org.opendaylight.genius.mdsalutil.FlowEntity;
-import org.opendaylight.genius.mdsalutil.InstructionInfo;
-import org.opendaylight.genius.mdsalutil.InstructionType;
-import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
-import org.opendaylight.genius.mdsalutil.MatchInfo;
-import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -195,13 +188,13 @@ public class ExternalNetworkListener extends AbstractDataChangeListener<Networks
                 BigInteger.valueOf(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
 
         List<InstructionInfo> instructions = new ArrayList<>();
-        instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NatConstants.PSNAT_TABLE }));
+        instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.PSNAT_TABLE }));
 
-        String flowRef = NatUtil.getFlowRef(dpId, NatConstants.L3_FIB_TABLE, defaultIP);
+        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.L3_FIB_TABLE, defaultIP);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.L3_FIB_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_FIB_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_DNAT_TABLE, matches, instructions);
 
         return flowEntity;
 
index 6109524a4bdb97417b485f4279428cd5df3355c6..acf9e5fd702087baa6c05cd9cccee11ec0049742 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;\r
 import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;\r
 import org.opendaylight.genius.mdsalutil.MDSALUtil;\r
+import org.opendaylight.genius.mdsalutil.NwConstants;\r
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpidFromInterfaceInput;\r
@@ -264,7 +265,7 @@ public class ExternalNetworksChangeListener extends AsyncDataTreeChangeListenerB
                       String externalIp = ipMap.getExternalIp();\r
                       LOG.debug("NAT Service : got externalIp as {}", externalIp);\r
                       LOG.debug("NAT Service : About to call advToBgpAndInstallFibAndTsFlows for dpnId {}, vpnName {} and externalIp {}", dpnId, vpnName, externalIp);\r
-                      externalRouterListener.advToBgpAndInstallFibAndTsFlows(dpnId, NatConstants.INBOUND_NAPT_TABLE, vpnName, NatUtil.getVpnId(dataBroker, routerId.getValue()), externalIp, vpnService, fibService, bgpManager, dataBroker, LOG);\r
+                      externalRouterListener.advToBgpAndInstallFibAndTsFlows(dpnId, NwConstants.INBOUND_NAPT_TABLE, vpnName, NatUtil.getVpnId(dataBroker, routerId.getValue()), externalIp, vpnService, fibService, bgpManager, dataBroker, LOG);\r
                   }\r
             } else {\r
                 LOG.warn("NAT Service : No ipMapping present fot the routerId {}", routerId);\r
index 7c4810995238a28cf44fa6a56fe8164985376fe1..65d8f8b4650da14e8e6d58cf2e49d6283d77aa56 100644 (file)
@@ -582,9 +582,9 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         instructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos));
         instructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[] { BigInteger.valueOf(routerId), MetaDataUtil.METADATA_MASK_VRFID }));
 
-        String flowRef = getFlowRefOutbound(dpId, NatConstants.OUTBOUND_NAPT_TABLE, routerId);
+        String flowRef = getFlowRefOutbound(dpId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
         BigInteger cookie = getCookieOutboundFlow(routerId);
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.OUTBOUND_NAPT_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef,
                 5, flowRef, 0, 0,
                 cookie, matches, instructions);
         LOG.debug("NAT Service : returning flowEntity {}", flowEntity);
@@ -715,10 +715,10 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         LOG.debug("NAT Service : Setting the tunnel to the list of action infos {}", actionsInfo);
         actionsInfo.add(new ActionInfo(ActionType.group, new String[] {String.valueOf(groupId)}));
         instructions.add(new InstructionInfo(InstructionType.write_actions, actionsInfo));
-        String flowRef = getFlowRefSnat(dpId, NatConstants.PSNAT_TABLE, routerName);
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PSNAT_TABLE, flowRef,
+        String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_SNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
 
         LOG.debug("NAT Service : Returning SNAT Flow Entity {}", flowEntity);
         return flowEntity;
@@ -737,12 +737,12 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         List<InstructionInfo> instructions = new ArrayList<InstructionInfo>();
         instructions.add(new InstructionInfo(InstructionType.goto_table, new long[]
-                { NatConstants.OUTBOUND_NAPT_TABLE }));
+                { NwConstants.OUTBOUND_NAPT_TABLE }));
 
-        String flowRef = getFlowRefSnat(dpId, NatConstants.PSNAT_TABLE, routerName);
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PSNAT_TABLE, flowRef,
+        String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_SNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
 
         LOG.debug("NAT Service : Returning SNAT Flow Entity {}", flowEntity);
         return flowEntity;
@@ -768,9 +768,9 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         instructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[]
                 { routerId, MetaDataUtil.METADATA_MASK_VRFID }));
         instructions.add(new InstructionInfo(InstructionType.goto_table, new long[]
-                { NatConstants.OUTBOUND_NAPT_TABLE }));
-        String flowRef = getFlowRefTs(dpId, NatConstants.TERMINATING_SERVICE_TABLE, routerId.longValue());
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.TERMINATING_SERVICE_TABLE, flowRef,
+                { NwConstants.OUTBOUND_NAPT_TABLE }));
+        String flowRef = getFlowRefTs(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, routerId.longValue());
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, flowRef,
                 NatConstants.DEFAULT_TS_FLOW_PRIORITY, flowRef, 0, 0,
                 NatConstants.COOKIE_TS_TABLE, matches, instructions);
         return flowEntity;
@@ -887,7 +887,7 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
     List<BucketInfo> getBucketInfoForPrimaryNaptSwitch(){
         List<BucketInfo> listBucketInfo = new ArrayList<>();
         List<ActionInfo> listActionInfoPrimary =  new ArrayList<>();
-        listActionInfoPrimary.add(new ActionInfo(ActionType.nx_resubmit, new String[]{String.valueOf(NatConstants.TERMINATING_SERVICE_TABLE)}));
+        listActionInfoPrimary.add(new ActionInfo(ActionType.nx_resubmit, new String[]{String.valueOf(NwConstants.INTERNAL_TUNNEL_TABLE)}));
         BucketInfo bucketPrimary = new BucketInfo(listActionInfoPrimary);
         listBucketInfo.add(0, bucketPrimary);
         return listBucketInfo;
@@ -910,13 +910,13 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
         ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
-        listActionInfo.add(new ActionInfo(ActionType.nx_resubmit, new String[] { Integer.toString(NatConstants.L3_FIB_TABLE) }));
+        listActionInfo.add(new ActionInfo(ActionType.nx_resubmit, new String[] { Integer.toString(NwConstants.L3_FIB_TABLE) }));
         instructionInfo.add(new InstructionInfo(InstructionType.apply_actions, listActionInfo));
 
-        String flowRef = getFlowRefTs(dpId, NatConstants.NAPT_PFIB_TABLE, segmentId);
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.NAPT_PFIB_TABLE, flowRef,
+        String flowRef = getFlowRefTs(dpId, NwConstants.NAPT_PFIB_TABLE, segmentId);
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.NAPT_PFIB_TABLE, flowRef,
                 NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_SNAT_TABLE, matches, instructionInfo);
+                NwConstants.COOKIE_SNAT_TABLE, matches, instructionInfo);
 
         LOG.debug("NAT Service : Returning NaptPFib Flow Entity {}", flowEntity);
         return flowEntity;
@@ -935,7 +935,7 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                     networkId, externalIp, routerId);
             return;
         }
-        advToBgpAndInstallFibAndTsFlows(dpnId, NatConstants.INBOUND_NAPT_TABLE, vpnName, routerId, externalIp, vpnService, fibService, bgpManager, dataBroker, LOG);
+        advToBgpAndInstallFibAndTsFlows(dpnId, NwConstants.INBOUND_NAPT_TABLE, vpnName, routerId, externalIp, vpnService, fibService, bgpManager, dataBroker, LOG);
         LOG.debug("NAT Service : handleSnatReverseTraffic() exit for DPN ID, routerId, externalIp : {}", dpnId, routerId, externalIp);
     }
 
@@ -1257,7 +1257,7 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                 LOG.debug("Remove the NAPT translation entries from Inbound NAPT tables for the removed external IP {}", externalIp);
                 for(Integer externalPort : externalPorts) {
                     //Remove the NAPT translation entries from Inbound NAPT table
-                    naptEventHandler.removeNatFlows(dpnId, NatConstants.INBOUND_NAPT_TABLE, routerId, externalIp, externalPort);
+                    naptEventHandler.removeNatFlows(dpnId, NwConstants.INBOUND_NAPT_TABLE, routerId, externalIp, externalPort);
                 }
 
                 Set<Map.Entry<String, List<String>>> internalIpPorts = internalIpPortMap.entrySet();
@@ -1267,7 +1267,7 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                     List<String> internalPorts = internalIpPort.getValue();
                     for(String internalPort : internalPorts){
                         //Remove the NAPT translation entries from Outbound NAPT table
-                        naptEventHandler.removeNatFlows(dpnId, NatConstants.OUTBOUND_NAPT_TABLE, routerId, internalIp, Integer.valueOf(internalPort));
+                        naptEventHandler.removeNatFlows(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId, internalIp, Integer.valueOf(internalPort));
                     }
                 }
             }
@@ -1396,7 +1396,7 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                     LOG.debug("Best effort for getting primary napt switch when router i/f are added after gateway-set");
                     dpnId = NatUtil.getPrimaryNaptfromRouterId(dataBroker,routerId);
                 }
-                advToBgpAndInstallFibAndTsFlows(dpnId, NatConstants.INBOUND_NAPT_TABLE, vpnName, routerId,
+                advToBgpAndInstallFibAndTsFlows(dpnId, NwConstants.INBOUND_NAPT_TABLE, vpnName, routerId,
                         leastLoadedExtIp + "/" + leastLoadedExtIpPrefix, vpnService, fibService, bgpManager, dataBroker, LOG);
             }
         }
@@ -1539,32 +1539,32 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         //Remove the PSNAT entry which forwards the packet to Outbound NAPT Table (For the
         // traffic which comes from the  VMs of the NAPT switches)
-        String pSNatFlowRef = getFlowRefSnat(dpnId, NatConstants.PSNAT_TABLE, routerName);
-        FlowEntity pSNatFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.PSNAT_TABLE, pSNatFlowRef);
+        String pSNatFlowRef = getFlowRefSnat(dpnId, NwConstants.PSNAT_TABLE, routerName);
+        FlowEntity pSNatFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.PSNAT_TABLE, pSNatFlowRef);
 
-        LOG.info("NAT Service : Remove the flow in the " + NatConstants.PSNAT_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
+        LOG.info("NAT Service : Remove the flow in the " + NwConstants.PSNAT_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
         mdsalManager.removeFlow(pSNatFlowEntity);
 
         //Remove the Terminating Service table entry which forwards the packet to Outbound NAPT Table (For the
         // traffic which comes from the VMs of the non NAPT switches)
-        String tsFlowRef = getFlowRefTs(dpnId, NatConstants.TERMINATING_SERVICE_TABLE, routerId);
-        FlowEntity tsNatFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.TERMINATING_SERVICE_TABLE, tsFlowRef);
+        String tsFlowRef = getFlowRefTs(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, routerId);
+        FlowEntity tsNatFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, tsFlowRef);
 
-        LOG.info("NAT Service : Remove the flow in the " + NatConstants.TERMINATING_SERVICE_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
+        LOG.info("NAT Service : Remove the flow in the " + NwConstants.INTERNAL_TUNNEL_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
         mdsalManager.removeFlow(tsNatFlowEntity);
 
         //Remove the Outbound flow entry which forwards the packet to FIB Table
-        String outboundNatFlowRef = getFlowRefOutbound(dpnId, NatConstants.OUTBOUND_NAPT_TABLE, routerId);
-        FlowEntity outboundNatFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.OUTBOUND_NAPT_TABLE, outboundNatFlowRef);
+        String outboundNatFlowRef = getFlowRefOutbound(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
+        FlowEntity outboundNatFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, outboundNatFlowRef);
 
-        LOG.info("NAT Service : Remove the flow in the " + NatConstants.OUTBOUND_NAPT_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
+        LOG.info("NAT Service : Remove the flow in the " + NwConstants.OUTBOUND_NAPT_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
         mdsalManager.removeFlow(outboundNatFlowEntity);
 
         //Remove the NAPT PFIB TABLE which forwards the incoming packet to FIB Table matching on the router ID.
-        String natPfibFlowRef = getFlowRefTs(dpnId, NatConstants.NAPT_PFIB_TABLE, routerId);
-        FlowEntity natPfibFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.NAPT_PFIB_TABLE, natPfibFlowRef);
+        String natPfibFlowRef = getFlowRefTs(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId);
+        FlowEntity natPfibFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.NAPT_PFIB_TABLE, natPfibFlowRef);
 
-        LOG.info("NAT Service : Remove the flow in the " + NatConstants.NAPT_PFIB_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
+        LOG.info("NAT Service : Remove the flow in the " + NwConstants.NAPT_PFIB_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
         mdsalManager.removeFlow(natPfibFlowEntity);
 
         //Long vpnId = NatUtil.getVpnId(dataBroker, routerId); - This does not work since ext-routers is deleted already - no network info
@@ -1587,9 +1587,9 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         if(vpnId != NatConstants.INVALID_ID){
            //Remove the NAPT PFIB TABLE which forwards the outgoing packet to FIB Table matching on the VPN ID.
-           String natPfibVpnFlowRef = getFlowRefTs(dpnId, NatConstants.NAPT_PFIB_TABLE, vpnId);
-           FlowEntity natPfibVpnFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.NAPT_PFIB_TABLE, natPfibVpnFlowRef);
-           LOG.info("NAT Service : Remove the flow in the " + NatConstants.NAPT_PFIB_TABLE + " for the active switch with the DPN ID {} and VPN ID {}", dpnId, vpnId);
+           String natPfibVpnFlowRef = getFlowRefTs(dpnId, NwConstants.NAPT_PFIB_TABLE, vpnId);
+           FlowEntity natPfibVpnFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.NAPT_PFIB_TABLE, natPfibVpnFlowRef);
+           LOG.info("NAT Service : Remove the flow in the " + NwConstants.NAPT_PFIB_TABLE + " for the active switch with the DPN ID {} and VPN ID {}", dpnId, vpnId);
            mdsalManager.removeFlow(natPfibVpnFlowEntity);
         }
 
@@ -1614,10 +1614,10 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                 String internalPort = ipPortParts[1];
 
                 //Build the flow for the outbound NAPT table
-                String switchFlowRef = NatUtil.getNaptFlowRef(dpnId, NatConstants.OUTBOUND_NAPT_TABLE, String.valueOf(routerId), internalIp, Integer.valueOf(internalPort));
-                FlowEntity outboundNaptFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.OUTBOUND_NAPT_TABLE, cookieSnatFlow, switchFlowRef);
+                String switchFlowRef = NatUtil.getNaptFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, String.valueOf(routerId), internalIp, Integer.valueOf(internalPort));
+                FlowEntity outboundNaptFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, cookieSnatFlow, switchFlowRef);
 
-                LOG.info("NAT Service : Remove the flow in the " + NatConstants.OUTBOUND_NAPT_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
+                LOG.info("NAT Service : Remove the flow in the " + NwConstants.OUTBOUND_NAPT_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
                 mdsalManager.removeFlow(outboundNaptFlowEntity);
 
                 IpPortExternal ipPortExternal = ipPortMap.getIpPortExternal();
@@ -1625,10 +1625,10 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                 int externalPort = ipPortExternal.getPortNum();
 
                 //Build the flow for the inbound NAPT table
-                switchFlowRef = NatUtil.getNaptFlowRef(dpnId, NatConstants.INBOUND_NAPT_TABLE, String.valueOf(routerId), externalIp, externalPort);
-                FlowEntity inboundNaptFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.INBOUND_NAPT_TABLE, cookieSnatFlow, switchFlowRef);
+                switchFlowRef = NatUtil.getNaptFlowRef(dpnId, NwConstants.INBOUND_NAPT_TABLE, String.valueOf(routerId), externalIp, externalPort);
+                FlowEntity inboundNaptFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.INBOUND_NAPT_TABLE, cookieSnatFlow, switchFlowRef);
 
-                LOG.info("NAT Service : Remove the flow in the " + NatConstants.INBOUND_NAPT_TABLE + " for the active active switch with the DPN ID {} and router ID {}", dpnId, routerId);
+                LOG.info("NAT Service : Remove the flow in the " + NwConstants.INBOUND_NAPT_TABLE + " for the active active switch with the DPN ID {} and router ID {}", dpnId, routerId);
                 mdsalManager.removeFlow(inboundNaptFlowEntity);
             }
         }
@@ -1650,9 +1650,9 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
          if(vpnId != NatConstants.INVALID_ID){
             //Remove the NAPT PFIB TABLE which forwards the outgoing packet to FIB Table matching on the VPN ID.
-            String natPfibVpnFlowRef = getFlowRefTs(dpnId, NatConstants.NAPT_PFIB_TABLE, vpnId);
-            FlowEntity natPfibVpnFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.NAPT_PFIB_TABLE, natPfibVpnFlowRef);
-            LOG.info("NAT Service : Remove the flow in the " + NatConstants.NAPT_PFIB_TABLE + " for the active switch with the DPN ID {} and VPN ID {}", dpnId, vpnId);
+            String natPfibVpnFlowRef = getFlowRefTs(dpnId, NwConstants.NAPT_PFIB_TABLE, vpnId);
+            FlowEntity natPfibVpnFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.NAPT_PFIB_TABLE, natPfibVpnFlowRef);
+            LOG.info("NAT Service : Remove the flow in the " + NwConstants.NAPT_PFIB_TABLE + " for the active switch with the DPN ID {} and VPN ID {}", dpnId, vpnId);
             mdsalManager.removeFlow(natPfibVpnFlowEntity);
 
              // Remove IP-PORT active NAPT entries and release port from IdManager
@@ -1676,10 +1676,10 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                      String internalPort = ipPortParts[1];
 
                      //Build the flow for the outbound NAPT table
-                     String switchFlowRef = NatUtil.getNaptFlowRef(dpnId, NatConstants.OUTBOUND_NAPT_TABLE, String.valueOf(routerId), internalIp, Integer.valueOf(internalPort));
-                     FlowEntity outboundNaptFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.OUTBOUND_NAPT_TABLE, cookieSnatFlow, switchFlowRef);
+                     String switchFlowRef = NatUtil.getNaptFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, String.valueOf(routerId), internalIp, Integer.valueOf(internalPort));
+                     FlowEntity outboundNaptFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, cookieSnatFlow, switchFlowRef);
 
-                     LOG.info("NAT Service : Remove the flow in the " + NatConstants.OUTBOUND_NAPT_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
+                     LOG.info("NAT Service : Remove the flow in the " + NwConstants.OUTBOUND_NAPT_TABLE + " for the active switch with the DPN ID {} and router ID {}", dpnId, routerId);
                      mdsalManager.removeFlow(outboundNaptFlowEntity);
 
                      IpPortExternal ipPortExternal = ipPortMap.getIpPortExternal();
@@ -1687,10 +1687,10 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                      int externalPort = ipPortExternal.getPortNum();
 
                      //Build the flow for the inbound NAPT table
-                     switchFlowRef = NatUtil.getNaptFlowRef(dpnId, NatConstants.INBOUND_NAPT_TABLE, String.valueOf(routerId), externalIp, externalPort);
-                     FlowEntity inboundNaptFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.INBOUND_NAPT_TABLE, cookieSnatFlow, switchFlowRef);
+                     switchFlowRef = NatUtil.getNaptFlowRef(dpnId, NwConstants.INBOUND_NAPT_TABLE, String.valueOf(routerId), externalIp, externalPort);
+                     FlowEntity inboundNaptFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.INBOUND_NAPT_TABLE, cookieSnatFlow, switchFlowRef);
 
-                     LOG.info("NAT Service : Remove the flow in the " + NatConstants.INBOUND_NAPT_TABLE + " for the active active switch with the DPN ID {} and router ID {}", dpnId, routerId);
+                     LOG.info("NAT Service : Remove the flow in the " + NwConstants.INBOUND_NAPT_TABLE + " for the active active switch with the DPN ID {} and router ID {}", dpnId, routerId);
                      mdsalManager.removeFlow(inboundNaptFlowEntity);
 
                      // Finally release port from idmanager
@@ -1722,10 +1722,10 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                 LOG.info("NAT Service : Handle Ordinary switch");
 
                 //Remove the PSNAT entry which forwards the packet to Terminating Service table
-                String pSNatFlowRef = getFlowRefSnat(dpnId, NatConstants.PSNAT_TABLE, String.valueOf(routerName));
-                FlowEntity pSNatFlowEntity = NatUtil.buildFlowEntity(dpnId, NatConstants.PSNAT_TABLE, pSNatFlowRef);
+                String pSNatFlowRef = getFlowRefSnat(dpnId, NwConstants.PSNAT_TABLE, String.valueOf(routerName));
+                FlowEntity pSNatFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.PSNAT_TABLE, pSNatFlowRef);
 
-                LOG.info("Remove the flow in the " + NatConstants.PSNAT_TABLE + " for the non active switch with the DPN ID {} and router ID {}", dpnId, routerId);
+                LOG.info("Remove the flow in the " + NwConstants.PSNAT_TABLE + " for the non active switch with the DPN ID {} and router ID {}", dpnId, routerId);
                 mdsalManager.removeFlow(pSNatFlowEntity);
 
                 //Remove the group entry which forwards the traffic to the out port (VXLAN tunnel).
@@ -2139,9 +2139,9 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                 SessionAddress internalAddress = new SessionAddress(internalIp, Integer.valueOf(internalPort));
                 SessionAddress externalAddress = naptManager.getExternalAddressMapping(routerId, internalAddress, protocol);
                 long internetVpnid = NatUtil.getVpnId(dataBroker, routerId);
-                naptEventHandler.buildAndInstallNatFlows(dpnId, NatConstants.OUTBOUND_NAPT_TABLE, internetVpnid, routerId, bgpVpnId,
+                naptEventHandler.buildAndInstallNatFlows(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, internetVpnid, routerId, bgpVpnId,
                         internalAddress, externalAddress, protocol);
-                naptEventHandler.buildAndInstallNatFlows(dpnId, NatConstants.INBOUND_NAPT_TABLE, internetVpnid, routerId, bgpVpnId,
+                naptEventHandler.buildAndInstallNatFlows(dpnId, NwConstants.INBOUND_NAPT_TABLE, internetVpnid, routerId, bgpVpnId,
                         externalAddress, internalAddress, protocol);
 
             }
@@ -2166,10 +2166,10 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         LOG.debug("NAT Service : Setting the tunnel to the list of action infos {}", actionsInfo);
         actionsInfo.add(new ActionInfo(ActionType.group, new String[] {String.valueOf(groupId)}));
         instructions.add(new InstructionInfo(InstructionType.write_actions, actionsInfo));
-        String flowRef = getFlowRefSnat(dpId, NatConstants.PSNAT_TABLE, routerName);
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PSNAT_TABLE, flowRef,
+        String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_SNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
 
         LOG.debug("NAT Service : Returning SNAT Flow Entity {}", flowEntity);
         return flowEntity;
@@ -2186,12 +2186,12 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         List<InstructionInfo> instructions = new ArrayList<InstructionInfo>();
         instructions.add(new InstructionInfo(InstructionType.goto_table, new long[]
-                { NatConstants.OUTBOUND_NAPT_TABLE }));
+                { NwConstants.OUTBOUND_NAPT_TABLE }));
 
-        String flowRef = getFlowRefSnat(dpId, NatConstants.PSNAT_TABLE, routerName);
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PSNAT_TABLE, flowRef,
+        String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_SNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
 
         LOG.debug("NAT Service : Returning SNAT Flow Entity {}", flowEntity);
         return flowEntity;
@@ -2218,9 +2218,9 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         instructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[]
                 { bgpVpnIdAsBigInt, MetaDataUtil.METADATA_MASK_VRFID }));
         instructions.add(new InstructionInfo(InstructionType.goto_table, new long[]
-                { NatConstants.OUTBOUND_NAPT_TABLE }));
-        String flowRef = getFlowRefTs(dpId, NatConstants.TERMINATING_SERVICE_TABLE, routerId.longValue());
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.TERMINATING_SERVICE_TABLE, flowRef,
+                { NwConstants.OUTBOUND_NAPT_TABLE }));
+        String flowRef = getFlowRefTs(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, routerId.longValue());
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, flowRef,
                 NatConstants.DEFAULT_TS_FLOW_PRIORITY, flowRef, 0, 0,
                 NatConstants.COOKIE_TS_TABLE, matches, instructions);
         return flowEntity;
@@ -2247,10 +2247,9 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         instructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos));
         instructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[]{BigInteger.valueOf(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID}));
 
-        String flowRef = getFlowRefOutbound(dpId, NatConstants.OUTBOUND_NAPT_TABLE, routerId);
+        String flowRef = getFlowRefOutbound(dpId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
         BigInteger cookie = getCookieOutboundFlow(routerId);
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.OUTBOUND_NAPT_TABLE, flowRef,
-                5, flowRef, 0, 0,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef, 5, flowRef, 0, 0,
                 cookie, matches, instructions);
         LOG.debug("NAT Service : returning flowEntity {}", flowEntity);
         return flowEntity;
@@ -2273,13 +2272,13 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
         ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
-        listActionInfo.add(new ActionInfo(ActionType.nx_resubmit, new String[] { Integer.toString(NatConstants.L3_FIB_TABLE) }));
+        listActionInfo.add(new ActionInfo(ActionType.nx_resubmit, new String[] { Integer.toString(NwConstants.L3_FIB_TABLE) }));
         instructionInfo.add(new InstructionInfo(InstructionType.apply_actions, listActionInfo));
 
-        String flowRef = getFlowRefTs(dpId, NatConstants.NAPT_PFIB_TABLE, segmentId);
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.NAPT_PFIB_TABLE, flowRef,
+        String flowRef = getFlowRefTs(dpId, NwConstants.NAPT_PFIB_TABLE, segmentId);
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.NAPT_PFIB_TABLE, flowRef,
                 NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_SNAT_TABLE, matches, instructionInfo);
+                NwConstants.COOKIE_SNAT_TABLE, matches, instructionInfo);
 
         LOG.debug("NAT Service : Returning NaptPFib Flow Entity {}", flowEntity);
         return flowEntity;
index c9d2fac24dd89c3464665fe952242b18b7f47727..ec1eff80219833c3e9b7d38385892a2fd617f336 100644 (file)
@@ -11,16 +11,7 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.genius.mdsalutil.AbstractDataChangeListener;
-import org.opendaylight.genius.mdsalutil.ActionInfo;
-import org.opendaylight.genius.mdsalutil.ActionType;
-import org.opendaylight.genius.mdsalutil.FlowEntity;
-import org.opendaylight.genius.mdsalutil.InstructionInfo;
-import org.opendaylight.genius.mdsalutil.InstructionType;
-import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
-import org.opendaylight.genius.mdsalutil.MatchInfo;
-import org.opendaylight.genius.mdsalutil.MetaDataUtil;
+import org.opendaylight.genius.mdsalutil.*;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.FloatingIpInfo;
@@ -180,13 +171,13 @@ public class FloatingIPListener extends AbstractDataChangeListener<IpMapping> im
         instructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[] { BigInteger.valueOf
                 (segmentId), MetaDataUtil.METADATA_MASK_VRFID }));
         instructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos));
-        instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NatConstants.DNAT_TABLE }));
+        instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.DNAT_TABLE }));
 
-        String flowRef = NatUtil.getFlowRef(dpId, NatConstants.PDNAT_TABLE, routerId, externalIp);
+        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.PDNAT_TABLE, routerId, externalIp);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PDNAT_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PDNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_DNAT_TABLE, matches, instructions);
 
         return flowEntity;
     }
@@ -221,15 +212,15 @@ public class FloatingIPListener extends AbstractDataChangeListener<IpMapping> im
         List<InstructionInfo> instructions = new ArrayList<>();
 //        instructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[] { BigInteger.valueOf
 //                (routerId), MetaDataUtil.METADATA_MASK_VRFID }));
-        actionsInfos.add(new ActionInfo(ActionType.nx_resubmit, new String[] { Integer.toString(NatConstants.L3_FIB_TABLE) }));
+        actionsInfos.add(new ActionInfo(ActionType.nx_resubmit, new String[] { Integer.toString(NwConstants.L3_FIB_TABLE) }));
         instructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos));
         //instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NatConstants.L3_FIB_TABLE }));
 
-        String flowRef = NatUtil.getFlowRef(dpId, NatConstants.DNAT_TABLE, routerId, externalIp);
+        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.DNAT_TABLE, routerId, externalIp);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.DNAT_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_DNAT_TABLE, matches, instructions);
 
         return flowEntity;
 
@@ -263,13 +254,13 @@ public class FloatingIPListener extends AbstractDataChangeListener<IpMapping> im
         List<InstructionInfo> instructions = new ArrayList<>();
         instructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[] { BigInteger.valueOf(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
         instructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos));
-        instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NatConstants.SNAT_TABLE }));
+        instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.SNAT_TABLE }));
 
-        String flowRef = NatUtil.getFlowRef(dpId, NatConstants.PSNAT_TABLE, routerId, internalIp);
+        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.PSNAT_TABLE, routerId, internalIp);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PSNAT_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_DNAT_TABLE, matches, instructions);
 
         return flowEntity;
     }
@@ -300,15 +291,15 @@ public class FloatingIPListener extends AbstractDataChangeListener<IpMapping> im
 
         List<InstructionInfo> instructions = new ArrayList<>();
         //instructions.add(new InstructionInfo(InstructionType.write_metadata, new BigInteger[] { BigInteger.valueOf(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
-        actionsInfos.add(new ActionInfo(ActionType.nx_resubmit, new String[] { Integer.toString(NatConstants.L3_FIB_TABLE) }));
+        actionsInfos.add(new ActionInfo(ActionType.nx_resubmit, new String[] { Integer.toString(NwConstants.L3_FIB_TABLE) }));
         instructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos));
         //instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NatConstants.L3_FIB_TABLE }));
 
-        String flowRef = NatUtil.getFlowRef(dpId, NatConstants.SNAT_TABLE, vpnId, internalIp);
+        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.SNAT_TABLE, vpnId, internalIp);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.SNAT_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.SNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_DNAT_TABLE, matches, instructions);
 
         return flowEntity;
 
@@ -694,11 +685,11 @@ public class FloatingIPListener extends AbstractDataChangeListener<IpMapping> im
 
         LOG.info("Bulding Delete DNAT Flow entity for ip {} ", externalIp);
 
-        String flowRef = NatUtil.getFlowRef(dpId, NatConstants.PDNAT_TABLE, routerId, externalIp);
+        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.PDNAT_TABLE, routerId, externalIp);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PDNAT_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PDNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, null, null);
+                NwConstants.COOKIE_DNAT_TABLE, null, null);
 
         return flowEntity;
     }
@@ -709,11 +700,11 @@ public class FloatingIPListener extends AbstractDataChangeListener<IpMapping> im
 
         LOG.info("Bulding Delete DNAT Flow entity for ip {} ", externalIp);
 
-        String flowRef = NatUtil.getFlowRef(dpId, NatConstants.DNAT_TABLE, routerId, externalIp);
+        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.DNAT_TABLE, routerId, externalIp);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.DNAT_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, null, null);
+                NwConstants.COOKIE_DNAT_TABLE, null, null);
 
         return flowEntity;
 
@@ -723,11 +714,11 @@ public class FloatingIPListener extends AbstractDataChangeListener<IpMapping> im
 
         LOG.info("Building Delete PSNAT Flow entity for ip {} ", internalIp);
 
-        String flowRef = NatUtil.getFlowRef(dpId, NatConstants.PSNAT_TABLE, routerId, internalIp);
+        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.PSNAT_TABLE, routerId, internalIp);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PSNAT_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, null, null);
+                NwConstants.COOKIE_DNAT_TABLE, null, null);
 
         return flowEntity;
     }
@@ -736,11 +727,11 @@ public class FloatingIPListener extends AbstractDataChangeListener<IpMapping> im
 
         LOG.info("Building Delete SNAT Flow entity for ip {} ", internalIp);
 
-        String flowRef = NatUtil.getFlowRef(dpId, NatConstants.SNAT_TABLE, routerId, internalIp);
+        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.SNAT_TABLE, routerId, internalIp);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.SNAT_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.SNAT_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, null, null);
+                NwConstants.COOKIE_DNAT_TABLE, null, null);
 
         return flowEntity;
 
index 64e8d555cb3e668fba215bf67f954f68129afda7..65792900d7a4692db1369b2566f5839d44962ead 100644 (file)
@@ -180,7 +180,7 @@ public class InterfaceStateEventListener extends AbstractDataChangeListener<Inte
                     for (Integer portnum : portList) {
                         //build and remove the flow in outbound table
                         try {
-                            removeNatFlow(naptSwitch, NatConstants.OUTBOUND_NAPT_TABLE, routerId, internalIp, portnum);
+                            removeNatFlow(naptSwitch, NwConstants.OUTBOUND_NAPT_TABLE, routerId, internalIp, portnum);
                         } catch (Exception ex) {
                             LOG.error("NAT Service : Failed to remove snat flow for internalIP {} with Port {} protocol {} for routerId {} " +
                                     "in OUTBOUNDTABLE of NaptSwitch {}: {}",internalIp,portnum,protocol,routerId,naptSwitch,ex);
@@ -198,7 +198,7 @@ public class InterfaceStateEventListener extends AbstractDataChangeListener<Inte
 
                         //build and remove the flow in inboundtable
                         try {
-                            removeNatFlow(naptSwitch, NatConstants.INBOUND_NAPT_TABLE,routerId, externalIpAddress, portNumber);
+                            removeNatFlow(naptSwitch, NwConstants.INBOUND_NAPT_TABLE,routerId, externalIpAddress, portNumber);
                         } catch (Exception ex) {
                             LOG.error("NAT Service : Failed to remove snat flow internalIP {} with Port {} protocol {} for routerId {} " +
                                     "in INBOUNDTABLE of naptSwitch {} : {}",externalIpAddress,portNumber,protocol,routerId,naptSwitch,ex);
index 64c6c45d82be5cdec31ef9fe75eb15d6f3f72539..f24a2a4e82891cba5275ad7ce0757a1befaf7536 100644 (file)
@@ -154,8 +154,8 @@ public class NaptEventHandler {
             }
             //Build and install the NAPT translation flows in the Outbound and Inbound NAPT tables
             if(!naptEntryEvent.isPktProcessed()) {
-                buildAndInstallNatFlows(dpnId, NatConstants.OUTBOUND_NAPT_TABLE, vpnId, routerId, bgpVpnId, internalAddress, externalAddress, protocol);
-                buildAndInstallNatFlows(dpnId, NatConstants.INBOUND_NAPT_TABLE, vpnId, routerId, bgpVpnId, externalAddress, internalAddress, protocol);
+                buildAndInstallNatFlows(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, vpnId, routerId, bgpVpnId, internalAddress, externalAddress, protocol);
+                buildAndInstallNatFlows(dpnId, NwConstants.INBOUND_NAPT_TABLE, vpnId, routerId, bgpVpnId, externalAddress, internalAddress, protocol);
             }
 
             //Send Packetout - tcp or udp packets which got punted to controller.
@@ -228,7 +228,7 @@ public class NaptEventHandler {
 
         }else{
             LOG.debug("NAT Service : Inside delete Operation of NaptEventHandler");
-            removeNatFlows(dpnId, NatConstants.INBOUND_NAPT_TABLE, routerId, naptEntryEvent.getIpAddress(), naptEntryEvent.getPortNumber());
+            removeNatFlows(dpnId, NwConstants.INBOUND_NAPT_TABLE, routerId, naptEntryEvent.getIpAddress(), naptEntryEvent.getPortNumber());
         }
 
         LOG.info("NAT Service : handleNaptEvent() exited for IP, port, routerID : {}", naptEntryEvent.getIpAddress(), naptEntryEvent.getPortNumber(), routerId);
@@ -243,7 +243,7 @@ public class NaptEventHandler {
         String translatedIp = translatedSourceAddress.getIpAddress();
         String translatedPort = String.valueOf(translatedSourceAddress.getPortNumber());
         int idleTimeout=0;
-        if(tableId == NatConstants.OUTBOUND_NAPT_TABLE) {
+        if(tableId == NwConstants.OUTBOUND_NAPT_TABLE) {
             idleTimeout = NatConstants.DEFAULT_NAPT_IDLE_TIMEOUT;
         }
         long metaDataValue = routerId;
@@ -284,7 +284,7 @@ public class NaptEventHandler {
         }
 
         MatchInfo metaDataMatchInfo = null;
-        if(tableId == NatConstants.OUTBOUND_NAPT_TABLE){
+        if(tableId == NwConstants.OUTBOUND_NAPT_TABLE){
             ipMatchInfo = new MatchInfo(MatchFieldType.ipv4_source, new String[] {ipAddressAsString, "32" });
             if(protocol == NAPTEntryEvent.Protocol.TCP) {
                 protocolMatchInfo = new MatchInfo(MatchFieldType.ip_proto, new long[] {IPProtocols.TCP.intValue()});
@@ -310,7 +310,7 @@ public class NaptEventHandler {
         matchInfo.add(ipMatchInfo);
         matchInfo.add(protocolMatchInfo);
         matchInfo.add(portMatchInfo);
-        if(tableId == NatConstants.OUTBOUND_NAPT_TABLE){
+        if(tableId == NwConstants.OUTBOUND_NAPT_TABLE){
             matchInfo.add(metaDataMatchInfo);
         }
         return matchInfo;
@@ -322,7 +322,7 @@ public class NaptEventHandler {
         ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
         ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
 
-        if(tableId == NatConstants.OUTBOUND_NAPT_TABLE){
+        if(tableId == NwConstants.OUTBOUND_NAPT_TABLE){
             ipActionInfo = new ActionInfo(ActionType.set_source_ip, new String[] {ipAddress});
             if(protocol == NAPTEntryEvent.Protocol.TCP) {
                portActionInfo = new ActionInfo( ActionType.set_tcp_source_port, new String[] {port});
@@ -344,7 +344,8 @@ public class NaptEventHandler {
         listActionInfo.add(portActionInfo);
 
         instructionInfo.add(new InstructionInfo(InstructionType.apply_actions, listActionInfo));
-        instructionInfo.add(new InstructionInfo(InstructionType.goto_table, new long[] { NatConstants.NAPT_PFIB_TABLE }));
+        instructionInfo.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.NAPT_PFIB_TABLE
+        }));
 
         return instructionInfo;
     }
@@ -358,7 +359,7 @@ public class NaptEventHandler {
         //Build the flow with the port IP and port as the match info.
         String switchFlowRef = NatUtil.getNaptFlowRef(dpnId, tableId, String.valueOf(segmentId), ip, port);
         FlowEntity snatFlowEntity = NatUtil.buildFlowEntity(dpnId, tableId, switchFlowRef);
-        LOG.debug("NAT Service : Remove the flow in the table {} for the switch with the DPN ID {}", NatConstants.INBOUND_NAPT_TABLE, dpnId);
+        LOG.debug("NAT Service : Remove the flow in the table {} for the switch with the DPN ID {}", NwConstants.INBOUND_NAPT_TABLE, dpnId);
         mdsalManager.removeFlow(snatFlowEntity);
 
     }
index e66a4920aabcc4f34681d132c2c16ffc46d0bf7f..c537d0783b042d4454225314eb1037d6a15688b9 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.netvirt.natservice.internal;
 
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
+import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
@@ -70,7 +71,7 @@ public class NaptFlowRemovedEventHandler implements SalFlowListener{
         short tableId = switchFlowRemoved.getTableId();
         RemovedReasonFlags removedReasonFlag = switchFlowRemoved.getRemovedReason();
 
-        if (tableId == NatConstants.OUTBOUND_NAPT_TABLE && removedReasonFlag.isIDLETIMEOUT()) {
+        if (tableId == NwConstants.OUTBOUND_NAPT_TABLE && removedReasonFlag.isIDLETIMEOUT()) {
             LOG.info("NaptFlowRemovedEventHandler : onSwitchFlowRemoved() entry");
 
             //Get the internal internal IP address and the port number from the IPv4 match.
index 1be636038f5dfdb6bd0abfd2a21a85b68a2f61b7..43c70260df939fb34a19152137b6bd10b81e7fec 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.netvirt.natservice.internal;
 
 import org.opendaylight.controller.liblldp.NetUtils;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
+import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.packet.Ethernet;
 import org.opendaylight.genius.mdsalutil.packet.IPv4;
 import org.opendaylight.genius.mdsalutil.packet.TCP;
@@ -46,7 +47,7 @@ public class NaptPacketInHandler implements PacketProcessingListener {
             LOG.trace("packet: {}, tableId {}", packetReceived, tableId);
         }
 
-        if (tableId == NatConstants.OUTBOUND_NAPT_TABLE) {
+        if (tableId == NwConstants.OUTBOUND_NAPT_TABLE) {
             LOG.debug("NAT Service : NAPTPacketInHandler Packet for Outbound NAPT Table");
             byte[] inPayload = packetReceived.getPayload();
             Ethernet ethPkt = new Ethernet();
index 6e03e31361d7e70717a5fcafcb93c9c138753774..9f606b71991cdd1b90fe369daab17a3c47817776 100644 (file)
@@ -164,26 +164,26 @@ public class NaptSwitchHA {
         }
 
         //Remove the Terminating Service table entry which forwards the packet to Outbound NAPT Table
-        String tsFlowRef = externalRouterListener.getFlowRefTs(naptSwitch, NatConstants.TERMINATING_SERVICE_TABLE, routerId);
-        FlowEntity tsNatFlowEntity = NatUtil.buildFlowEntity(naptSwitch, NatConstants.TERMINATING_SERVICE_TABLE, tsFlowRef);
+        String tsFlowRef = externalRouterListener.getFlowRefTs(naptSwitch, NwConstants.INTERNAL_TUNNEL_TABLE, routerId);
+        FlowEntity tsNatFlowEntity = NatUtil.buildFlowEntity(naptSwitch, NwConstants.INTERNAL_TUNNEL_TABLE, tsFlowRef);
 
         LOG.info("Remove the flow in table {} for the old napt switch with the DPN ID {} and router ID {}"
-                ,NatConstants.TERMINATING_SERVICE_TABLE, naptSwitch, routerId);
+                ,NwConstants.INTERNAL_TUNNEL_TABLE, naptSwitch, routerId);
         mdsalManager.removeFlow(tsNatFlowEntity);
 
         //Remove the Outbound flow entry which forwards the packet to Outbound NAPT Table
-        String outboundNatFlowRef = externalRouterListener.getFlowRefOutbound(naptSwitch, NatConstants.OUTBOUND_NAPT_TABLE, routerId);
+        String outboundNatFlowRef = externalRouterListener.getFlowRefOutbound(naptSwitch, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
         FlowEntity outboundNatFlowEntity = NatUtil.buildFlowEntity(naptSwitch,
-                NatConstants.OUTBOUND_NAPT_TABLE, outboundNatFlowRef);
+                NwConstants.OUTBOUND_NAPT_TABLE, outboundNatFlowRef);
         LOG.info("Remove the flow in table {} for the old napt switch with the DPN ID {} and router ID {}"
-                ,NatConstants.OUTBOUND_NAPT_TABLE, naptSwitch, routerId);
+                ,NwConstants.OUTBOUND_NAPT_TABLE, naptSwitch, routerId);
         mdsalManager.removeFlow(outboundNatFlowEntity);
 
         //Remove the NAPT_PFIB_TABLE(47) flow entry forwards the packet to Fib Table for inbound traffic matching on the router ID.
-        String naptPFibflowRef = externalRouterListener.getFlowRefTs(naptSwitch, NatConstants.NAPT_PFIB_TABLE, routerId);
-        FlowEntity naptPFibFlowEntity = NatUtil.buildFlowEntity(naptSwitch, NatConstants.NAPT_PFIB_TABLE,naptPFibflowRef);
+        String naptPFibflowRef = externalRouterListener.getFlowRefTs(naptSwitch, NwConstants.NAPT_PFIB_TABLE, routerId);
+        FlowEntity naptPFibFlowEntity = NatUtil.buildFlowEntity(naptSwitch, NwConstants.NAPT_PFIB_TABLE, naptPFibflowRef);
         LOG.info("Remove the flow in table {} for the old napt switch with the DPN ID {} and router ID {}",
-                NatConstants.NAPT_PFIB_TABLE, naptSwitch, routerId);
+                NwConstants.NAPT_PFIB_TABLE, naptSwitch, routerId);
         mdsalManager.removeFlow(naptPFibFlowEntity);
 
         //Remove the NAPT_PFIB_TABLE(47) flow entry forwards the packet to Fib Table for outbound traffic matching on the vpn ID.
@@ -206,10 +206,10 @@ public class NaptSwitchHA {
                 if (!switchSharedByRouters) {
                     Long vpnId = getVpnIdForRouter(routerId);
                     if (vpnId != NatConstants.INVALID_ID) {
-                        String naptFibflowRef = externalRouterListener.getFlowRefTs(naptSwitch, NatConstants.NAPT_PFIB_TABLE, vpnId);
-                        FlowEntity naptFibFlowEntity = NatUtil.buildFlowEntity(naptSwitch, NatConstants.NAPT_PFIB_TABLE,naptFibflowRef);
+                        String naptFibflowRef = externalRouterListener.getFlowRefTs(naptSwitch, NwConstants.NAPT_PFIB_TABLE, vpnId);
+                        FlowEntity naptFibFlowEntity = NatUtil.buildFlowEntity(naptSwitch, NwConstants.NAPT_PFIB_TABLE,naptFibflowRef);
                         LOG.info("Remove the flow in table {} for the old napt switch with the DPN ID {} and vpnId {}",
-                                NatConstants.NAPT_PFIB_TABLE, naptSwitch, vpnId);
+                                NwConstants.NAPT_PFIB_TABLE, naptSwitch, vpnId);
                         mdsalManager.removeFlow(naptFibFlowEntity);
                     } else {
                         LOG.error("Invalid vpnId retrieved for routerId {}",routerId);
@@ -275,13 +275,13 @@ public class NaptSwitchHA {
                 String internalPort = ipPortParts[1];
 
                 //Build and remove flow in outbound NAPT table
-                String switchFlowRef = NatUtil.getNaptFlowRef(naptSwitch, NatConstants.OUTBOUND_NAPT_TABLE, String.valueOf(routerId),
+                String switchFlowRef = NatUtil.getNaptFlowRef(naptSwitch, NwConstants.OUTBOUND_NAPT_TABLE, String.valueOf(routerId),
                         internalIp, Integer.valueOf(internalPort));
-                FlowEntity outboundNaptFlowEntity = NatUtil.buildFlowEntity(naptSwitch, NatConstants.OUTBOUND_NAPT_TABLE,
+                FlowEntity outboundNaptFlowEntity = NatUtil.buildFlowEntity(naptSwitch, NwConstants.OUTBOUND_NAPT_TABLE,
                         cookieSnatFlow, switchFlowRef);
 
                 LOG.info("Remove the flow in table {} for old napt switch with the DPN ID {} and router ID {}",
-                        NatConstants.OUTBOUND_NAPT_TABLE,naptSwitch, routerId);
+                        NwConstants.OUTBOUND_NAPT_TABLE,naptSwitch, routerId);
                 mdsalManager.removeFlow(outboundNaptFlowEntity);
 
                 IpPortExternal ipPortExternal = ipPortMap.getIpPortExternal();
@@ -294,13 +294,13 @@ public class NaptSwitchHA {
                 int externalPort = ipPortExternal.getPortNum();
 
                 //Build and remove flow in  inbound NAPT table
-                switchFlowRef = NatUtil.getNaptFlowRef(naptSwitch, NatConstants.INBOUND_NAPT_TABLE, String.valueOf(routerId),
+                switchFlowRef = NatUtil.getNaptFlowRef(naptSwitch, NwConstants.INBOUND_NAPT_TABLE, String.valueOf(routerId),
                         externalIp, externalPort);
-                FlowEntity inboundNaptFlowEntity = NatUtil.buildFlowEntity(naptSwitch, NatConstants.INBOUND_NAPT_TABLE,
+                FlowEntity inboundNaptFlowEntity = NatUtil.buildFlowEntity(naptSwitch, NwConstants.INBOUND_NAPT_TABLE,
                         cookieSnatFlow, switchFlowRef);
 
                 LOG.info("Remove the flow in table {} for old napt switch with the DPN ID {} and router ID {}",
-                        NatConstants.INBOUND_NAPT_TABLE,naptSwitch, routerId);
+                        NwConstants.INBOUND_NAPT_TABLE,naptSwitch, routerId);
                 mdsalManager.removeFlow(inboundNaptFlowEntity);
             }
         }
@@ -499,7 +499,7 @@ public class NaptSwitchHA {
                 if(getSwitchStatus(newNaptSwitch)) {
                     //Install the flow in newNaptSwitch Outbound NAPT table.
                     try {
-                        NaptEventHandler.buildAndInstallNatFlows(newNaptSwitch, NatConstants.OUTBOUND_NAPT_TABLE,
+                        NaptEventHandler.buildAndInstallNatFlows(newNaptSwitch, NwConstants.OUTBOUND_NAPT_TABLE,
                                 vpnId,  routerId, bgpVpnId, sourceAddress, externalAddress, proto);
                     } catch (Exception ex) {
                         LOG.error("Failed to add flow in OUTBOUND_NAPT_TABLE for routerid {} dpnId {} ipport {}:{} proto {}" +
@@ -512,7 +512,7 @@ public class NaptSwitchHA {
                             , intportnum, proto, externalAddress, extportNumber,bgpVpnId);
                     //Install the flow in newNaptSwitch Inbound NAPT table.
                     try {
-                        NaptEventHandler.buildAndInstallNatFlows(newNaptSwitch, NatConstants.INBOUND_NAPT_TABLE,
+                        NaptEventHandler.buildAndInstallNatFlows(newNaptSwitch, NwConstants.INBOUND_NAPT_TABLE,
                                 vpnId, routerId, bgpVpnId, externalAddress, sourceAddress, proto);
                     } catch (Exception ex) {
                         LOG.error("Failed to add flow in INBOUND_NAPT_TABLE for routerid {} dpnId {} extIpport{}:{} proto {} " +
@@ -578,7 +578,7 @@ public class NaptSwitchHA {
         List<BucketInfo> listBucketInfo = new ArrayList<>();
         List<ActionInfo> listActionInfoPrimary = new ArrayList<>();
         listActionInfoPrimary.add(new ActionInfo(ActionType.nx_resubmit,
-                new String[]{String.valueOf(NatConstants.TERMINATING_SERVICE_TABLE)}));
+                new String[]{String.valueOf(NwConstants.INTERNAL_TUNNEL_TABLE)}));
         BucketInfo bucketPrimary = new BucketInfo(listActionInfoPrimary);
         listBucketInfo.add(bucketPrimary);
         return listBucketInfo;
@@ -720,7 +720,7 @@ public class NaptSwitchHA {
         matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
                 BigInteger.valueOf(routerVpnId), MetaDataUtil.METADATA_MASK_VRFID }));
 
-        String flowRef = getFlowRefSnat(dpId, NatConstants.PSNAT_TABLE, routerName);
+        String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
 
         if (addordel == NatConstants.ADD_FLOW) {
             List<InstructionInfo> instructions = new ArrayList<InstructionInfo>();
@@ -733,13 +733,13 @@ public class NaptSwitchHA {
             actionsInfo.add(new ActionInfo(ActionType.group, new String[] {String.valueOf(groupId)}));
             instructions.add(new InstructionInfo(InstructionType.write_actions, actionsInfo));
 
-            flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PSNAT_TABLE, flowRef,
+            flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef,
                     NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                    NatConstants.COOKIE_SNAT_TABLE, matches, instructions);
+                    NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
         } else {
-            flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PSNAT_TABLE, flowRef,
+            flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef,
                     NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                    NatConstants.COOKIE_SNAT_TABLE, matches, null);
+                    NwConstants.COOKIE_SNAT_TABLE, matches, null);
         }
         return flowEntity;
     }
@@ -753,21 +753,21 @@ public class NaptSwitchHA {
         matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
                 BigInteger.valueOf(routerVpnId), MetaDataUtil.METADATA_MASK_VRFID }));
 
-        String flowRef = getFlowRefSnat(dpId, NatConstants.PSNAT_TABLE, routerName);
+        String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
 
         if (addordel == NatConstants.ADD_FLOW) {
             List<InstructionInfo> instructions = new ArrayList<>();
 
             instructions.add(new InstructionInfo(InstructionType.goto_table, new long[]
-                    { NatConstants.OUTBOUND_NAPT_TABLE }));
+                    { NwConstants.OUTBOUND_NAPT_TABLE }));
 
-            flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PSNAT_TABLE, flowRef,
+            flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef,
                     NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                    NatConstants.COOKIE_SNAT_TABLE, matches, instructions);
+                    NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
         } else {
-            flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.PSNAT_TABLE, flowRef,
+            flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef,
                     NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                    NatConstants.COOKIE_SNAT_TABLE, matches, null);
+                    NwConstants.COOKIE_SNAT_TABLE, matches, null);
         }
         return flowEntity;
     }
@@ -828,7 +828,7 @@ public class NaptSwitchHA {
                 for (String externalIp : externalIps) {
                     LOG.debug("advToBgpAndInstallFibAndTsFlows in naptswitch id {} with vpnName {} and externalIp {}",
                             naptSwitch, vpnName, externalIp);
-                    externalRouterListener.advToBgpAndInstallFibAndTsFlows(naptSwitch, NatConstants.INBOUND_NAPT_TABLE,
+                    externalRouterListener.advToBgpAndInstallFibAndTsFlows(naptSwitch, NwConstants.INBOUND_NAPT_TABLE,
                             vpnName, routerId, externalIp, vpnService, fibService, bgpManager, dataBroker, LOG);
                     LOG.debug("Successfully added fib entries in naptswitch {} for router {} with external IP {}", naptSwitch,
                             routerId, externalIp);
index 279bb8965b3fa139dd2a4aedf8492118836eb6e0..e6dcbee78947ab6d00d062576a541b549da1146a 100644 (file)
@@ -12,10 +12,7 @@ import java.math.BigInteger;
 
 
 public class NatConstants {
-    public static final short INBOUND_NAPT_TABLE = 44;
-    public static final short OUTBOUND_NAPT_TABLE = 46;
-    public static final short NAPT_PFIB_TABLE = 47;
-    public static final short TERMINATING_SERVICE_TABLE = 36;
+
     public static final short DEFAULT_NAPT_FLOW_PRIORITY = 10;
     public static final String NAPT_FLOW_NAME = "SNAT";
     public static BigInteger COOKIE_NAPT_BASE = new BigInteger("8000000", 16);
@@ -23,21 +20,14 @@ public class NatConstants {
     public static final String FLOWID_SEPARATOR = ".";
     public static final int DEFAULT_NAPT_IDLE_TIMEOUT = 300;
     public static int EVENT_QUEUE_LENGTH = 1000000;
-    public static final short PDNAT_TABLE = 25;
-    public static final short DNAT_TABLE = 27;
-    public static final short SNAT_TABLE = 28;
-    public static final short PSNAT_TABLE = 26;
-    public static final short L3_FIB_TABLE = 21;
     public static final String FLOWID_PREFIX = "L3.";
     public static final int DEFAULT_DNAT_FLOW_PRIORITY = 10;
-    public static final BigInteger COOKIE_DNAT_TABLE = new BigInteger("8000004", 16);
     public static final long INVALID_ID = -1;
     public static final BigInteger COOKIE_OUTBOUND_NAPT_TABLE = new BigInteger("8000008", 16);
     public static final short DEFAULT_SNAT_FLOW_PRIORITY = 10;
     public static final short DEFAULT_PSNAT_FLOW_PRIORITY = 5;
     public static final String SNAT_FLOW_NAME = "SNAT";
     public static final String SNAT_FLOWID_PREFIX = "SNAT.";
-    public static final BigInteger COOKIE_SNAT_TABLE = new BigInteger("8000006", 16);
     public static final String SNAT_IDPOOL_NAME = "snatGroupIdPool";
     public static final long SNAT_ID_LOW_VALUE = 200000L;
     public static final long SNAT_ID_HIGH_VALUE = 225000L;
index b7db14fb84530567a89f266535d48048f5f16978..a781717c72ab9161e509df399c0cee15624cfb20 100644 (file)
@@ -13,13 +13,7 @@ import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.opendaylight.genius.mdsalutil.FlowEntity;
-import org.opendaylight.genius.mdsalutil.InstructionInfo;
-import org.opendaylight.genius.mdsalutil.InstructionType;
-import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
-import org.opendaylight.genius.mdsalutil.MatchInfo;
-import org.opendaylight.genius.mdsalutil.MetaDataUtil;
+import org.opendaylight.genius.mdsalutil.*;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -58,13 +52,13 @@ public class SNATDefaultRouteProgrammer {
                 BigInteger.valueOf(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
 
         List<InstructionInfo> instructions = new ArrayList<>();
-        instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NatConstants.PSNAT_TABLE }));
+        instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.PSNAT_TABLE }));
 
-        String flowRef = getFlowRefFib(dpId, NatConstants.L3_FIB_TABLE, vpnId);
+        String flowRef = getFlowRefFib(dpId, NwConstants.L3_FIB_TABLE, vpnId);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.L3_FIB_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_FIB_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_DNAT_TABLE, matches, instructions);
 
         return flowEntity;
 
@@ -96,13 +90,13 @@ public class SNATDefaultRouteProgrammer {
                 BigInteger.valueOf(bgpVpnId), MetaDataUtil.METADATA_MASK_VRFID }));
 
         List<InstructionInfo> instructions = new ArrayList<>();
-        instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NatConstants.PSNAT_TABLE }));
+        instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.PSNAT_TABLE }));
 
-        String flowRef = getFlowRefFib(dpId, NatConstants.L3_FIB_TABLE, routerId);
+        String flowRef = getFlowRefFib(dpId, NwConstants.L3_FIB_TABLE, routerId);
 
-        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NatConstants.L3_FIB_TABLE, flowRef,
+        FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_FIB_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
-                NatConstants.COOKIE_DNAT_TABLE, matches, instructions);
+                NwConstants.COOKIE_DNAT_TABLE, matches, instructions);
 
         return flowEntity;
 
index 5b065dbc9a6d664d50dc02792e98daff85036f58..2d73fa44d2c23f05a0f22e5fab9b7fb9577062b1 100644 (file)
@@ -118,14 +118,14 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
 
                     List<Instruction> instructions = new ArrayList<>();
                     List<ActionInfo> actionsInfos = new ArrayList<>();
-                    actionsInfos.add(new ActionInfo(ActionType.nx_resubmit, new String[] { Integer.toString(NatConstants.PDNAT_TABLE) }));
+                    actionsInfos.add(new ActionInfo(ActionType.nx_resubmit, new String[] { Integer.toString(NwConstants.PDNAT_TABLE) }));
                     instructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos).buildInstruction(0));
                     makeTunnelTableEntry(dpnId, label, instructions);
 
                     //Install custom FIB routes
                     List<Instruction> customInstructions = new ArrayList<>();
-                    customInstructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NatConstants.PDNAT_TABLE }).buildInstruction(0));
-                    makeLFibTableEntry(dpnId, label, NatConstants.PDNAT_TABLE);
+                    customInstructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.PDNAT_TABLE }).buildInstruction(0));
+                    makeLFibTableEntry(dpnId, label, NwConstants.PDNAT_TABLE);
                     CreateFibEntryInput input = new CreateFibEntryInputBuilder().setVpnName(vpnName).setSourceDpid(dpnId).setInstruction(customInstructions)
                             .setIpAddress(externalIp + "/32").setServiceId(label).setInstruction(customInstructions).build();
                     //Future<RpcResult<java.lang.Void>> createFibEntry(CreateFibEntryInput input);
index 422d67fc13f117912c75b57a6a578bbf8acacf1a..1c314111dffcb097433ee5f0e5b4ed690bdfb891 100644 (file)
@@ -16,19 +16,14 @@ public class VpnConstants {
     public static final String VPN_IDPOOL_SIZE = "100000";
     public static final short DEFAULT_FLOW_PRIORITY = 10;
     public static final int DEFAULT_LPORT_DISPATCHER_FLOW_PRIORITY = 1;
-    public static final short L3VPN_SERVICE_IDENTIFIER = 2;
     public static final long INVALID_ID = -1;
     public static final String SEPARATOR = ".";
-    public static final BigInteger COOKIE_VM_INGRESS_TABLE = new BigInteger("8000001", 16);
     public static final BigInteger COOKIE_L3_BASE = new BigInteger("8000000", 16);
     public static final String FLOWID_PREFIX = "L3.";
     public static final long MIN_WAIT_TIME_IN_MILLISECONDS = 5000;
     public static final long MAX_WAIT_TIME_IN_MILLISECONDS = 90000;
     public static final long PER_INTERFACE_MAX_WAIT_TIME_IN_MILLISECONDS = 10000;
     public static final int ELAN_GID_MIN = 200000;
-    public static final short ELAN_SMAC_TABLE = 50;
-    public static final short LPORT_DISPATCHER_TABLE = 17;
-    public static final short FIB_TABLE = 21;
     public static byte[] EthernetDestination_Broadcast = new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
             (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
     public static byte[] MAC_Broadcast = new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
index 53bb5b429d4866aeab52744dcffec1e7b94a1211..beed327f017f6343dc2f5ff4a000f12bae15ea95 100644 (file)
@@ -591,13 +591,13 @@ public class VpnInterfaceManager extends AbstractDataChangeListener<VpnInterface
         BoundServices
                 serviceInfo =
                 InterfaceUtils.getBoundServices(String.format("%s.%s.%s", "vpn",vpnInstanceName, vpnInterfaceName),
-                        VpnConstants.L3VPN_SERVICE_IDENTIFIER, priority,
-                        VpnConstants.COOKIE_VM_INGRESS_TABLE, instructions);
+                        NwConstants.L3VPN_SERVICE_INDEX, priority,
+                        NwConstants.COOKIE_VM_INGRESS_TABLE, instructions);
         writeConfigTxn.put(LogicalDatastoreType.CONFIGURATION,
-                InterfaceUtils.buildServiceId(vpnInterfaceName, VpnConstants.L3VPN_SERVICE_IDENTIFIER), serviceInfo, true);
-        makeArpFlow(dpId, VpnConstants.L3VPN_SERVICE_IDENTIFIER, lPortTag, vpnInterfaceName,
+                InterfaceUtils.buildServiceId(vpnInterfaceName, NwConstants.L3VPN_SERVICE_INDEX), serviceInfo, true);
+        makeArpFlow(dpId, NwConstants.L3VPN_SERVICE_INDEX, lPortTag, vpnInterfaceName,
                 vpnId, ArpReplyOrRequest.REQUEST, NwConstants.ADD_FLOW, writeConfigTxn);
-        makeArpFlow(dpId, VpnConstants.L3VPN_SERVICE_IDENTIFIER, lPortTag, vpnInterfaceName,
+        makeArpFlow(dpId, NwConstants.L3VPN_SERVICE_INDEX, lPortTag, vpnInterfaceName,
                 vpnId, ArpReplyOrRequest.REPLY, NwConstants.ADD_FLOW, writeConfigTxn);
 
     }
@@ -1301,12 +1301,12 @@ public class VpnInterfaceManager extends AbstractDataChangeListener<VpnInterface
         if (!isInterfaceStateDown && isConfigRemoval) {
             writeConfigTxn.delete(LogicalDatastoreType.CONFIGURATION,
                     InterfaceUtils.buildServiceId(vpnInterfaceName,
-                            VpnConstants.L3VPN_SERVICE_IDENTIFIER));
+                            NwConstants.L3VPN_SERVICE_INDEX));
         }
         long vpnId = VpnUtil.getVpnId(broker, vpnInstanceName);
-        makeArpFlow(dpId, VpnConstants.L3VPN_SERVICE_IDENTIFIER, lPortTag, vpnInterfaceName,
+        makeArpFlow(dpId, NwConstants.L3VPN_SERVICE_INDEX, lPortTag, vpnInterfaceName,
                 vpnId, ArpReplyOrRequest.REQUEST, NwConstants.DEL_FLOW, writeConfigTxn);
-        makeArpFlow(dpId, VpnConstants.L3VPN_SERVICE_IDENTIFIER, lPortTag, vpnInterfaceName,
+        makeArpFlow(dpId, NwConstants.L3VPN_SERVICE_INDEX, lPortTag, vpnInterfaceName,
                 vpnId, ArpReplyOrRequest.REPLY, NwConstants.DEL_FLOW, writeConfigTxn);
     }
 
index 4b78c19a4da262ffcecaef311a72de12106cd9ef..8efc323c857d11799795ca37bdc9712ccd8de736 100644 (file)
@@ -143,10 +143,10 @@ public class InterVpnLinkUtil {
        List<MatchInfo> matches = Arrays.asList(new MatchInfo(MatchFieldType.metadata,
                                                               new BigInteger[] {
                                                                   MetaDataUtil.getMetaDataForLPortDispatcher(lportTag,
-                                                                                VpnConstants.L3VPN_SERVICE_IDENTIFIER),
+                                                                                NwConstants.L3VPN_SERVICE_INDEX),
                                                                   MetaDataUtil.getMetaDataMaskForLPortDispatcher() }));
        String flowRef = getLportDispatcherFlowRef(interVpnLinkName, lportTag);
-       Flow lPortDispatcherFlow = MDSALUtil.buildFlowNew(VpnConstants.LPORT_DISPATCHER_TABLE, flowRef,
+       Flow lPortDispatcherFlow = MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, flowRef,
                                                          VpnConstants.DEFAULT_LPORT_DISPATCHER_FLOW_PRIORITY, flowRef,
                                                          0, 0, VpnUtil.getCookieL3((int) vpnId), matches,
                                                          buildLportDispatcherTableInstructions(vpnId));
@@ -165,7 +165,7 @@ public class InterVpnLinkUtil {
        String flowRef = new StringBuffer().append(VpnConstants.FLOWID_PREFIX).append("INTERVPNLINK")
                      .append(NwConstants.FLOWID_SEPARATOR).append(interVpnLinkName)
                      .append(NwConstants.FLOWID_SEPARATOR).append(lportTag)
-                     .append(NwConstants.FLOWID_SEPARATOR).append(VpnConstants.L3VPN_SERVICE_IDENTIFIER)
+                     .append(NwConstants.FLOWID_SEPARATOR).append(NwConstants.L3VPN_SERVICE_INDEX)
                      .append(NwConstants.FLOWID_SEPARATOR).append(VpnConstants.DEFAULT_LPORT_DISPATCHER_FLOW_PRIORITY)
                      .toString();
        return flowRef;
@@ -178,7 +178,7 @@ public class InterVpnLinkUtil {
        instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(BigInteger.valueOf(vpnId),
                                                                     MetaDataUtil.METADATA_MASK_VRFID,
                                                                     ++instructionKey));
-       instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(VpnConstants.FIB_TABLE, ++instructionKey));
+       instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.L3_FIB_TABLE, ++instructionKey));
 
        return instructions;
    }