Separated OpenstackInterface feature from OpenstackNetworking application.

Change-Id: I4766de7e93c5b432c50a2167b9a9d9d4605b1ad2
diff --git a/apps/openstackinterface/api/pom.xml b/apps/openstackinterface/api/pom.xml
new file mode 100644
index 0000000..0cb43e3
--- /dev/null
+++ b/apps/openstackinterface/api/pom.xml
@@ -0,0 +1,49 @@
+<?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>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-app-openstackinterface</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-openstackinterface-api</artifactId>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-core-serializers</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>
+
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackExternalGateway.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackExternalGateway.java
new file mode 100644
index 0000000..ee4c59e
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackExternalGateway.java
@@ -0,0 +1,145 @@
+/*
+ * 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.openstackinterface;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import org.onlab.packet.Ip4Address;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * A configurable external gateway modes extension model in openstack router.
+ */
+public final class OpenstackExternalGateway {
+
+    private final String networkId;
+    private final boolean enablePnat;
+    private final Map<String, Ip4Address> externalFixedIps;
+
+    private OpenstackExternalGateway(String networkId, boolean enablePnat,
+                                     Map<String, Ip4Address> externalFixedIps) {
+        this.networkId = networkId;
+        this.enablePnat = enablePnat;
+        this.externalFixedIps = externalFixedIps;
+    }
+
+    /**
+     * Returns network ID.
+     *
+     * @return Network ID
+     */
+    public String networkId() {
+        return networkId;
+    }
+
+    /**
+     * Returns the PNAT status for external gateway.
+     *
+     * @return PNAT status
+     */
+    public boolean isEnablePnat() {
+        return enablePnat;
+    }
+
+    /**
+     * Returns external fixed IP informations.
+     *
+     * @return External fixed IP informations
+     */
+    public Map<String, Ip4Address> externalFixedIps() {
+        return ImmutableMap.copyOf(externalFixedIps);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (o instanceof OpenstackExternalGateway) {
+            OpenstackExternalGateway that = (OpenstackExternalGateway) o;
+
+            return this.networkId.equals(that.networkId) &&
+                    this.enablePnat == that.enablePnat &&
+                    this.externalFixedIps.equals(that.externalFixedIps);
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(networkId, enablePnat, externalFixedIps);
+    }
+
+    /**
+     * An Openstack External Gateway Builder class.
+     */
+    public static final class Builder {
+        private String networkId;
+        private boolean enablePnat;
+        private Map<String, Ip4Address> externalFixedIps;
+
+        public Builder() {
+            externalFixedIps = Maps.newHashMap();
+        }
+
+        /**
+         * Sets network ID.
+         *
+         * @param networkId Network ID
+         * @return Builder object
+         */
+        public Builder networkId(String networkId) {
+            this.networkId = networkId;
+            return this;
+        }
+
+        /**
+         * Sets whether PNAT status is enabled or not.
+         *
+         * @param enablePnat true if PNAT status is enabled, false otherwise
+         * @return Builder object
+         */
+        public Builder enablePnat(boolean enablePnat) {
+            this.enablePnat = enablePnat;
+            return this;
+        }
+
+        /**
+         * Sets external fixed IP address information.
+         *
+         * @param externalFixedIps External fixed IP information
+         * @return Builder object
+         */
+
+        public Builder externalFixedIps(Map<String, Ip4Address> externalFixedIps) {
+            this.externalFixedIps.putAll(externalFixedIps);
+            return this;
+        }
+
+        /**
+         * Builds an OpenstackExternalGateway object.
+         *
+         * @return OpenstackExternalGateway object
+         */
+        public OpenstackExternalGateway build() {
+            return new OpenstackExternalGateway(networkId, enablePnat, ImmutableMap.copyOf(externalFixedIps));
+        }
+    }
+
+}
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackFloatingIP.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackFloatingIP.java
new file mode 100644
index 0000000..4726254
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackFloatingIP.java
@@ -0,0 +1,287 @@
+/*
+ * 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.openstackinterface;
+
+import org.onlab.packet.Ip4Address;
+
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ *  An Openstack Neutron Floating IP Model.
+ */
+public final class OpenstackFloatingIP {
+
+    public enum FloatingIpStatus {
+        UP,
+        DOWN,
+        ACTIVE,
+    }
+
+    private final String tenantId;
+    private final String networkId;
+    private final Ip4Address fixedIpAddress;
+    private String portId;
+    private String routerId;
+    private final String id;
+    private final Ip4Address floatingIpAddress;
+    private final FloatingIpStatus status;
+
+    private OpenstackFloatingIP(FloatingIpStatus status, String id, String tenantId,
+                                String networkId, Ip4Address fixedIpAddress, String portId,
+                                String routerId, Ip4Address floatingIpAddress) {
+        this.status = status;
+        this.id = id;
+        this.tenantId = tenantId;
+        this.networkId = networkId;
+        this.fixedIpAddress = fixedIpAddress;
+        this.portId = portId;
+        this.routerId = routerId;
+        this.floatingIpAddress = floatingIpAddress;
+    }
+
+    /**
+     * Returns floating IP status.
+     *
+     * @return floating IP status
+     */
+    public FloatingIpStatus status() {
+        return status;
+    }
+
+    /**
+     * Returns floating IP`s ID.
+     *
+     * @return floating IP`s ID
+     */
+    public String id() {
+        return id;
+    }
+
+    /**
+     * Returns tenant ID.
+     *
+     * @return tenant ID
+     */
+    public String tenantId() {
+        return tenantId;
+    }
+
+    /**
+     * Returns network ID.
+     *
+     * @return network ID
+     */
+    public String networkId() {
+        return networkId;
+    }
+
+    /**
+     * Returns fixed IP Address.
+     *
+     * @return fixed IP Address
+     */
+    public Ip4Address fixedIpAddress() {
+        return fixedIpAddress;
+    }
+
+    /**
+     * Returns port ID.
+     *
+     * @return port ID
+     */
+    public String portId() {
+        return portId;
+    }
+
+    /**
+     * Updates port ID.
+     *
+     * @param portId Updated port ID
+     */
+    public void updatePortId(String portId) {
+        this.portId = portId;
+    }
+
+    /**
+     * Returns router ID.
+     *
+     * @return router ID
+     */
+    public String routerId() {
+        return routerId;
+    }
+
+    /**
+     * Updates router ID.
+     *
+     * @param routerId Updated router ID
+     */
+    public void updateRouterId(String routerId) {
+        this.routerId = routerId;
+    }
+
+    /**
+     * Returns floating IP address.
+     *
+     * @return Floating IP address
+     */
+    public Ip4Address floatingIpAddress() {
+        return floatingIpAddress;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (o instanceof  OpenstackFloatingIP) {
+            OpenstackFloatingIP that = (OpenstackFloatingIP) o;
+
+            return this.status.equals(that.status) &&
+                    this.id.equals(that.id) &&
+                    this.tenantId.equals(that.tenantId) &&
+                    this.networkId.equals(that.networkId) &&
+                    this.fixedIpAddress.equals(that.fixedIpAddress) &&
+                    this.floatingIpAddress.equals(that.floatingIpAddress) &&
+                    this.portId.equals(that.portId) &&
+                    this.routerId.equals(that.routerId);
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(status, id, tenantId, networkId, floatingIpAddress, fixedIpAddress, portId, routerId);
+    }
+
+    /**
+     * An Openstack Floating IP Builder class.
+     */
+    public static final class Builder {
+        private String tenantId;
+        private String networkId;
+        private Ip4Address fixedIpAddress;
+        private String portId;
+        private String routerId;
+        private String id;
+        private Ip4Address floatingIpAddress;
+        private FloatingIpStatus status;
+
+        /**
+         * Sets tenant ID.
+         *
+         * @param tenantId tenant ID
+         * @return Builder object
+         */
+        public Builder tenantId(String tenantId) {
+            this.tenantId = tenantId;
+            return this;
+        }
+
+        /**
+         * Sets floating IP status.
+         *
+         * @param status Floating IP status
+         * @return Builder object
+         */
+        public Builder status(FloatingIpStatus status) {
+            this.status = status;
+            return this;
+        }
+
+        /**
+         * Sets Floating IP`s ID.
+         *
+         * @param id Floating IP`s ID
+         * @return Builder object
+         */
+        public Builder id(String id) {
+            this.id = id;
+            return this;
+        }
+
+        /**
+         * Sets network ID.
+         *
+         * @param networkId Network ID
+         * @return Builder object
+         */
+        public Builder networkId(String networkId) {
+            this.networkId = networkId;
+            return this;
+        }
+
+        /**
+         * Sets fixed IP address.
+         *
+         * @param fixedIpAddress Fixed IP address
+         * @return Builder object
+         */
+        public Builder fixedIpAddress(Ip4Address fixedIpAddress) {
+            this.fixedIpAddress = fixedIpAddress;
+            return this;
+        }
+
+        /**
+         * Sets port ID.
+         *
+         * @param portId port ID
+         * @return Builder object
+         */
+        public Builder portId(String portId) {
+            this.portId = portId;
+            return this;
+        }
+
+        /**
+         * Sets router ID.
+         *
+         * @param routerId router ID
+         * @return Builder object
+         */
+        public Builder routerId(String routerId) {
+            this.routerId = routerId;
+            return this;
+        }
+
+        /**
+         * Sets floating IP address.
+         *
+         * @param floatingIpAddress Floating IP address
+         * @return Builder object
+         */
+        public Builder floatingIpAddress(Ip4Address floatingIpAddress) {
+            this.floatingIpAddress = floatingIpAddress;
+            return this;
+        }
+
+        /**
+         * Builds an OpenstackFloatingIP object.
+         *
+         * @return OpenstackFloatingIP object
+         */
+        public OpenstackFloatingIP build() {
+            return new OpenstackFloatingIP(checkNotNull(status), checkNotNull(id), checkNotNull(tenantId),
+                    checkNotNull(networkId), fixedIpAddress, portId,
+                    routerId, checkNotNull(floatingIpAddress));
+
+        }
+    }
+}
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackInterfaceService.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackInterfaceService.java
new file mode 100644
index 0000000..f565fb2
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackInterfaceService.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2015-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.openstackinterface;
+
+import org.onosproject.net.Port;
+
+import java.util.Collection;
+
+/**
+ * Handles port management REST API from Openstack for VMs.
+ */
+public interface OpenstackInterfaceService {
+
+    /**
+     * Returns port information list for the network ID given.
+     *
+     * @param networkId Network ID of the ports
+     * @return port information list
+     */
+    Collection<OpenstackPort> ports(String networkId);
+
+    /**
+     * Returns port information list.
+     *
+     * @return port information list
+     */
+    Collection<OpenstackPort> ports();
+    /**
+     * Returns port information for the port given.
+     *
+     * @param port port reference
+     * @return port information
+     */
+    OpenstackPort port(Port port);
+
+    /**
+     * Returns port information for the port ID given.
+     *
+     * @param portId Port ID
+     * @return port information
+     */
+    OpenstackPort port(String portId);
+
+    /**
+     * Returns network information list for the network ID given.
+     *
+     * @param networkId Network ID
+     * @return network information, or null if not present
+     */
+    OpenstackNetwork network(String networkId);
+
+    /**
+     * Returns the information of all openstack networks.
+     *
+     * @return collection of network information
+     */
+    Collection<OpenstackNetwork> networks();
+
+    /**
+     * Returns subnet information for the subnet ID give.
+     *
+     * @param subnetId Subnet ID
+     * @return subnet information, or null if not present
+     */
+    OpenstackSubnet subnet(String subnetId);
+
+    /**
+     * Returns collection of openstack subnet information.
+     *
+     * @return collection of openststack subnet information
+     */
+    Collection<OpenstackSubnet> subnets();
+
+    /**
+     * Returns the router information list.
+     *
+     * @return router information list
+     */
+    Collection<OpenstackRouter> routers();
+
+    /**
+     * Returns the router information for the router ID given.
+     *
+     * @param routerId router ID
+     * @return router information
+     */
+    OpenstackRouter router(String routerId);
+
+    /**
+     * Returns Security Group information of the security groupd id given.
+     *
+     * @param id security group id
+     * @return security group information
+     */
+    OpenstackSecurityGroup getSecurityGroup(String id);
+
+}
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackNetwork.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackNetwork.java
new file mode 100644
index 0000000..e36ef42
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackNetwork.java
@@ -0,0 +1,138 @@
+/*
+ * 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.openstackinterface;
+
+import java.util.Collection;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+
+/**
+ * Represents the network information given by Neutron.
+ */
+public final class OpenstackNetwork {
+
+    private String name;
+    private String tenantId;
+    private String segmentId;
+    private String id;
+    private NetworkType networkType;
+    private Collection<OpenstackSubnet> subnets;
+
+    public enum NetworkType {
+        /**
+         * Currently only VXLAN moded is supported.
+         */
+        VXLAN
+    }
+
+    /**
+     * Returns the builder object of the OpenstackNetwork class.
+     *
+     * @return OpenstackNetwork builder object
+     */
+    public static OpenstackNetwork.Builder builder() {
+        return new Builder();
+    }
+
+    private OpenstackNetwork(String name, String tenantId, String id, String sid,
+                             NetworkType type, Collection<OpenstackSubnet> subnets) {
+        this.name = checkNotNull(name);
+        this.tenantId = checkNotNull(tenantId);
+        this.segmentId = checkNotNull(sid);
+        this.id = checkNotNull(id);
+        this.networkType = type;
+        this.subnets = subnets;
+    }
+
+    public String name() {
+        return this.name;
+    }
+
+    public String tenantId() {
+        return this.tenantId;
+    }
+
+    public String id() {
+        return this.id;
+    }
+
+    public String segmentId() {
+        return this.segmentId;
+    }
+
+    public NetworkType networkType() {
+        return this.networkType;
+    }
+
+    public Collection<OpenstackSubnet> subnets() {
+        return this.subnets;
+    }
+
+    @Override
+    protected Object clone() throws CloneNotSupportedException {
+       return super.clone();
+    }
+
+    public static final class Builder {
+        private String name;
+        private String tenantId;
+        private String id;
+        private String sid;
+        private NetworkType networkType;
+        private Collection<OpenstackSubnet> subnets;
+
+        public Builder name(String name) {
+            this.name = name;
+
+            return this;
+        }
+
+        public Builder tenantId(String tenantId) {
+            this.tenantId = tenantId;
+
+            return this;
+        }
+
+        public Builder id(String id) {
+            this.id = id;
+
+            return this;
+        }
+
+        public Builder segmentId(String sid) {
+            this.sid = sid;
+
+            return this;
+        }
+
+        public Builder networkType(NetworkType type) {
+            this.networkType = type;
+
+            return this;
+        }
+
+        public Builder subnets(Collection<OpenstackSubnet> subnets) {
+            this.subnets = subnets;
+
+            return this;
+        }
+
+        public OpenstackNetwork build() {
+            return new OpenstackNetwork(name, tenantId, id, sid, networkType, subnets);
+        }
+    }
+}
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackNetworkingConfig.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackNetworkingConfig.java
new file mode 100644
index 0000000..042112d
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackNetworkingConfig.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2015-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.openstackinterface;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.config.basics.BasicElementConfig;
+
+/**
+ * Handles configuration for OpenstackSwitching app.
+ */
+public class OpenstackNetworkingConfig extends Config<ApplicationId> {
+    public static final String NEUTRON_SERVER = "neutron_server";
+    public static final String KEYSTONE_SERVER = "keystone_server";
+    public static final String USER_NAME = "user_name";
+    public static final String PASSWORD = "password";
+    public static final String PHYSICAL_ROUTER_MAC = "physicalRouterMac";
+
+    /**
+     * Returns the Neutron server IP address.
+     *
+     * @return Neutron server IP
+     */
+    public String neutronServer() {
+        return get(NEUTRON_SERVER, "");
+    }
+
+    /**
+     * Returns the Keystone server IP address.
+     *
+     * @return Keystone server IP
+     */
+    public String keystoneServer() {
+        return get(KEYSTONE_SERVER, "");
+    }
+
+    /**
+     * Returns the username for openstack.
+     *
+     * @return username for openstack
+     */
+    public String userName() {
+        return get(USER_NAME, "");
+    }
+
+    /**
+     * Returns the password for openstack.
+     *
+     * @return password for openstack
+     */
+    public String password() {
+        return get(PASSWORD, "");
+    }
+
+    /**
+     * Returns the MacAddress for physical router.
+     *
+     * @return physical router mac
+     */
+    public String physicalRouterMac() {
+        return get(PHYSICAL_ROUTER_MAC, "");
+    }
+
+    /**
+     * Sets the neutron server IP address.
+     *
+     * @param url neutron server IP address
+     * @return itself
+     */
+    public BasicElementConfig neutronServer(String url) {
+        return (BasicElementConfig) setOrClear(NEUTRON_SERVER, url);
+    }
+
+    /**
+     * Sets the keystone server IP address.
+     *
+     * @param url keystone server IP address
+     * @return itself
+     */
+    public BasicElementConfig keystoneServer(String url) {
+        return (BasicElementConfig) setOrClear(KEYSTONE_SERVER, url);
+    }
+
+    /**
+     * Sets the username for openstack.
+     *
+     * @param username user name for openstack
+     * @return itself
+     */
+    public BasicElementConfig userName(String username) {
+        return (BasicElementConfig) setOrClear(USER_NAME, username);
+    }
+
+    /**
+     * Sets the password for openstack.
+     *
+     * @param password password for openstack
+     * @return itself
+     */
+    public BasicElementConfig password(String password) {
+        return (BasicElementConfig) setOrClear(PASSWORD, password);
+    }
+}
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackPort.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackPort.java
new file mode 100644
index 0000000..68fa3c9
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackPort.java
@@ -0,0 +1,361 @@
+/*
+ * 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.openstackinterface;
+
+import com.google.common.collect.Maps;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * It represents the Openstack Port information.
+ */
+public final class OpenstackPort {
+
+    public enum PortStatus {
+        UP,
+        DOWN,
+        ACTIVE,
+        NA,
+    }
+
+    private PortStatus status;
+    private String name;
+    private Map<IpAddress, MacAddress> allowedAddressPairs;
+    private boolean adminStateUp;
+    private String networkId;
+    private String tenantId;
+    private String deviceOwner;
+    private MacAddress macAddress;
+    // <subnet id, ip address>
+    private HashMap<String, Ip4Address> fixedIps;
+    private String id;
+    private Collection<String> securityGroups;
+    private String deviceId;
+
+    private OpenstackPort(PortStatus status, String name, Map<IpAddress, MacAddress> allowedAddressPairs,
+                          boolean adminStateUp, String networkId, String tenantId,
+                          String deviceOwner, MacAddress macAddress, HashMap fixedIps,
+                          String id, Collection<String> securityGroups, String deviceId) {
+        this.status = status;
+        this.name = name;
+        this.allowedAddressPairs = checkNotNull(allowedAddressPairs);
+        this.adminStateUp = adminStateUp;
+        this.networkId = checkNotNull(networkId);
+        this.tenantId = checkNotNull(tenantId);
+        this.deviceOwner = deviceOwner;
+        this.macAddress = checkNotNull(macAddress);
+        this.fixedIps = checkNotNull(fixedIps);
+        this.id = checkNotNull(id);
+        this.securityGroups = securityGroups;
+        this.deviceId = deviceId;
+    }
+
+
+
+    /**
+     * Returns OpenstackPort builder object.
+     *
+     * @return OpenstackPort builder
+     */
+    public static OpenstackPort.Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Returns port status.
+     *
+     * @return port status
+     */
+    public PortStatus status() {
+        return status;
+    }
+
+    /**
+     * Returns port name.
+     *
+     * @return port name
+     */
+    public String name() {
+        return name;
+    }
+
+    /**
+     * Returns allowed address pairs.
+     *
+     * @return map of ip address and mac address, or empty map
+     */
+    public Map<IpAddress, MacAddress> allowedAddressPairs() {
+        return allowedAddressPairs;
+    }
+
+    /**
+     * Returns whether admin state up or not.
+     *
+     * @return true if admin state up, false otherwise
+     */
+    public boolean isAdminStateUp() {
+        return adminStateUp;
+    }
+
+    /**
+     * Returns network ID.
+     *
+     * @return network ID
+     */
+    public String networkId() {
+        return networkId;
+    }
+
+    /**
+     * Returns device owner.
+     *
+     * @return device owner
+     */
+    public String deviceOwner() {
+        return deviceOwner;
+    }
+
+    /**
+     * Returns mac address.
+     *
+     * @return mac address
+     */
+    public MacAddress macAddress() {
+        return macAddress;
+    }
+
+    /**
+     * Returns the fixed IP information.
+     *
+     * @return fixed IP info
+     */
+    public HashMap fixedIps() {
+        return fixedIps;
+    }
+
+    /**
+     * Returns port ID.
+     *
+     * @return port ID
+     */
+    public String id() {
+        return id;
+    }
+
+    /**
+     * Returns security group information.
+     *
+     * @return security group info
+     */
+    public Collection<String> securityGroups() {
+        return securityGroups;
+    }
+
+    /**
+     * Returns device ID.
+     *
+     * @return device ID
+     */
+    public String deviceId() {
+        return deviceId;
+    }
+
+    /**
+     * OpenstackPort Builder class.
+     */
+    public static final class Builder {
+
+        private PortStatus status;
+        private String name;
+        private Map<IpAddress, MacAddress> allowedAddressPairs;
+        private boolean adminStateUp;
+        private String networkId;
+        private String tenantId;
+        private String deviceOwner;
+        private MacAddress macAddress;
+        // list  of hash map <subnet id, ip address>
+        private HashMap<String, Ip4Address> fixedIps;
+        private String id;
+        private Collection<String> securityGroups;
+        private String deviceId;
+
+        Builder() {
+            fixedIps = Maps.newHashMap();
+            allowedAddressPairs = Maps.newHashMap();
+        }
+
+        /**
+         * Sets port status.
+         *
+         * @param status port status
+         * @return Builder object
+         */
+        public Builder portStatus(PortStatus status) {
+            this.status = status;
+
+            return this;
+        }
+
+        /**
+         * Sets port name.
+         *
+         * @param name port name
+         * @return Builder object
+         */
+        public Builder name(String name) {
+            this.name = name;
+
+            return this;
+        }
+
+        /**
+         * Sets allowed address pairs.
+         *
+         * @param addrPairs map of ip address and mac address
+         * @return Builder object
+         */
+        public Builder allowedAddressPairs(Map<IpAddress, MacAddress> addrPairs) {
+            this.allowedAddressPairs.putAll(addrPairs);
+            return this;
+        }
+
+        /**
+         * Sets whether admin state up or not.
+         *
+         * @param isAdminStateUp true if admin state is up, false otherwise
+         * @return Builder object
+         */
+        public Builder adminState(boolean isAdminStateUp) {
+            this.adminStateUp = isAdminStateUp;
+
+            return this;
+        }
+
+        /**
+         * Sets network ID.
+         *
+         * @param networkId network ID
+         * @return Builder object
+         */
+        public Builder netwrokId(String networkId) {
+            this.networkId = networkId;
+
+            return this;
+        }
+
+        /**
+         * Sets tenant ID.
+         *
+         * @param tenantId tenant ID
+         * @return Builder object
+         */
+        public Builder tenantId(String tenantId) {
+            this.tenantId = tenantId;
+
+            return this;
+        }
+
+        /**
+         * Sets device owner.
+         *
+         * @param owner device owner
+         * @return Builder object
+         */
+        public Builder deviceOwner(String owner) {
+            this.deviceOwner = owner;
+
+            return this;
+        }
+
+        /**
+         * Sets MAC address of the port.
+         *
+         * @param mac MAC address
+         * @return Builder object
+         */
+        public Builder macAddress(MacAddress mac) {
+            this.macAddress = mac;
+
+            return this;
+        }
+
+        /**
+         * Sets Fixed IP address information.
+         *
+         * @param fixedIpList Fixed IP info
+         * @return Builder object
+         */
+        public Builder fixedIps(HashMap<String, Ip4Address> fixedIpList) {
+            fixedIps.putAll(fixedIpList);
+
+            return this;
+        }
+
+        /**
+         * Sets ID of the port.
+         *
+         * @param id ID of the port
+         * @return Builder object
+         */
+        public Builder id(String id) {
+            this.id = id;
+
+            return this;
+        }
+
+        /**
+         * Sets security group of the port.
+         *
+         * @param securityGroupList security group list of the port
+         * @return Builder object
+         */
+        public Builder securityGroup(Collection<String> securityGroupList) {
+            this.securityGroups = securityGroupList;
+            return this;
+        }
+
+        /**
+         * Sets device ID of the port.
+         *
+         * @param deviceId device ID
+         * @return Builder object
+         */
+        public Builder deviceId(String deviceId) {
+            this.deviceId = deviceId;
+
+            return this;
+        }
+
+        /**
+         * Builds an OpenstackPort object.
+         *
+         * @return OpenstackPort objecet
+         */
+        public OpenstackPort build() {
+            return new OpenstackPort(status, name, allowedAddressPairs, adminStateUp,
+                                     networkId, networkId, deviceOwner, macAddress, fixedIps,
+                                     id, securityGroups, deviceId);
+        }
+    }
+}
+
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackRouter.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackRouter.java
new file mode 100644
index 0000000..b5e081e
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackRouter.java
@@ -0,0 +1,219 @@
+/*
+ * 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.openstackinterface;
+
+import java.util.Objects;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * An Openstack Neutron Router Model.
+ */
+public final class OpenstackRouter {
+
+    public enum RouterStatus {
+        UP,
+        DOWN,
+        ACTIVE,
+    }
+
+    private final String tenantId;
+    private final String id;
+    private final String name;
+    private RouterStatus status;
+    private boolean adminStateUp;
+    private OpenstackExternalGateway gatewayExternalInfo;
+
+    private OpenstackRouter(String id, String tenantId, String name, RouterStatus status,
+                           boolean adminStateUp, OpenstackExternalGateway gatewayExternalInfo) {
+        this.id = id;
+        this.tenantId = tenantId;
+        this.name = name;
+        this.status = status;
+        this.adminStateUp = adminStateUp;
+        this.gatewayExternalInfo = gatewayExternalInfo;
+
+    }
+
+    /**
+     * Returns tenant ID.
+     *
+     * @return tenant ID
+     */
+    public String tenantId() {
+        return tenantId;
+    }
+
+    /**
+     * Returns router ID.
+     *
+     * @return router ID
+     */
+    public String id() {
+        return id;
+    }
+
+    /**
+     * Returns router name.
+     *
+     * @return router name
+     */
+    public String name() {
+        return name;
+    }
+
+    /**
+     * Returns router status.
+     *
+     * @return router stauts
+     */
+    public RouterStatus status() {
+        return status;
+    }
+
+    /**
+     * Returns whether admin state up or not.
+     *
+     * @return true if admin state up, false otherwise
+     */
+    public boolean adminStateUp() {
+        return adminStateUp;
+    }
+
+    /**
+     * Returns external gateway information.
+     *
+     * @return external gateway information
+     */
+    public OpenstackExternalGateway gatewayExternalInfo() {
+        return gatewayExternalInfo;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (o instanceof OpenstackRouter) {
+            OpenstackRouter that = (OpenstackRouter) o;
+
+            return this.adminStateUp == that.adminStateUp &&
+                    this.gatewayExternalInfo.equals(that.gatewayExternalInfo) &&
+                    this.id.equals(that.id) &&
+                    this.name.equals(that.name) &&
+                    this.status.equals(that.status) &&
+                    this.tenantId.equals(that.tenantId);
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(adminStateUp, gatewayExternalInfo, id, name, status, tenantId);
+    }
+
+    /**
+     * An Openstack Router Builder class.
+     */
+    public static final class Builder {
+
+        private String tenantId;
+        private String id;
+        private String name;
+        private RouterStatus status;
+        private Boolean adminStateUp;
+        private OpenstackExternalGateway gatewayExternalInfo;
+
+        /**
+         * Sets router ID.
+         *
+         * @param id router ID
+         * @return Builder object
+         */
+        public Builder id(String id) {
+            this.id = id;
+            return this;
+        }
+
+        /**
+         * Sets router name.
+         *
+         * @param name router name
+         * @return Builder object
+         */
+        public Builder name(String name) {
+            this.name = name;
+            return this;
+        }
+
+        /**
+         * Sets router status.
+         *
+         * @param status router status
+         * @return Builder object
+         */
+        public Builder status(RouterStatus status) {
+            this.status = status;
+            return this;
+        }
+
+        /**
+         * Sets tenant ID.
+         *
+         * @param tenantId Tenant ID
+         * @return Builder object
+         */
+        public Builder tenantId(String tenantId) {
+            this.tenantId = tenantId;
+            return this;
+        }
+
+        /**
+         * Sets whether admin state up or not.
+         *
+         * @param adminStateUp true if admin state is up, false otherwise
+         * @return Builder object
+         */
+        public Builder adminStateUp(boolean adminStateUp) {
+            this.adminStateUp = adminStateUp;
+            return this;
+        }
+
+        /**
+         * Sets external gateway information.
+         *
+         * @param gatewayExternalInfo external gateway information
+         * @return Builder object
+         */
+        public Builder gatewayExternalInfo(OpenstackExternalGateway gatewayExternalInfo) {
+            this.gatewayExternalInfo = gatewayExternalInfo;
+            return this;
+        }
+
+        /**
+         * Builds an OpenstackRouter object.
+         *
+         * @return OpenstasckRouter object
+         */
+        public OpenstackRouter build() {
+            return new OpenstackRouter(checkNotNull(id), checkNotNull(tenantId), name, checkNotNull(status),
+                    checkNotNull(adminStateUp), gatewayExternalInfo);
+        }
+    }
+
+
+}
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackRouterInterface.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackRouterInterface.java
new file mode 100644
index 0000000..37e3478
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackRouterInterface.java
@@ -0,0 +1,162 @@
+/*
+ * 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.openstackinterface;
+
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * An Openstack Neutron Router Interface Model.
+ */
+public final class OpenstackRouterInterface {
+    private final String id;
+    private final String tenantId;
+    private final String subnetId;
+    private final String portId;
+
+    private OpenstackRouterInterface(String id, String tenantId,
+                                     String subnetId, String portId) {
+        this.id = checkNotNull(id);
+        this.tenantId = checkNotNull(tenantId);
+        this.subnetId = checkNotNull(subnetId);
+        this.portId = checkNotNull(portId);
+    }
+
+    /**
+     * Returns Router Interface ID.
+     *
+     * @return router interface ID
+     */
+    public String id() {
+        return id;
+    }
+
+    /**
+     * Returns tenant ID.
+     *
+     * @return tenant ID
+     */
+    public String tenantId() {
+        return tenantId;
+    }
+
+    /**
+     * Returns subnet ID.
+     *
+     * @return subnet ID
+     */
+    public String subnetId() {
+        return subnetId;
+    }
+
+    /**
+     * Returns port ID.
+     *
+     * @return port ID
+     */
+    public String portId() {
+        return portId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (o instanceof OpenstackRouterInterface) {
+            OpenstackRouterInterface that = (OpenstackRouterInterface)  o;
+
+            return this.id.equals(that.id) &&
+                    this.portId.equals(that.portId) &&
+                    this.subnetId.equals(that.subnetId) &&
+                    this.tenantId.equals(that.tenantId);
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, portId, subnetId, tenantId);
+    }
+
+    /**
+     * An Openstack Router Interface Builder class.
+     */
+    public static final class Builder {
+        private String id;
+        private String tenantId;
+        private String subnetId;
+        private String portId;
+
+        /**
+         * Sets Router Interface ID.
+         *
+         * @param id router interface ID
+         * @return Builder object
+         */
+        public Builder id(String id) {
+            this.id = id;
+            return this;
+        }
+
+        /**
+         * Sets tenant ID.
+         *
+         * @param tenantId tenant ID
+         * @return Builder object
+         */
+        public Builder tenantId(String tenantId) {
+            this.tenantId = tenantId;
+            return this;
+        }
+
+        /**
+         * Sets subnet ID.
+         *
+         * @param subnetId subnet ID
+         * @return Builder object
+         */
+        public Builder subnetId(String subnetId) {
+            this.subnetId = subnetId;
+            return this;
+        }
+
+        /**
+         * Sets port ID.
+         *
+         * @param portId port ID
+         * @return Builder object
+         */
+        public Builder portId(String portId) {
+            this.portId = portId;
+            return this;
+        }
+
+        /**
+         * Builds an Openstack Router Interface object.
+         *
+         * @return OpenstackRouterInterface object
+         */
+        public OpenstackRouterInterface build() {
+            return new OpenstackRouterInterface(checkNotNull(id), checkNotNull(tenantId),
+                    checkNotNull(subnetId), checkNotNull(portId));
+        }
+
+    }
+}
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackSecurityGroup.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackSecurityGroup.java
new file mode 100644
index 0000000..47a30a4
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackSecurityGroup.java
@@ -0,0 +1,207 @@
+/*
+ * 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.openstackinterface;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Objects;
+
+/**
+ * Represents Openstack Security Group information.
+ */
+public final class OpenstackSecurityGroup {
+
+    private String description;
+    private String id;
+    private String name;
+    private Collection<OpenstackSecurityGroupRule> rules;
+    private String tenantId;
+
+    private OpenstackSecurityGroup(String description, String id, String name,
+                                   Collection<OpenstackSecurityGroupRule> rules,
+                                   String tenantId) {
+        this.description = description;
+        this.id = id;
+        this.name = name;
+        this.tenantId = tenantId;
+        this.rules = rules;
+    }
+
+    /**
+     * Returns the description of the security group.
+     *
+     * @return description
+     */
+    public String description() {
+        return this.description;
+    }
+
+    /**
+     * Returns ID of the security group.
+     *
+     * @return ID
+     */
+    public String id() {
+        return this.id;
+    }
+
+    /**
+     * Returns the name of the security group.
+     *
+     * @return name
+     */
+    public String name() {
+        return this.name;
+    }
+
+    /**
+     * Returns the list of the security group rules.
+     *
+     * @return Collection of OpenstackSecurityGroupRule objects
+     */
+    public Collection<OpenstackSecurityGroupRule> rules() {
+        return Collections.unmodifiableCollection(rules);
+    }
+
+    /**
+     * Returns the Tenant ID.
+     *
+     * @return tenant ID
+     */
+    public String tenantId() {
+        return this.tenantId;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sbuilder = new StringBuilder("Security Group :")
+                .append(description + ",")
+                .append(id + ",")
+                .append(name + ",");
+        rules.forEach(rule -> sbuilder.append(rule.toString()));
+        sbuilder.append(tenantId);
+
+        return sbuilder.toString();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o instanceof OpenstackSecurityGroup) {
+            OpenstackSecurityGroup that = (OpenstackSecurityGroup) o;
+
+            return this.description.equals(that.description) &&
+                    this.tenantId.equals(that.tenantId) &&
+                    this.id.equals(that.id) &&
+                    this.name.equals(that.name) &&
+                    this.rules.containsAll(that.rules);
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(description, tenantId, id, name, rules);
+    }
+
+    /**
+     * Returns the SecurityGroupRule builder object.
+     *
+     * @return builder object
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Represents the builder of the SecurityGroupRule.
+     *
+     */
+    public static final class Builder {
+        private String description;
+        private String id;
+        private String name;
+        private Collection<OpenstackSecurityGroupRule> rules;
+        private String tenantId;
+
+        /**
+         * Sets the description of the security group.
+         *
+         * @param description description
+         * @return builder object
+         */
+        public Builder description(String description) {
+            this.description = description;
+            return this;
+        }
+
+        /**
+         * Sets the ID of the security group.
+         *
+         * @param id ID
+         * @return builder object
+         */
+        public Builder id(String id) {
+            this.id = id;
+            return this;
+        }
+
+        /**
+         * Sets the name of the security group.
+         *
+         * @param name name
+         * @return builder object
+         */
+        public Builder name(String name) {
+            this.name = name;
+            return this;
+        }
+
+        /**
+         * Sets Security Group rules.
+         *
+         * @param rules security group rules
+         * @return builder object
+         */
+        public Builder rules(Collection<OpenstackSecurityGroupRule> rules) {
+            this.rules = rules;
+            return this;
+        }
+
+        /**
+         * Sets the tenant ID of the security group.
+         *
+         * @param tenantId tenant ID
+         * @return builder object
+         */
+        public Builder tenantId(String tenantId) {
+            this.tenantId = tenantId;
+            return this;
+        }
+
+        /**
+         * Creates the OpenstackSecurityGroup object.
+         *
+         * @return OpenstackSecurityGroup object
+         */
+        public OpenstackSecurityGroup build() {
+            return new OpenstackSecurityGroup(description, id, name, rules, tenantId);
+        }
+    }
+}
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackSecurityGroupRule.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackSecurityGroupRule.java
new file mode 100644
index 0000000..42a4a44
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackSecurityGroupRule.java
@@ -0,0 +1,242 @@
+/*
+ * 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.openstackinterface;
+
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Represents Openstack Security Group Rules.
+ */
+public final class OpenstackSecurityGroupRule {
+
+    private final String direction;
+    private final String ethertype;
+    private final String id;
+    private final String portRangeMax;
+    private final String portRangeMin;
+    private final String protocol;
+    private final String remoteGroupId;
+    private final String remoteIpPrefix;
+    private final String secuityGroupId;
+    private final String tenantId;
+
+    private OpenstackSecurityGroupRule(String direction,
+                                       String ethertype,
+                                       String id,
+                                       String portRangeMax,
+                                       String portRangeMin,
+                                       String protocol,
+                                       String remoteGroupId,
+                                       String remoteIpPrefix,
+                                       String securityGroupId,
+                                       String tenantId) {
+        this.direction = direction;
+        this.ethertype = ethertype;
+        this.id = checkNotNull(id);
+        this.portRangeMax = portRangeMax;
+        this.portRangeMin = portRangeMin;
+        this.protocol = protocol;
+        this.remoteGroupId = remoteGroupId;
+        this.remoteIpPrefix = remoteIpPrefix;
+        this.secuityGroupId = securityGroupId;
+        this.tenantId = tenantId;
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder(" [")
+                .append(direction + ",")
+                .append(ethertype + ",")
+                .append(id + ",")
+                .append(portRangeMax + ",")
+                .append(portRangeMin + ",")
+                .append(protocol + ",'")
+                .append(remoteGroupId + ",")
+                .append(remoteIpPrefix + ",")
+                .append(secuityGroupId + ",")
+                .append(tenantId + "] ")
+                .toString();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (this instanceof OpenstackSecurityGroupRule) {
+            OpenstackSecurityGroupRule that = (OpenstackSecurityGroupRule) o;
+            return this.direction.equals(that.direction) &&
+                    this.ethertype.equals(that.direction) &&
+                    this.id.equals(that.id) &&
+                    this.portRangeMax.equals(that.portRangeMax) &&
+                    this.portRangeMin.equals(that.portRangeMin) &&
+                    this.protocol.equals(that.protocol) &&
+                    this.remoteGroupId.equals(that.remoteGroupId) &&
+                    this.secuityGroupId.equals(that.secuityGroupId) &&
+                    this.remoteIpPrefix.equals(that.remoteIpPrefix) &&
+                    this.tenantId.equals(that.tenantId);
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(direction, ethertype, id, portRangeMax, portRangeMin, protocol,
+                remoteGroupId, remoteIpPrefix, secuityGroupId, tenantId);
+    }
+
+    /**
+     * Represents a security group rule builder object.
+     */
+    public static final class Builder {
+
+        private String direction;
+        private String etherType;
+        private String id;
+        private String portRangeMax;
+        private String portRangeMin;
+        private String protocol;
+        private String remoteGroupId;
+        private String remoteIpPrefix;
+        private String secuityGroupId;
+        private String tenantId;
+
+
+        /**
+         * Sets the direction of the security group rule.
+         *
+         * @param direction direction (ingress or egress)
+         * @return builder object
+         */
+        public Builder direction(String direction) {
+            this.direction = direction;
+            return this;
+        }
+
+        /**
+         * Sets the Ethernet Type.
+         *
+         * @param etherType Ethernet Type
+         * @return builder object
+         */
+        public Builder etherType(String etherType) {
+            this.etherType = etherType;
+            return this;
+        }
+
+        /**
+         * Sets the Security Group Rule ID.
+         *
+         * @param id security group rule ID
+         * @return builder object
+         */
+        public Builder id(String id) {
+            this.id = id;
+            return this;
+        }
+
+        /**
+         * Sets the port range max value.
+         *
+         * @param portRangeMax port range max value
+         * @return builder object
+         */
+        public Builder portRangeMax(String portRangeMax) {
+            this.portRangeMax = portRangeMax;
+            return this;
+        }
+
+        /**
+         * Sets the port range min value.
+         *
+         * @param portRangeMin port range min value
+         * @return builder object
+         */
+        public Builder portRangeMin(String portRangeMin) {
+            this.portRangeMin = portRangeMin;
+            return this;
+        }
+
+        /**
+         * Sets the protocol.
+         *
+         * @param protocol protocol
+         * @return builder object
+         */
+        public Builder protocol(String protocol) {
+            this.protocol = protocol;
+            return this;
+        }
+
+        /**
+         * Sets the remote security group ID.
+         *
+         * @param remoteGroupId remote security group ID
+         * @return builder
+         */
+        public Builder remoteGroupId(String remoteGroupId) {
+            this.remoteGroupId = remoteGroupId;
+            return this;
+        }
+
+        /**
+         * Sets the remote IP address as prefix.
+         *
+         * @param remoteIpPrefix remote IP address
+         * @return builder object
+         */
+        public Builder remoteIpPrefix(String remoteIpPrefix) {
+            this.remoteIpPrefix = remoteIpPrefix;
+            return this;
+        }
+
+        /**
+         * Sets the Security Group ID.
+         *
+         * @param securityGroupId security group ID
+         * @return builder object
+         */
+        public Builder securityGroupId(String securityGroupId) {
+            this.secuityGroupId = securityGroupId;
+            return this;
+        }
+
+        /**
+         * Sets the tenant ID.
+         *
+         * @param tenantId tenant ID
+         * @return builder object
+         */
+        public Builder tenantId(String tenantId) {
+            this.tenantId = tenantId;
+            return this;
+        }
+
+        /**
+         * Creates a OpenstackSecurityGroupRule instance.
+         *
+         * @return OpenstackSecurityGroupRule object
+         */
+        public OpenstackSecurityGroupRule build() {
+            return new OpenstackSecurityGroupRule(direction, etherType, id, portRangeMax,
+                    portRangeMin, protocol, remoteGroupId, remoteIpPrefix, secuityGroupId, tenantId);
+        }
+    }
+}
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackSubnet.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackSubnet.java
new file mode 100644
index 0000000..9162916
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/OpenstackSubnet.java
@@ -0,0 +1,176 @@
+/*
+ * 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.openstackinterface;
+
+import org.onlab.packet.Ip4Address;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Represents the subnet information given by Neutron.
+ *
+ */
+public final class OpenstackSubnet {
+    private String name;
+    private boolean enableHhcp;
+    private String networkId;
+    private String tenantId;
+    private List<Ip4Address> dnsNameservers;
+    private String gatewayIp;
+    private String cidr;
+    private String id;
+    private Collection<String> securityGroups;
+
+    private OpenstackSubnet(String name, boolean enableHhcp, String networkId,
+                            String tenantId, List<Ip4Address> dnsNameservers, String gatewayIp,
+                            String cidr, String id, Collection<String> securityGroups) {
+        this.name = name;
+        this.enableHhcp = enableHhcp;
+        this.networkId = checkNotNull(networkId);
+        this.tenantId = checkNotNull(tenantId);
+        this.dnsNameservers = dnsNameservers;
+        this.gatewayIp = gatewayIp;
+        this.cidr = checkNotNull(cidr);
+        this.id = checkNotNull(id);
+        this.securityGroups = securityGroups;
+    }
+
+    /**
+     * Returns OpenstackSubnet builder object.
+     *
+     * @return OpenstackSubnet builder
+     */
+    public static OpenstackSubnet.Builder builder() {
+        return new Builder();
+    }
+
+    public String name() {
+        return name;
+    }
+
+    public boolean enableHhcp() {
+        return enableHhcp;
+    }
+
+    public String networkId() {
+        return networkId;
+    }
+
+    public String tenantId() {
+        return tenantId;
+    }
+
+    public List<Ip4Address> dnsNameservers() {
+        return dnsNameservers;
+    }
+
+    public String gatewayIp() {
+        return gatewayIp;
+    }
+
+    public String cidr() {
+        return cidr;
+    }
+
+    public String id() {
+        return id;
+    }
+
+    public Collection<String> securityGroups() {
+        return Collections.unmodifiableCollection(this.securityGroups);
+    }
+
+    /**
+     * OpenstackSubnet Builder class.
+     *
+     */
+    public static final class Builder {
+        private String name;
+        private boolean enableDhcp;
+        private String networkId;
+        private String tenantId;
+        private List<Ip4Address> dnsNameservers;
+        private String gatewayIp;
+        private String cidr;
+        private String id;
+        private Collection<String> securityGroups;
+
+        Builder() {}
+
+        public Builder setName(String name) {
+            this.name = name;
+
+            return this;
+        }
+
+        public Builder setEnableDhcp(boolean enableDhcp) {
+            this.enableDhcp = enableDhcp;
+
+            return this;
+        }
+
+        public Builder setNetworkId(String networkId) {
+            this.networkId = networkId;
+
+            return this;
+        }
+
+        public Builder setTenantId(String tenantId) {
+            this.tenantId = tenantId;
+
+            return this;
+        }
+
+        public Builder setDnsNameservers(List<Ip4Address> dnsNameservers) {
+            this.dnsNameservers = dnsNameservers;
+
+            return this;
+        }
+
+        public Builder setGatewayIp(String gatewayIp) {
+            this.gatewayIp = gatewayIp;
+
+            return this;
+        }
+
+        public Builder setCidr(String cidr) {
+            this.cidr = cidr;
+
+            return this;
+        }
+
+        public Builder setId(String id) {
+            this.id = id;
+
+            return this;
+        }
+
+        public Builder securityGroups(Collection<String> securityGroups) {
+            this.securityGroups = securityGroups;
+
+            return this;
+        }
+
+        public OpenstackSubnet build() {
+            return new OpenstackSubnet(name, enableDhcp, networkId, tenantId,
+                    dnsNameservers, gatewayIp, cidr, id, securityGroups);
+        }
+    }
+}
diff --git a/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/package-info.java b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/package-info.java
new file mode 100644
index 0000000..0507571
--- /dev/null
+++ b/apps/openstackinterface/api/src/main/java/org/onosproject/openstackinterface/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.
+ */
+
+/**
+ * Application for OpenstackRouting.
+ */
+package org.onosproject.openstackinterface;
\ No newline at end of file
diff --git a/apps/openstackinterface/app/pom.xml b/apps/openstackinterface/app/pom.xml
new file mode 100644
index 0000000..77715be
--- /dev/null
+++ b/apps/openstackinterface/app/pom.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-app-openstackinterface</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-openstackinterface-app</artifactId>
+    <packaging>bundle</packaging>
+
+
+    <properties>
+        <onos.app.name>org.onosproject.openstackinterface</onos.app.name>
+        <onos.app.category>default</onos.app.category>
+        <onos.app.url>http://onosproject.org</onos.app.url>
+        <onos.app.readme>Openstack Interface Application.</onos.app.readme>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-openstackinterface-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-rest</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-rest</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-servlet</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-dhcp-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-client</artifactId>
+            <version>1.19</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-core</artifactId>
+            <version>1.19</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-misc</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+
+</project>
diff --git a/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/OpenstackInterfaceManager.java b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/OpenstackInterfaceManager.java
new file mode 100644
index 0000000..9b99b81
--- /dev/null
+++ b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/OpenstackInterfaceManager.java
@@ -0,0 +1,409 @@
+/*
+ * 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.openstackinterface;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.WebResource;
+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.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.Port;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.openstackinterface.web.OpenstackNetworkCodec;
+import org.onosproject.openstackinterface.web.OpenstackPortCodec;
+import org.onosproject.openstackinterface.web.OpenstackRouterCodec;
+import org.onosproject.openstackinterface.web.OpenstackSecurityGroupCodec;
+import org.onosproject.openstackinterface.web.OpenstackSubnetCodec;
+import org.slf4j.Logger;
+import javax.ws.rs.core.MediaType;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.net.MediaType.JSON_UTF_8;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Handles REST Calls to Openstack Neutron.
+ *
+ */
+@Service
+@Component(immediate = true)
+public class OpenstackInterfaceManager implements OpenstackInterfaceService {
+
+    private static final String URI_NETWORKS = "networks";
+    private static final String URI_PORTS = "ports";
+    private static final String URI_SUBNETS = "subnets";
+    private static final String URI_SECURITY_GROUPS = "security-groups";
+    private static final String URI_TOKENS = "tokens";
+
+    private static final String PATH_ROUTERS = "routers";
+    private static final String PATH_NETWORKS = "networks";
+    private static final String PATH_PORTS = "ports";
+    private static final String PATH_SUBNETS = "subnets";
+    private static final String PATH_ACCESS = "access";
+    private static final String PATH_TOKEN = "token";
+    private static final String PATH_ID = "id";
+
+    private static final String HEADER_AUTH_TOKEN = "X-Auth-Token";
+
+    private final Logger log = getLogger(getClass());
+    private String neutronUrl;
+    private String keystoneUrl;
+    private String tokenId;
+    private String userName;
+    private String pass;
+
+    private static final String PORT_NAME = "portName";
+
+    private ApplicationId appId;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry cfgService;
+
+    private InternalConfigListener internalConfigListener = new InternalConfigListener();
+    private ExecutorService networkEventExcutorService =
+            Executors.newSingleThreadExecutor(groupedThreads("onos/openstackinterface", "config-event"));
+
+    private final Set<ConfigFactory> factories = ImmutableSet.of(
+            new ConfigFactory<ApplicationId, OpenstackNetworkingConfig>(APP_SUBJECT_FACTORY,
+                    OpenstackNetworkingConfig.class,
+                    "openstackinterface") {
+                @Override
+                public OpenstackNetworkingConfig createConfig() {
+                    return new OpenstackNetworkingConfig();
+                }
+            }
+    );
+
+
+    @Activate
+    protected void activate() {
+        appId = coreService
+                .registerApplication("org.onosproject.openstackinterface");
+
+        factories.forEach(cfgService::registerConfigFactory);
+        cfgService.addListener(internalConfigListener);
+
+        log.info("started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        cfgService.removeListener(internalConfigListener);
+        factories.forEach(cfgService::unregisterConfigFactory);
+        log.info("stopped");
+    }
+
+    /**
+     * Returns network information stored in Neutron.
+     *
+     * @return List of OpenstackNetwork
+     */
+    public Collection<OpenstackNetwork> getNetworks() {
+
+        WebResource.Builder builder = getClientBuilder(neutronUrl + URI_NETWORKS);
+        String response = builder.accept(MediaType.APPLICATION_JSON_TYPE).
+                header(HEADER_AUTH_TOKEN, getToken()).get(String.class);
+
+        log.debug("networks response:" + response);
+
+        ObjectMapper mapper = new ObjectMapper();
+        List<OpenstackNetwork> openstackNetworks = Lists.newArrayList();
+        try {
+            ObjectNode node = (ObjectNode) mapper.readTree(response);
+            ArrayNode networkList = (ArrayNode) node.path(PATH_NETWORKS);
+            OpenstackNetworkCodec networkCodec = new OpenstackNetworkCodec();
+            networkList.forEach(n -> openstackNetworks.add(networkCodec.decode((ObjectNode) n, null)));
+        } catch (IOException e) {
+            log.warn("getNetworks()", e);
+        }
+
+        openstackNetworks.removeAll(Collections.singleton(null));
+        openstackNetworks.forEach(n -> log.debug("network ID: {}", n.id()));
+
+        return openstackNetworks;
+    }
+
+    /**
+     * Returns port information stored in Neutron.
+     *
+     * @return List of OpenstackPort
+     */
+    public Collection<OpenstackPort> getPorts() {
+
+        WebResource.Builder builder = getClientBuilder(neutronUrl + URI_PORTS);
+        String response = builder.accept(MediaType.APPLICATION_JSON_TYPE).
+                header(HEADER_AUTH_TOKEN, getToken()).get(String.class);
+
+        ObjectMapper mapper = new ObjectMapper();
+        List<OpenstackPort> openstackPorts = Lists.newArrayList();
+        try {
+            ObjectNode node = (ObjectNode) mapper.readTree(response);
+            ArrayNode portList = (ArrayNode) node.path(PATH_PORTS);
+            OpenstackPortCodec portCodec = new OpenstackPortCodec();
+            portList.forEach(p -> openstackPorts.add(portCodec.decode((ObjectNode) p, null)));
+        } catch (IOException e) {
+            log.warn("getPorts()", e);
+        }
+
+        log.debug("port response:" + response);
+        openstackPorts.forEach(n -> log.debug("port ID: {}", n.id()));
+
+        return openstackPorts;
+    }
+
+    public Collection<OpenstackRouter> getRouters() {
+        WebResource.Builder builder = getClientBuilder(neutronUrl + PATH_ROUTERS);
+        String response = builder.accept(MediaType.APPLICATION_JSON_TYPE).
+                header(HEADER_AUTH_TOKEN, getToken()).get(String.class);
+
+        ObjectMapper mapper = new ObjectMapper();
+        List<OpenstackRouter> openstackRouters = Lists.newArrayList();
+
+        try {
+            ObjectNode node = (ObjectNode) mapper.readTree(response);
+            ArrayNode routerList = (ArrayNode) node.path(PATH_ROUTERS);
+            OpenstackRouterCodec openstackRouterCodec = new OpenstackRouterCodec();
+            routerList.forEach(r -> openstackRouters
+                    .add(openstackRouterCodec.decode((ObjectNode) r, null)));
+        } catch (IOException e) {
+            log.warn("getRouters()", e);
+        }
+
+        log.debug("router response:" + response);
+        openstackRouters.forEach(r -> log.debug("router ID: {}", r.id()));
+
+        return openstackRouters;
+    }
+
+    /**
+     * Returns Subnet information in Neutron.
+     *
+     * @return List of OpenstackSubnet
+     */
+    public Collection<OpenstackSubnet> getSubnets() {
+
+        WebResource.Builder builder = getClientBuilder(neutronUrl + URI_SUBNETS);
+        String response = builder.accept(MediaType.APPLICATION_JSON_TYPE).
+                header(HEADER_AUTH_TOKEN, getToken()).get(String.class);
+
+        ObjectMapper mapper = new ObjectMapper();
+        List<OpenstackSubnet> subnets = Lists.newArrayList();
+        try {
+            ObjectNode node = (ObjectNode) mapper.readTree(response);
+            ArrayNode subnetList = (ArrayNode) node.path(PATH_SUBNETS);
+            OpenstackSubnetCodec subnetCodec = new OpenstackSubnetCodec();
+            subnetList.forEach(s -> subnets.add(subnetCodec.decode((ObjectNode) s, null)));
+        } catch (IOException e) {
+            log.warn("getSubnets()", e);
+        }
+
+        log.debug("subnets response:" + response);
+        subnets.forEach(s -> log.debug("subnet ID: {}", s.id()));
+
+        return subnets;
+    }
+
+    /**
+     * Extracts OpenstackSecurityGroup information for the ID.
+     *
+     * @param id Security Group ID
+     * @return OpenstackSecurityGroup object or null if fails
+     */
+    public OpenstackSecurityGroup getSecurityGroup(String id) {
+        WebResource.Builder builder = getClientBuilder(neutronUrl + URI_SECURITY_GROUPS + "/" + id);
+        String response = builder.accept(MediaType.APPLICATION_JSON_TYPE).
+                header(HEADER_AUTH_TOKEN, getToken()).get(String.class);
+
+        ObjectMapper mapper = new ObjectMapper();
+        OpenstackSecurityGroup securityGroup = null;
+        try {
+            ObjectNode node = (ObjectNode) mapper.readTree(response);
+            OpenstackSecurityGroupCodec sgCodec = new OpenstackSecurityGroupCodec();
+            securityGroup = sgCodec.decode(node, null);
+        } catch (IOException e) {
+            log.warn("getSecurityGroup()", e);
+        }
+
+        return securityGroup;
+    }
+
+    private WebResource.Builder getClientBuilder(String uri) {
+        Client client = Client.create();
+        WebResource resource = client.resource(uri);
+        return resource.accept(JSON_UTF_8.toString())
+                .type(JSON_UTF_8.toString());
+    }
+
+    private String getToken() {
+        if (isTokenInvalid()) {
+            String request = "{\"auth\": {\"tenantName\": \"admin\", " +
+                    "\"passwordCredentials\":  {\"username\": \"" +
+                    userName + "\",\"password\": \"" + pass + "\"}}}";
+            WebResource.Builder builder = getClientBuilder(keystoneUrl + URI_TOKENS);
+            String response = builder.accept(MediaType.APPLICATION_JSON).post(String.class, request);
+
+            ObjectMapper mapper = new ObjectMapper();
+            try {
+                ObjectNode node = (ObjectNode) mapper.readTree(response);
+                tokenId = node.path(PATH_ACCESS).path(PATH_TOKEN).path(PATH_ID).asText();
+            } catch (IOException e) {
+                log.warn("getToken()", e);
+            }
+            log.debug("token response:" + response);
+        }
+
+        return tokenId;
+    }
+
+    private boolean isTokenInvalid() {
+        //TODO: validation check for the existing token
+        return true;
+    }
+
+    @Override
+    public Collection<OpenstackPort> ports(String networkId) {
+        return getPorts().stream()
+                .filter(port -> port.networkId().equals(networkId))
+                .collect(Collectors.toList());
+    }
+
+    @Override
+    public Collection<OpenstackPort> ports() {
+        return getPorts();
+    }
+
+    @Override
+    public OpenstackPort port(Port port) {
+        String uuid = port.annotations().value(PORT_NAME).substring(3);
+        return getPorts().stream()
+                .filter(p -> p.id().startsWith(uuid))
+                .findAny().orElse(null);
+    }
+
+    @Override
+    public OpenstackPort port(String portId) {
+        return getPorts().stream()
+                .filter(p -> p.id().equals(portId))
+                .findAny().orElse(null);
+    }
+
+    @Override
+    public OpenstackNetwork network(String networkId) {
+        Collection<OpenstackSubnet> subnets = getSubnets().stream()
+                .filter(s -> s.networkId().equals(networkId))
+                .collect(Collectors.toList());
+
+        OpenstackNetwork openstackNetwork = getNetworks().stream()
+                .filter(n -> n.id().equals(networkId))
+                .findAny().orElse(null);
+
+        if (openstackNetwork == null) {
+            return null;
+        }
+
+        return OpenstackNetwork.builder()
+                .id(openstackNetwork.id())
+                .name(openstackNetwork.name())
+                .networkType(openstackNetwork.networkType())
+                .segmentId(openstackNetwork.segmentId())
+                .tenantId(openstackNetwork.tenantId())
+                .subnets(subnets)
+                .build();
+    }
+
+    @Override
+    public Collection<OpenstackNetwork> networks() {
+        return getNetworks();
+    }
+
+    @Override
+    public OpenstackSubnet subnet(String subnetId) {
+        return getSubnets().stream()
+                .filter(subnet -> subnet.id().equals(subnetId))
+                .findAny().orElse(null);
+    }
+
+    @Override
+    public Collection<OpenstackSubnet> subnets() {
+        return getSubnets();
+    }
+
+    @Override
+    public Collection<OpenstackRouter> routers() {
+        return getRouters();
+    }
+
+    @Override
+    public OpenstackRouter router(String routerId) {
+        return getRouters().stream()
+                .filter(router -> router.id().equals(routerId))
+                .findAny().orElse(null);
+    }
+
+    private class InternalConfigListener implements NetworkConfigListener {
+
+        public void configureNetwork() {
+            OpenstackNetworkingConfig cfg =
+                    cfgService.getConfig(appId, OpenstackNetworkingConfig.class);
+            if (cfg == null) {
+                log.error("There is no openstack server information in config.");
+                return;
+            }
+
+            neutronUrl = checkNotNull(cfg.neutronServer());
+            keystoneUrl = checkNotNull(cfg.keystoneServer());
+            userName = checkNotNull(cfg.userName());
+            pass = checkNotNull(cfg.password());
+        }
+
+        @Override
+        public void event(NetworkConfigEvent event) {
+            if (((event.type() == NetworkConfigEvent.Type.CONFIG_ADDED ||
+                    event.type() == NetworkConfigEvent.Type.CONFIG_UPDATED)) &&
+                    event.configClass().equals(OpenstackNetworkingConfig.class)) {
+
+                log.info("Network configuration changed");
+                networkEventExcutorService.execute(this::configureNetwork);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/package-info.java b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/package-info.java
new file mode 100644
index 0000000..0507571
--- /dev/null
+++ b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/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.
+ */
+
+/**
+ * Application for OpenstackRouting.
+ */
+package org.onosproject.openstackinterface;
\ No newline at end of file
diff --git a/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackNetworkCodec.java b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackNetworkCodec.java
new file mode 100644
index 0000000..18c73a6
--- /dev/null
+++ b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackNetworkCodec.java
@@ -0,0 +1,76 @@
+/*
+ * 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.openstackinterface.web;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.openstackinterface.OpenstackNetwork;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of the OpenstackNetwork Codec.
+ *
+ */
+public class OpenstackNetworkCodec extends JsonCodec<OpenstackNetwork> {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private static final String NETWORK = "network";
+    private static final String NAME = "name";
+    private static final String TENANT_ID = "tenant_id";
+    private static final String SEGMENTATION_ID = "provider:segmentation_id";
+    private static final String NETWORK_TYPE = "provider:network_type";
+    private static final String ID = "id";
+
+    @Override
+    public OpenstackNetwork decode(ObjectNode json, CodecContext context) {
+
+        JsonNode networkInfo = json.get(NETWORK);
+        if (networkInfo == null) {
+            networkInfo = json;
+        }
+
+        String name = networkInfo.path(NAME).asText();
+        String tenantId = networkInfo.path(TENANT_ID).asText();
+        String id = networkInfo.path(ID).asText();
+
+        OpenstackNetwork.Builder onb = OpenstackNetwork.builder();
+        onb.name(name)
+                .tenantId(tenantId)
+                .id(id);
+
+        if (networkInfo.path(NETWORK_TYPE).isMissingNode()) {
+            log.debug("Network {} has no network type, ignore it.", name);
+            return null;
+        }
+
+        String networkType = networkInfo.path(NETWORK_TYPE).asText();
+        try {
+            onb.networkType(OpenstackNetwork.NetworkType.valueOf(networkType.toUpperCase()));
+        } catch (IllegalArgumentException e) {
+            log.debug("Network {} has unsupported network type {}, ignore it.",
+                     name, networkType);
+            return null;
+        }
+
+        onb.segmentId(networkInfo.path(SEGMENTATION_ID).asText());
+
+        return onb.build();
+    }
+}
diff --git a/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackPortCodec.java b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackPortCodec.java
new file mode 100644
index 0000000..1c107ac
--- /dev/null
+++ b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackPortCodec.java
@@ -0,0 +1,131 @@
+/*
+ * 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.openstackinterface.web;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.openstackinterface.OpenstackPort;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Encodes and decodes the OpenstackPort.
+ */
+public class OpenstackPortCodec extends JsonCodec<OpenstackPort> {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    // JSON field names
+    private static final String PORT = "port";
+    private static final String STATUS = "status";
+    private static final String NAME = "name";
+    private static final String ADDRESS_PAIR = "allowed_address_pairs";
+    private static final String ADMIN_STATUS = "admin_status";
+    private static final String NETWORK_ID = "network_id";
+    private static final String TENANT_ID = "tenant_id";
+    private static final String DEVICE_OWNER = "device_owner";
+    private static final String MAC_ADDRESS = "mac_address";
+    private static final String FIXED_IPS = "fixed_ips";
+    private static final String SUBNET_ID = "subnet_id";
+    private static final String IP_ADDRESS = "ip_address";
+    private static final String ID = "id";
+    private static final String SECURITY_GROUPS = "security_groups";
+    private static final String DEVICE_ID = "device_id";
+    private static final String NA = "N/A";
+
+    @Override
+    public OpenstackPort decode(ObjectNode json, CodecContext context) {
+
+        checkNotNull(json);
+        HashMap<String, Ip4Address> fixedIpMap = new HashMap<>();
+        JsonNode portInfo = json.get(PORT);
+        if (portInfo == null) {
+            portInfo = json;
+        }
+
+        String status = portInfo.path(STATUS).asText();
+        String name = portInfo.path(NAME).asText();
+        boolean adminStateUp = portInfo.path(ADMIN_STATUS).asBoolean();
+        String networkId = portInfo.path(NETWORK_ID).asText();
+        String tenantId = portInfo.path(TENANT_ID).asText();
+        String deviceOwner = portInfo.path(DEVICE_OWNER).asText();
+        String macStr = portInfo.path(MAC_ADDRESS).asText();
+        ArrayNode fixedIpList = (ArrayNode) portInfo.path(FIXED_IPS);
+        for (JsonNode fixedIpInfo: fixedIpList) {
+            String subnetId = fixedIpInfo.path(SUBNET_ID).asText();
+            String ipAddressStr = fixedIpInfo.path(IP_ADDRESS).asText();
+            if (!fixedIpInfo.path(IP_ADDRESS).isMissingNode() && ipAddressStr != null) {
+                Ip4Address ipAddress = Ip4Address.valueOf(ipAddressStr);
+                fixedIpMap.put(subnetId, ipAddress);
+            }
+        }
+        String id = portInfo.path(ID).asText();
+        ArrayNode securityGroupList = (ArrayNode) portInfo.path(SECURITY_GROUPS);
+        Collection<String> securityGroupIdList = Lists.newArrayList();
+        securityGroupList.forEach(securityGroup -> securityGroupIdList.add(securityGroup.asText()));
+        String deviceId = portInfo.path(DEVICE_ID).asText();
+
+        Map<IpAddress, MacAddress> addressPairs = Maps.newHashMap();
+        for (JsonNode addrPair : (ArrayNode) portInfo.path(ADDRESS_PAIR)) {
+            try {
+                addressPairs.put(IpAddress.valueOf(addrPair.path(IP_ADDRESS).asText()),
+                                 MacAddress.valueOf(addrPair.path(MAC_ADDRESS).asText()));
+            } catch (IllegalArgumentException e) {
+                log.debug("Invalid address pair {}", addrPair.toString());
+            }
+        }
+
+        OpenstackPort.Builder openstackPortBuilder = OpenstackPort.builder();
+        OpenstackPort.PortStatus portStatus =
+                status.equals(NA) ? OpenstackPort.PortStatus.NA :
+                        OpenstackPort.PortStatus.valueOf(status);
+
+        openstackPortBuilder.portStatus(portStatus)
+                .name(name)
+                .adminState(adminStateUp)
+                .netwrokId(networkId)
+                .tenantId(tenantId)
+                .deviceOwner(deviceOwner)
+                .macAddress(MacAddress.valueOf(macStr))
+                .fixedIps(fixedIpMap)
+                .id(id)
+                .deviceId(deviceId)
+                .securityGroup(securityGroupIdList);
+
+        if (!addressPairs.isEmpty()) {
+            openstackPortBuilder.allowedAddressPairs(addressPairs);
+        }
+
+        OpenstackPort openstackPort = openstackPortBuilder.build();
+
+        return openstackPort;
+    }
+
+}
diff --git a/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackRouterCodec.java b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackRouterCodec.java
new file mode 100644
index 0000000..6a1750e
--- /dev/null
+++ b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackRouterCodec.java
@@ -0,0 +1,107 @@
+/*
+ * 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.openstackinterface.web;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Maps;
+import org.onlab.packet.Ip4Address;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.openstackinterface.OpenstackExternalGateway;
+import org.onosproject.openstackinterface.OpenstackRouter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+/**
+ * Implementation of the OpenstackRouter Codec.
+ */
+public class OpenstackRouterCodec extends JsonCodec<OpenstackRouter> {
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private static final String ROUTER = "router";
+    private static final String TENANT_ID = "tenant_id";
+    private static final String NETWORK_ID = "network_id";
+    private static final String ID = "id";
+    private static final String NAME = "name";
+    private static final String STATUS = "status";
+    private static final String ADMIN_STATE_UP = "admin_state_up";
+    private static final String EXTERNAL_GW_INFO = "external_gateway_info";
+    private static final String EXTERNAL_FIXED_IPS = "external_fixed_ips";
+    private static final String SUBNET_ID = "subnet_id";
+    private static final String IP_ADDRESS = "ip_address";
+
+    /**
+     * Decodes the OpenstackRouter.
+     *
+     * @param json    JSON to decode
+     * @param context decoding context
+     * @return OpenstackRouter
+     */
+    @Override
+    public OpenstackRouter decode(ObjectNode json, CodecContext context) {
+
+        if (json == null || !json.isObject()) {
+            return null;
+        }
+        JsonNode routerInfo = json.get(ROUTER);
+        if (routerInfo == null) {
+            routerInfo = json;
+        }
+
+        String tenantId = checkNotNull(routerInfo.path(TENANT_ID).asText());
+        String id = checkNotNull(routerInfo.path(ID).asText());
+        String name = checkNotNull(routerInfo.path(NAME).asText());
+        String status = checkNotNull(routerInfo.path(STATUS).asText());
+        String adminStateUp = checkNotNull(routerInfo.path(ADMIN_STATE_UP).asText());
+
+        OpenstackExternalGateway.Builder osExtBuiler = new OpenstackExternalGateway.Builder();
+
+        if (!routerInfo.path(EXTERNAL_GW_INFO).isMissingNode()) {
+            String externalGatewayNetId = checkNotNull(routerInfo.path(EXTERNAL_GW_INFO).path(NETWORK_ID).asText());
+            Map<String, Ip4Address> fixedIpMap = Maps.newHashMap();
+
+
+            if (!routerInfo.path(EXTERNAL_GW_INFO).path(EXTERNAL_FIXED_IPS).isMissingNode()) {
+                ArrayNode fixedIpList = (ArrayNode) routerInfo.path(EXTERNAL_GW_INFO).path(EXTERNAL_FIXED_IPS);
+
+                for (JsonNode fixedIpInfo : fixedIpList) {
+                    String subnetId = checkNotNull(fixedIpInfo.path(SUBNET_ID).asText());
+                    String ipAddressStr = checkNotNull(fixedIpInfo.path(IP_ADDRESS).asText());
+                    if (!fixedIpInfo.path(IP_ADDRESS).isMissingNode() && ipAddressStr != null) {
+                        fixedIpMap.put(subnetId, Ip4Address.valueOf(ipAddressStr));
+                    }
+                }
+            }
+
+            osExtBuiler.networkId(externalGatewayNetId)
+                    .enablePnat(true)
+                    .externalFixedIps(fixedIpMap);
+        }
+        OpenstackRouter.Builder osBuilder = new OpenstackRouter.Builder()
+                .tenantId(tenantId)
+                .id(id)
+                .name(name)
+                .status(OpenstackRouter.RouterStatus.valueOf(status))
+                .adminStateUp(Boolean.valueOf(adminStateUp))
+                .gatewayExternalInfo(osExtBuiler.build());
+
+        return osBuilder.build();
+    }
+}
diff --git a/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackRouterInterfaceCodec.java b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackRouterInterfaceCodec.java
new file mode 100644
index 0000000..01e8d7e
--- /dev/null
+++ b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackRouterInterfaceCodec.java
@@ -0,0 +1,64 @@
+/*
+ * 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.openstackinterface.web;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.openstackinterface.OpenstackRouterInterface;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import static com.google.common.base.Preconditions.checkNotNull;
+/**
+ * Implementation of the OpenstackRouterInterface Codec.
+ */
+public class OpenstackRouterInterfaceCodec extends JsonCodec<OpenstackRouterInterface> {
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private static final String ID = "id";
+    private static final String TENANT_ID = "tenant_id";
+    private static final String SUBNET_ID = "subnet_id";
+    private static final String PORT_ID = "port_id";
+
+    /**
+     * Decodes the OpenstackRouterInterface.
+     *
+     * @param json    JSON to decode
+     * @param context decoding context
+     * @return OpenstackRouterInterface
+     */
+    @Override
+    public OpenstackRouterInterface decode(ObjectNode json, CodecContext context) {
+        if (json == null || !json.isObject()) {
+            return null;
+        }
+        JsonNode routerIfInfo = json;
+
+        String id = checkNotNull(routerIfInfo.path(ID).asText());
+        String tenantId = checkNotNull(routerIfInfo.path(TENANT_ID).asText());
+        String subnetId = checkNotNull(routerIfInfo.path(SUBNET_ID).asText());
+        String portId = checkNotNull(routerIfInfo.path(PORT_ID).asText());
+
+        OpenstackRouterInterface.Builder osBuilder = new OpenstackRouterInterface.Builder()
+                .id(id)
+                .tenantId(tenantId)
+                .subnetId(subnetId)
+                .portId(portId);
+
+        return osBuilder.build();
+    }
+}
diff --git a/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackSecurityGroupCodec.java b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackSecurityGroupCodec.java
new file mode 100644
index 0000000..b2b0105
--- /dev/null
+++ b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackSecurityGroupCodec.java
@@ -0,0 +1,95 @@
+/*
+ * 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.openstackinterface.web;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Lists;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.openstackinterface.OpenstackSecurityGroup;
+import org.onosproject.openstackinterface.OpenstackSecurityGroupRule;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+
+/**
+ * Encodes and decodes the Openstack Security Group.
+ */
+public class OpenstackSecurityGroupCodec extends JsonCodec<OpenstackSecurityGroup> {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private static final String SECURITY_GROUP = "security_group";
+    private static final String DESCRIPTION = "description";
+    private static final String ID = "id";
+    private static final String NAME = "name";
+    private static final String SECURITY_GROUP_RULES = "security_group_rules";
+    private static final String DIRECTION = "direction";
+    private static final String EHTERTYPE = "ethertype";
+    private static final String PORT_RANGE_MAX = "port_range_max";
+    private static final String PORT_RANGE_MIN = "port_range_min";
+    private static final String PROTOCOL = "protocol";
+    private static final String REMOTE_GROUP_ID = "remote_group_id";
+    private static final String REMOTE_IP_PREFIX = "remote_ip_prefix";
+    private static final String SECURITY_GROUP_ID = "security_group_id";
+    private static final String TENAN_ID = "tenant_id";
+
+    @Override
+    public OpenstackSecurityGroup decode(ObjectNode json, CodecContext context) {
+        JsonNode securityGroupNode = json.get(SECURITY_GROUP);
+        if (securityGroupNode == null) {
+            log.warn("SecurityGroup Json data is null");
+            return null;
+        }
+
+        String description = securityGroupNode.path(DESCRIPTION).asText();
+        String id = securityGroupNode.path(ID).asText();
+        String name = securityGroupNode.path(NAME).asText();
+        ArrayNode ruleInfoList = (ArrayNode) securityGroupNode.path(SECURITY_GROUP_RULES);
+        Collection<OpenstackSecurityGroupRule> rules = Lists.newArrayList();
+        for (JsonNode ruleInfo: ruleInfoList) {
+            OpenstackSecurityGroupRule openstackSecurityGroupRule =
+                    new OpenstackSecurityGroupRule.Builder()
+                        .direction(ruleInfo.path(DIRECTION).asText())
+                        .etherType(ruleInfo.path(EHTERTYPE).asText())
+                        .id(ruleInfo.path(ID).asText())
+                        .portRangeMax(ruleInfo.path(PORT_RANGE_MAX).asText())
+                        .portRangeMin(ruleInfo.path(PORT_RANGE_MIN).asText())
+                        .protocol(ruleInfo.path(PROTOCOL).asText())
+                        .remoteGroupId(ruleInfo.path(REMOTE_GROUP_ID).asText())
+                        .remoteIpPrefix(ruleInfo.path(REMOTE_IP_PREFIX).asText())
+                        .securityGroupId(ruleInfo.path(SECURITY_GROUP_ID).asText())
+                        .tenantId(ruleInfo.path(TENAN_ID).asText())
+                        .build();
+
+            rules.add(openstackSecurityGroupRule);
+        }
+        String tenantId = securityGroupNode.path(TENAN_ID).asText();
+
+        OpenstackSecurityGroup openstackSecurityGroup = OpenstackSecurityGroup.builder()
+                .description(description)
+                .id(id)
+                .name(name)
+                .rules(rules)
+                .tenantId(tenantId)
+                .build();
+
+        return openstackSecurityGroup;
+    }
+}
diff --git a/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackSubnetCodec.java b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackSubnetCodec.java
new file mode 100644
index 0000000..70ccb96
--- /dev/null
+++ b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/OpenstackSubnetCodec.java
@@ -0,0 +1,85 @@
+/*
+ * 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.openstackinterface.web;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Lists;
+import org.onlab.packet.Ip4Address;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.openstackinterface.OpenstackSubnet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Encodes and decodes the OpenstackSubnet.
+ */
+public class OpenstackSubnetCodec extends JsonCodec<OpenstackSubnet> {
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    // JSON Field names
+    private static final String SUBNET = "subnet";
+    private static final String NAME = "name";
+    private static final String ENABLE_DHCP = "enable_dhcp";
+    private static final String NETWORK_ID = "network_id";
+    private static final String TENANT_ID = "tenant_id";
+    private static final String DNS_NAMESERVERS = "dns_nameservers";
+    private static final String GATEWAY_IP = "gateway_ip";
+    private static final String CIDR = "cidr";
+    private static final String ID = "id";
+
+    @Override
+    public OpenstackSubnet decode(ObjectNode json, CodecContext context) {
+        checkNotNull(json);
+        JsonNode subnetInfo = json.get(SUBNET);
+        if (subnetInfo == null) {
+            subnetInfo = json;
+        }
+
+        String name = subnetInfo.path(NAME).asText();
+        boolean enableDhcp = subnetInfo.path(ENABLE_DHCP).asBoolean();
+        String networkId = subnetInfo.path(NETWORK_ID).asText();
+        String tenantId = subnetInfo.path(TENANT_ID).asText();
+        ArrayNode dnsNameservsers = (ArrayNode) subnetInfo.path(DNS_NAMESERVERS);
+        List<Ip4Address> dnsList = Lists.newArrayList();
+        if (dnsNameservsers != null && !dnsNameservsers.isMissingNode()) {
+            dnsNameservsers.forEach(dns -> dnsList.add(Ip4Address.valueOf(dns.asText())));
+        }
+        String gatewayIp = subnetInfo.path(GATEWAY_IP).asText();
+        String cidr = subnetInfo.path(CIDR).asText();
+        String id = subnetInfo.path(ID).asText();
+
+        OpenstackSubnet openstackSubnet = OpenstackSubnet.builder()
+                .setName(name)
+                .setEnableDhcp(enableDhcp)
+                .setNetworkId(networkId)
+                .setTenantId(tenantId)
+                .setDnsNameservers(dnsList)
+                .setGatewayIp(gatewayIp)
+                .setCidr(cidr)
+                .setId(id)
+                .build();
+        return openstackSubnet;
+    }
+}
diff --git a/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/package-info.java b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/package-info.java
new file mode 100644
index 0000000..cca89f9
--- /dev/null
+++ b/apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/web/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2015-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.
+ */
+
+/**
+ * OpenStack networking implementation.
+ */
+package org.onosproject.openstackinterface.web;
diff --git a/apps/openstackinterface/network-cfg.json b/apps/openstackinterface/network-cfg.json
new file mode 100644
index 0000000..c177e59
--- /dev/null
+++ b/apps/openstackinterface/network-cfg.json
@@ -0,0 +1,29 @@
+{
+    "apps" : {
+        "org.onosproject.openstackinterface" : {
+            "openstackinterface" : {
+                 "neutron_server" : "http://10.40.101.209:9696/v2.0/",
+                 "keystone_server" : "http://10.40.101.209:5000/v2.0/",
+		 "user_name" : "admin",
+                 "password" : "nova"
+             }
+         }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "basic" : {
+                "driver" : "sona"
+            }
+        },
+        "of:0000000000000002" : {
+            "basic" : {
+                "driver" : "sona"
+            }
+        },
+        "of:0000000000000003" : {
+            "basic" : {
+                "driver" : "sona"
+            }
+        }
+    }
+}
diff --git a/apps/openstackinterface/pom.xml b/apps/openstackinterface/pom.xml
new file mode 100644
index 0000000..2298af9
--- /dev/null
+++ b/apps/openstackinterface/pom.xml
@@ -0,0 +1,38 @@
+<?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>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-apps</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-openstackinterface</artifactId>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>api</module>
+        <module>app</module>
+    </modules>
+
+</project>
+