SDFAB-104 Support routing via next hop in single leaf pair topology
The original design principle we adopted while implementing dual-homing is only recovering local failure using pair link.
Routing via next hop is a global thing recovered by updating ECMP hashing.
However, there is no spine in the single leaf pair setup so we need additional logic to recover this using pair link.
Change-Id: I3d648b139038be69656dd86b4c40d12bf10f50b2
diff --git a/impl/src/test/java/org/onosproject/segmentrouting/MockSegmentRoutingManager.java b/impl/src/test/java/org/onosproject/segmentrouting/MockSegmentRoutingManager.java
index ad098b4..fdd3951 100644
--- a/impl/src/test/java/org/onosproject/segmentrouting/MockSegmentRoutingManager.java
+++ b/impl/src/test/java/org/onosproject/segmentrouting/MockSegmentRoutingManager.java
@@ -16,12 +16,14 @@
package org.onosproject.segmentrouting;
+import org.onlab.packet.MacAddress;
import org.onosproject.core.DefaultApplicationId;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -30,11 +32,16 @@
*/
public class MockSegmentRoutingManager extends SegmentRoutingManager {
private Map<Integer, TrafficTreatment> nextTable;
+ private Map<DeviceId, MacAddress> routerMacs;
+ private List<DeviceId> infraDeviceIds;
private AtomicInteger atomicNextId = new AtomicInteger();
- MockSegmentRoutingManager(Map<Integer, TrafficTreatment> nextTable) {
+ MockSegmentRoutingManager(Map<Integer, TrafficTreatment> nextTable,
+ Map<DeviceId, MacAddress> routerMacs) {
appId = new DefaultApplicationId(1, SegmentRoutingManager.APP_NAME);
this.nextTable = nextTable;
+ this.routerMacs = routerMacs;
+ this.infraDeviceIds = List.of(DeviceId.deviceId("device:1"));
}
@Override
@@ -46,4 +53,18 @@
nextTable.put(nextId, treatment);
return nextId;
}
+
+ @Override
+ public List<DeviceId> getInfraDeviceIds() {
+ return List.copyOf(infraDeviceIds);
+ }
+
+ public void setInfraDeviceIds(List<DeviceId> infraDeviceIds) {
+ this.infraDeviceIds = infraDeviceIds;
+ }
+
+ @Override
+ public MacAddress getDeviceMacAddress(DeviceId deviceId) {
+ return routerMacs.get(deviceId);
+ }
}