@Nonnull @Override public List<AclKey> getAllIds(@Nonnull final InstanceIdentifier<Acl> id, @Nonnull final ReadContext context) throws ReadFailedException { final List<AclKey> keys = new ArrayList<>(); final Optional<AclDetailsReplyDump> vppAclDump = vppAclDumpManager.getDump(id, context.getModificationCache(), READ_ALL); if (vppAclDump.isPresent()) { vppAclDump.get().aclDetails.stream() .map(details -> standardAclContext.getAclName(details.aclIndex, context.getMappingContext())) .forEach(name -> keys.add(new AclKey(name, VppAcl.class))); } final Optional<MacipAclDetailsReplyDump> macipAclDump = macipAclDumpManager.getDump(id, context.getModificationCache(), READ_ALL); if (macipAclDump.isPresent()) { macipAclDump.get().macipAclDetails.stream() .map(details -> macipAclContext.getAclName(details.aclIndex, context.getMappingContext())) .forEach(name -> keys.add(new AclKey(name, VppMacipAcl.class))); } return keys; }
private static Stream<Ace> aclToAceStream(@Nonnull final Acl assignedAcl, @Nonnull final WriteContext writeContext) { final String aclName = assignedAcl.getName(); final Class<? extends AclBase> aclType = assignedAcl.getType(); // ietf-acl updates are handled first, so we use writeContext.readAfter final Optional<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl> aclOptional = writeContext.readAfter(AclWriter.ACL_ID.child( org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl.class, new AclKey(aclName, aclType))); checkArgument(aclOptional.isPresent(), "Acl lists not configured"); final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl acl = aclOptional.get(); final AccessListEntries accessListEntries = acl.getAccessListEntries(); checkArgument(accessListEntries != null, "access list entries not configured"); return accessListEntries.getAce().stream(); }
private AclImpl(AclBuilder base) { if (base.getKey() == null) { this._key = new AclKey( base.getAclName(), base.getAclType() ); this._aclName = base.getAclName(); this._aclType = base.getAclType(); } else { this._key = base.getKey(); this._aclName = _key.getAclName(); this._aclType = _key.getAclType(); } this._accessListEntries = base.getAccessListEntries(); this._aclOperData = base.getAclOperData(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl>>, Augmentation<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public AclBuilder(Acl base) { if (base.getKey() == null) { this._key = new AclKey( base.getAclName(), base.getAclType() ); this._aclName = base.getAclName(); this._aclType = base.getAclType(); } else { this._key = base.getKey(); this._aclName = _key.getAclName(); this._aclType = _key.getAclType(); } this._accessListEntries = base.getAccessListEntries(); this._aclOperData = base.getAclOperData(); if (base instanceof AclImpl) { AclImpl impl = (AclImpl) 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> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
public AclBuilder(Acl base) { if (base.key() == null) { this.key = new AclKey( base.getAclName(), base.getAclType() ); this._aclName = base.getAclName(); this._aclType = base.getAclType(); } else { this.key = base.key(); this._aclName = key.getAclName(); this._aclType = key.getAclType(); } this._accessListEntries = base.getAccessListEntries(); this._aclOperData = base.getAclOperData(); if (base instanceof AclImpl) { AclImpl impl = (AclImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<Acl> casted =(AugmentationHolder<Acl>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
private AclImpl(AclBuilder base) { if (base.key() == null) { this.key = new AclKey( base.getAclName(), base.getAclType() ); this._aclName = base.getAclName(); this._aclType = base.getAclType(); } else { this.key = base.key(); this._aclName = key.getAclName(); this._aclType = key.getAclType(); } this._accessListEntries = base.getAccessListEntries(); this._aclOperData = base.getAclOperData(); this.augmentation = ImmutableMap.copyOf(base.augmentation); }