Merge "AD-SAL: Filter packet-in based on container flow"
[controller.git] / opendaylight / md-sal / compatibility / sal-compatibility / src / main / java / org / opendaylight / controller / sal / compatibility / ToSalConversionsUtils.java
index b64f17a77028ff018df7691d4f0498027356d4a8..d2243a4704f363ceb27b5f49fff8955c9c90ee74 100644 (file)
@@ -53,6 +53,7 @@ import org.opendaylight.controller.sal.action.SwPath;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.NodeConnector.NodeConnectorIDType;
 import org.opendaylight.controller.sal.flowprogrammer.Flow;
 import org.opendaylight.controller.sal.match.Match;
 import org.opendaylight.controller.sal.match.MatchType;
@@ -134,7 +135,7 @@ public class ToSalConversionsUtils {
     public static Flow toFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow source, Node node) {
         final Flow target = new Flow();
         genericFlowToAdFlow(source, target);
-        
+
         target.setMatch(toMatch(source.getMatch()));
 
         List<Action> actions = getAction(source);
@@ -144,7 +145,7 @@ public class ToSalConversionsUtils {
 
         return target;
     }
-    
+
     /**
      * @param source notification, missing instructions
      * @param node corresponding node where the flow change occured
@@ -181,7 +182,7 @@ public class ToSalConversionsUtils {
         }
         target.setId(source.getCookie().getValue().longValue());
     }
-    
+
     public static List<Action> getAction(
             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow source) {
         if (source.getInstructions() != null) {
@@ -376,10 +377,16 @@ public class ToSalConversionsUtils {
         return null;
     }
 
-    private static NodeConnector fromNodeConnectorRef(Uri uri, Node node) {
+    /**
+     * @param openflow nodeConnector uri
+     * @param node
+     * @return assembled nodeConnector
+     */
+    public static NodeConnector fromNodeConnectorRef(Uri uri, Node node) {
         NodeConnector nodeConnector = null;
         try {
-            nodeConnector = new NodeConnector(NodeMapping.MD_SAL_TYPE,node.getNodeIDString()+":"+uri.getValue(),node);
+            nodeConnector = new NodeConnector(NodeConnectorIDType.OPENFLOW,
+                    Short.valueOf(uri.getValue()), node);
         } catch (ConstructionException e) {
             e.printStackTrace();
         }