Fix to remove @ from id and type parameter of node and nodeconnector in Northbound...
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / core / NodeConnector.java
index 495af7970c7f0597ad50fc1e39863aafd3753fd6..85a6c22c568cd97894c420c2850eeb848a6a1b14 100644 (file)
@@ -28,6 +28,9 @@ import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
+import org.opendaylight.controller.sal.utils.INodeFactory;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
 
 /**
  * Describe a generic network element attachment points,
@@ -276,7 +279,7 @@ public class NodeConnector implements Serializable {
      *
      * @return the NodeConnectorType of this object
      */
-    @XmlAttribute(name = "type")
+    @XmlElement(name = "type")
     public String getType() {
         return this.nodeConnectorType;
     }
@@ -359,7 +362,7 @@ public class NodeConnector implements Serializable {
      *
      * @return the NodeConnector ID of this object in String format
      */
-    @XmlAttribute(name = "id")
+    @XmlElement(name = "id")
     public String getNodeConnectorIDString() {
         return this.nodeConnectorID.toString();
     }
@@ -602,8 +605,13 @@ public class NodeConnector implements Serializable {
                 return null;
             }
         } else {
-            // Lookup via OSGi service registry
+            //Use INodeConnectorFactory to create a NodeConnector of registered type.
+            //The protocol plugin being used depends on typeStr.
+            INodeConnectorFactory f = (INodeConnectorFactory) ServiceHelper
+                    .getGlobalInstance(INodeConnectorFactory.class, new NodeConnector(), "(protocolName="+typeStr+")");
+            if(f==null)
+                return null;
+            return f.fromStringNoNode(typeStr, IDStr, n);
         }
-        return null;
     }
 }