Custom Node Type jaxb string to id 13/413/3
authorKalvin Hom <kahom@cisco.com>
Fri, 31 May 2013 01:48:37 +0000 (18:48 -0700)
committerKalvin Hom <kahom@cisco.com>
Tue, 4 Jun 2013 18:57:03 +0000 (11:57 -0700)
When using the web services, nodeIDString
needs to be parsed into the correct
type to get the nodeID when it is not
one of the preset Node types.

Change-Id: Ic55b440e0a5a951f9f8c6c167e1e1bcfa8c3b107
Signed-off-by: Kalvin Hom <kahom@cisco.com>
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Node.java

index ef0c066..5a71ab8 100644 (file)
@@ -228,8 +228,13 @@ public class Node implements Serializable {
         } else if (typeStr.equals(NodeIDType.PRODUCTION)) {
             this.nodeID = IDStr;
         } else {
-            // We need to lookup via OSGi service registry for an
-            // handler for this
+            //Use plugin's method to get appropriate conversion from IDStr to nodeID
+            INodeFactory f = (INodeFactory) ServiceHelper
+                    .getGlobalInstance(INodeFactory.class, new Node(), "(protocolName="+typeStr+")");
+            if(f!=null){
+                Node n = f.fromString(typeStr, IDStr);
+                this.nodeID = n.nodeID;
+            }
         }
     }