Work toward ONOS-1451: Separate Event Key space per instance
Misc changes and cleanup:
* Added new class OnosInstanceId
* Replace (as appropriate) the string controllerId (and associated methods)
with the new class OnosInstanceId
* Renaming: Host -> Device
- Method getDeviceID -> getHostID
- Changed Host Key ID prefix 'D' to 'H'
- Few renaming of Host -> Device inside Javadoc
Change-Id: I59c20d68277ecde2f7df4e7097a4a52d5786df1b
diff --git a/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java b/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java
index 6eb6687..88a1177 100644
--- a/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java
+++ b/src/test/java/net/onrc/onos/core/registry/StandaloneRegistryTest.java
@@ -18,6 +18,7 @@
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.onrc.onos.core.registry.IControllerRegistryService.ControlChangeCallback;
+import net.onrc.onos.core.util.OnosInstanceId;
import org.junit.After;
import org.junit.Before;
@@ -185,25 +186,26 @@
}
/**
- * Test if {@link StandaloneRegistry#getControllerId()} can return correct ID.
+ * Test if {@link StandaloneRegistry#getOnosInstanceId()} can return
+ * correct ID.
*
* @throws RegistryException
*/
@Test
- public void testGetControllerId() throws RegistryException {
+ public void testGetOnosInstanceId() throws RegistryException {
String controllerIdToRegister = "test";
// try before controller is registered
- String controllerId = registry.getControllerId();
- assertNull(controllerId);
+ OnosInstanceId onosInstanceId = registry.getOnosInstanceId();
+ assertNull(onosInstanceId);
// register
registry.registerController(controllerIdToRegister);
- // call getControllerId and verify
- controllerId = registry.getControllerId();
- assertNotNull(controllerId);
- assertEquals(controllerIdToRegister, controllerId);
+ // call getOnosInstanceId and verify
+ onosInstanceId = registry.getOnosInstanceId();
+ assertNotNull(onosInstanceId);
+ assertEquals(controllerIdToRegister, onosInstanceId.toString());
}
/**
diff --git a/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java b/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java
index ca56736..5490162 100644
--- a/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java
+++ b/src/test/java/net/onrc/onos/core/registry/ZookeeperRegistryTest.java
@@ -9,6 +9,7 @@
import net.floodlightcontroller.test.FloodlightTestCase;
import net.onrc.onos.core.registry.StandaloneRegistryTest.LoggingCallback;
import net.onrc.onos.core.registry.ZookeeperRegistry.SwitchLeaderListener;
+import net.onrc.onos.core.util.OnosInstanceId;
import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
@@ -115,25 +116,26 @@
}
/**
- * Test if {@link ZookeeperRegistry#getControllerId()} correctly returns registered ID.
+ * Test if {@link ZookeeperRegistry#getOnosInstanceId()} correctly returns
+ * registered ID.
*
* @throws Exception
*/
@Test
- public void testGetControllerId() throws Exception {
+ public void testGetOnosInstanceId() throws Exception {
String controllerIdToRegister = "controller1";
// try before controller is registered
- String controllerId = registry.getControllerId();
- assertNull(controllerId);
+ OnosInstanceId onosInstanceId = registry.getOnosInstanceId();
+ assertNull(onosInstanceId);
// register
registry.registerController(controllerIdToRegister);
- // call getControllerId and verify
- controllerId = registry.getControllerId();
- assertNotNull(controllerId);
- assertEquals(controllerIdToRegister, controllerId);
+ // call getOnosInstanceId and verify
+ onosInstanceId = registry.getOnosInstanceId();
+ assertNotNull(onosInstanceId);
+ assertEquals(controllerIdToRegister, onosInstanceId.toString());
}
/**