summaryrefslogtreecommitdiffstats
path: root/v3po/api/src/main/yang/vpp-vlan.yang
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-05-27 12:11:39 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-06-06 12:51:48 +0000
commita54aa10434f8a1d08c01c015006cdf0077c8f54c (patch)
tree036b234104be1e3a9fda6fa44f6fc3963867d0e7 /v3po/api/src/main/yang/vpp-vlan.yang
parent98a8729ed67d997caa70c91c8695779c94f9a073 (diff)
Vlan alternative model
Change-Id: I0dcb535338495b4bb858adf2e2fe1b78cf85c498 Signed-off-by: Maros Marsalek <mmarsale@cisco.com> Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/api/src/main/yang/vpp-vlan.yang')
-rw-r--r--v3po/api/src/main/yang/vpp-vlan.yang267
1 files changed, 267 insertions, 0 deletions
diff --git a/v3po/api/src/main/yang/vpp-vlan.yang b/v3po/api/src/main/yang/vpp-vlan.yang
new file mode 100644
index 000000000..a0ce5f91f
--- /dev/null
+++ b/v3po/api/src/main/yang/vpp-vlan.yang
@@ -0,0 +1,267 @@
+module vpp-vlan {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:vpp:vlan";
+ prefix "vpp-vlan";
+
+ revision "2015-05-27" {
+ description
+ "Initial revision of vlan model for VPP.
+ Reuses some concepts from draft-wilton-netmod-intf-vlan-yang-02 model.";
+ }
+
+ import ietf-interfaces {
+ prefix "if";
+ }
+ import ietf-yang-types {
+ prefix "yang";
+ }
+ import yang-ext {
+ prefix "ext";
+ }
+ import dot1q-types {
+ prefix dot1q;
+ }
+ import v3po {
+ prefix v3po;
+ }
+
+ typedef sub-interface-status {
+ type enumeration {
+ enum "up";
+ enum "down";
+ }
+ }
+
+ grouping match-attributes {
+ choice match-type {
+ mandatory true;
+ description "Provides a choice of how the frames may be matched";
+
+ case default {
+ description "Default match";
+ leaf default {
+ type empty;
+ description
+ "Default match. Matches all traffic not matched to any
+ other peer sub-interface by a more specific
+ encapsulation.";
+ } // leaf default
+ } // case default
+
+ case untagged {
+ description "Match untagged Ethernet frames only";
+ leaf untagged {
+ type empty;
+ description
+ "Untagged match. Matches all untagged traffic.";
+ } // leaf untagged
+ } // case untagged
+
+ case vlan-tagged {
+ container vlan-tagged {
+ description "Matches VLAN tagged frames";
+ list tag {
+ key "index";
+ min-elements 1;
+ max-elements 2;
+ description "The tags to match, with the outermost tag to
+ match assigned index 0";
+ leaf index {
+ type uint8 {
+ range "0..1";
+ }
+
+ must "index = 0 or
+ count(../../tag[index = 0]/index) > 0" {
+ error-message "An inner tag can only be matched on
+ when also matching on an outer tag";
+ description "Only allow matching on an inner tag, if
+ also matching on the outer tags at the
+ same time";
+ }
+ description
+ "The index into the tag stack, outermost tag first";
+ }
+
+ uses dot1q:dot1q-tag-or-any;
+ }
+
+ leaf match-exact-tags {
+ type boolean;
+ default true;
+ description
+ "If set, indicates that all 802.1Q VLAN tags in the
+ Ethernet frame header must be explicitly matched, i.e.
+ the EtherType following the matched tags must not be a
+ 802.1Q tag EtherType. If unset then extra 802.1Q VLAN
+ tags are allowed.";
+ }
+ } // container vlan-tagged
+ } // case vlan-tagged
+ }
+ }
+
+ // TODO VPP does not allow to change subinterface nor delete it (except for tag-rewrite operation)
+ grouping sub-interface-base-attributes {
+ container tags {
+ list tag {
+ key "index";
+ max-elements 2;
+
+ description "The VLAN tags to use by locally sourced traffic";
+
+ leaf index {
+ type uint8 {
+ range "0..1";
+ }
+
+ /*
+ * Only allow a push of an inner tag if an outer tag is also
+ * being pushed.
+ */
+ must "index != 0 or
+ count(../../push-tags[index = 0]/index) > 0" {
+ error-message "An inner tag can only be pushed if an outer
+ tag is also specified";
+ description "Only allow a push of an inner tag if an outer
+ tag is also being pushed";
+ }
+ description "The index into the tag stack";
+ }
+
+ uses dot1q:dot1q-tag;
+
+ }
+ }
+
+ container match {
+ description
+ "The match used to classify frames to this interface";
+ uses match-attributes;
+ }
+
+ container l2 {
+ uses v3po:l2-base-attributes;
+ container rewrite {
+ uses tag-rewrite;
+ }
+ }
+ }
+
+ grouping sub-interface-config-attributes {
+ leaf enabled {
+ type boolean;
+ default "false";
+ description
+ "Contains the configured, desired state of the sub-interface.
+ To enable sub-interface, the super inerface needs to be enabled";
+ }
+ }
+
+ grouping sub-interface-operational-attributes {
+ leaf admin-status {
+ type sub-interface-status;
+ mandatory true;
+ }
+ leaf oper-status {
+ type sub-interface-status;
+ mandatory true;
+ }
+ leaf if-index {
+ type int32 {
+ range "1..2147483647";
+ }
+ mandatory true;
+ }
+ leaf phys-address {
+ type yang:phys-address;
+ description
+ "The sub-interface's Media Access Control (MAC) address.";
+ }
+ leaf speed {
+ type yang:gauge64;
+ units "bits/second";
+ }
+ }
+
+ /*
+ * Only symetrical rewrite is supported
+ */
+ grouping tag-rewrite {
+ description "Flexible rewrite";
+ leaf pop-tags {
+ type uint8 {
+ range 1..2;
+ }
+ description "The number of tags to pop (or translate if used in
+ conjunction with push-tags)";
+ }
+
+ list push-tags {
+ key "index";
+ max-elements 2;
+ description "The number of tags to push (or translate if used
+ in conjunction with pop-tags)";
+ /*
+ * Server should order by increasing index.
+ */
+ leaf index {
+ type uint8 {
+ range 0..1;
+ }
+
+ /*
+ * Only allow a push of an inner tag if an outer tag is also
+ * being pushed.
+ */
+ must "index != 0 or
+ count(../../push-tags[index = 0]/index) > 0" {
+ error-message "An inner tag can only be pushed if an outer
+ tag is also specified";
+ description "Only allow a push of an inner tag if an outer
+ tag is also being pushed";
+ }
+ }
+
+ uses dot1q:dot1q-tag;
+ }
+ }
+
+ augment /if:interfaces/if:interface {
+ ext:augment-identifier "subinterface-augmentation";
+
+ container sub-interfaces {
+ description "L2 vlan subinterfaces";
+
+
+ list sub-interface {
+ key "identifier";
+ leaf identifier {
+ type uint32;
+ }
+
+ uses sub-interface-base-attributes;
+ uses sub-interface-config-attributes;
+ }
+ }
+ }
+
+ augment /if:interfaces-state/if:interface {
+ ext:augment-identifier "subinterface-state-augmentation";
+
+ container sub-interfaces {
+ description "L2 vlan subinterfaces";
+
+ list sub-interface {
+ key "identifier";
+ leaf identifier {
+ type uint32;
+ }
+
+ uses sub-interface-base-attributes;
+ uses sub-interface-operational-attributes;
+ }
+ }
+ }
+
+}