Directly use config provided by the event to prevent race condition

Change-Id: I1732b5a1095cdd04fbe1be0619e19cefac07a118
diff --git a/core/net/src/main/java/org/onosproject/net/intf/impl/InterfaceManager.java b/core/net/src/main/java/org/onosproject/net/intf/impl/InterfaceManager.java
index 5693db5..36c5bd5 100644
--- a/core/net/src/main/java/org/onosproject/net/intf/impl/InterfaceManager.java
+++ b/core/net/src/main/java/org/onosproject/net/intf/impl/InterfaceManager.java
@@ -249,9 +249,7 @@
                 switch (event.type()) {
                 case CONFIG_ADDED:
                 case CONFIG_UPDATED:
-                    InterfaceConfig config =
-                            configService.getConfig((ConnectPoint) event.subject(), InterfaceConfig.class);
-                    updateInterfaces(config);
+                    event.config().ifPresent(config -> updateInterfaces((InterfaceConfig) config));
                     break;
                 case CONFIG_REMOVED:
                     removeInterfaces((ConnectPoint) event.subject());
diff --git a/core/net/src/test/java/org/onosproject/net/intf/impl/InterfaceManagerTest.java b/core/net/src/test/java/org/onosproject/net/intf/impl/InterfaceManagerTest.java
index 89ca4ee..b4a7163 100644
--- a/core/net/src/test/java/org/onosproject/net/intf/impl/InterfaceManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intf/impl/InterfaceManagerTest.java
@@ -163,7 +163,7 @@
         interfaces.add(newIntf);
 
         NetworkConfigEvent event = new NetworkConfigEvent(
-                NetworkConfigEvent.Type.CONFIG_ADDED, cp, CONFIG_CLASS);
+                NetworkConfigEvent.Type.CONFIG_ADDED, cp, ic, null, CONFIG_CLASS);
 
         assertEquals(NUM_INTERFACES, interfaceManager.getInterfaces().size());
 
@@ -201,12 +201,13 @@
 
         // New interface config updates the existing interface and adds a new
         // interface to the same connect point
+        InterfaceConfig oldIc = new TestInterfaceConfig(cp, Sets.newHashSet(intf));
         InterfaceConfig ic = new TestInterfaceConfig(cp, interfaces);
 
         configs.put(cp, ic);
 
         NetworkConfigEvent event = new NetworkConfigEvent(
-                NetworkConfigEvent.Type.CONFIG_UPDATED, cp, CONFIG_CLASS);
+                NetworkConfigEvent.Type.CONFIG_UPDATED, cp, ic, oldIc, CONFIG_CLASS);
 
         // Send in the event signalling the interfaces for this connect point
         // have been updated