summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml1
-rw-r--r--srv6/asciidoc/Readme.adoc3
-rw-r--r--srv6/pom.xml59
-rw-r--r--srv6/srv6-api/asciidoc/Readme.adoc15
-rw-r--r--srv6/srv6-api/pom.xml62
-rw-r--r--srv6/srv6-api/src/main/yang/hc2vpp-ietf-srv6-base@2018-03-01.yang666
-rw-r--r--srv6/srv6-api/src/main/yang/hc2vpp-ietf-srv6-static@2018-03-01.yang832
-rw-r--r--srv6/srv6-api/src/main/yang/ietf-srv6-types@2018-03-01.yang589
-rw-r--r--srv6/srv6-api/src/main/yang/vpp-ietf-srv6-base@2018-06-13.yang73
-rw-r--r--srv6/srv6-impl/asciidoc/Readme.adoc43
-rw-r--r--srv6/srv6-impl/pom.xml106
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6Configuration.java35
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6IIds.java96
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6Module.java48
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/JVppRequest.java38
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBinder.java70
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBindingRegistry.java50
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionWriteBindingRegistry.java34
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionWriteBindingRegistryProvider.java56
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndDT4FunctionBinder.java49
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndDT6FunctionBinder.java49
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndTFunctionBinder.java47
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/TableLookupFunctionBinder.java76
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/nofunction/EndFunctionBinder.java58
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX2FunctionBinder.java56
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX4FunctionBinder.java60
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX6FunctionBinder.java60
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndXFunctionBinder.java61
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/XConnectFunctionBinder.java65
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/DeleteRequest.java25
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/Srv6Customizer.java49
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/Srv6WriterFactory.java59
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/UpdateRequest.java25
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/WriteRequest.java25
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/EncapsulationSourceCustomizer.java60
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceDeleteRequest.java39
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceWriteRequest.java58
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/LocatorCustomizer.java45
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/SidCustomizer.java136
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/LocalSidFunctionRequest.java133
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/NoProtocolLocalSidRequest.java29
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/TableLookupLocalSidRequest.java49
-rw-r--r--srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/XConnectLocalSidRequest.java87
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/Srv6ModuleTest.java98
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/util/JvppRequestTest.java101
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBindingRegistryTest.java246
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/Srv6CustomizerTest.java42
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/encap/source/EncapsulationSourceCustomizerTest.java72
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceRequestTest.java78
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/SidCustomizerTest.java81
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/LocalSidRequestTest.java97
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/NoProtocolLocalSidRequestTest.java81
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/TableLookupLocalSidRequestTest.java76
-rw-r--r--srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/XConnectLocalSidRequestTest.java90
-rwxr-xr-xsrv6/srv6_localsid_postman_collection.json2411
-rw-r--r--vpp-integration/api-docs/docs/pom.xml7
-rw-r--r--vpp-integration/api-docs/scripts/pom.xml7
-rw-r--r--vpp-integration/minimal-distribution/pom.xml6
58 files changed, 7768 insertions, 1 deletions
diff --git a/pom.xml b/pom.xml
index 72d308339..4ec1b239a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,5 +56,6 @@
<module>interface-role</module>
<module>bgp</module>
<module>mpls</module>
+ <module>srv6</module>
</modules>
</project>
diff --git a/srv6/asciidoc/Readme.adoc b/srv6/asciidoc/Readme.adoc
new file mode 100644
index 000000000..e7ca05ce6
--- /dev/null
+++ b/srv6/asciidoc/Readme.adoc
@@ -0,0 +1,3 @@
+= srv6-aggregator
+
+Overview of srv6-aggregator
diff --git a/srv6/pom.xml b/srv6/pom.xml
new file mode 100644
index 000000000..d2af66e0f
--- /dev/null
+++ b/srv6/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2018 Bell Canada, Pantheon Technologies 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>io.fd.hc2vpp.common</groupId>
+ <artifactId>hc2vpp-parent</artifactId>
+ <version>1.18.07-SNAPSHOT</version>
+ <relativePath>../common/hc2vpp-parent</relativePath>
+ </parent>
+
+ <groupId>io.fd.hc2vpp.srv6</groupId>
+ <artifactId>srv6-aggregator</artifactId>
+ <version>1.18.07-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+ <packaging>pom</packaging>
+ <modelVersion>4.0.0</modelVersion>
+ <description>Aggregator for Hc2vpp SRv6 plugin</description>
+
+ <modules>
+ <module>srv6-api</module>
+ <module>srv6-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>
diff --git a/srv6/srv6-api/asciidoc/Readme.adoc b/srv6/srv6-api/asciidoc/Readme.adoc
new file mode 100644
index 000000000..3c378954d
--- /dev/null
+++ b/srv6/srv6-api/asciidoc/Readme.adoc
@@ -0,0 +1,15 @@
+= srv6-api
+
+SRv6 API consists of models obtained
+from https://datatracker.ietf.org/doc/draft-raza-spring-srv6-yang/[draft-raza-spring-srv6-yang]:
+
+- `hc2vpp-ietf-srv6-base@2018-03-01.yang`
+- `hc2vpp-ietf-srv6-static@2018-03-01.yang`
+- `ietf-srv6-types@2018-03-01.yang`
+
+Models *hc2vpp-ietf-srv6-base* and *hc2vpp-ietf-srv6-static*
+are changed (https://jira.fd.io/browse/HC2VPP-332[HC2VPP-332]):
+
+ - imports for routing models (https://jira.fd.io/browse/HC2VPP-298[HC2VPP-298])
+ - presence in end function containers was added to fix
+ mandatory child verification if parent container is not present
diff --git a/srv6/srv6-api/pom.xml b/srv6/srv6-api/pom.xml
new file mode 100644
index 000000000..c20c43234
--- /dev/null
+++ b/srv6/srv6-api/pom.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2018 Bell Canada, Pantheon Technologies 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ 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>io.fd.hc2vpp.common</groupId>
+ <artifactId>api-parent</artifactId>
+ <version>1.18.07-SNAPSHOT</version>
+ <relativePath>../../common/api-parent</relativePath>
+ </parent>
+
+ <groupId>io.fd.hc2vpp.srv6</groupId>
+ <artifactId>srv6-api</artifactId>
+ <name>${project.artifactId}</name>
+ <version>1.18.07-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.fd.hc2vpp.routing</groupId>
+ <artifactId>routing-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.fd.hc2vpp.fib.management</groupId>
+ <artifactId>fib-management-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-yang-types-20130715</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>ietf-interfaces</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>yang-ext</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/srv6/srv6-api/src/main/yang/hc2vpp-ietf-srv6-base@2018-03-01.yang b/srv6/srv6-api/src/main/yang/hc2vpp-ietf-srv6-base@2018-03-01.yang
new file mode 100644
index 000000000..4d41b4566
--- /dev/null
+++ b/srv6/srv6-api/src/main/yang/hc2vpp-ietf-srv6-base@2018-03-01.yang
@@ -0,0 +1,666 @@
+module hc2vpp-ietf-srv6-base {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-srv6-base";
+ prefix srv6;
+
+ import ietf-interfaces {
+ prefix "if";
+ }
+
+ import ietf-inet-types {
+ prefix inet;
+ }
+
+ import ietf-yang-types {
+ prefix "yang";
+ }
+
+ // TODO: hc2vpp-298 - Renamed imports, because hc2vpp uses modified versions of these models.
+ import hc2vpp-ietf-routing-types {
+ prefix "rt-types";
+ }
+
+
+ // TODO: hc2vpp-298 - Renamed imports, because hc2vpp uses modified versions of these models.
+ import hc2vpp-ietf-routing {
+ prefix "rt";
+ }
+
+ import ietf-srv6-types {
+ prefix srv6-types;
+ }
+
+ organization
+ "IETF SPRING Working Group";
+ contact
+ "WG Web: <http://tools.ietf.org/wg/spring/>
+ WG List: <mailto:spring@ietf.org>
+
+ Editor: Kamran Raza
+ <mailto:skraza@cisco.com>
+
+ Editor: Jaganbabu Rajamanickam
+ <maito:jrajaman@cisco.com>
+
+ Editor: Xufeng Liu
+ <mailto:Xufeng_Liu@jabil.com>
+
+ Editor: Zhibo Hu
+ <mailto:huzhibo@huawei.com>
+
+ Editor: Iftekhar Hussain
+ <mailto:IHussain@infinera.com>
+
+ Editor: Himanshu Shah
+ <mailto:hshah@ciena.com>
+
+ Editor: Daniel Voyer
+ <mailto:daniel.voyer@bell.ca>
+
+ Editor: Hani Elmalky
+ <mailto:hani.elmalky@ericsson.com>
+
+ Editor: Satoru Matsushima
+ <mailto:satoru.matsushima@gmail.com>
+
+ Editor: Katsuhiro Horiba
+ <mailto:katsuhiro.horiba@g.softbank.co.jp>
+
+ Editor: Ahmed AbdelSalam
+ <mailto:ahmed.abdelsalam@gssi.it>
+
+ ";
+
+ description
+ "This YANG module defines the essential elements for the
+ management of Segment-Routing with IPv6 dataplane (SRv6).
+
+ Copyright (c) 2017 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).";
+
+ reference "RFC XXXX";
+
+ revision 2018-03-01 {
+ description
+ "Updated to align with SRv6 network programming draft rev 04";
+ reference
+ "RFC XXXX: YANG Data Model for SRv6";
+ }
+
+ revision 2017-11-12 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: YANG Data Model for SRv6";
+ }
+
+/*
+ * Common
+ */
+
+ grouping path-attrs-cmn {
+ description
+ "Path properties -common for v4/v6";
+
+ leaf weight {
+ type uint32;
+ description
+ "This value is used to compute a loadshare to perform un-equal
+ load balancing when multiple outgoing path(s) are specified. A
+ share is computed as a ratio of this number to the total under
+ all configured path(s).";
+ }
+
+ leaf role {
+
+ type enumeration {
+ enum PRIMARY { description "Path as primary traffic carrying"; }
+ enum BACKUP { description "Path acts as a backup"; }
+ enum PRIMARY_AND_BACKUP { description
+ "Path acts as primary and backup simultaneously"; }
+ }
+ description "The path role";
+ }
+
+ leaf backup-path-index {
+ type uint8;
+ description "Index of the protecting (backup) path";
+ }
+ }
+
+ grouping path-out-sids {
+ description "Grouping for path's SID stack";
+
+ list out-sid {
+ key "sid";
+ description "Out SID";
+
+ leaf sid {
+ type srv6-types:srv6-sid;
+ description "SID value";
+ }
+ }
+
+ }
+
+ grouping path-out-labels {
+ description "Grouping for path's label stack";
+
+ list out-label {
+ key "label";
+ description "Out label";
+
+ leaf label {
+ type rt-types:mpls-label;
+ description "Label value";
+ }
+ }
+
+ }
+
+ /*
+ * Config and State
+ */
+
+ grouping srv6-encap {
+ description "Grouping for encap param config.";
+
+ container encapsulation {
+ description "Configure encapsulation related parameters";
+ leaf source-address {
+ type inet:ipv6-address;
+ description "Specify a source address (for T.Encap). The address must locally exists
+ and be routable";
+ }
+ leaf ip-ttl-propagation {
+ type boolean;
+ default false;
+ description "IP TTL propagation from encapsulated packet to encapsulating outer
+ IPv6 header. When configured on decapsulation side, this refers to
+ propagating IP TTL from outer IPv6 header to inner header after decap";
+ }
+
+ }
+ }
+
+ grouping srv6-locator-state {
+ description "SRv6 grouping Locastateor ";
+
+ leaf operational-status {
+ type srv6-types:srv6-status-type;
+ config false;
+ description "Indicates whether locator state is UP";
+ }
+
+ leaf is-in-address-conflict {
+ type boolean;
+ config false;
+ description "Indicates whether locator address conflicts with
+ some other IPv6 address on the box";
+ }
+ }
+
+ grouping srv6-locators {
+ description "SRv6 locator grouping";
+
+ container locators {
+ description "SRv6 locators";
+
+ list locator {
+ key "name";
+ description "Configure a SRv6 locator";
+
+
+ leaf name {
+ type string;
+ description "Locator name";
+ }
+
+ leaf enable {
+ type boolean;
+ default false;
+ description "Enable a SRv6 locator";
+ }
+ leaf is-default {
+ type boolean;
+ mandatory true;
+ description "Indicates if the locator is a default locator";
+ }
+
+ container prefix {
+ description "Specify locator prefix value";
+ leaf address {
+ type inet:ipv6-address;
+ mandatory true;
+ description "IPv6 address";
+ }
+ leaf length {
+ type srv6-types:srv6-locator-len;
+ mandatory true;
+ description "Locator (prefix) length";
+ }
+ }
+ uses srv6-locator-state;
+ }
+ }
+ }
+
+ grouping srv6-stats-in {
+ description "Grouping for inbound stats";
+
+ leaf in-pkts {
+ type yang:counter64;
+ description
+ "A cumulative counter of the total number of packets received";
+ }
+
+ leaf in-octets {
+ type yang:counter64;
+ description
+ "A cumulative counter of the total bytes received.";
+ }
+
+ }
+
+ grouping srv6-stats-out {
+ description "Grouping for inbound stats";
+
+ leaf out-pkts {
+ type yang:counter64;
+ description
+ "A cumulative counter of the total number of packets transmitted";
+ }
+
+ leaf out-octets {
+ type yang:counter64;
+ description
+ "A cumulative counter of the total bytes transmitted.";
+ }
+ }
+
+ grouping path-out-sids-choice {
+ description "Grouping for Out-SID choices";
+ choice encap-type {
+ description "Out-SID encap-based choice";
+ case srv6 {
+ uses path-out-sids;
+ }
+ case mpls {
+ uses path-out-labels;
+ }
+ }
+ }
+
+ grouping local-sid-fwd-state {
+ description "SRv6 local-SID forwarding state grouping";
+
+ container forwarding {
+ description "SRv6 local-SID forwarding state";
+
+ leaf is-installed {
+ type boolean;
+ description "Indicates whether SID is installed in forwarding";
+ }
+
+ leaf next-hop-type {
+ type srv6-types:srv6-nexthop-type;
+ description "Forwarding next-hop types";
+ }
+
+ container paths {
+
+ when "../is-installed = 'true'" {
+ description "This container is valid only when the local-SID is installed
+ in forwarding";
+ }
+
+ list path {
+ key path-index;
+ description "The list of paths associated with the SID";
+
+ leaf path-index {
+ type uint8;
+ description "Index of the path";
+ }
+
+ container l2 {
+ when "../../../next-hop-type = 'l2'" {
+ description "This container is valid only for L2 type of NHs";
+ }
+
+ leaf interface {
+ type if:interface-ref;
+ description "The outgoing Layer2 interface";
+ }
+
+ description "L2 information";
+ }
+
+ container l3 {
+ when "../../../next-hop-type != 'l2'" {
+ description "This container is valid only for L3 type of NHs";
+ }
+
+ leaf interface {
+ type if:interface-ref;
+ description "The outgoing Layer3 interface";
+ }
+
+ leaf next-hop {
+ type inet:ip-address;
+ description "The IP address of the next-hop";
+ }
+
+ uses path-attrs-cmn;
+
+ description "L3 information";
+ }
+ uses path-out-sids-choice;
+ }
+
+ description "Forwarding paths";
+ }
+ }
+ }
+
+ grouping srv6-state-sid {
+ description "SRv6 SID state grouping";
+
+ container local-sids {
+ config false;
+ description "Local-SID state";
+
+ container counters {
+ description "SRv6 counters";
+
+ container cnt3 {
+ description "Counts SRv6 traffic received/dropped on local prefix not instantiated as local-SID";
+ uses srv6-stats-in;
+ }
+ }
+
+ list local-sid {
+ key "sid";
+ description "Per-localSID Counters";
+
+ leaf sid {
+ type srv6-types:srv6-sid;
+ description "Local SID value";
+ }
+
+ uses srv6-locator-ref;
+
+ leaf is-reserved {
+ type boolean;
+ description "Set to true if SID comes from reserved pool";
+ }
+
+ leaf end-behavior-type {
+ type identityref {
+ base srv6-types:srv6-endpoint-type;
+ }
+ description "Type of SRv6 end behavior.";
+ }
+
+ leaf alloc-type {
+ type srv6-types:sid-alloc-type;
+ description
+ "Type of sid allocation.";
+
+ }
+
+ list owner {
+ key "type instance";
+ description "SID Owner clients";
+ leaf type {
+ type identityref {
+ base srv6-types:srv6-sid-owner-type;
+ }
+ description "SID owner/client type";
+ }
+ leaf instance {
+ type string;
+ description "Client instance";
+ }
+ leaf is-winner {
+ type boolean;
+ description "Is this client/owner the winning in terms of forwarding";
+ }
+ }
+
+ uses local-sid-fwd-state;
+
+ container counters {
+ description "SRv6 per local-SID counters";
+
+ container cnt1 {
+ description "Counts SRv6 traffic received on local-SID prefix and processed successfully";
+ uses srv6-stats-in;
+ }
+ }
+ }
+ }
+ }
+
+ grouping srv6-support-ends {
+ description "SRv6 End behavior support grouping";
+
+ list end-behavior {
+ key "type";
+ description "End behavior support";
+
+ leaf type {
+ type identityref {
+ base srv6-types:srv6-endpoint-type;
+ }
+ description "End behavior (End*) type";
+ }
+
+ leaf supported {
+ type boolean;
+ mandatory true;
+ description "True if supported";
+ }
+ }
+ }
+
+ grouping srv6-support-transits {
+ description "SRv6 Transit behavior support grouping";
+
+ list transit-behavior {
+ key "type";
+ description "Transit behavior support";
+
+ leaf type {
+ type srv6-types:srv6-transit-type;
+ description "Transit behavior (T*) type";
+ }
+ leaf supported {
+ type boolean;
+ mandatory true;
+ description "True if supported";
+ }
+ }
+ }
+
+ grouping srv6-support-signaled {
+ description "SRv6 signaled parameter support grouping";
+
+ container signaled-parameters {
+ description "SRv6 signaled parameter support";
+
+ leaf max-sl {
+ type uint8;
+ //mandatory true;
+ description "Maximum value of the SL field in the SRH of
+ a received packet before applying the function
+ associated with a SID";
+ }
+ leaf max-end-pop-srh {
+ type uint8;
+ //mandatory true;
+ description "Maximum number of SIDs in the top SRH in an
+ SRH stack to which the router can apply
+ PSP or USP flavors";
+ }
+ leaf max-t_insert {
+
+ type uint8;
+ //mandatory true;
+ description "Maximum number of SIDs that can be inserted as
+ part of the T.insert behavior";
+ }
+ leaf max-t_encap {
+ type uint8;
+ //mandatory true;
+ description "Maximum number of SIDs that can be inserted as
+ part of the T.Encap behavior";
+ }
+ leaf max-end_d {
+ type uint8;
+ //mandatory true;
+ description "Maximum number of SIDs in an SRH when applying
+ End.DX6 and End.DT6 functions";
+ }
+ }
+ }
+
+ grouping srv6-support-security-rules {
+ description "SRv6 Security rules grouping";
+
+ list security-rule {
+ key "type";
+ description "Security rule support";
+
+ leaf type {
+ type srv6-types:srv6-security-rule-type;
+ description "Security rule type";
+ }
+ leaf supported {
+ type boolean;
+ mandatory true;
+ description "True if supported";
+ }
+ }
+ }
+
+ grouping srv6-support-counters {
+ description "SRv6 Counters grouping";
+
+ list counters {
+ key "type";
+ description "SRv6 counter support";
+
+ leaf type {
+ type srv6-types:srv6-counter-type;
+
+ description "Counter type";
+ }
+ leaf supported {
+ type boolean;
+ mandatory true;
+ description "True if supported";
+ }
+ }
+ }
+
+ grouping srv6-state-capabilities {
+ description "SRv6 node capabilities grouping";
+ container node-capabilities {
+ config false;
+ description "Node's SRv6 capabilities";
+
+ uses srv6-support-ends;
+ uses srv6-support-transits;
+ uses srv6-support-signaled;
+ uses srv6-support-security-rules;
+ uses srv6-support-counters;
+ }
+ }
+
+ augment "/rt:routing" {
+ description
+ "This augments routing-instance configuration with segment-routing SRv6.";
+
+ container srv6 {
+ description "Segment Routing with IPv6 dataplane";
+
+ /* config */
+ leaf enable {
+ type boolean;
+ default false;
+ description "Enable SRv6";
+ }
+
+ uses srv6-encap;
+ uses srv6-locators;
+ uses srv6-state-capabilities;
+ uses srv6-state-sid;
+ }
+ }
+
+ /* Notifications */
+
+ grouping srv6-locator-ref {
+
+ description
+ "An absolute reference to an SRv6 locator";
+ leaf locator-ref {
+ type leafref {
+ path "/rt:routing/srv6:srv6/srv6:locators/srv6:locator/srv6:name";
+ }
+ description
+ "Reference to a SRv6 locator.";
+ }
+ }
+
+ notification srv6-locator-status-event {
+ description
+ "Notification event for a change of SRv6 locator operational status.";
+ leaf operational-status {
+ type srv6-types:srv6-status-type;
+ description "Operational status";
+ }
+ uses srv6-locator-ref;
+ }
+
+ notification srv6-sid-collision-event {
+ description
+ "Notification event for an SRv6 SID collision - i.e., attempt to bind an already
+ bound SID to a new context";
+ leaf sid {
+ type srv6-types:srv6-sid;
+ description "SRv6 SID";
+ }
+ container existing {
+ description "Current assignment / bind";
+ leaf end-behavior-type {
+ type identityref {
+ base srv6-types:srv6-endpoint-type;
+ }
+ description "End type";
+ }
+ // TODO: More
+ }
+ container requested {
+ description "Requested assignment / bind";
+
+ leaf end-behavior-type {
+ type identityref {
+ base srv6-types:srv6-endpoint-type;
+ }
+ description "End type";
+ }
+
+ }
+
+ }
+
+} // module
diff --git a/srv6/srv6-api/src/main/yang/hc2vpp-ietf-srv6-static@2018-03-01.yang b/srv6/srv6-api/src/main/yang/hc2vpp-ietf-srv6-static@2018-03-01.yang
new file mode 100644
index 000000000..3ba936688
--- /dev/null
+++ b/srv6/srv6-api/src/main/yang/hc2vpp-ietf-srv6-static@2018-03-01.yang
@@ -0,0 +1,832 @@
+module hc2vpp-ietf-srv6-static {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-srv6-static";
+ prefix srv6-static;
+
+ import ietf-interfaces {
+ prefix "if";
+ }
+
+ import ietf-inet-types {
+ prefix inet;
+ }
+
+ // TODO: hc2vpp-298 - Renamed imports, because hc2vpp uses modified versions of these models.
+ import hc2vpp-ietf-routing {
+ prefix "rt";
+ }
+
+ import ietf-srv6-types {
+ prefix srv6-types;
+ }
+
+ // TODO: hc2vpp-332 - Renamed imports, because hc2vpp uses modified versions of these models.
+ import hc2vpp-ietf-srv6-base {
+ prefix srv6;
+ }
+
+ organization
+ "IETF SPRING Working Group";
+ contact
+ "WG Web: <http://tools.ietf.org/wg/spring/>
+ WG List: <mailto:spring@ietf.org>
+
+
+ Editor: Kamran Raza
+ <mailto:skraza@cisco.com>
+
+ Editor: Jaganbabu Rajamanickam
+ <maito:jrajaman@cisco.com>
+
+ Editor: Xufeng Liu
+ <mailto:Xufeng_Liu@jabil.com>
+
+ Editor: Zhibo Hu
+ <mailto:huzhibo@huawei.com>
+
+ Editor: Iftekhar Hussain
+ <mailto:IHussain@infinera.com>
+
+ Editor: Himanshu Shah
+ <mailto:hshah@ciena.com>
+
+ Editor: Daniel Voyer
+ <mailto:daniel.voyer@bell.ca>
+
+ Editor: Hani Elmalky
+ <mailto:hani.elmalky@ericsson.com>
+
+ Editor: Satoru Matsushima
+ <mailto:satoru.matsushima@gmail.com>
+
+ Editor: Katsuhiro Horiba
+ <mailto:katsuhiro.horiba@g.softbank.co.jp>
+
+ Editor: Ahmed AbdelSalam
+ <mailto:ahmed.abdelsalam@gssi.it>
+
+ ";
+
+ description
+ "This YANG module defines the essential elements for the
+ management of Static application for Segment-Routing with
+ IPv6 dataplane (SRv6).
+
+ Copyright (c) 2017 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+
+ (http://trustee.ietf.org/license-info).";
+
+ reference "RFC XXXX";
+
+ revision 2018-03-01 {
+ description
+ "Updated to align with SRv6 network programming draft rev 04";
+ reference
+ "RFC XXXX: YANG Data Model for SRv6";
+ }
+
+ revision 2017-11-12 {
+ description
+ "Initial revision.";
+ reference
+ "RFC XXXX: YANG Data Model for SRv6";
+ }
+
+ /*
+ * Config and State
+ */
+
+
+ grouping path-attrs-v6 {
+ description
+ "IPv6 Path properties";
+
+ leaf interface {
+ type if:interface-ref;
+ description "The outgoing interface";
+ }
+
+ leaf next-hop {
+ type inet:ipv6-address;
+ description "The IP address of the next-hop";
+ }
+
+ uses srv6:path-attrs-cmn;
+ }
+
+ grouping path-attrs-v4 {
+ description
+ "IPv4 Path properties";
+
+ leaf interface {
+ type if:interface-ref;
+ description "The outgoing interface";
+ }
+
+ leaf next-hop {
+ type inet:ipv4-address;
+ description "The IP address of the next-hop";
+ }
+
+ uses srv6:path-attrs-cmn;
+ }
+
+ grouping path-attrs-mpls {
+ description
+ "MPLS Path properties";
+
+ leaf interface {
+ type if:interface-ref;
+ description "The outgoing interface";
+ }
+
+ leaf next-hop {
+ type inet:ip-address;
+ description "The IP address of the next-hop";
+ }
+
+ uses srv6:path-attrs-cmn;
+ }
+
+ grouping multi-paths-v6 {
+ description "Multipath grouping";
+
+ container paths {
+ description "List of outgoing paths";
+ list path {
+ key path-index;
+ description "The list of paths associated with the SID";
+
+ leaf path-index {
+ type uint8;
+ description "Index of the path";
+ }
+
+ uses path-attrs-v6;
+ container encap {
+ description "Encapsulation on path";
+ uses srv6:path-out-sids;
+ }
+ }
+ }
+ }
+
+
+ grouping multi-paths-v4 {
+ description "Multipath grouping";
+
+ container paths {
+ description "List of outgoing paths";
+ list path {
+ key path-index;
+ description "The list of paths associated with the SID";
+
+ leaf path-index {
+ type uint8;
+ description "Index of the path";
+ }
+
+ uses path-attrs-v4;
+ container encap {
+ description "Encapsulation on path";
+ uses srv6:path-out-sids;
+ }
+ }
+ }
+ }
+
+ grouping multi-paths-mpls {
+ description "Multipath grouping";
+
+ container paths {
+ description "List of outgoing paths";
+ list path {
+ key path-index;
+ description "The list of paths associated with the SID";
+
+ leaf path-index {
+ type uint8;
+ description "Index of the path";
+ }
+
+ uses path-attrs-mpls;
+ container encap {
+ description "Encapsulation on path";
+ uses srv6:path-out-labels;
+ }
+ }
+ }
+ }
+
+ grouping srv6-sid-config {
+ description
+
+ "Configuration parameters relating to SRv6 sid.";
+
+ leaf opcode {
+ type srv6-types:srv6-func-opcode-unreserved;
+ description
+ "SRv6 function opcode.";
+ }
+ leaf end-behavior-type {
+ type identityref {
+ base srv6-types:srv6-endpoint-type;
+ }
+ mandatory true;
+ description
+ "Type of SRv6 end behavior.";
+ }
+
+ container end {
+ when "../end-behavior-type = 'End'" {
+ description
+ "This container is valid only when the user chooses End
+ behavior (variant: no PSP, no USP).";
+ }
+ description
+ "The Endpoint function is the most basic function.
+ FIB lookup on updated DA and forward accordingly
+ to the matched entry.
+ This is the SRv6 instantiation of a Prefix SID
+ (variant: no PSP, no USP)";
+
+ }
+
+ container end_psp {
+ when "../end-behavior-type = 'End_PSP'" {
+ description
+ "This container is valid only when the user chooses End
+ behavior (variant: PSP only).";
+ }
+ description
+ "The Endpoint function is the most basic function.
+ FIB lookup on updated DA and forward accordingly
+ to the matched entry.
+ This is the SRv6 instantiation of a Prefix SID
+ (variant: PSP only)";
+
+ }
+
+ container end_usp {
+ when "../end-behavior-type = 'End_USP'" {
+
+ description
+ "This container is valid only when the user chooses End
+ behavior (variant: USP only).";
+ }
+ description
+ "The Endpoint function is the most basic function.
+ FIB lookup on updated DA and forward accordingly
+ to the matched entry.
+ This is the SRv6 instantiation of a Prefix SID
+ (variant: USP only)";
+
+ }
+
+ container end_psp_usp {
+ when "../end-behavior-type = 'End_PSP_USP'" {
+ description
+ "This container is valid only when the user chooses End
+ behavior (variant: PSP/USP).";
+ }
+ description
+ "The Endpoint function is the most basic function.
+ FIB lookup on updated DA and forward accordingly
+ to the matched entry.
+ This is the SRv6 instantiation of a Prefix SID
+ (variant: PSP/USP)";
+
+ }
+
+ container end-t {
+ when "../end-behavior-type = 'End.T'" {
+ description
+ "This container is valid only when the user chooses
+ End.T behavior (variant: no PSP, no USP).";
+ }
+ description
+ "Endpoint with specific IPv6 table lookup (variant: no PSP, no USP).
+ Lookup the next segment in IPv6 table T
+ associated with the SID and forward via
+ the matched table entry.
+ The End.T is used for multi-table operation
+ in the core.";
+ // TODO: HC2VPP-332 - Uncommented presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+ leaf lookup-table-ipv6 {
+ type srv6-types:table-id;
+ mandatory true;
+ description
+ "Table Id for lookup on updated DA (next segment)";
+
+ }
+ }
+
+ container end-t_psp {
+ when "../end-behavior-type = 'End.T_PSP'" {
+ description
+ "This container is valid only when the user chooses
+ End.T behavior (variant: PSP only).";
+ }
+ description
+ "Endpoint with specific IPv6 table lookup (variant: PSP only).
+ Lookup the next segment in IPv6 table T
+ associated with the SID and forward via
+ the matched table entry.
+ The End.T is used for multi-table operation
+ in the core.";
+ // TODO: HC2VPP-332 - Uncommented presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+
+ leaf lookup-table-ipv6 {
+ type srv6-types:table-id;
+ mandatory true;
+ description
+ "Table Id for lookup on updated DA (next segment)";
+ }
+ }
+
+
+ container end-t_usp {
+ when "../end-behavior-type = 'End.T_USP'" {
+ description
+ "This container is valid only when the user chooses
+ End.T behavior (variant: USP only).";
+ }
+ description
+ "Endpoint with specific IPv6 table lookup (variant: USP only).
+ Lookup the next segment in IPv6 table T
+ associated with the SID and forward via
+ the matched table entry.
+ The End.T is used for multi-table operation
+ in the core.";
+ // TODO: HC2VPP-332 - Uncommented presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+
+ leaf lookup-table-ipv6 {
+ type srv6-types:table-id;
+ mandatory true;
+ description
+
+ "Table Id for lookup on updated DA (next segment)";
+ }
+ }
+
+ container end-t_psp_usp {
+ when "../end-behavior-type = 'End.T_PSP_USP'" {
+ description
+ "This container is valid only when the user chooses
+ End.T behavior (variant: USP/PSP).";
+ }
+ description
+ "Endpoint with specific IPv6 table lookup (variant: USP/PSP).
+ Lookup the next segment in IPv6 table T
+ associated with the SID and forward via
+ the matched table entry.
+ The End.T is used for multi-table operation
+ in the core.";
+ // TODO: HC2VPP-332 - Uncommented presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+
+ leaf lookup-table-ipv6 {
+ type srv6-types:table-id;
+ mandatory true;
+ description
+ "Table Id for lookup on updated DA (next segment)";
+ }
+ }
+
+ container end-x {
+ when "../end-behavior-type = 'End.X'" {
+ description
+ "This container is valid only when the user chooses
+ End.X behavior (variant: no USP/PSP)";
+ }
+ description
+ "Endpoint with cross-connect to an array of
+ layer-3 adjacencies (variant: no USP/PSP).
+ Forward to layer-3 adjacency bound to the SID S.
+ The End.X function is required to express any
+ traffic-engineering policy.";
+
+ leaf protected {
+ type boolean;
+ default false;
+ description "Is Adj-SID protected?";
+ }
+
+ uses multi-paths-v6;
+
+ }
+
+ container end-x_psp {
+ when "../end-behavior-type = 'End.X_PSP'" {
+ description
+ "This container is valid only when the user chooses
+ End.X behavior (variant: PSP only)";
+ }
+ description
+ "Endpoint with cross-connect to an array of
+ layer-3 adjacencies (variant: PSP only).
+ Forward to layer-3 adjacency bound to the SID S.
+ The End.X function is required to express any
+ traffic-engineering policy.";
+
+ leaf protected {
+ type boolean;
+ default false;
+ description "Is Adj-SID protected?";
+ }
+
+ uses multi-paths-v6;
+ }
+
+ container end-x_usp {
+ when "../end-behavior-type = 'End.X_USP'" {
+ description
+ "This container is valid only when the user chooses
+ End.X behavior (variant: USP only)";
+ }
+ description
+ "Endpoint with cross-connect to an array of
+ layer-3 adjacencies (variant: USP only).
+ Forward to layer-3 adjacency bound to the SID S.
+ The End.X function is required to express any
+ traffic-engineering policy.";
+
+ leaf protected {
+ type boolean;
+ default false;
+ description "Is Adj-SID protected?";
+ }
+
+ uses multi-paths-v6;
+ }
+
+ container end-x_psp_usp {
+ when "../end-behavior-type = 'End.X_PSP_USP'" {
+
+ description
+ "This container is valid only when the user chooses
+ End.X behavior (variant: PSP/USP)";
+ }
+ description
+ "Endpoint with cross-connect to an array of
+ layer-3 adjacencies (variant: PSP/USP).
+ Forward to layer-3 adjacency bound to the SID S.
+ The End.X function is required to express any
+ traffic-engineering policy.";
+
+ leaf protected {
+ type boolean;
+ default false;
+ description "Is Adj-SID protected?";
+ }
+
+ uses multi-paths-v6;
+ }
+
+
+ container end-b6 {
+ when "../end-behavior-type = 'End.B6'" {
+ description
+ "This container is valid only when the user chooses
+ End.B6 behavior.";
+ }
+ description
+ "Endpoint bound to an SRv6 Policy.
+ Insert SRH based on the policy and forward the
+ packet toward the first hop configured in the policy.
+ This is the SRv6 instantiation of a Binding SID.";
+ // TODO: HC2VPP-332 - Uncommented presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+
+ leaf policy-name {
+ type string;
+ mandatory true;
+ description "SRv6 policy name.";
+ }
+
+ uses multi-paths-v6;
+ }
+
+ container end-b6-encaps {
+ when "../end-behavior-type = 'End.B6.Encaps'" {
+ description
+ "This container is valid only when the user chooses
+
+ End_B6_Encaps behavior.";
+ }
+ description
+ "This is a variation of the End.B6 behavior where
+ the SRv6 Policy also includes an IPv6 Source
+ Address.
+ Insert SRH based on the policy and update the
+ source IP and forward the packet toward the
+ first hop configured in the policy.
+ Instead of simply inserting an SRH with the
+ policy (End.B6), this behavior also adds an
+ outer IPv6 header.";
+ // TODO: HC2VPP-332 - Uncommented presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+
+ leaf policy-name {
+ type string;
+ mandatory true;
+ description "SRv6 policy name.";
+ }
+ leaf source-address {
+ type inet:ipv6-address;
+ mandatory true;
+ description
+ "IPv6 source address for Encap.";
+ }
+
+ uses multi-paths-v6;
+ }
+
+ container end-bm {
+ when "../end-behavior-type = 'End.BM'" {
+ description
+ "This container is valid only when the user chooses
+ End.BM behavior.";
+ }
+ description
+ "Endpoint bound to an SR-MPLS Policy.
+ push an MPLS label stack <L1, L2, L3> on the
+ received packet and forward the according to
+ Lable L1.
+ This is an SRv6 instantiation of an SR-MPLS Binding SID.";
+ // TODO: HC2VPP-332 - Uncommented presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+
+ leaf policy-name {
+ type string;
+ mandatory true;
+
+ description "SRv6 policy name";
+ }
+ uses multi-paths-mpls;
+ }
+
+ container end-dx6 {
+ when "../end-behavior-type = 'End.DX6'" {
+ description
+ "This container is valid only when the user chooses
+ End.DX6 behavior.";
+ }
+ description
+ "Endpoint with decapsulation and cross-connect to
+ an array of IPv6 adjacencies. Pop the (outer)
+ IPv6 header and its extension headers and forward
+ to layer-3 adjacency bound to the SID S.
+ The End.DX6 used in the L3VPN use-case.";
+
+ uses multi-paths-v6;
+ }
+ container end-dx4 {
+ when "../end-behavior-type = 'End.DX4'" {
+ description
+ "This container is valid only when the user chooses
+ End.DX4 behavior.";
+ }
+ description
+ "Endpoint with decapsulation and cross-connect to
+ an array of IPv4 adjacencies.
+ Pop the (outer) IPv6 header and its extension
+ header and forward to layer-3 adjacency bound
+ to the SID S.
+ This would be equivalent to the per-CE VPN
+ label in MPLS.";
+
+ uses multi-paths-v4;
+ }
+ container end-dt6 {
+ when "../end-behavior-type = 'End.DT6'" {
+ description
+ "This container is valid only when the user chooses
+ End.DT6 behavior.";
+ }
+ description
+ "Endpoint with decapsulation and specific IPv6 table
+ lookup.
+ Pop the (outer) IPv6 header and its extension
+ headers.
+
+ Lookup the exposed inner IPv6 DA in IPv6
+ table T and forward via the matched table entry.
+ End.DT6 function is used in L3VPN use-case.";
+ // TODO: HC2VPP-332 - Uncommented presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+
+ leaf lookup-table-ipv6 {
+ type srv6-types:table-id;
+ mandatory true;
+ description "IPv6 table";
+ }
+ }
+ container end-dt4 {
+ when "../end-behavior-type = 'End.DT4'" {
+ description
+ "This container is valid only when the user chooses
+ End.DT4 behavior.";
+ }
+ description
+ "Endpoint with decapsulation and specific
+ IPv4 table lookup.
+ Pop the (outer) IPv6 header and its extension
+ headers.
+ Lookup the exposed inner IPv4 DA in IPv4
+ table T and forward via the matched table entry.
+ This would be equivalent to the per-VRF VPN label
+ in MPLS.";
+ // TODO: HC2VPP-332 - Uncommented presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+
+ leaf lookup-table-ipv4 {
+ type srv6-types:table-id;
+ mandatory true;
+ description "IPv4 table";
+ }
+ }
+ container end-dt46 {
+ when "../end-behavior-type = 'End.DT46'" {
+ description
+ "This container is valid only when the user chooses
+ End.DT46 behavior.";
+ }
+ description
+ "Endpoint with decapsulation and specific
+ IP table lookup.
+ Depending on the protocol type (IPv4 or IPv6)
+ of the inner ip packet and the specific VRF name
+ forward the packet.
+
+ This would be equivalent to the per-VRF VPN
+ label in MPLS.";
+ // TODO: HC2VPP-332 - Uncommented presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+
+ leaf lookup-table-ipv4 {
+ type srv6-types:table-id;
+ mandatory true;
+ description "IPv4 table";
+ }
+ leaf lookup-table-ipv6 {
+ type srv6-types:table-id;
+ mandatory true;
+ description "IPv6 table";
+ }
+ }
+
+ container end-dx2 {
+ when "../end-behavior-type = 'End.DX2'" {
+ description
+ "This container is valid only when the user chooses
+ End.DX2 behavior.";
+ }
+ description
+ "This is an Endpoint with decapsulation and Layer-2
+ cross-connect to OIF.
+ Pop the (outer) IPv6 header and its extension headers.
+ Forward the resulting frame via OIF associated to the SID.
+ The End.DX2 function is the L2VPN use-case";
+ // TODO: HC2VPP-332 - Added presence in container so mandatory child is enforced
+ // only when container is present. Caused by Yangtools not enforcing when statement (YANGTOOLS-688).
+ presence "Mandatory child only if container is present";
+
+ container paths {
+ description "List of outgoing paths";
+
+ leaf interface {
+ type if:interface-ref;
+ mandatory true;
+ description "Layer-2 cross-connect to Out interface.";
+ }
+ }
+ }
+ /* TODO
+ container end-dx2v {
+ when "../end-behavior-type = 'End.DX2V'" {
+ description
+ "This container is valid only when the user chooses
+ End.DX2V behavior.";
+ }
+ description
+
+ "Endpoint with decapsulation and specific VLAN
+ L2 table lookup.
+ Pop the (outer) IPv6 header
+ and its extension headers lookup the exposed
+ inner VLANs in L2 table T forward via the
+ matched table entry.
+ The End.DX2V is used for EVPN Flexible cross-connect
+ use-cases";
+ leaf end-dx2v {
+ type empty;
+ description
+ "End_DX2V behavior";
+ }
+ }
+ container end-dt2u {
+ when "../end-behavior-type = 'End.DT2U'" {
+ description
+ "This container is valid only when the user chooses
+ End.DT2U behavior.";
+ }
+ description
+ "Endpoint with decapsulation and specific
+ unicast MAC L2 table lookup.
+ Pop the (outer) IPv6 header and its extension headers.
+ Learn the exposed inner MAC SA in L2 table T.
+ Lookup the exposed inner MAC DA in L2 table T.
+ Forward via the matched T entry else to all L2OIF in T.
+ The End.DT2U is used for EVPN Bridging unicast use cases";
+ leaf end-dt2u {
+ type empty;
+ description
+ "End_DT2U behavior";
+ }
+ }
+ container end-dt2m {
+ when "../end-behavior-type = 'End.DT2M'" {
+ description
+ "This container is valid only when the user chooses
+ End.DT2M behavior.";
+ }
+ description
+ "Endpoint with decapsulation and specific L2 table flooding.
+ Pop the (outer) IPv6 header and its extension headers.
+ Learn the exposed inner MAC SA in L2 table T.
+ Forward on all L2OIF excluding the one specified in Arg.FE2.
+ The End.DT2M is used for EVPN Bridging BUM use case with
+ ESI filtering capability.";
+ leaf end-dt2m {
+
+ type empty;
+ description
+ "End_DT2M behavior";
+ }
+ }
+*/
+
+ container end-otp {
+ when "../end-behavior-type = 'End.OTP'" {
+ description
+ "This container is valid only when the user chooses
+ End.OTP behavior.";
+ }
+ description
+ "Endpoint for OAM with timestamp and punt behavior";
+ }
+ }
+
+ grouping srv6-static-cfg {
+ description
+ "Grouping configuration and operation for SRv6 sid.";
+
+ list sid {
+ key "opcode";
+ description "Local SID list";
+
+ uses srv6-sid-config;
+ }
+ }
+
+ augment "/rt:routing/srv6:srv6/srv6:locators/srv6:locator" {
+ description
+ "This augments locator leaf withing SRv6.";
+
+ container static {
+ description "Static SRv6";
+
+ /* Local SIDs */
+ container local-sids {
+ description
+ "SRv6-static local-SIDs";
+
+ uses srv6-static-cfg;
+ /* no state for now; SID state accessible through base model */
+ }
+
+ }
+ }
+
+} // module
diff --git a/srv6/srv6-api/src/main/yang/ietf-srv6-types@2018-03-01.yang b/srv6/srv6-api/src/main/yang/ietf-srv6-types@2018-03-01.yang
new file mode 100644
index 000000000..e87a92f14
--- /dev/null
+++ b/srv6/srv6-api/src/main/yang/ietf-srv6-types@2018-03-01.yang
@@ -0,0 +1,589 @@
+module ietf-srv6-types {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-srv6-types";
+ prefix srv6-types;
+
+ import ietf-inet-types {
+ prefix inet;
+ }
+
+ organization
+ "IETF SPRING Working Group";
+ contact
+ "WG Web: <http://tools.ietf.org/wg/spring/>
+ WG List: <mailto:spring@ietf.org>
+
+ Editor: Kamran Raza
+ <mailto:skraza@cisco.com>
+
+ Editor: Jaganbabu Rajamanickam
+ <maito:jrajaman@cisco.com>
+
+ Editor: Xufeng Liu
+ <mailto:Xufeng_Liu@jabil.com>
+
+ Editor: Zhibo Hu
+ <mailto:huzhibo@huawei.com>
+
+ Editor: Iftekhar Hussain
+ <mailto:IHussain@infinera.com>
+
+ Editor: Himanshu Shah
+ <mailto:hshah@ciena.com>
+
+ Editor: Daniel Voyer
+ <mailto:daniel.voyer@bell.ca>
+
+ Editor: Hani Elmalky
+ <mailto:hani.elmalky@ericsson.com>
+
+ Editor: Satoru Matsushima
+ <mailto:satoru.matsushima@gmail.com>
+
+ Editor: Katsuhiro Horiba
+
+ <mailto:katsuhiro.horiba@g.softbank.co.jp>
+
+ Editor: Ahmed AbdelSalam
+ <mailto:ahmed.abdelsalam@gssi.it>
+
+ ";
+
+ description
+ "This YANG module defines the essential types for the
+ management of Segment-Routing with IPv6 dataplane (SRv6).
+
+ Copyright (c) 2018 IETF Trust and the persons identified as
+ authors of the code. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or
+ without modification, is permitted pursuant to, and subject
+ to the license terms contained in, the Simplified BSD License
+ set forth in Section 4.c of the IETF Trust's Legal Provisions
+ Relating to IETF Documents
+ (http://trustee.ietf.org/license-info).";
+
+ reference "RFC XXXX";
+
+ revision 2018-03-01 {
+ description
+ "Updated to align with SRv6 network programming draft rev 04";
+ reference
+ "RFC XXXX: YANG Data Model for SRv6";
+ }
+
+ revision 2017-11-12 {
+ description
+ "Initial revision";
+ reference
+ "RFC XXXX: YANG Data Model for SRv6";
+ }
+
+ identity srv6-endpoint-type {
+ description
+ "Base identity from which specific SRv6 Endpoint types are derived.";
+ }
+
+ /* Endpoints defined under draft-filsfils-spring-srv6-network-programming */
+
+ identity End {
+ base srv6-endpoint-type;
+ description
+ "End function (variant: no PSP, no USP).";
+
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End_PSP {
+ base srv6-endpoint-type;
+ description
+ "End function (variant: PSP only).";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End_USP {
+ base srv6-endpoint-type;
+ description
+ "End function (variant: USP only).";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End_PSP_USP {
+ base srv6-endpoint-type;
+ description
+ "End function (variant: PSP and USP).";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.X {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with cross-connect to an array
+ of layer-3 adjacencies (variant: no PSP, no USP).";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.X_PSP {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with cross-connect to an array
+ of layer-3 adjacencies (variant: PSP only).";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.X_USP {
+ base srv6-endpoint-type;
+
+ description
+ "Endpoint with cross-connect to an array
+ of layer-3 adjacencies (variant: USP only).";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.X_PSP_USP {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with cross-connect to an array
+ of layer-3 adjacencies (variant: PSP and USP).";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.T {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with specific IPv6 table lookup
+ (variant: no PSP, no USP).";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.T_PSP {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with specific IPv6 table lookup
+ (variant: PSP only).";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.T_USP {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with specific IPv6 table lookup
+ (variant: USP only).";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.T_PSP_USP {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with specific IPv6 table lookup
+ (variant: PSP and USP).";
+
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.B6 {
+ base srv6-endpoint-type;
+ description
+ "Endpoint bound to an SRv6 Policy";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.B6.Encaps {
+ base srv6-endpoint-type;
+ description
+ "This is a variation of the End.B6 behavior
+ where the SRv6 Policy also includes an
+ IPv6 Source Address A.";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.BM {
+ base srv6-endpoint-type;
+ description
+ "Endpoint bound to an SR-MPLS Policy";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.DX6 {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with decapsulation and cross-connect
+ to an array of IPv6 adjacencies";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.DX4 {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with decapsulation and cross-connect
+ to an array of IPv4 adjacencies";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+
+ identity End.DT6 {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with decapsulation and specific
+ IPv6 table lookup";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.DT4 {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with decapsulation and specific
+ IPv4 table lookup";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.DT46 {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with decapsulation and specific IP
+ (IPv4 or IPv6) table lookup";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.DX2 {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with decapsulation and Layer-2
+ cross-connect to an L2 interface";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.DX2V {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with decapsulation and specific
+ VLAN L2 table lookup";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.DT2U {
+ base srv6-endpoint-type;
+ description
+
+ "Endpoint with decapsulation and specific
+ unicast MAC L2 table lookup";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.DT2M {
+ base srv6-endpoint-type;
+ description
+ "Endpoint with decapsulation and specific L2 table
+ flooding";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.OTP {
+ base srv6-endpoint-type;
+ description
+ "Endpoint for OAM operation of timestamp and punt";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ identity End.S {
+ base srv6-endpoint-type;
+ description
+ "Endpoint in search of a target in table TE";
+ reference
+ "draft-filsfils-spring-srv6-network-programming-04";
+ }
+
+ /* Endpoints defined under draft-xuclad-spring-sr-service-chaining */
+
+ identity End.AS {
+ base srv6-endpoint-type;
+ description
+ "Service-Chaining Static proxy for inner type (Ethernet,
+ IPv4 or IPv6)";
+ reference
+ "draft-xuclad-spring-sr-service-chaining-01";
+ }
+
+ identity End.AD {
+ base srv6-endpoint-type;
+ description
+ "Service-Chaining Dynamic proxy for inner type (Ethernet,
+ IPv4 or IPv6)";
+ reference
+
+ "draft-xuclad-spring-sr-service-chaining-01";
+ }
+
+ identity End.ASM {
+ base srv6-endpoint-type;
+ description
+ "Service-Chaining Shared memory SR proxy for inner type
+ (Ethernet, IPv4 or IPv6)";
+ reference
+ "draft-xuclad-spring-sr-service-chaining-01";
+ }
+
+ identity End.AM {
+ base srv6-endpoint-type;
+ description
+ "Service-Chaining Masquerading SR proxy";
+ reference
+ "draft-xuclad-spring-sr-service-chaining-01";
+ }
+
+ /* Endpoints defined under draft-ietf-dmm-srv6-mobile-uplane */
+
+ identity End.MAP {
+ base srv6-endpoint-type;
+ description
+ "DMM End.MAP";
+ reference
+ "draft-ietf-dmm-srv6-mobile-uplane-01";
+ }
+
+ identity End.M.GTP6.UP {
+ base srv6-endpoint-type;
+ description
+ "DMM End.M.GTP6.UP";
+ reference
+ "draft-ietf-dmm-srv6-mobile-uplane-01";
+ }
+
+ identity End.M.GTP6.DN {
+ base srv6-endpoint-type;
+
+ description
+ "DMM End.M.GTP6.DN";
+ reference
+ "draft-ietf-dmm-srv6-mobile-uplane-01";
+ }
+
+ identity End.M.GTP4.DN {
+ base srv6-endpoint-type;
+ description
+ "DMM End.M.GTP4.DN";
+ reference
+ "draft-ietf-dmm-srv6-mobile-uplane-01";
+ }
+
+ identity End.Limit {
+ base srv6-endpoint-type;
+ description
+ "DMM End.Limit";
+ reference
+ "draft-ietf-dmm-srv6-mobile-uplane-01";
+ }
+
+ typedef srv6-transit-type {
+
+ type enumeration {
+ /* draft-filsfils-spring-srv6-network-programming-04 */
+ enum T { value 1; description "Transit behavior"; }
+ enum T.Insert {
+ description "Transit behavior with insertion of an SRv6 policy";
+ }
+ enum T.Insert.Red {
+ description "Transit behavior with reduced insertion of an SRv6 policy";
+ }
+ enum T.Encaps {
+ description "Transit behavior with encap of an SRv6 policy";
+ }
+ enum T.Encaps.Red {
+ description "Transit behavior with reduced encap of an SRv6 policy";
+ }
+ enum T.Encaps.L2 {
+ description "T.Encaps behavior on the received L2 frame";
+ }
+ enum T.Encaps.L2.Red {
+ description "T.Encaps.Red behavior on the received L2 frame";
+ }
+ }
+
+ description "SRv6 Transit behavior types";
+
+ }
+
+ typedef srv6-security-rule-type {
+ type enumeration {
+ /* draft-filsfils-spring-srv6-network-programming-04 */
+ enum SEC1 { value 1; description "Security rule SEC1"; }
+ enum SEC2 { description "Security rule SEC2"; }
+ enum SEC3 { description "Security rule SEC3"; }
+ enum SEC4 { description "Security rule SEC4"; }
+ }
+
+ description "SRv6 Security rule types";
+ }
+
+ typedef srv6-counter-type {
+ type enumeration {
+ /* draft-filsfils-spring-srv6-network-programming-04 */
+ enum CNT1 { value 1; description "CNT1"; }
+ enum CNT2 { description "CNT2"; }
+ enum CNT3 { description "CNT3"; }
+ }
+
+ description "SRv6 counter types";
+ }
+
+ typedef srv6-sid {
+ type inet:ipv6-prefix;
+ description
+ "This type defines a SID value in SRv6";
+ }
+
+ typedef srv6-func-opcode {
+ type uint32;
+ description
+ "This is a typedef for SID FUNC's opcode type";
+ }
+
+ typedef srv6-func-opcode-reserved {
+ type uint32 {
+ range "1 .. 63";
+ }
+
+ description
+ "This is a typedef for SID FUNC's reserved opcode type";
+ }
+
+ typedef srv6-func-opcode-unreserved {
+ type uint32 {
+
+ range "64 .. max";
+ }
+
+ description
+ "This is a typedef for SID FUNC's allocatable (unreserved) opcode type";
+ }
+
+ typedef srv6-func-opcode-reserved-type {
+ type enumeration {
+ enum invalid { value 0; description "Invalid opcode"; }
+ }
+
+ description "SRv6 SID FUNC Reserved Opcodes";
+ }
+
+ typedef srv6-locator-len {
+ type uint8 {
+ range "32 .. 96";
+ }
+ description
+ "This type defines an SRv6 locator len with range constraints";
+ }
+
+ typedef srv6-sid-pfxlen {
+ type uint8 {
+ range "33 .. 128";
+ }
+ default 128;
+ description
+ "This type defines a SID prefixlen with range constraints";
+ }
+
+ typedef sid-alloc-type {
+ type enumeration {
+ enum Dynamic {
+ description
+ "SID allocated dynamically.";
+ }
+ enum Explicit {
+ description
+ "SID allocated with explicit (static) value";
+ }
+ }
+ description
+ "Types of sid allocation used.";
+ }
+
+ identity srv6-sid-owner-type {
+
+ description
+ "Base identity from which SID owner types are derived.";
+ }
+
+ identity isis {
+ base srv6-sid-owner-type;
+ description "ISIS";
+ }
+
+ identity ospfv3 {
+ base srv6-sid-owner-type;
+ description "OSPFv3";
+ }
+
+ identity bgp {
+ base srv6-sid-owner-type;
+ description "BGP";
+ }
+
+ identity evpn {
+ base srv6-sid-owner-type;
+ description "EVPN";
+ }
+
+ identity sr-policy {
+ base srv6-sid-owner-type;
+ description "SR Policy";
+ }
+
+ identity service-function {
+ base srv6-sid-owner-type;
+ description "SF";
+ }
+
+ // TODO: Rtg module ?
+ typedef table-id {
+ type uint32;
+ description
+ "Routing Table Id";
+ }
+
+ typedef srv6-status-type {
+ type enumeration {
+ enum up { value 1; description "State is Up"; }
+ enum down { description "State is Down"; }
+ }
+ description
+ "Status type";
+
+ }
+
+ typedef srv6-nexthop-type {
+ type enumeration {
+ enum ipv4 { value 1; description "IPv4 next-hop"; }
+ enum ipv6 { description "IPv6 next-hop"; }
+ enum mpls { description "MPLS next-hop"; }
+ enum l2 { description "L2 next-hop"; }
+ }
+ description
+ "Forwarding Next-hop type";
+ }
+
+} // module
diff --git a/srv6/srv6-api/src/main/yang/vpp-ietf-srv6-base@2018-06-13.yang b/srv6/srv6-api/src/main/yang/vpp-ietf-srv6-base@2018-06-13.yang
new file mode 100644
index 000000000..16aad11c8
--- /dev/null
+++ b/srv6/srv6-api/src/main/yang/vpp-ietf-srv6-base@2018-06-13.yang
@@ -0,0 +1,73 @@
+module vpp-ietf-srv6-base {
+
+ namespace "urn:hc2vpp:params:xml:ns:yang:vpp-ietf-srv6-base";
+ prefix vpp-ietf-srv6-base;
+
+ import hc2vpp-ietf-srv6-base {
+ prefix "ietf-srv6-base";
+ revision-date 2018-03-01;
+ }
+
+ import vpp-fib-table-management {
+ prefix fib-management;
+ revision-date 2018-05-21;
+ }
+
+ import hc2vpp-ietf-routing {
+ prefix "rt";
+ }
+
+ import yang-ext { prefix "ext"; }
+
+ organization
+ "FD.io - The Fast Data Project";
+
+ contact
+ "Hc2vpp Wiki <https://wiki.fd.io/view/Hc2vpp>
+ Mailing List <hc2vpp@lists.fd.io>";
+
+ description
+ "This module provides VPP specific configuration of FIB table management
+ for SRv6 base configuration.
+ It augments locator beacause, locator is the routable element in SRv6 and
+ because this is IPv6 specific configuration the address family for FIB has
+ to be always Ipv6.
+
+ Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.";
+
+ revision 2018-06-13 {
+ description "initial revision";
+ }
+
+ grouping vpp-srv6-fib {
+ container fib-table {
+ leaf table-id {
+ type fib-management:fib-table-list-ref;
+ description "VRF index reference.";
+ }
+ leaf address-family {
+ type fib-management:address-family-type;
+ description "Address family reference. For SRv6 has to be always Ipv6.";
+ }
+ }
+ }
+
+ augment "/rt:routing/ietf-srv6-base:srv6/ietf-srv6-base:locators/ietf-srv6-base:locator" {
+ description "This augments locator leaf withing SRv6 with VPP specific configuration.";
+ ext:augment-identifier "vpp-srv6-fib-locator-augment";
+
+ uses vpp-srv6-fib;
+ }
+}
diff --git a/srv6/srv6-impl/asciidoc/Readme.adoc b/srv6/srv6-impl/asciidoc/Readme.adoc
new file mode 100644
index 000000000..73b6f1b82
--- /dev/null
+++ b/srv6/srv6-impl/asciidoc/Readme.adoc
@@ -0,0 +1,43 @@
+= srv6-impl
+
+== Implemented features:
+
+- locator read,write and delete requests and customizers,
+ based on augmentation of routing model in: +
+ `hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator`
+- local sid read,write and delete requests and customizers,
+ based on augmentation of routing model in: +
+ `hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/static/local-sids/sid/`
+- encapsulation source write and delete requests and customizers,
+ based on augmentation of routing model in: +
+ `hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/hc2vpp-ietf-srv6-base:encapsulation`
+
+== VPP mapping
+
+- local sid and locator configuration maps to *sr_localsid_add_del* in VPP API:
+ *IPv6 SR LocalSID add/del params:* +
+ *is_del* Boolean of whether its a delete instruction +
+ *localsid_addr* IPv6 address of the localsid +
+ *end_psp* Boolean of whether decapsulation is allowed in this function +
+ *behavior* Type of behavior (function) for this localsid +
+ *sw_if_index* Only for L2/L3 xconnect. OIF. In VRF variant the fib_table. +
+ *vlan_index* Only for L2 xconnect. Outgoing VLAN tag. +
+ *fib_table* FIB table in which we should install the localsid entry +
+ *nh_addr6* Next Hop IPv6 address. Only for L2/L3 xconnect. +
+ *nh_addr4* Next Hop IPv6 address. Only for L2/L3 xconnect. +
+- encapsulation source maps to *sr_set_encap_source* in VPP API: +
+ *IPv6 SR Set SRv6 encapsulation source params:* +
+ *bsid* is the bindingSID of the SR Policy +
+ *index* is the index of the SR policy
+
+
+== Supported End function configurations:
+
+- *END* (VPP behavior type 1)
+- *END X* (VPP behavior type 2)
+- *END DX2* (VPP behavior type 5)
+- *END DX4* (VPP behavior type 7)
+- *END DX6* (VPP behavior type 6)
+- *END T* (VPP behavior type 3)
+- *END DT4* (VPP behavior type 9)
+- *END DT6* (VPP behavior type 8)
diff --git a/srv6/srv6-impl/pom.xml b/srv6/srv6-impl/pom.xml
new file mode 100644
index 000000000..08fed218b
--- /dev/null
+++ b/srv6/srv6-impl/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2018 Bell Canada, Pantheon Technologies 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ 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>io.fd.hc2vpp.common</groupId>
+ <artifactId>vpp-impl-parent</artifactId>
+ <version>1.18.07-SNAPSHOT</version>
+ <relativePath>../../vpp-common/vpp-impl-parent</relativePath>
+ </parent>
+
+ <groupId>io.fd.hc2vpp.srv6</groupId>
+ <artifactId>srv6-impl</artifactId>
+ <name>${project.artifactId}</name>
+ <version>1.18.07-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.fd.hc2vpp.routing</groupId>
+ <artifactId>routing-impl</artifactId>
+ <version>1.18.07-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- Honeycomb infrastructure -->
+ <dependency>
+ <groupId>io.fd.honeycomb</groupId>
+ <artifactId>translate-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.fd.honeycomb</groupId>
+ <artifactId>translate-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.fd.honeycomb</groupId>
+ <artifactId>translate-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- SRv6 api -->
+ <dependency>
+ <groupId>io.fd.hc2vpp.srv6</groupId>
+ <artifactId>srv6-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- Translation -->
+ <dependency>
+ <groupId>io.fd.hc2vpp.common</groupId>
+ <artifactId>vpp-translate-utils</artifactId>
+ </dependency>
+ <!-- DI -->
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.fd.hc2vpp.common</groupId>
+ <artifactId>vpp-translate-test</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- Helpers -->
+ <dependency>
+ <groupId>com.googlecode.java-ipv6</groupId>
+ <artifactId>java-ipv6</artifactId>
+ <version>0.16</version>
+ </dependency>
+ <!-- Tests -->
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.fd.honeycomb.infra</groupId>
+ <artifactId>test-tools</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-testlib</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6Configuration.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6Configuration.java
new file mode 100644
index 000000000..8d23b1703
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6Configuration.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6;
+
+public class Srv6Configuration {
+
+ /**
+ * Used to map Srv6 Sids to locator length values
+ */
+ public static final String LOCATOR_CONTEXT = "locator-context";
+
+ /**
+ * Locator length context child name for locator length
+ */
+ public static final String LOCATOR_LENGTH = "locator-length";
+
+ /**
+ * Locator length context child name for locator length
+ */
+ public static final String LOCATOR_IPV6_ADDRESS = "locator-ipv6-address";
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6IIds.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6IIds.java
new file mode 100644
index 000000000..53c0df6d1
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6IIds.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+
+package io.fd.hc2vpp.srv6;
+
+import org.opendaylight.yang.gen.v1.urn.hc2vpp.params.xml.ns.yang.vpp.ietf.srv6.base.rev180613.VppSrv6FibLocatorAugment;
+import org.opendaylight.yang.gen.v1.urn.hc2vpp.params.xml.ns.yang.vpp.ietf.srv6.base.rev180613.vpp.srv6.fib.FibTable;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.Routing;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.Locator1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v6.Paths;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v6.paths.Path;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.routing.srv6.locators.locator.Static;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.routing.srv6.locators.locator._static.LocalSids;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.End;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndB6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndB6Encaps;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndBm;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDt4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDt46;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDt6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDx2;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDx4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDx6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndT;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndX;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.Routing1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.routing.Srv6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.encap.Encapsulation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.Locators;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.Locator;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.locator.Prefix;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class Srv6IIds {
+ public final static InstanceIdentifier<Routing> RT = InstanceIdentifier.create(Routing.class);
+ public final static InstanceIdentifier<Routing1> RT_RT1_AUG = RT.augmentation(Routing1.class);
+ public final static InstanceIdentifier<Srv6> RT_SRV6 = RT_RT1_AUG.child(Srv6.class);
+ public final static InstanceIdentifier<Locators> RT_SRV6_LOCATORS = RT_SRV6.child(Locators.class);
+ public final static InstanceIdentifier<Locator> RT_SRV6_LOCS_LOCATOR = RT_SRV6_LOCATORS.child(Locator.class);
+ public final static InstanceIdentifier<Locator> LOCATOR = InstanceIdentifier.create(Locator.class);
+ public final static InstanceIdentifier<VppSrv6FibLocatorAugment> LOC_FT_AUG =
+ LOCATOR.augmentation(VppSrv6FibLocatorAugment.class);
+ public final static InstanceIdentifier<FibTable> LOC_FT = LOC_FT_AUG.child(FibTable.class);
+
+ public final static InstanceIdentifier<Prefix> LOC_PREFIX = LOCATOR.child(Prefix.class);
+ public final static InstanceIdentifier<Locator1> RT_SRV6_LOCS_LOC_AUG =
+ RT_SRV6_LOCS_LOCATOR.augmentation(Locator1.class);
+ public final static InstanceIdentifier<Static> RT_SRV6_LOCS_LOC_STATIC = RT_SRV6_LOCS_LOC_AUG.child(Static.class);
+ public final static InstanceIdentifier<LocalSids> RT_SRV6_LOCS_LOC_ST_LOCALSIDS =
+ RT_SRV6_LOCS_LOC_STATIC.child(LocalSids.class);
+ public final static InstanceIdentifier<Sid> RT_SRV6_LOCS_LOC_ST_LS_SID =
+ RT_SRV6_LOCS_LOC_ST_LOCALSIDS.child(Sid.class);
+ public final static InstanceIdentifier<Encapsulation> RT_SRV6_ENCAP = RT_SRV6.child(Encapsulation.class);
+
+ public final static InstanceIdentifier<Sid> SID = InstanceIdentifier.create(Sid.class);
+ public final static InstanceIdentifier<End> SID_END = SID.child(End.class);
+ public final static InstanceIdentifier<EndX> SID_END_X = SID.child(EndX.class);
+ public final static InstanceIdentifier<Paths> SID_END_X_PATHS = SID_END_X.child(Paths.class);
+ public final static InstanceIdentifier<Path> SID_END_X_PATHS_PATH = SID_END_X_PATHS.child(Path.class);
+ public final static InstanceIdentifier<EndT> SID_END_T = SID.child(EndT.class);
+ public final static InstanceIdentifier<EndB6> SID_END_B6 = SID.child(EndB6.class);
+ public final static InstanceIdentifier<EndB6Encaps> SID_END_B6ENCAP = SID.child(EndB6Encaps.class);
+ public final static InstanceIdentifier<EndBm> SID_END_BM = SID.child(EndBm.class);
+ public final static InstanceIdentifier<EndDt4> SID_END_DT4 = SID.child(EndDt4.class);
+ public final static InstanceIdentifier<EndDt6> SID_END_DT6 = SID.child(EndDt6.class);
+ public final static InstanceIdentifier<EndDt46> SID_END_DT46 = SID.child(EndDt46.class);
+ public final static InstanceIdentifier<EndDx2> SID_END_DX2 = SID.child(EndDx2.class);
+ public final static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.end.dx2.Paths>
+ SID_END_DX2_PATHS = SID_END_DX2.child(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.end.dx2.Paths.class);
+ public final static InstanceIdentifier<EndDx4> SID_END_DX4 = SID.child(EndDx4.class);
+ public final static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v4.Paths>
+ SID_END_DX4_PATHS = SID_END_DX4.child(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v4.Paths.class);
+ public final static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v4.paths.Path>
+ SID_END_DX4_PATHS_PATH = SID_END_DX4_PATHS.child(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v4.paths.Path.class);
+ public final static InstanceIdentifier<EndDx6> SID_END_DX6 = SID.child(EndDx6.class);
+ public final static InstanceIdentifier<Paths> SID_END_DX6_PATHS = SID_END_DX6.child(Paths.class);
+ public final static InstanceIdentifier<Path> SID_END_DX6_PATHS_PATH = SID_END_DX6_PATHS.child(Path.class);
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6Module.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6Module.java
new file mode 100644
index 000000000..5dd3e2097
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/Srv6Module.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+import io.fd.hc2vpp.srv6.util.function.LocalSidFunctionWriteBindingRegistry;
+import io.fd.hc2vpp.srv6.util.function.LocalSidFunctionWriteBindingRegistryProvider;
+import io.fd.hc2vpp.srv6.write.Srv6WriterFactory;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Srv6Module extends AbstractModule {
+
+ private static final Logger LOG = LoggerFactory.getLogger(Srv6Module.class);
+
+ @Override
+ protected void configure() {
+ LOG.info("Installing SRv6 module");
+ LOG.info("Reading SRv6 configuration");
+ requestInjection(Srv6Configuration.class);
+
+ bind(LocalSidFunctionWriteBindingRegistry.class).toProvider(LocalSidFunctionWriteBindingRegistryProvider.class)
+ .in(Singleton.class);
+
+ LOG.info("Injecting SRv6 writers");
+ final Multibinder<WriterFactory> writeBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
+ writeBinder.addBinding().to(Srv6WriterFactory.class);
+
+ LOG.info("SRv6 module successfully configured");
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/JVppRequest.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/JVppRequest.java
new file mode 100644
index 000000000..9ea9fff30
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/JVppRequest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util;
+
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
+import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+
+public abstract class JVppRequest implements AddressTranslator, JvppReplyConsumer {
+
+ private final FutureJVppCore api;
+
+ protected JVppRequest(final FutureJVppCore api) {
+ this.api = api;
+ }
+
+ protected FutureJVppCore getApi() {
+ return api;
+ }
+
+ public void checkValid() {
+ //noop
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBinder.java
new file mode 100644
index 000000000..e51ee5ac5
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBinder.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function;
+
+import io.fd.hc2vpp.srv6.write.sid.request.LocalSidFunctionRequest;
+import io.fd.honeycomb.translate.write.WriteContext;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+
+/**
+ * Binder interface, which is used to map yang model data classes of local sid functions to local sid function requests
+ * used to configure endpoint functions on VPP. It uses behavior function type integer value defined by VPP API, to find
+ * suitable binder. This value is translated to {@link Srv6EndpointType} in model, which represents the same endpoint
+ * function as defined by VPP API.
+ *
+ * @param <T> Type which extends general interface for {@link LocalSidFunctionRequest} and represents template binder
+ * that is used to process end function data represented by provided class type.
+ */
+public interface LocalSidFunctionBinder<T extends LocalSidFunctionRequest> {
+
+ /**
+ * Binds request accordingly to type of function implemented by this interface
+ *
+ * @return request with all attributes necessary for this function
+ */
+ @Nonnull
+ T createWriteRequestAndBind(@Nonnull final Sid data, @Nonnull final WriteContext ctx);
+
+ /**
+ * Provides Endpoint function type class.
+ * @return Endpoint function class
+ */
+ @Nonnull
+ Class<? extends Srv6EndpointType> getHandledFunctionType();
+
+ /**
+ * Provide behavior function type integer value.
+ *
+ * @return integer value of behaviour function type as defined in VPP api
+ */
+ int getBehaviourFunctionType();
+
+ /**
+ * Checks whether binder can handle provided data
+ *
+ * @param data sid function data to be checked
+ * @return true if function binder is able to process provided data, false otherwise
+ */
+ default boolean canHandle(final Sid data) {
+ if (data == null || data.getEndBehaviorType() == null) {
+ return false;
+ }
+ return data.getEndBehaviorType().equals(getHandledFunctionType());
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBindingRegistry.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBindingRegistry.java
new file mode 100644
index 000000000..d56656fb9
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBindingRegistry.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import io.fd.hc2vpp.srv6.write.sid.request.LocalSidFunctionRequest;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Nonnull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+abstract class LocalSidFunctionBindingRegistry<T extends LocalSidFunctionRequest> {
+
+ private static final Logger LOG = LoggerFactory.getLogger(LocalSidFunctionBindingRegistry.class);
+ final List<LocalSidFunctionBinder<T>> binders;
+
+ LocalSidFunctionBindingRegistry() {
+ binders = new ArrayList<>();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void registerFunctionType(@Nonnull final LocalSidFunctionBinder binder) {
+ checkNotNull(binder, "Cannot register null binder");
+ if (!isFunctionRegistered(binder)) {
+ binders.add(binder);
+ } else {
+ LOG.warn("Binder for class already registered. Canceling registration for {}.", binder);
+ }
+ }
+
+ private boolean isFunctionRegistered(@Nonnull final LocalSidFunctionBinder binder) {
+ return binders.stream().parallel().anyMatch(locBinder -> locBinder.getClass().equals(binder.getClass()));
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionWriteBindingRegistry.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionWriteBindingRegistry.java
new file mode 100644
index 000000000..b74a7668b
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionWriteBindingRegistry.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function;
+
+import io.fd.hc2vpp.srv6.write.sid.request.LocalSidFunctionRequest;
+import io.fd.honeycomb.translate.util.RWUtils;
+import io.fd.honeycomb.translate.write.WriteContext;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+
+public class LocalSidFunctionWriteBindingRegistry<T extends LocalSidFunctionRequest>
+ extends LocalSidFunctionBindingRegistry<T> {
+
+ public LocalSidFunctionRequest bind(final Sid localSid, @Nonnull final WriteContext ctx) {
+ return binders.parallelStream()
+ .filter(toLocalSidFunctionBinder -> toLocalSidFunctionBinder.canHandle(localSid))
+ .map(binder -> binder.createWriteRequestAndBind(localSid, ctx))
+ .collect(RWUtils.singleItemCollector());
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionWriteBindingRegistryProvider.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionWriteBindingRegistryProvider.java
new file mode 100644
index 000000000..20189b702
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionWriteBindingRegistryProvider.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.srv6.util.function.lookup.EndDT4FunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.lookup.EndDT6FunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.lookup.EndTFunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.nofunction.EndFunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.xconnect.EndDX2FunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.xconnect.EndDX4FunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.xconnect.EndDX6FunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.xconnect.EndXFunctionBinder;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.inject.Named;
+
+public class LocalSidFunctionWriteBindingRegistryProvider implements Provider<LocalSidFunctionWriteBindingRegistry> {
+
+ @Inject
+ @Named("interface-context")
+ private NamingContext interfaceContext;
+
+ @Inject
+ private FutureJVppCore api;
+ private final LocalSidFunctionWriteBindingRegistry registry = new LocalSidFunctionWriteBindingRegistry();
+
+ @Override
+ public LocalSidFunctionWriteBindingRegistry get() {
+ registry.registerFunctionType(new EndFunctionBinder(api));
+ registry.registerFunctionType(new EndTFunctionBinder(api));
+ registry.registerFunctionType(new EndDT4FunctionBinder(api));
+ registry.registerFunctionType(new EndDT6FunctionBinder(api));
+ registry.registerFunctionType(new EndXFunctionBinder(api, interfaceContext));
+ registry.registerFunctionType(new EndDX2FunctionBinder(api, interfaceContext));
+ registry.registerFunctionType(new EndDX4FunctionBinder(api, interfaceContext));
+ registry.registerFunctionType(new EndDX6FunctionBinder(api, interfaceContext));
+
+ return registry;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndDT4FunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndDT4FunctionBinder.java
new file mode 100644
index 000000000..e8ea22419
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndDT4FunctionBinder.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function.lookup;
+
+import com.google.common.base.Preconditions;
+import io.fd.hc2vpp.srv6.write.sid.request.TableLookupLocalSidRequest;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDT4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+
+public class EndDT4FunctionBinder extends TableLookupFunctionBinder {
+
+ public EndDT4FunctionBinder(@Nonnull final FutureJVppCore api) {
+ super(api);
+ }
+
+ @Nonnull
+ @Override
+ public TableLookupLocalSidRequest createWriteRequestAndBind(@Nonnull Sid data,
+ @Nonnull WriteContext ctx) {
+ Preconditions.checkNotNull(data.getEndDt4(), "EndDt4 data cannot be null.");
+ Preconditions.checkNotNull(data.getEndDt4().getLookupTableIpv4(), "EndDt4 lookup table cannot be null.");
+ int lookupTable = data.getEndDt4().getLookupTableIpv4().getValue().intValue();
+ return bindData(new TableLookupLocalSidRequest(getFutureJVpp()), lookupTable, false, ctx);
+ }
+
+ @Override
+ @Nonnull
+ public Class<? extends Srv6EndpointType> getHandledFunctionType() {
+ return EndDT4.class;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndDT6FunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndDT6FunctionBinder.java
new file mode 100644
index 000000000..01e6c6bb2
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndDT6FunctionBinder.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function.lookup;
+
+import com.google.common.base.Preconditions;
+import io.fd.hc2vpp.srv6.write.sid.request.TableLookupLocalSidRequest;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDT6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+
+public class EndDT6FunctionBinder extends TableLookupFunctionBinder {
+
+ public EndDT6FunctionBinder(@Nonnull final FutureJVppCore api) {
+ super(api);
+ }
+
+ @Nonnull
+ @Override
+ public TableLookupLocalSidRequest createWriteRequestAndBind(@Nonnull Sid data,
+ @Nonnull WriteContext ctx) {
+ Preconditions.checkNotNull(data.getEndDt6(), "EndDt6 data cannot be null.");
+ Preconditions.checkNotNull(data.getEndDt6().getLookupTableIpv6(), "EndDt6 lookup table cannot be null.");
+ int lookupTable = data.getEndDt6().getLookupTableIpv6().getValue().intValue();
+ return bindData(new TableLookupLocalSidRequest(getFutureJVpp()), lookupTable, true, ctx);
+ }
+
+ @Override
+ @Nonnull
+ public Class<? extends Srv6EndpointType> getHandledFunctionType() {
+ return EndDT6.class;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndTFunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndTFunctionBinder.java
new file mode 100644
index 000000000..13a2d3bc7
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/EndTFunctionBinder.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function.lookup;
+
+import com.google.common.base.Preconditions;
+import io.fd.hc2vpp.srv6.write.sid.request.TableLookupLocalSidRequest;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+
+public class EndTFunctionBinder extends TableLookupFunctionBinder {
+
+ public EndTFunctionBinder(@Nonnull FutureJVppCore api) {
+ super(api);
+ }
+
+ @Nonnull
+ @Override
+ public TableLookupLocalSidRequest createWriteRequestAndBind(@Nonnull Sid data, @Nonnull WriteContext ctx) {
+ Preconditions.checkNotNull(data.getEndT(), "EndT data cannot be null.");
+ Preconditions.checkNotNull(data.getEndT().getLookupTableIpv6(), "EndT lookup table cannot be null.");
+ int lookupTable = data.getEndT().getLookupTableIpv6().getValue().intValue();
+ return bindData(new TableLookupLocalSidRequest(getFutureJVpp()), lookupTable, true, ctx);
+ }
+
+ @Override
+ @Nonnull
+ public Class<? extends Srv6EndpointType> getHandledFunctionType() {
+ return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndT.class;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/TableLookupFunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/TableLookupFunctionBinder.java
new file mode 100644
index 000000000..8e6ab4f40
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/lookup/TableLookupFunctionBinder.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function.lookup;
+
+import static com.google.common.base.Preconditions.checkState;
+
+import com.google.common.collect.ImmutableMap;
+import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
+import io.fd.hc2vpp.fib.management.FibManagementIIds;
+import io.fd.hc2vpp.srv6.util.function.LocalSidFunctionBinder;
+import io.fd.hc2vpp.srv6.write.sid.request.TableLookupLocalSidRequest;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.Map;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDT4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDT6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndT;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.AddressFamilyIdentity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.VniReference;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.vpp.fib.table.management.fib.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.vpp.fib.table.management.fib.tables.TableKey;
+import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+
+abstract class TableLookupFunctionBinder extends FutureJVppCustomizer
+ implements LocalSidFunctionBinder<TableLookupLocalSidRequest> {
+
+ private static final Map<Class<? extends Srv6EndpointType>, Integer> REGISTER = ImmutableMap.of(
+ EndT.class, 3,
+ EndDT6.class, 8,
+ EndDT4.class, 9
+ );
+
+ TableLookupFunctionBinder(@Nonnull final FutureJVppCore api) {
+ super(api);
+ checkState(REGISTER.containsKey(getHandledFunctionType()),
+ "Unsupported type of Local SID function %s", getHandledFunctionType());
+ }
+
+ TableLookupLocalSidRequest bindData(TableLookupLocalSidRequest request, int tableIndex, final boolean isIpv6,
+ WriteContext ctx) {
+ // verify if the lookup table exists
+ Class<? extends AddressFamilyIdentity> adrFamily = isIpv6 ? Ipv6.class : Ipv4.class;
+ TableKey tableKey = new TableKey(adrFamily, new VniReference(Integer.toUnsignedLong(tableIndex)));
+ KeyedInstanceIdentifier<Table, TableKey> vrfIid = FibManagementIIds.FM_FIB_TABLES.child(Table.class, tableKey);
+ if (!ctx.readAfter(vrfIid).isPresent()) {
+ throw new IllegalArgumentException(
+ String.format("VRF lookup table: %s not found. Binding failed for request: %s", tableKey, request));
+ }
+ request.setLookupFibTable(tableIndex);
+ request.setFunction(getBehaviourFunctionType());
+ return request;
+ }
+
+ @Override
+ public int getBehaviourFunctionType() {
+ return REGISTER.get(getHandledFunctionType());
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/nofunction/EndFunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/nofunction/EndFunctionBinder.java
new file mode 100644
index 000000000..a1952e3c4
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/nofunction/EndFunctionBinder.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function.nofunction;
+
+import com.google.common.base.Preconditions;
+import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
+import io.fd.hc2vpp.srv6.util.function.LocalSidFunctionBinder;
+import io.fd.hc2vpp.srv6.write.sid.request.NoProtocolLocalSidRequest;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+
+public class EndFunctionBinder extends FutureJVppCustomizer implements
+ LocalSidFunctionBinder<NoProtocolLocalSidRequest> {
+
+ private static final int END_FUNCTION_VALUE = 1;
+
+ public EndFunctionBinder(@Nonnull FutureJVppCore futureJVppCore) {
+ super(futureJVppCore);
+ }
+
+ @Nonnull
+ @Override
+ public NoProtocolLocalSidRequest createWriteRequestAndBind(@Nonnull Sid data,
+ @Nonnull WriteContext ctx) {
+ Preconditions.checkNotNull(data.getEnd(), "End data cannot be null.");
+ NoProtocolLocalSidRequest request = new NoProtocolLocalSidRequest(getFutureJVpp());
+ request.setFunction(END_FUNCTION_VALUE);
+ return request;
+ }
+
+ @Nonnull
+ @Override
+ public Class<? extends Srv6EndpointType> getHandledFunctionType() {
+ return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.End.class;
+ }
+
+ @Override
+ public int getBehaviourFunctionType() {
+ return END_FUNCTION_VALUE;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX2FunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX2FunctionBinder.java
new file mode 100644
index 000000000..63de40b9c
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX2FunctionBinder.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function.xconnect;
+
+import com.google.common.base.Preconditions;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.srv6.write.sid.request.XConnectLocalSidRequest;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDX2;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+
+public class EndDX2FunctionBinder extends XConnectFunctionBinder {
+
+ public EndDX2FunctionBinder(@Nonnull final FutureJVppCore api, @Nonnull final NamingContext interfaceContext) {
+ super(api, interfaceContext);
+ }
+
+ @Nonnull
+ @Override
+ public XConnectLocalSidRequest createWriteRequestAndBind(@Nonnull Sid data,
+ @Nonnull WriteContext ctx) {
+ Preconditions.checkNotNull(data.getEndDx2(), "EndDx2 data cannot be null.");
+ Preconditions.checkNotNull(data.getEndDx2().getPaths(), "EndDx2 paths cannot be null.");
+ Preconditions.checkNotNull(data.getEndDx2().getPaths().getInterface(), "EndDx2 Interface cannot be null.");
+ XConnectLocalSidRequest request = new XConnectLocalSidRequest(getFutureJVpp());
+ String outInterface = data.getEndDx2().getPaths().getInterface();
+ Preconditions.checkArgument(outInterface != null && !outInterface.isEmpty(),
+ "Failed to map data: {} for request: {}", data, request);
+ request.setOutgoingInterfaceIndex(getInterfaceIndex(ctx.getMappingContext(), outInterface));
+ request.setFunction(getBehaviourFunctionType());
+ return request;
+ }
+
+ @Nonnull
+ @Override
+ public Class<? extends Srv6EndpointType> getHandledFunctionType() {
+ return EndDX2.class;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX4FunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX4FunctionBinder.java
new file mode 100644
index 000000000..51abc9876
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX4FunctionBinder.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function.xconnect;
+
+import com.google.common.base.Preconditions;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.srv6.write.sid.request.XConnectLocalSidRequest;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.Optional;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v4.paths.Path;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDX4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+
+public class EndDX4FunctionBinder extends XConnectFunctionBinder {
+
+ public EndDX4FunctionBinder(@Nonnull FutureJVppCore api, @Nonnull NamingContext interfaceContext) {
+ super(api, interfaceContext);
+ }
+
+ @Nonnull
+ @Override
+ public XConnectLocalSidRequest createWriteRequestAndBind(@Nonnull Sid data, @Nonnull WriteContext ctx) {
+ XConnectLocalSidRequest request = new XConnectLocalSidRequest(getFutureJVpp());
+ Preconditions.checkNotNull(data.getEndDx4(), "EndDx4 data cannot be null.");
+ Preconditions.checkNotNull(data.getEndDx4().getPaths(), "EndDx4 paths cannot be null.");
+ Preconditions.checkNotNull(data.getEndDx4().getPaths().getPath(), "EndDx4 list of paths cannot be null.");
+ Optional<Path> firstPathOptional = data.getEndDx4().getPaths().getPath().stream().findFirst();
+ Preconditions
+ .checkArgument(firstPathOptional.isPresent(), "Failed to map data: {} for request: {}", data, request);
+ request.setOutgoingInterfaceIndex(
+ getInterfaceIndex(ctx.getMappingContext(), firstPathOptional.get().getInterface()));
+ request.setNextHopAddress(new IpAddress(firstPathOptional.get().getNextHop()));
+ request.setFunction(getBehaviourFunctionType());
+ return request;
+ }
+
+ @Nonnull
+ @Override
+ public Class<? extends Srv6EndpointType> getHandledFunctionType() {
+ return EndDX4.class;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX6FunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX6FunctionBinder.java
new file mode 100644
index 000000000..71194fbd4
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndDX6FunctionBinder.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function.xconnect;
+
+import com.google.common.base.Preconditions;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.srv6.write.sid.request.XConnectLocalSidRequest;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.Optional;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v6.paths.Path;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDX6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+
+public class EndDX6FunctionBinder extends XConnectFunctionBinder {
+
+ public EndDX6FunctionBinder(@Nonnull FutureJVppCore api, @Nonnull NamingContext interfaceContext) {
+ super(api, interfaceContext);
+ }
+
+ @Nonnull
+ @Override
+ public XConnectLocalSidRequest createWriteRequestAndBind(@Nonnull Sid data, @Nonnull WriteContext ctx) {
+ XConnectLocalSidRequest request = new XConnectLocalSidRequest(getFutureJVpp());
+ Preconditions.checkNotNull(data.getEndDx6(), "EndDx6 data cannot be null.");
+ Preconditions.checkNotNull(data.getEndDx6().getPaths(), "EndDx6 paths cannot be null.");
+ Preconditions.checkNotNull(data.getEndDx6().getPaths().getPath(), "EndDx6 list of paths cannot be null.");
+ Optional<Path> firstPathOptional = data.getEndDx6().getPaths().getPath().stream().findFirst();
+ Preconditions
+ .checkArgument(firstPathOptional.isPresent(), "Failed to map data: {} for request: {}", data, request);
+ request.setOutgoingInterfaceIndex(
+ getInterfaceIndex(ctx.getMappingContext(), firstPathOptional.get().getInterface()));
+ request.setNextHopAddress(new IpAddress(firstPathOptional.get().getNextHop()));
+ request.setFunction(getBehaviourFunctionType());
+ return request;
+ }
+
+ @Nonnull
+ @Override
+ public Class<? extends Srv6EndpointType> getHandledFunctionType() {
+ return EndDX6.class;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndXFunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndXFunctionBinder.java
new file mode 100644
index 000000000..0b3af395c
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/EndXFunctionBinder.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function.xconnect;
+
+import com.google.common.base.Preconditions;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.srv6.write.sid.request.XConnectLocalSidRequest;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.Optional;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v6.paths.Path;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+
+public class EndXFunctionBinder extends XConnectFunctionBinder {
+
+ public EndXFunctionBinder(@Nonnull FutureJVppCore api, @Nonnull NamingContext interfaceContext) {
+ super(api, interfaceContext);
+ }
+
+ @Nonnull
+ @Override
+ public XConnectLocalSidRequest createWriteRequestAndBind(@Nonnull Sid data,
+ @Nonnull WriteContext ctx) {
+ XConnectLocalSidRequest request = new XConnectLocalSidRequest(getFutureJVpp());
+ Preconditions.checkNotNull(data.getEndX(), "EndX data cannot be null.");
+ Preconditions.checkNotNull(data.getEndX().getPaths(), "EndX paths cannot be null.");
+ Preconditions.checkNotNull(data.getEndX().getPaths().getPath(), "EndX list of paths cannot be null.");
+ Optional<Path> firstPathOptional = data.getEndX().getPaths().getPath().stream().findFirst();
+ Preconditions
+ .checkArgument(firstPathOptional.isPresent(), "Failed to map data: {} for request: {}", data, request);
+
+ request.setOutgoingInterfaceIndex(
+ getInterfaceIndex(ctx.getMappingContext(), firstPathOptional.get().getInterface()));
+ request.setNextHopAddress(new IpAddress(firstPathOptional.get().getNextHop()));
+ request.setFunction(getBehaviourFunctionType());
+ return request;
+ }
+
+ @Nonnull
+ @Override
+ public Class<? extends Srv6EndpointType> getHandledFunctionType() {
+ return org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndX.class;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/XConnectFunctionBinder.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/XConnectFunctionBinder.java
new file mode 100644
index 000000000..9f69c9041
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/util/function/xconnect/XConnectFunctionBinder.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function.xconnect;
+
+import static com.google.common.base.Preconditions.checkState;
+import static java.lang.String.format;
+
+import com.google.common.collect.ImmutableMap;
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
+import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.srv6.util.function.LocalSidFunctionBinder;
+import io.fd.hc2vpp.srv6.write.sid.request.XConnectLocalSidRequest;
+import io.fd.honeycomb.translate.MappingContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.Map;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDX2;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDX4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDX6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndX;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6EndpointType;
+
+abstract class XConnectFunctionBinder extends FutureJVppCustomizer
+ implements LocalSidFunctionBinder<XConnectLocalSidRequest>, AddressTranslator {
+
+ private static final Map<Class<? extends Srv6EndpointType>, Integer>
+ REGISTER = ImmutableMap.of(EndX.class, 2,
+ EndDX2.class, 5,
+ EndDX4.class, 7,
+ EndDX6.class, 6);
+
+ private final NamingContext interfaceContext;
+
+ XConnectFunctionBinder(@Nonnull final FutureJVppCore api, @Nonnull final NamingContext interfaceContext) {
+ super(api);
+ this.interfaceContext = interfaceContext;
+ checkState(REGISTER.containsKey(getHandledFunctionType()), "Unsupported type of Local SID function %s",
+ getHandledFunctionType());
+ }
+
+ @Override
+ public int getBehaviourFunctionType() {
+ return REGISTER.get(getHandledFunctionType());
+ }
+
+ int getInterfaceIndex(final MappingContext ctx, final String name) {
+ return interfaceContext.getIndex(name, ctx, () -> new IllegalArgumentException(
+ format("Interface with name %s not found", name)));
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/DeleteRequest.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/DeleteRequest.java
new file mode 100644
index 000000000..bd48e25df
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/DeleteRequest.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write;
+
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public interface DeleteRequest {
+
+ void delete(final InstanceIdentifier<?> identifier) throws WriteFailedException;
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/Srv6Customizer.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/Srv6Customizer.java
new file mode 100644
index 000000000..a9cb8405d
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/Srv6Customizer.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+
+package io.fd.hc2vpp.srv6.write;
+
+import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.routing.Srv6;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Srv6Customizer implements WriterCustomizer<Srv6> {
+ private static final Logger LOG = LoggerFactory.getLogger(Srv6Customizer.class);
+
+ @Override
+ public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Srv6> instanceIdentifier,
+ @Nonnull final Srv6 srv6,
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
+ LOG.debug("Writing SRV6 configuration is not supported by VPP. SRV6 is always enabled");
+ throw new WriteFailedException.CreateFailedException(instanceIdentifier, srv6,
+ new UnsupportedOperationException("Changing SRV6 configuration is not supported by VPP."));
+ }
+
+ @Override
+ public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Srv6> instanceIdentifier,
+ @Nonnull final Srv6 srv6,
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
+ LOG.debug("Deleting SRV6 configuration is not supported by VPP. SRV6 is always enabled");
+ throw new WriteFailedException.DeleteFailedException(instanceIdentifier,
+ new UnsupportedOperationException("Changing SRV6 configuration is not supported by VPP."));
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/Srv6WriterFactory.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/Srv6WriterFactory.java
new file mode 100644
index 000000000..5dea50f48
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/Srv6WriterFactory.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Inject;
+import io.fd.hc2vpp.srv6.Srv6IIds;
+import io.fd.hc2vpp.srv6.util.function.LocalSidFunctionWriteBindingRegistry;
+import io.fd.hc2vpp.srv6.write.encap.source.EncapsulationSourceCustomizer;
+import io.fd.hc2vpp.srv6.write.sid.LocatorCustomizer;
+import io.fd.hc2vpp.srv6.write.sid.SidCustomizer;
+import io.fd.honeycomb.translate.impl.write.GenericListWriter;
+import io.fd.honeycomb.translate.impl.write.GenericWriter;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+
+public class Srv6WriterFactory implements WriterFactory {
+
+ @Inject
+ private FutureJVppCore futureJVppCore;
+ @Inject
+ private LocalSidFunctionWriteBindingRegistry bindingRegistry;
+
+ @Override
+ public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
+
+ registry.add(new GenericWriter<>(Srv6IIds.RT_SRV6, new Srv6Customizer()));
+
+ registry.subtreeAdd(ImmutableSet.of(Srv6IIds.LOC_PREFIX, Srv6IIds.LOC_FT_AUG, Srv6IIds.LOC_FT),
+ new GenericWriter<>(Srv6IIds.RT_SRV6_LOCS_LOCATOR, new LocatorCustomizer(futureJVppCore)));
+
+ registry.add(new GenericWriter<>(Srv6IIds.RT_SRV6_ENCAP, new EncapsulationSourceCustomizer(futureJVppCore)));
+
+ registry.subtreeAdd(ImmutableSet
+ .of(Srv6IIds.SID_END, Srv6IIds.SID_END_X, Srv6IIds.SID_END_X_PATHS, Srv6IIds.SID_END_X_PATHS_PATH,
+ Srv6IIds.SID_END_T, Srv6IIds.SID_END_B6, Srv6IIds.SID_END_B6ENCAP, Srv6IIds.SID_END_BM,
+ Srv6IIds.SID_END_DT4, Srv6IIds.SID_END_DT6, Srv6IIds.SID_END_DT46, Srv6IIds.SID_END_DX2,
+ Srv6IIds.SID_END_DX4, Srv6IIds.SID_END_DX6, Srv6IIds.SID_END_DX6_PATHS,
+ Srv6IIds.SID_END_DX6_PATHS_PATH, Srv6IIds.SID_END_DX4_PATHS, Srv6IIds.SID_END_DX4_PATHS_PATH,
+ Srv6IIds.SID_END_DX2_PATHS), new GenericListWriter<>(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID,
+ new SidCustomizer(futureJVppCore, bindingRegistry)));
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/UpdateRequest.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/UpdateRequest.java
new file mode 100644
index 000000000..545c1d24f
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/UpdateRequest.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write;
+
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public interface UpdateRequest {
+
+ void update(final InstanceIdentifier<?> identifier) throws WriteFailedException;
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/WriteRequest.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/WriteRequest.java
new file mode 100644
index 000000000..f083c4ab8
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/WriteRequest.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write;
+
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public interface WriteRequest {
+
+ void write(final InstanceIdentifier<?> identifier) throws WriteFailedException;
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/EncapsulationSourceCustomizer.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/EncapsulationSourceCustomizer.java
new file mode 100644
index 000000000..375aad0f9
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/EncapsulationSourceCustomizer.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.encap.source;
+
+import com.google.common.annotations.VisibleForTesting;
+import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
+import io.fd.hc2vpp.srv6.write.encap.source.request.EncapsulationSourceDeleteRequest;
+import io.fd.hc2vpp.srv6.write.encap.source.request.EncapsulationSourceWriteRequest;
+import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.encap.Encapsulation;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class EncapsulationSourceCustomizer extends FutureJVppCustomizer implements WriterCustomizer<Encapsulation> {
+
+ public EncapsulationSourceCustomizer(@Nonnull FutureJVppCore futureJVppCore) {
+ super(futureJVppCore);
+ }
+
+ @Override
+ public void writeCurrentAttributes(@Nonnull InstanceIdentifier<Encapsulation> instanceIdentifier,
+ @Nonnull Encapsulation encapsulation, @Nonnull WriteContext writeContext)
+ throws WriteFailedException {
+ bindEncapsulationSourceWriteRequest(encapsulation).write(instanceIdentifier);
+
+ }
+
+ private EncapsulationSourceWriteRequest bindEncapsulationSourceWriteRequest(Encapsulation encapsulation) {
+ return new EncapsulationSourceWriteRequest(getFutureJVpp()).setBsid(encapsulation.getSourceAddress());
+ }
+
+ @Override
+ public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<Encapsulation> instanceIdentifier,
+ @Nonnull Encapsulation encapsulation, @Nonnull WriteContext writeContext)
+ throws WriteFailedException {
+ bindEncapsulationSourceDeleteRequest().delete(instanceIdentifier);
+ }
+
+ @VisibleForTesting
+ private EncapsulationSourceDeleteRequest bindEncapsulationSourceDeleteRequest() {
+ return new EncapsulationSourceDeleteRequest(getFutureJVpp());
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceDeleteRequest.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceDeleteRequest.java
new file mode 100644
index 000000000..e8877a956
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceDeleteRequest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.encap.source.request;
+
+import io.fd.hc2vpp.srv6.util.JVppRequest;
+import io.fd.hc2vpp.srv6.write.DeleteRequest;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SrSetEncapSource;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class EncapsulationSourceDeleteRequest extends JVppRequest implements DeleteRequest {
+
+ public EncapsulationSourceDeleteRequest(final FutureJVppCore api) {
+ super(api);
+ }
+
+ @Override
+ public void delete(InstanceIdentifier<?> identifier) throws WriteFailedException {
+ checkValid();
+ final SrSetEncapSource request = new SrSetEncapSource();
+ request.encapsSource = null;
+ getReplyForDelete(getApi().srSetEncapSource(request).toCompletableFuture(), identifier);
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceWriteRequest.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceWriteRequest.java
new file mode 100644
index 000000000..0ecf13108
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceWriteRequest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.encap.source.request;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import io.fd.hc2vpp.srv6.util.JVppRequest;
+import io.fd.hc2vpp.srv6.write.WriteRequest;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SrSetEncapSource;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class EncapsulationSourceWriteRequest extends JVppRequest implements WriteRequest {
+
+ private Ipv6Address bsid;
+
+ public EncapsulationSourceWriteRequest(final FutureJVppCore api) {
+ super(api);
+ }
+
+ @Override
+ public void checkValid() {
+ checkNotNull(bsid, "Binding SID must be set");
+ }
+
+ public Ipv6Address getBsid() {
+ return bsid;
+ }
+
+ public EncapsulationSourceWriteRequest setBsid(final Ipv6Address bsid) {
+ this.bsid = bsid;
+ return this;
+ }
+
+ @Override
+ public void write(final InstanceIdentifier<?> identifier) throws WriteFailedException {
+ checkValid();
+ final SrSetEncapSource request = new SrSetEncapSource();
+ request.encapsSource = ipv6AddressNoZoneToArray(bsid);
+ getReplyForWrite(getApi().srSetEncapSource(request).toCompletableFuture(), identifier);
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/LocatorCustomizer.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/LocatorCustomizer.java
new file mode 100644
index 000000000..86ab3599c
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/LocatorCustomizer.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid;
+
+import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.Locator;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.LocatorKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class LocatorCustomizer extends FutureJVppCustomizer implements ListWriterCustomizer<Locator, LocatorKey> {
+
+ public LocatorCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
+ super(futureJVppCore);
+ }
+
+ @Override
+ public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Locator> instanceIdentifier,
+ @Nonnull final Locator locator, @Nonnull final WriteContext writeContext) {
+ // noop
+ }
+
+ @Override
+ public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Locator> instanceIdentifier,
+ @Nonnull final Locator locator, @Nonnull final WriteContext writeContext) {
+ // noop
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/SidCustomizer.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/SidCustomizer.java
new file mode 100644
index 000000000..c63205699
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/SidCustomizer.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.googlecode.ipv6.IPv6NetworkMask;
+import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
+import io.fd.hc2vpp.fib.management.FibManagementIIds;
+import io.fd.hc2vpp.srv6.util.function.LocalSidFunctionWriteBindingRegistry;
+import io.fd.hc2vpp.srv6.write.sid.request.LocalSidFunctionRequest;
+import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
+import io.fd.honeycomb.translate.util.RWUtils;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.hc2vpp.params.xml.ns.yang.vpp.ietf.srv6.base.rev180613.VppSrv6FibLocatorAugment;
+import org.opendaylight.yang.gen.v1.urn.hc2vpp.params.xml.ns.yang.vpp.ietf.srv6.base.rev180613.vpp.srv6.fib.FibTable;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.SidKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.Locator;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.locator.Prefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.vpp.fib.table.management.fib.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.vpp.fib.table.management.fib.tables.TableKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+
+public class SidCustomizer extends FutureJVppCustomizer implements ListWriterCustomizer<Sid, SidKey> {
+
+ private final LocalSidFunctionWriteBindingRegistry bindingRegistry;
+
+ public SidCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
+ @Nonnull final LocalSidFunctionWriteBindingRegistry bindingRegistry) {
+ super(futureJVppCore);
+ this.bindingRegistry = bindingRegistry;
+ }
+
+ Ipv6Address resolveSidAddress(@Nonnull final Prefix locPrefix, @Nonnull Sid localSid) {
+ com.googlecode.ipv6.IPv6Address ip =
+ com.googlecode.ipv6.IPv6Address.fromString(locPrefix.getAddress().getValue());
+ IPv6NetworkMask mask = IPv6NetworkMask.fromPrefixLength(locPrefix.getLength().getValue());
+ // strip function part if present
+ ip = ip.maskWithNetworkMask(mask);
+ //add new function part based on opcode
+ String locIp = ip.add(localSid.getOpcode().getValue().intValue()).toString();
+ return new Ipv6Address(locIp);
+ }
+
+ @Override
+ public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Sid> instanceIdentifier,
+ @Nonnull final Sid localSid, @Nonnull final WriteContext writeContext)
+ throws WriteFailedException {
+ InstanceIdentifier<Locator> locatorIid = RWUtils.cutId(instanceIdentifier, Locator.class);
+ Optional<Locator> locatorOpt = writeContext.readAfter(locatorIid);
+ Table vrfTable = getVrfTable(instanceIdentifier, writeContext, locatorIid, locatorOpt);
+ LocalSidFunctionRequest request = bindRequest(extractLocPrefix(instanceIdentifier, locatorOpt, localSid),
+ localSid, vrfTable.getTableId().getValue().intValue(), writeContext);
+ if (request == null) {
+ throw new WriteFailedException(instanceIdentifier,
+ String.format("Cannot create write request for %s", localSid));
+ }
+ request.write(instanceIdentifier);
+ }
+
+ private Table getVrfTable(final @Nonnull InstanceIdentifier<Sid> iid, final @Nonnull WriteContext writeContext,
+ final InstanceIdentifier<Locator> locatorIid, final Optional<Locator> locatorOpt) {
+ Preconditions.checkArgument(locatorOpt.isPresent(), "Locator: {} for SID: {} was not found.", locatorIid, iid);
+ Preconditions.checkNotNull(locatorOpt.get().getAugmentation(VppSrv6FibLocatorAugment.class),
+ "Vpp FIB table augmentation was not found for SID: {}.", iid);
+ FibTable fibTable = locatorOpt.get().getAugmentation(VppSrv6FibLocatorAugment.class).getFibTable();
+ Preconditions.checkNotNull(fibTable, "Vpp FIB table configuration was not found for SID: {}.", iid);
+ TableKey tableKey = new TableKey(fibTable.getAddressFamily(), fibTable.getTableId());
+ KeyedInstanceIdentifier<Table, TableKey> vrfIid = FibManagementIIds.FM_FIB_TABLES.child(Table.class, tableKey);
+ if (!writeContext.readAfter(vrfIid).isPresent()) {
+ throw new IllegalArgumentException(
+ String.format("VRF table: %s not found. Create table before writing SID : %s.", tableKey, iid));
+ }
+ return writeContext.readAfter(vrfIid).get();
+ }
+
+ private Prefix extractLocPrefix(final @Nonnull InstanceIdentifier<Sid> instanceIdentifier,
+ Optional<Locator> locatorOpt, final @Nonnull Sid localSid)
+ throws WriteFailedException {
+ Preconditions.checkArgument(locatorOpt.isPresent(), "Cannot read locator for sid: {}, with IId: ", localSid,
+ instanceIdentifier);
+ Locator loc = locatorOpt.get();
+ if (loc.getPrefix() == null || loc.getPrefix() == null || loc.getPrefix().getAddress() == null ||
+ loc.getPrefix().getLength() == null) {
+ throw new WriteFailedException(instanceIdentifier,
+ String.format("Cannot parse locator prefix for local sid %s", localSid));
+ }
+ return loc.getPrefix();
+ }
+
+ @Override
+ public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Sid> instanceIdentifier,
+ @Nonnull final Sid localSid, @Nonnull final WriteContext writeContext)
+ throws WriteFailedException {
+ InstanceIdentifier<Locator> locatorIid = RWUtils.cutId(instanceIdentifier, Locator.class);
+ Optional<Locator> locatorOpt = writeContext.readBefore(locatorIid);
+ Table vrfTable = getVrfTable(instanceIdentifier, writeContext, locatorIid, locatorOpt);
+ LocalSidFunctionRequest request = bindRequest(extractLocPrefix(instanceIdentifier, locatorOpt, localSid),
+ localSid, vrfTable.getTableId().getValue().intValue(), writeContext);
+
+ if (request == null) {
+ throw new WriteFailedException(instanceIdentifier,
+ String.format("Cannot create delete request for %s", localSid));
+ }
+ request.delete(instanceIdentifier);
+ }
+
+ private LocalSidFunctionRequest bindRequest(final @Nonnull Prefix locPrefix, final @Nonnull Sid localSid,
+ final int installFibId, final @Nonnull WriteContext writeContext) {
+ LocalSidFunctionRequest request = bindingRegistry.bind(localSid, writeContext);
+ Ipv6Address sidAddress = resolveSidAddress(locPrefix, localSid);
+ request.setLocalSidAddress(sidAddress);
+ request.setInstallFibTable(installFibId);
+ return request;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/LocalSidFunctionRequest.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/LocalSidFunctionRequest.java
new file mode 100644
index 000000000..e3d64ea6c
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/LocalSidFunctionRequest.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid.request;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
+import io.fd.hc2vpp.srv6.util.JVppRequest;
+import io.fd.hc2vpp.srv6.write.DeleteRequest;
+import io.fd.hc2vpp.srv6.write.WriteRequest;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SrLocalsidAddDel;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import io.fd.vpp.jvpp.core.types.Srv6Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.Srv6SidConfig;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * General template for Local SID requests
+ */
+public abstract class LocalSidFunctionRequest<O extends ChildOf<Srv6SidConfig>> extends JVppRequest
+ implements WriteRequest, DeleteRequest {
+
+ /**
+ * Local SID
+ */
+ private Ipv6Address localSidAddress;
+
+ /**
+ * FIB table where Local SID will be installed
+ */
+ private int installFibTable;
+
+ /**
+ * Function that will be used for this Local SID
+ */
+ private int function;
+
+ /**
+ * Whether this node should remove segment routing header for incoming packets
+ */
+ private boolean isPsp;
+
+ LocalSidFunctionRequest(final FutureJVppCore api) {
+ super(api);
+ //Default behaviour is PSP. END,END.T and END.X function can set USP=true -> PSP=false
+ isPsp = true;
+ }
+
+ protected void bindRequest(final SrLocalsidAddDel request) {
+ Srv6Sid srv6Sid = new Srv6Sid();
+ srv6Sid.addr = ipv6AddressNoZoneToArray(getLocalSidAddress());
+ request.localsid = srv6Sid;
+ request.behavior = (byte) getFunction();
+ request.fibTable = getInstallFibTable();
+ request.endPsp = booleanToByte(isPsp());
+ }
+
+ @Override
+ public void checkValid() {
+ checkNotNull(getLocalSidAddress(), "Sid address not set");
+ checkState(getFunction() != 0, "No behavior set");
+ }
+
+ @Override
+ public void write(final InstanceIdentifier<?> identifier) throws WriteFailedException {
+ checkValid();
+
+ final SrLocalsidAddDel request = new SrLocalsidAddDel();
+ request.isDel = 0;
+ bindRequest(request);
+
+ getReplyForWrite(getApi().srLocalsidAddDel(request).toCompletableFuture(), identifier);
+ }
+
+ @Override
+ public void delete(final InstanceIdentifier<?> identifier) throws WriteFailedException {
+ checkValid();
+
+ final SrLocalsidAddDel request = new SrLocalsidAddDel();
+ request.isDel = 1;
+ bindRequest(request);
+ getReplyForDelete(getApi().srLocalsidAddDel(request).toCompletableFuture(), identifier);
+ }
+
+ public Ipv6Address getLocalSidAddress() {
+ return localSidAddress;
+ }
+
+ public void setLocalSidAddress(final Ipv6Address localSidAddress) {
+ this.localSidAddress = localSidAddress;
+ }
+
+ public int getInstallFibTable() {
+ return installFibTable;
+ }
+
+ public void setInstallFibTable(final int installFibTable) {
+ this.installFibTable = installFibTable;
+ }
+
+ public int getFunction() {
+ return function;
+ }
+
+ public void setFunction(final int function) {
+ this.function = function;
+ }
+
+ public boolean isPsp() {
+ return isPsp;
+ }
+
+ public void setPsp(final boolean psp) {
+ isPsp = psp;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/NoProtocolLocalSidRequest.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/NoProtocolLocalSidRequest.java
new file mode 100644
index 000000000..18630ccc2
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/NoProtocolLocalSidRequest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid.request;
+
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+
+/**
+ * Local SID using End function
+ */
+public class NoProtocolLocalSidRequest extends LocalSidFunctionRequest {
+
+ public NoProtocolLocalSidRequest(final FutureJVppCore api) {
+ super(api);
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/TableLookupLocalSidRequest.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/TableLookupLocalSidRequest.java
new file mode 100644
index 000000000..4642b3349
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/TableLookupLocalSidRequest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid.request;
+
+import io.fd.vpp.jvpp.core.dto.SrLocalsidAddDel;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+
+/**
+ * Request for Local SID using table lookup functions
+ */
+public class TableLookupLocalSidRequest extends LocalSidFunctionRequest {
+
+ /**
+ * FIB table where table lookup should be performed
+ */
+ private int lookupFibTable;
+
+ public TableLookupLocalSidRequest(final FutureJVppCore api) {
+ super(api);
+ }
+
+ @Override
+ protected void bindRequest(final SrLocalsidAddDel request) {
+ super.bindRequest(request);
+ request.swIfIndex = getLookupFibTable();
+ }
+
+ public int getLookupFibTable() {
+ return lookupFibTable;
+ }
+
+ public void setLookupFibTable(final int lookupFibTable) {
+ this.lookupFibTable = lookupFibTable;
+ }
+}
diff --git a/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/XConnectLocalSidRequest.java b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/XConnectLocalSidRequest.java
new file mode 100644
index 000000000..38208aaf1
--- /dev/null
+++ b/srv6/srv6-impl/src/main/java/io/fd/hc2vpp/srv6/write/sid/request/XConnectLocalSidRequest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid.request;
+
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
+import io.fd.vpp.jvpp.core.dto.SrLocalsidAddDel;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+
+/**
+ * Request for Local SID that should use x-connect functions
+ */
+public class XConnectLocalSidRequest extends LocalSidFunctionRequest {
+
+ /**
+ * L2 interface that should be use for forwarding traffic
+ */
+ private int outgoingInterfaceIndex;
+
+ /**
+ * Outgoing VLan tag
+ */
+ private int vlanIndex;
+
+ /**
+ * Address of the next hop
+ */
+ private IpAddress nextHopAddress;
+
+ public XConnectLocalSidRequest(final FutureJVppCore api) {
+ super(api);
+ }
+
+ @Override
+ protected void bindRequest(final SrLocalsidAddDel request) {
+ super.bindRequest(request);
+ request.swIfIndex = getOutgoingInterfaceIndex();
+ request.vlanIndex = getVlanIndex();
+ if (getNextHopAddress() != null) {
+ if (AddressTranslator.INSTANCE.isIpv6(getNextHopAddress())) {
+ request.nhAddr6 = ipAddressToArray(getNextHopAddress());
+ } else {
+ request.nhAddr4 = ipAddressToArray(getNextHopAddress());
+
+ }
+
+ }
+ }
+
+ public int getOutgoingInterfaceIndex() {
+ return outgoingInterfaceIndex;
+ }
+
+ public void setOutgoingInterfaceIndex(final int outgoingInterfaceIndex) {
+ this.outgoingInterfaceIndex = outgoingInterfaceIndex;
+ }
+
+ public int getVlanIndex() {
+ return vlanIndex;
+ }
+
+ public void setVlanIndex(final int vlanIndex) {
+ this.vlanIndex = vlanIndex;
+ }
+
+ public IpAddress getNextHopAddress() {
+ return nextHopAddress;
+ }
+
+ public void setNextHopAddress(final IpAddress nextHopAddress) {
+ this.nextHopAddress = nextHopAddress;
+ }
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/Srv6ModuleTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/Srv6ModuleTest.java
new file mode 100644
index 000000000..c465dfbaf
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/Srv6ModuleTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.Matchers.empty;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import com.google.inject.testing.fieldbinder.Bind;
+import com.google.inject.testing.fieldbinder.BoundFieldModule;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.srv6.write.Srv6WriterFactory;
+import io.fd.hc2vpp.vpp.classifier.context.VppClassifierContextManager;
+import io.fd.honeycomb.translate.ModificationCache;
+import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
+import io.fd.honeycomb.translate.util.YangDAG;
+import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
+public class Srv6ModuleTest {
+
+ @Bind
+ @Named("interface-context")
+ private NamingContext interfaceContext;
+
+ @Bind
+ @Mock
+ private FutureJVppCore futureJVppCore;
+
+ @Bind
+ @Mock
+ private ModificationCache modificationCache;
+
+ @Named("honeycomb-context")
+ @Bind
+ @Mock
+ private DataBroker honeycombContext;
+
+ @Named("honeycomb-initializer")
+ @Bind
+ @Mock
+ private DataBroker honeycombInitializer;
+
+ @Named("classify-table-context")
+ @Bind
+ @Mock
+ private VppClassifierContextManager classifierContextManager;
+
+ @Inject
+ private Set<WriterFactory> writerFactories = new HashSet<>();
+
+ @Before
+ public void setUp() {
+ initMocks(this);
+ interfaceContext = new NamingContext("interfaceContext", "interfaceContext");
+ Guice.createInjector(new Srv6Module(), BoundFieldModule.of(this)).injectMembers(this);
+ }
+
+ @Test
+ public void testWriterFactories() {
+ assertThat(writerFactories, is(not(empty())));
+
+ // Test registration process (all dependencies present, topological order of writers does exist, etc.)
+ final FlatWriterRegistryBuilder registryBuilder = new FlatWriterRegistryBuilder(new YangDAG());
+ writerFactories.forEach(factory -> factory.init(registryBuilder));
+ assertNotNull(registryBuilder.build());
+ assertEquals(1, writerFactories.size());
+ assertTrue(writerFactories.iterator().next() instanceof Srv6WriterFactory);
+ }
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/util/JvppRequestTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/util/JvppRequestTest.java
new file mode 100644
index 000000000..0bc3f6b6d
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/util/JvppRequestTest.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Inject;
+import io.fd.hc2vpp.common.test.util.FutureProducer;
+import io.fd.hc2vpp.common.test.util.NamingContextHelper;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.srv6.util.function.LocalSidFunctionWriteBindingRegistry;
+import io.fd.hc2vpp.srv6.util.function.lookup.EndDT4FunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.lookup.EndDT6FunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.lookup.EndTFunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.nofunction.EndFunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.xconnect.EndDX2FunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.xconnect.EndDX4FunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.xconnect.EndDX6FunctionBinder;
+import io.fd.hc2vpp.srv6.util.function.xconnect.EndXFunctionBinder;
+import io.fd.honeycomb.test.tools.HoneycombTestRunner;
+import io.fd.honeycomb.test.tools.annotations.SchemaContextProvider;
+import io.fd.honeycomb.translate.MappingContext;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
+
+@RunWith(HoneycombTestRunner.class)
+public abstract class JvppRequestTest implements FutureProducer, NamingContextHelper {
+ protected static final LocalSidFunctionWriteBindingRegistry WRITE_REGISTRY =
+ new LocalSidFunctionWriteBindingRegistry();
+
+ @Inject
+ @Mock
+ protected static FutureJVppCore api;
+
+ @Mock
+ protected static WriteContext ctx;
+
+ @Mock
+ protected static MappingContext mappingContext;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ NamingContext interfaceContext = new NamingContext("iface", "interface-context");
+
+ EndFunctionBinder endFunctionBinder = new EndFunctionBinder(api);
+ EndTFunctionBinder endTFunctionBinder = new EndTFunctionBinder(api);
+ EndDT4FunctionBinder endDT4FunctionBinder = new EndDT4FunctionBinder(api);
+ EndDT6FunctionBinder endDT6FunctionBinder = new EndDT6FunctionBinder(api);
+ EndXFunctionBinder endXFunctionBinder = new EndXFunctionBinder(api, interfaceContext);
+ EndDX2FunctionBinder endDX2FunctionBinder = new EndDX2FunctionBinder(api, interfaceContext);
+ EndDX4FunctionBinder endDX4FunctionBinder = new EndDX4FunctionBinder(api, interfaceContext);
+ EndDX6FunctionBinder endDX6FunctionBinder = new EndDX6FunctionBinder(api, interfaceContext);
+ WRITE_REGISTRY.registerFunctionType(endFunctionBinder);
+ WRITE_REGISTRY.registerFunctionType(endTFunctionBinder);
+ WRITE_REGISTRY.registerFunctionType(endDT4FunctionBinder);
+ WRITE_REGISTRY.registerFunctionType(endDT6FunctionBinder);
+ WRITE_REGISTRY.registerFunctionType(endXFunctionBinder);
+ WRITE_REGISTRY.registerFunctionType(endDX2FunctionBinder);
+ WRITE_REGISTRY.registerFunctionType(endDX4FunctionBinder);
+ WRITE_REGISTRY.registerFunctionType(endDX6FunctionBinder);
+ init();
+ }
+
+ @SchemaContextProvider
+ public ModuleInfoBackedContext createSchemaContext() {
+ ModuleInfoBackedContext mibContext = ModuleInfoBackedContext.create();
+ mibContext.addModuleInfos(ImmutableSet.of(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.$YangModuleInfoImpl
+ .getInstance(),
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.$YangModuleInfoImpl
+ .getInstance(),
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.$YangModuleInfoImpl
+ .getInstance(),
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.$YangModuleInfoImpl
+ .getInstance(),
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.$YangModuleInfoImpl
+ .getInstance()));
+ return mibContext;
+ }
+
+ protected abstract void init();
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBindingRegistryTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBindingRegistryTest.java
new file mode 100644
index 000000000..66ddf48db
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/util/function/LocalSidFunctionBindingRegistryTest.java
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.util.function;
+
+import static org.mockito.Mockito.when;
+
+import com.google.common.base.Optional;
+import io.fd.hc2vpp.fib.management.FibManagementIIds;
+import io.fd.hc2vpp.srv6.util.JvppRequestTest;
+import io.fd.hc2vpp.srv6.write.sid.request.LocalSidFunctionRequest;
+import io.fd.hc2vpp.srv6.write.sid.request.NoProtocolLocalSidRequest;
+import io.fd.hc2vpp.srv6.write.sid.request.TableLookupLocalSidRequest;
+import io.fd.hc2vpp.srv6.write.sid.request.XConnectLocalSidRequest;
+import io.fd.honeycomb.translate.read.ReadContext;
+import java.util.Collections;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v6.PathsBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v6.paths.PathBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.SidBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.End;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDt4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDt4Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDt6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDt6Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDx2;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDx2Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDx4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDx4Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDx6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndDx6Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndT;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndTBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndX;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.EndXBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.PathAttrsCmn;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDT4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDT6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDX2;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDX4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndDX6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.TableId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.VniReference;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.vpp.fib.table.management.fib.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.vpp.fib.table.management.fib.tables.TableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.vpp.fib.table.management.fib.tables.TableKey;
+
+public class LocalSidFunctionBindingRegistryTest extends JvppRequestTest {
+
+ private static final Ipv6Address A = new Ipv6Address("A::101");
+ private static final Ipv6AddressNoZone A_NO_ZONE = new Ipv6AddressNoZone("a::101");
+ private static final Ipv4Address V4HOP = new Ipv4Address("0.0.1.0");
+ private static final Ipv4AddressNoZone A_V4 = new Ipv4AddressNoZone("10.0.0.1");
+ private static final String LOCAL_0 = "local0";
+ private static final TableId TABLE_ID_4 = new TableId(4L);
+ private static final TableKey TABLE_4_IPV6_KEY = new TableKey(Ipv6.class, new VniReference(TABLE_ID_4.getValue()));
+ private static final TableKey TABLE_4_IPV4_KEY = new TableKey(Ipv4.class, new VniReference(TABLE_ID_4.getValue()));
+
+ @Mock
+ private ReadContext readCtx;
+
+ @Override
+ protected void init() {
+ MockitoAnnotations.initMocks(this);
+ defineMapping(mappingContext, "local0", 1, "interface-context");
+ defineMapping(mappingContext, "vlan0", 2, "interface-context");
+ when(ctx.getMappingContext()).thenReturn(mappingContext);
+ when(readCtx.getMappingContext()).thenReturn(mappingContext);
+ when(ctx.readAfter(FibManagementIIds.FM_FIB_TABLES.child(Table.class, TABLE_4_IPV6_KEY)))
+ .thenReturn(Optional.of(
+ new TableBuilder().setTableId(TABLE_4_IPV6_KEY.getTableId()).setKey(TABLE_4_IPV6_KEY)
+ .setAddressFamily(TABLE_4_IPV6_KEY.getAddressFamily()).build()));
+ when(ctx.readAfter(FibManagementIIds.FM_FIB_TABLES.child(Table.class, TABLE_4_IPV4_KEY)))
+ .thenReturn(Optional.of(
+ new TableBuilder().setTableId(TABLE_4_IPV4_KEY.getTableId()).setKey(TABLE_4_IPV4_KEY)
+ .setAddressFamily(TABLE_4_IPV4_KEY.getAddressFamily()).build()));
+ }
+
+ @Test
+ public void testEnd() {
+ End end = new EndBuilder().build();
+ Sid localSid = new SidBuilder()
+ .setEnd(end)
+ .setEndBehaviorType(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.End.class)
+ .build();
+ LocalSidFunctionRequest request = WRITE_REGISTRY.bind(localSid, ctx);
+ Assert.assertTrue(request instanceof NoProtocolLocalSidRequest);
+ Assert.assertEquals(1, request.getFunction());
+ }
+
+ @Test
+ public void testEndX() {
+ EndX endX = new EndXBuilder()
+ .setPaths(new PathsBuilder().setPath(Collections.singletonList(
+ new PathBuilder().setRole(PathAttrsCmn.Role.PRIMARY)
+ .setWeight(1L)
+ .setPathIndex((short) 1)
+ .setInterface(LOCAL_0)
+ .setNextHop(A)
+ .build())).build())
+ .build();
+ Sid localSid = new SidBuilder()
+ .setEndX(endX)
+ .setEndBehaviorType(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndX.class)
+ .build();
+ LocalSidFunctionRequest request = WRITE_REGISTRY.bind(localSid, ctx);
+ Assert.assertTrue(request instanceof XConnectLocalSidRequest);
+ Assert.assertEquals(2, request.getFunction());
+ XConnectLocalSidRequest xConnectRequest = XConnectLocalSidRequest.class.cast(request);
+ Assert.assertEquals(A, xConnectRequest.getNextHopAddress().getIpv6Address());
+ Assert.assertEquals(1, xConnectRequest.getOutgoingInterfaceIndex());
+ }
+
+ @Test
+ public void testEndDX2() {
+ EndDx2 endDx2 = new EndDx2Builder().setPaths(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6.sid.config.end.dx2.PathsBuilder()
+ .setInterface(LOCAL_0)
+ .build()).build();
+ Sid localSid = new SidBuilder()
+ .setEndDx2(endDx2)
+ .setEndBehaviorType(EndDX2.class)
+ .build();
+ LocalSidFunctionRequest request = WRITE_REGISTRY.bind(localSid, ctx);
+ Assert.assertTrue(request instanceof XConnectLocalSidRequest);
+ Assert.assertEquals(5, request.getFunction());
+ XConnectLocalSidRequest xConnectRequest = XConnectLocalSidRequest.class.cast(request);
+ Assert.assertNull(xConnectRequest.getNextHopAddress());
+ Assert.assertEquals(1, xConnectRequest.getOutgoingInterfaceIndex());
+ }
+
+ @Test
+ public void testEndDX6() {
+ EndDx6 endDx6 = new EndDx6Builder()
+ .setPaths(new PathsBuilder()
+ .setPath(Collections.singletonList(new PathBuilder()
+ .setNextHop(A)
+ .setInterface(LOCAL_0)
+ .build()))
+ .build())
+ .build();
+ Sid localSid = new SidBuilder()
+ .setEndDx6(endDx6)
+ .setEndBehaviorType(EndDX6.class)
+ .build();
+ LocalSidFunctionRequest request = WRITE_REGISTRY.bind(localSid, ctx);
+ Assert.assertTrue(request instanceof XConnectLocalSidRequest);
+ Assert.assertEquals(6, request.getFunction());
+ XConnectLocalSidRequest xConnectRequest = XConnectLocalSidRequest.class.cast(request);
+ Assert.assertEquals(A, xConnectRequest.getNextHopAddress().getIpv6Address());
+ Assert.assertEquals(1, xConnectRequest.getOutgoingInterfaceIndex());
+ }
+
+ @Test
+ public void testEndDX4() {
+ EndDx4 endDx4 = new EndDx4Builder()
+ .setPaths(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v4.PathsBuilder()
+ .setPath(Collections.singletonList(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.multi.paths.v4.paths.PathBuilder()
+ .setNextHop(V4HOP)
+ .setInterface(LOCAL_0)
+ .build()))
+ .build())
+ .build();
+ Sid localSid = new SidBuilder()
+ .setEndDx4(endDx4)
+ .setEndBehaviorType(EndDX4.class)
+ .build();
+ LocalSidFunctionRequest request = WRITE_REGISTRY.bind(localSid, ctx);
+ Assert.assertTrue(request instanceof XConnectLocalSidRequest);
+ Assert.assertEquals(7, request.getFunction());
+ XConnectLocalSidRequest xConnectRequest = XConnectLocalSidRequest.class.cast(request);
+ Assert.assertEquals(V4HOP, xConnectRequest.getNextHopAddress().getIpv4Address());
+ Assert.assertEquals(1, xConnectRequest.getOutgoingInterfaceIndex());
+ }
+
+ @Test
+ public void testEndT() {
+ EndT endT = new EndTBuilder().setLookupTableIpv6(TABLE_ID_4).build();
+ Sid localSid = new SidBuilder()
+ .setEndT(endT)
+ .setEndBehaviorType(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.EndT.class)
+ .build();
+ LocalSidFunctionRequest request = WRITE_REGISTRY.bind(localSid, ctx);
+ Assert.assertTrue(request instanceof TableLookupLocalSidRequest);
+ Assert.assertEquals(3, request.getFunction());
+ TableLookupLocalSidRequest tableLookupRequest = TableLookupLocalSidRequest.class.cast(request);
+ Assert.assertEquals(TABLE_ID_4.getValue().intValue(), tableLookupRequest.getLookupFibTable());
+ }
+
+ @Test
+ public void testEndDT6() {
+ EndDt6 endDt6 = new EndDt6Builder().setLookupTableIpv6(TABLE_ID_4).build();
+ Sid localSid = new SidBuilder()
+ .setEndDt6(endDt6)
+ .setEndBehaviorType(EndDT6.class)
+ .build();
+ LocalSidFunctionRequest request = WRITE_REGISTRY.bind(localSid, ctx);
+ Assert.assertTrue(request instanceof TableLookupLocalSidRequest);
+ Assert.assertEquals(8, request.getFunction());
+ TableLookupLocalSidRequest tableLookupRequest = TableLookupLocalSidRequest.class.cast(request);
+ Assert.assertEquals(TABLE_ID_4.getValue().intValue(), tableLookupRequest.getLookupFibTable());
+ }
+
+ @Test
+ public void testEndDT4() {
+ EndDt4 endDt4 = new EndDt4Builder().setLookupTableIpv4(TABLE_ID_4).build();
+ Sid localSid = new SidBuilder()
+ .setEndDt4(endDt4)
+ .setEndBehaviorType(EndDT4.class)
+ .build();
+ LocalSidFunctionRequest request = WRITE_REGISTRY.bind(localSid, ctx);
+ Assert.assertTrue(request instanceof TableLookupLocalSidRequest);
+ Assert.assertEquals(9, request.getFunction());
+ TableLookupLocalSidRequest tableLookupRequest = TableLookupLocalSidRequest.class.cast(request);
+ Assert.assertEquals(TABLE_ID_4.getValue().intValue(), tableLookupRequest.getLookupFibTable());
+ }
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/Srv6CustomizerTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/Srv6CustomizerTest.java
new file mode 100644
index 000000000..b4f5bf9b7
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/Srv6CustomizerTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+
+package io.fd.hc2vpp.srv6.write;
+
+import io.fd.hc2vpp.srv6.Srv6IIds;
+import io.fd.hc2vpp.srv6.write.sid.request.LocalSidRequestTest;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.routing.Srv6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.routing.Srv6Builder;
+
+public class Srv6CustomizerTest extends LocalSidRequestTest {
+
+ @Test(expected = WriteFailedException.class)
+ public void writeCurrentAttributesNullTest() throws WriteFailedException {
+ Srv6Customizer customizer = new Srv6Customizer();
+ Srv6 srv6 = new Srv6Builder().setEnable(true).build();
+ customizer.writeCurrentAttributes(Srv6IIds.RT_SRV6, srv6, ctx);
+ }
+
+ @Test(expected = WriteFailedException.class)
+ public void deleteCurrentAttributesNullTest() throws WriteFailedException {
+ Srv6Customizer customizer = new Srv6Customizer();
+ Srv6 srv6 = new Srv6Builder().setEnable(true).build();
+ customizer.deleteCurrentAttributes(Srv6IIds.RT_SRV6, srv6, ctx);
+ }
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/encap/source/EncapsulationSourceCustomizerTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/encap/source/EncapsulationSourceCustomizerTest.java
new file mode 100644
index 000000000..0daef976a
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/encap/source/EncapsulationSourceCustomizerTest.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.encap.source;
+
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import io.fd.hc2vpp.common.test.util.FutureProducer;
+import io.fd.hc2vpp.srv6.Srv6IIds;
+import io.fd.hc2vpp.srv6.util.JvppRequestTest;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SrSetEncapSource;
+import io.fd.vpp.jvpp.core.dto.SrSetEncapSourceReply;
+import java.util.Arrays;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.encap.Encapsulation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.encap.EncapsulationBuilder;
+
+public class EncapsulationSourceCustomizerTest extends JvppRequestTest implements FutureProducer {
+
+ private static final byte[] BSID_BYTES = {0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
+ private static Ipv6Address A1 = new Ipv6Address("a::1");
+ private static EncapsulationSourceCustomizer sourceCustomizer;
+ private static Encapsulation encapsulation = new EncapsulationBuilder()
+ .setIpTtlPropagation(false)
+ .setSourceAddress(A1)
+ .build();
+
+ @Captor
+ private ArgumentCaptor<SrSetEncapSource> requestCaptor;
+
+ @Override
+ protected void init() {
+ MockitoAnnotations.initMocks(this);
+ sourceCustomizer = new EncapsulationSourceCustomizer(api);
+ when(api.srSetEncapSource(requestCaptor.capture())).thenReturn(future(new SrSetEncapSourceReply()));
+ }
+
+ @Test
+ public void writeCurrentAttributesTest() throws WriteFailedException {
+ sourceCustomizer.writeCurrentAttributes(Srv6IIds.RT_SRV6_ENCAP, encapsulation, ctx);
+ verify(api, Mockito.times(1)).srSetEncapSource(requestCaptor.capture());
+ Assert.assertTrue(Arrays.equals(BSID_BYTES, requestCaptor.getValue().encapsSource));
+ }
+
+ @Test
+ public void deleteCurrentAttributesTest() throws WriteFailedException {
+ sourceCustomizer.deleteCurrentAttributes(Srv6IIds.RT_SRV6_ENCAP, encapsulation, ctx);
+ verify(api, Mockito.times(1)).srSetEncapSource(requestCaptor.capture());
+ Assert.assertNull(requestCaptor.getValue().encapsSource);
+ }
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceRequestTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceRequestTest.java
new file mode 100644
index 000000000..442b87cdd
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/encap/source/request/EncapsulationSourceRequestTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.encap.source.request;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+import io.fd.hc2vpp.srv6.Srv6IIds;
+import io.fd.hc2vpp.srv6.util.JvppRequestTest;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SrSetEncapSource;
+import io.fd.vpp.jvpp.core.dto.SrSetEncapSourceReply;
+import java.util.Arrays;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mockito;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+
+public class EncapsulationSourceRequestTest extends JvppRequestTest {
+
+ private static final Ipv6Address BSID = new Ipv6Address("C1::");
+ private static final byte[] BSID_BYTES = {0, -63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+ @Captor
+ private ArgumentCaptor<SrSetEncapSource> requestCaptor;
+
+ @Override
+ protected void init() {
+ Mockito.when(api.srSetEncapSource(any())).thenReturn(future(new SrSetEncapSourceReply()));
+ }
+
+ @Test
+ public void testWriteInvalid() throws WriteFailedException {
+ try {
+ new EncapsulationSourceWriteRequest(api).write(Srv6IIds.RT_SRV6_ENCAP);
+ } catch (NullPointerException e) {
+ verifyNoMoreInteractions(api);
+ return;
+ }
+ Assert.fail("NullPointerException was expected");
+ }
+
+ @Test
+ public void testWriteValid() throws WriteFailedException {
+ final EncapsulationSourceWriteRequest request = new EncapsulationSourceWriteRequest(api).setBsid(BSID);
+
+ request.write(Srv6IIds.RT_SRV6_ENCAP);
+ verify(api, Mockito.times(1)).srSetEncapSource(requestCaptor.capture());
+ Assert.assertEquals(BSID, request.getBsid());
+ Assert.assertTrue(Arrays.equals(BSID_BYTES, requestCaptor.getValue().encapsSource));
+ }
+
+ @Test
+ public void testDeleteValid() throws WriteFailedException {
+ final EncapsulationSourceDeleteRequest request = new EncapsulationSourceDeleteRequest(api);
+
+ request.delete(Srv6IIds.RT_SRV6_ENCAP);
+ verify(api, Mockito.times(1)).srSetEncapSource(requestCaptor.capture());
+ Assert.assertNull(requestCaptor.getValue().encapsSource);
+ }
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/SidCustomizerTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/SidCustomizerTest.java
new file mode 100644
index 000000000..ae72161e5
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/SidCustomizerTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import com.google.common.base.Optional;
+import io.fd.hc2vpp.srv6.write.sid.request.LocalSidRequestTest;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.SidBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.locator.Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.locator.PrefixBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.End;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6LocatorLen;
+
+public class SidCustomizerTest extends LocalSidRequestTest {
+
+ private static final Ipv6Address IP_ADDRESS = new Ipv6Address("a::101");
+
+ @Before
+ public void setup() {
+ when(ctx.readAfter(any())).thenReturn(Optional.of(LOCATOR));
+ when(ctx.readBefore(any())).thenReturn(Optional.of(LOCATOR));
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void writeCurrentAttributesNullTest() throws WriteFailedException {
+ SidCustomizer customizer = new SidCustomizer(api, WRITE_REGISTRY);
+ Sid localSid = getSidNull();
+ customizer.writeCurrentAttributes(SID_A_101, localSid, ctx);
+ verify(api, times(0)).srLocalsidAddDel(any());
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void deleteCurrentAttributesNullTest() throws WriteFailedException {
+ SidCustomizer customizer = new SidCustomizer(api, WRITE_REGISTRY);
+ Sid localSid = getSidNull();
+ customizer.deleteCurrentAttributes(SID_A_101, localSid, ctx);
+ verify(api, times(0)).srLocalsidAddDel(any());
+ }
+
+ @Test
+ public void resolveSidAddressTest() {
+ Sid localSid = getSidNull();
+ SidCustomizer customizer = new SidCustomizer(api, WRITE_REGISTRY);
+ Prefix locPrefix = new PrefixBuilder().setAddress(new Ipv6Address("a::")).setLength(new Srv6LocatorLen(
+ (short) 64)).build();
+ Ipv6Address ipv6Address = customizer.resolveSidAddress(locPrefix, localSid);
+ assertTrue((IP_ADDRESS.equals(ipv6Address)));
+ }
+
+ private Sid getSidNull() {
+ return new SidBuilder()
+ .setOpcode(OPCODE_A_101)
+ .setEndBehaviorType(End.class)
+ .setEnd(null)
+ .build();
+ }
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/LocalSidRequestTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/LocalSidRequestTest.java
new file mode 100644
index 000000000..80cf47aa0
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/LocalSidRequestTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid.request;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
+import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
+import io.fd.hc2vpp.srv6.Srv6IIds;
+import io.fd.hc2vpp.srv6.util.JvppRequestTest;
+import io.fd.vpp.jvpp.core.dto.SrLocalsidAddDel;
+import io.fd.vpp.jvpp.core.dto.SrLocalsidAddDelReply;
+import java.util.Arrays;
+import org.junit.Assert;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mock;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.Locator1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.routing.srv6.locators.locator.Static;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.routing.srv6.locators.locator._static.LocalSids;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.Sid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6._static.rev180301.srv6._static.cfg.SidKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.Locator;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.LocatorBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.LocatorKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.base.rev180301.srv6.locators.locators.locator.PrefixBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6FuncOpcodeUnreserved;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.srv6.types.rev180301.Srv6LocatorLen;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public abstract class LocalSidRequestTest extends JvppRequestTest {
+
+ protected static final Srv6FuncOpcodeUnreserved OPCODE_A_101 =
+ new Srv6FuncOpcodeUnreserved(257L); // 101 in hex format for IPv6
+ protected static final InstanceIdentifier<Sid> SID_A_101 =
+ Srv6IIds.RT_SRV6_LOCATORS.child(Locator.class, new LocatorKey("a::")).augmentation(Locator1.class)
+ .child(Static.class).child(LocalSids.class).child(Sid.class, new SidKey(OPCODE_A_101));
+ static final byte[] SID_BYTES = {0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ static final Ipv6Address SID = new Ipv6Address("A::0");
+ protected static Locator LOCATOR = new LocatorBuilder().setName("a::").setPrefix(
+ new PrefixBuilder().setLength(new Srv6LocatorLen((short) 64)).setAddress(new Ipv6Address("a::")).build())
+ .build();
+
+ @Captor
+ ArgumentCaptor<SrLocalsidAddDel> requestcaptor;
+
+ static void assertIsCreate(final SrLocalsidAddDel request) {
+ assertEquals(0, request.isDel);
+ }
+
+ static void assertIsDelete(final SrLocalsidAddDel request) {
+ assertEquals(1, request.isDel);
+ }
+
+ static void assertBaseFields(final SrLocalsidAddDel request, final byte[] localSidAddress,
+ final int installFibTable, final int segmentRoutingBehavior,
+ final int isDecapsulationEnabled) {
+ assertEquals(installFibTable, request.fibTable);
+ assertEquals(isDecapsulationEnabled, request.endPsp);
+ assertEquals(segmentRoutingBehavior, request.behavior);
+ assertTrue(Arrays.equals(localSidAddress, request.localsid.addr));
+ }
+
+ public static void assertRequestEqual(SrLocalsidAddDel srLocalsidAddDel, int behaviour, boolean isWrite,
+ String localSid) {
+ //PSP is true whe USP is false and vice versa
+ Assert.assertFalse(!ByteDataTranslator.INSTANCE.byteToBoolean(srLocalsidAddDel.endPsp));
+ Assert.assertEquals(behaviour, (int) srLocalsidAddDel.behavior);
+ Assert.assertEquals(isWrite, !ByteDataTranslator.INSTANCE.byteToBoolean(srLocalsidAddDel.isDel));
+ IpAddress ipAddress = AddressTranslator.INSTANCE.arrayToIpAddress(true, srLocalsidAddDel.localsid.addr);
+ Assert.assertEquals(localSid.toLowerCase(), ipAddress.getIpv6Address().getValue().toLowerCase());
+ }
+
+ @Override
+ protected void init() {
+ when(api.srLocalsidAddDel(any())).thenReturn(future(new SrLocalsidAddDelReply()));
+ }
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/NoProtocolLocalSidRequestTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/NoProtocolLocalSidRequestTest.java
new file mode 100644
index 000000000..a53fc09ba
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/NoProtocolLocalSidRequestTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid.request;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import io.fd.hc2vpp.srv6.Srv6IIds;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SrLocalsidAddDel;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+
+public class NoProtocolLocalSidRequestTest extends LocalSidRequestTest {
+
+ private static final int END_VALUE = 1;
+
+ private static void assertRequestBody(final SrLocalsidAddDel jvppRequest) {
+ assertNull(jvppRequest.nhAddr6);
+ assertNull(jvppRequest.nhAddr4);
+ assertEquals(0, jvppRequest.vlanIndex);
+ assertEquals(0, jvppRequest.swIfIndex);
+ }
+
+ private static NoProtocolLocalSidRequest createValidRequest(final FutureJVppCore api) {
+ final NoProtocolLocalSidRequest request = new NoProtocolLocalSidRequest(api);
+ request.setLocalSidAddress(new Ipv6Address("A::0"));
+ request.setFunction(END_VALUE);
+ request.setInstallFibTable(0);
+ return request;
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testNoAddress() throws WriteFailedException {
+ final NoProtocolLocalSidRequest request = new NoProtocolLocalSidRequest(api);
+ request.write(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testNoBehavior() throws WriteFailedException {
+ final NoProtocolLocalSidRequest request = new NoProtocolLocalSidRequest(api);
+ request.setLocalSidAddress(SID);
+ request.write(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ }
+
+ @Test
+ public void testWriteValid() throws WriteFailedException {
+ createValidRequest(api).write(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ verify(api, times(1)).srLocalsidAddDel(requestcaptor.capture());
+ final SrLocalsidAddDel jvppRequest = requestcaptor.getValue();
+ assertIsCreate(jvppRequest);
+ assertRequestBody(jvppRequest);
+ }
+
+ @Test
+ public void testDeleteValid() throws WriteFailedException {
+ createValidRequest(api).delete(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ verify(api, times(1)).srLocalsidAddDel(requestcaptor.capture());
+ final SrLocalsidAddDel jvppRequest = requestcaptor.getValue();
+ assertIsDelete(jvppRequest);
+ assertBaseFields(jvppRequest, SID_BYTES, 0, END_VALUE, 1);
+ assertRequestBody(jvppRequest);
+ }
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/TableLookupLocalSidRequestTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/TableLookupLocalSidRequestTest.java
new file mode 100644
index 000000000..0cedec73b
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/TableLookupLocalSidRequestTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid.request;
+
+import static io.fd.vpp.jvpp.Assertions.assertEquals;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import io.fd.hc2vpp.srv6.Srv6IIds;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SrLocalsidAddDel;
+import org.junit.Test;
+
+public class TableLookupLocalSidRequestTest extends LocalSidRequestTest {
+
+ private static final int END_T_VALUE = 3;
+
+ @Test(expected = NullPointerException.class)
+ public void testNoAddress() throws WriteFailedException {
+ final TableLookupLocalSidRequest request = new TableLookupLocalSidRequest(api);
+ request.write(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testNoBehavior() throws WriteFailedException {
+ final TableLookupLocalSidRequest request = new TableLookupLocalSidRequest(api);
+ request.setLocalSidAddress(SID);
+ request.write(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ }
+
+ @Test
+ public void testWriteValid() throws WriteFailedException {
+ createValidRequest().write(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ verify(api, times(1)).srLocalsidAddDel(requestcaptor.capture());
+ final SrLocalsidAddDel jvppRequest = requestcaptor.getValue();
+
+ assertIsCreate(jvppRequest);
+ assertBaseFields(jvppRequest, SID_BYTES, 0, END_T_VALUE, 1);
+ assertEquals(7, jvppRequest.swIfIndex);
+ }
+
+ @Test
+ public void testDeleteValid() throws WriteFailedException {
+ createValidRequest().delete(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ verify(api, times(1)).srLocalsidAddDel(requestcaptor.capture());
+ final SrLocalsidAddDel jvppRequest = requestcaptor.getValue();
+
+ assertIsDelete(jvppRequest);
+ assertBaseFields(jvppRequest, SID_BYTES, 0, END_T_VALUE, 1);
+ assertEquals(7, jvppRequest.swIfIndex);
+ }
+
+ private TableLookupLocalSidRequest createValidRequest() {
+ final TableLookupLocalSidRequest request = new TableLookupLocalSidRequest(api);
+ request.setLookupFibTable(7);
+ request.setInstallFibTable(0);
+ request.setLocalSidAddress(SID);
+ request.setFunction(END_T_VALUE);
+ return request;
+ }
+
+}
diff --git a/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/XConnectLocalSidRequestTest.java b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/XConnectLocalSidRequestTest.java
new file mode 100644
index 000000000..970295001
--- /dev/null
+++ b/srv6/srv6-impl/src/test/java/io/fd/hc2vpp/srv6/write/sid/request/XConnectLocalSidRequestTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon Technologies 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.
+ */
+
+package io.fd.hc2vpp.srv6.write.sid.request;
+
+import static io.fd.vpp.jvpp.Assertions.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import io.fd.hc2vpp.srv6.Srv6IIds;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SrLocalsidAddDel;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.Arrays;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+
+public class XConnectLocalSidRequestTest extends LocalSidRequestTest {
+
+ private static final IpAddress NEXT_HOP_ADDRESS = new IpAddress(new Ipv6Address("B::0"));
+ private static final byte[] NEXT_HOP_ADDRESS_BYTES = new byte[]{0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ private static final int END_DX6_VALUE = 6;
+
+ private static XConnectLocalSidRequest createValidRequest(final FutureJVppCore api) {
+ final XConnectLocalSidRequest request = new XConnectLocalSidRequest(api);
+ request.setLocalSidAddress(SID);
+ request.setNextHopAddress(NEXT_HOP_ADDRESS);
+ request.setOutgoingInterfaceIndex(7);
+ request.setVlanIndex(4);
+ request.setInstallFibTable(0);
+ request.setFunction(END_DX6_VALUE);
+ return request;
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testNoAddress() throws WriteFailedException {
+ final XConnectLocalSidRequest request = new XConnectLocalSidRequest(api);
+ request.write(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testNoBehavior() throws WriteFailedException {
+ final XConnectLocalSidRequest request = new XConnectLocalSidRequest(api);
+ request.setLocalSidAddress(SID);
+ request.write(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ }
+
+ @Test
+ public void testWriteValid() throws WriteFailedException {
+ createValidRequest(api).write(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ verify(api, times(1)).srLocalsidAddDel(requestcaptor.capture());
+
+ final SrLocalsidAddDel jvppRequest = requestcaptor.getValue();
+
+ assertIsCreate(jvppRequest);
+ assertBaseFields(jvppRequest, SID_BYTES, 0, END_DX6_VALUE, 1);
+ assertEquals(7, jvppRequest.swIfIndex);
+ assertEquals(4, jvppRequest.vlanIndex);
+ assertTrue(Arrays.equals(NEXT_HOP_ADDRESS_BYTES, jvppRequest.nhAddr6));
+ }
+
+ @Test
+ public void testDeleteValid() throws WriteFailedException {
+ createValidRequest(api).delete(Srv6IIds.RT_SRV6_LOCS_LOC_ST_LS_SID);
+ verify(api, times(1)).srLocalsidAddDel(requestcaptor.capture());
+
+ final SrLocalsidAddDel jvppRequest = requestcaptor.getValue();
+
+ assertIsDelete(jvppRequest);
+ assertBaseFields(jvppRequest, SID_BYTES, 0, END_DX6_VALUE, 1);
+ assertEquals(7, jvppRequest.swIfIndex);
+ assertEquals(4, jvppRequest.vlanIndex);
+ assertTrue(Arrays.equals(NEXT_HOP_ADDRESS_BYTES, jvppRequest.nhAddr6));
+ }
+}
diff --git a/srv6/srv6_localsid_postman_collection.json b/srv6/srv6_localsid_postman_collection.json
new file mode 100755
index 000000000..551e121f2
--- /dev/null
+++ b/srv6/srv6_localsid_postman_collection.json
@@ -0,0 +1,2411 @@
+{
+ "info": {
+ "_postman_id": "a946df2e-1831-4fab-9a47-8d2923353a1f",
+ "name": "Honeycomb SRv6-LocalSids collection copy",
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
+ },
+ "item": [
+ {
+ "name": "0.SRv6 (unsuported)",
+ "description": null,
+ "item": [
+ {
+ "name": "SRv6",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"hc2vpp-ietf-srv6-base:srv6\": {\n \"enable\": true\n }\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ ""
+ ]
+ },
+ "description": "setting of SRv6 enabled is not supported by VPP now"
+ },
+ "response": []
+ },
+ {
+ "name": "SRv6 config",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ ""
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "SRv6 oper",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ ""
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "SRv6",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ ""
+ ]
+ }
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "1.FIB-TABLE (precondition)",
+ "description": "",
+ "item": [
+ {
+ "name": "Write IPv6 FIB 0 (to store SIDs)",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"vpp-fib-table-management:table\": [\n {\n \"table-id\": 0,\n \"address-family\": \"vpp-fib-table-management:ipv6\",\n \"name\": \"ipv6-VRF:0\"\n }\n ]\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/0/vpp-fib-table-management:ipv6",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "vpp-fib-table-management:fib-table-management",
+ "vpp-fib-table-management:fib-tables",
+ "table",
+ "0",
+ "vpp-fib-table-management:ipv6"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Delete IPv6 FIB 0",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/0/vpp-fib-table-management:ipv6",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "vpp-fib-table-management:fib-table-management",
+ "vpp-fib-table-management:fib-tables",
+ "table",
+ "0",
+ "vpp-fib-table-management:ipv6"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Write IPv6 FIB 1 (lookup table for END T functions)",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"vpp-fib-table-management:table\": [\n {\n \"table-id\": 1,\n \"address-family\": \"vpp-fib-table-management:ipv6\",\n \"name\": \"ipv6-VRF:1\"\n }\n ]\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/1/vpp-fib-table-management:ipv6",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "vpp-fib-table-management:fib-table-management",
+ "vpp-fib-table-management:fib-tables",
+ "table",
+ "1",
+ "vpp-fib-table-management:ipv6"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Delete IPv6 FIB 1 (lookup table for END T functions)",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/1/vpp-fib-table-management:ipv6",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "vpp-fib-table-management:fib-table-management",
+ "vpp-fib-table-management:fib-tables",
+ "table",
+ "1",
+ "vpp-fib-table-management:ipv6"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Write IPv4 FIB 1 (lookup table for END T functions)",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"vpp-fib-table-management:table\": [\n {\n \"table-id\": 1,\n \"address-family\": \"vpp-fib-table-management:ipv4\",\n \"name\": \"ipv4-VRF:1\"\n }\n ]\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/1/vpp-fib-table-management:ipv4",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "vpp-fib-table-management:fib-table-management",
+ "vpp-fib-table-management:fib-tables",
+ "table",
+ "1",
+ "vpp-fib-table-management:ipv4"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "DeleteIPv4 FIB 1 (lookup table for END T functions)",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/1/vpp-fib-table-management:ipv4",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "vpp-fib-table-management:fib-table-management",
+ "vpp-fib-table-management:fib-tables",
+ "table",
+ "1",
+ "vpp-fib-table-management:ipv4"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Read IPv6 FIBs operational",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "vpp-fib-table-management:fib-table-management",
+ "vpp-fib-table-management:fib-tables",
+ ""
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Read IPv6 FIBs config",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "vpp-fib-table-management:fib-table-management",
+ "vpp-fib-table-management:fib-tables"
+ ]
+ }
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "2.LOCATORS",
+ "description": null,
+ "item": [
+ {
+ "name": "A::",
+ "description": null,
+ "item": [
+ {
+ "name": "locator A::",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"hc2vpp-ietf-srv6-base:locator\": [\n {\n \"name\": \"a::\",\n \"is-default\": false,\n \"prefix\": {\n \"address\": \"a::\",\n \"length\": 64\n },\n \"enable\": true,\n \"vpp-ietf-srv6-base:fib-table\" : {\n\t \"table-id\": 0,\n\t \"address-family\": \"vpp-fib-table-management:ipv6\"\n }\n }\n ]\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "locator A:: config",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ ""
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "locator A:: operational",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ ""
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "locator A::",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::"
+ ]
+ }
+ },
+ "response": []
+ }
+ ],
+ "_postman_isSubFolder": true
+ },
+ {
+ "name": "B::",
+ "description": null,
+ "item": [
+ {
+ "name": "locator B::",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"hc2vpp-ietf-srv6-base:locator\": [\n {\n \"name\": \"b::\",\n \"is-default\": false,\n \"prefix\": {\n \"address\": \"b::\",\n \"length\": 64\n },\n \"enable\": true,\n \"vpp-ietf-srv6-base:fib-table\" : {\n\t \"table-id\": 0,\n\t \"address-family\": \"vpp-fib-table-management:ipv6\"\n }\n }\n ]\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/b::",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "b::"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "locator B:: config",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/b::/",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "b::",
+ ""
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "locator B:: operational",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/b::/",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "b::",
+ ""
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "locator B::",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/b::",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "b::"
+ ]
+ }
+ },
+ "response": []
+ }
+ ],
+ "_postman_isSubFolder": true
+ }
+ ]
+ },
+ {
+ "name": "3.Encapsulation Policy",
+ "description": null,
+ "item": [
+ {
+ "name": "Encapsulation policy",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"hc2vpp-ietf-srv6-base:encapsulation\": {\n \"ip-ttl-propagation\": false,\n \"source-address\": \"a::1\"\n }\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/hc2vpp-ietf-srv6-base:encapsulation",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "hc2vpp-ietf-srv6-base:encapsulation"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl set sr encaps source addr A::1"
+ },
+ "response": []
+ },
+ {
+ "name": "Encapsulation policy",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/encapsulation",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "encapsulation"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "Encapsulation policy",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/hc2vpp-ietf-srv6-base:encapsulation",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "hc2vpp-ietf-srv6-base:encapsulation"
+ ]
+ }
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "4.END-FUNCTIONS",
+ "description": null,
+ "item": [
+ {
+ "name": "END",
+ "description": null,
+ "item": [
+ {
+ "name": "End local sid B::100",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \"hc2vpp-ietf-srv6-static:sid\": [\r\n\t\t{\r\n\t\t\t\"opcode\": 100,\r\n\t\t\t\"end-behavior-type\": \"ietf-srv6-types:End\",\r\n\t\t\t\"end\": {}\r\n\t\t}\r\n\t]\r\n}\r\n"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/b::/static/local-sids/sid/100",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "b::",
+ "static",
+ "local-sids",
+ "sid",
+ "100"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address B:: behavior end"
+ },
+ "response": []
+ },
+ {
+ "name": "End local sid B::100 config",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \"hc2vpp-ietf-srv6-base:locator\": [\r\n {\r\n\t\t\t\"name\": \"b::\",\r\n\t\t\t\"enable\": true,\r\n\t\t\t\"is-default\": true,\r\n\t\t\t\"prefix\": {\r\n\t\t\t\t\"address\": \"b::\",\r\n\t\t\t\t\"length\": 64\r\n\t\t\t},\r\n\t\t\t\"static\": {\r\n\t\t\t\t\"local-sids\": {\r\n\t\t\t\t\t\"sid\": [\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\"opcode\": 100,\r\n\t\t\t\t\t\t\t\"end-behavior-type\": \"End\",\r\n\t\t\t\t\t\t\t\"end\": {\r\n\t\t\t\t\t\t\t\t\"usp\" : false\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t]\r\n\t\t\t\t}\r\n\t\t\t}\r\n }\r\n\t]\r\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/b::/static/local-sids/sid/100",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "b::",
+ "static",
+ "local-sids",
+ "sid",
+ "100"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address B:: behavior end"
+ },
+ "response": []
+ },
+ {
+ "name": "End local sid B::100 operational",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \"hc2vpp-ietf-srv6-base:locator\": [\r\n {\r\n\t\t\t\"name\": \"b::\",\r\n\t\t\t\"enable\": true,\r\n\t\t\t\"is-default\": true,\r\n\t\t\t\"prefix\": {\r\n\t\t\t\t\"address\": \"b::\",\r\n\t\t\t\t\"length\": 64\r\n\t\t\t},\r\n\t\t\t\"static\": {\r\n\t\t\t\t\"local-sids\": {\r\n\t\t\t\t\t\"sid\": [\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\"opcode\": 100,\r\n\t\t\t\t\t\t\t\"end-behavior-type\": \"End\",\r\n\t\t\t\t\t\t\t\"end\": {\r\n\t\t\t\t\t\t\t\t\"usp\" : false\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t]\r\n\t\t\t\t}\r\n\t\t\t}\r\n }\r\n\t]\r\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/b::/static/local-sids/sid/100",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "b::",
+ "static",
+ "local-sids",
+ "sid",
+ "100"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address B:: behavior end"
+ },
+ "response": []
+ },
+ {
+ "name": "End local sid B::100",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/b::/static/local-sids/sid/100",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "b::",
+ "static",
+ "local-sids",
+ "sid",
+ "100"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address B:: behavior end"
+ },
+ "response": []
+ }
+ ],
+ "_postman_isSubFolder": true
+ },
+ {
+ "name": "END.X",
+ "description": null,
+ "item": [
+ {
+ "name": "EndX local sid A::101",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \"hc2vpp-ietf-srv6-static:sid\": [\r\n\t\t{\r\n\t\t\t\"opcode\": 101,\r\n\t\t\t\"end-behavior-type\": \"ietf-srv6-types:End.X\",\r\n\t\t\t\"end-x\": {\r\n\t\t\t\t\"paths\": {\r\n\t\t\t\t\t\"path\": [\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\"path-index\": 1,\r\n\t\t\t\t\t\t\t\"interface\": \"local0\",\r\n\t\t\t\t\t\t\t\"next-hop\": \"a::1\",\r\n\t\t\t\t\t\t\t\"weight\": 1,\r\n\t\t\t\t\t\t\t\"role\": \"PRIMARY\"\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/101",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "101"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.x local0 A::1\r\n\r\nSid name in VPP (A::101) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"101\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndX local sid A::101 conf",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/101",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "101"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.x local0 A::1\r\n\r\nSid name in VPP (A::101) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"101\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndX local sid A::101 oper",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/101",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "101"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.x local0 A::1\r\n\r\nSid name in VPP (A::101) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"101\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndX local sid A::101",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/101",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "101"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.x local0 A::1\r\n\r\nSid name in VPP (A::101) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"101\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ }
+ ],
+ "_postman_isSubFolder": true
+ },
+ {
+ "name": "END.DX6",
+ "description": null,
+ "item": [
+ {
+ "name": "EndDX6 local sid A::201",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \"hc2vpp-ietf-srv6-static:sid\": [\r\n\t\t{\r\n\t\t\t\"opcode\": 201,\r\n\t\t\t\"end-behavior-type\": \"ietf-srv6-types:End.DX6\",\r\n\t\t\t\"end-dx6\": {\r\n\t\t\t\t\"paths\": {\r\n\t\t\t\t\t\"path\": [\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\"path-index\": 1,\r\n\t\t\t\t\t\t\t\"interface\": \"local0\",\r\n\t\t\t\t\t\t\t\"next-hop\": \"a::1\",\r\n\t\t\t\t\t\t\t\"weight\": 1,\r\n\t\t\t\t\t\t\t\"role\": \"PRIMARY\"\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/201",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "201"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.dx6 local0 A::1\r\n\r\nSid name in VPP (A::201) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"201\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDX6 A::201 config",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/201",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "201"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "EndDX6 A::201 oper",
+ "request": {
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/201",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "201"
+ ]
+ }
+ },
+ "response": []
+ },
+ {
+ "name": "EndDX6 local sid A::201",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/201",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "201"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.dx6 local0 A::1\r\n\r\nSid name in VPP (A::201) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"201\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ }
+ ],
+ "_postman_isSubFolder": true
+ },
+ {
+ "name": "END.DX4",
+ "description": null,
+ "item": [
+ {
+ "name": "EndDX4 local sid A::301",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \"hc2vpp-ietf-srv6-static:sid\": [\r\n\t\t{\r\n\t\t\t\"opcode\": 301,\r\n\t\t\t\"end-behavior-type\": \"ietf-srv6-types:End.DX4\",\r\n\t\t\t\"end-dx4\": {\r\n\t\t\t\t\"paths\": {\r\n\t\t\t\t\t\"path\": [\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\"path-index\": 1,\r\n\t\t\t\t\t\t\t\"interface\": \"local0\",\r\n\t\t\t\t\t\t\t\"next-hop\": \"10.0.0.1\",\r\n\t\t\t\t\t\t\t\"weight\": 1,\r\n\t\t\t\t\t\t\t\"role\": \"PRIMARY\"\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n}\r\n\t"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/301",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "301"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.dx4 local0 10.0.0.1\r\n\r\nSid name in VPP (A::301) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"301\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDX4 local sid A::301 conf",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/301",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "301"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.dx4 local0 10.0.0.1\r\n\r\nSid name in VPP (A::301) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"301\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDX4 local sid A::301 oper",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/301",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "301"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.dx4 local0 10.0.0.1\r\n\r\nSid name in VPP (A::301) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"301\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDX4 local sid A::301",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/301",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "301"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.dx4 local0 10.0.0.1\r\n\r\nSid name in VPP (A::301) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"301\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ }
+ ],
+ "_postman_isSubFolder": true
+ },
+ {
+ "name": "END.DX2",
+ "description": null,
+ "item": [
+ {
+ "name": "EndDX2 local sid A::401",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \"hc2vpp-ietf-srv6-static:sid\": [\r\n\t\t{\r\n\t\t\t\"opcode\": 401,\r\n\t\t\t\"end-behavior-type\": \"ietf-srv6-types:End.DX2\",\r\n\t\t\t\"end-dx2\": {\r\n\t\t\t\t\"paths\": {\r\n\t\t\t\t\t\"interface\": \"local0\"\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n}\r\n\t"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/401",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "401"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.dx2 local0\r\n\r\nSid name in VPP (A::401) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"401\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDX2 local sid A::401 conf",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/401",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "401"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.dx2 local0\r\n\r\nSid name in VPP (A::401) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"401\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDX2 local sid A::401 oper",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/401",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "401"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.dx2 local0\r\n\r\nSid name in VPP (A::401) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"401\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDX2 local sid A::401",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/401",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "401"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A:: behavior end.dx2 local0\r\n\r\nSid name in VPP (A::401) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"401\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ }
+ ],
+ "_postman_isSubFolder": true
+ },
+ {
+ "name": "END.T",
+ "description": null,
+ "item": [
+ {
+ "name": "EndDT local sid A::501",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \"hc2vpp-ietf-srv6-static:sid\": [\r\n\t\t{\r\n\t\t\t\"opcode\": 501,\r\n\t\t\t\"end-behavior-type\": \"ietf-srv6-types:End.T\",\r\n\t\t\t\"end-t\": {\r\n\t\t\t\t\"lookup-table-ipv6\" : \"1\"\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n}\r\n\t"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/501",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "501"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid del address A::501 behavior end.t 1\r\n\r\nPRECONDITION:\r\nIPv6 Fib table must exist on VPP -> sudo vppctl ip6 table add 1\r\n\r\nSid name in VPP (A::501) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"501\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDT local sid A::501 conf",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/501",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "501"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid del address A::501 behavior end.t 1\r\n\r\nSid name in VPP (A::501) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"501\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDT local sid A::501 oper",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/501",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "501"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid del address A::501 behavior end.t 1\r\n\r\nSid name in VPP (A::501) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"501\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDT local sid A::501",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/501",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "501"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid del address A::501 behavior end.t 1\r\n\r\nSid name in VPP (A::501) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"501\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ }
+ ],
+ "_postman_isSubFolder": true
+ },
+ {
+ "name": "END.DT4",
+ "description": null,
+ "item": [
+ {
+ "name": "EndDT4 local sid A::601",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \"hc2vpp-ietf-srv6-static:sid\": [\r\n\t\t{\r\n\t\t\t\"opcode\": 601,\r\n\t\t\t\"end-behavior-type\": \"ietf-srv6-types:End.DT4\",\r\n\t\t\t\"end-dt4\": {\r\n\t\t\t\t\"lookup-table-ipv4\" : \"1\"\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n}\r\n\t"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/601",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "601"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A::601 behavior end.dt4 1\r\n\r\nPRECONDITION:\r\nIPv4 Fib table must exist on VPP -> sudo vppctl ip table add 1\r\n\r\nSid name in VPP (A::601) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"601\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDT4 local sid A::601 conf",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/601",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "601"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A::601 behavior end.dt4 1\r\n\r\nSid name in VPP (A::601) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"601\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDT4 local sid A::601 oper",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/601",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "601"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A::601 behavior end.dt4 1\r\n\r\nSid name in VPP (A::601) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"601\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDT4 local sid A::601",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/601",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "601"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A::601 behavior end.dt4 1\r\n\r\nSid name in VPP (A::601) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"601\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ }
+ ],
+ "_postman_isSubFolder": true
+ },
+ {
+ "name": "END.DT6",
+ "description": null,
+ "item": [
+ {
+ "name": "EndDT6 local sid A::701",
+ "request": {
+ "method": "PUT",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \"hc2vpp-ietf-srv6-static:sid\": [\r\n\t\t{\r\n\t\t\t\"opcode\": 701,\r\n\t\t\t\"end-behavior-type\": \"ietf-srv6-types:End.DT6\",\r\n\t\t\t\"end-dt6\": {\r\n\t\t\t\t\"lookup-table-ipv6\" : \"1\"\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n}\r\n\t"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/701",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "701"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A::701 behavior end.dt6 1\r\n\r\nPRECONDITION:\r\nIPv6 Fib table must exist on VPP -> sudo vppctl ip6 table add 1\r\n\r\nSid name in VPP (A::701) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"701\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDT6 local sid A::701 conf",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/701",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "701"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A::701 behavior end.dt6 1\r\n\r\nSid name in VPP (A::701) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"701\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDT6 local sid A::701 oper",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/701",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "701"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A::701 behavior end.dt6 1\r\n\r\nSid name in VPP (A::701) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"701\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ },
+ {
+ "name": "EndDT6 local sid A::701",
+ "request": {
+ "method": "DELETE",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": ""
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/config/hc2vpp-ietf-routing:routing/hc2vpp-ietf-srv6-base:srv6/locators/locator/a::/static/local-sids/sid/701",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "config",
+ "hc2vpp-ietf-routing:routing",
+ "hc2vpp-ietf-srv6-base:srv6",
+ "locators",
+ "locator",
+ "a::",
+ "static",
+ "local-sids",
+ "sid",
+ "701"
+ ]
+ },
+ "description": "equivalent to vpp command:\r\n-> vppctl sr localsid address A::701 behavior end.dt6 1\r\n\r\nSid name in VPP (A::701) consists of two parts:\r\n- First part is Locator e.g. \"A::\" (mapped to locator -> name)\r\n- Second part is function e.g. \"701\" (mapped to sid -> opcode)"
+ },
+ "response": []
+ }
+ ],
+ "_postman_isSubFolder": true
+ }
+ ]
+ },
+ {
+ "name": "Locator Context Read",
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Authorization",
+ "value": "Basic YWRtaW46YWRtaW4="
+ },
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "raw": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}"
+ },
+ "url": {
+ "raw": "http://localhost:8183/restconf/operational/naming-context:contexts\\locator-context:srv6-locator-mappings\\",
+ "protocol": "http",
+ "host": [
+ "localhost"
+ ],
+ "port": "8183",
+ "path": [
+ "restconf",
+ "operational",
+ "naming-context:contexts\\locator-context:srv6-locator-mappings\\"
+ ]
+ }
+ },
+ "response": []
+ }
+ ],
+ "auth": {
+ "type": "basic",
+ "basic": [
+ {
+ "key": "password",
+ "value": "admin",
+ "type": "string"
+ },
+ {
+ "key": "username",
+ "value": "admin",
+ "type": "string"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/vpp-integration/api-docs/docs/pom.xml b/vpp-integration/api-docs/docs/pom.xml
index b5c62171b..3416a5471 100644
--- a/vpp-integration/api-docs/docs/pom.xml
+++ b/vpp-integration/api-docs/docs/pom.xml
@@ -47,12 +47,14 @@
io.fd.hc2vpp.dhcp.DhcpModule,
io.fd.hc2vpp.policer.PolicerModule,
io.fd.hc2vpp.mpls.MplsModule,
+ io.fd.hc2vpp.srv6.Srv6Module,
io.fd.hc2vpp.docs.core.mock.binding.MockNshModule,
io.fd.hc2vpp.docs.core.mock.binding.MockIoamModule,
io.fd.hc2vpp.bgp.inet.BgpInetModule,
io.fd.hc2vpp.bgp.prefix.sid.BgpPrefixSidModule
</api.docs.modules>
<project.root.folder>${project.basedir}/../../..</project.root.folder>
+ <guava.version>23.6-jre</guava.version>
</properties>
<build>
@@ -105,6 +107,11 @@
<artifactId>scripts</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ </dependency>
</dependencies>
</plugin>
</plugins>
diff --git a/vpp-integration/api-docs/scripts/pom.xml b/vpp-integration/api-docs/scripts/pom.xml
index cdc05e876..e5a22a4f3 100644
--- a/vpp-integration/api-docs/scripts/pom.xml
+++ b/vpp-integration/api-docs/scripts/pom.xml
@@ -136,6 +136,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>io.fd.hc2vpp.srv6</groupId>
+ <artifactId>srv6-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>io.fd.hc2vpp.bgp</groupId>
<artifactId>bgp-inet</artifactId>
<version>${project.version}</version>
@@ -217,4 +222,4 @@
</plugins>
</build>
-</project> \ No newline at end of file
+</project>
diff --git a/vpp-integration/minimal-distribution/pom.xml b/vpp-integration/minimal-distribution/pom.xml
index 61ded4b13..fc029eec7 100644
--- a/vpp-integration/minimal-distribution/pom.xml
+++ b/vpp-integration/minimal-distribution/pom.xml
@@ -66,6 +66,7 @@
io.fd.hc2vpp.dhcp.DhcpModule,
io.fd.hc2vpp.policer.PolicerModule,
io.fd.hc2vpp.mpls.MplsModule,
+ io.fd.hc2vpp.srv6.Srv6Module,
<!-- Nsh module by default disabled, because it needs vpp-nsh plugin, which is not part of vpp codebase.-->
// io.fd.hc2vpp.vppnsh.impl.VppNshModule,
<!-- iOAM module by default disabled, because it needs ioam plugin (not part of vpp codebase.)-->
@@ -181,6 +182,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>io.fd.hc2vpp.srv6</groupId>
+ <artifactId>srv6-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>io.fd.hc2vpp.bgp</groupId>
<artifactId>bgp-prefix-sid</artifactId>
<version>${hc2vpp.bgp.version}</version>