@Override public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataBefore, @Nonnull final L2 dataAfter, @Nonnull final WriteContext writeContext) throws WriteFailedException { final String subInterfaceName = getSubInterfaceName(id); final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext()); // TODO handle update properly (if possible) setL2(id, subInterfaceIndex, subInterfaceName, dataAfter, writeContext); }
@Override public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataAfter, @Nonnull final WriteContext writeContext) throws WriteFailedException { final String subInterfaceName = getSubInterfaceName(id); final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext()); setL2(id, subInterfaceIndex, subInterfaceName, dataAfter, writeContext); }
@Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<IetfAcl> id, @Nonnull final IetfAcl dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { final String subInterfaceName = getSubInterfaceName(id); final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext()); LOG.debug("Removing ACLs for sub-interface={}(id={}): {}", subInterfaceName, subInterfaceIndex, dataBefore); aclWriter.deleteAcl(id, subInterfaceIndex); } }
@Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { final String subInterfaceName = getSubInterfaceName(id); final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext()); deleteL2(id, subInterfaceIndex, subInterfaceName, dataBefore, writeContext); }
@Override public void readCurrentAttributes(@Nonnull InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight .params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.ProxyArp> id, @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po .rev150105.interfaces.state._interface.ProxyArpBuilder builder, @Nonnull ReadContext ctx) throws ReadFailedException { //TODO: Implement fully when VPP Proxy ARP read API is available // https://jira.fd.io/browse/VPP-225 final InterfaceKey key = id.firstKeyOf(Interface.class); final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext()); LOG.warn("Reading of ARP data not (yet) supported by VPP API"); } }
@Override public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataBefore, @Nonnull final L2 dataAfter, @Nonnull final WriteContext writeContext) throws WriteFailedException { final String ifcName = id.firstKeyOf(Interface.class).getName(); final int swIfc = interfaceContext.getIndex(ifcName, writeContext.getMappingContext()); // TODO handle update properly (if possible) setL2(id, swIfc, ifcName, dataAfter, writeContext); }
@Override public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataAfter, @Nonnull final WriteContext writeContext) throws WriteFailedException { final String ifcName = id.firstKeyOf(Interface.class).getName(); final int swIfc = interfaceContext.getIndex(ifcName, writeContext.getMappingContext()); setL2(id, swIfc, ifcName, dataAfter, writeContext); }
@Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<L2> id, @Nonnull final L2 dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { final String ifcName = id.firstKeyOf(Interface.class).getName(); final int swIfc = interfaceContext.getIndex(ifcName, writeContext.getMappingContext()); deleteL2(id, swIfc, ifcName, dataBefore, writeContext); }
@Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<IetfAcl> id, @Nonnull final IetfAcl dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { final String ifName = id.firstKeyOf(Interface.class).getName(); final int ifIndex = interfaceContext.getIndex(ifName, writeContext.getMappingContext()); LOG.debug("Removing ACLs for interface={}(id={}): {}", ifName, ifIndex, dataBefore); aclWriter.deleteAcl(id, ifIndex); } }
private void setAcl(final boolean isAdd, @Nonnull final InstanceIdentifier<Acl> id, @Nonnull final Acl acl, @Nonnull final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException { final String ifName = id.firstKeyOf(Interface.class).getName(); final int ifIndex = interfaceContext.getIndex(ifName, writeContext.getMappingContext()); LOG.debug("Setting ACL(isAdd={}) on interface={}(id={}): {}", isAdd, ifName, ifIndex, acl); inputAclSetInterface(getFutureJVpp(), isAdd, id, acl, ifIndex, classifyTableContext, writeContext.getMappingContext()); LOG.debug("Successfully set ACL(isAdd={}) on interface={}(id={}): {}", isAdd, ifName, ifIndex, acl); } }
private void setTagRewrite(final InstanceIdentifier<Rewrite> id, final String ifname, final Rewrite rewrite, final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException { final int swIfIndex = interfaceContext.getIndex(ifname, writeContext.getMappingContext()); LOG.debug("Setting tag rewrite for interface {}(id=): {}", ifname, swIfIndex, rewrite); final CompletionStage<L2InterfaceVlanTagRewriteReply> replyCompletionStage = getFutureJVpp().l2InterfaceVlanTagRewrite(getTagRewriteRequest(swIfIndex, rewrite)); TranslateUtils.getReplyForWrite(replyCompletionStage.toCompletableFuture(), id); LOG.debug("Tag rewrite for interface {}(id=) set successfully: {}", ifname, swIfIndex, rewrite); }
@Override public List<AddressKey> getAllIds(@Nonnull InstanceIdentifier<Address> id, @Nonnull ReadContext ctx) throws ReadFailedException { LOG.debug("Reading list of keys for sub-interface addresses: {}", id); final String subInterfaceName = getSubInterfaceName(id); final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, ctx.getMappingContext()); final Optional<IpAddressDetailsReplyDump> dumpOptional = dumpAddresses(getFutureJVpp(), id, subInterfaceName, subInterfaceIndex, ctx); return getAllIpv4AddressIds(dumpOptional, AddressKey::new); }
private void modifyVhostUserIf(final InstanceIdentifier<VhostUser> id, final String swIfName, final VhostUser vhostUser, final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException { LOG.debug("Updating vhost user interface: name={}, vhostUser={}", swIfName, vhostUser); final CompletionStage<ModifyVhostUserIfReply> modifyVhostUserIfReplyCompletionStage = getFutureJVpp() .modifyVhostUserIf(getModifyVhostUserIfRequest(vhostUser, interfaceContext.getIndex(swIfName, writeContext.getMappingContext()))); TranslateUtils.getReplyForWrite(modifyVhostUserIfReplyCompletionStage.toCompletableFuture(), id); LOG.debug("Vhost user interface updated successfully for: {}, vhostUser: {}", swIfName, vhostUser); }
@Override public List<AddressKey> getAllIds(@Nonnull InstanceIdentifier<Address> id, @Nonnull ReadContext ctx) throws ReadFailedException { LOG.debug("Reading list of keys for interface addresses: {}", id); final String interfaceName = id.firstKeyOf(Interface.class).getName(); final int interfaceIndex = interfaceContext.getIndex(interfaceName, ctx.getMappingContext()); final Optional<IpAddressDetailsReplyDump> dumpOptional = dumpAddresses(getFutureJVpp(), id, interfaceName, interfaceIndex, ctx); return getAllIpv4AddressIds(dumpOptional, AddressKey::new); }
private void setInterfaceAttributes(final InstanceIdentifier<Interface> id, final Interface swIf, final String swIfName, final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException { setInterfaceFlags(id, swIfName, interfaceContext.getIndex(swIfName, writeContext.getMappingContext()), swIf.isEnabled() ? (byte) 1 : (byte) 0); }
private void bdIpMacAddDel(@Nonnull final InstanceIdentifier<ArpTerminationTableEntry> id, @Nonnull final ArpTerminationTableEntry entry, final WriteContext writeContext, boolean isAdd) throws VppBaseCallException, WriteTimeoutException { final String bdName = id.firstKeyOf(BridgeDomain.class).getName(); final int bdId = bdContext.getIndex(bdName, writeContext.getMappingContext()); final BdIpMacAddDel request = createRequest(entry, bdId, isAdd); LOG.debug("Sending l2FibAddDel request: {}", ReflectionToStringBuilder.toString(request)); final CompletionStage<BdIpMacAddDelReply> replyCompletionStage = getFutureJVpp().bdIpMacAddDel(request); TranslateUtils.getReplyForWrite(replyCompletionStage.toCompletableFuture(), id); }
private void setAcl(final boolean isAdd, @Nonnull final InstanceIdentifier<Acl> id, @Nonnull final Acl acl, @Nonnull final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException { final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class); final SubInterfaceKey subInterfacekey = id.firstKeyOf(SubInterface.class); final String subInterfaceName = SubInterfaceUtils .getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue()); final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext()); LOG.debug("Setting ACL(isAdd={}) on sub-interface={}(id={}): {}", isAdd, subInterfaceName, subInterfaceIndex, acl); inputAclSetInterface(getFutureJVpp(), isAdd, id, acl, subInterfaceIndex, classifyTableContext, writeContext.getMappingContext()); LOG.debug("Successfully set ACL(isAdd={}) on sub-interface={}(id={}): {}", isAdd, subInterfaceName, subInterfaceIndex, acl); } }
private void deleteVhostUserIf(final InstanceIdentifier<VhostUser> id, final String swIfName, final VhostUser vhostUser, final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException { LOG.debug("Deleting vhost user interface: name={}, vhostUser={}", swIfName, vhostUser); final CompletionStage<DeleteVhostUserIfReply> deleteVhostUserIfReplyCompletionStage = getFutureJVpp().deleteVhostUserIf(getDeleteVhostUserIfRequest(interfaceContext.getIndex(swIfName, writeContext.getMappingContext()))); TranslateUtils.getReplyForWrite(deleteVhostUserIfReplyCompletionStage.toCompletableFuture(), id); LOG.debug("Vhost user interface deleted successfully for: {}, vhostUser: {}", swIfName, vhostUser); // Remove interface from our interface context interfaceContext.removeName(swIfName, writeContext.getMappingContext()); }
@Override public void deleteCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, WriteContext writeContext) throws WriteFailedException { final String interfaceName = id.firstKeyOf(Interface.class).getName(); final int interfaceIndex = interfaceContext.getIndex(interfaceName, writeContext.getMappingContext()); setAddress(false, id, interfaceName, interfaceIndex, dataBefore, writeContext); }
private void createSubInterface(final InstanceIdentifier<SubInterface> id, @Nonnull final String superIfName, @Nonnull final SubInterface subInterface, final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException { final int superIfIndex = interfaceContext.getIndex(superIfName, writeContext.getMappingContext()); final CompletionStage<CreateSubifReply> createSubifReplyCompletionStage = getFutureJVpp().createSubif(getCreateSubifRequest(subInterface, superIfIndex)); final CreateSubifReply reply = TranslateUtils.getReplyForWrite(createSubifReplyCompletionStage.toCompletableFuture(), id); setInterfaceState(id, reply.swIfIndex, booleanToByte(subInterface.isEnabled())); interfaceContext.addName(reply.swIfIndex, getSubInterfaceName(superIfName, Math.toIntExact(subInterface.getIdentifier())), writeContext.getMappingContext()); LOG.debug("Sub interface created successfully for: {}, subInterface: {}", superIfName, subInterface); }