public ActionsBuilder(Actions base) { this._packetHandling = base.getPacketHandling(); if (base instanceof ActionsImpl) { ActionsImpl impl = (ActionsImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.Actions> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.Actions>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
public ActionsBuilder(Actions base) { this._packetHandling = base.getPacketHandling(); if (base instanceof ActionsImpl) { ActionsImpl impl = (ActionsImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<Actions> casted =(AugmentationHolder<Actions>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
default byte standardAction(@Nonnull final Ace ace) { // default == deny final PacketHandling action = Optional.ofNullable(ace.getActions()) .orElseThrow(() -> new IllegalArgumentException(String.format("Unable to extract Action from %s", ace))) .getPacketHandling(); return ACTION_VALUE_PAIRS.get(ACTION_VALUE_PAIRS.keySet().stream() .filter(aClass -> aClass.isInstance(action)) .findAny() .orElseThrow(() -> new IllegalArgumentException( String.format("Unsupported packet-handling action %s for ACE %s", action, ace.getRuleName())))).byteValue(); }
/** * Only 0 and 1 are allowed for mac-ip */ default byte macIpAction(@Nonnull final Ace ace) { // action choice itself has default, but nothing stops us from not defining actions container itself final PacketHandling action = Optional.ofNullable(ace.getActions()).orElseThrow( () -> new IllegalArgumentException(String.format("Unable to extract Action from %s", ace))) .getPacketHandling(); if (action instanceof Permit) { return 1; } else if (action instanceof Deny) { return 0; } else { throw new IllegalArgumentException( String.format("Unsupported packet-handling action %s for ACE %s", action, ace)); } }
if (!Objects.equals(_packetHandling, other.getPacketHandling())) { return false;
if (!Objects.equals(_packetHandling, other.getPacketHandling())) { return false;
ace.getActions() != null && ace.getActions().getPacketHandling() != null) .collect(Collectors.groupingBy(AclType::fromAce));
@Override public final void write(@Nonnull final InstanceIdentifier<?> id, @Nonnull final List<Ace> aces, @Nonnull final InputAclSetInterface request, @Nonnegative final int vlanTags) throws VppBaseCallException, WriteTimeoutException { final PacketHandling action = aces.stream().map(ace -> ace.getActions().getPacketHandling()).distinct() .collect(SINGLE_ITEM_COLLECTOR); checkArgument(vlanTags >= 0 && vlanTags <= 2, "Number of vlan tags %s is not in [0,2] range"); int nextTableIndex = -1; for (final Ace ace : aces) { // Create table + session per entry final ClassifyAddDelTable ctRequest = createClassifyTable(action, (T) ace.getMatches().getAceType(), nextTableIndex, vlanTags); nextTableIndex = createClassifyTable(id, ctRequest); createClassifySession(id, createClassifySession(action, (T) ace.getMatches().getAceType(), nextTableIndex, vlanTags)); } setClassifyTable(request, nextTableIndex); }