Add initial NEMO CLI renderer structure. 57/29957/1
authorZhigang Ji <jizhigang@huawei.com>
Fri, 20 Nov 2015 07:12:32 +0000 (15:12 +0800)
committerZhigang Ji <jizhigang@huawei.com>
Fri, 20 Nov 2015 07:18:19 +0000 (15:18 +0800)
Change-Id: Ie511715b77aae700241f981206f15e888e392274
Signed-off-by: Zhigang Ji <jizhigang@huawei.com>
12 files changed:
nemo-artifacts/pom.xml
nemo-features/pom.xml
nemo-features/src/main/features/features.xml
nemo-renderers/cli-renderer/pom.xml [new file with mode: 0644]
nemo-renderers/cli-renderer/src/main/java/org/opendaylight/nemo/renderer/cli/CliRenderer.java [new file with mode: 0644]
nemo-renderers/cli-renderer/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/nemo/cli/renderer/impl/rev151119/CliRendererModule.java [new file with mode: 0644]
nemo-renderers/cli-renderer/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/nemo/cli/renderer/impl/rev151119/CliRendererModuleFactory.java [new file with mode: 0644]
nemo-renderers/cli-renderer/src/main/resources/etc/opendaylight/karaf/config.xml [new file with mode: 0644]
nemo-renderers/cli-renderer/src/main/yang/cli-renderer-impl.yang [new file with mode: 0644]
nemo-renderers/cli-renderer/src/main/yang/cli-renderer.yang [new file with mode: 0644]
nemo-renderers/pom.xml
pom.xml

index a78d80de0891c6ad72dea0fafdb66ca884d529b0..522ac310f1a39602d1d10abd3934b1894d4723a5 100644 (file)
@@ -32,6 +32,11 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
         <artifactId>openflow-renderer</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>${project.groupId}</groupId>
+        <artifactId>cli-renderer</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>nemo-ui</artifactId>
index 8f320324440af79d7eceb29e02dba971f145871a..44bd72b9ed24eafc202d6ef153f9788aacb6e7e9 100644 (file)
@@ -169,6 +169,18 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <classifier>external-resource</classifier>
       <type>json</type>
     </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>cli-renderer</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>cli-renderer</artifactId>
+      <version>${project.version}</version>
+      <classifier>config</classifier>
+      <type>xml</type>
+    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>nemo-ui</artifactId>
index 2cfb0c4f105b06bc369a03ebf148b6a355d63900..f28721a61536110029171207fed3aa3a022d0a2f 100644 (file)
@@ -43,6 +43,8 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   </feature>\r
   <feature name='odl-nemo-cli-renderer' version='${project.version}' description='OpenDaylight :: NEMO :: CLI Renderer'>\r
     <feature version='${project.version}'>odl-nemo-engine-rest</feature>\r
+    <bundle>mvn:org.opendaylight.nemo/cli-renderer/${project.version}</bundle>\r
+    <configfile finalname='etc/opendaylight/karaf/02-nemo-cli-renderer.xml'>mvn:org.opendaylight.nemo/cli-renderer/${project.version}/xml/config</configfile>\r
   </feature>\r
   <feature name='odl-nemo-engine-ui' version='${project.version}' description='OpenDaylight :: NEMO :: Engine :: UI'>\r
     <feature version='${dlux.version}'>odl-dlux-core</feature>\r
diff --git a/nemo-renderers/cli-renderer/pom.xml b/nemo-renderers/cli-renderer/pom.xml
new file mode 100644 (file)
index 0000000..9ec4d15
--- /dev/null
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2015 Huawei, 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.controller</groupId>
+    <artifactId>config-parent</artifactId>
+    <version>0.4.0-SNAPSHOT</version>
+    <relativePath />
+  </parent>
+
+  <groupId>org.opendaylight.nemo</groupId>
+  <artifactId>cli-renderer</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+  <name>${project.artifactId}</name>
+
+  <properties>
+    <jacoco.version>0.7.2.201409121644</jacoco.version>
+    <sonar.jacoco.reportPath>target/code-coverage/jacoco.exec</sonar.jacoco.reportPath>
+    <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>nemo-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>nemo-impl</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.jacoco</groupId>
+          <artifactId>jacoco-maven-plugin</artifactId>
+          <version>${jacoco.version}</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.opendaylight.yangtools</groupId>
+        <artifactId>yang-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate-sources</goal>
+            </goals>
+            <configuration>
+              <yangFilesRootDir>src/main/yang</yangFilesRootDir>
+              <codeGenerators>
+                <generator>
+                  <codeGeneratorClass>
+                    org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
+                  </codeGeneratorClass>
+                  <outputBaseDir>
+                    ${salGeneratorPath}
+                  </outputBaseDir>
+                </generator>
+              </codeGenerators>
+              <inspectDependencies>true</inspectDependencies>
+            </configuration>
+          </execution>
+        </executions>
+        <dependencies>
+          <dependency>
+            <groupId>org.opendaylight.mdsal</groupId>
+            <artifactId>maven-sal-api-gen-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <type>jar</type>
+          </dependency>
+        </dependencies>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>${project.build.directory}/classes/etc/opendaylight/karaf/config.xml</file>
+                  <type>xml</type>
+                  <classifier>config</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>org.opendaylight.nemo.*</include>
+          </includes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>pre-unit-test</id>
+            <goals>
+              <goal>prepare-agent</goal>
+            </goals>
+            <configuration>
+              <destFile>${sonar.jacoco.reportPath}</destFile>
+            </configuration>
+          </execution>
+          <execution>
+            <id>post-unit-test</id>
+            <goals>
+              <goal>report</goal>
+            </goals>
+            <configuration>
+              <dataFile>${sonar.jacoco.reportPath}</dataFile>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/nemo.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/nemo.git</developerConnection>
+    <url>https://wiki.opendaylight.org/view/NEMO:Main</url>
+    <tag>HEAD</tag>
+  </scm>
+</project>
\ No newline at end of file
diff --git a/nemo-renderers/cli-renderer/src/main/java/org/opendaylight/nemo/renderer/cli/CliRenderer.java b/nemo-renderers/cli-renderer/src/main/java/org/opendaylight/nemo/renderer/cli/CliRenderer.java
new file mode 100644 (file)
index 0000000..5734b83
--- /dev/null
@@ -0,0 +1,40 @@
+/*\r
+ * Copyright (c) 2015 Huawei, 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.nemo.renderer.cli;\r
+\r
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+/**\r
+ * NEMO renderer that uses CLI to implement an overlay network\r
+ * using traditional network devices.\r
+ *\r
+ * @author Zhigang Ji\r
+ */\r
+public class CliRenderer implements AutoCloseable {\r
+    private static final Logger LOG = LoggerFactory.getLogger(CliRenderer.class);\r
+\r
+    private final DataBroker dataBroker;\r
+\r
+    public CliRenderer(DataBroker dataBroker) {\r
+        super();\r
+\r
+        this.dataBroker = dataBroker;\r
+\r
+        LOG.info("Initialized the NEMO CLI renderer.");\r
+\r
+        return;\r
+    }\r
+\r
+    @Override\r
+    public void close() throws Exception {\r
+        // TODO\r
+    }\r
+}\r
diff --git a/nemo-renderers/cli-renderer/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/nemo/cli/renderer/impl/rev151119/CliRendererModule.java b/nemo-renderers/cli-renderer/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/nemo/cli/renderer/impl/rev151119/CliRendererModule.java
new file mode 100644 (file)
index 0000000..9ebf945
--- /dev/null
@@ -0,0 +1,33 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.cli.renderer.impl.rev151119;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.nemo.renderer.cli.CliRenderer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CliRendererModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.cli.renderer.impl.rev151119.AbstractCliRendererModule {
+    private static final Logger LOG = LoggerFactory.getLogger(CliRendererModule.class);
+
+    public CliRendererModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public CliRendererModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, CliRendererModule oldModule, AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public AutoCloseable createInstance() {
+        DataBroker dataBroker = getDataBrokerDependency();
+
+        // TODO
+
+        return new CliRenderer(dataBroker);
+    }
+
+}
diff --git a/nemo-renderers/cli-renderer/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/nemo/cli/renderer/impl/rev151119/CliRendererModuleFactory.java b/nemo-renderers/cli-renderer/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/nemo/cli/renderer/impl/rev151119/CliRendererModuleFactory.java
new file mode 100644 (file)
index 0000000..5748d81
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: cli-renderer-impl yang module local name: cli-renderer-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Nov 20 01:24:34 CST 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.cli.renderer.impl.rev151119;
+public class CliRendererModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.cli.renderer.impl.rev151119.AbstractCliRendererModuleFactory {
+
+}
diff --git a/nemo-renderers/cli-renderer/src/main/resources/etc/opendaylight/karaf/config.xml b/nemo-renderers/cli-renderer/src/main/resources/etc/opendaylight/karaf/config.xml
new file mode 100644 (file)
index 0000000..8a24c1f
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+Copyright (c) 2015 Huawei, Inc and others. All rights reserved.\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
+<snapshot>\r
+  <configuration>\r
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">\r
+      <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">\r
+        <module>\r
+          <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:nemo:cli:renderer:impl">prefix:cli-renderer-impl</type>\r
+          <name>cli-renderer-impl</name>\r
+          <data-broker>\r
+            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>\r
+            <name>binding-data-broker</name>\r
+          </data-broker>\r
+          <rpc-registry>\r
+            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>\r
+            <name>binding-rpc-broker</name>\r
+          </rpc-registry>\r
+          <notification-service>\r
+            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-notification-service</type>\r
+            <name>binding-notification-broker</name>\r
+          </notification-service>\r
+        </module>\r
+      </modules>\r
+    </data>\r
+  </configuration>\r
+\r
+  <required-capabilities></required-capabilities>\r
+</snapshot>
\ No newline at end of file
diff --git a/nemo-renderers/cli-renderer/src/main/yang/cli-renderer-impl.yang b/nemo-renderers/cli-renderer/src/main/yang/cli-renderer-impl.yang
new file mode 100644 (file)
index 0000000..1599f97
--- /dev/null
@@ -0,0 +1,62 @@
+/*\r
+ * Copyright (c) 2015 Huawei, 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
+module cli-renderer-impl {\r
+    yang-version 1;\r
+\r
+    namespace "urn:opendaylight:params:xml:ns:yang:nemo:cli:renderer:impl";\r
+    prefix "cli-renderer-impl";\r
+\r
+    import config { prefix config; revision-date 2013-04-05; }\r
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }\r
+\r
+    description\r
+        "This module contains the base YANG definitions for\r
+         NEMO CLI renderer implementation.";\r
+\r
+    revision "2015-11-19" {\r
+        description\r
+            "Initial revision.";\r
+    }\r
+\r
+    identity cli-renderer-impl {\r
+        base config:module-type;\r
+        config:java-name-prefix CliRenderer;\r
+    }\r
+\r
+    augment "/config:modules/config:module/config:configuration" {\r
+        case cli-renderer-impl {\r
+            when "/config:modules/config:module/config:type = 'cli-renderer-impl'";\r
+\r
+            container data-broker {\r
+                uses config:service-ref {\r
+                    refine type {\r
+                        mandatory false;\r
+                        config:required-identity mdsal:binding-async-data-broker;\r
+                    }\r
+                }\r
+            }\r
+            container rpc-registry {\r
+                uses config:service-ref {\r
+                    refine type {\r
+                        mandatory true;\r
+                        config:required-identity mdsal:binding-rpc-registry;\r
+                    }\r
+                }\r
+            }\r
+            container notification-service {\r
+                uses config:service-ref {\r
+                    refine type {\r
+                        mandatory true;\r
+                        config:required-identity mdsal:binding-notification-service;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/nemo-renderers/cli-renderer/src/main/yang/cli-renderer.yang b/nemo-renderers/cli-renderer/src/main/yang/cli-renderer.yang
new file mode 100644 (file)
index 0000000..06b6918
--- /dev/null
@@ -0,0 +1,22 @@
+/*\r
+ * Copyright (c) 2015 Huawei, 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
+module cli-renderer {\r
+    yang-version 1;\r
+\r
+    namespace "urn:opendaylight:params:xml:ns:yang:nemo:cli:renderer";\r
+    prefix "cli-renderer";\r
+\r
+    description\r
+        "This module defines the NEMO CLI renderer model.";\r
+\r
+    revision "2015-11-19" {\r
+        description\r
+            "Initial revision.";\r
+    }\r
+}\r
index 1024502239b6d9a1aa0d5e2247dc9e132159bcb4..b5fd9cb9183bd19be1241ee4d53a463c7433c1fa 100644 (file)
@@ -23,6 +23,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 
   <modules>
     <module>openflow-renderer</module>
+    <module>cli-renderer</module>
   </modules>
 
   <scm>
diff --git a/pom.xml b/pom.xml
index d89815144d9a9079f0c758e9b3d0a295a84e03ef..7d36a7e1af82e7ab2225410755aa4dcd9c9be0ef 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -31,10 +31,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <module>nemo-artifacts</module>
     <module>nemo-api</module>
     <module>nemo-impl</module>
-    <module>nemo-renderers</module>
     <module>nemo-ui</module>
     <module>nemo-features</module>
     <module>nemo-karaf</module>
+    <module>nemo-renderers</module>
   </modules>
 
   <url>https://wiki.opendaylight.org/view/NEMO:Main</url>