Introducing VPP renderer 16/39116/3
authorMichal Cmarada <mcmarada@cisco.com>
Thu, 19 May 2016 12:57:33 +0000 (14:57 +0200)
committerMartin Sunal <msunal@cisco.com>
Fri, 20 May 2016 07:19:15 +0000 (07:19 +0000)
Initial yang for vpp renderer

Change-Id: I60ab30fa6cc471134271b02282987e05aa1b46c6
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
artifacts/pom.xml
features/pom.xml
features/src/main/features/features.xml
renderers/pom.xml
renderers/vpp/pom.xml [new file with mode: 0644]
renderers/vpp/src/main/config/default-config.xml [new file with mode: 0644]
renderers/vpp/src/main/java/org/opendaylight/controller/config/yang/config/vpp_provider/impl/VppProviderModule.java [new file with mode: 0644]
renderers/vpp/src/main/java/org/opendaylight/controller/config/yang/config/vpp_provider/impl/VppProviderModuleFactory.java [new file with mode: 0644]
renderers/vpp/src/main/java/org/opendaylight/controller/config/yang/config/vpp_provider/impl/VppRenderer.java [new file with mode: 0644]
renderers/vpp/src/main/yang/vpp-provider-impl.yang [new file with mode: 0644]

index 6eef12e7d57f9a857be7a7712d898a4a080f9c61..f9fd8aa7f5112455b9f0287235bdc42f9660fd5c 100755 (executable)
         <artifactId>ne-location-provider</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>vpp-renderer</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>neutron-mapper</artifactId>
         <type>xml</type>
         <classifier>config</classifier>
       </dependency>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>vpp-renderer</artifactId>
+        <version>${project.version}</version>
+        <type>xml</type>
+        <classifier>config</classifier>
+      </dependency>
       <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>neutron-mapper</artifactId>
index 12389e640a9e14ba6f234e7a1af232b88e6a44df..77089623e919981bb79b9e7668628d1a64b79d5d 100755 (executable)
       <groupId>org.opendaylight.groupbasedpolicy</groupId>
       <artifactId>ne-location-provider</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.groupbasedpolicy</groupId>
+      <artifactId>vpp-renderer</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.groupbasedpolicy</groupId>
       <artifactId>neutron-mapper</artifactId>
       <type>xml</type>
       <classifier>config</classifier>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.groupbasedpolicy</groupId>
+      <artifactId>vpp-renderer</artifactId>
+      <type>xml</type>
+      <classifier>config</classifier>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.groupbasedpolicy</groupId>
       <artifactId>neutron-mapper</artifactId>
index 046346d82709138b94327f33ef01c6dcaad90633..2b385da76648a60629f886fbddd3282f675b1066 100755 (executable)
         <configfile finalname="${config.configfile.directory}/15-neutron-ovsdb.xml">mvn:org.opendaylight.groupbasedpolicy/neutron-ovsdb/{{VERSION}}/xml/config</configfile>
     </feature>
 
+    <!--
+        The VPP renderer
+    -->
+    <feature name='odl-groupbasedpolicy-vpp' version='${project.version}' description='OpenDaylight :: groupbasedpolicy :: VPP renderer '>
+        <feature version="${project.version}">odl-groupbasedpolicy-base</feature>
+        <bundle>mvn:org.opendaylight.groupbasedpolicy/vpp-renderer/{{VERSION}}</bundle>
+        <configfile finalname="${config.configfile.directory}/15-vpp-renderer.xml">mvn:org.opendaylight.groupbasedpolicy/vpp-renderer/{{VERSION}}/xml/config</configfile>
+    </feature>
+
     <!--
          The UI Backend
     -->
index cedd261800fed2560bc6415ebb3ff4e4f1f66e64..1a39df73bc34ce54a0b16ee5e75f7c6406102da0 100644 (file)
@@ -25,6 +25,7 @@
     <module>iovisor</module>
     <module>ovssfc</module>
     <module>netconf</module>
+    <module>vpp</module>
   </modules>
 
   <dependencies>
diff --git a/renderers/vpp/pom.xml b/renderers/vpp/pom.xml
new file mode 100644 (file)
index 0000000..0da97aa
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+  This program and the accompanying materials are made available under the
+  terms of the Eclipse Public License v1.0 which accompanies this distribution,
+  and is available at http://www.eclipse.org/legal/epl-v10.html -->
+<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.opendaylight.groupbasedpolicy</groupId>
+    <artifactId>groupbasedpolicy-renderers</artifactId>
+    <version>0.4.0-SNAPSHOT</version>
+    <relativePath>../</relativePath>
+  </parent>
+
+  <artifactId>vpp-renderer</artifactId>
+  <packaging>bundle</packaging>
+
+  <properties></properties>
+
+  <dependencies>
+    <!-- project specific dependencies -->
+
+    <!-- testing dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <!-- project build -->
+  <build>
+    <!-- We use the maven-resources-plugin to copy a class from the groupbasepolicy
+      bundle that we need in order to run some unit tests in the renderer (classes
+      in the test directory aren't packaged in bundles, and instead of keeping
+      separate copies, we just copy the file(s) needed in order to run the test). -->
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Export-Package>
+              org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.vpp.input.rev160425.*
+            </Export-Package> -->
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/renderers/vpp/src/main/config/default-config.xml b/renderers/vpp/src/main/config/default-config.xml
new file mode 100644 (file)
index 0000000..baff11b
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+    <configuration>
+        <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+            <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+                <module>
+                    <name>vpp-provider-impl</name>
+                    <type xmlns:vpp="urn:opendaylight:params:xml:ns:yang:controller:config:vpp-provider:impl">
+                        vpp:vpp-provider-impl
+                    </type>
+                    <data-broker>
+                      <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+                      <name>binding-data-broker</name>
+                    </data-broker>
+                </module>
+            </modules>
+        </data>
+    </configuration>
+    <required-capabilities>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:config:vpp-provider:impl?module=vpp-provider-impl&amp;revision=2016-04-25</capability>
+    </required-capabilities>
+</snapshot>
diff --git a/renderers/vpp/src/main/java/org/opendaylight/controller/config/yang/config/vpp_provider/impl/VppProviderModule.java b/renderers/vpp/src/main/java/org/opendaylight/controller/config/yang/config/vpp_provider/impl/VppProviderModule.java
new file mode 100644 (file)
index 0000000..3d2f7d0
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.config.yang.config.vpp_provider.impl;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VppProviderModule extends org.opendaylight.controller.config.yang.config.vpp_provider.impl.AbstractVppProviderModule {
+
+    private static final Logger LOG = LoggerFactory.getLogger(VppProviderModule.class);
+
+    public VppProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public VppProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.vpp_provider.impl.VppProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        final VppRenderer vppRenderer = new VppRenderer(getDataBrokerDependency());
+
+        LOG.info("VPP Renderer instance has been created");
+
+        return new AutoCloseable() {
+
+            @Override
+            public void close() throws Exception {
+                vppRenderer.close();
+            }
+        };
+    }
+
+}
diff --git a/renderers/vpp/src/main/java/org/opendaylight/controller/config/yang/config/vpp_provider/impl/VppProviderModuleFactory.java b/renderers/vpp/src/main/java/org/opendaylight/controller/config/yang/config/vpp_provider/impl/VppProviderModuleFactory.java
new file mode 100644 (file)
index 0000000..3e4028c
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+/*
+* Generated file
+*
+* Generated from: yang module name: vpp-provider-impl yang module local name: vpp-provider-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Thu May 05 09:46:48 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.vpp_provider.impl;
+public class VppProviderModuleFactory extends org.opendaylight.controller.config.yang.config.vpp_provider.impl.AbstractVppProviderModuleFactory {
+
+}
diff --git a/renderers/vpp/src/main/java/org/opendaylight/controller/config/yang/config/vpp_provider/impl/VppRenderer.java b/renderers/vpp/src/main/java/org/opendaylight/controller/config/yang/config/vpp_provider/impl/VppRenderer.java
new file mode 100644 (file)
index 0000000..f3885f2
--- /dev/null
@@ -0,0 +1,34 @@
+/*\r
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.controller.config.yang.config.vpp_provider.impl;\r
+\r
+import com.google.common.base.Preconditions;\r
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+public class VppRenderer implements AutoCloseable {\r
+    private static final Logger LOG = LoggerFactory.getLogger(VppRenderer.class);\r
+\r
+    private DataBroker dataBroker;\r
+\r
+    public VppRenderer(DataBroker dataBroker) {\r
+        Preconditions.checkNotNull(dataBroker);\r
+\r
+        this.dataBroker = dataBroker;\r
+\r
+        LOG.info("VPP Renderer has Started");\r
+    }\r
+\r
+    @Override\r
+    public void close() throws Exception {\r
+        this.dataBroker = null;\r
+    }\r
+\r
+}\r
diff --git a/renderers/vpp/src/main/yang/vpp-provider-impl.yang b/renderers/vpp/src/main/yang/vpp-provider-impl.yang
new file mode 100644 (file)
index 0000000..b70d8c9
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+module vpp-provider-impl {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:vpp-provider:impl";
+    prefix "vpp-provider-impl";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+    import ietf-yang-types { prefix "yang"; revision-date 2010-09-24; }
+    import opendaylight-sal-binding-broker-impl { prefix sal-broker; revision-date 2013-10-28;}
+    import groupbasedpolicy-cfg { prefix gbpcfg; revision-date 2015-11-06; }
+
+    description
+        "This module contains the base YANG definitions for
+          vpp-provider impl implementation.";
+
+    revision "2016-04-25" {
+        description
+            "Initial revision.";
+    }
+
+    identity vpp-provider-impl {
+        base "config:module-type";
+
+        config:java-name-prefix VppProvider;
+    }
+
+    // Augments the 'configuration' choice node under modules/module.
+    augment "/config:modules/config:module/config:configuration" {
+        case vpp-provider-impl {
+            when "/config:modules/config:module/config:type = 'vpp-provider-impl'";
+
+            // Wires in the data-broker service
+            container data-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-async-data-broker;
+                    }
+                }
+            }
+        }
+    }
+}