CORD-523 Introduce generic routing service in Segment Routing
Segment Routing now reacts to routes being added/removed through RouteService.
SR will disable SingleSwitchFibInstaller if vRouter is activated
SR will install a routing table entry on
- The leaf where next hop attaches to
- The other leaves that points packets to the leaf where next hop attaches to
Host handler no longer add any IP flow for hosts outside the configured subnet
- We need to explicitly add a per host route via RouteService when needed (vSG)
Change suppressSubnet behavior
- Before: do not push any flow
- After: ignore subnet config but still push filtering obj with VLAN 4094
ARP handler drops all packets from suppressed ports
Additional refactoring
- Remove vRouterId. Gateway router now needs to be specify through route API
- Limit the scope of some variables
- Unify handler.init method name
Change-Id: Idd2fd19fa74e3fa6209eef5cf2ed79957715c5e9
diff --git a/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java b/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
index cb0a275..c2360cb 100644
--- a/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
+++ b/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
@@ -20,6 +20,7 @@
import com.google.common.collect.SetMultimap;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip4Prefix;
+import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
@@ -331,15 +332,7 @@
srinfo.subnets.values());
ImmutableSet.Builder<Ip4Prefix> builder = ImmutableSet.builder();
- builder.addAll(srinfo.subnets.values());
- SegmentRoutingAppConfig appConfig =
- srManager.cfgService.getConfig(srManager.appId, SegmentRoutingAppConfig.class);
- if (appConfig != null) {
- if (deviceId.equals(appConfig.vRouterId().orElse(null))) {
- builder.add(Ip4Prefix.valueOf("0.0.0.0/0"));
- }
- }
- return builder.build();
+ return builder.addAll(srinfo.subnets.values()).build();
}
return null;
}
@@ -452,6 +445,20 @@
}
/**
+ * Checks if the IP is in the subnet defined on given connect point.
+ *
+ * @param connectPoint Connect point
+ * @param ip The IP address to check
+ * @return True if the IP belongs to the subnet.
+ * False if the IP does not belong to the subnet, or
+ * there is no subnet configuration on given connect point.
+ */
+ public boolean inSameSubnet(ConnectPoint connectPoint, IpAddress ip) {
+ Ip4Prefix portSubnet = getPortSubnet(connectPoint.deviceId(), connectPoint.port());
+ return portSubnet != null && portSubnet.contains(ip);
+ }
+
+ /**
* Returns the ports corresponding to the adjacency Sid given.
*
* @param deviceId device identification of the router
@@ -516,7 +523,7 @@
SegmentRoutingAppConfig appConfig = srManager.cfgService
.getConfig(srManager.appId, SegmentRoutingAppConfig.class);
if (appConfig != null && appConfig.suppressSubnet().contains(connectPoint)) {
- log.info("Ignore suppressed port {}", connectPoint);
+ log.info("Interface configuration on port {} is ignored", connectPoint);
return true;
}
return false;