Bug #60 : JSON list responses from the NB-APIs returns native object (instead of...
[controller.git] / opendaylight / northbound / flowprogrammer / src / main / java / org / opendaylight / controller / flowprogrammer / northbound / FlowProgrammerNorthbound.java
index 7bd36a3cbf5b7cebde6665f23987a28a048b6d9c..257fbbda670486582949bdb3eab5dd4297ba7d88 100644 (file)
@@ -417,7 +417,7 @@ public class FlowProgrammerNorthbound {
             @PathParam(value = "name") String name,
             @PathParam("nodeType") String nodeType,
             @PathParam(value = "nodeId") String nodeId,
-            @TypeHint(FlowConfig.class) JAXBElement<FlowConfig> flowConfig) {
+            @TypeHint(FlowConfig.class) FlowConfig flowConfig) {
 
         if (!NorthboundUtils.isAuthorized(
                 getUserName(), containerName, Privilege.WRITE, this)) {
@@ -425,12 +425,13 @@ public class FlowProgrammerNorthbound {
                     "User is not authorized to perform this operation on container "
                             + containerName);
         }
-        if (flowConfig.getValue().getNode() == null) {
+
+        if (flowConfig.getNode() == null) {
             return Response.status(Response.Status.BAD_REQUEST).entity("Invalid Configuration. Node is null or empty")
                     .build();
         }
-        handleResourceCongruence(name, flowConfig.getValue().getName());
-        handleResourceCongruence(nodeId, flowConfig.getValue().getNode().getNodeIDString());
+        handleResourceCongruence(name, flowConfig.getName());
+        handleResourceCongruence(nodeId, flowConfig.getNode().getNodeIDString());
         handleDefaultDisabled(containerName);
 
         IForwardingRulesManager frm = getForwardingRulesManagerService(containerName);
@@ -448,7 +449,7 @@ public class FlowProgrammerNorthbound {
                     + RestMessages.RESOURCECONFLICT.toString());
         }
 
-        Status status = frm.addStaticFlow(flowConfig.getValue());
+        Status status = frm.addStaticFlow(flowConfig);
 
         if (status.isSuccess()) {
             NorthboundUtils.auditlog("Flow", username, "added", name, containerName);