NorthBound APIs for the Bridge Domain configuration Service. 74/774/3
authorMadhu Venugopal <vmadhu@cisco.com>
Fri, 2 Aug 2013 13:59:47 +0000 (06:59 -0700)
committerMadhu Venugopal <vmadhu@cisco.com>
Fri, 2 Aug 2013 15:21:05 +0000 (08:21 -0700)
This is the first cut NB-APIs and the enunciate documentation will be generated once the Jenkins Verify is complete
@ https://jenkins.opendaylight.org/controller/job/controller-verify/ws/opendaylight/northbound/networkconfiguration/bridgedomain/target/site/wsdocs/index.html

At a high level, the current version supports the following APIs :

1. Connect : PUT http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/mgmt1/172.28.30.51/6634
             Response Data : xml : <node type="STUB" id="mgmt1"/>
                             json: {"@type": "STUB","@id": "mgmt1"}
2. Connect : PUT http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/STUB/mgmt1/172.28.30.51/6634
             Response Data : xml : <node type="STUB" id="mgmt1"/>
                             json: {"@type": "STUB","@id": "mgmt1"}

3. Create Bridge  : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/STUB/mgmt1/bridge1
4. Add Port       : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port1
5. Add Port, Vlan : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port2/200

Change-Id: Ic55f6bd20859b78a0e004a39388ee358eae5e61a
Signed-off-by: Madhu Venugopal <vmadhu@cisco.com>
opendaylight/distribution/opendaylight/pom.xml
opendaylight/northbound/networkconfiguration/bridgedomain/enunciate.xml [new file with mode: 0644]
opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml [new file with mode: 0644]
opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java [new file with mode: 0644]
opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthboundApplication.java [new file with mode: 0644]
opendaylight/northbound/networkconfiguration/bridgedomain/src/main/resources/WEB-INF/web.xml [new file with mode: 0644]

index 807dea52e38de9994d81ba2796c908085cae07fc..97f68785919919445086a0276e42f73bf4cd4326 100644 (file)
@@ -94,6 +94,7 @@
     <module>../../northbound/hosttracker</module>
     <module>../../northbound/subnets</module>
     <module>../../northbound/switchmanager</module>
     <module>../../northbound/hosttracker</module>
     <module>../../northbound/subnets</module>
     <module>../../northbound/switchmanager</module>
+    <module>../../northbound/networkconfiguration/bridgedomain</module>
 
     <!-- Northbound integration tests -->
     <module>../../northbound/integrationtest</module>
 
     <!-- Northbound integration tests -->
     <module>../../northbound/integrationtest</module>
diff --git a/opendaylight/northbound/networkconfiguration/bridgedomain/enunciate.xml b/opendaylight/northbound/networkconfiguration/bridgedomain/enunciate.xml
new file mode 100644 (file)
index 0000000..f5a7ef1
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<enunciate label="full" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.26.xsd">
+
+  <services>
+    <rest defaultRestSubcontext="/controller/nb/v2/networkconfig/bridgedomain"/>
+  </services>
+
+  <modules>
+    <docs docsDir="rest" title="Bridge Domain Configuration REST API" includeExampleXml="true" includeExampleJson="true"/>
+  </modules>
+</enunciate>
diff --git a/opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml b/opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml
new file mode 100644 (file)
index 0000000..cba14fd
--- /dev/null
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>commons.opendaylight</artifactId>
+    <version>1.4.0-SNAPSHOT</version>
+    <relativePath>../../../commons/opendaylight</relativePath>
+  </parent>
+
+  <artifactId>networkconfig.bridgedomain.northbound</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.enunciate</groupId>
+        <artifactId>maven-enunciate-plugin</artifactId>
+        <version>${enunciate.version}</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal</artifactId>
+            <version>0.5.0-SNAPSHOT</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>2.3.6</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Export-Package>
+            </Export-Package>
+            <Import-Package>
+              org.opendaylight.controller.sal.core,
+              org.opendaylight.controller.sal.utils,
+              org.opendaylight.controller.sal.networkconfig.bridgedomain,
+              org.opendaylight.controller.containermanager,
+              org.opendaylight.controller.usermanager,
+              com.sun.jersey.spi.container.servlet,
+              org.opendaylight.controller.northbound.commons,
+              org.opendaylight.controller.northbound.commons.exception,
+              org.opendaylight.controller.northbound.commons.utils,
+              org.opendaylight.controller.sal.authorization,
+              org.opendaylight.controller.connectionmanager,
+              org.opendaylight.controller.sal.connection,
+              org.slf4j,
+              javax.ws.rs,
+              javax.ws.rs.core,
+              javax.xml.bind.annotation,
+              javax.xml.bind,
+              !org.codehaus.enunciate.jaxrs
+            </Import-Package>
+            <Export-Package>
+            </Export-Package>
+            <Web-ContextPath>/controller/nb/v2/networkconfig/bridgedomain</Web-ContextPath>
+          </instructions>
+          <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.connection</artifactId>
+      <version>0.1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.networkconfiguration</artifactId>
+      <version>0.0.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>connectionmanager</artifactId>
+      <version>0.1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager</artifactId>
+      <version>0.4.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.enunciate</groupId>
+      <artifactId>enunciate-core-annotations</artifactId>
+      <version>${enunciate.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>commons.northbound</artifactId>
+      <version>0.4.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller.thirdparty</groupId>
+      <artifactId>com.sun.jersey.jersey-servlet</artifactId>
+      <version>1.17-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>
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
new file mode 100644 (file)
index 0000000..36819f6
--- /dev/null
@@ -0,0 +1,336 @@
+
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.bridgedomain.northbound;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.SecurityContext;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.codehaus.enunciate.jaxrs.TypeHint;
+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.utils.NetUtils;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+
+/**
+ * BridgeDomain Configuration Northbound APIs
+ *
+ * <br><br>
+ * Authentication scheme : <b>HTTP Basic</b><br>
+ * Authentication realm : <b>opendaylight</b><br>
+ * Transport : <b>HTTP and HTTPS</b><br>
+ * <br>
+ * HTTPS Authentication is disabled by default. Administrator can enable it in tomcat-server.xml after adding
+ * a proper keystore / SSL certificate from a trusted authority.<br>
+ * More info : http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration
+ */
+@Path("/")
+public class BridgeDomainNorthbound {
+    private String username;
+
+    @Context
+    public void setSecurityContext(SecurityContext context) {
+        username = context.getUserPrincipal().getName();
+    }
+    protected String getUserName() {
+        return username;
+    }
+
+    private IBridgeDomainConfigService getConfigurationService() {
+        return (IBridgeDomainConfigService) ServiceHelper
+                .getGlobalInstance(IBridgeDomainConfigService.class, this);
+    }
+
+    private IConnectionManager getConnectionManager() {
+        return (IConnectionManager) ServiceHelper
+                .getGlobalInstance(IConnectionManager.class, this);
+    }
+
+    /**
+     * 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.
+     * <pre>
+     * Example :
+     * Request : PUT http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/mgmt1/1.1.1.1/6634
+     * Response : Node :
+     *                  xml : &lt;node type="STUB" id="mgmt1"/&gt;
+     *                  json: {"@type": "STUB","@id": "mgmt1"}
+     *</pre>
+     * @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.
+     * @param port Layer4 Port of the management session to connect with.
+     * @return Node If the connection is successful, HTTP 404 otherwise.
+     */
+
+    @Path("/connect/{nodeName}/{ipAddress}/{port}/")
+    @PUT
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(Node.class)
+    @StatusCodes( {
+        @ResponseCode(code = 201, condition = "Node connected successfully"),
+        @ResponseCode(code = 404, condition = "Could not connect to the Node with the specified parameters"),
+        @ResponseCode(code = 406, condition = "Invalid IP Address or Port parameter passed."),
+        @ResponseCode(code = 503, condition = "Connection Manager Service not available")} )
+    public Node connect(
+            @PathParam(value = "nodeName") String nodeName,
+            @PathParam(value = "ipAddress") String ipAddress,
+            @PathParam(value = "port") String port) {
+
+        IConnectionManager connectionManager = getConnectionManager();
+        if (connectionManager == null) {
+            throw new ServiceUnavailableException("IConnectionManager not available.");
+        }
+
+        if (!NetUtils.isIPv4AddressValid(ipAddress)) {
+            throw new NotAcceptableException("Invalid ip address "+ipAddress);
+        }
+
+        try {
+            Integer.parseInt(port);
+        } catch (Exception e) {
+            throw new NotAcceptableException("Invalid Layer4 Port "+port);
+        }
+
+        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
+        params.put(ConnectionConstants.ADDRESS, ipAddress);
+        params.put(ConnectionConstants.PORT, port);
+
+        Node node = null;
+        try {
+            node = connectionManager.connect(nodeName, params);
+            if (node == null) {
+                throw new ResourceNotFoundException("Failed to connect to Node at "+ipAddress+":"+port);
+            }
+            return node;
+        } catch (Exception e) {
+            throw new ResourceNotFoundException(e.getMessage());
+        }
+    }
+
+    /**
+     * 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.
+     * <pre>
+     * Example :
+     * Request : PUT http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/STUB/mgmt1/1.1.1.1/6634
+     * Response : Node :
+     *                  xml : &lt;node type="STUB" id="mgmt1"/&gt;
+     *                  json: {"@type": "STUB","@id": "mgmt1"}
+     *</pre>
+     * @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.
+     * @param port Layer4 Port of the management session to connect with.
+     * @return Node If the connection is successful, HTTP 404 otherwise.
+     */
+
+    @Path("/connect/{nodeType}/{nodeId}/{ipAddress}/{port}/")
+    @PUT
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(Node.class)
+    @StatusCodes( {
+        @ResponseCode(code = 201, condition = "Node connected successfully"),
+        @ResponseCode(code = 404, condition = "Could not connect to the Node with the specified parameters"),
+        @ResponseCode(code = 406, condition = "Invalid IP Address or Port parameter passed."),
+        @ResponseCode(code = 503, condition = "Connection Manager Service not available")} )
+    public Node connect(
+            @PathParam(value = "nodeType") String nodeType,
+            @PathParam(value = "nodeId") String nodeId,
+            @PathParam(value = "ipAddress") String ipAddress,
+            @PathParam(value = "port") String port) {
+
+        IConnectionManager connectionManager = getConnectionManager();
+        if (connectionManager == null) {
+            throw new ServiceUnavailableException("IConnectionManager not available.");
+        }
+
+        if (!NetUtils.isIPv4AddressValid(ipAddress)) {
+            throw new NotAcceptableException("Invalid ip address "+ipAddress);
+        }
+
+        try {
+            Integer.parseInt(port);
+        } catch (Exception e) {
+            throw new NotAcceptableException("Invalid Layer4 Port "+port);
+        }
+
+        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
+        params.put(ConnectionConstants.ADDRESS, ipAddress);
+        params.put(ConnectionConstants.PORT, port);
+
+        Node node = null;
+        try {
+            node = connectionManager.connect(nodeType, nodeId, params);
+            if (node == null) {
+                throw new ResourceNotFoundException("Failed to connect to Node at "+ipAddress+":"+port);
+            }
+            return node;
+        } catch (Exception e) {
+            throw new ResourceNotFoundException(e.getMessage());
+        }
+    }
+
+    /**
+     * Create a Bridge.
+     * <pre>
+     * Example :
+     * Request : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/STUB/mgmt1/bridge1
+     *</pre>
+     * @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 for a bridge to be created.
+     */
+
+   @Path("/bridge/{nodeType}/{nodeId}/{bridgeName}")
+   @POST
+   @StatusCodes( { @ResponseCode(code = 201, condition = "Bridge created successfully"),
+       @ResponseCode(code = 404, condition = "Could not create Bridge"),
+       @ResponseCode(code = 412, condition = "Failed to create Bridge due to an exception"),
+       @ResponseCode(code = 503, condition = "Bridge Domain Configuration Service not available")} )
+
+   public Response createBridge(
+           @PathParam(value = "nodeType") String nodeType,
+           @PathParam(value = "nodeId") String nodeId,
+           @PathParam(value = "bridgeName") String name) {
+
+       IBridgeDomainConfigService configurationService = getConfigurationService();
+       if (configurationService == null) {
+           throw new ServiceUnavailableException("IBridgeDomainConfigService not available.");
+       }
+
+       Node node = Node.fromString(nodeType, nodeId);
+       Status status = null;
+       try {
+           status = configurationService.createBridgeDomain(node, name, null);
+           if (status.getCode().equals(StatusCode.SUCCESS)) {
+               return Response.status(Response.Status.CREATED).build();
+           }
+       } catch (Throwable t) {
+           return Response.status(Response.Status.PRECONDITION_FAILED).build();
+       }
+       throw new ResourceNotFoundException(status.getDescription());
+   }
+
+   /**
+    * Add a Port to a Bridge
+    * <pre>
+    * Example :
+    * Request : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port1
+    *</pre>
+    * @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.
+    * @param portName Name / Identifier of a Port that is being added to a bridge.
+    */
+
+   @Path("/port/{nodeType}/{nodeId}/{bridgeName}/{portName}")
+   @POST
+   @StatusCodes( { @ResponseCode(code = 201, condition = "Port added successfully"),
+       @ResponseCode(code = 404, condition = "Could not add Port to the Bridge"),
+       @ResponseCode(code = 412, condition = "Failed to add Port due to an exception"),
+       @ResponseCode(code = 503, condition = "Bridge Domain Configuration Service not available")} )
+
+   public Response addPort(
+           @PathParam(value = "nodeType") String nodeType,
+           @PathParam(value = "nodeId") String nodeId,
+           @PathParam(value = "bridgeName") String bridge,
+           @PathParam(value = "portName") String port) {
+
+       IBridgeDomainConfigService configurationService = getConfigurationService();
+       if (configurationService == null) {
+           throw new ServiceUnavailableException("IBridgeDomainConfigService not available.");
+       }
+
+       Node node = Node.fromString(nodeType, nodeId);
+       Status status = null;
+       try {
+           status = configurationService.addPort(node, bridge, port, null);
+           if (status.getCode().equals(StatusCode.SUCCESS)) {
+               return Response.status(Response.Status.CREATED).build();
+           }
+       } catch (Throwable t) {
+           return Response.status(Response.Status.PRECONDITION_FAILED).build();
+       }
+       throw new ResourceNotFoundException(status.getDescription());
+   }
+
+   /**
+    * Add a Port,Vlan to a Bridge
+    * <pre>
+    * Example :
+    * Request : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port2/200
+    *</pre>
+    * @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.
+    * @param portName Name / Identifier of a Port that is being added to a bridge.
+    * @param vlan Vlan Id.
+    */
+
+   @Path("/port/{nodeType}/{nodeId}/{bridgeName}/{portName}/{vlan}")
+   @POST
+   @StatusCodes( { @ResponseCode(code = 201, condition = "Created Port with Vlan tag successfully"),
+       @ResponseCode(code = 404, condition = "Could not add Port,Vlan to the Bridge"),
+       @ResponseCode(code = 406, condition = "Invalid Vlan parameter passed."),
+       @ResponseCode(code = 412, condition = "Failed to add Port,Vlan due to an exception"),
+       @ResponseCode(code = 503, condition = "Bridge Domain Configuration Service not available")} )
+
+   public Response addPort(
+           @PathParam(value = "nodeType") String nodeType,
+           @PathParam(value = "nodeId") String nodeId,
+           @PathParam(value = "bridgeName") String bridge,
+           @PathParam(value = "portName") String port,
+           @PathParam(value = "vlan") String vlan) {
+
+       IBridgeDomainConfigService configurationService = getConfigurationService();
+       if (configurationService == null) {
+           throw new ServiceUnavailableException("IBridgeDomainConfigService not available.");
+       }
+       try {
+           Integer.parseInt(vlan);
+       } catch (Exception e) {
+           throw new NotAcceptableException("Incorrect Vlan :"+vlan);
+       }
+
+       Node node = Node.fromString(nodeType, nodeId);
+       Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
+       configs.put(ConfigConstants.TYPE, ConfigConstants.VLAN);
+       configs.put(ConfigConstants.VLAN, vlan);
+
+       Status status = null;
+       try {
+       status = configurationService.addPort(node, bridge, port, configs);
+       if (status.getCode().equals(StatusCode.SUCCESS)) {
+           return Response.status(Response.Status.CREATED).build();
+       }
+       } catch (Exception e) {
+           return Response.status(Response.Status.PRECONDITION_FAILED).build();
+       }
+       throw new ResourceNotFoundException(status.getDescription());
+   }
+}
diff --git a/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthboundApplication.java b/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthboundApplication.java
new file mode 100644 (file)
index 0000000..1d1fd15
--- /dev/null
@@ -0,0 +1,30 @@
+
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.bridgedomain.northbound;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.ws.rs.core.Application;
+
+/**
+ * Instance of javax.ws.rs.core.Application used to return the classes
+ * that will be instantiated for JAXRS processing, this is necessary
+ * because the package scanning in jersey doesn't yet work in OSGi
+ * environment.
+ *
+ */
+public class BridgeDomainNorthboundApplication extends Application {
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        classes.add(BridgeDomainNorthbound.class);
+        return classes;
+    }
+}
diff --git a/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/resources/WEB-INF/web.xml b/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/resources/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..b7f35c3
--- /dev/null
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+        version="3.0">
+  <servlet>
+    <servlet-name>BridgeDomainConfiguration</servlet-name>
+    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.opendaylight.controller.networkconfig.bridgedomain.northbound.BridgeDomainNorthboundApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+        <servlet-mapping>
+                <servlet-name>BridgeDomainConfiguration</servlet-name>
+                <url-pattern>/*</url-pattern>
+        </servlet-mapping>
+
+        <security-constraint>
+                <web-resource-collection>
+                        <web-resource-name>BridgeDomain Configuration NorthBound API</web-resource-name>
+                        <url-pattern>/*</url-pattern>
+                </web-resource-collection>
+                <auth-constraint>
+                        <role-name>System-Admin</role-name>
+                        <role-name>Network-Admin</role-name>
+                        <role-name>Network-Operator</role-name>
+                        <role-name>Container-User</role-name>
+                </auth-constraint>
+        </security-constraint>
+
+        <security-role>
+                <role-name>System-Admin</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Network-Admin</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Network-Operator</role-name>
+        </security-role>
+        <security-role>
+                <role-name>Container-User</role-name>
+        </security-role>
+
+        <login-config>
+                <auth-method>BASIC</auth-method>
+                <realm-name>opendaylight</realm-name>
+        </login-config>
+
+</web-app>
\ No newline at end of file