From acac66d2b4b29eab99b2604965680f50da9eb9ef Mon Sep 17 00:00:00 2001 From: Faseela K Date: Thu, 14 Jan 2016 16:56:01 +0530 Subject: [PATCH] Moving TableIds into a single constants file Change-Id: I994417ebd1567001b4049b73deadbbf52aa0d472 Signed-off-by: Faseela K --- .../vpnservice/fibmanager/FibManager.java | 45 ++++++++----------- .../vpnservice/interfacemgr/IfmConstants.java | 4 -- .../commons/InterfaceManagerCommonUtils.java | 8 ++-- .../InterfaceManagerRpcService.java | 8 ++-- .../FlowBasedServicesConfigBindHelper.java | 5 ++- .../FlowBasedServicesConfigUnbindHelper.java | 3 +- .../FlowBasedServicesStateBindHelper.java | 3 +- .../utilities/FlowBasedServicesUtils.java | 6 +-- ...owBasedServicesStateConfigurationTest.java | 7 +-- .../test/InterfaceManagerTestUtil.java | 2 +- .../vpnservice/itm/globals/ITMConstants.java | 5 +-- .../itm/rpc/ItmManagerRpcService.java | 15 +++---- .../vpnservice/mdsalutil/NwConstants.java | 11 +++++ .../opendaylight/vpnservice/VpnConstants.java | 4 -- .../vpnservice/VpnInterfaceManager.java | 6 +-- 15 files changed, 60 insertions(+), 72 deletions(-) diff --git a/fibmanager/fibmanager-impl/src/main/java/org/opendaylight/vpnservice/fibmanager/FibManager.java b/fibmanager/fibmanager-impl/src/main/java/org/opendaylight/vpnservice/fibmanager/FibManager.java index f1ce228a..7adde2c4 100644 --- a/fibmanager/fibmanager-impl/src/main/java/org/opendaylight/vpnservice/fibmanager/FibManager.java +++ b/fibmanager/fibmanager-impl/src/main/java/org/opendaylight/vpnservice/fibmanager/FibManager.java @@ -82,13 +82,6 @@ public class FibManager extends AbstractDataChangeListener implements private NexthopManager nextHopManager; private ItmRpcService itmManager; private OdlInterfaceRpcService interfaceManager; - - private static final short L3_FIB_TABLE = 21; - private static final short L3_LFIB_TABLE = 20; - public static final short INTERNAL_TUNNEL_TABLE = 23; - private static final short L3_PROTOCOL_TABLE = 36; - private static final short L3_INTERFACE_TABLE = 80; - public static final short LPORT_DISPATCHER_TABLE = 30; 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; @@ -278,8 +271,8 @@ public class FibManager extends AbstractDataChangeListener implements List mkInstructions = new ArrayList(); mkInstructions.add(new InstructionInfo(InstructionType.write_actions, actionsInfos)); - FlowEntity terminatingServiceTableFlowEntity = MDSALUtil.buildFlowEntity(destDpId, INTERNAL_TUNNEL_TABLE, - getFlowRef(destDpId, INTERNAL_TUNNEL_TABLE,label), 5, String.format("%s:%d","TST Flow Entry ",label), + FlowEntity terminatingServiceTableFlowEntity = MDSALUtil.buildFlowEntity(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE, + getFlowRef(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE,label), 5, String.format("%s:%d","TST Flow Entry ",label), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(label)),mkMatches, mkInstructions); mdsalManager.installFlow(terminatingServiceTableFlowEntity); @@ -294,8 +287,8 @@ public class FibManager extends AbstractDataChangeListener implements MetaDataUtil.getTunnelIdWithValidVniBitAndVniSet((int)label), MetaDataUtil.METADA_MASK_TUNNEL_ID })); flowEntity = MDSALUtil.buildFlowEntity(dpId, - INTERNAL_TUNNEL_TABLE, - getFlowRef(dpId, INTERNAL_TUNNEL_TABLE, (int)label), + NwConstants.INTERNAL_TUNNEL_TABLE, + getFlowRef(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, (int)label), 5, String.format("%s:%d","TST Flow Entry ",label), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, null); mdsalManager.removeFlow(flowEntity); @@ -500,12 +493,12 @@ public class FibManager extends AbstractDataChangeListener implements instructions.add(new InstructionInfo(InstructionType.write_actions, actionInfos)); } - String flowRef = getFlowRef(dpId, L3_FIB_TABLE, rd, destPrefix); + String flowRef = getFlowRef(dpId, NwConstants.L3_FIB_TABLE, rd, destPrefix); FlowEntity flowEntity; int priority = DEFAULT_FIB_FLOW_PRIORITY + prefixLength; - flowEntity = MDSALUtil.buildFlowEntity(dpId, L3_FIB_TABLE, flowRef, + flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_FIB_TABLE, flowRef, priority, flowRef, 0, 0, COOKIE_VM_FIB_TABLE, matches, instructions); @@ -539,10 +532,10 @@ public class FibManager extends AbstractDataChangeListener implements instructions.add(new InstructionInfo(InstructionType.write_actions, actionsInfos)); // Install the flow entry in L3_LFIB_TABLE - String flowRef = getFlowRef(dpId, L3_LFIB_TABLE, label, nextHop); + String flowRef = getFlowRef(dpId, NwConstants.L3_LFIB_TABLE, label, nextHop); FlowEntity flowEntity; - flowEntity = MDSALUtil.buildFlowEntity(dpId, L3_LFIB_TABLE, flowRef, + flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_LFIB_TABLE, flowRef, DEFAULT_FIB_FLOW_PRIORITY, flowRef, 0, 0, COOKIE_VM_LFIB_TABLE, matches, instructions); @@ -656,13 +649,13 @@ public class FibManager extends AbstractDataChangeListener implements final BigInteger COOKIE_TABLE_MISS = new BigInteger("1030000", 16); // Instruction to goto L3 InterfaceTable List instructions = new ArrayList(); - instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { L3_INTERFACE_TABLE })); + instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.L3_INTERFACE_TABLE })); List matches = new ArrayList(); - FlowEntity flowEntityLfib = MDSALUtil.buildFlowEntity(dpnId, L3_LFIB_TABLE, - getFlowRef(dpnId, L3_LFIB_TABLE, NwConstants.TABLE_MISS_FLOW), + FlowEntity flowEntityLfib = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_LFIB_TABLE, + getFlowRef(dpnId, NwConstants.L3_LFIB_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "Table Miss", 0, 0, COOKIE_TABLE_MISS, matches, instructions); - FlowEntity flowEntityFib = MDSALUtil.buildFlowEntity(dpnId,L3_FIB_TABLE, getFlowRef(dpnId, L3_FIB_TABLE, NwConstants.TABLE_MISS_FLOW), + FlowEntity flowEntityFib = MDSALUtil.buildFlowEntity(dpnId,NwConstants.L3_FIB_TABLE, getFlowRef(dpnId, NwConstants.L3_FIB_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "FIB Table Miss Flow", 0, 0, COOKIE_VM_FIB_TABLE, matches, instructions); @@ -691,13 +684,13 @@ public class FibManager extends AbstractDataChangeListener implements final BigInteger COOKIE_PROTOCOL_TABLE = new BigInteger("1070000", 16); // Instruction to goto L3 InterfaceTable List instructions = new ArrayList<>(); - instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] {L3_LFIB_TABLE})); + instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] {NwConstants.L3_LFIB_TABLE})); List matches = new ArrayList(); matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { 0x8847L })); - FlowEntity flowEntityToLfib = MDSALUtil.buildFlowEntity(dpnId, L3_PROTOCOL_TABLE, - getFlowRef(dpnId, L3_PROTOCOL_TABLE, - L3_LFIB_TABLE), + FlowEntity flowEntityToLfib = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_PROTOCOL_TABLE, + getFlowRef(dpnId, NwConstants.L3_PROTOCOL_TABLE, + NwConstants.L3_LFIB_TABLE), DEFAULT_FIB_FLOW_PRIORITY, "Protocol Table For LFIB", 0, 0, @@ -741,10 +734,10 @@ public class FibManager extends AbstractDataChangeListener implements instructions.add(new InstructionInfo(InstructionType.clear_actions)); // Instruction to goto L3 InterfaceTable - instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { LPORT_DISPATCHER_TABLE })); + instructions.add(new InstructionInfo(InstructionType.goto_table, new long[] { NwConstants.LPORT_DISPATCHER_TABLE })); - FlowEntity flowEntityL3Intf = MDSALUtil.buildFlowEntity(dpnId, L3_INTERFACE_TABLE, - getFlowRef(dpnId, L3_INTERFACE_TABLE, NwConstants.TABLE_MISS_FLOW), + FlowEntity flowEntityL3Intf = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_INTERFACE_TABLE, + getFlowRef(dpnId, NwConstants.L3_INTERFACE_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "L3 Interface Table Miss", 0, 0, COOKIE_TABLE_MISS, matches, instructions); if (addOrRemove == NwConstants.ADD_FLOW) { LOG.info("Invoking MDSAL to install L3 interface Table Miss Entries"); diff --git a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/IfmConstants.java b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/IfmConstants.java index ce95c4c3..2e573bef 100644 --- a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/IfmConstants.java +++ b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/IfmConstants.java @@ -20,10 +20,6 @@ public class IfmConstants { public static final int DEFAULT_IFINDEX = 65536; public static final int DEFAULT_FLOW_PRIORITY = 5; public static final String IFM_LPORT_TAG_IDPOOL_NAME = "vlaninterfaces.lporttag"; - public static final short VLAN_INTERFACE_INGRESS_TABLE = 0; - public static final short INTERNAL_TUNNEL_TABLE = 22; - public static final short EXTERNAL_TUNNEL_TABLE = 23; - public static final short LFIB_TABLE = 20; public static final BigInteger COOKIE_VM_LFIB_TABLE = new BigInteger("8000002", 16);; public static final String TUNNEL_TABLE_FLOWID_PREFIX = "TUNNEL."; public static final BigInteger TUNNEL_TABLE_COOKIE = new BigInteger("9000000", 16); diff --git a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/commons/InterfaceManagerCommonUtils.java b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/commons/InterfaceManagerCommonUtils.java index fe34b5a4..c3fafa07 100644 --- a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/commons/InterfaceManagerCommonUtils.java +++ b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/commons/InterfaceManagerCommonUtils.java @@ -88,18 +88,18 @@ public class InterfaceManagerCommonUtils { } public static void makeTunnelIngressFlow(List> futures, IMdsalApiManager mdsalApiManager, IfTunnel tunnel, BigInteger dpnId, long portNo, Interface iface, int addOrRemoveFlow) { - String flowRef = InterfaceManagerCommonUtils.getTunnelInterfaceFlowRef(dpnId, VpnConstants.LPORT_INGRESS_TABLE, iface.getName()); + String flowRef = InterfaceManagerCommonUtils.getTunnelInterfaceFlowRef(dpnId, NwConstants.VLAN_INTERFACE_INGRESS_TABLE, iface.getName()); List matches = new ArrayList(); List mkInstructions = new ArrayList(); if (NwConstants.ADD_FLOW == addOrRemoveFlow) { matches.add(new MatchInfo(MatchFieldType.in_port, new BigInteger[] { dpnId, BigInteger.valueOf(portNo) })); - short tableId = tunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeMplsOverGre.class) ? IfmConstants.LFIB_TABLE : - tunnel.isInternal() ? IfmConstants.INTERNAL_TUNNEL_TABLE : IfmConstants.EXTERNAL_TUNNEL_TABLE; + short tableId = tunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeMplsOverGre.class) ? NwConstants.L3_LFIB_TABLE : + tunnel.isInternal() ? NwConstants.INTERNAL_TUNNEL_TABLE : NwConstants.EXTERNAL_TUNNEL_TABLE; mkInstructions.add(new InstructionInfo(InstructionType.goto_table, new long[] {tableId}));} BigInteger COOKIE_VM_INGRESS_TABLE = new BigInteger("8000001", 16); - FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, IfmConstants.VLAN_INTERFACE_INGRESS_TABLE, flowRef, + FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.VLAN_INTERFACE_INGRESS_TABLE, flowRef, IfmConstants.DEFAULT_FLOW_PRIORITY, iface.getName(), 0, 0, COOKIE_VM_INGRESS_TABLE, matches, mkInstructions); if (NwConstants.ADD_FLOW == addOrRemoveFlow) { futures.add(mdsalApiManager.installFlow(dpnId, flowEntity)); diff --git a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/rpcservice/InterfaceManagerRpcService.java b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/rpcservice/InterfaceManagerRpcService.java index 14070ed0..b21cd15b 100644 --- a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/rpcservice/InterfaceManagerRpcService.java +++ b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/rpcservice/InterfaceManagerRpcService.java @@ -397,8 +397,8 @@ public class InterfaceManagerRpcService implements OdlInterfaceRpcService { private ListenableFuture makeTerminatingServiceFlow(IfTunnel tunnelInfo, BigInteger dpnId, BigInteger tunnelKey, List instruction, int addOrRemove) { List mkMatches = new ArrayList(); mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] {tunnelKey})); - short tableId = tunnelInfo.isInternal() ? IfmConstants.INTERNAL_TUNNEL_TABLE : - IfmConstants.EXTERNAL_TUNNEL_TABLE; + short tableId = tunnelInfo.isInternal() ? NwConstants.INTERNAL_TUNNEL_TABLE : + NwConstants.EXTERNAL_TUNNEL_TABLE; final String flowRef = getFlowRef(dpnId,tableId, tunnelKey); Flow terminatingSerFlow = MDSALUtil.buildFlowNew(tableId, flowRef, 5, "TST Flow Entry", 0, 0, @@ -416,9 +416,9 @@ public class InterfaceManagerRpcService implements OdlInterfaceRpcService { new long[]{0x8847L})); mkMatches.add(new MatchInfo(MatchFieldType.mpls_label, new String[]{Long.toString(tunnelKey.longValue())})); // Install the flow entry in L3_LFIB_TABLE - String flowRef = getFlowRef(dpnId, IfmConstants.LFIB_TABLE, tunnelKey); + String flowRef = getFlowRef(dpnId, NwConstants.L3_LFIB_TABLE, tunnelKey); - Flow lfibFlow = MDSALUtil.buildFlowNew(IfmConstants.LFIB_TABLE, flowRef, + Flow lfibFlow = MDSALUtil.buildFlowNew(NwConstants.L3_LFIB_TABLE, flowRef, IfmConstants.DEFAULT_FLOW_PRIORITY, "LFIB Entry", 0, 0, IfmConstants.COOKIE_VM_LFIB_TABLE, mkMatches, instruction); if (addOrRemove == NwConstants.ADD_FLOW) { diff --git a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigBindHelper.java b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigBindHelper.java index e34e2b06..0e9be053 100644 --- a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigBindHelper.java +++ b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigBindHelper.java @@ -15,6 +15,7 @@ import org.opendaylight.vpnservice.interfacemgr.IfmUtil; import org.opendaylight.vpnservice.interfacemgr.commons.InterfaceManagerCommonUtils; import org.opendaylight.vpnservice.interfacemgr.servicebindings.flowbased.utilities.FlowBasedServicesUtils; import org.opendaylight.vpnservice.mdsalutil.MatchInfo; +import org.opendaylight.vpnservice.mdsalutil.NwConstants; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -84,7 +85,7 @@ public class FlowBasedServicesConfigBindHelper { if (matches != null) { FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface, boundServiceNew, - transaction, matches, ifState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE); + transaction, matches, ifState.getIfIndex(), NwConstants.VLAN_INTERFACE_INGRESS_TABLE); } if (transaction != null) { @@ -131,7 +132,7 @@ public class FlowBasedServicesConfigBindHelper { WriteTransaction installFlowTransaction = dataBroker.newWriteOnlyTransaction(); FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface, boundServiceNew, installFlowTransaction, - matches, ifState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE); + matches, ifState.getIfIndex(), NwConstants.VLAN_INTERFACE_INGRESS_TABLE); futures.add(installFlowTransaction.submit()); } } diff --git a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigUnbindHelper.java b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigUnbindHelper.java index e18072c7..cd0c00d9 100644 --- a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigUnbindHelper.java +++ b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigUnbindHelper.java @@ -15,6 +15,7 @@ import org.opendaylight.vpnservice.interfacemgr.IfmUtil; import org.opendaylight.vpnservice.interfacemgr.commons.InterfaceManagerCommonUtils; import org.opendaylight.vpnservice.interfacemgr.servicebindings.flowbased.utilities.FlowBasedServicesUtils; import org.opendaylight.vpnservice.mdsalutil.MatchInfo; +import org.opendaylight.vpnservice.mdsalutil.NwConstants; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -102,7 +103,7 @@ public class FlowBasedServicesConfigUnbindHelper { BoundServices toBeMoved = tmpServicesMap.get(highestPriority); FlowBasedServicesUtils.removeIngressFlow(iface, boundServiceOld, dpId, t); FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface, toBeMoved, t, - matches, ifState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE); + matches, ifState.getIfIndex(), NwConstants.VLAN_INTERFACE_INGRESS_TABLE); FlowBasedServicesUtils.removeLPortDispatcherFlow(dpId, iface, toBeMoved, t); if (t != null) { diff --git a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/statehelpers/FlowBasedServicesStateBindHelper.java b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/statehelpers/FlowBasedServicesStateBindHelper.java index b1c4d489..25812cdf 100644 --- a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/statehelpers/FlowBasedServicesStateBindHelper.java +++ b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/statehelpers/FlowBasedServicesStateBindHelper.java @@ -15,6 +15,7 @@ import org.opendaylight.vpnservice.interfacemgr.IfmUtil; import org.opendaylight.vpnservice.interfacemgr.commons.InterfaceManagerCommonUtils; import org.opendaylight.vpnservice.interfacemgr.servicebindings.flowbased.utilities.FlowBasedServicesUtils; import org.opendaylight.vpnservice.mdsalutil.MatchInfo; +import org.opendaylight.vpnservice.mdsalutil.NwConstants; import org.opendaylight.vpnservice.mdsalutil.interfaces.IMdsalApiManager; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel; @@ -73,7 +74,7 @@ public class FlowBasedServicesStateBindHelper { if (matches != null) { FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface, highestPriorityBoundService, - t, matches, ifaceState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE); + t, matches, ifaceState.getIfIndex(), NwConstants.VLAN_INTERFACE_INGRESS_TABLE); } for (BoundServices boundService : allServices) { diff --git a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/utilities/FlowBasedServicesUtils.java b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/utilities/FlowBasedServicesUtils.java index bcaff79d..1624b0b5 100644 --- a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/utilities/FlowBasedServicesUtils.java +++ b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/utilities/FlowBasedServicesUtils.java @@ -188,7 +188,7 @@ public class FlowBasedServicesUtils { Node nodeDpn = buildInventoryDpnNode(dpId); InstanceIdentifier flowInstanceId = InstanceIdentifier.builder(Nodes.class) .child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class) - .child(Table.class, new TableKey(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE)).child(Flow.class, flowKey).build(); + .child(Table.class, new TableKey(NwConstants.VLAN_INTERFACE_INGRESS_TABLE)).child(Flow.class, flowKey).build(); t.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId); } @@ -244,7 +244,7 @@ public class FlowBasedServicesUtils { Node nodeDpn = buildInventoryDpnNode(dpId); InstanceIdentifier flowInstanceId = InstanceIdentifier.builder(Nodes.class) .child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class) - .child(Table.class, new TableKey(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE)).child(Flow.class, flowKey).build(); + .child(Table.class, new TableKey(NwConstants.VLAN_INTERFACE_INGRESS_TABLE)).child(Flow.class, flowKey).build(); t.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId); } @@ -265,7 +265,7 @@ public class FlowBasedServicesUtils { } private static String getFlowRef(BigInteger dpnId, String iface, BoundServices service) { - return new StringBuffer().append(dpnId).append(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE).append(NwConstants.FLOWID_SEPARATOR) + return new StringBuffer().append(dpnId).append( NwConstants.VLAN_INTERFACE_INGRESS_TABLE).append(NwConstants.FLOWID_SEPARATOR) .append(iface).append(NwConstants.FLOWID_SEPARATOR).append(service.getServiceName()).append(NwConstants.FLOWID_SEPARATOR) .append(service.getServicePriority()).toString(); } diff --git a/interfacemgr/interfacemgr-impl/src/test/java/org/opendaylight/vpnservice/interfacemgr/test/FlowBasedServicesStateConfigurationTest.java b/interfacemgr/interfacemgr-impl/src/test/java/org/opendaylight/vpnservice/interfacemgr/test/FlowBasedServicesStateConfigurationTest.java index 79ae7492..ce7e9779 100644 --- a/interfacemgr/interfacemgr-impl/src/test/java/org/opendaylight/vpnservice/interfacemgr/test/FlowBasedServicesStateConfigurationTest.java +++ b/interfacemgr/interfacemgr-impl/src/test/java/org/opendaylight/vpnservice/interfacemgr/test/FlowBasedServicesStateConfigurationTest.java @@ -17,10 +17,7 @@ import org.opendaylight.vpnservice.interfacemgr.IfmConstants; import org.opendaylight.vpnservice.interfacemgr.IfmUtil; import org.opendaylight.vpnservice.interfacemgr.servicebindings.flowbased.statehelpers.FlowBasedServicesStateBindHelper; import org.opendaylight.vpnservice.interfacemgr.servicebindings.flowbased.statehelpers.FlowBasedServicesStateUnbindHelper; -import org.opendaylight.vpnservice.mdsalutil.MDSALUtil; -import org.opendaylight.vpnservice.mdsalutil.MatchFieldType; -import org.opendaylight.vpnservice.mdsalutil.MatchInfo; -import org.opendaylight.vpnservice.mdsalutil.MetaDataUtil; +import org.opendaylight.vpnservice.mdsalutil.*; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus; @@ -104,7 +101,7 @@ public class FlowBasedServicesStateConfigurationTest { .setLowerLayerIf(lowerLayerIfList) .setKey(IfmUtil.getStateInterfaceKeyFromName(InterfaceManagerTestUtil.interfaceName)) .setName(InterfaceManagerTestUtil.interfaceName); - stypeOpenflow = InterfaceManagerTestUtil.buildStypeOpenflow(dpId,flowpriority, IfmConstants.VLAN_INTERFACE_INGRESS_TABLE, instructions); + stypeOpenflow = InterfaceManagerTestUtil.buildStypeOpenflow(dpId,flowpriority, NwConstants.VLAN_INTERFACE_INGRESS_TABLE, instructions); instructionKey = new InstructionKey(instructionKeyval); BigInteger[] metadataValues = IfmUtil.mergeOpenflowMetadataWriteInstructions(instructions); boundService = InterfaceManagerTestUtil.buildBoundServices(serviceName,key,new BoundServicesKey(key),stypeOpenflow); diff --git a/interfacemgr/interfacemgr-impl/src/test/java/org/opendaylight/vpnservice/interfacemgr/test/InterfaceManagerTestUtil.java b/interfacemgr/interfacemgr-impl/src/test/java/org/opendaylight/vpnservice/interfacemgr/test/InterfaceManagerTestUtil.java index 497d089b..89d7db18 100644 --- a/interfacemgr/interfacemgr-impl/src/test/java/org/opendaylight/vpnservice/interfacemgr/test/InterfaceManagerTestUtil.java +++ b/interfacemgr/interfacemgr-impl/src/test/java/org/opendaylight/vpnservice/interfacemgr/test/InterfaceManagerTestUtil.java @@ -217,7 +217,7 @@ public class InterfaceManagerTestUtil { public static String buildflowRef(BigInteger dpId,String servicaName,String boundServicename, short servicePriority) { - String flowRef = new StringBuffer().append(dpId).append(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE).append(NwConstants.FLOWID_SEPARATOR). + String flowRef = new StringBuffer().append(dpId).append(NwConstants.VLAN_INTERFACE_INGRESS_TABLE).append(NwConstants.FLOWID_SEPARATOR). append(servicaName).append(NwConstants.FLOWID_SEPARATOR).append(boundServicename). append(NwConstants.FLOWID_SEPARATOR).append(servicePriority).toString(); return flowRef; diff --git a/itm/itm-api/src/main/java/org/opendaylight/vpnservice/itm/globals/ITMConstants.java b/itm/itm-api/src/main/java/org/opendaylight/vpnservice/itm/globals/ITMConstants.java index cff7efe5..88cf81df 100644 --- a/itm/itm-api/src/main/java/org/opendaylight/vpnservice/itm/globals/ITMConstants.java +++ b/itm/itm-api/src/main/java/org/opendaylight/vpnservice/itm/globals/ITMConstants.java @@ -11,10 +11,7 @@ import java.math.BigInteger; public class ITMConstants{ - - public static final short INTERNAL_TUNNEL_TABLE = 22; - public static final BigInteger COOKIE_ITM = new BigInteger("9000000", 16); - + public static final BigInteger COOKIE_ITM = new BigInteger("9000000", 16); public static final String ITM_IDPOOL_NAME = "Itmservices"; public static final long ITM_IDPOOL_START = 1L; public static final String ITM_IDPOOL_SIZE = "100000"; diff --git a/itm/itm-impl/src/main/java/org/opendaylight/vpnservice/itm/rpc/ItmManagerRpcService.java b/itm/itm-impl/src/main/java/org/opendaylight/vpnservice/itm/rpc/ItmManagerRpcService.java index 066e5059..69aa9044 100644 --- a/itm/itm-impl/src/main/java/org/opendaylight/vpnservice/itm/rpc/ItmManagerRpcService.java +++ b/itm/itm-impl/src/main/java/org/opendaylight/vpnservice/itm/rpc/ItmManagerRpcService.java @@ -12,6 +12,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.Future; +import org.opendaylight.vpnservice.mdsalutil.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.IdManagerService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,12 +60,6 @@ import com.google.common.util.concurrent.SettableFuture; import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; -import org.opendaylight.vpnservice.mdsalutil.MDSALUtil; -import org.opendaylight.vpnservice.mdsalutil.MatchFieldType; -import org.opendaylight.vpnservice.mdsalutil.MatchInfo; -import org.opendaylight.vpnservice.mdsalutil.MetaDataUtil; -import org.opendaylight.vpnservice.mdsalutil.ActionInfo; -import org.opendaylight.vpnservice.mdsalutil.ActionType; import com.google.common.base.Optional; @@ -223,8 +218,8 @@ public class ItmManagerRpcService implements ItmRpcService { new BigInteger(1, vxLANHeader), MetaDataUtil.METADA_MASK_VALID_TUNNEL_ID_BIT_AND_TUNNEL_ID })); - Flow terminatingServiceTableFlow = MDSALUtil.buildFlowNew(ITMConstants.INTERNAL_TUNNEL_TABLE, - getFlowRef(ITMConstants.INTERNAL_TUNNEL_TABLE,serviceId), 5, String.format("%s:%d","ITM Flow Entry ",serviceId), + Flow terminatingServiceTableFlow = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, + getFlowRef(NwConstants.INTERNAL_TUNNEL_TABLE,serviceId), 5, String.format("%s:%d","ITM Flow Entry ",serviceId), 0, 0, ITMConstants.COOKIE_ITM.add(BigInteger.valueOf(serviceId)),mkMatches, input.getInstruction()); ListenableFuture installFlowResult = mdsalManager.installFlow(input.getDpnId(), terminatingServiceTableFlow); @@ -250,8 +245,8 @@ public class ItmManagerRpcService implements ItmRpcService { public Future> removeTerminatingServiceActions(final RemoveTerminatingServiceActionsInput input) { LOG.info("remove terminatingServiceActions called with DpnId = {} and serviceId = {}", input.getDpnId(), input.getServiceId()); final SettableFuture> result = SettableFuture.create(); - Flow terminatingServiceTableFlow = MDSALUtil.buildFlowNew(ITMConstants.INTERNAL_TUNNEL_TABLE, - getFlowRef(ITMConstants.INTERNAL_TUNNEL_TABLE,input.getServiceId()), 5, String.format("%s:%d","ITM Flow Entry ",input.getServiceId()), + Flow terminatingServiceTableFlow = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, + getFlowRef(NwConstants.INTERNAL_TUNNEL_TABLE,input.getServiceId()), 5, String.format("%s:%d","ITM Flow Entry ",input.getServiceId()), 0, 0, ITMConstants.COOKIE_ITM.add(BigInteger.valueOf(input.getServiceId())),getTunnelMatchesForServiceId(input.getServiceId()), null ); ListenableFuture installFlowResult = mdsalManager.installFlow(input.getDpnId(), terminatingServiceTableFlow); diff --git a/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/vpnservice/mdsalutil/NwConstants.java b/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/vpnservice/mdsalutil/NwConstants.java index da0b0f74..56df8353 100644 --- a/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/vpnservice/mdsalutil/NwConstants.java +++ b/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/vpnservice/mdsalutil/NwConstants.java @@ -41,4 +41,15 @@ public class NwConstants { public static final int DEFAULT_ARP_FLOW_PRIORITY = 100; + //Table IDs + public static final short L3_FIB_TABLE = 21; + public static final short L3_LFIB_TABLE = 20; + + public static final short L3_PROTOCOL_TABLE = 36; + public static final short L3_INTERFACE_TABLE = 80; + public static final short LPORT_DISPATCHER_TABLE = 30; + public static final short VLAN_INTERFACE_INGRESS_TABLE = 0; + public static final short INTERNAL_TUNNEL_TABLE = 36; + public static final short EXTERNAL_TUNNEL_TABLE = 38; + } \ No newline at end of file diff --git a/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnConstants.java b/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnConstants.java index 8bcde64d..75b07639 100644 --- a/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnConstants.java +++ b/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnConstants.java @@ -14,10 +14,6 @@ public class VpnConstants { public static final String VPN_IDPOOL_NAME = "vpnservices"; public static final long VPN_IDPOOL_START = 100L; public static final String VPN_IDPOOL_SIZE = "100000"; - public static final short LPORT_INGRESS_TABLE = 0; - public static final short LFIB_TABLE = 20; - public static final short FIB_TABLE = 21; - public static final short L3_INTERFACE_TABLE = 80; public static final short DEFAULT_FLOW_PRIORITY = 10; public static final short L3VPN_SERVICE_IDENTIFIER = 2; public static final long INVALID_ID = -1; diff --git a/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnInterfaceManager.java b/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnInterfaceManager.java index 45a21744..c37666a9 100644 --- a/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnInterfaceManager.java +++ b/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnInterfaceManager.java @@ -212,7 +212,7 @@ public class VpnInterfaceManager extends AbstractDataChangeListener instructions = new ArrayList(); 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)); BoundServices serviceInfo = @@ -305,10 +305,10 @@ public class VpnInterfaceManager extends AbstractDataChangeListener