use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace in project netvirt by opendaylight.
the class AclServiceUtils method getRemoteAclIdsByDirection.
public static Set<Uuid> getRemoteAclIdsByDirection(Acl acl, Class<? extends DirectionBase> direction) {
Set<Uuid> remoteAclIds = new HashSet<>();
AccessListEntries accessListEntries = acl.getAccessListEntries();
if (accessListEntries != null && accessListEntries.getAce() != null) {
for (Ace ace : accessListEntries.getAce()) {
SecurityRuleAttr aceAttr = AclServiceUtils.getAccesssListAttributes(ace);
if (aceAttr.getDirection().equals(direction) && doesAceHaveRemoteGroupId(aceAttr)) {
remoteAclIds.add(aceAttr.getRemoteGroupId());
}
}
}
return remoteAclIds;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace in project netvirt by opendaylight.
the class AclEventListener method getChangedAceList.
private List<Ace> getChangedAceList(Acl updatedAcl, Acl currentAcl) {
if (updatedAcl == null) {
return null;
}
List<Ace> updatedAceList = updatedAcl.getAccessListEntries() == null ? new ArrayList<>() : new ArrayList<>(updatedAcl.getAccessListEntries().getAce());
if (currentAcl == null) {
return updatedAceList;
}
List<Ace> currentAceList = currentAcl.getAccessListEntries() == null ? new ArrayList<>() : new ArrayList<>(currentAcl.getAccessListEntries().getAce());
for (Iterator<Ace> iterator = updatedAceList.iterator(); iterator.hasNext(); ) {
Ace ace1 = iterator.next();
for (Ace ace2 : currentAceList) {
if (ace1.getRuleName().equals(ace2.getRuleName())) {
iterator.remove();
}
}
}
return updatedAceList;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace in project netvirt by opendaylight.
the class AbstractAclServiceImpl method programAclForExistingTrafficTable.
private void programAclForExistingTrafficTable(AclInterface port, Ace ace, int addOrRemove, String flowName, List<MatchInfoBase> matches, Integer priority) {
AceIp acl = (AceIp) ace.getMatches().getAceType();
final String newFlowName = flowName + this.directionString + "_" + port.getDpId() + "_" + port.getLPortTag() + "_" + ((acl.getAceIpVersion() instanceof AceIpv4) ? "_IPv4" : "_IPv6") + "_FlowAfterRuleDeleted";
final List<MatchInfoBase> newMatches = matches.stream().filter(obj -> !(obj instanceof NxMatchCtState || obj instanceof MatchMetadata)).collect(Collectors.toList());
newMatches.add(AclServiceUtils.buildLPortTagMatch(port.getLPortTag(), serviceMode));
newMatches.add(new NxMatchCtState(AclConstants.TRACKED_RPL_CT_STATE, AclConstants.TRACKED_RPL_CT_STATE_MASK));
List<InstructionInfo> instructions = AclServiceUtils.createCtMarkInstructionForNewState(getAclFilterCumDispatcherTable(), port.getElanId());
// Reversing the flow add/delete operation for this table.
int operation = (addOrRemove == NwConstants.ADD_FLOW) ? NwConstants.DEL_FLOW : NwConstants.ADD_FLOW;
syncFlow(port.getDpId(), getAclForExistingTrafficTable(), newFlowName, priority, "ACL", 0, AclServiceUtils.getHardTimoutForApplyStatefulChangeOnExistingTraffic(ace, aclServiceUtils), AclConstants.COOKIE_ACL_BASE, newMatches, instructions, operation);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace in project netvirt by opendaylight.
the class NeutronSecurityRuleListener method add.
@Override
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
protected void add(InstanceIdentifier<SecurityRule> instanceIdentifier, SecurityRule securityRule) {
LOG.trace("added securityRule: {}", securityRule);
try {
Ace ace = toAceBuilder(securityRule).build();
InstanceIdentifier<Ace> identifier = getAceInstanceIdentifier(securityRule);
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, identifier, ace);
} catch (Exception ex) {
LOG.error("Exception occured while adding acl for security rule: {}. ", securityRule, ex);
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace in project netvirt by opendaylight.
the class PolicyAceChangeListener method update.
@Override
protected void update(InstanceIdentifier<Ace> identifier, Ace origAce, Ace updatedAce) {
AclKey aclKey = identifier.firstKeyOf(Acl.class);
handlePolicyAceUpdate(aclKey, origAce, false);
handlePolicyAceUpdate(aclKey, updatedAce, true);
}
Aggregations