CORD-1495 Fix race condition when loading network config
Change-Id: I6df7e5fcba053301fd323e13f3b5b9b9bf3ba520
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index a10870c..bcbefc8 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -35,6 +35,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.event.Event;
+import org.onosproject.incubator.net.config.basics.InterfaceConfig;
import org.onosproject.incubator.net.config.basics.McastConfig;
import org.onosproject.incubator.net.intf.Interface;
import org.onosproject.incubator.net.intf.InterfaceService;
@@ -1144,11 +1145,24 @@
if (event.configClass().equals(SegmentRoutingDeviceConfig.class)) {
switch (event.type()) {
case CONFIG_ADDED:
- log.info("Segment Routing Config added.");
+ log.info("Segment Routing Device Config added for {}", event.subject());
configureNetwork();
break;
case CONFIG_UPDATED:
- log.info("Segment Routing Config updated.");
+ log.info("Segment Routing Config updated for {}", event.subject());
+ // TODO support dynamic configuration
+ break;
+ default:
+ break;
+ }
+ } else if (event.configClass().equals(InterfaceConfig.class)) {
+ switch (event.type()) {
+ case CONFIG_ADDED:
+ log.info("Interface Config added for {}", event.subject());
+ configureNetwork();
+ break;
+ case CONFIG_UPDATED:
+ log.info("Interface Config updated for {}", event.subject());
// TODO support dynamic configuration
break;
default:
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
index d75bedd..a7544b7 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
@@ -107,7 +107,7 @@
info.isEdge = config.isEdgeRouter();
info.adjacencySids = config.adjacencySids();
deviceConfigMap.put(info.deviceId, info);
- log.info("Read device config for device: {}", info.deviceId);
+ log.debug("Read device config for device: {}", info.deviceId);
/*
* IPv6 sid is not inserted. this part of the code is not used for now.
*/