Adding OpenConfig YANG models.
Change-Id: I0a2fdd5826e80933cf4b9ae939ff3051acec02aa
diff --git a/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-l2.yang b/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-l2.yang
new file mode 100644
index 0000000..a5af674
--- /dev/null
+++ b/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-l2.yang
@@ -0,0 +1,295 @@
+submodule openconfig-network-instance-l2 {
+
+ belongs-to openconfig-network-instance {
+ prefix "oc-netinst";
+ }
+
+
+ // import some basic types
+ import openconfig-extensions { prefix "oc-ext"; }
+ import openconfig-interfaces { prefix "oc-if"; }
+ import ietf-yang-types { prefix "yang"; }
+
+ // meta
+ organization "OpenConfig working group";
+
+ contact
+ "OpenConfig working group
+ www.openconfig.net";
+
+ description
+ "This module contains groupings which specifically relate to
+ Layer 2 network instance configuration and operational state
+ parameters.";
+
+ oc-ext:openconfig-version "0.8.0";
+
+ revision "2017-02-28" {
+ description
+ "Add OSPFv2 to network instance";
+ reference "0.8.0";
+ }
+
+ revision "2017-01-26" {
+ description
+ "Add policy forwarding to network instance";
+ reference "0.7.0";
+ }
+
+ revision "2017-01-13" {
+ description
+ "Add AFT to the network instance";
+ reference "0.6.0";
+ }
+
+ revision "2016-12-15" {
+ description
+ "Add segment routing to network instance";
+ reference "0.5.0";
+ }
+
+ revision "2016-11-10" {
+ description
+ "Update model to include IS-IS.";
+ reference "0.4.1";
+ }
+
+ revision "2016-10-12" {
+ description
+ "Update table connections";
+ reference "0.4.0";
+ }
+
+ revision "2016-09-28" {
+ description
+ "Change L2 instance to submodule; add MAC table";
+ reference "0.3.0";
+ }
+
+ revision "2016-08-11" {
+ description
+ "Resolve repeated container names in routing protocols";
+ reference "0.2.3";
+ }
+
+ revision "2016-07-08" {
+ description
+ "Updated with refactored routing protocol models";
+ reference "0.2.1";
+ }
+
+ revision "2016-03-29" {
+ description
+ "Initial revision";
+ reference "0.2.0";
+ }
+
+ revision "2015-11-20" {
+ description
+ "Initial revision";
+ reference "0.1.0";
+ }
+
+ grouping l2ni-instance {
+ description
+ "Configuration and operational state parameters relating
+ to a Layer 2 network instance";
+
+ container fdb {
+ description
+ "Operational state and configuration parameters relating to
+ the forwarding database of the network instance";
+
+ container config {
+ description
+ "Configuration parameters relating to the FDB";
+ uses l2ni-fdb-mac-config;
+ }
+ container state {
+ config false;
+ description
+ "Operational state parameters relating to the FDB";
+ uses l2ni-fdb-mac-config;
+ }
+
+ uses l2ni-mac-table-top;
+ }
+ }
+
+ grouping l2ni-instance-common-config {
+ description
+ "Common configuration options which are specific to Layer 2
+ network instances";
+
+ leaf mtu {
+ type uint16;
+ description
+ "The maximum frame size which should be supported for this
+ instance for Layer 2 frames";
+ }
+
+ }
+
+ grouping l2ni-fdb-mac-config {
+ description
+ "Parameters relating to FDB behaviour relating to MAC
+ addresses";
+
+ leaf mac-learning {
+ type boolean;
+ description
+ "When this leaf is set to true, MAC learning is enabled for
+ the network instance, such that MAC addresses are learned
+ from ingress frames and added to the FDB.";
+ }
+
+ leaf mac-aging-time {
+ // Cisco supports one aging time for local and remote, but
+ // can specify this time is absolute or against inactivity.
+ // ALU SROS supports different aging times for local and remote
+ // but does not allow absolute/inactivity specification.
+ // JNPR supports only a single aging time, and no specification
+ // of whether inactivity/absolute is used.
+ // It is easy to augment new options in here for local remote
+ // and an extra leaf to allow specification of the type of aging
+ // so this is left as a single value.
+ type uint16;
+ units seconds;
+ description
+ "The number of seconds of inactivity after which the entry
+ in the local FDB is timed out.";
+ }
+
+ leaf maximum-entries {
+ type uint16;
+ description
+ "The maximum number of MAC address entries that should be
+ accepted into the FDB";
+ }
+ }
+
+ grouping l2ni-encapsulation-config {
+ description
+ "Encapsulation related configuration parameters for a L2
+ network instance";
+
+ leaf control-word {
+ type boolean;
+ description
+ "Whether the control-word should be used for the network
+ instance";
+ reference "RFC3985";
+ }
+ }
+
+ grouping l2ni-mac-table-config {
+ description
+ "Configuration data for MAC table entries";
+
+ leaf mac-address {
+ type yang:mac-address;
+ description
+ "MAC address for the dynamic or static MAC table
+ entry";
+ }
+
+ leaf vlan {
+ //TODO(aashaikh): Consider whether this should just reflect the
+ //VLAN id or be a union type to also support displaying/setting
+ //the VLAN by name (i.e., global VLAN configured in the VLAN
+ // model).
+ type leafref {
+ path "../../../../../../vlans/vlan/config/vlan-id";
+ }
+ description
+ "VLAN from which this MAC address was received";
+ }
+ }
+
+ grouping l2ni-mac-table-state {
+ description
+ "Operational state data for MAC table entries";
+
+ leaf age {
+ type uint64;
+ units seconds;
+ description
+ "The time in seconds since the MAC address has been in the
+ table";
+ }
+
+ leaf entry-type {
+ type enumeration {
+ enum STATIC {
+ description
+ "Statically programmed MAC table entry";
+ }
+ enum DYNAMIC {
+ description
+ "Dynamically learned MAC table entry";
+ }
+ }
+ description
+ "Indicates whether the entry was statically configured, or
+ dynamically learned.";
+ }
+
+ }
+
+ grouping l2ni-mac-table-top {
+ description
+ "Top-level grouping for MAC table list";
+
+
+ container mac-table {
+ description
+ "Table of learned or statically configured MAC addresses and
+ corresponding VLANs in the bridge domain";
+
+ container entries {
+ description
+ "Enclosing container for list of MAC table entries";
+
+ list entry {
+ key "mac-address";
+ description
+ "List of learned MAC addresses";
+
+ leaf mac-address {
+ type leafref {
+ path "../config/mac-address";
+ }
+ description
+ "Reference to mac-address list key";
+ }
+
+ container config {
+ description
+ "Configuration data for MAC table entries";
+
+ uses l2ni-mac-table-config;
+ }
+
+ container state {
+
+ config false;
+
+ description
+ "Operational state data for MAC table entries";
+
+ uses l2ni-mac-table-config;
+ uses l2ni-mac-table-state;
+ }
+
+ container interface {
+ description
+ "Reference to the base and/or subinterface for the
+ MAC table entry";
+
+ uses oc-if:interface-ref;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-l3.yang b/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-l3.yang
new file mode 100644
index 0000000..72fb8af
--- /dev/null
+++ b/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-l3.yang
@@ -0,0 +1,112 @@
+module openconfig-network-instance-l3 {
+
+ yang-version "1";
+
+ // namespace
+ namespace "http://openconfig.net/yang/network-instance-l3";
+
+ prefix "oc-ni-l3";
+
+ // import some basic types
+ //import ietf-inet-types { prefix inet; }
+ import openconfig-extensions { prefix "oc-ext"; }
+ import openconfig-types { prefix "octypes"; }
+
+ // meta
+ organization "OpenConfig working group";
+
+ contact
+ "OpenConfig working group
+ www.openconfig.net";
+
+ description
+ "This module contains groupings which specifically relate to
+ Layer 2 network instance configuration and operational state
+ parameters.";
+
+ oc-ext:openconfig-version "0.8.0";
+
+ revision "2017-02-28" {
+ description
+ "Add OSPFv2 to network instance";
+ reference "0.8.0";
+ }
+
+ revision "2017-01-26" {
+ description
+ "Add policy forwarding to network instance";
+ reference "0.7.0";
+ }
+
+ revision "2017-01-13" {
+ description
+ "Add AFT to the network instance";
+ reference "0.6.0";
+ }
+
+ revision "2016-12-15" {
+ description
+ "Add segment routing to network instance";
+ reference "0.5.0";
+ }
+
+ revision "2016-11-10" {
+ description
+ "Update model to include IS-IS.";
+ reference "0.4.1";
+ }
+
+ revision "2016-09-28" {
+ description
+ "Change L2 instance to submodule; add MAC table";
+ reference "0.3.0";
+ }
+
+ revision "2016-08-11" {
+ description
+ "Resolve repeated container names in routing protocols";
+ reference "0.2.3";
+ }
+
+ revision "2016-07-08" {
+ description
+ "Updated with refactored routing protocol models";
+ reference "0.2.1";
+ }
+
+ revision "2016-03-29" {
+ description
+ "Initial revision";
+ reference "0.2.0";
+ }
+
+ revision "2016-03-14" {
+ description
+ "Initial revision";
+ reference "0.1.0";
+ }
+
+ grouping l3ni-instance {
+ description
+ "Configuration and operational state parameters relevant
+ to network instances that include a Layer 3 type";
+
+ }
+
+ grouping l3ni-instance-common-config {
+ description
+ "Configuration parameters that are common to L3 network
+ instances other than the default instance";
+
+ leaf-list enabled-address-families {
+ type identityref {
+ base octypes:ADDRESS_FAMILY;
+ }
+ description
+ "The address families that are to be enabled for this
+ network instance.";
+ }
+ }
+
+
+}
diff --git a/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-policy.yang b/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-policy.yang
new file mode 100644
index 0000000..acb17d0
--- /dev/null
+++ b/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-policy.yang
@@ -0,0 +1,116 @@
+module openconfig-network-instance-policy {
+
+ yang-version "1";
+
+ // namespace
+ namespace "http://openconfig.net/yang/network-instance/policy";
+
+ prefix "oc-ni-pol";
+
+ // import some basic types
+ import openconfig-extensions { prefix oc-ext; }
+ import openconfig-routing-policy { prefix oc-rpol; }
+ import openconfig-policy-types { prefix oc-pol-types; }
+
+
+ // meta
+ organization "OpenConfig working group";
+
+ contact
+ "OpenConfig working group
+ www.openconfig.net";
+
+ description
+ "This module defines routing policy statements (conditions and
+ actions) for the network instance model. These statements are
+ generally added to the routing policy model.";
+
+ oc-ext:openconfig-version "0.1.0";
+
+ revision "2017-02-15" {
+ description
+ "Initial revision";
+ reference "0.1.0";
+ }
+
+
+ // grouping statements
+
+ grouping protocol-instance-policy-config {
+ description
+ "Configuration data for policy matching on protocol instance";
+
+ leaf protocol-identifier {
+ type identityref {
+ base oc-pol-types:INSTALL_PROTOCOL_TYPE;
+ }
+ description
+ "The identifier (protocol type) of the
+ protocol instance to match on in the local network
+ instance.";
+ }
+
+ leaf protocol-name {
+ type string;
+ description
+ "The name of the protocol instance to match
+ on in the local network instance";
+ }
+ }
+
+ grouping protocol-instance-policy-state {
+ description
+ "Operational state data for policy matching on protocol
+ instance";
+ }
+
+ grouping protocol-instance-policy-top {
+ description
+ "Top-level grouping for policy matching on protocol instance";
+
+ container match-protocol-instance {
+ description
+ "Top-level container for protocol instance match condition
+ in policy statements. The protocol instance is referenced
+ by an identifier and name";
+
+ container config {
+ description
+ "Configuration data for policy matching on protocol
+ instance";
+
+ uses protocol-instance-policy-config;
+ }
+
+ container state {
+
+ config false;
+
+ description
+ "Operational state data for policy matching on protocol instance";
+
+ uses protocol-instance-policy-config;
+ uses protocol-instance-policy-state;
+ }
+ }
+ }
+
+ // data definition statements
+
+ // augment statements
+
+ augment "/oc-rpol:routing-policy/oc-rpol:policy-definitions/" +
+ "oc-rpol:policy-definition/oc-rpol:statements/oc-rpol:statement/" +
+ "oc-rpol:conditions" {
+ description
+ "Add match conditions for protocol instances to the routing
+ policy model.";
+
+ uses protocol-instance-policy-top;
+ }
+
+ // rpc statements
+
+ // notification statements
+
+}
\ No newline at end of file
diff --git a/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-types.yang b/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-types.yang
new file mode 100644
index 0000000..bcbe8ca
--- /dev/null
+++ b/models/openconfig/src/main/yang/network-instance/openconfig-network-instance-types.yang
@@ -0,0 +1,255 @@
+module openconfig-network-instance-types {
+
+ yang-version "1";
+
+ // namespace
+ namespace "http://openconfig.net/yang/network-instance-types";
+
+ prefix "oc-ni-types";
+
+ import openconfig-extensions { prefix "oc-ext"; }
+
+ // meta
+ organization "OpenConfig working group";
+
+ contact
+ "OpenConfig working group
+ www.openconfig.net";
+
+ description
+ "Types associated with a network instance";
+
+ oc-ext:openconfig-version "0.8.0";
+
+ revision "2017-02-28" {
+ description
+ "Add OSPFv2 to network instance";
+ reference "0.8.0";
+ }
+
+ revision "2017-01-26" {
+ description
+ "Add policy forwarding to network instance";
+ reference "0.7.0";
+ }
+
+ revision "2017-01-13" {
+ description
+ "Add AFT to the network instance";
+ reference "0.6.0";
+ }
+
+ revision "2016-12-15" {
+ description
+ "Add segment routing to network instance";
+ reference "0.5.0";
+ }
+
+ revision "2016-11-10" {
+ description
+ "Update model to include IS-IS.";
+ reference "0.4.1";
+ }
+
+ revision "2016-10-12" {
+ description
+ "Update table connections";
+ reference "0.4.0";
+ }
+
+ revision "2016-09-28" {
+ description
+ "Change L2 instance to submodule; add MAC table";
+ reference "0.3.0";
+ }
+
+ revision "2016-08-11" {
+ description
+ "Resolve repeated container names in routing protocols";
+ reference "0.2.3";
+ }
+
+ revision "2016-07-08" {
+ description
+ "Updated with refactored routing protocol models";
+ reference "0.2.1";
+ }
+
+ revision "2016-03-29" {
+ description
+ "Initial revision";
+ reference "0.2.0";
+ }
+
+ revision "2015-10-18" {
+ description
+ "Initial revision";
+ reference "0.1.0";
+ }
+
+ // identity statements
+ identity NETWORK_INSTANCE_TYPE {
+ description
+ "A base identity which can be extended to indicate different
+ types of network instance supported by a device.";
+ }
+
+ identity DEFAULT_INSTANCE {
+ base NETWORK_INSTANCE_TYPE;
+ description
+ "A special routing instance which acts as the 'default' or
+ 'global' routing instance for a network device.";
+ }
+
+ identity L3VRF {
+ base NETWORK_INSTANCE_TYPE;
+ description
+ "A private Layer 3 only routing instance which is formed of
+ one or more RIBs";
+ }
+
+ identity L2VSI {
+ base NETWORK_INSTANCE_TYPE;
+ description
+ "A private Layer 2 only switch instance which is formed of
+ one or more L2 forwarding tables";
+ }
+
+ identity L2P2P {
+ base NETWORK_INSTANCE_TYPE;
+ description
+ "A private Layer 2 only forwarding instance which acts as
+ a point to point connection between two endpoints";
+ }
+
+ identity L2L3 {
+ base NETWORK_INSTANCE_TYPE;
+ description
+ "A private Layer 2 and Layer 2 forwarding instance";
+ }
+
+ identity ENDPOINT_TYPE {
+ description
+ "Specification of the type of endpoint that is being associated
+ with a network instance";
+ }
+
+ identity LOCAL {
+ base ENDPOINT_TYPE;
+ description
+ "A local interface which is being associated with the endpoint";
+ }
+
+ identity REMOTE {
+ base ENDPOINT_TYPE;
+ description
+ "A remote interface which is being associated with the
+ endpoint";
+ }
+
+ identity LABEL_ALLOCATION_MODE {
+ description
+ "Base identity to be used to express types of label allocation
+ strategies to be used within a network instance";
+ }
+
+ identity PER_PREFIX {
+ base LABEL_ALLOCATION_MODE;
+ description
+ "A label is to be allocated per prefix entry in the RIB for the
+ network instance";
+ }
+
+ identity PER_NEXTHOP {
+ base LABEL_ALLOCATION_MODE;
+ description
+ "A label is to be allocated per nexthop entry in the RIB for
+ the network instance";
+ }
+
+ identity INSTANCE_LABEL {
+ base LABEL_ALLOCATION_MODE;
+ description
+ "A single label is to be used for the instance";
+ }
+
+ identity ENCAPSULATION {
+ description
+ "On the wire encapsulations that can be used when
+ differentiating network instances";
+ }
+
+ identity MPLS {
+ base ENCAPSULATION;
+ description
+ "Use MPLS labels to distinguish network instances on the wire";
+ }
+
+ identity VXLAN {
+ base ENCAPSULATION;
+ description
+ "Use VXLAN (RFC7348) VNIs to distinguish network instances on
+ the wire";
+ }
+
+ identity SIGNALLING_PROTOCOL {
+ description
+ "The signalling protocol that should be used to diseminate
+ entries within a forwarding instance";
+ }
+
+ identity LDP {
+ base SIGNALLING_PROTOCOL;
+ description
+ "Use LDP-based setup for signalling. Where the instance is
+ a point-to-point service this refers to RFC4447 ('Martini')
+ setup. Where the service is an L2VSI, or L2L3 instance it
+ refers to RFC4762 LDP-signalled VPLS instances";
+ }
+
+ identity BGP_VPLS {
+ base SIGNALLING_PROTOCOL;
+ description
+ "Use BGP-based signalling and autodiscovery for VPLS instances
+ as per RFC4761";
+ }
+
+ identity BGP_EVPN {
+ base SIGNALLING_PROTOCOL;
+ description
+ "Use BGP-based Ethernet VPN (RFC7432) based signalling for
+ the network instance";
+ }
+
+ // rjs note:
+ // this should move to openconfig-types when merged
+ typedef route-distinguisher {
+ type union {
+ // type 0: <2-byte administrator>:<4-byte assigned number>
+ type string {
+ pattern '^(65[0-5][0-3][0-5]|[1-5][1-5][0-9][0-9][0-9]|'
+ + '[1-9]?[1-9]?[0-9][0-9]|[1-9]):'
+ + '(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-5]|'
+ + '[0-3][0-9]{9}|[1-9][0-9]{1,8}|[1-9])$';
+ }
+ // type 1: <ip-address>:<2-byte assigned number>
+ type string {
+ pattern
+ '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]):'
+ + '(65[0-5][0-3][0-5]|[1-5][1-5][0-9][0-9][0-9]|'
+ + '[1-9]?[1-9]?[0-9][0-9]|[1-9])$';
+ }
+ // type 2: <4-byte as-number>:<2-byte assigned number>
+ type string {
+ pattern
+ '^(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-5]|'
+ + '[0-3][0-9]{9}|[1-9][0-9]{1,8}|[1-9]):'
+ + '(65[0-5][0-3][0-5]|[1-5]{2}[0-9]{3}|'
+ + '[1-9]{0,2}[0-9][0-9]|[1-9])$';
+ }
+ }
+ description "A route distinguisher value";
+ reference "RFC4364";
+ }
+}
diff --git a/models/openconfig/src/main/yang/network-instance/openconfig-network-instance.yang b/models/openconfig/src/main/yang/network-instance/openconfig-network-instance.yang
new file mode 100644
index 0000000..e857c95
--- /dev/null
+++ b/models/openconfig/src/main/yang/network-instance/openconfig-network-instance.yang
@@ -0,0 +1,1016 @@
+module openconfig-network-instance {
+
+ yang-version "1";
+
+ // namespace
+ namespace "http://openconfig.net/yang/network-instance";
+
+ prefix "oc-netinst";
+
+ // import some basic types
+ //import ietf-inet-types { prefix inet; }
+ import ietf-yang-types { prefix "yang"; }
+ import ietf-inet-types { prefix "inet"; }
+ import openconfig-network-instance-types { prefix "oc-ni-types"; }
+ import openconfig-policy-types { prefix "oc-pol-types"; }
+ import openconfig-routing-policy { prefix "oc-rpol"; }
+ import openconfig-local-routing { prefix "oc-loc-rt"; }
+ import openconfig-interfaces { prefix "oc-if"; }
+ import openconfig-extensions { prefix "oc-ext"; }
+ import openconfig-network-instance-l3 { prefix "oc-ni-l3"; }
+ import openconfig-types { prefix "oc-types"; }
+ import openconfig-bgp { prefix "oc-bgp"; }
+ import openconfig-mpls { prefix "oc-mpls"; }
+ import openconfig-vlan { prefix "oc-vlan"; }
+ import openconfig-ospfv2 { prefix "oc-ospfv2"; }
+ import openconfig-policy-forwarding { prefix "oc-pf"; }
+ import openconfig-segment-routing { prefix "oc-sr"; }
+ import openconfig-isis { prefix "oc-isis"; }
+ import openconfig-aft { prefix "oc-aft"; }
+
+ // include submodules
+ include openconfig-network-instance-l2;
+
+ // meta
+ organization "OpenConfig working group";
+
+ contact
+ "OpenConfig working group
+ www.openconfig.net";
+
+ description
+ "An OpenConfig description of a network-instance. This may be
+ a Layer 3 forwarding construct such as a virtual routing and
+ forwarding (VRF) instance, or a Layer 2 instance such as a
+ virtual switch instance (VSI). Mixed Layer 2 and Layer 3
+ instances are also supported.";
+
+ oc-ext:openconfig-version "0.8.0";
+
+ revision "2017-02-28" {
+ description
+ "Add OSPFv2 to network instance";
+ reference "0.8.0";
+ }
+
+ revision "2017-01-26" {
+ description
+ "Add policy forwarding to network instance";
+ reference "0.7.0";
+ }
+
+ revision "2017-01-13" {
+ description
+ "Add AFT to the network instance";
+ reference "0.6.0";
+ }
+
+ revision "2016-12-15" {
+ description
+ "Add segment routing to network instance";
+ reference "0.5.0";
+ }
+
+ revision "2016-11-10" {
+ description
+ "Add IS-IS to OpenConfig network instance";
+ reference "0.4.1";
+ }
+
+ revision "2016-10-12" {
+ description
+ "Update table connections";
+ reference "0.4.0";
+ }
+
+ revision "2016-09-28" {
+ description
+ "Change L2 instance to submodule; add MAC table";
+ reference "0.3.0";
+ }
+
+ revision "2016-08-11" {
+ description
+ "Resolve repeated container names in routing protocols";
+ reference "0.2.3";
+ }
+
+ revision "2016-07-08" {
+ description
+ "Updated with refactored routing protocol models";
+ reference "0.2.1";
+ }
+
+ revision "2016-03-29" {
+ description
+ "Initial revision";
+ reference "0.2.0";
+ }
+
+ revision "2015-10-18" {
+ description
+ "Initial revision";
+ reference "0.1.0";
+ }
+
+ grouping network-instance-top {
+ description
+ "Top-level grouping containing a list of network instances.";
+
+ container network-instances {
+ description
+ "The L2, L3, or L2+L3 forwarding instances that are
+ configured on the local system";
+
+ list network-instance {
+ key "name";
+
+ description
+ "Network instances configured on the local system";
+
+ leaf name {
+ type leafref {
+ path "../config/name";
+ }
+ description
+ "A unique name identifying the network instance";
+ }
+
+ uses l2ni-instance {
+ when "../type = 'L2VSI' or ../type = 'L2P2P'" +
+ " or ../type = 'L2L3' or ../type = 'DEFAULT_INSTANCE'" {
+ description
+ "Layer 2 configuration parameters included when
+ a network instance is a Layer 2 instance or a
+ combined L2L3 instance";
+ }
+ }
+
+ container config {
+ description
+ "Configuration parameters relating to a network
+ instance";
+ uses network-instance-config;
+ uses network-instance-type-dependent-config;
+ }
+
+
+ container state {
+ config false;
+ description
+ "Operational state parameters relating to a network
+ instance";
+ uses network-instance-config;
+ uses network-instance-type-dependent-config;
+ uses network-instance-state;
+ }
+
+ container encapsulation {
+ when "../config/type != 'DEFAULT_INSTANCE'" {
+ description
+ "Only allow the encapsulation of the instance to be
+ set when the instance is not the default instance";
+ }
+ description
+ "Configuration parameters relating to the encapsulation
+ used for the network instance";
+
+ container config {
+ description
+ "Configuration parameters relating to the encapsulation
+ of the network instance";
+
+ uses encapsulation-config;
+
+ uses l2ni-encapsulation-config {
+ when "../../../type = 'L2VSI' or ../../../type = 'L2P2P'
+ or ../../../type = 'L2L3'" {
+ description
+ "Only allow L2 encapsulations to be set
+ when the instance is of a type that supports
+ L2";
+ }
+ }
+ }
+
+ container state {
+ config false;
+ description
+ "State parameters relating to the encapsulation of
+ the network instance";
+ uses encapsulation-config;
+
+ uses l2ni-encapsulation-config {
+ when "../../../type = 'L2VSI' or ../../../type = 'L2P2P'
+ or ../../../type = 'L2L3'" {
+ description
+ "Only allow L2 encapsulations to be set
+ when the instance is of a type that supports
+ L2";
+ }
+ }
+ }
+ }
+
+ container inter-instance-policies {
+ description
+ "Policies dictating how RIB or FIB entries are imported
+ to and exported from this instance";
+
+ uses oc-rpol:apply-policy-group;
+ }
+
+ container table-connections {
+ description
+ "Policies dictating how RIB or FIB entries are propagated
+ between tables";
+
+ list table-connection {
+ key "src-protocol dst-protocol address-family";
+
+ description
+ "A list of connections between pairs of routing or
+ forwarding tables, the leaking of entries between
+ which is specified by the import policy.
+
+ A connection connecting a source table to a destination
+ table implies that routes that match the policy specified
+ for the connection are available for the destination
+ protocol to advertise, or match within its policies.";
+
+ leaf src-protocol {
+ type leafref {
+ path "../config/src-protocol";
+ }
+ description
+ "The name of the protocol associated with the table
+ which should be utilised as the source of forwarding
+ or routing information";
+ }
+
+ leaf dst-protocol {
+ type leafref {
+ path "../config/dst-protocol";
+ }
+ description
+ "The table to which routing entries should be
+ exported";
+ }
+
+ leaf address-family {
+ type leafref {
+ path "../config/address-family";
+ }
+ description
+ "The address family associated with the connection";
+ }
+
+ container config {
+ description
+ "Configuration parameters relating to the connection
+ between tables";
+ uses inter-table-policies-config;
+ }
+ container state {
+ config false;
+ description
+ "State parameters relating to the connection between
+ tables";
+ uses inter-table-policies-config;
+ }
+ }
+ }
+
+ container interfaces {
+ description
+ "The interfaces that are associated with this network
+ instance";
+
+ list interface {
+ key "id";
+ unique "config/interface config/subinterface";
+
+ description
+ "An interface associated with the network instance";
+
+ leaf id {
+ type leafref {
+ path "../config/id";
+ }
+ description
+ "A reference to an identifier for this interface which
+ acts as a key for this list";
+ }
+
+ container config {
+ description
+ "Configuration parameters relating to the associated
+ interface";
+ uses instance-interfaces-config;
+ }
+
+ container state {
+ config false;
+ description
+ "Operational state parameters relating to the
+ associated interface";
+
+ uses instance-interfaces-config;
+ uses instance-interfaces-state;
+ }
+ }
+ }
+
+ container tables {
+ description
+ "The routing tables that are managed by this network
+ instance";
+
+ list table {
+ key "protocol address-family";
+
+ description
+ "A network instance manages one or more forwarding or
+ routing tables. These may reflect a Layer 2 forwarding
+ information base, a Layer 3 routing table, or an MPLS
+ LFIB.
+
+ The table populated by a protocol within an instance is
+ identified by the protocol identifier (e.g., BGP, IS-IS)
+ and the address family (e.g., IPv4, IPv6) supported by
+ that protocol. Multiple instances of the same protocol
+ populate a single table -- such that
+ a single IS-IS or OSPF IPv4 table exists per network
+ instance.
+
+ An implementation is expected to create entries within
+ this list when the relevant protocol context is enabled.
+ i.e., when a BGP instance is created with IPv4 and IPv6
+ address families enabled, the protocol=BGP,
+ address-family=IPv4 table is created by the system.";
+
+ leaf protocol {
+ type leafref {
+ path "../config/protocol";
+ }
+ description
+ "A reference to the protocol that populates
+ the table";
+ }
+
+ leaf address-family {
+ type leafref {
+ path "../config/address-family";
+ }
+ description
+ "A reference to the address-family that the
+ table represents";
+ }
+
+ container config {
+ description
+ "Configuration parameters relating to the
+ table";
+ uses table-config;
+ }
+
+ container state {
+ config false;
+ description
+ "State parameters related to the table";
+ uses table-config;
+ }
+ }
+ }
+
+ container connection-points {
+ description
+ "The set of connection points within a forwarding
+ instance";
+
+ list connection-point {
+ key "connection-point-id";
+
+ description
+ "A connection point within a Layer 2 network instance.
+ Each connection-point consists of a set of interfaces
+ only one of which is active at any one time. Other than
+ the specification of whether an interface is local
+ (i.e., exists within this network-instance), or remote,
+ all configuration and state parameters are common";
+
+ leaf connection-point-id {
+ type leafref {
+ path "../config/connection-point-id";
+ }
+ description
+ "A locally significant reference for the
+ connection-point";
+ }
+
+ container config {
+ description
+ "Configuration parameters relating to a Layer 2
+ network instance connection point";
+ uses instance-connection-point-config;
+ }
+ container state {
+ config false;
+ description
+ "Operational state parameters relating to a Layer 2
+ network instance connection point";
+
+ uses instance-connection-point-config;
+ uses instance-connection-point-state;
+ }
+
+ container endpoints {
+ when "../config/type = 'L2P2P' " +
+ "or ../config/type = 'L2VSI'" {
+ description
+ "Configuration parameters to associate interfaces
+ into a common group for use in Layer 2 network
+ instances";
+ }
+
+ description
+ "The set of endpoints which are grouped within the
+ connection point";
+
+ list endpoint {
+ key "endpoint-id";
+
+ description
+ "A list of the endpoints (interfaces or remote
+ connection points that can be used for this
+ connection point). The active endpoint is selected
+ based on the precedence that it is configured
+ with";
+
+ leaf endpoint-id {
+ type leafref {
+ path "../config/endpoint-id";
+ }
+ description
+ "A pointer to the configured identifier for the
+ endpoint";
+ }
+
+ container config {
+ description
+ "Configuration parameters relating to the
+ endpoint";
+ uses instance-endpoint-config;
+ }
+ container state {
+ config false;
+ description
+ "Operational state parameters relating to the
+ endpoint";
+ uses instance-endpoint-config;
+ uses instance-endpoint-state;
+ }
+
+ container local {
+ when "../config/type = 'LOCAL'" {
+ description
+ "Only include the local configuration when
+ the endpoint is specified to be local to
+ the network element";
+ }
+
+ description
+ "Configuration and operational state parameters
+ relating to a local interface";
+
+ container config {
+ description
+ "Configuration parameters relating to a local
+ endpoint";
+ uses instance-endpoint-local-config;
+ }
+
+ container state {
+ config false;
+ description
+ "Operational state parameters relating to a
+ local endpoint";
+ uses instance-endpoint-local-config;
+ }
+ }
+
+ container remote {
+ when "../config/type = 'REMOTE'" {
+ description
+ "Only include the remote configuration when
+ the endpoint is specified to be remote to
+ the network element";
+ }
+
+ description
+ "Configuration and operational state parameters
+ relating to a remote interface";
+
+ container config {
+ description
+ "Configuration parameters relating to a remote
+ endpoint";
+ uses instance-endpoint-remote-config;
+ }
+
+ container state {
+ config false;
+ description
+ "Operational state parameters relating to
+ a remote endpoint";
+ uses instance-endpoint-remote-config;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ uses oc-mpls:mpls-top {
+ when "../config/type = 'DEFAULT'" {
+ description
+ "MPLS configuration is only valid within the default
+ network instance.";
+ }
+ }
+
+ uses oc-sr:sr-top {
+ when "../config/type = 'DEFAULT'" {
+ description
+ "Segment routing configuration is only valid with the default
+ network instance.";
+ }
+ }
+
+ uses oc-vlan:vlan-top;
+
+ uses oc-pf:policy-forwarding-top;
+
+ uses oc-aft:aft-top;
+
+ container protocols {
+ description
+ "The routing protocols that are enabled for this
+ network-instance.";
+
+ list protocol {
+ key "identifier name";
+
+ description
+ "A process (instance) of a routing protocol. Some
+ systems may not support more than one instance of
+ a particular routing protocol";
+
+ leaf identifier {
+ type leafref {
+ path "../config/identifier";
+ }
+ description
+ "The protocol name for the routing or forwarding
+ protocol to be instantiated";
+ }
+
+ leaf name {
+ type leafref {
+ path "../config/name";
+ }
+ description
+ "An operator-assigned identifier for the routing
+ or forwarding protocol. For some processes this
+ leaf may be system defined.";
+ }
+
+ container config {
+ description
+ "Configuration parameters relating to the routing
+ protocol instance";
+
+ uses protocols-config;
+ }
+
+ container state {
+ config false;
+ description
+ "State parameters relating to the routing protocol
+ instance";
+
+ uses protocols-config;
+ uses protocols-state;
+ }
+
+ uses oc-loc-rt:local-static-top {
+ when "../config/identifier = 'STATIC'" {
+ description
+ "Include static route parameters only when the
+ protocol is set to static";
+ }
+ description
+ "Configuration and state parameters relating to
+ static routes";
+ }
+
+ uses oc-loc-rt:local-aggregate-top {
+ when "../config/identifier = 'LOCAL_AGGREGATE'" {
+ description
+ "Include aggregate route parameters only when the
+ protocol is set to aggregate";
+ }
+ description
+ "Configuration and state parameters relating to
+ locally generated aggregate routes";
+ }
+
+ uses oc-bgp:bgp-top {
+ when "../config/identifier = 'BGP'" {
+ description
+ "Include BGP parameters only when the protocol
+ is of type BGP";
+ }
+ description
+ "Configuration and state parameters relating to
+ Border Gateway Protocol (BGP)";
+ }
+
+ uses oc-ospfv2:ospfv2-top {
+ when "../config/identifier = 'OSPF2'" {
+ description
+ "Include OSPFv2 parameters only when the protocol
+ is of type OSPFv2";
+ }
+ }
+
+ uses oc-isis:isis-top {
+ when "../config/identifier = 'ISIS'" {
+ description
+ "Include IS-IS configuration when the protocol is of type
+ IS-IS";
+ }
+ description
+ "Configuration and state parameters relating to Intermediate
+ System to Intermediate System (IS-IS).";
+ }
+ }
+ }
+ }
+ }
+ }
+
+ grouping network-instance-type-dependent-config {
+ description
+ "Type dependent network instance configuration";
+
+ uses oc-ni-l3:l3ni-instance-common-config {
+ when "../type = 'L3VRF' or ../type = 'L2L3'" {
+ description
+ "Layer 3 VRF configuration parameters included when a
+ network instance is a L3VRF or combined L2L3 instance";
+ }
+ }
+
+ uses l2ni-instance-common-config {
+ when "../type = 'L2VSI' or ../type = 'L2P2P'" +
+ " or ../type = 'L2L3'" {
+ description
+ "Layer 2 configuration parameters included when
+ a network instance is a Layer 2 instance or a
+ combined L2L3 instance";
+ }
+ }
+ }
+
+ grouping instance-endpoint-config {
+ description
+ "Configuration data relating to an forwarding-instance
+ endpoint";
+
+ leaf endpoint-id {
+ type string;
+ description
+ "An identifier for the endpoint";
+ }
+
+ leaf precedence {
+ type uint16;
+ description
+ "The precedence of the endpoint - the lowest precendence
+ viable endpoint will be utilised as the active endpoint
+ within a connection";
+ }
+
+ leaf type {
+ type identityref {
+ base "oc-ni-types:ENDPOINT_TYPE";
+ }
+ description
+ "The type of endpoint that is referred to by the current
+ endpoint";
+ }
+
+ }
+
+ grouping instance-endpoint-local-config {
+ description
+ "Configuration parameters relating to an endpoint that is local
+ to the current system";
+
+ uses oc-if:interface-ref-common;
+ }
+
+ grouping instance-endpoint-remote-config {
+ description
+ "Configuration parameters relating to an endpoint that is
+ remote from the local system";
+ leaf remote-system {
+ type inet:ip-address;
+ description
+ "The IP address of the device which hosts the
+ remote end-point";
+ }
+
+ leaf virtual-circuit-identifier {
+ type uint32;
+ description
+ "The virtual-circuit identifier that identifies the
+ connection at the remote end-point";
+ }
+ }
+
+ grouping instance-endpoint-state {
+ description
+ "Operational state data relating to a forwarding-instance
+ endpoint";
+ leaf active {
+ type boolean;
+ description
+ "When the backup endpoint is active, the value of this
+ parameter is set to true";
+ }
+ }
+
+ grouping instance-connection-point-config {
+ description
+ "Configuration data relating to a forwarding-instance
+ connection point";
+
+ leaf connection-point-id {
+ type string;
+ description
+ "An identifier for a connection point";
+ }
+ }
+
+ grouping instance-connection-point-state {
+ description
+ "Operational state data relating to a forwarding-instance
+ connection point";
+ }
+
+ grouping table-config {
+ description
+ "Config parameters relating to an L2/L2.5/L3 table that exists
+ within a network instance";
+
+ leaf protocol {
+ type leafref {
+ path "../../../../protocols/protocol/config/identifier";
+ }
+ description
+ "Reference to the protocol that the table is associated with.";
+ }
+
+ leaf address-family {
+ type identityref {
+ base oc-types:ADDRESS_FAMILY;
+ }
+ description
+ "The address family (IPv4, IPv6) of the table's entries";
+ }
+ }
+
+ grouping instance-interfaces-config {
+ description
+ "Configuration parameters related to an interface associated
+ with the network instance";
+
+ leaf id {
+ type string;
+ description
+ "A unique identifier for this interface - this is expressed
+ as a free-text string";
+ }
+
+ uses oc-if:interface-ref-common;
+
+ leaf-list associated-address-families {
+ type identityref {
+ base oc-types:ADDRESS_FAMILY;
+ }
+ description
+ "The address families on the subinterface which are to be
+ associated with this network instance. When this leaf-list
+ is empty and the network instance requires Layer 3 information
+ the address families for which the network instance is
+ enabled should be imported. If the value of this leaf-list
+ is specified then the association MUST only be made for
+ those address families that are included in the list.";
+ }
+ }
+
+ grouping instance-interfaces-state {
+ description
+ "Operational state parameters relating to an interface
+ associated with this network instance";
+ }
+
+ grouping inter-table-policies-config {
+ description
+ "Configuration entries that relate to how RIB or FIB entries
+ are propagated between tables within the same network
+ instance";
+
+ leaf src-protocol {
+ type leafref {
+ // we are at table-connections/table-connection/config/.
+ path "../../../../tables/table/config/protocol";
+ }
+ description
+ "The source protocol for the table connection";
+ }
+
+ leaf address-family {
+ type leafref {
+ // we are at table-connections/table-connection/config/.
+ path "../../../../tables/" +
+ "table[protocol=current()/../src-protocol]/" +
+ "config/address-family";
+ }
+ description
+ "The address family associated with the connection. This
+ must be defined for the source protocol. The target
+ address family is implicitly defined by the address family
+ specified for the source protocol.";
+ }
+
+ leaf dst-protocol {
+ type leafref {
+ path "../../../../tables/table/config/protocol";
+ }
+ description
+ "The destination protocol for the table connection";
+ }
+
+ uses oc-rpol:apply-policy-import-config;
+ }
+
+ grouping network-instance-config {
+ description
+ "Configuration parameters relating to a top-level network
+ instance";
+
+ leaf name {
+ type string;
+ description
+ "An operator-assigned unique name for the forwarding
+ instance";
+ }
+
+ leaf type {
+ type identityref {
+ base "oc-ni-types:NETWORK_INSTANCE_TYPE";
+ }
+ description
+ "The type of network instance. The value of this leaf
+ indicates the type of forwarding entries that should be
+ supported by this network instance";
+ }
+
+ leaf enabled {
+ type boolean;
+ description
+ "Whether the network instance should be configured to be
+ active on the network element";
+ }
+
+ leaf description {
+ type string;
+ description
+ "A free-form string to be used by the network operator to
+ describe the function of this network instance";
+ }
+
+ leaf router-id {
+ type yang:dotted-quad;
+ description
+ "A identifier for the local network instance - typically
+ used within associated routing protocols or signalling
+ routing information in another network instance";
+ }
+
+ leaf route-distinguisher {
+ type oc-ni-types:route-distinguisher;
+ description
+ "The route distinguisher that should be used for the local
+ VRF or VSI instance when it is signalled via BGP.";
+ }
+ }
+
+ grouping network-instance-state {
+ description
+ "Operational state parameters relating to a network instance";
+ }
+
+ grouping protocols-config {
+ description
+ "Configuration parameters relating to a generic protocol
+ instance within a network instance";
+
+ leaf identifier {
+ type identityref {
+ base "oc-pol-types:INSTALL_PROTOCOL_TYPE";
+ }
+ description
+ "The protocol identifier for the instance";
+ }
+
+ leaf name {
+ type string;
+ description
+ "A unique name for the protocol instance";
+ }
+
+ leaf enabled {
+ type boolean;
+ description
+ "A boolean value indicating whether the local protocol
+ instance is enabled.";
+ }
+
+ leaf default-metric {
+ type uint32;
+ description
+ "The default metric within the RIB for entries that are
+ installed by this protocol instance. This value may
+ be overridden by protocol specific configuration options.
+ The lower the metric specified the more preferable the RIB
+ entry is to be selected for use within the network instance.
+ Where multiple entries have the same metric value then these
+ equal cost paths should be treated according to the specified
+ ECMP path selection behaviour for the instance";
+ }
+ }
+
+ grouping protocols-state {
+ description
+ "Operational state parameters relating to a protocol instance";
+ }
+
+ grouping instance-interface-association-config {
+ description
+ "Grouping containing leaves that are to be augmented into an
+ interface or subinterface to include mapping to a network
+ instance";
+
+ leaf network-instance {
+ type leafref {
+ path "/network-instances/network-instance/name";
+ }
+ description
+ "The network instance that this interface is associated
+ with";
+ }
+ }
+
+ grouping encapsulation-config {
+ description
+ "Type agnostic configuration parameters relating to the
+ encapsulation of the network instance";
+
+ leaf encapsulation-type {
+ type identityref {
+ base oc-ni-types:ENCAPSULATION;
+ }
+ description
+ "The on-the-wire encapsulation that should be used when
+ sending traffic from this network instance";
+ }
+
+ // rjs: This is left here as I suspect that this can
+ // be used in EVPN. Need to validate implementations, otherwise
+ // move to L3. (TODO)
+ leaf label-allocation-mode {
+ type identityref {
+ base oc-ni-types:LABEL_ALLOCATION_MODE;
+ }
+ description
+ "The label allocation mode to be used for L3 entries
+ in the network instance";
+ }
+ }
+
+ uses network-instance-top;
+}