summaryrefslogtreecommitdiffstats
path: root/v3po/api/src/main/yang
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/api/src/main/yang')
-rw-r--r--v3po/api/src/main/yang/dot1q-types.yang237
-rw-r--r--v3po/api/src/main/yang/v3po.yang19
-rw-r--r--v3po/api/src/main/yang/vpp-vlan.yang267
3 files changed, 517 insertions, 6 deletions
diff --git a/v3po/api/src/main/yang/dot1q-types.yang b/v3po/api/src/main/yang/dot1q-types.yang
new file mode 100644
index 000000000..594b9d6ce
--- /dev/null
+++ b/v3po/api/src/main/yang/dot1q-types.yang
@@ -0,0 +1,237 @@
+module dot1q-types {
+ namespace "urn:ieee:params:xml:ns:yang:dot1q-types";
+ prefix dot1q;
+
+ organization
+ "Cisco Systems, Inc.
+ Customer Service
+
+ Postal: 170 W Tasman Drive
+ San Jose, CA 95134
+
+ Tel: +1 1800 553-NETS
+
+ E-mail: cs-yang@cisco.com";
+
+ contact
+ "Robert Wilton - rwilton@cisco.com";
+
+ description
+ "This module contains a collection of generally useful YANG types
+ that are specific to 802.1Q VLANs that can be usefully shared
+ between multiple models.
+
+ Terms and Acronyms
+
+ 802.1Q: IEEE 802.1Q VLANs
+
+ VLAN (vlan): Virtual Local Area Network
+ ";
+
+ revision 2015-06-26 {
+ description "Latest revision, changed namespace";
+
+ reference "Intended to be standardized IEEE 802.1";
+ }
+
+ typedef PCP {
+ type uint8 {
+ range "0..7";
+ }
+ description
+ "Priority Code Point. PCP is a 3-bit field that refers to the
+ class of service applied to an 802.1Q VLAN tagged frame. The
+ field specifies a priority value between 0 and 7, these values
+ can be used by quality of service (QoS) to prioritize
+ different classes of traffic.";
+ reference "IEEE 802.1Q (2014)";
+ }
+
+ /*
+ * Defines what it means to be an 802.1Q VLAN Id, where values 0
+ * and 4095 are reserved.
+ */
+ typedef dot1q-vlan-id {
+ type uint16 {
+ range "1..4094";
+ }
+ description "An 802.1Q VLAN Identifier";
+ reference "IEEE 802.1Q (2014)";
+ }
+
+ /*
+ * Defines the supported IEEE 802.1Q types that can be used for
+ * VLAN tag matching.
+ */
+ identity dot1q-tag-vlan-type {
+ description "Base identity from which all 802.1Q VLAN tag types
+ are derived from";
+ }
+
+ identity c-vlan {
+ base dot1q-tag-vlan-type;
+ description
+ "An 802.1Q Customer-VLAN tag, normally using the 0x8100
+ Ethertype";
+ }
+
+ identity s-vlan {
+ base dot1q-tag-vlan-type;
+ description
+ "An 802.1Q Service-VLAN tag, using the 0x88a8 Ethertype
+ originally introduced in 802.1ad, and incorporated into
+ 802.1Q (2011)";
+ }
+
+ typedef dot1q-tag-type {
+ type identityref {
+ base "dot1q-tag-vlan-type";
+ }
+ description "Identifies a specific 802.1Q tag type";
+ reference "IEEE 802.1Q (2014)";
+ }
+
+ /*
+ * Defines the type used to represent ranges of VLAN Ids.
+ *
+ * Ideally we would model that as a list of VLAN Ids in YANG, but
+ * the model is easier to use if this is just represented as a
+ * string.
+ *
+ * This type is used to match an ordered list of VLAN Ids, or
+ * contiguous ranges of VLAN Ids. Valid VLAN Ids must be in the
+ * range 1 to 4094, and included in the list in non overlapping
+ * ascending order.
+ *
+ * E.g. "1, 10-100, 50, 500-1000"
+ */
+ typedef dot1q-vlan-id-ranges {
+ type string {
+ pattern "([0-9]{1,4}(-[0-9]{1,4})?(,[0-9]{1,4}" +
+ "(-[0-9]{1,4})?)*)";
+ }
+ description "A list of VLAN Ids, or non overlapping VLAN ranges,
+ in ascending order, between 1 and 4094";
+ }
+
+ /*
+ * A grouping which represents an 802.1Q VLAN tag, matching both
+ * the tag Ethertype and a single VLAN Id. The PCP and DEI fields
+ * in the 802.1Q tag are ignored for tag matching purposes.
+ */
+ grouping dot1q-tag {
+ description "Grouping to allow configuration to identify a single
+ 802.1Q VLAN tag";
+ container dot1q-tag {
+ description "Identifies an 802.1Q VLAN tag with an explicit
+ tag-type and a single VLAN Id";
+ leaf tag-type {
+ type dot1q-tag-type;
+ mandatory true;
+ description "VLAN tag type";
+ }
+ leaf vlan-id {
+ type dot1q-vlan-id;
+ mandatory true;
+ description "VLAN Id";
+ }
+ }
+ }
+
+ /*
+ * A grouping which represents an 802.1Q VLAN tag, matching both
+ * the tag Ethertype and a single VLAN Id or "any" to match on any
+ * VLAN Id. The PCP and DEI fields in the 802.1Q tag are ignored
+ * for tag matching purposes.
+ */
+ grouping dot1q-tag-or-any {
+ description "Grouping to allow configuration to identify a single
+ 802.1Q VLAN tag or the 'any' value to match any VLAN
+ Id not matched by a more specific VLAN Id match";
+ container dot1q-tag {
+ description "Identifies an 802.1Q VLAN tag with an explicit
+ tag-type and a single VLAN Id, or 'any' VLAN Id";
+ leaf tag-type {
+ type dot1q-tag-type;
+ mandatory true;
+ description "VLAN tag type";
+ }
+ leaf vlan-id {
+ type union {
+ type dot1q-vlan-id;
+ type enumeration {
+ enum "any" {
+ value 4096;
+ description
+ "Matches 'any' VLAN tag in the range 1 to 4094 that
+ is not matched by a more specific VLAN Id match";
+ }
+ }
+ }
+ mandatory true;
+ description "VLAN Id or any";
+ }
+ }
+ }
+
+ /*
+ * A grouping which represents an 802.1Q tag that matches a range
+ * of VLAN Ids. The PCP and DEI fields in the 802.1Q tag are
+ * ignored for tag matching purposes.
+ */
+ grouping dot1q-tag-ranges {
+ description "Grouping to allow configuration to identify an
+ 802.1Q VLAN tag that matches any VLAN Id within a
+ set of non overlapping VLAN Id ranges";
+ container dot1q-tag {
+ description "Identifies an 802.1Q VLAN tag with an explicit
+ tag-type and and a range of VLAN Ids";
+ leaf tag-type {
+ type dot1q-tag-type;
+ mandatory true;
+ description "VLAN tag type";
+ }
+ leaf vlan-ids {
+ type dot1q-vlan-id-ranges;
+ mandatory true;
+ description "VLAN Ids";
+ }
+ }
+ }
+
+ /*
+ * A grouping which represents an 802.1Q VLAN tag, matching both
+ * the tag Ethertype and a single VLAN Id, ordered list of ranges,
+ * or "any" to match on any VLAN Id. The PCP and DEI fields in the
+ * 802.1Q tag are ignored for tag matching purposes.
+ */
+ grouping dot1q-tag-ranges-or-any {
+ description "Grouping to allow configuration to identify an
+ 802.1Q VLAN tag that matches any specific VLAN Id
+ within a set of non overlapping VLAN Id ranges, or
+ the 'any' value to match any VLAN Id";
+ container dot1q-tag {
+ description "Identifies an 802.1Q VLAN tag with an explicit
+ tag-type, an ordered list of VLAN Id ranges, or
+ 'any' VLAN Id";
+ leaf tag-type {
+ type dot1q-tag-type;
+ mandatory true;
+ description "VLAN tag type";
+ }
+ leaf vlan-id {
+ type union {
+ type dot1q-vlan-id-ranges;
+ type enumeration {
+ enum "any" {
+ description "Matches 'any' VLAN tag in the range 1 to
+ 4094";
+ }
+ }
+ }
+ mandatory true;
+ description "VLAN Ids or any";
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/v3po/api/src/main/yang/v3po.yang b/v3po/api/src/main/yang/v3po.yang
index c1210a923..86a2764b8 100644
--- a/v3po/api/src/main/yang/v3po.yang
+++ b/v3po/api/src/main/yang/v3po.yang
@@ -49,6 +49,7 @@ module v3po {
}
}
+ // todo remove from v3po
typedef tag-rewrite-operation {
type enumeration {
enum disabled;
@@ -149,6 +150,7 @@ module v3po {
}
}
+ // todo remove from v3po
grouping sub-interface-base-attributes {
leaf identifier {
type uint32;
@@ -322,7 +324,7 @@ module v3po {
}
}
- grouping l2-attributes {
+ grouping l2-base-attributes {
description
"Parameters for configuring Layer2 features on interfaces.";
@@ -365,9 +367,6 @@ module v3po {
}
}
}
- container vlan-tag-rewrite { // todo valid only for sub-interfaces
- uses vlan-tag-rewrite-attributes;
- }
}
augment /if:interfaces/if:interface {
@@ -418,7 +417,11 @@ module v3po {
must "(not (../if:ipv4[if:enabled = 'true']/if:address/if:ip) and " +
"not (../if:ipv6[if:enabled = 'true']/if:address/if:ip))";
- uses l2-attributes;
+ uses l2-base-attributes;
+
+ container vlan-tag-rewrite {
+ uses vlan-tag-rewrite-attributes;
+ }
}
container vxlan-gpe {
@@ -511,7 +514,11 @@ module v3po {
must "(not (../if:ipv4[if:enabled = 'true']/if:address/if:ip) and " +
"not (../if:ipv6[if:enabled = 'true']/if:address/if:ip))";
- uses l2-attributes;
+ uses l2-base-attributes;
+
+ container vlan-tag-rewrite {
+ uses vlan-tag-rewrite-attributes;
+ }
}
}
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;
+ }
+ }
+ }
+
+}