ONOS-3692 Southbound Rest provider and protocol

Change-Id: I74a5752d4fce1df88828fa6c531979ab7c30a26a
t
diff --git a/protocols/pom.xml b/protocols/pom.xml
index a4e3faa..4daacfe 100644
--- a/protocols/pom.xml
+++ b/protocols/pom.xml
@@ -37,6 +37,7 @@
         <module>pcep</module>
         <module>ovsdb</module>
         <module>bgp</module>
+        <module>rest</module>
     </modules>
 
     <dependencies>
diff --git a/protocols/rest/api/pom.xml b/protocols/rest/api/pom.xml
new file mode 100644
index 0000000..6e50a4e
--- /dev/null
+++ b/protocols/rest/api/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016 Open Networking Laboratory
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<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>
+        <artifactId>onos-restsb</artifactId>
+        <groupId>org.onosproject</groupId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-restsb-api</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>ONOS Rest southbound plugin API</description>
+
+
+
+</project>
\ No newline at end of file
diff --git a/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/DefaultRestSBDevice.java b/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/DefaultRestSBDevice.java
new file mode 100644
index 0000000..baf26cb
--- /dev/null
+++ b/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/DefaultRestSBDevice.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.protocol.rest;
+
+import com.google.common.base.Preconditions;
+import org.onlab.packet.IpAddress;
+import org.onosproject.net.DeviceId;
+
+import java.util.Objects;
+
+/**
+ * Default implementation for Rest devices.
+ */
+public class DefaultRestSBDevice implements RestSBDevice {
+    private static final String REST = "rest";
+    private static final String COLON = ":";
+    private final IpAddress ip;
+    private final int port;
+    private final String name;
+    private final String password;
+    private boolean isActive;
+    private String protocol;
+
+    public DefaultRestSBDevice(IpAddress ip, int port, String name, String password,
+                               String protocol, boolean isActive) {
+        Preconditions.checkNotNull(ip, "IP address cannot be null");
+        Preconditions.checkArgument(port > 0, "Port address cannot be negative");
+        Preconditions.checkNotNull(protocol, "protocol address cannot be null");
+        this.ip = ip;
+        this.port = port;
+        this.name = name;
+        this.password = password;
+        this.isActive = isActive;
+        this.protocol = protocol;
+    }
+
+    @Override
+    public IpAddress ip() {
+        return ip;
+    }
+
+    @Override
+    public int port() {
+        return port;
+    }
+
+    @Override
+    public String name() {
+        return name;
+    }
+
+    @Override
+    public String password() {
+        return password;
+    }
+
+    @Override
+    public DeviceId deviceId() {
+        return DeviceId.deviceId(REST + COLON + ip + COLON + port);
+    }
+
+    @Override
+    public void setActive(boolean active) {
+        isActive = active;
+    }
+
+    @Override
+    public boolean isActive() {
+        return isActive;
+    }
+
+    @Override
+    public String protocol() {
+        return protocol;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        }
+        if (!(obj instanceof RestSBDevice)) {
+            return false;
+        }
+        RestSBDevice device = (RestSBDevice) obj;
+        return this.name.equals(device.name()) && this.ip.equals(device.ip()) &&
+                this.port == device.port();
+
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(ip, port);
+    }
+
+}
diff --git a/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/RestSBController.java b/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/RestSBController.java
new file mode 100644
index 0000000..28d5617
--- /dev/null
+++ b/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/RestSBController.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.protocol.rest;
+
+import org.onlab.packet.IpAddress;
+import org.onosproject.net.DeviceId;
+
+import java.io.InputStream;
+import java.util.Map;
+
+/**
+ * Abstraction of an REST controller. Serves as a one stop shop for obtaining
+ * Rest southbound devices and (un)register listeners.
+ */
+public interface RestSBController {
+
+    /**
+     * Returns all the devices known to this controller.
+     *
+     * @return map of devices
+     */
+    Map<DeviceId, RestSBDevice> getDevices();
+
+    /**
+     * Returns a device by node identifier.
+     *
+     * @param deviceInfo node identifier
+     * @return RestSBDevice rest device
+     */
+    RestSBDevice getDevice(DeviceId deviceInfo);
+
+    /**
+     * Returns a device by Ip and Port.
+     *
+     * @param ip   device ip
+     * @param port device port
+     * @return RestSBDevice rest device
+     */
+    RestSBDevice getDevice(IpAddress ip, int port);
+
+    /**
+     * Adds a device to the device map.
+     *
+     * @param device to be added
+     */
+    void addDevice(RestSBDevice device);
+
+    /**
+     * Removes the device from the devices map.
+     *
+     * @param device to be removed
+     */
+    void removeDevice(RestSBDevice device);
+
+    /**
+     * Does a REST POST request with specified parameters to the device.
+     *
+     * @param device    device to make the request to
+     * @param request   url of the request
+     * @param payload   payload of the request as an InputStream
+     * @param mediaType type of content in the payload i.e. application/json
+     * @return true if operation returned 200, 201, 202, false otherwise
+     */
+    boolean post(DeviceId device, String request, InputStream payload, String mediaType);
+
+    /**
+     * Does a REST PUT request with specified parameters to the device.
+     *
+     * @param device    device to make the request to
+     * @param request   resource path of the request
+     * @param payload   payload of the request as an InputStream
+     * @param mediaType type of content in the payload i.e. application/json
+     * @return true if operation returned 200, 201, 202, false otherwise
+     */
+    boolean put(DeviceId device, String request, InputStream payload, String mediaType);
+
+    /**
+     * Does a REST GET request with specified parameters to the device.
+     *
+     * @param device  device to make the request to
+     * @param request url of the request
+     * @param mediaType format to retrieve the content in
+     * @return an inputstream of data from the reply.
+     */
+    InputStream get(DeviceId device, String request, String mediaType);
+
+    /**
+     * Does a REST DELETE request with specified parameters to the device.
+     *
+     * @param device    device to make the request to
+     * @param request   url of the request
+     * @param payload   payload of the request as an InputStream
+     * @param mediaType type of content in the payload i.e. application/json
+     * @return true if operation returned 200 false otherwise
+     */
+    boolean delete(DeviceId device, String request, InputStream payload, String mediaType);
+
+}
diff --git a/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/RestSBDevice.java b/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/RestSBDevice.java
new file mode 100644
index 0000000..6b76989
--- /dev/null
+++ b/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/RestSBDevice.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.protocol.rest;
+
+import org.onlab.packet.IpAddress;
+import org.onosproject.net.DeviceId;
+
+/**
+ * Represents an abstraction of a Rest Device in ONOS.
+ */
+public interface RestSBDevice {
+    /**
+     * Returns the ip of this device.
+     *
+     * @return ip
+     */
+    IpAddress ip();
+
+    /**
+     * Returns the password of this device.
+     *
+     * @return port
+     */
+    int port();
+
+    /**
+     * Returns the name of this device.
+     *
+     * @return name
+     */
+    String name();
+
+    /**
+     * Returns the password of this device.
+     *
+     * @return password
+     */
+    String password();
+
+    /**
+     * Returns the ONOS deviceID for this device.
+     *
+     * @return DeviceId
+     */
+    DeviceId deviceId();
+
+    /**
+     * Sets or unsets the state of the device.
+     *
+     * @param active boolean
+     */
+    void setActive(boolean active);
+
+    /**
+     * Returns the state of this device.
+     *
+     * @return state
+     */
+    boolean isActive();
+
+    /**
+     * Returns the protocol for the REST request, usually HTTP o HTTPS.
+     *
+     * @return protocol
+     */
+    String protocol();
+
+}
diff --git a/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/package-info.java b/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/package-info.java
new file mode 100644
index 0000000..a2ad7b6
--- /dev/null
+++ b/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * REST southbound protocols libraries.
+ */
+package org.onosproject.protocol.rest;
diff --git a/protocols/rest/ctl/pom.xml b/protocols/rest/ctl/pom.xml
new file mode 100644
index 0000000..bce280e
--- /dev/null
+++ b/protocols/rest/ctl/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016 Open Networking Laboratory
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<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">
+    <parent>
+        <artifactId>onos-restsb</artifactId>
+        <groupId>org.onosproject</groupId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>onos-restsb-ctl</artifactId>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-restsb-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>
\ No newline at end of file
diff --git a/protocols/rest/ctl/src/main/java/org/onosproject/protocol/rest/ctl/RestSBControllerImpl.java b/protocols/rest/ctl/src/main/java/org/onosproject/protocol/rest/ctl/RestSBControllerImpl.java
new file mode 100644
index 0000000..66f2530
--- /dev/null
+++ b/protocols/rest/ctl/src/main/java/org/onosproject/protocol/rest/ctl/RestSBControllerImpl.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.protocol.rest.ctl;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+import org.apache.commons.io.IOUtils;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.packet.IpAddress;
+import org.onosproject.net.DeviceId;
+import org.onosproject.protocol.rest.RestSBController;
+import org.onosproject.protocol.rest.RestSBDevice;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * The implementation of RestSBController.
+ */
+@Component(immediate = true)
+@Service
+public class RestSBControllerImpl implements RestSBController {
+
+    private static final Logger log =
+            LoggerFactory.getLogger(RestSBControllerImpl.class);
+    private static final String APPLICATION = "application/";
+    private static final String XML = "xml";
+    private static final String JSON = "json";
+    private static final String DOUBLESLASH = "//";
+    private static final String COLON = ":";
+    private static final int STATUS_OK = Response.Status.OK.getStatusCode();
+    private static final int STATUS_CREATED = Response.Status.CREATED.getStatusCode();
+    private static final int STATUS_ACCEPTED = Response.Status.ACCEPTED.getStatusCode();
+    private static final String SLASH = "/";
+
+    private final Map<DeviceId, RestSBDevice> deviceMap = new ConcurrentHashMap<>();
+    Client client;
+
+    @Activate
+    public void activate(ComponentContext context) {
+        client = Client.create();
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        deviceMap.clear();
+        log.info("Stopped");
+    }
+
+    @Override
+    public Map<DeviceId, RestSBDevice> getDevices() {
+        return deviceMap;
+    }
+
+    @Override
+    public RestSBDevice getDevice(DeviceId deviceInfo) {
+        return deviceMap.get(deviceInfo);
+    }
+
+    @Override
+    public RestSBDevice getDevice(IpAddress ip, int port) {
+        for (DeviceId info : deviceMap.keySet()) {
+            if (IpAddress.valueOf(info.uri().getHost()).equals(ip) &&
+                    info.uri().getPort() == port) {
+                return deviceMap.get(info);
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public void addDevice(RestSBDevice device) {
+        deviceMap.put(device.deviceId(), device);
+    }
+
+    @Override
+    public void removeDevice(RestSBDevice device) {
+        deviceMap.remove(device.deviceId());
+    }
+
+    @Override
+    public boolean post(DeviceId device, String request, InputStream payload, String mediaType) {
+        WebResource webResource = getWebResource(device, request);
+
+        ClientResponse response = null;
+        if (payload != null) {
+            try {
+                response = webResource.accept(mediaType)
+                        .post(ClientResponse.class, IOUtils.toString(payload, StandardCharsets.UTF_8));
+            } catch (IOException e) {
+                log.error("Cannot do POST {} request on device {} because can't read payload",
+                          request, device);
+            }
+        } else {
+            response = webResource.accept(mediaType)
+                    .post(ClientResponse.class);
+        }
+        return checkReply(response);
+    }
+
+    @Override
+    public boolean put(DeviceId device, String request, InputStream payload, String mediaType) {
+        WebResource webResource = getWebResource(device, request);
+        ClientResponse response = null;
+        if (payload != null) {
+            try {
+                response = webResource.accept(mediaType)
+                        .put(ClientResponse.class, IOUtils.toString(payload, StandardCharsets.UTF_8));
+            } catch (IOException e) {
+                log.error("Cannot do PUT {} request on device {} because can't read payload",
+                          request, device);
+            }
+        } else {
+            response = webResource.accept(mediaType)
+                    .put(ClientResponse.class);
+        }
+        return checkReply(response);
+    }
+
+    @Override
+    public InputStream get(DeviceId device, String request, String mediaType) {
+        WebResource webResource = getWebResource(device, request);
+        String type;
+        switch (mediaType) {
+            case XML:
+                type = MediaType.APPLICATION_XML;
+                break;
+            case JSON:
+                type = MediaType.APPLICATION_JSON;
+                break;
+            default:
+                throw new IllegalArgumentException("Unsupported media type " + mediaType);
+
+        }
+        return new ByteArrayInputStream(webResource.accept(type).get(ClientResponse.class)
+                                                .getEntity(String.class)
+                                                .getBytes(StandardCharsets.UTF_8));
+    }
+
+    @Override
+    public boolean delete(DeviceId device, String request, InputStream payload, String mediaType) {
+        WebResource webResource = getWebResource(device, request);
+        ClientResponse response = null;
+        if (payload != null) {
+            try {
+                response = webResource.accept(mediaType)
+                        .delete(ClientResponse.class, IOUtils.toString(payload, StandardCharsets.UTF_8));
+            } catch (IOException e) {
+                log.error("Cannot do PUT {} request on device {} because can't read payload",
+                          request, device);
+            }
+        } else {
+            response = webResource.accept(mediaType)
+                    .delete(ClientResponse.class);
+        }
+        return checkReply(response);
+    }
+
+    private WebResource getWebResource(DeviceId device, String request) {
+        return Client.create().resource(deviceMap.get(device).protocol() + COLON +
+                                                DOUBLESLASH +
+                                                deviceMap.get(device).ip().toString() +
+                                                COLON + deviceMap.get(device).port() +
+                                                SLASH + request);
+    }
+
+    private boolean checkReply(ClientResponse response) {
+        if (response != null) {
+            if (response.getStatus() == STATUS_OK ||
+                    response.getStatus() == STATUS_CREATED ||
+                    response.getStatus() == STATUS_ACCEPTED) {
+                return true;
+            } else {
+                log.error("Failed request: HTTP error code : "
+                                  + response.getStatus());
+                return false;
+            }
+        }
+        log.error("Null reply from device");
+        return false;
+    }
+}
diff --git a/protocols/rest/ctl/src/main/java/org/onosproject/protocol/rest/ctl/package-info.java b/protocols/rest/ctl/src/main/java/org/onosproject/protocol/rest/ctl/package-info.java
new file mode 100644
index 0000000..238e9d4
--- /dev/null
+++ b/protocols/rest/ctl/src/main/java/org/onosproject/protocol/rest/ctl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * NETCONF libraries.
+ */
+package org.onosproject.protocol.rest.ctl;
diff --git a/protocols/rest/pom.xml b/protocols/rest/pom.xml
new file mode 100644
index 0000000..a0c7200
--- /dev/null
+++ b/protocols/rest/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016 Open Networking Laboratory
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<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">
+    <parent>
+        <artifactId>onos-protocols</artifactId>
+        <groupId>org.onosproject</groupId>
+        <version>1.5.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>onos-restsb</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>api</module>
+        <module>ctl</module>
+    </modules>
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+
+</project>
\ No newline at end of file