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;
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);
return target;
}
-
+
/**
* @param source notification, missing instructions
* @param node corresponding node where the flow change occured
}
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) {
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();
}