use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.Direction in project netvirt by opendaylight.
the class DisplayAclDataCaches method getRemoteAclIdMap.
protected void getRemoteAclIdMap(Class<? extends DirectionBase> direction) {
if (all == null && uuidStr == null) {
printRemoteAclIdMapHelp();
} else if (all == null) {
Uuid uuidRef;
try {
uuidRef = Uuid.getDefaultInstance(uuidStr);
} catch (IllegalArgumentException e) {
session.getConsole().println("Invalid uuid" + e.getMessage());
log.error("Invalid uuid", e);
return;
}
Collection<Uuid> remoteUuidLst = aclDataCache.getRemoteAcl(uuidRef, direction);
if (remoteUuidLst == null || remoteUuidLst.isEmpty()) {
session.getConsole().println("UUID not matched");
} else {
session.getConsole().println(REM_ID_HEAD);
session.getConsole().print(String.format(KEY_TAB, uuidRef.getValue()));
boolean first = true;
for (Uuid uuid : remoteUuidLst) {
if (first) {
session.getConsole().println(String.format(REM_ID_TAB, uuid.getValue()));
first = false;
} else {
session.getConsole().println(String.format(REM_ID_TAB_FOR, "", uuid.getValue()));
}
}
}
} else if (uuidStr == null) {
if (!validateAll()) {
printRemoteAclIdMapHelp();
return;
}
Map<Uuid, Collection<Uuid>> map = DirectionEgress.class.equals(direction) ? aclDataCache.getEgressRemoteAclIdMap() : aclDataCache.getIngressRemoteAclIdMap();
if (map.isEmpty()) {
session.getConsole().println("No data found");
} else {
session.getConsole().println(REM_ID_HEAD);
for (Entry<Uuid, Collection<Uuid>> entry : map.entrySet()) {
session.getConsole().print(String.format(KEY_TAB, entry.getKey().getValue()));
if (entry.getValue() == null || entry.getValue().isEmpty()) {
session.getConsole().println(String.format(REM_ID_TAB, ""));
} else {
boolean first = true;
for (Uuid uuid : entry.getValue()) {
if (first) {
session.getConsole().println(String.format(REM_ID_TAB, uuid.getValue()));
first = false;
} else {
session.getConsole().println(String.format(REM_ID_TAB_FOR, "", uuid.getValue()));
}
}
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.Direction in project netvirt by opendaylight.
the class AclServiceUtils method getRemoteAclTags.
public SortedSet<Integer> getRemoteAclTags(List<Uuid> aclIds, Class<? extends DirectionBase> direction) {
SortedSet<Integer> remoteAclTags = new TreeSet<>();
Set<Uuid> remoteAclIds = getRemoteAclIdsByDirection(aclIds, direction);
for (Uuid remoteAclId : remoteAclIds) {
Integer remoteAclTag = getAclTag(remoteAclId);
if (remoteAclTag != null && remoteAclTag != AclConstants.INVALID_ACL_TAG) {
remoteAclTags.add(remoteAclTag);
}
}
return remoteAclTags;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.Direction 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.opendaylight.netvirt.acl.live.statistics.rev161129.Direction 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.opendaylight.netvirt.acl.live.statistics.rev161129.Direction in project netvirt by opendaylight.
the class AclLiveStatisticsRpcServiceTest method getStatsTwoPortEgressOnly.
/**
* Test stats for two ports and egress direction only. <br>
* port1 is valid <br>
* port2 is invalid <br>
* Expectation: Error expected for port2. Drop stats should be available for
* egress direction only.
*
* @throws Exception the exception
*/
@Test
public void getStatsTwoPortEgressOnly() throws Exception {
List<String> lstInterfaces = Arrays.asList(PORT_1, PORT_2);
Direction direction = Direction.Egress;
GetAclPortStatisticsInput input = new GetAclPortStatisticsInputBuilder().setDirection(direction).setInterfaceNames(lstInterfaces).build();
Future<RpcResult<GetAclPortStatisticsOutput>> rpcResultFuture = aclStatsService.getAclPortStatistics(input);
RpcResult<GetAclPortStatisticsOutput> output = rpcResultFuture.get();
LOG.info("getStatsTwoPortEgressOnly output = {}", output);
assertStatsOutput(output, direction);
}
Aggregations