*/
package org.opendaylight.netvirt.natservice.internal;
-import com.google.common.base.Optional;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar;
import org.opendaylight.genius.infra.Datastore.Configuration;
import org.opendaylight.genius.infra.TypedReadWriteTransaction;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack;
import org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack.NxCtAction;
+import org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear;
import org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort;
import org.opendaylight.genius.mdsalutil.actions.ActionNxLoadMetadata;
import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination;
import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
-import org.opendaylight.genius.mdsalutil.matches.MatchTunnelId;
import org.opendaylight.genius.mdsalutil.nxmatches.NxMatchCtState;
+import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.netvirt.fibmanager.api.IFibManager;
import org.opendaylight.netvirt.natservice.ha.NatDataUtil;
import org.opendaylight.netvirt.vpnmanager.api.IVpnFootprintService;
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.ext.routers.routers.ExternalIps;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.subnets.Subnets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatRangePresent;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Override
protected void addSnatSpecificEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
- Routers routers, BigInteger dpnId) {
+ Routers routers, Uint64 dpnId) {
LOG.info("installSnatSpecificEntriesForNaptSwitch: called for router {}",
routers.getRouterName());
String routerName = routers.getRouterName();
- Long routerId = NatUtil.getVpnId(confTx, routerName);
+ Uint32 routerId = NatUtil.getVpnId(confTx, routerName);
int elanId = NatUtil.getElanInstanceByName(confTx, routers.getNetworkId().getValue())
.getElanTag().intValue();
if (routerId == NatConstants.INVALID_ID) {
/* Install Outbound NAT entries */
addSnatMissEntryForPrimrySwch(confTx, dpnId, routerId, elanId);
- addTerminatingServiceTblEntry(confTx, dpnId, routerId, elanId);
String extGwMacAddress = NatUtil.getExtGwMacAddFromRouterName(confTx, routerName);
addOutboundTblTrackEntry(confTx, dpnId, routerId, extGwMacAddress);
- for (ExternalIps externalIp : routers.getExternalIps()) {
+ for (ExternalIps externalIp : routers.nonnullExternalIps()) {
if (!NWUtil.isIpv4Address(externalIp.getIpAddress())) {
// In this class we handle only IPv4 use-cases.
continue;
}
//The logic now handle only one external IP per router, others if present will be ignored.
- long extSubnetId = NatUtil.getExternalSubnetVpnId(confTx, externalIp.getSubnetId());
+ Uint32 extSubnetId = NatUtil.getExternalSubnetVpnId(confTx, externalIp.getSubnetId());
addOutboundTblEntry(confTx, dpnId, routerId, externalIp.getIpAddress(), elanId, extGwMacAddress);
addNaptPfibFlow(confTx, routers, dpnId, routerId, extSubnetId);
if (externalSubnet.isPresent()) {
String externalVpn = externalIp.getSubnetId().getValue();
String vpnRd = NatUtil.getVpnRd(confTx, externalVpn);
- vpnFootprintService.updateVpnToDpnMapping(dpnId, externalVpn, vpnRd, null /* interfaceName*/,
- new ImmutablePair<>(IpAddresses.IpAddressSource.ExternalFixedIP, fibExternalIp),
- true);
+ vpnFootprintService.updateVpnToDpnMapping(dpnId, externalVpn, vpnRd,
+ null /* interfaceName*/, new ImmutablePair<>(IpAddresses
+ .IpAddressSource.ExternalFixedIP, fibExternalIp), true);
}
break;
}
@Override
protected void removeSnatSpecificEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
- Routers routers, BigInteger dpnId) {
+ Routers routers, Uint64 dpnId) throws ExecutionException, InterruptedException {
LOG.info("installSnatSpecificEntriesForNaptSwitch: called for router {}",
routers.getRouterName());
String routerName = routers.getRouterName();
- Long routerId = NatUtil.getVpnId(confTx, routerName);
+ Uint32 routerId = NatUtil.getVpnId(confTx, routerName);
if (routerId == NatConstants.INVALID_ID) {
LOG.error("InvalidRouterId: unable to installSnatSpecificEntriesForNaptSwitch on dpn {}", dpnId);
return;
/* Remove Outbound NAT entries */
removeSnatMissEntryForPrimrySwch(confTx, dpnId, routerId);
- removeTerminatingServiceTblEntry(confTx, dpnId, routerId);
removeOutboundTblTrackEntry(confTx, dpnId, routerId);
- for (ExternalIps externalIp : routers.getExternalIps()) {
+ for (ExternalIps externalIp : routers.nonnullExternalIps()) {
if (!NWUtil.isIpv4Address(externalIp.getIpAddress())) {
// In this class we handle only IPv4 use-cases.
continue;
}
@Override
- protected void addSnatSpecificEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
- Routers routers, BigInteger dpnId) {
+ protected void addSnatSpecificEntriesForNonNaptSwitch() {
// Nothing to to do here
}
@Override
- protected void removeSnatSpecificEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
- Routers routers, BigInteger dpnId) {
+ protected void removeSnatSpecificEntriesForNonNaptSwitch() {
// Nothing to to do here
}
- protected void addSnatMissEntryForPrimrySwch(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId,
- Long routerId, int elanId) {
+ protected void addSnatMissEntryForPrimrySwch(TypedWriteTransaction<Configuration> confTx, Uint64 dpnId,
+ Uint32 routerId, int elanId) {
LOG.info("installSnatSpecificEntriesForNaptSwitch : called for the primary NAPT switch dpnId {}", dpnId);
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
- matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
+ matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId.longValue()),
+ MetaDataUtil.METADATA_MASK_VRFID));
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
List<NxCtAction> ctActionsList = new ArrayList<>();
instructions.add(new InstructionApplyActions(actionsInfos));
String flowRef = getFlowRef(dpnId, NwConstants.PSNAT_TABLE, routerId);
- addFlow(confTx, dpnId, NwConstants.PSNAT_TABLE, flowRef, NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef,
- NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
+ NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.PSNAT_TABLE, flowRef,
+ NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches,
+ instructions);
}
- protected void removeSnatMissEntryForPrimrySwch(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
- Long routerId) {
+ protected void removeSnatMissEntryForPrimrySwch(TypedReadWriteTransaction<Configuration> confTx, Uint64 dpnId,
+ Uint32 routerId) throws ExecutionException, InterruptedException {
LOG.info("installSnatSpecificEntriesForNaptSwitch : called for the primary NAPT switch dpnId {}", dpnId);
String flowRef = getFlowRef(dpnId, NwConstants.PSNAT_TABLE, routerId);
- removeFlow(confTx, dpnId, NwConstants.PSNAT_TABLE, flowRef);
- }
-
- protected void addTerminatingServiceTblEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId,
- Long routerId, int elanId) {
- LOG.info("installTerminatingServiceTblEntry : creating entry for Terminating Service Table "
- + "for switch {}, routerId {}", dpnId, routerId);
- List<MatchInfo> matches = new ArrayList<>();
- matches.add(MatchEthernetType.IPV4);
- matches.add(new MatchTunnelId(BigInteger.valueOf(routerId)));
-
- List<ActionInfo> actionsInfos = new ArrayList<>();
- List<NxCtAction> ctActionsList = new ArrayList<>();
- NxCtAction nxCtAction = new ActionNxConntrack.NxNat(0, 0, 0,null, null,0, 0);
- ctActionsList.add(nxCtAction);
- ActionNxConntrack actionNxConntrack = new ActionNxConntrack(0, 0, elanId, NwConstants
- .OUTBOUND_NAPT_TABLE,ctActionsList);
- ActionNxLoadMetadata actionLoadMeta = new ActionNxLoadMetadata(MetaDataUtil
- .getVpnIdMetadata(routerId), LOAD_START, LOAD_END);
- actionsInfos.add(actionLoadMeta);
- actionsInfos.add(actionNxConntrack);
- List<InstructionInfo> instructions = new ArrayList<>();
- instructions.add(new InstructionApplyActions(actionsInfos));
- String flowRef = getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, routerId);
- addFlow(confTx, dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, flowRef, NatConstants.DEFAULT_TS_FLOW_PRIORITY,
- flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
+ NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.PSNAT_TABLE, flowRef);
}
- protected void removeTerminatingServiceTblEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
- Long routerId) {
- LOG.info("installTerminatingServiceTblEntry : creating entry for Terminating Service Table "
- + "for switch {}, routerId {}", dpnId, routerId);
-
- String flowRef = getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, routerId);
- removeFlow(confTx, dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, flowRef);
- }
-
- protected void addOutboundTblTrackEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId,
- Long routerId, String extGwMacAddress) {
+ protected void addOutboundTblTrackEntry(TypedWriteTransaction<Configuration> confTx, Uint64 dpnId,
+ Uint32 routerId, String extGwMacAddress) {
LOG.info("createOutboundTblTrackEntry : called for switch {}, routerId {}", dpnId, routerId);
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new NxMatchCtState(SNAT_CT_STATE, SNAT_CT_STATE_MASK));
- matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
+ matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId.longValue()),
+ MetaDataUtil.METADATA_MASK_VRFID));
ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
listActionInfo.add(new ActionSetFieldEthernetSource(new MacAddress(extGwMacAddress)));
ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
instructionInfo.add(new InstructionApplyActions(listActionInfo));
String flowRef = getFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId) + "trkest";
- addFlow(confTx, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef, NatConstants.SNAT_TRK_FLOW_PRIORITY, flowRef,
- NwConstants.COOKIE_SNAT_TABLE, matches, instructionInfo);
+ NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef,
+ NatConstants.SNAT_TRK_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches,
+ instructionInfo);
}
- protected void removeOutboundTblTrackEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
- Long routerId) {
+ protected void removeOutboundTblTrackEntry(TypedReadWriteTransaction<Configuration> confTx, Uint64 dpnId,
+ Uint32 routerId) throws ExecutionException, InterruptedException {
LOG.info("createOutboundTblTrackEntry : called for switch {}, routerId {}", dpnId, routerId);
String flowRef = getFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId) + "trkest";
- removeFlow(confTx, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef);
+ NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef);
}
- protected void addOutboundTblEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId, long routerId,
+ protected void addOutboundTblEntry(TypedWriteTransaction<Configuration> confTx, Uint64 dpnId, Uint32 routerId,
String externalIp, int elanId, String extGwMacAddress) {
LOG.info("createOutboundTblEntry : dpId {} and routerId {}", dpnId, routerId);
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new NxMatchCtState(TRACKED_NEW_CT_STATE, TRACKED_NEW_CT_MASK));
- matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
+ matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId.longValue()),
+ MetaDataUtil.METADATA_MASK_VRFID));
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionSetFieldEthernetSource(new MacAddress(extGwMacAddress)));
List<NxCtAction> ctActionsListCommit = new ArrayList<>();
int rangePresent = NxActionNatRangePresent.NXNATRANGEIPV4MIN.getIntValue();
int flags = NxActionNatFlags.NXNATFSRC.getIntValue();
NxCtAction nxCtActionCommit = new ActionNxConntrack.NxNat(0, flags, rangePresent,
- new IpPrefixOrAddress(externalIp.toCharArray()).getIpAddress(),
- null,0, 0);
+ IpPrefixOrAddressBuilder.getDefaultInstance(externalIp).getIpAddress(), null,0, 0);
ctActionsListCommit.add(nxCtActionCommit);
int ctCommitFlag = 1;
ActionNxConntrack actionNxConntrackSubmit = new ActionNxConntrack(ctCommitFlag, 0, elanId,
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionApplyActions(actionsInfos));
String flowRef = getFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
- addFlow(confTx, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef, NatConstants.SNAT_NEW_FLOW_PRIORITY,
- flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
+ NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef,
+ NatConstants.SNAT_NEW_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
}
- protected void removeOutboundTblEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
- long routerId) {
+ protected void removeOutboundTblEntry(TypedReadWriteTransaction<Configuration> confTx, Uint64 dpnId,
+ Uint32 routerId) throws ExecutionException, InterruptedException {
LOG.info("createOutboundTblEntry : dpId {} and routerId {}", dpnId, routerId);
String flowRef = getFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
- removeFlow(confTx, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef);
+ NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef);
}
- protected void addNaptPfibFlow(TypedReadWriteTransaction<Configuration> confTx, Routers routers, BigInteger dpnId,
- long routerId, long extSubnetId) {
- Long extNetId = NatUtil.getVpnId(confTx, routers.getNetworkId().getValue());
+ protected void addNaptPfibFlow(TypedReadWriteTransaction<Configuration> confTx, Routers routers, Uint64 dpnId,
+ Uint32 routerId, Uint32 extSubnetId) {
+ Uint32 extNetId = NatUtil.getVpnId(confTx, routers.getNetworkId().getValue());
LOG.info("installNaptPfibFlow : dpId {}, extNetId {}", dpnId, extNetId);
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new NxMatchCtState(SNAT_CT_STATE, SNAT_CT_STATE_MASK));
- matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
+ matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId.longValue()),
+ MetaDataUtil.METADATA_MASK_VRFID));
List<ActionInfo> listActionInfo = new ArrayList<>();
if (extSubnetId == NatConstants.INVALID_ID) {
LOG.error("installNaptPfibFlow : external subnet id is invalid.");
return;
}
ActionNxLoadMetadata actionLoadMeta = new ActionNxLoadMetadata(MetaDataUtil
- .getVpnIdMetadata(extSubnetId), LOAD_START, LOAD_END);
+ .getVpnIdMetadata(extSubnetId.longValue()), LOAD_START, LOAD_END);
listActionInfo.add(actionLoadMeta);
- ArrayList<InstructionInfo> instructions = new ArrayList<>();
- listActionInfo.add(new ActionNxLoadInPort(BigInteger.ZERO));
+ listActionInfo.add(new ActionNxLoadInPort(Uint64.valueOf(BigInteger.ZERO)));
+ listActionInfo.add(new ActionNxCtClear());
listActionInfo.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
+ ArrayList<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionApplyActions(listActionInfo));
String flowRef = getFlowRef(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId);
flowRef = flowRef + "OUTBOUND";
- addFlow(confTx, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef, NatConstants.SNAT_TRK_FLOW_PRIORITY,
- flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
+ NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef,
+ NatConstants.SNAT_TRK_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
}
protected void removeNaptPfibFlow(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
- BigInteger dpnId, long routerId) {
- Long extNetId = NatUtil.getVpnId(confTx, routers.getNetworkId().getValue());
+ Uint64 dpnId, Uint32 routerId) throws ExecutionException, InterruptedException {
+ Uint32 extNetId = NatUtil.getVpnId(confTx, routers.getNetworkId().getValue());
LOG.info("installNaptPfibFlow : dpId {}, extNetId {}", dpnId, extNetId);
String flowRef = getFlowRef(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId) + "OUTBOUND";
- removeFlow(confTx, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef);
+ NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef);
}
- protected void addInboundEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId, long routerId,
- String externalIp, int elanId, long extSubnetId) {
+ protected void addInboundEntry(TypedWriteTransaction<Configuration> confTx, Uint64 dpnId, Uint32 routerId,
+ String externalIp, int elanId, Uint32 extSubnetId) {
LOG.info("installInboundEntry : dpId {} and routerId {}", dpnId, routerId);
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
LOG.error("installInboundEntry : external subnet id is invalid.");
return;
}
- matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(extSubnetId),
+ matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(extSubnetId.longValue()),
MetaDataUtil.METADATA_MASK_VRFID));
List<ActionInfo> actionsInfos = new ArrayList<>();
List<NxCtAction> ctActionsList = new ArrayList<>();
NxCtAction nxCtAction = new ActionNxConntrack.NxNat(0, 0, 0,null, null,0, 0);
ActionNxLoadMetadata actionLoadMeta = new ActionNxLoadMetadata(MetaDataUtil
- .getVpnIdMetadata(routerId), LOAD_START, LOAD_END);
+ .getVpnIdMetadata(routerId.longValue()), LOAD_START, LOAD_END);
actionsInfos.add(actionLoadMeta);
ctActionsList.add(nxCtAction);
ActionNxConntrack actionNxConntrack = new ActionNxConntrack(0, 0, elanId, NwConstants
instructions.add(new InstructionApplyActions(actionsInfos));
String flowRef = getFlowRef(dpnId, NwConstants.INBOUND_NAPT_TABLE, routerId);
flowRef = flowRef + "OUTBOUND";
- addFlow(confTx, dpnId, NwConstants.INBOUND_NAPT_TABLE, flowRef, NatConstants.DEFAULT_TS_FLOW_PRIORITY, flowRef,
- NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
+ NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.INBOUND_NAPT_TABLE, flowRef,
+ NatConstants.DEFAULT_TS_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
}
- protected void removeInboundEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
- long routerId) {
+ protected void removeInboundEntry(TypedReadWriteTransaction<Configuration> confTx, Uint64 dpnId,
+ Uint32 routerId) throws ExecutionException, InterruptedException {
LOG.info("installInboundEntry : dpId {} and routerId {}", dpnId, routerId);
String flowRef = getFlowRef(dpnId, NwConstants.INBOUND_NAPT_TABLE, routerId) + "OUTBOUND";
- removeFlow(confTx, dpnId, NwConstants.INBOUND_NAPT_TABLE, flowRef);
+ NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.INBOUND_NAPT_TABLE, flowRef);
}
- protected void addNaptPfibEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId, long routerId) {
+ protected void addNaptPfibEntry(TypedWriteTransaction<Configuration> confTx, Uint64 dpnId, Uint32 routerId) {
LOG.info("installNaptPfibEntry : called for dpnId {} and routerId {} ", dpnId, routerId);
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new NxMatchCtState(DNAT_CT_STATE, DNAT_CT_STATE_MASK));
- matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
+ matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId.longValue()),
+ MetaDataUtil.METADATA_MASK_VRFID));
ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
- listActionInfo.add(new ActionNxLoadInPort(BigInteger.ZERO));
+ listActionInfo.add(new ActionNxLoadInPort(Uint64.valueOf(BigInteger.ZERO)));
listActionInfo.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
instructionInfo.add(new InstructionApplyActions(listActionInfo));
String flowRef = getFlowRef(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId) + "INBOUND";
- addFlow(confTx, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef, NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef,
- NwConstants.COOKIE_SNAT_TABLE, matches, instructionInfo);
+ NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef,
+ NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches,
+ instructionInfo);
}
- protected void removeNaptPfibEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
- long routerId) {
+ protected void removeNaptPfibEntry(TypedReadWriteTransaction<Configuration> confTx, Uint64 dpnId,
+ Uint32 routerId) throws ExecutionException, InterruptedException {
LOG.info("installNaptPfibEntry : called for dpnId {} and routerId {} ", dpnId, routerId);
String flowRef = getFlowRef(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId) + "INBOUND";
- removeFlow(confTx, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef);
+ NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef);
}
}