[ONOS-5989] YANG based L3VPN: Provide the skeleton structure with L3SM model

Change-Id: Ib72b92cef6b3f62f35eef6e10a811308f7b43b3f
diff --git a/apps/l3vpn/netl3vpn/BUCK b/apps/l3vpn/netl3vpn/BUCK
new file mode 100644
index 0000000..47b8c9a
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/BUCK
@@ -0,0 +1,16 @@
+COMPILE_DEPS = [
+  '//lib:CORE_DEPS',
+  '//apps/l3vpn/yangmodel:onos-apps-l3vpn-yangmodel',
+  '//lib:onos-yang-model',
+  '//lib:onos-yang-runtime',
+]
+
+TEST_DEPS = [
+  '//lib:TEST_ADAPTERS',
+  '//utils/osgi:onlab-osgi-tests',
+]
+
+osgi_jar_with_tests(
+  deps = COMPILE_DEPS,
+  test_deps = TEST_DEPS,
+)
diff --git a/apps/l3vpn/netl3vpn/pom.xml b/apps/l3vpn/netl3vpn/pom.xml
new file mode 100644
index 0000000..2ce1d09
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<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-l3vpn</artifactId>
+        <version>1.10.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-app-l3vpn-netl3vpn</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>IETF L3VPN Service Model</description>
+
+    <properties>
+        <yang-tool-version>1.12.0-b5</yang-tool-version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-model</artifactId>
+            <version>${yang-tool-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-yang-runtime</artifactId>
+            <version>${yang-tool-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-l3vpn-yangmodel</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
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/NetL3vpnManager.java
new file mode 100644
index 0000000..2535173
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/NetL3vpnManager.java
@@ -0,0 +1,106 @@
+/*
+ * 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.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.onosproject.core.CoreService;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev20130715.IetfInetTypes;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.IetfL3VpnSvc;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev20130715.IetfYangTypes;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.l3vpn.svc.ext.rev20160730.L3VpnSvcExt;
+import org.onosproject.yang.model.YangModel;
+import org.onosproject.yang.model.YangModuleId;
+import org.onosproject.yang.runtime.DefaultAppModuleInfo;
+import org.onosproject.yang.runtime.DefaultModelRegistrationParam;
+import org.onosproject.yang.runtime.ModelRegistrationParam;
+import org.onosproject.yang.runtime.YangModelRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Iterator;
+
+import static org.onosproject.yang.runtime.helperutils.YangApacheUtils.getYangModel;
+
+/**
+ * The IETF net l3vpn manager implementation.
+ */
+@Component(immediate = true)
+public class NetL3vpnManager {
+
+    private static final String APP_ID = "org.onosproject.app.l3vpn";
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected YangModelRegistry modelRegistry;
+
+    private ModelRegistrationParam regParam = null;
+
+    @Activate
+    protected void activate() {
+        coreService.registerApplication(APP_ID);
+        log.info("Started");
+        //TODO implementation
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        modelRegistry.unregisterModel(regParam);
+        log.info("Stopped");
+    }
+
+    private void registerModel() {
+        YangModel model = getYangModel(getClass());
+        Iterator<YangModuleId> it = model.getYangModulesId().iterator();
+
+        //Create model registration param.
+        ModelRegistrationParam.Builder b =
+                DefaultModelRegistrationParam.builder().setYangModel(model);
+
+        YangModuleId id;
+        while (it.hasNext()) {
+            id = it.next();
+            switch (id.moduleName()) {
+                case "ietf-inet-types":
+                    b.addAppModuleInfo(id, new DefaultAppModuleInfo(
+                            IetfInetTypes.class, null));
+                    break;
+                case "ietf-l3vpn-svc":
+                    b.addAppModuleInfo(id, new DefaultAppModuleInfo(
+                            IetfL3VpnSvc.class, null));
+                    break;
+                case "ietf-yang-types":
+                    b.addAppModuleInfo(id, new DefaultAppModuleInfo(
+                            IetfYangTypes.class, null));
+                    break;
+                case "l3vpn-svc-ext":
+                    b.addAppModuleInfo(id, new DefaultAppModuleInfo(
+                            L3VpnSvcExt.class, null));
+                    break;
+                default:
+                    break;
+            }
+        }
+        regParam = b.build();
+        modelRegistry.registerModel(regParam);
+    }
+}
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
new file mode 100644
index 0000000..de5783a
--- /dev/null
+++ b/apps/l3vpn/netl3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/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 l3vpn net YANG.
+ */
+package org.onosproject.l3vpn.netl3vpn;