import java.util.List;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.groupbasedpolicy.renderer.vpp.policy.acl.AccessListUtil.ACE_DIRECTION;
import org.opendaylight.groupbasedpolicy.renderer.vpp.util.GbpNetconfTransaction;
import org.opendaylight.groupbasedpolicy.renderer.vpp.util.VppIidFactory;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.Ace;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.VppAcl;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.VppAcl;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
rules = new ArrayList<>();
}
- public void writeRule(GbpAceBuilder rule) {
+ public void writeRule(@Nullable GbpAceBuilder rule) {
if (rule != null) {
this.rules.add(rule);
}
}
- public void writeRules(List<GbpAceBuilder> rules) {
+ public void writeRules(@Nullable List<GbpAceBuilder> rules) {
if (rules != null) {
rules.forEach(this::writeRule);
}
public abstract AccessListUtil.ACE_DIRECTION getDirection();
- public abstract void writeAclRefOnIface(@Nonnull DataBroker mountPoint,
+ public abstract void writeAclRefOnIface(@Nonnull InstanceIdentifier<Node> vppIid,
@Nonnull InstanceIdentifier<Interface> ifaceIid);
public Acl buildVppAcl(@Nonnull InterfaceKey ifaceKey) {
.build();
}
- public void writeAcl(@Nonnull DataBroker mountPoint, @Nonnull InterfaceKey ifaceKey) {
+ public void writeAcl(@Nonnull InstanceIdentifier<Node> vppIid, @Nonnull InterfaceKey ifaceKey) {
Acl builtAcl = this.buildVppAcl(ifaceKey);
LOG.trace("Writing access-list {}", builtAcl.getAclName());
- boolean write = GbpNetconfTransaction.netconfSyncedWrite(mountPoint,
+ boolean write = GbpNetconfTransaction.netconfSyncedWrite(vppIid,
VppIidFactory.getVppAcl(resolveAclName(ifaceKey)), builtAcl, GbpNetconfTransaction.RETRY_COUNT);
if (!write) {
LOG.error("Failed to write rule {}", builtAcl);
}
}
- public static void removeAclsForInterface(@Nonnull DataBroker mountPoint, @Nonnull InterfaceKey ifaceKey) {
+ public static void removeAclsForInterface(@Nonnull InstanceIdentifier<Node> vppIid,
+ @Nonnull InterfaceKey ifaceKey) {
LOG.debug("Removing access-list {}", ifaceKey);
for (ACE_DIRECTION dir : new ACE_DIRECTION[] {ACE_DIRECTION.INGRESS, ACE_DIRECTION.EGRESS}) {
- GbpNetconfTransaction.netconfSyncedDelete(mountPoint,
- VppIidFactory.getVppAcl(ifaceKey.getName() + dir), GbpNetconfTransaction.RETRY_COUNT);
+ GbpNetconfTransaction.netconfSyncedDelete(vppIid, VppIidFactory.getVppAcl(ifaceKey.getName() + dir),
+ GbpNetconfTransaction.RETRY_COUNT);
}
}
- public static void removeAclRefFromIface(@Nonnull DataBroker mountPoint, @Nonnull InterfaceKey ifaceKey) {
+ public static void removeAclRefFromIface(@Nonnull InstanceIdentifier<Node> vppIid, @Nonnull InterfaceKey ifaceKey) {
LOG.debug("Removing access-lists from interface {}", ifaceKey.getName());
- GbpNetconfTransaction.netconfSyncedDelete(mountPoint,
+ GbpNetconfTransaction.netconfSyncedDelete(vppIid,
VppIidFactory.getAclInterfaceRef(VppIidFactory.getInterfaceIID(ifaceKey)),
GbpNetconfTransaction.RETRY_COUNT);
}