Refactoring of OpenstackSwitching and OpenstackRouting

Change-Id: Ib7caea98006274dcdfebfe27c07e3533730ab23e
diff --git a/apps/openstacknetworking/api/pom.xml b/apps/openstacknetworking/api/pom.xml
new file mode 100644
index 0000000..b4ad7c1
--- /dev/null
+++ b/apps/openstacknetworking/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-openstacknetworking</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-openstacknetworking-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/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackExternalGateway.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackExternalGateway.java
new file mode 100644
index 0000000..8f1e741
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackExternalGateway.java
@@ -0,0 +1,144 @@
+/*
+ * 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.openstacknetworking;
+
+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 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, externalFixedIps);
+        }
+    }
+
+}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackFloatingIP.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackFloatingIP.java
new file mode 100644
index 0000000..bed0289
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackFloatingIP.java
@@ -0,0 +1,266 @@
+/*
+ * 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.openstacknetworking;
+
+import org.onlab.packet.Ip4Address;
+
+import java.util.Objects;
+
+/**
+ *  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 final String portId;
+    private final 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;
+    }
+
+    /**
+     * Returns router ID.
+     *
+     * @return router ID
+     */
+    public String routerId() {
+        return 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(status, id, tenantId, networkId,
+                    fixedIpAddress, portId, routerId, floatingIpAddress);
+
+        }
+    }
+}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetwork.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetwork.java
new file mode 100644
index 0000000..23a0674
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/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.openstacknetworking;
+
+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/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingConfig.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingConfig.java
new file mode 100644
index 0000000..37e9c06
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingConfig.java
@@ -0,0 +1,136 @@
+/*
+ * 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.openstacknetworking;
+
+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 DONOTPUSH = "do_not_push_flows";
+    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 flag whether the app pushes flows or not.
+     *
+     * @return the flag or false if not set
+     */
+    public boolean doNotPushFlows() {
+        String flag = get(DONOTPUSH, "false");
+        return Boolean.valueOf(flag);
+    }
+
+    /**
+     * 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 flag whether the app pushes flows or not.
+     *
+     * @param flag the flag whether the app pushes flows or not
+     * @return self
+     */
+    public BasicElementConfig doNotPushFlows(boolean flag) {
+        return (BasicElementConfig) setOrClear(DONOTPUSH, flag);
+    }
+
+    /**
+     * 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/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingService.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingService.java
new file mode 100644
index 0000000..6bd6bf8
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingService.java
@@ -0,0 +1,128 @@
+/*
+ * 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.openstacknetworking;
+
+import org.onosproject.net.Port;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Handles port management REST API from Openstack for VMs.
+ */
+public interface OpenstackNetworkingService {
+
+    /**
+     * 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);
+
+    /**
+     * Retruns OpenstackPortInfo map.
+     *
+     * @return OpenstackPortInfo map
+     */
+    Map<String, OpenstackPortInfo> openstackPortInfo();
+
+    /**
+     * Sets configurations specified by net-config.xml file.
+     *
+     * @param neutronUrl neutron server url
+     * @param keystoneUrl keystone server url
+     * @param userName horizon user name
+     * @param pass horizon passowrd
+     */
+    void setConfigurations(String neutronUrl, String keystoneUrl, String userName, String pass);
+
+    /**
+     * 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/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPort.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPort.java
new file mode 100644
index 0000000..13bcb0e
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/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.openstacknetworking;
+
+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/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPortInfo.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPortInfo.java
new file mode 100644
index 0000000..0099ea9
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPortInfo.java
@@ -0,0 +1,108 @@
+/*
+ * 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.openstacknetworking;
+
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.MacAddress;
+import org.onosproject.net.DeviceId;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Contains OpenstackPort Information.
+ */
+public class OpenstackPortInfo {
+    private final Ip4Address hostIp;
+    private final MacAddress hostMac;
+    private final DeviceId deviceId;
+    private final long vni;
+    private final Ip4Address gatewayIP;
+
+    public OpenstackPortInfo(Ip4Address hostIp, MacAddress hostMac, DeviceId deviceId, long vni, Ip4Address gatewayIP) {
+        this.hostIp = hostIp;
+        this.hostMac = hostMac;
+        this.deviceId = deviceId;
+        this.vni = vni;
+        this.gatewayIP = gatewayIP;
+    }
+
+    public Ip4Address ip() {
+        return hostIp;
+    }
+
+    public MacAddress mac() {
+        return hostMac;
+    }
+
+    public DeviceId deviceId() {
+        return deviceId;
+    }
+
+    public long vni() {
+        return vni;
+    }
+
+    public Ip4Address gatewayIP() {
+        return gatewayIP;
+    }
+
+    public static OpenstackPortInfo.Builder builder() {
+        return new Builder();
+    }
+
+    public static final class Builder {
+        private Ip4Address hostIp;
+        private MacAddress hostMac;
+        private DeviceId deviceId;
+        private long vni;
+        private Ip4Address gatewayIP;
+
+        public Builder setGatewayIP(Ip4Address gatewayIP) {
+            this.gatewayIP = checkNotNull(gatewayIP, "gatewayIP cannot be null");
+            return this;
+        }
+
+        public Builder setHostIp(Ip4Address hostIp) {
+            this.hostIp = checkNotNull(hostIp, "hostIp cannot be null");
+            return this;
+        }
+
+        public Builder setHostMac(MacAddress hostMac) {
+            this.hostMac = checkNotNull(hostMac, "hostMac cannot be bull");
+            return this;
+        }
+
+        public Builder setDeviceId(DeviceId deviceId) {
+            this.deviceId = checkNotNull(deviceId, "deviceId cannot be null");
+            return this;
+        }
+
+        public Builder setVni(long vni) {
+            this.vni = checkNotNull(vni, "vni cannot be null");
+            return this;
+        }
+        public OpenstackPortInfo build() {
+            return new OpenstackPortInfo(this);
+        }
+    }
+
+    private OpenstackPortInfo(Builder builder) {
+        hostIp = builder.hostIp;
+        hostMac = builder.hostMac;
+        deviceId = builder.deviceId;
+        vni = builder.vni;
+        gatewayIP = builder.gatewayIP;
+    }
+}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouter.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouter.java
new file mode 100644
index 0000000..8e513f1
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouter.java
@@ -0,0 +1,218 @@
+/*
+ * 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.openstacknetworking;
+
+import java.util.Objects;
+
+/**
+ * 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 final RouterStatus status;
+    private final boolean adminStateUp;
+    private final 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(id, tenantId, name, status,
+                    adminStateUp, gatewayExternalInfo);
+        }
+    }
+
+
+}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouterInterface.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouterInterface.java
new file mode 100644
index 0000000..972e6c5
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/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.openstacknetworking;
+
+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(id, tenantId, subnetId, portId);
+        }
+
+    }
+}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRoutingService.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRoutingService.java
new file mode 100644
index 0000000..101059a
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRoutingService.java
@@ -0,0 +1,80 @@
+/*
+ * 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.openstacknetworking;
+
+/**
+ * The Interface of Openstack Routing.
+ */
+public interface OpenstackRoutingService {
+
+    /**
+     * Stores the Floating IP information created by Openstack.
+     *
+     * @param openstackFloatingIP Floating IP information
+     */
+    void createFloatingIP(OpenstackFloatingIP openstackFloatingIP);
+
+    /**
+     * Updates flow rules corresponding to the Floating IP information updated by Openstack.
+     *
+     * @param openstackFloatingIP Floating IP information
+     */
+    void updateFloatingIP(OpenstackFloatingIP openstackFloatingIP);
+
+    /**
+     * Removes flow rules corresponding to Floating IP information removed by Openstack.
+     *
+     * @param id Deleted Floating IP`s ID
+     */
+    void deleteFloatingIP(String id);
+
+    /**
+     * Stores the router information created by Openstack.
+     *
+     * @param openstackRouter Floating IP information
+     */
+    void createRouter(OpenstackRouter openstackRouter);
+
+    /**
+     * Updates flow rules corresponding to the router information updated by Openstack.
+     *
+     * @param openstackRouter Router information
+     */
+    void updateRouter(OpenstackRouter openstackRouter);
+
+    /**
+     * Removes flow rules corresponding to the router information removed by Openstack.
+     *
+     * @param id Deleted router`s ID
+     */
+    void deleteRouter(String id);
+
+    /**
+     * Updates flow rules corresponding to the router information updated by Openstack.
+     *
+     * @param openstackRouterInterface Router information
+     */
+    void updateRouterInterface(OpenstackRouterInterface openstackRouterInterface);
+
+    /**
+     * Removes flow rules corresponding to the router information removed by Openstack.
+     *
+     * @param openstackRouterInterface Router information
+     */
+    void removeRouterInterface(OpenstackRouterInterface openstackRouterInterface);
+
+
+}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSecurityGroup.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSecurityGroup.java
new file mode 100644
index 0000000..358b92b
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/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.openstacknetworking;
+
+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/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSecurityGroupRule.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSecurityGroupRule.java
new file mode 100644
index 0000000..8b9da8f
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/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.openstacknetworking;
+
+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/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSubnet.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSubnet.java
new file mode 100644
index 0000000..8223711
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/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.openstacknetworking;
+
+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/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSwitchingService.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSwitchingService.java
new file mode 100644
index 0000000..9f70a00
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSwitchingService.java
@@ -0,0 +1,67 @@
+/*
+ * 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.openstacknetworking;
+
+import java.util.Map;
+
+/**
+ * Handles port management REST API from Openstack for VMs.
+ */
+public interface OpenstackSwitchingService {
+
+    /**
+     * Store the port information created by Openstack.
+     *
+     * @param openstackPort port information
+     */
+    void createPorts(OpenstackPort openstackPort);
+
+    /**
+     * Removes flow rules corresponding to the port removed by Openstack.
+     *
+     * @param uuid UUID
+     */
+    void removePort(String uuid);
+
+    /**
+     * Updates flow rules corresponding to the port information updated by Openstack.
+     *
+     * @param openstackPort OpenStack port
+     */
+    void updatePort(OpenstackPort openstackPort);
+
+    /**
+     * Stores the network information created by openstack.
+     *
+     * @param openstackNetwork network information
+     */
+    void createNetwork(OpenstackNetwork openstackNetwork);
+
+    /**
+     * Stores the subnet information created by openstack.
+     *
+     * @param openstackSubnet subnet information
+     */
+    void createSubnet(OpenstackSubnet openstackSubnet);
+
+    /**
+     * Retruns OpenstackPortInfo map.
+     *
+     * @return OpenstackPortInfo map
+     */
+    Map<String, OpenstackPortInfo> openstackPortInfo();
+
+}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/package-info.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/package-info.java
new file mode 100644
index 0000000..bf6a8cc
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/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.openstacknetworking;
\ No newline at end of file