2 * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netvirt.natservice.internal;
10 import static org.opendaylight.netvirt.natservice.internal.NatUtil.requireNonNullElse;
12 import com.google.common.base.Optional;
13 import java.math.BigInteger;
14 import java.util.ArrayList;
15 import java.util.Collections;
16 import java.util.List;
17 import java.util.concurrent.ExecutionException;
18 import org.apache.commons.lang3.tuple.ImmutablePair;
19 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
20 import org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar;
21 import org.opendaylight.genius.infra.Datastore.Configuration;
22 import org.opendaylight.genius.infra.TypedReadWriteTransaction;
23 import org.opendaylight.genius.infra.TypedWriteTransaction;
24 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
25 import org.opendaylight.genius.mdsalutil.ActionInfo;
26 import org.opendaylight.genius.mdsalutil.InstructionInfo;
27 import org.opendaylight.genius.mdsalutil.MatchInfo;
28 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
29 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
30 import org.opendaylight.genius.mdsalutil.NWUtil;
31 import org.opendaylight.genius.mdsalutil.NwConstants;
32 import org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack;
33 import org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack.NxCtAction;
34 import org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear;
35 import org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort;
36 import org.opendaylight.genius.mdsalutil.actions.ActionNxLoadMetadata;
37 import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
38 import org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetSource;
39 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
40 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
41 import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
42 import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination;
43 import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
44 import org.opendaylight.genius.mdsalutil.nxmatches.NxMatchCtState;
45 import org.opendaylight.netvirt.fibmanager.api.IFibManager;
46 import org.opendaylight.netvirt.natservice.ha.NatDataUtil;
47 import org.opendaylight.netvirt.vpnmanager.api.IVpnFootprintService;
48 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpn.to.dpn.list.IpAddresses;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.subnets.Subnets;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddressBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatFlags;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatRangePresent;
59 import org.slf4j.Logger;
60 import org.slf4j.LoggerFactory;
62 public abstract class ConntrackBasedSnatService extends AbstractSnatService {
63 private static final Logger LOG = LoggerFactory.getLogger(ConntrackBasedSnatService.class);
65 protected static final int TRACKED_NEW_CT_STATE = 0x21;
66 protected static final int TRACKED_NEW_CT_MASK = 0x21;
67 protected static final int SNAT_CT_STATE = 0x40;
68 protected static final int SNAT_CT_STATE_MASK = 0x40;
69 protected static final int DNAT_CT_STATE = 0x80;
70 protected static final int DNAT_CT_STATE_MASK = 0x80;
72 public ConntrackBasedSnatService(DataBroker dataBroker, IMdsalApiManager mdsalManager, ItmRpcService itmManager,
73 IdManagerService idManager, NAPTSwitchSelector naptSwitchSelector,
74 OdlInterfaceRpcService odlInterfaceRpcService,
75 IInterfaceManager interfaceManager, IVpnFootprintService vpnFootprintService,
76 IFibManager fibManager, NatDataUtil natDataUtil,
77 DataTreeEventCallbackRegistrar eventCallbacks) {
78 super(dataBroker, mdsalManager, itmManager, odlInterfaceRpcService, idManager, naptSwitchSelector,
79 interfaceManager, vpnFootprintService, fibManager, natDataUtil, eventCallbacks);
83 protected void addSnatSpecificEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
84 Routers routers, BigInteger dpnId) {
85 LOG.info("installSnatSpecificEntriesForNaptSwitch: called for router {}",
86 routers.getRouterName());
87 String routerName = routers.getRouterName();
88 Long routerId = NatUtil.getVpnId(confTx, routerName);
89 int elanId = NatUtil.getElanInstanceByName(confTx, routers.getNetworkId().getValue())
90 .getElanTag().intValue();
91 if (routerId == NatConstants.INVALID_ID) {
92 LOG.error("InvalidRouterId: unable to installSnatSpecificEntriesForNaptSwitch on dpn {}", dpnId);
95 /* Install Outbound NAT entries */
97 addSnatMissEntryForPrimrySwch(confTx, dpnId, routerId, elanId);
99 String extGwMacAddress = NatUtil.getExtGwMacAddFromRouterName(confTx, routerName);
100 addOutboundTblTrackEntry(confTx, dpnId, routerId, extGwMacAddress);
101 for (ExternalIps externalIp : requireNonNullElse(routers.getExternalIps(),
102 Collections.<ExternalIps>emptyList())) {
103 if (!NWUtil.isIpv4Address(externalIp.getIpAddress())) {
104 // In this class we handle only IPv4 use-cases.
107 //The logic now handle only one external IP per router, others if present will be ignored.
108 long extSubnetId = NatUtil.getExternalSubnetVpnId(confTx, externalIp.getSubnetId());
109 addOutboundTblEntry(confTx, dpnId, routerId, externalIp.getIpAddress(), elanId, extGwMacAddress);
110 addNaptPfibFlow(confTx, routers, dpnId, routerId, extSubnetId);
112 //Install Inbound NAT entries
113 addInboundEntry(confTx, dpnId, routerId, externalIp.getIpAddress(), elanId, extSubnetId);
114 addNaptPfibEntry(confTx, dpnId, routerId);
116 String fibExternalIp = NatUtil.validateAndAddNetworkMask(externalIp.getIpAddress());
117 Optional<Subnets> externalSubnet = NatUtil.getOptionalExternalSubnets(confTx, externalIp.getSubnetId());
118 if (externalSubnet.isPresent()) {
119 String externalVpn = externalIp.getSubnetId().getValue();
120 String vpnRd = NatUtil.getVpnRd(confTx, externalVpn);
121 vpnFootprintService.updateVpnToDpnMapping(dpnId, externalVpn, vpnRd, null /* interfaceName*/,
122 new ImmutablePair<>(IpAddresses.IpAddressSource.ExternalFixedIP, fibExternalIp),
130 protected void removeSnatSpecificEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
131 Routers routers, BigInteger dpnId) throws ExecutionException, InterruptedException {
132 LOG.info("installSnatSpecificEntriesForNaptSwitch: called for router {}",
133 routers.getRouterName());
134 String routerName = routers.getRouterName();
135 Long routerId = NatUtil.getVpnId(confTx, routerName);
136 if (routerId == NatConstants.INVALID_ID) {
137 LOG.error("InvalidRouterId: unable to installSnatSpecificEntriesForNaptSwitch on dpn {}", dpnId);
140 /* Remove Outbound NAT entries */
142 removeSnatMissEntryForPrimrySwch(confTx, dpnId, routerId);
144 removeOutboundTblTrackEntry(confTx, dpnId, routerId);
145 for (ExternalIps externalIp : requireNonNullElse(routers.getExternalIps(),
146 Collections.<ExternalIps>emptyList())) {
147 if (!NWUtil.isIpv4Address(externalIp.getIpAddress())) {
148 // In this class we handle only IPv4 use-cases.
151 //The logic now handle only one external IP per router, others if present will be ignored.
152 removeOutboundTblEntry(confTx, dpnId, routerId);
153 removeNaptPfibFlow(confTx, routers, dpnId, routerId);
155 //Install Inbound NAT entries
156 removeInboundEntry(confTx, dpnId, routerId);
157 removeNaptPfibEntry(confTx, dpnId, routerId);
159 String fibExternalIp = NatUtil.validateAndAddNetworkMask(externalIp.getIpAddress());
160 Optional<Subnets> externalSubnet = NatUtil.getOptionalExternalSubnets(confTx, externalIp.getSubnetId());
161 if (externalSubnet.isPresent()) {
162 String externalVpn = externalIp.getSubnetId().getValue();
163 String vpnRd = NatUtil.getVpnRd(confTx, externalVpn);
164 vpnFootprintService.updateVpnToDpnMapping(dpnId, externalVpn, vpnRd, null /* interfaceName*/,
165 new ImmutablePair<>(IpAddresses.IpAddressSource.ExternalFixedIP, fibExternalIp),
173 protected void addSnatSpecificEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
174 Routers routers, BigInteger dpnId) {
175 // Nothing to to do here
179 protected void removeSnatSpecificEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
180 Routers routers, BigInteger dpnId) {
181 // Nothing to to do here
184 protected void addSnatMissEntryForPrimrySwch(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId,
185 Long routerId, int elanId) {
186 LOG.info("installSnatSpecificEntriesForNaptSwitch : called for the primary NAPT switch dpnId {}", dpnId);
187 List<MatchInfo> matches = new ArrayList<>();
188 matches.add(MatchEthernetType.IPV4);
189 matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
190 List<InstructionInfo> instructions = new ArrayList<>();
191 List<ActionInfo> actionsInfos = new ArrayList<>();
192 List<NxCtAction> ctActionsList = new ArrayList<>();
193 NxCtAction nxCtAction = new ActionNxConntrack.NxNat(0, 0, 0,null, null,0, 0);
194 ctActionsList.add(nxCtAction);
195 ActionNxConntrack actionNxConntrack = new ActionNxConntrack(0, 0, elanId,
196 NwConstants.OUTBOUND_NAPT_TABLE,ctActionsList);
198 actionsInfos.add(actionNxConntrack);
199 instructions.add(new InstructionApplyActions(actionsInfos));
201 String flowRef = getFlowRef(dpnId, NwConstants.PSNAT_TABLE, routerId);
202 NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.PSNAT_TABLE, flowRef,
203 NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches,
207 protected void removeSnatMissEntryForPrimrySwch(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
208 Long routerId) throws ExecutionException, InterruptedException {
209 LOG.info("installSnatSpecificEntriesForNaptSwitch : called for the primary NAPT switch dpnId {}", dpnId);
211 String flowRef = getFlowRef(dpnId, NwConstants.PSNAT_TABLE, routerId);
212 NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.PSNAT_TABLE, flowRef);
215 protected void addOutboundTblTrackEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId,
216 Long routerId, String extGwMacAddress) {
217 LOG.info("createOutboundTblTrackEntry : called for switch {}, routerId {}", dpnId, routerId);
218 List<MatchInfoBase> matches = new ArrayList<>();
219 matches.add(MatchEthernetType.IPV4);
220 matches.add(new NxMatchCtState(SNAT_CT_STATE, SNAT_CT_STATE_MASK));
221 matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
222 ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
223 listActionInfo.add(new ActionSetFieldEthernetSource(new MacAddress(extGwMacAddress)));
224 ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
225 listActionInfo.add(new ActionNxResubmit(NwConstants.NAPT_PFIB_TABLE));
226 instructionInfo.add(new InstructionApplyActions(listActionInfo));
228 String flowRef = getFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId) + "trkest";
229 NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef,
230 NatConstants.SNAT_TRK_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches,
234 protected void removeOutboundTblTrackEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
235 Long routerId) throws ExecutionException, InterruptedException {
236 LOG.info("createOutboundTblTrackEntry : called for switch {}, routerId {}", dpnId, routerId);
238 String flowRef = getFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId) + "trkest";
239 NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef);
242 protected void addOutboundTblEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId, long routerId,
243 String externalIp, int elanId, String extGwMacAddress) {
244 LOG.info("createOutboundTblEntry : dpId {} and routerId {}", dpnId, routerId);
245 List<MatchInfoBase> matches = new ArrayList<>();
246 matches.add(MatchEthernetType.IPV4);
247 matches.add(new NxMatchCtState(TRACKED_NEW_CT_STATE, TRACKED_NEW_CT_MASK));
248 matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
249 List<ActionInfo> actionsInfos = new ArrayList<>();
250 actionsInfos.add(new ActionSetFieldEthernetSource(new MacAddress(extGwMacAddress)));
251 List<NxCtAction> ctActionsListCommit = new ArrayList<>();
252 int rangePresent = NxActionNatRangePresent.NXNATRANGEIPV4MIN.getIntValue();
253 int flags = NxActionNatFlags.NXNATFSRC.getIntValue();
254 NxCtAction nxCtActionCommit = new ActionNxConntrack.NxNat(0, flags, rangePresent,
255 IpPrefixOrAddressBuilder.getDefaultInstance(externalIp).getIpAddress(), null,0, 0);
256 ctActionsListCommit.add(nxCtActionCommit);
257 int ctCommitFlag = 1;
258 ActionNxConntrack actionNxConntrackSubmit = new ActionNxConntrack(ctCommitFlag, 0, elanId,
259 NwConstants.NAPT_PFIB_TABLE, ctActionsListCommit);
260 actionsInfos.add(actionNxConntrackSubmit);
261 List<InstructionInfo> instructions = new ArrayList<>();
262 instructions.add(new InstructionApplyActions(actionsInfos));
263 String flowRef = getFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
264 NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef,
265 NatConstants.SNAT_NEW_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
268 protected void removeOutboundTblEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
269 long routerId) throws ExecutionException, InterruptedException {
270 LOG.info("createOutboundTblEntry : dpId {} and routerId {}", dpnId, routerId);
271 String flowRef = getFlowRef(dpnId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
272 NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef);
275 protected void addNaptPfibFlow(TypedReadWriteTransaction<Configuration> confTx, Routers routers, BigInteger dpnId,
276 long routerId, long extSubnetId) {
277 Long extNetId = NatUtil.getVpnId(confTx, routers.getNetworkId().getValue());
278 LOG.info("installNaptPfibFlow : dpId {}, extNetId {}", dpnId, extNetId);
279 List<MatchInfoBase> matches = new ArrayList<>();
280 matches.add(MatchEthernetType.IPV4);
281 matches.add(new NxMatchCtState(SNAT_CT_STATE, SNAT_CT_STATE_MASK));
282 matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
283 List<ActionInfo> listActionInfo = new ArrayList<>();
284 if (extSubnetId == NatConstants.INVALID_ID) {
285 LOG.error("installNaptPfibFlow : external subnet id is invalid.");
288 ActionNxLoadMetadata actionLoadMeta = new ActionNxLoadMetadata(MetaDataUtil
289 .getVpnIdMetadata(extSubnetId), LOAD_START, LOAD_END);
290 listActionInfo.add(actionLoadMeta);
291 listActionInfo.add(new ActionNxLoadInPort(BigInteger.ZERO));
292 listActionInfo.add(new ActionNxCtClear());
293 listActionInfo.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
294 ArrayList<InstructionInfo> instructions = new ArrayList<>();
295 instructions.add(new InstructionApplyActions(listActionInfo));
296 String flowRef = getFlowRef(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId);
297 flowRef = flowRef + "OUTBOUND";
298 NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef,
299 NatConstants.SNAT_TRK_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
302 protected void removeNaptPfibFlow(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
303 BigInteger dpnId, long routerId) throws ExecutionException, InterruptedException {
304 Long extNetId = NatUtil.getVpnId(confTx, routers.getNetworkId().getValue());
305 LOG.info("installNaptPfibFlow : dpId {}, extNetId {}", dpnId, extNetId);
306 String flowRef = getFlowRef(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId) + "OUTBOUND";
307 NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef);
310 protected void addInboundEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId, long routerId,
311 String externalIp, int elanId, long extSubnetId) {
312 LOG.info("installInboundEntry : dpId {} and routerId {}", dpnId, routerId);
313 List<MatchInfoBase> matches = new ArrayList<>();
314 matches.add(MatchEthernetType.IPV4);
315 matches.add(new MatchIpv4Destination(externalIp,"32"));
316 if (extSubnetId == NatConstants.INVALID_ID) {
317 LOG.error("installInboundEntry : external subnet id is invalid.");
320 matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(extSubnetId),
321 MetaDataUtil.METADATA_MASK_VRFID));
322 List<ActionInfo> actionsInfos = new ArrayList<>();
323 List<NxCtAction> ctActionsList = new ArrayList<>();
324 NxCtAction nxCtAction = new ActionNxConntrack.NxNat(0, 0, 0,null, null,0, 0);
325 ActionNxLoadMetadata actionLoadMeta = new ActionNxLoadMetadata(MetaDataUtil
326 .getVpnIdMetadata(routerId), LOAD_START, LOAD_END);
327 actionsInfos.add(actionLoadMeta);
328 ctActionsList.add(nxCtAction);
329 ActionNxConntrack actionNxConntrack = new ActionNxConntrack(0, 0, elanId, NwConstants
330 .NAPT_PFIB_TABLE,ctActionsList);
332 actionsInfos.add(actionNxConntrack);
333 List<InstructionInfo> instructions = new ArrayList<>();
334 instructions.add(new InstructionApplyActions(actionsInfos));
335 String flowRef = getFlowRef(dpnId, NwConstants.INBOUND_NAPT_TABLE, routerId);
336 flowRef = flowRef + "OUTBOUND";
337 NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.INBOUND_NAPT_TABLE, flowRef,
338 NatConstants.DEFAULT_TS_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
341 protected void removeInboundEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
342 long routerId) throws ExecutionException, InterruptedException {
343 LOG.info("installInboundEntry : dpId {} and routerId {}", dpnId, routerId);
345 String flowRef = getFlowRef(dpnId, NwConstants.INBOUND_NAPT_TABLE, routerId) + "OUTBOUND";
346 NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.INBOUND_NAPT_TABLE, flowRef);
349 protected void addNaptPfibEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId, long routerId) {
350 LOG.info("installNaptPfibEntry : called for dpnId {} and routerId {} ", dpnId, routerId);
351 List<MatchInfoBase> matches = new ArrayList<>();
352 matches.add(MatchEthernetType.IPV4);
353 matches.add(new NxMatchCtState(DNAT_CT_STATE, DNAT_CT_STATE_MASK));
354 matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
356 ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
357 ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
358 listActionInfo.add(new ActionNxLoadInPort(BigInteger.ZERO));
359 listActionInfo.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
360 instructionInfo.add(new InstructionApplyActions(listActionInfo));
362 String flowRef = getFlowRef(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId) + "INBOUND";
363 NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef,
364 NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches,
368 protected void removeNaptPfibEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
369 long routerId) throws ExecutionException, InterruptedException {
370 LOG.info("installNaptPfibEntry : called for dpnId {} and routerId {} ", dpnId, routerId);
371 String flowRef = getFlowRef(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId) + "INBOUND";
372 NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef);