X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnorthbound%2Fnetworkconfiguration%2Fbridgedomain%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetworkconfig%2Fbridgedomain%2Fnorthbound%2FBridgeDomainNorthbound.java;h=da7faa2c78d9cf9b4155ce244cbd190ea649b4a8;hb=468405c27b007e896bf12713651ae383740b6c2c;hp=36819f6222553772d621e9258a65f3d7676fcf44;hpb=3835d91556ed661b9b9711950aafbffa1d6a92e0;p=controller.git diff --git a/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java b/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java index 36819f6222..da7faa2c78 100644 --- a/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java +++ b/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java @@ -29,10 +29,10 @@ import org.opendaylight.controller.connectionmanager.IConnectionManager; import org.opendaylight.controller.northbound.commons.exception.NotAcceptableException; import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException; import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException; -import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants; -import org.opendaylight.controller.sal.networkconfig.bridgedomain.IBridgeDomainConfigService; import org.opendaylight.controller.sal.connection.ConnectionConstants; import org.opendaylight.controller.sal.core.Node; +import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants; +import org.opendaylight.controller.sal.networkconfig.bridgedomain.IBridgeDomainConfigService; import org.opendaylight.controller.sal.utils.NetUtils; import org.opendaylight.controller.sal.utils.ServiceHelper; import org.opendaylight.controller.sal.utils.Status; @@ -56,7 +56,7 @@ public class BridgeDomainNorthbound { @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName(); } protected String getUserName() { return username; @@ -76,11 +76,23 @@ public class BridgeDomainNorthbound { * If a Network Configuration Service needs a special Management Connection and if the * Node Type is unknown, use this REST api to connect to the management session. *
+     *
      * Example :
-     * Request : PUT http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/mgmt1/1.1.1.1/6634
-     * Response : Node :
-     *                  xml : <node type="STUB" id="mgmt1"/>
-     *                  json: {"@type": "STUB","@id": "mgmt1"}
+     *
+     * Request :
+     * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/mgmt1/1.1.1.1/6634
+     *
+     * Response :
+     * Node :
+     * xml :
+     * <node>
+     *    <id>mgmt1</id>
+     *    <type>STUB</type>
+     * </node>
+     *
+     * json:
+     * {"id": "mgmt1","type": "STUB"}
+     *
      *
* @param nodeName User-Defined name of the node to connect with. This can be any alpha numeric value * @param ipAddress IP Address of the Node to connect with. @@ -137,11 +149,22 @@ public class BridgeDomainNorthbound { * If a Network Configuration Service needs a special Management Connection, and if the * node Type is known, the user can choose to use this REST api to connect to the management session. *
+     *
      * Example :
-     * Request : PUT http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/STUB/mgmt1/1.1.1.1/6634
+     *
+     * Request :
+     * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/STUB/mgmt1/1.1.1.1/6634
+     *
      * Response : Node :
-     *                  xml : <node type="STUB" id="mgmt1"/>
-     *                  json: {"@type": "STUB","@id": "mgmt1"}
+     * xml :
+     * <node>
+     *    <id>mgmt1</id>
+     *    <type>STUB</type>
+     * </node>
+     *
+     * json:
+     * {"id": "mgmt1","type": "STUB"}
+     *
      *
* @param nodeName User-Defined name of the node to connect with. This can be any alpha numeric value * @param ipAddress IP Address of the Node to connect with. @@ -198,8 +221,12 @@ public class BridgeDomainNorthbound { /** * Create a Bridge. *
+     *
      * Example :
-     * Request : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/STUB/mgmt1/bridge1
+     *
+     * Request :
+     * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/STUB/mgmt1/bridge1
+     *
      *
* @param nodeType Node Type of the node with the management session. * @param nodeId Node Identifier of the node with the management session. @@ -239,8 +266,12 @@ public class BridgeDomainNorthbound { /** * Add a Port to a Bridge *
+    *
     * Example :
-    * Request : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port1
+    *
+    * Request :
+    * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port1
+    *
     *
* @param nodeType Node Type of the node with the management session. * @param nodeId Node Identifier of the node with the management session. @@ -282,9 +313,12 @@ public class BridgeDomainNorthbound { /** * Add a Port,Vlan to a Bridge *
+    *
     * Example :
-    * Request : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port2/200
-    *
+ * Request : + * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port2/200 + * + * * @param nodeType Node Type of the node with the management session. * @param nodeId Node Identifier of the node with the management session. * @param bridgeName Name / Identifier of the bridge to which a Port is being added. @@ -319,7 +353,7 @@ public class BridgeDomainNorthbound { Node node = Node.fromString(nodeType, nodeId); Map configs = new HashMap(); - configs.put(ConfigConstants.TYPE, ConfigConstants.VLAN); + configs.put(ConfigConstants.TYPE, ConfigConstants.VLAN.name()); configs.put(ConfigConstants.VLAN, vlan); Status status = null;