exeCmdStr + "aclInterfaceCache --all show | --key <key>");
}
- private boolean validateAll(String all) {
- if (all.equalsIgnoreCase("show")) {
- return true;
- }
- return false;
+ private boolean validateAll() {
+ return "show".equalsIgnoreCase(all);
}
protected void getAclInterfaceMap() throws Exception {
if (all == null && uuidStr == null) {
printAclInterfaceMapHelp();
- return;
- }
- if (all == null && uuidStr != null) {
+ } else if (all == null) {
Uuid uuid;
try {
uuid = Uuid.getDefaultInstance(uuidStr);
Collection<AclInterface> aclInterfaceList = aclDataCache.getInterfaceList(uuid);
if (aclInterfaceList == null || aclInterfaceList.isEmpty()) {
session.getConsole().println("UUID not matched");
- return;
} else {
- session.getConsole().println(String.format(ACL_INT_HEAD));
+ session.getConsole().println(ACL_INT_HEAD);
session.getConsole().print(String.format(KEY_TAB, uuid.toString()));
for (AclInterface aclInterface : aclInterfaceList) {
session.getConsole().println(String.format(ACL_INT_TAB,
aclInterface.getAllowedAddressPairs(), aclInterface.getSubnetIpPrefixes(),
aclInterface.isMarkedForDelete()));
}
- return;
}
- }
- if (all != null && uuidStr == null) {
- if (!validateAll(all)) {
+ } else if (uuidStr == null) {
+ if (!validateAll()) {
printAclInterfaceMapHelp();
return;
}
if (map.isEmpty()) {
session.getConsole().println("No data found");
- return;
} else {
- session.getConsole().println(String.format(ACL_INT_HEAD));
+ session.getConsole().println(ACL_INT_HEAD);
for (Entry<Uuid, Collection<AclInterface>> entry: map.entrySet()) {
- Uuid key = entry.getKey();
- session.getConsole().print(String.format(KEY_TAB, key.toString()));
+ session.getConsole().print(String.format(KEY_TAB, entry.getKey().toString()));
for (AclInterface aclInterface: entry.getValue()) {
session.getConsole().println(String.format(ACL_INT_TAB,
aclInterface.isPortSecurityEnabled(), aclInterface.getInterfaceId(),
aclInterface.isMarkedForDelete()));
}
}
- return;
}
}
}
protected void getRemoteAclIdMap() throws Exception {
if (all == null && uuidStr == null) {
printRemoteAclIdMapHelp();
- return;
- }
- if (all == null && uuidStr != null) {
+ } else if (all == null) {
Uuid uuidRef;
try {
uuidRef = Uuid.getDefaultInstance(uuidStr);
Collection<Uuid> remoteUuidLst = aclDataCache.getRemoteAcl(uuidRef);
if (remoteUuidLst == null || remoteUuidLst.isEmpty()) {
session.getConsole().println("UUID not matched");
- return;
} else {
- session.getConsole().println(String.format(REM_ID_HEAD));
+ session.getConsole().println(REM_ID_HEAD);
session.getConsole().print(String.format(KEY_TAB, uuidRef.toString()));
for (Uuid uuid : remoteUuidLst) {
session.getConsole().println(String.format(REM_ID_TAB, uuid.getValue()));
}
- return;
}
- }
- if (all != null && uuidStr == null) {
- if (!validateAll(all)) {
+ } else if (uuidStr == null) {
+ if (!validateAll()) {
printRemoteAclIdMapHelp();
return;
}
Map<Uuid, Collection<Uuid>> map = aclDataCache.getRemoteAclIdMap();
if (map.isEmpty()) {
session.getConsole().println("No data found");
- return;
} else {
- session.getConsole().println(String.format(REM_ID_HEAD));
+ session.getConsole().println(REM_ID_HEAD);
for (Entry<Uuid, Collection<Uuid>> entry: map.entrySet()) {
- Uuid key = entry .getKey();
- session.getConsole().print(String.format(KEY_TAB, key.toString()));
+ session.getConsole().print(String.format(KEY_TAB, entry.getKey().toString()));
for (Uuid uuid: entry.getValue()) {
session.getConsole().println(String.format(REM_ID_TAB, uuid.getValue()));
}
}
- return;
}
}
}
protected void getAclFlowPriorityMap() throws Exception {
if (all == null && key == null) {
printAclFlowPriorityMapHelp();
- return;
- }
- if (all == null && key != null) {
+ } else if (all == null) {
Integer val = aclDataCache.getAclFlowPriority(key);
- session.getConsole().println(String.format(ACL_DATA_HEAD));
+ session.getConsole().println(ACL_DATA_HEAD);
session.getConsole().println(String.format(ACL_DATA_TAB_FOR, key, val));
- return;
- }
-
- if (all != null && key == null) {
- if (!validateAll(all)) {
+ } else if (key == null) {
+ if (!validateAll()) {
printAclFlowPriorityMapHelp();
return;
}
Map<String, Integer> map = aclDataCache.getAclFlowPriorityMap();
if (map.isEmpty()) {
session.getConsole().println("No data found");
- return;
} else {
- session.getConsole().println(String.format(ACL_DATA_HEAD));
+ session.getConsole().println(ACL_DATA_HEAD);
for (Map.Entry<String, Integer> entry : map.entrySet()) {
session.getConsole().println(String.format(ACL_DATA_TAB_FOR, entry.getKey(), entry.getValue()));
}
- return;
}
}
}
session.getConsole().println("No data found");
return;
}
- session.getConsole().println(String.format(ACL_INT_HEAD));
+ session.getConsole().println(ACL_INT_HEAD);
session.getConsole().println(String.format(ACL_INT_TAB_FOR, key,
aclInterface.isPortSecurityEnabled(), aclInterface.getInterfaceId(),
aclInterface.getLPortTag(), aclInterface.getDpId(), aclInterface.getElanId(),
aclInterface.getAllowedAddressPairs(), aclInterface.getSubnetIpPrefixes(),
aclInterface.isMarkedForDelete()));
- return;
- }
-
- if (all != null && key == null) {
- if (!validateAll(all)) {
+ } else if (key == null) {
+ if (!validateAll()) {
printAclInterfaceCacheHelp();
return;
}
Collection<Entry<String, AclInterface>> entries = aclInterfaceCache.entries();
if (entries.isEmpty()) {
session.getConsole().println("No data found");
- return;
} else {
- session.getConsole().println(String.format(ACL_INT_HEAD));
+ session.getConsole().println(ACL_INT_HEAD);
for (Map.Entry<String, AclInterface> entry : entries) {
AclInterface aclInterface = entry.getValue();
session.getConsole().println(String.format(ACL_INT_TAB_FOR, entry.getKey(),
aclInterface.isMarkedForDelete()));
}
}
- return;
}
}
}