HONEYCOMB-46: Add NSH feature in Honeycomb
authorHongjun Ni <[email protected]>
Fri, 24 Jun 2016 15:44:03 +0000 (23:44 +0800)
committerMaros Marsalek <[email protected]>
Tue, 16 Aug 2016 13:00:22 +0000 (13:00 +0000)
PatchSet 14: Refactor NSH Plugin based on new code organization
PatchSet 13: merge Change 1796: Add nsh-entry Yang Model
PatchSet 12:augment with vxlan-encap-type
PatchSet 11: rebase and make nsh yang model visible to ODL netconf
PatchSet 8: move vpp-nsh.yang to v3po/nsh folder
PatchSet 7: split two patches: nsh-entry and nsh-map
PatchSet 6: support md-type1 and md-type2
PatchSet 5: Use encap-type and parameters
PatchSet 4: Use identity instead of enum
PatchSet 3: consolidate comments from Ed
PatchSet 2: fix indent issue.

Change-Id: I18353b714d39199ffa346fd39da6cafdbcc1b30c
Signed-off-by: Hongjun Ni <[email protected]>
Signed-off-by: Ed Warnicke <[email protected]>
nsh/api/pom.xml [new file with mode: 0644]
nsh/api/src/main/yang/vpp-nsh.yang [new file with mode: 0644]
nsh/impl/pom.xml [new file with mode: 0644]
nsh/pom.xml [new file with mode: 0644]

diff --git a/nsh/api/pom.xml b/nsh/api/pom.xml
new file mode 100644 (file)
index 0000000..44119a9
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 Cisco and/or its affiliates.
+ 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">
+  <parent>
+    <groupId>io.fd.honeycomb.common</groupId>
+    <artifactId>api-parent</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <relativePath>../../common/api-parent</relativePath>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>io.fd.honeycomb.v3po</groupId>
+  <artifactId>nsh-api</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.opendaylight.mdsal.model</groupId>
+        <artifactId>mdsal-model-artifacts</artifactId>
+        <version>0.8.2-Beryllium-SR2</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>iana-if-type-2014-05-08</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>ietf-yang-types-20130715</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>ietf-interfaces</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>ietf-inet-types-2013-07-15</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>yang-ext</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>v3po-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/nsh/api/src/main/yang/vpp-nsh.yang b/nsh/api/src/main/yang/vpp-nsh.yang
new file mode 100644 (file)
index 0000000..50dfe8e
--- /dev/null
@@ -0,0 +1,265 @@
+module vpp-nsh {
+  yang-version 1;
+  namespace "urn:opendaylight:params:xml:ns:yang:vpp:nsh";
+  prefix "vpp-nsh";
+
+  revision "2016-06-24" {
+    description "Initial revision of vpp-nsh model";
+  }
+
+  import iana-if-type {
+    prefix "ianaift";
+  }
+  import ietf-interfaces {
+    prefix "if";
+  }
+  import ietf-yang-types {
+    prefix "yang";
+  }
+  import ietf-inet-types {
+    prefix "inet";
+  }
+  import yang-ext {
+    prefix "ext";
+  }
+  import v3po {
+    prefix "v3po";
+  }
+  /*
+   * Defines the supported next protocols that can be used for
+   * NSH next-protocol field.
+   */
+  identity next-protocol {
+    description "Base identity from which all nsh next protocols
+                 are derived from";
+  }
+
+  identity ipv4 {
+    base next-protocol;
+    description
+      "Support ipv4 to act as next protocol";
+  }
+
+  identity ipv6 {
+    base next-protocol;
+    description
+      "Support ipv6 to act as next protocol";
+  }
+
+  identity ethernet {
+    base next-protocol;
+    description
+      "Support ethernet to act as next protocol";
+  }
+
+  typedef nsh-next-protocol {
+    type identityref {
+      base "next-protocol";
+    }
+    description "Identifies a specific next protocol for nsh";
+  }
+
+  /*
+   * Defines the supported encap type.
+   */
+  identity encap-type {
+    description "encap type";
+  }
+
+  identity vxlan-gpe-encap-type {
+    base "encap-type";
+    description "vxlan-gpe encap type";
+  }
+
+  identity vxlan-encap-type {
+    base "encap-type";
+    description "vxlan encap type";
+  }
+
+  typedef nsh-encap-type {
+    type identityref {
+      base "encap-type";
+    }
+  }
+
+  /*
+   * Defines the supported MD-types.
+   */
+  identity md-type {
+    description "md type";
+  }
+
+  identity md-type1 {
+    base "md-type";
+    description "nsh md-type1";
+  }
+
+  identity md-type2 {
+    base "md-type";
+    description "nsh md-type2";
+  }
+
+  typedef nsh-md-type {
+    type identityref {
+      base "md-type";
+    }
+  }
+
+  grouping nsh-md-type1-attributes {
+    leaf c1 {
+      type uint32;
+    }
+    leaf c2 {
+      type uint32;
+    }
+    leaf c3 {
+      type uint32;
+    }
+    leaf c4 {
+      type uint32;
+    }
+  }
+
+  grouping nsh-md-type2-attributes {
+
+  }
+
+  grouping nsh-entry-base-attributes {
+    leaf name {
+      type string;
+      description "NSH Entry Name";
+    }
+    leaf nsp {
+      type uint32 {
+        range "0..16777215";
+      }
+    }
+    leaf nsi {
+      type uint8 {
+        range "1..255";
+      }
+    }
+    leaf md-type {
+      type nsh-md-type;
+    }
+    leaf version {
+      type uint8;
+    }
+    leaf length {
+      type uint8;
+    }
+    leaf next-protocol {
+      type nsh-next-protocol;
+    }
+  }
+
+  grouping nsh-map-base-attributes {
+    leaf name {
+      type string;
+      description "NSH Map Name";
+    }
+    leaf nsp {
+      type uint32 {
+        range "0..16777215";
+      }
+    }
+    leaf nsi {
+      type uint8 {
+        range "1..255";
+      }
+    }
+    leaf mapped-nsp {
+      type uint32 {
+        range "0..16777215";
+      }
+    }
+    leaf mapped-nsi {
+      type uint8 {
+        range "1..255";
+      }
+    }
+    leaf encap-type {
+      type nsh-encap-type;
+    }
+  }
+
+  container nsh {
+    description
+    "NSH config data";
+
+    container nsh-entries {
+      list nsh-entry {
+        key "name";
+
+        uses nsh-entry-base-attributes;
+
+        description
+          "nsh-entry configuration";
+      }
+    }
+
+    container nsh-maps {
+      list nsh-map {
+        key "name";
+
+        uses nsh-map-base-attributes;
+
+        description
+          "nsh-map configuration";
+      }
+    }
+  }
+
+  augment /nsh/nsh-entries/nsh-entry {
+    ext:augment-identifier nsh-entry-md-type-augment;
+    when "/md-type = 'vpp-nsh:md-type1' ";
+    uses nsh-md-type1-attributes;
+  }
+
+  augment /nsh/nsh-entries/nsh-entry {
+    ext:augment-identifier nsh-entry-md-type-augment;
+    when "/md-type = 'vpp-nsh:md-type2' ";
+    uses nsh-md-type2-attributes;
+  }
+
+  augment /nsh/nsh-maps/nsh-map {
+    ext:augment-identifier nsh-vxlan-gpe-encap-augment;
+    when "/encap-type = 'vpp-nsh:vxlan-gpe-encap-type' ";
+    uses v3po:vxlan-gpe-base-attributes;
+  }
+
+  augment /nsh/nsh-maps/nsh-map {
+    ext:augment-identifier vxlan-encap-augment;
+    when "/encap-type = 'vpp-nsh:vxlan-encap-type' ";
+    uses v3po:vxlan-base-attributes;
+  }
+
+  container nsh-state {
+    config false;
+
+    description
+      "NSH operational data";
+
+    container nsh-entries {
+      list nsh-entry {
+        key "name";
+
+        uses nsh-entry-base-attributes;
+
+        description
+          "nsh-entry operational data";
+      }
+    }
+
+    container nsh-maps {
+      list nsh-map {
+        key "name";
+
+        uses nsh-map-base-attributes;
+
+        description
+          "nsh-map operational data";
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/nsh/impl/pom.xml b/nsh/impl/pom.xml
new file mode 100644 (file)
index 0000000..ee420cb
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 Cisco and/or its affiliates.
+ 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">
+    <parent>
+        <groupId>io.fd.honeycomb.common</groupId>
+        <artifactId>impl-parent</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../../../common/impl-parent</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>io.fd.honeycomb.v3po</groupId>
+    <artifactId>nsh-impl</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>nsh-api</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-config</artifactId>
+            <version>1.3.2-Beryllium-SR2</version>
+        </dependency>
+        <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>
diff --git a/nsh/pom.xml b/nsh/pom.xml
new file mode 100644 (file)
index 0000000..964f318
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 Cisco and/or its affiliates.
+ 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">
+
+  <parent>
+    <groupId>org.opendaylight.odlparent</groupId>
+    <artifactId>odlparent</artifactId>
+    <version>1.6.2-Beryllium-SR2</version>
+    <relativePath/>
+  </parent>
+
+  <groupId>io.fd.honeycomb.v3po</groupId>
+  <artifactId>nsh-aggregator</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <name>nsh</name>
+  <packaging>pom</packaging>
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>3.1.1</maven>
+  </prerequisites>
+  <modules>
+    <module>api</module>
+    <module>impl</module>
+  </modules>
+  <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>