Minor Registry changes and Controller now registers itself on startup using the registry
diff --git a/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java b/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java
index e3181fe..8a468bc 100644
--- a/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java
+++ b/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java
@@ -32,7 +32,8 @@
public void requestControl(long dpid, ControlChangeCallback cb)
throws RegistryException {
if (controllerId == null) {
- throw new RuntimeException("Must register a controller before calling requestControl");
+ throw new RuntimeException(
+ "Must register a controller before calling requestControl");
}
switchCallbacks.put(HexString.toHexString(dpid), cb);
@@ -75,6 +76,10 @@
@Override
public void registerController(String controllerId)
throws RegistryException {
+ if (this.controllerId != null) {
+ throw new RegistryException(
+ "Controller already registered with id " + this.controllerId);
+ }
this.controllerId = controllerId;
}