Host pointing to the pair port after its pair device is brought down and up
Host-related programming should be done in the same thread to guarantee the order
Change-Id: I07f6e60f4d9ea4392295a7f7ec21b3e2c96aca45
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index c12918b..1d9c507 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -1273,8 +1273,8 @@
}
appCfgHandler.init(deviceId);
- hostHandler.init(deviceId);
- routeHandler.init(deviceId);
+ hostEventExecutor.execute(() -> hostHandler.init(deviceId));
+ routeEventExecutor.execute(() -> routeHandler.init(deviceId));
}
private void processDeviceRemoved(Device device) {
@@ -1393,7 +1393,7 @@
if (portUp) {
log.info("Device:EdgePort {}:{} is enabled in vlan: {}", deviceId,
port.number(), vlanId);
- hostHandler.processPortUp(new ConnectPoint(deviceId, port.number()));
+ hostEventExecutor.execute(() -> hostHandler.processPortUp(new ConnectPoint(deviceId, port.number())));
} else {
log.info("Device:EdgePort {}:{} is disabled in vlan: {}", deviceId,
port.number(), vlanId);
@@ -1845,7 +1845,8 @@
// Remove a single port from L2FG
grpHandler.updateGroupFromVlanConfiguration(vlanId, portNum, nextId, install);
// Remove L2 Bridging rule and L3 Unicast rule to the host
- hostHandler.processIntfVlanUpdatedEvent(deviceId, portNum, vlanId, pushVlan, install);
+ hostEventExecutor.execute(() -> hostHandler.processIntfVlanUpdatedEvent(deviceId, portNum,
+ vlanId, pushVlan, install));
// Remove broadcast forwarding rule and corresponding L2FG for VLAN
// only if there is no port configured on that VLAN ID
if (!getVlanPortMap(deviceId).containsKey(vlanId)) {
@@ -1866,7 +1867,8 @@
grpHandler.createBcastGroupFromVlan(vlanId, Collections.singleton(portNum));
routingRulePopulator.updateSubnetBroadcastRule(deviceId, vlanId, install);
}
- hostHandler.processIntfVlanUpdatedEvent(deviceId, portNum, vlanId, pushVlan, install);
+ hostEventExecutor.execute(() -> hostHandler.processIntfVlanUpdatedEvent(deviceId, portNum,
+ vlanId, pushVlan, install));
} else {
log.warn("Failed to retrieve next objective for vlan {} in device {}:{}", vlanId, deviceId, portNum);
}
@@ -1907,7 +1909,7 @@
// 3. Host unicast routing rule
// Remove unicast routing rule
- hostHandler.processIntfIpUpdatedEvent(cp, ipPrefixSet, false);
+ hostEventExecutor.execute(() -> hostHandler.processIntfIpUpdatedEvent(cp, ipPrefixSet, false));
}
private void addSubnetConfig(ConnectPoint cp, Set<InterfaceIpAddress> ipAddressSet) {
@@ -1946,6 +1948,6 @@
// 3. Host unicast routing rule
// Add unicast routing rule
- hostHandler.processIntfIpUpdatedEvent(cp, ipPrefixSet, true);
+ hostEventExecutor.execute(() -> hostHandler.processIntfIpUpdatedEvent(cp, ipPrefixSet, true));
}
}