update OFDeviceProviderTest - roleAssertFail
Change-Id: Iccdda5a11a3a6aa019e1641d068e10b2b17c9798
diff --git a/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java b/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
index 3162895..80b9b18 100644
--- a/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/device/impl/DeviceManager.java
@@ -233,7 +233,7 @@
@Override
public void unableToAssertRole(DeviceId deviceId, MastershipRole role) {
// FIXME: implement response to this notification
- log.warn("Falied to assert role [{}] onto Device {}",
+ log.warn("Failed to assert role [{}] onto Device {}",
role, deviceId);
}
}
diff --git a/providers/openflow/device/src/test/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProviderTest.java b/providers/openflow/device/src/test/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProviderTest.java
index af5cf52..8196cb8 100644
--- a/providers/openflow/device/src/test/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProviderTest.java
+++ b/providers/openflow/device/src/test/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProviderTest.java
@@ -120,6 +120,16 @@
assertEquals("port status unhandled", 3, registry.ports.get(DID1).size());
}
+ @Test
+ public void roleAssertFailed() {
+ controller.listener.roleAssertFailed(DPID1, RoleState.MASTER);
+ assertEquals("wrong role reported", DPID1, registry.roles.get(MASTER));
+ controller.listener.roleAssertFailed(DPID1, RoleState.EQUAL);
+ assertEquals("wrong role reported", DPID1, registry.roles.get(STANDBY));
+ controller.listener.roleAssertFailed(DPID1, RoleState.SLAVE);
+ assertEquals("wrong role reported", DPID1, registry.roles.get(NONE));
+ }
+
private static OFPortDesc portDesc(int port) {
OFPortDesc.Builder builder = OFFactoryVer10.INSTANCE.buildPortDesc();
builder.setPortNo(OFPort.of(port));
@@ -129,9 +139,11 @@
private class TestDeviceRegistry implements DeviceProviderRegistry {
DeviceProvider provider;
- Set<DeviceId> connected = new HashSet<DeviceId>();
+
+ Set<DeviceId> connected = new HashSet<>();
Multimap<DeviceId, PortDescription> ports = HashMultimap.create();
PortDescription descr = null;
+ Map<MastershipRole, Dpid> roles = new HashMap<>();
@Override
public DeviceProviderService register(DeviceProvider provider) {
@@ -184,7 +196,7 @@
@Override
public void unableToAssertRole(DeviceId deviceId, MastershipRole role) {
- // FIXME: add fixture core when tests are done on this
+ roles.put(role, Dpid.dpid(deviceId.uri()));
}
}