Improves ping responder
Patch contains several bugfixes and improvements:
- Fixes sid retrieval when the destination leaf is down
- Fixes sid retrieval when ping goes through the spine
- Fixes MPLS deserializer
- Improves Ethernet toString
- Fixes ping to looback for dh host when bond sends to wrong leaf
Change-Id: I05963e74b2976e526826ffd377cadeb462ba0a8d
diff --git a/app/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java b/app/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
index 81a161f..123da37 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
@@ -351,6 +351,24 @@
}
}
+ /**
+ * Gets router ip address based on the destination ip address.
+ *
+ * @param destIpAddress the destination ip address
+ * @param routerDeviceId the device id
+ * @return the ip address of the routes
+ */
+ public IpAddress getRouterIpAddress(IpAddress destIpAddress, DeviceId routerDeviceId) {
+ IpAddress routerIpAddress;
+ try {
+ routerIpAddress = destIpAddress.isIp4() ? getRouterIpv4(routerDeviceId) :
+ getRouterIpv6(routerDeviceId);
+ } catch (DeviceConfigNotFoundException e) {
+ routerIpAddress = null;
+ }
+ return routerIpAddress;
+ }
+
@Override
public boolean isEdgeDevice(DeviceId deviceId) throws DeviceConfigNotFoundException {
SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
@@ -624,6 +642,19 @@
}
/**
+ * Returns all the connect points of the segment routers that have the
+ * specified ip address in their subnets.
+ *
+ * @param destIpAddress target ip address
+ * @return connect points of the segment routers
+ */
+ public Set<ConnectPoint> getConnectPointsForASubnetHost(IpAddress destIpAddress) {
+ return srManager.interfaceService.getMatchingInterfaces(destIpAddress).stream()
+ .map(Interface::connectPoint)
+ .collect(Collectors.toSet());
+ }
+
+ /**
* Returns the router ip address of segment router that has the
* specified ip address in its subnets.
*