use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.Acl in project netvirt by opendaylight.
the class AclServiceUtils method allocateId.
public static Integer allocateId(IdManagerService idManager, String poolName, String idKey, Integer defaultId) {
AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
try {
Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
RpcResult<AllocateIdOutput> rpcResult = result.get();
if (rpcResult.isSuccessful()) {
Integer allocatedId = rpcResult.getResult().getIdValue().intValue();
LOG.debug("Allocated ACL ID: {} with key: {} into pool: {}", allocatedId, idKey, poolName);
return allocatedId;
} else {
LOG.error("RPC Call to Get Unique Id for key {} from pool {} returned with Errors {}", idKey, poolName, rpcResult.getErrors());
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Exception when getting Unique Id for key {} from pool {} ", idKey, poolName, e);
}
return defaultId;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.Acl in project netvirt by opendaylight.
the class AclServiceUtils method getHardTimoutForApplyStatefulChangeOnExistingTraffic.
/**
* Returns the hard timeout based on the protocol when a ACL rule removed from the instance.
* It will returns the timeout configured in the {@link AclserviceConfig} class.
*
* @param ace the ace
* @param aclServiceUtils acl service utils
* @return the hard time out
*/
public static Integer getHardTimoutForApplyStatefulChangeOnExistingTraffic(Ace ace, AclServiceUtils aclServiceUtils) {
int hardTimeout = AclConstants.SECURITY_GROUP_ICMP_IDLE_TIME_OUT;
Matches matches = ace.getMatches();
AceIp acl = (AceIp) matches.getAceType();
Short protocol = acl.getProtocol();
if (protocol == null) {
return hardTimeout;
} else if (protocol == NwConstants.IP_PROT_TCP) {
hardTimeout = aclServiceUtils.getConfig().getSecurityGroupTcpIdleTimeout();
} else if (protocol == NwConstants.IP_PROT_UDP) {
hardTimeout = aclServiceUtils.getConfig().getSecurityGroupUdpIdleTimeout();
}
return hardTimeout;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.Acl 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 in project netvirt by opendaylight.
the class AclServiceUtils method getRemoteAclIdsByDirection.
public Set<Uuid> getRemoteAclIdsByDirection(List<Uuid> aclIds, Class<? extends DirectionBase> direction) {
Set<Uuid> remoteAclIds = new HashSet<>();
if (aclIds == null || aclIds.isEmpty()) {
return remoteAclIds;
}
for (Uuid aclId : aclIds) {
Acl acl = this.aclDataUtil.getAcl(aclId.getValue());
if (null == acl) {
LOG.warn("ACL {} not found in cache.", aclId.getValue());
continue;
}
remoteAclIds.addAll(getRemoteAclIdsByDirection(acl, direction));
}
return remoteAclIds;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.Acl in project netvirt by opendaylight.
the class AclLiveStatisticsRpcServiceTest method setUp.
@Before
public void setUp() throws Exception {
aclStatsService = new AclLiveStatisticsRpcServiceImpl(config, dataBroker, odlDirectStatsService);
singleTransactionDataBroker = new SingleTransactionDataBroker(dataBroker);
LOG.info("Acl mode: {}", config.getSecurityGroupMode());
newElan(ELAN, ELAN_TAG);
newElanInterface(ELAN, PORT_1, true);
Pair<DataTreeIdentifier<Interface>, Interface> port1 = new IdentifiedInterfaceWithAclBuilder().interfaceName(PORT_1).portSecurity(true).build();
dataBrokerUtil.put(port1);
testInterfaceManager.addInterface(port1.getValue());
putNewStateInterface(dataBroker, "port1", PORT_MAC_1);
asyncEventsWaiter.awaitEventsConsumption();
}
Aggregations