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);
}
*/
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);
}
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);
}
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
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);
}
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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;
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);
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);
// 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;
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.";
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;
}
}
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);
}
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);
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(
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
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,
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();
}
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);
}
*/
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
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;
* @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);
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)));
}
}
}
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());
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());
// 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;
}
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)));
// 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);
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);
}
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) {
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;
}
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);
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);
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;
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();
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;
@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);
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;
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);
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;
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";
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);
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);
}
- 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 */
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);
}
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);
}
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;
}
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 */
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);
}
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();
}
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 */
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));
}
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;
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));
*/
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;
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;
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
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
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);
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;
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;
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;
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;
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;
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);
}
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();
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));
}
}
}
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);
}
}
//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
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);
}
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();
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);
}
}
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
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();
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
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).
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);
}
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;
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;
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;
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;
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;
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;
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;
}
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;
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;
}
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;
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;
}
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;
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;
}
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;
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);
//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);
}
//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.
}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);
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;
}
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()});
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;
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});
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;
}
//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);
}
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;
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.
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;
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();
}
//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.
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);
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();
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);
}
}
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 {}" +
, 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 {} " +
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;
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>();
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;
}
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;
}
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);
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);
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;
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;
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;
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;
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);
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 };
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);
}
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);
}
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));
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;
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;
}