CORD-1149 Allow configuring multiple IPv4/IPv6 addresses on one interface
We had this limit before because we derived VLAN from subnet.
We no longer do that and thus user should be free to config 0+ IPv4/IPv6 addresses
Change-Id: I144c618112e4b437ebf64ea3b5ab05a83263cb17
diff --git a/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java b/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
index 490bf4f..d75bedd 100644
--- a/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
+++ b/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
@@ -57,9 +57,7 @@
public class DeviceConfiguration implements DeviceProperties {
private static final String ERROR_CONFIG = "Configuration error.";
- private static final String TOO_MANY_SUBNET = ERROR_CONFIG + " Too many subnets configured on {}";
private static final String NO_SUBNET = "No subnet configured on {}";
- private static final String MISCONFIGURED = "Subnets are not configured correctly for {}";
private static final Logger log = LoggerFactory.getLogger(DeviceConfiguration.class);
private final List<Integer> allSegmentIds = new ArrayList<>();
@@ -440,7 +438,7 @@
* @param deviceId Device ID
* @param port Port number
* @return The subnets configured on given port or empty set if
- * the port is unconfigured, misconfigured or suppressed.
+ * the port is unconfigured or suppressed.
*/
public Set<IpPrefix> getPortSubnets(DeviceId deviceId, PortNumber port) {
ConnectPoint connectPoint = new ConnectPoint(deviceId, port);
@@ -458,14 +456,9 @@
if (subnets.isEmpty()) {
log.debug(NO_SUBNET, connectPoint);
return Collections.emptySet();
- } else if (subnets.size() > 2) {
- log.warn(TOO_MANY_SUBNET, connectPoint);
- return Collections.emptySet();
- } else if (verifySubnets(subnets)) {
- return subnets;
}
- log.warn(MISCONFIGURED, connectPoint);
- return Collections.emptySet();
+
+ return subnets;
}
/**
@@ -499,30 +492,6 @@
}
/**
- * Utility to verify the configuration of a given port.
- *
- * @param subnets the subnets set to verify
- * @return true if the configured subnets are ok. False otherwise.
- */
- private boolean verifySubnets(Set<IpPrefix> subnets) {
- Set<Ip4Prefix> ip4Prefices = subnets.stream()
- .filter(IpPrefix::isIp4)
- .map(IpPrefix::getIp4Prefix)
- .collect(Collectors.toSet());
- if (ip4Prefices.size() > 1) {
- return false;
- }
- Set<Ip6Prefix> ip6Prefices = subnets.stream()
- .filter(IpPrefix::isIp6)
- .map(IpPrefix::getIp6Prefix)
- .collect(Collectors.toSet());
- if (ip6Prefices.size() > 1) {
- return false;
- }
- return !(ip4Prefices.isEmpty() && ip6Prefices.isEmpty());
- }
-
- /**
* Returns the router ip address of segment router that has the
* specified ip address in its subnets.
*