Fixed IT breakage. 36/18736/2
authorShigeru Yasuda <s-yasuda@da.jp.nec.com>
Tue, 21 Apr 2015 09:00:13 +0000 (18:00 +0900)
committerShigeru Yasuda <s-yasuda@da.jp.nec.com>
Tue, 21 Apr 2015 14:06:14 +0000 (23:06 +0900)
  * ofmock: Notify link explicitly when the port state is changed.
  * ofmock: Ensure that both edge ports of the inter-switch link are
    created.

Change-Id: I80278595c11fc6537dfd91ce0813858c0dc52b43
Signed-off-by: Shigeru Yasuda <s-yasuda@da.jp.nec.com>
manager/it/ofmock/src/main/java/org/opendaylight/vtn/manager/it/ofmock/impl/OfMockProvider.java
manager/it/ofmock/src/main/java/org/opendaylight/vtn/manager/it/ofmock/impl/OfPort.java

index 72d4d1d2fd1b0dab3bbe4c2317172335157d7410..c20e3f82bcf5a1ee8da5ee5cc6670e4375fd8e88 100644 (file)
@@ -903,6 +903,10 @@ public class OfMockProvider implements AutoCloseable, Executor, OfMockService {
                     "Initial switch port cannot be specified to peer: " + peer;
                 throw new IllegalArgumentException(msg);
             }
+
+            // Ensure that both ports are already notified.
+            portListener.awaitCreated(pid);
+            portListener.awaitCreated(peer);
         }
 
         String dst;
index 94eb9664f33c1bd7e7e6f5f29ed87ed5d713daae..0893b09173c233e5fa4824efb92e5828ecdf2d01 100644 (file)
@@ -278,8 +278,12 @@ public final class OfPort {
             provider.publish(getNodeConnectorUpdated());
 
             String peer = peerIdentifier;
-            if (peer != null && state) {
-                notifyLinkDiscovered(provider, peer);
+            if (peer != null) {
+                if (state) {
+                    notifyLinkDiscovered(provider, peer);
+                } else {
+                    notifyLinkRemoved(provider, peer);
+                }
             }
         }
     }