[ONOS-6183] NET l3VPN structure and store implementation

Change-Id: I2fc9054dba07ef522b3cc879810422bd0f1f5de4
diff --git a/apps/l3vpn/BUCK b/apps/l3vpn/BUCK
index dbe100a..1c6d6ef 100644
--- a/apps/l3vpn/BUCK
+++ b/apps/l3vpn/BUCK
@@ -10,7 +10,7 @@
 onos_app(
   app_name = 'org.onosproject.l3vpn',
   title = 'YANG L3VPN App',
-  category = 'Traffic Steering',
+  category = 'L3VPN APP',
   url = 'http://onosproject.org',
   included_bundles = BUNDLES,
   description = 'L3VPN YANG Application',
diff --git a/apps/l3vpn/netl3vpn/BUCK b/apps/l3vpn/netl3vpn/BUCK
index 47b8c9a..d4d436a 100644
--- a/apps/l3vpn/netl3vpn/BUCK
+++ b/apps/l3vpn/netl3vpn/BUCK
@@ -1,6 +1,8 @@
 COMPILE_DEPS = [
   '//lib:CORE_DEPS',
   '//apps/l3vpn/yangmodel:onos-apps-l3vpn-yangmodel',
+  '//apps/config:onos-apps-config',
+  '//core/store/serializers:onos-core-serializers',
   '//lib:onos-yang-model',
   '//lib:onos-yang-runtime',
 ]
diff --git a/apps/l3vpn/netl3vpn/pom.xml b/apps/l3vpn/netl3vpn/pom.xml
index 2ce1d09..e1dbc1f 100644
--- a/apps/l3vpn/netl3vpn/pom.xml
+++ b/apps/l3vpn/netl3vpn/pom.xml
@@ -32,7 +32,7 @@
     <description>IETF L3VPN Service Model</description>
 
     <properties>
-        <yang-tool-version>1.12.0-b5</yang-tool-version>
+        <yang-tool-version>1.12.0-b6</yang-tool-version>
     </properties>
 
     <dependencies>
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/AccessInfo.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/AccessInfo.java
new file mode 100644
index 0000000..3728cbe
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/AccessInfo.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+import com.google.common.base.Objects;
+
+/**
+ * Representation of site network access information.
+ */
+public class AccessInfo {
+
+    /**
+     * Site id from sites list.
+     */
+    private String siteId;
+
+    /**
+     * Site network access id from site network access list.
+     */
+    private String accessId;
+
+    /**
+     * Constructs access info with site id and access id.
+     *
+     * @param s site id
+     * @param a access id
+     */
+    public AccessInfo(String s, String a) {
+        siteId = s;
+        accessId = a;
+    }
+
+    /**
+     * Returns the site id.
+     *
+     * @return site id
+     */
+    String siteId() {
+        return siteId;
+    }
+
+    /**
+     * Returns the access id.
+     *
+     * @return access id
+     */
+    String accessId() {
+        return accessId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(siteId, accessId);
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (this == object) {
+            return true;
+        }
+        if (object instanceof AccessInfo) {
+            AccessInfo that = (AccessInfo) object;
+            return Objects.equal(siteId, that.siteId) &&
+                    Objects.equal(accessId, that.accessId);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return "Access id : " + accessId + "\nSite id : " + siteId;
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/BgpDriverInfo.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/BgpDriverInfo.java
new file mode 100644
index 0000000..151f3e5
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/BgpDriverInfo.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+/**
+ * Representation of BGP configuration required for driver to process.
+ */
+public class BgpDriverInfo {
+
+    /**
+     * Model id level of the BGP information that needed to be added in store.
+     */
+    private BgpModelIdLevel modIdLevel;
+
+    /**
+     * Device id required for the creation of driver model object data.
+     */
+    private String devId;
+
+    /**
+     * Constructs BGP driver info.
+     *
+     * @param m model id level for BGP
+     * @param d device id
+     */
+    public BgpDriverInfo(BgpModelIdLevel m, String d) {
+        modIdLevel = m;
+        devId = d;
+    }
+
+    /**
+     * Returns the model id level of the BGP information to be added.
+     *
+     * @return model id level
+     */
+    BgpModelIdLevel modIdLevel() {
+        return modIdLevel;
+    }
+
+    /**
+     * Returns the device id.
+     *
+     * @return device id
+     */
+    String devId() {
+        return devId;
+    }
+
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/BgpInfo.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/BgpInfo.java
new file mode 100644
index 0000000..e461b24
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/BgpInfo.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Representation of BGP information which contains the protocol info and the
+ * VPN name.
+ */
+public class BgpInfo {
+
+    /**
+     * Map of route protocol and the protocol info for the BGP info.
+     */
+    private Map<RouteProtocol, ProtocolInfo> protocolInfo;
+
+    /**
+     * VPN name, to which the BGP info belongs.
+     */
+    private String vpnName;
+
+    /**
+     * Constructs BGP info.
+     */
+    public BgpInfo() {
+    }
+
+    /**
+     * Returns the map of protocol info associated with the BGP info.
+     *
+     * @return protocol info map.
+     */
+    Map<RouteProtocol, ProtocolInfo> protocolInfo() {
+        return protocolInfo;
+    }
+
+    /**
+     * Sets the map of protocol info with route protocol as key value.
+     *
+     * @param protocolInfo protocol info map
+     */
+    void protocolInfo(Map<RouteProtocol, ProtocolInfo> protocolInfo) {
+        this.protocolInfo = protocolInfo;
+    }
+
+    /**
+     * Adds a protocol info with route protocol as key to the map.
+     *
+     * @param route route protocol
+     * @param info  protocol info
+     */
+    void addProtocolInfo(RouteProtocol route, ProtocolInfo info) {
+        if (protocolInfo == null) {
+            protocolInfo = new HashMap<>();
+        }
+        protocolInfo.put(route, info);
+    }
+
+    /**
+     * Returns the VPN name of the BGP info.
+     *
+     * @return VPN name
+     */
+    String vpnName() {
+        return vpnName;
+    }
+
+    /**
+     * Sets the VPN name.
+     *
+     * @param vpnName VPN name
+     */
+    void vpnName(String vpnName) {
+        this.vpnName = vpnName;
+    }
+
+    @Override
+    public String toString() {
+        return "VPN name : " + vpnName;
+    }
+}
+
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/BgpModelIdLevel.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/BgpModelIdLevel.java
new file mode 100644
index 0000000..334f2fe
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/BgpModelIdLevel.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+/**
+ * Represents the model id level of BGP information to be added to store.
+ * //TODO: Further more levels of BGP addition has to be added.
+ */
+public enum BgpModelIdLevel {
+
+    /**
+     * Requested model id level is not present, representing top node.
+     */
+    ROOT,
+
+    /**
+     * Requested model id level is devices container.
+     */
+    DEVICES,
+
+    /**
+     * Requested model id level is device list.
+     */
+    DEVICE
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/DeviceInfo.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/DeviceInfo.java
new file mode 100644
index 0000000..8b4421e
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/DeviceInfo.java
@@ -0,0 +1,241 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.driver.DriverService;
+import org.onosproject.yang.model.ModelObjectData;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Representation of standard device model, with interface, instance and its
+ * respective device id.
+ */
+public class DeviceInfo {
+
+    /**
+     * Device id of the device.
+     */
+    private final DeviceId deviceId;
+
+    /**
+     * BGP information of the device.
+     */
+    private BgpInfo bgpInfo;
+
+    /**
+     * List of interface names of the device.
+     */
+    private List<String> ifNames;
+
+    /**
+     * List of network access of the device.
+     */
+    private List<AccessInfo> accesses;
+
+    /**
+     * Constructs device info with a device id.
+     *
+     * @param d device id
+     */
+    public DeviceInfo(DeviceId d) {
+        deviceId = d;
+    }
+
+    /**
+     * Returns the device id.
+     *
+     * @return device id
+     */
+    DeviceId deviceId() {
+        return deviceId;
+    }
+
+    /**
+     * Adds a interface name to the list.
+     *
+     * @param ifName interface name
+     */
+    void addIfName(String ifName) {
+        if (ifNames == null) {
+            ifNames = new LinkedList<>();
+        }
+        ifNames.add(ifName);
+    }
+
+    /**
+     * Returns the list of interface name.
+     *
+     * @return interface names
+     */
+    List<String> ifNames() {
+        return ifNames;
+    }
+
+    /**
+     * Sets the list of interface name.
+     *
+     * @param ifNames interface names
+     */
+    void ifNames(List<String> ifNames) {
+        this.ifNames = ifNames;
+    }
+
+    /**
+     * Returns the BGP information.
+     *
+     * @return BGP info
+     */
+    BgpInfo bgpInfo() {
+        return bgpInfo;
+    }
+
+    /**
+     * Sets the BGP information.
+     *
+     * @param bgpInfo BGP info
+     */
+    void bgpInfo(BgpInfo bgpInfo) {
+        this.bgpInfo = bgpInfo;
+    }
+
+    /**
+     * Returns the list of network accesses.
+     *
+     * @return network accesses
+     */
+    List<AccessInfo> accesses() {
+        return accesses;
+    }
+
+    /**
+     * Sets the list of network accesses.
+     *
+     * @param accesses network accesses
+     */
+    void accesses(List<AccessInfo> accesses) {
+        this.accesses = accesses;
+    }
+
+    /**
+     * Adds a access info to the network accesses list.
+     *
+     * @param accessInfo access info
+     */
+    void addAccessInfo(AccessInfo accessInfo) {
+        if (accesses == null) {
+            accesses = new LinkedList<>();
+        }
+        accesses.add(accessInfo);
+    }
+
+    /**
+     * Processes the creation of VPN instance to the driver with the model
+     * object data of standard device model. It returns the VPN instance of
+     * driver constructed model object data.
+     *
+     * @param driverSvc driver service
+     * @param modelData std device model object data
+     * @return driver instance model object data
+     */
+    ModelObjectData processCreateInstance(DriverService driverSvc,
+                                          ModelObjectData modelData) {
+        // TODO: Need to call the behaviour.
+        return null;
+    }
+
+    /**
+     * Processes the creation of interface to the driver with the model
+     * object data of standard device model. It returns the interface of driver
+     * constructed model object data.
+     *
+     * @param driverSvc driver service
+     * @param modData   std device model object data
+     * @return driver interface model object data
+     */
+    ModelObjectData processCreateInterface(DriverService driverSvc,
+                                           ModelObjectData modData) {
+        // TODO: Need to call the behaviour.
+        return null;
+    }
+
+    /**
+     * Processes the creation of BGP info to the driver with the BGP info and
+     * the BGP driver configuration. It returns the BGP info of driver
+     * constructed model object data.
+     *
+     * @param driverSvc  driver service
+     * @param bgpInfo    BGP info
+     * @param driverInfo driver config details
+     * @return driver BGP model object data
+     */
+    ModelObjectData processCreateBgpInfo(DriverService driverSvc,
+                                         BgpInfo bgpInfo,
+                                         BgpDriverInfo driverInfo) {
+        // TODO: Need to call the behaviour.
+        return null;
+    }
+
+    /**
+     * Processes the deletion of VPN instance to the driver with the model
+     * object data of standard device model. It returns the VPN instance of
+     * driver constructed model object data.
+     *
+     * @param driverSvc driver service
+     * @param modData   model object data
+     * @return driver instance model object data
+     */
+    ModelObjectData processDeleteInstance(DriverService driverSvc,
+                                          ModelObjectData modData) {
+        // TODO: Need to call the behaviour.
+        return null;
+    }
+
+    /**
+     * Processes the deletion of interface to the driver with the model
+     * object data of standard device model. It returns the interface of driver
+     * constructed model object data.
+     *
+     * @param driverSvc  driver service
+     * @param objectData model object data
+     * @return driver interface model object data
+     */
+    ModelObjectData processDeleteInterface(DriverService driverSvc,
+                                           ModelObjectData objectData) {
+        // TODO: Need to call the behaviour.
+        return null;
+    }
+
+    /**
+     * Processes the deletion of BGP info to the driver with the BGP info and
+     * the BGP driver configuration. It returns the BGP info of driver
+     * constructed model object data.
+     *
+     * @param driverSvc  driver service
+     * @param bgpInfo    BGP info
+     * @param driverInfo driver config details
+     * @return driver BGP model object data
+     */
+    ModelObjectData processDeleteBgpInfo(DriverService driverSvc,
+                                         BgpInfo bgpInfo,
+                                         BgpDriverInfo driverInfo) {
+        // TODO: Need to call the behaviour.
+        return null;
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/FullMeshVpnConfig.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/FullMeshVpnConfig.java
new file mode 100644
index 0000000..8802fc0
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/FullMeshVpnConfig.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+/**
+ * Representation of the full mesh VPN configuration containing RT.
+ */
+public class FullMeshVpnConfig extends VpnConfig {
+
+    /**
+     * Route target value.
+     */
+    private String rt;
+
+    /** Constructs full mesh VPN config.
+     *
+     * @param r RT value
+     */
+    public FullMeshVpnConfig(String r) {
+        rt = r;
+    }
+
+    /**
+     * Returns the RT value.
+     *
+     * @return RT value
+     */
+    String rt() {
+        return rt;
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/HubSpokeVpnConfig.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/HubSpokeVpnConfig.java
new file mode 100644
index 0000000..d305ae3
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/HubSpokeVpnConfig.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+/**
+ * Representation of the hub and spoke VPN configuration containing import and
+ * export RTs.
+ */
+public class HubSpokeVpnConfig extends VpnConfig {
+
+    /**
+     * Hub import RT value.
+     */
+    private String hubImpRt;
+
+    /**
+     * Hub export RT value.
+     */
+    private String hubExpRt;
+
+    /**
+     * Spoke import RT value.
+     */
+    private String spokeImpRt;
+
+    /**
+     * Spoke export RT value.
+     */
+    private String spokeExpRt;
+
+    /**
+     * Creates hub and spoke VPN config.
+     */
+    public HubSpokeVpnConfig() {
+    }
+
+    /**
+     * Returns hub import RT value.
+     *
+     * @return RT value
+     */
+    String hubImpRt() {
+        return hubImpRt;
+    }
+
+    /**
+     * Sets hub import RT value.
+     *
+     * @param hubImpRt RT value
+     */
+    void hubImpRt(String hubImpRt) {
+        this.hubImpRt = hubImpRt;
+    }
+
+    /**
+     * Returns hub export RT value.
+     *
+     * @return RT value
+     */
+    String hubExpRt() {
+        return hubExpRt;
+    }
+
+    /**
+     * Sets hub export RT value.
+     *
+     * @param hubExpRt RT value
+     */
+    void hubExpRt(String hubExpRt) {
+        this.hubExpRt = hubExpRt;
+    }
+
+    /**
+     * Returns spoke import RT value.
+     *
+     * @return RT value
+     */
+    String spokeImpRt() {
+        return spokeImpRt;
+    }
+
+    /**
+     * Sets spoke import RT value.
+     *
+     * @param spokeImpRt RT value
+     */
+    void spokeImpRt(String spokeImpRt) {
+        this.spokeImpRt = spokeImpRt;
+    }
+
+    /**
+     * Returns spoke export RT value.
+     *
+     * @return RT value
+     */
+    String spokeExpRt() {
+        return spokeExpRt;
+    }
+
+    /**
+     * Sets spoke export RT value.
+     *
+     * @param spokeExpRt RT value
+     */
+    void spokeExpRt(String spokeExpRt) {
+        this.spokeExpRt = spokeExpRt;
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/InterfaceInfo.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/InterfaceInfo.java
new file mode 100644
index 0000000..ecdddb6
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/InterfaceInfo.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+/**
+ * Representation of interface information, which has the interface name and
+ * its binding VPN name and the device info to which it belongs to.
+ */
+public class InterfaceInfo {
+
+    /**
+     * Device info value.
+     */
+    private DeviceInfo devInfo;
+
+    /**
+     * Interface name.
+     */
+    private String intName;
+
+    /**
+     * VPN instance name.
+     */
+    private String vpnName;
+
+    /**
+     * Constructs interface info.
+     *
+     * @param d device info
+     * @param i interface name
+     * @param v VPN name
+     */
+    public InterfaceInfo(DeviceInfo d, String i, String v) {
+        devInfo = d;
+        intName = i;
+        vpnName = v;
+    }
+
+    /**
+     * Returns device info of the interface.
+     *
+     * @return device info
+     */
+    DeviceInfo devInfo() {
+        return devInfo;
+    }
+
+    /**
+     * Returns the interface name.
+     *
+     * @return interface name
+     */
+    String intName() {
+        return intName;
+    }
+
+    /**
+     * Returns the VPN name.
+     *
+     * @return VPN name
+     */
+    String vpnName() {
+        return vpnName;
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/NetL3VpnException.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/NetL3VpnException.java
new file mode 100644
index 0000000..066e4fd
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/NetL3VpnException.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+/**
+ * Representation of exception that needs to be handled by net l3 VPN.
+ */
+public class NetL3VpnException extends RuntimeException {
+
+    /**
+     * Creates net l3 VPN exception with an exception message.
+     *
+     * @param excMsg message
+     */
+    public NetL3VpnException(String excMsg) {
+        super(excMsg);
+    }
+
+    /**
+     * Creates net l3 VPN exception with a cause for it.
+     *
+     * @param cause cause
+     */
+    public NetL3VpnException(Throwable cause) {
+        super(cause);
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/NetL3VpnStore.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/NetL3VpnStore.java
new file mode 100644
index 0000000..b5f8681
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/NetL3VpnStore.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+import org.onosproject.net.DeviceId;
+
+import java.util.Map;
+
+/**
+ * Abstraction of an entity providing pool of available VPN instances
+ * its associated devices and interface information.
+ */
+public interface NetL3VpnStore {
+
+    /**
+     * Returns the freed ids that can be re-used for RD and RT generation.
+     *
+     * @return collection of freed ids
+     */
+    Iterable<Long> getFreedIdList();
+
+    /**
+     * Returns the VPN instance map available in the store.
+     *
+     * @return VPN instance map
+     */
+    Map<String, VpnInstance> getVpnInstances();
+
+    /**
+     * Returns the BGP info map available in the store.
+     *
+     * @return BGP info map
+     */
+    Map<BgpInfo, DeviceId> getBgpInfo();
+
+    /**
+     * Returns the interface information map available in the store.
+     *
+     * @return interface info map
+     */
+    Map<AccessInfo, InterfaceInfo> getInterfaceInfo();
+
+    /**
+     * Adds freed id to the freed list in the store.
+     *
+     * @param id id
+     */
+    void addIdToFreeList(Long id);
+
+    /**
+     * Adds the VPN name and the VPN instance, if the map does'nt have the
+     * value with it.
+     *
+     * @param name     VPN name
+     * @param instance VPN instance
+     */
+    void addVpnInsIfAbsent(String name, VpnInstance instance);
+
+    /**
+     * Adds the access info and the interface info to the map in store.
+     *
+     * @param accessInfo access info
+     * @param intInfo    interface info
+     */
+    void addInterfaceInfo(AccessInfo accessInfo, InterfaceInfo intInfo);
+
+    /**
+     * Adds the BGP info and the device id to the map in store.
+     *
+     * @param bgpInfo BGP info
+     * @param devId   device id
+     */
+    void addBgpInfo(BgpInfo bgpInfo, DeviceId devId);
+
+    /**
+     * Removes the interface info with the key access info from the store.
+     *
+     * @param accessInfo access info
+     * @return true if removed; false otherwise
+     */
+    boolean removeInterfaceInfo(AccessInfo accessInfo);
+
+    /**
+     * Removes the VPN instance from the store with the key VPN name from the
+     * store.
+     *
+     * @param vpnName VPN name
+     * @return true if removed; false otherwise
+     */
+    boolean removeVpnInstance(String vpnName);
+
+    /**
+     * Removes the mentioned id from the freed list.
+     *
+     * @param id id
+     * @return true if removed; false otherwise
+     */
+    boolean removeIdFromFreeList(Long id);
+
+    /**
+     * Removes the device id from the store with the key BGP info from the
+     * store.
+     *
+     * @param bgpInfo BGP info
+     * @return true if removed; false otherwise
+     */
+    boolean removeBgpInfo(BgpInfo bgpInfo);
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/ProtocolInfo.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/ProtocolInfo.java
new file mode 100644
index 0000000..1692127
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/ProtocolInfo.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Representation of protocol info of the BGP info. It contains the route
+ * protocol and the interfaces which are associated with the information.
+ */
+public class ProtocolInfo {
+
+    /**
+     * Route protocol.
+     */
+    private RouteProtocol routeProtocol;
+
+    /**
+     * Interface details which uses this protocol with respect to IPV4 address.
+     */
+    private List<AccessInfo> v4Accesses;
+
+    /**
+     * Interface details which uses this protocol with respect to IPV6 address.
+     */
+    private List<AccessInfo> v6Accesses;
+
+    /**
+     * Status of IPV4 address family available.
+     */
+    private boolean ipv4Af;
+
+    /**
+     * Status of IPV6 address family available.
+     */
+    private boolean ipv6Af;
+
+    /**
+     * Process id of the protocol info.
+     */
+    private String processId;
+
+    /**
+     * Constructs protocol info.
+     */
+    public ProtocolInfo() {
+    }
+
+    /**
+     * Returns the route protocol.
+     *
+     * @return route protocol
+     */
+    RouteProtocol routeProtocol() {
+        return routeProtocol;
+    }
+
+    /**
+     * Sets the route protocol.
+     *
+     * @param routeProtocol route protocol
+     */
+    void routeProtocol(RouteProtocol routeProtocol) {
+        this.routeProtocol = routeProtocol;
+    }
+
+    /**
+     * Returns the process id.
+     *
+     * @return process id
+     */
+    String processId() {
+        return processId;
+    }
+
+    /**
+     * Sets the process id.
+     *
+     * @param processId process id.
+     */
+    void processId(String processId) {
+        this.processId = processId;
+    }
+
+    /**
+     * Returns true if the IPV4 address family uses the protocol info; false
+     * otherwise.
+     *
+     * @return true if IPV4 address family uses; false otherwise
+     */
+    boolean isIpv4Af() {
+        return ipv4Af;
+    }
+
+    /**
+     * Sets true if the IPV4 address family uses the protocol info; false
+     * otherwise.
+     *
+     * @param ipv4Af true if IPV4 interface uses; false otherwise
+     */
+    void ipv4Af(boolean ipv4Af) {
+        this.ipv4Af = ipv4Af;
+    }
+
+    /**
+     * Returns true if the IPV6 address family uses the protocol info; false
+     * otherwise.
+     *
+     * @return true if IPV6 address family uses; false otherwise
+     */
+    boolean isIpv6Af() {
+        return ipv6Af;
+    }
+
+    /**
+     * Sets true if the IPV6 address family uses the protocol info; false
+     * otherwise.
+     *
+     * @param ipv6Af true if IPV6 interface uses; false otherwise
+     */
+    void ipv6Af(boolean ipv6Af) {
+        this.ipv6Af = ipv6Af;
+    }
+
+    /**
+     * Returns the list of IPV4 network access information.
+     *
+     * @return IPV4 network accesses
+     */
+    List<AccessInfo> v4Accesses() {
+        return v4Accesses;
+    }
+
+    /**
+     * Sets the list of IPV4 network access information.
+     *
+     * @param v4Accesses IPV4 network accesses
+     */
+    void v4Accesses(List<AccessInfo> v4Accesses) {
+        this.v4Accesses = v4Accesses;
+    }
+
+    /**
+     * Adds a access info to the IPV4 network accesses.
+     *
+     * @param info IPV4 network access
+     */
+    void addV4Key(AccessInfo info) {
+        if (v4Accesses == null) {
+            v4Accesses = new LinkedList<>();
+        }
+        v4Accesses.add(info);
+    }
+
+    /**
+     * Returns the list of IPV6 network access information.
+     *
+     * @return IPV6 network accesses
+     */
+    List<AccessInfo> v6Accesses() {
+        return v6Accesses;
+    }
+
+    /**
+     * Sets the list of IPV6 network access information.
+     *
+     * @param v6Accesses IPV6 network accesses
+     */
+    void v6Accesses(List<AccessInfo> v6Accesses) {
+        this.v4Accesses = v6Accesses;
+    }
+
+    /**
+     * Adds a access info to the IPV6 network accesses.
+     * @param info IPV4 network access
+     */
+    void addV6Key(AccessInfo info) {
+        if (v6Accesses == null) {
+            v6Accesses = new LinkedList<>();
+        }
+        v6Accesses.add(info);
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/RouteProtocol.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/RouteProtocol.java
new file mode 100644
index 0000000..8ff03f6
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/RouteProtocol.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+/**
+ * Represents the route protocol of BGP info.
+ */
+public enum RouteProtocol {
+
+    /**
+     * Requested route protocol type is of BGP.
+     */
+    BGP("bgp"),
+
+    /**
+     * Requested route protocol type is of direct.
+     */
+    DIRECT("direct"),
+
+    /**
+     * Requested route protocol type is of OSPF.
+     */
+    OSPF("ospf"),
+
+    /**
+     * Requested route protocol type is of RIP.
+     */
+    RIP("rip"),
+
+    /**
+     * Requested route protocol type is of RIPNG.
+     */
+    RIP_NG("ripng"),
+
+    /**
+     * Requested route protocol type is of VRRP.
+     */
+    VRRP("vrrp"),
+
+    /**
+     * Requested route protocol type is of static.
+     */
+    STATIC("yangautoprefixstatic");
+
+    /**
+     * Defined protocol type from the enum value.
+     */
+    private final String proType;
+
+    /**
+     * Constructs protocol type value from enum.
+     *
+     * @param proType value of enum
+     */
+    RouteProtocol(String proType) {
+        this.proType = proType;
+    }
+
+    /**
+     * Returns route protocol for corresponding protocol name.
+     *
+     * @param name protocol name
+     * @return route protocol
+     */
+    static RouteProtocol getProType(String name) {
+        for (RouteProtocol protocol : values()) {
+            if (protocol.proType.equals(name.toLowerCase())) {
+                return protocol;
+            }
+        }
+        throw new NetL3VpnException("There is no protocol type as " + name);
+    }
+
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnConfig.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnConfig.java
new file mode 100644
index 0000000..d9973b0
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnConfig.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+/**
+ * Abstraction of VPN config which contains RD value for the VPN instance.
+ */
+public class VpnConfig {
+
+    /**
+     * RD value for VPN instance.
+     */
+    private String rd;
+
+    /**
+     * Created VPN config.
+     */
+    public VpnConfig() {
+    }
+
+    /**
+     * Returns RD value.
+     *
+     * @return RD value
+     */
+    String rd() {
+        return rd;
+    }
+
+    /**
+     * Sets the RD value.
+     *
+     * @param rd RD value
+     */
+    void rd(String rd) {
+        this.rd = rd;
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnInstance.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnInstance.java
new file mode 100644
index 0000000..b411b87
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnInstance.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+import org.onosproject.net.DeviceId;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Representation of stored VPN instance, which contains the configuration
+ * such as RD and RT, also the device info and the VPN type.
+ */
+public class VpnInstance<T extends VpnConfig> {
+
+    /**
+     * VPN instance name.
+     */
+    private String vpnName;
+
+    /**
+     * List of devices for the VPN.
+     */
+    private Map<DeviceId, DeviceInfo> devInfo;
+
+    /**
+     * Type of the VPN.
+     */
+    private VpnType type;
+
+    /**
+     * VPN config information.
+     */
+    private T vpnConfig;
+
+    /**
+     * Creates VPN instance with VPN name.
+     *
+     * @param v VPN name
+     */
+    public VpnInstance(String v) {
+        vpnName = v;
+    }
+
+    /**
+     * Returns the type of the VPN instance.
+     *
+     * @return VPN type
+     */
+    VpnType type() {
+        return type;
+    }
+
+    /**
+     * Sets the type of the VPN instance.
+     *
+     * @param type VPN type
+     */
+    void type(VpnType type) {
+        this.type = type;
+    }
+
+    /**
+     * Returns the configuration of VPN instance.
+     *
+     * @return VPN config
+     */
+    T vpnConfig() {
+        return vpnConfig;
+    }
+
+    /**
+     * Sets the configuration of VPN instance.
+     *
+     * @param vpnConfig VPN config
+     */
+    void vpnConfig(T vpnConfig) {
+        this.vpnConfig = vpnConfig;
+    }
+
+    /**
+     * Returns the device info map.
+     *
+     * @return device info map
+     */
+    Map<DeviceId, DeviceInfo> devInfo() {
+        return devInfo;
+    }
+
+    /**
+     * Sets the device info map.
+     *
+     * @param devInfo device info map
+     */
+    void devInfo(Map<DeviceId, DeviceInfo> devInfo) {
+        this.devInfo = devInfo;
+    }
+
+    /**
+     * Adds the content to device info map.
+     *
+     * @param id   device id
+     * @param info device info
+     */
+    void devInfo(DeviceId id, DeviceInfo info) {
+        if (devInfo == null) {
+            devInfo = new LinkedHashMap<>();
+        }
+        devInfo.put(id, info);
+    }
+
+    /**
+     * Returns the VPN instance name.
+     *
+     * @return VPN name
+     */
+    String vpnName() {
+        return vpnName;
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnSiteRole.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnSiteRole.java
new file mode 100644
index 0000000..e67018c
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnSiteRole.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+/**
+ * Representation of VPN instance name and its respective site role for each
+ * site.
+ */
+public class VpnSiteRole {
+
+    /**
+     * VPN instance name of the site.
+     */
+    private String name;
+
+    /**
+     * Site role of the site.
+     */
+    private VpnType role;
+
+    /**
+     * Creates VPN instance site role.
+     *
+     * @param n VPN name
+     * @param r site role
+     */
+    public VpnSiteRole(String n, VpnType r) {
+        name = n;
+        role = r;
+    }
+
+    /**
+     * Returns the VPN instance name of the site.
+     *
+     * @return VPN name
+     */
+    String name() {
+        return name;
+    }
+
+    /**
+     * Returns the site role.
+     *
+     * @return site role
+     */
+    VpnType role() {
+        return role;
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnType.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnType.java
new file mode 100644
index 0000000..09a3261
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/VpnType.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn;
+
+/**
+ * Represents the type of VPN instance.
+ */
+public enum VpnType {
+
+    /**
+     * Requested VPN type is of full mesh.
+     */
+    ANY_TO_ANY,
+
+    /**
+     * Requested VPN type is of hub.
+     */
+    HUB,
+
+    /**
+     * Requested VPN type is of spoke.
+     */
+    SPOKE
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/DistributedNetL3VpnStore.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/DistributedNetL3VpnStore.java
new file mode 100644
index 0000000..baf3bc4
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/DistributedNetL3VpnStore.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2017-present 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.l3vpn.netl3vpn.impl;
+
+import com.google.common.collect.ImmutableSet;
+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.onlab.util.KryoNamespace;
+import org.onosproject.l3vpn.netl3vpn.AccessInfo;
+import org.onosproject.l3vpn.netl3vpn.BgpInfo;
+import org.onosproject.l3vpn.netl3vpn.DeviceInfo;
+import org.onosproject.l3vpn.netl3vpn.FullMeshVpnConfig;
+import org.onosproject.l3vpn.netl3vpn.HubSpokeVpnConfig;
+import org.onosproject.l3vpn.netl3vpn.InterfaceInfo;
+import org.onosproject.l3vpn.netl3vpn.ProtocolInfo;
+import org.onosproject.l3vpn.netl3vpn.RouteProtocol;
+import org.onosproject.l3vpn.netl3vpn.VpnConfig;
+import org.onosproject.l3vpn.netl3vpn.VpnInstance;
+import org.onosproject.l3vpn.netl3vpn.VpnType;
+import org.onosproject.l3vpn.netl3vpn.NetL3VpnStore;
+import org.onosproject.net.DeviceId;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.ConsistentMap;
+import org.onosproject.store.service.DistributedSet;
+import org.onosproject.store.service.Serializer;
+import org.onosproject.store.service.StorageService;
+import org.onosproject.yang.model.LeafListKey;
+import org.onosproject.yang.model.ListKey;
+import org.onosproject.yang.model.NodeKey;
+import org.onosproject.yang.model.ResourceId;
+import org.onosproject.yang.model.SchemaId;
+import org.slf4j.Logger;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Manages the pool of available VPN instances and its associated devices
+ * and interface information.
+ */
+@Component(immediate = true)
+@Service
+public class DistributedNetL3VpnStore implements NetL3VpnStore {
+
+    private static final Serializer L3VPN_SERIALIZER = Serializer
+            .using(new KryoNamespace.Builder().register(KryoNamespaces.API)
+                           .register(KryoNamespaces.API)
+                           .register(VpnInstance.class)
+                           .register(VpnType.class)
+                           .register(VpnConfig.class)
+                           .register(FullMeshVpnConfig.class)
+                           .register(HubSpokeVpnConfig.class)
+                           .register(DeviceInfo.class)
+                           .register(ResourceId.class)
+                           .register(NodeKey.class)
+                           .register(SchemaId.class)
+                           .register(LeafListKey.class)
+                           .register(ListKey.class)
+                           .register(AccessInfo.class)
+                           .register(BgpInfo.class)
+                           .register(RouteProtocol.class)
+                           .register(ProtocolInfo.class)
+                           .build());
+
+    private static final String FREE_ID_NULL = "Free ID cannot be null";
+    private static final String VPN_NAME_NULL = "VPN name cannot be null";
+    private static final String VPN_INS_NULL = "VPN instance cannot be null";
+    private static final String ACCESS_INFO_NULL = "Access info cannot be null";
+    private static final String BGP_INFO_NULL = "BGP info cannot be null";
+    private static final String INT_INFO_NULL = "Interface info cannot be null";
+    private static final String DEV_ID_NULL = "Device Id cannot be null";
+
+    private final Logger log = getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected StorageService storageService;
+
+    /**
+     * Freed id list of NET L3VPN.
+     */
+    private DistributedSet<Long> freedIdList;
+
+    /**
+     * Map of interface info with access info as key.
+     */
+    private ConsistentMap<AccessInfo, InterfaceInfo> intInfoMap;
+
+    /**
+     * Map of VPN instance with VPN name as key.
+     */
+    private ConsistentMap<String, VpnInstance> vpnInsMap;
+
+    /**
+     * Map of BGP information and the device id.
+     */
+    private ConsistentMap<BgpInfo, DeviceId> bgpInfoMap;
+
+    @Activate
+    protected void activate() {
+        vpnInsMap = storageService.<String, VpnInstance>consistentMapBuilder()
+                .withName("onos-l3vpn-instance-map")
+                .withSerializer(L3VPN_SERIALIZER)
+                .build();
+
+        intInfoMap = storageService
+                .<AccessInfo, InterfaceInfo>consistentMapBuilder()
+                .withName("onos-l3vpn-int-info-map")
+                .withSerializer(L3VPN_SERIALIZER)
+                .build();
+
+        bgpInfoMap = storageService.<BgpInfo, DeviceId>consistentMapBuilder()
+                .withName("onos-l3vpn-bgp-info-map")
+                .withSerializer(L3VPN_SERIALIZER)
+                .build();
+
+        freedIdList = storageService.<Long>setBuilder()
+                .withName("onos-l3vpn-id-freed-list")
+                .withSerializer(Serializer.using(KryoNamespaces.API))
+                .build()
+                .asDistributedSet();
+
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        log.info("Stopped");
+    }
+
+    @Override
+    public Iterable<Long> getFreedIdList() {
+        return ImmutableSet.copyOf(freedIdList);
+    }
+
+    @Override
+    public Map<String, VpnInstance> getVpnInstances() {
+        return vpnInsMap.entrySet().stream()
+                .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()
+                        .value()));
+    }
+
+    @Override
+    public Map<BgpInfo, DeviceId> getBgpInfo() {
+        return bgpInfoMap.entrySet().stream()
+                .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()
+                        .value()));
+    }
+
+    @Override
+    public Map<AccessInfo, InterfaceInfo> getInterfaceInfo() {
+        return intInfoMap.entrySet().stream()
+                .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()
+                        .value()));
+    }
+
+    @Override
+    public void addIdToFreeList(Long id) {
+        checkNotNull(id, FREE_ID_NULL);
+        freedIdList.add(id);
+    }
+
+    @Override
+    public void addVpnInsIfAbsent(String name, VpnInstance instance) {
+        checkNotNull(name, VPN_NAME_NULL);
+        checkNotNull(instance, VPN_INS_NULL);
+        vpnInsMap.putIfAbsent(name, instance);
+    }
+
+    @Override
+    public void addInterfaceInfo(AccessInfo accessInfo, InterfaceInfo intInfo) {
+        checkNotNull(accessInfo, ACCESS_INFO_NULL);
+        checkNotNull(intInfo, INT_INFO_NULL);
+        intInfoMap.putIfAbsent(accessInfo, intInfo);
+    }
+
+    @Override
+    public void addBgpInfo(BgpInfo bgpInfo, DeviceId devId) {
+        checkNotNull(devId, BGP_INFO_NULL);
+        checkNotNull(devId, DEV_ID_NULL);
+        bgpInfoMap.put(bgpInfo, devId);
+    }
+
+    @Override
+    public boolean removeInterfaceInfo(AccessInfo accessInfo) {
+        checkNotNull(accessInfo, ACCESS_INFO_NULL);
+
+        if (intInfoMap.remove(accessInfo) == null) {
+            log.error("Interface info deletion for access info {} has failed.",
+                      accessInfo.toString());
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean removeVpnInstance(String vpnName) {
+        checkNotNull(vpnName, VPN_NAME_NULL);
+
+        if (vpnInsMap.remove(vpnName) == null) {
+            log.error("Vpn instance deletion for vpn name {} has failed.",
+                      vpnName);
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean removeIdFromFreeList(Long id) {
+        checkNotNull(id, FREE_ID_NULL);
+
+        if (!freedIdList.remove(id)) {
+            log.error("Id from free id list {} deletion has failed.",
+                      id.toString());
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean removeBgpInfo(BgpInfo bgpInfo) {
+        checkNotNull(bgpInfo, BGP_INFO_NULL);
+
+        if (bgpInfoMap.remove(bgpInfo) == null) {
+            log.error("Device id deletion for BGP info {} has failed.",
+                      bgpInfo.toString());
+            return false;
+        }
+        return true;
+    }
+}
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/NetL3vpnManager.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/NetL3vpnManager.java
similarity index 97%
rename from apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/NetL3vpnManager.java
rename to apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/NetL3vpnManager.java
index 2535173..107440c 100644
--- a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/NetL3vpnManager.java
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/NetL3vpnManager.java
@@ -13,7 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.l3vpn.netl3vpn;
+
+package org.onosproject.l3vpn.netl3vpn.impl;
 
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
@@ -40,6 +41,7 @@
 
 /**
  * The IETF net l3vpn manager implementation.
+ * // TODO: Implementation of the manager class.
  */
 @Component(immediate = true)
 public class NetL3vpnManager {
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/package-info.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/package-info.java
new file mode 100644
index 0000000..a509d5b
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present 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.
+ */
+
+/**
+ * The implementations of IETF NET l3VPN manager and store.
+ */
+package org.onosproject.l3vpn.netl3vpn.impl;
diff --git a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/package-info.java b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/package-info.java
index de5783a..a49497c 100644
--- a/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/package-info.java
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/package-info.java
@@ -15,6 +15,6 @@
  */
 
 /**
- * The implementations of IETF l3vpn net YANG.
+ * The IETF NET l3VPN YANG application.
  */
 package org.onosproject.l3vpn.netl3vpn;
diff --git a/apps/l3vpn/pom.xml b/apps/l3vpn/pom.xml
index faa3170..3bfb833 100644
--- a/apps/l3vpn/pom.xml
+++ b/apps/l3vpn/pom.xml
@@ -29,14 +29,6 @@
     <artifactId>onos-app-l3vpn</artifactId>
     <packaging>pom</packaging>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onos-yang-model</artifactId>
-            <version>1.12.0-b5</version>
-        </dependency>
-    </dependencies>
-
     <modules>
         <module>netl3vpn</module>
         <module>yangmodel</module>
diff --git a/apps/l3vpn/yangmodel/pom.xml b/apps/l3vpn/yangmodel/pom.xml
index a2bfbd22..fca0ffd 100644
--- a/apps/l3vpn/yangmodel/pom.xml
+++ b/apps/l3vpn/yangmodel/pom.xml
@@ -35,8 +35,8 @@
         <plugins>
             <plugin>
                 <groupId>org.onosproject</groupId>
-                <artifactId>onos-yang-maven-plugin</artifactId>
-                <version>1.11</version>
+                <artifactId>onos-yang-compiler-maven-plugin</artifactId>
+                <version>1.12.0-b6</version>
                 <executions>
                     <execution>
                         <goals>
@@ -47,5 +47,4 @@
             </plugin>
         </plugins>
     </build>
-    <!-- Fix maven plugin version together with fix for buck -->
 </project>