- private Set<Short> getPortList(String ports) {
- /*
- * example:
- * ports = "1,3,5-12"
- * elemArray = ["1" "3" "5-12"]
- * elem[2] = "5-12" --> limits = ["5" "12"]
- * portList = [1 3 5 6 7 8 9 10 11 12]
- */
- Set<Short> portList = new HashSet<Short>();
- String[] elemArray = ports.split(",");
- for (String elem : elemArray) {
- if (elem.contains("-")) {
- String[] limits = elem.split("-");
- for (short j = Short.valueOf(limits[0]); j <= Short
- .valueOf(limits[1]); j++) {
- portList.add(Short.valueOf(j));
- }
- } else {
- portList.add(Short.valueOf(elem));
- }
+ private Status validateSubnetAddress() {
+ if (!NetUtils.isIPAddressValid(subnet)) {
+ return new Status(StatusCode.BADREQUEST, String.format("Invalid Subnet configuration: Invalid address: %s", subnet));