import javax.annotation.Nullable;\r
\r
import org.apache.commons.net.util.SubnetUtils;\r
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;\r
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;\r
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;\r
import org.opendaylight.groupbasedpolicy.renderer.vpp.util.VppIidFactory;\r
import org.opendaylight.groupbasedpolicy.util.DataStoreHelper;\r
import org.opendaylight.groupbasedpolicy.util.NetUtils;\r
+import org.opendaylight.vbd.impl.transaction.VbdNetconfTransaction;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;\r
wTx.put(LogicalDatastoreType.CONFIGURATION, natIid, nat);\r
}\r
\r
- public static void setOutboundInterface(Interface iface, DataBroker dataBroker) {\r
+ public static void setOutboundInterface(Interface iface, InstanceIdentifier<Node> vppIid) {\r
InstanceIdentifier<Nat> natIid = buildNatIid(VppIidFactory.getInterfaceIID(iface.getKey()));\r
Nat nat = new NatBuilder().setOutbound(new OutboundBuilder().build()).build();\r
- GbpNetconfTransaction.netconfSyncedWrite(dataBroker, natIid, nat, GbpNetconfTransaction.RETRY_COUNT);\r
+ GbpNetconfTransaction.netconfSyncedWrite(vppIid, natIid, nat, GbpNetconfTransaction.RETRY_COUNT);\r
\r
}\r
\r
- public static void unsetOutboundInterface(Interface iface, DataBroker dataBroker) {\r
+ public static void unsetOutboundInterface(Interface iface, InstanceIdentifier<Node> vppIid) {\r
InstanceIdentifier<Nat> natIid = buildNatIid(VppIidFactory.getInterfaceIID(iface.getKey()));\r
- GbpNetconfTransaction.netconfSyncedDelete(dataBroker, natIid, GbpNetconfTransaction.RETRY_COUNT);\r
+ GbpNetconfTransaction.netconfSyncedDelete(vppIid, natIid, GbpNetconfTransaction.RETRY_COUNT);\r
}\r
\r
public static InstanceIdentifier<Nat> buildNatIid(InstanceIdentifier<Interface> ifaceIid) {\r
return extCache;\r
}\r
\r
- public static void resolveOutboundNatInterface(DataBroker mountpoint, InstanceIdentifier<Node> mountPointIid,\r
+ public static void resolveOutboundNatInterface(InstanceIdentifier<Node> mountPointIid,\r
NodeId nodeId, Map<NodeId, PhysicalInterfaceKey> extInterfaces) {\r
if (extInterfaces.containsKey(nodeId)){\r
PhysicalInterfaceKey physicalInterfaceKey = extInterfaces.get(nodeId);\r
Optional<Interfaces> readIfaces = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION,\r
- InstanceIdentifier.create(Interfaces.class), mountpoint.newReadOnlyTransaction());\r
+ InstanceIdentifier.create(Interfaces.class),\r
+ VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(mountPointIid).getKey().newReadOnlyTransaction());\r
if(readIfaces.isPresent() ) {\r
for (Interface nodeInterface : readIfaces.get().getInterface()) {\r
if (nodeInterface.getName().equals(physicalInterfaceKey.getInterfaceName())) {\r
LOG.trace("Setting outbound NAT on interface {} on node: {}", nodeInterface.getName(), mountPointIid);\r
- NatUtil.setOutboundInterface(nodeInterface, mountpoint);\r
+ NatUtil.setOutboundInterface(nodeInterface, mountPointIid);\r
}\r
}\r
\r