netconfcentral logo

openconfig-network-instance@2017-12-13



  module openconfig-network-instance {

    yang-version 1;

    namespace
      "http://openconfig.net/yang/network-instance";

    prefix oc-netinst;

    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 openconfig-network-instance-l2;

    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.";

    revision "2017-12-13" {
      description
        "Fix incorrect constraint on SR and MPLS containers";
      reference
        "0.9.0";

    }

    revision "2017-08-24" {
      description "Minor formatting fixes";
      reference
        "0.8.1";

    }

    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";

    }

    oc-ext:openconfig-version "0.9.0";

    typedef network-instance-ref {
      type leafref {
        path "/network-instances/network-instance/config/name";
      }
      description
        "A re-usable type that can be referenced within other
       modules that references a network instance.";
    }

    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 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 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 config

            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 state
          }  // container encapsulation

          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 inter-instance-policies

          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 config

              container state {
                config false;
                description
                  "State parameters relating to the connection between
                tables";
                uses inter-table-policies-config;
              }  // container state
            }  // list table-connection
          }  // container table-connections

          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 config

              container state {
                config false;
                description
                  "Operational state parameters relating to the
                associated interface";
                uses instance-interfaces-config;

                uses instance-interfaces-state;
              }  // container state
            }  // list interface
          }  // container interfaces

          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 config

              container state {
                config false;
                description
                  "State parameters related to the table";
                uses table-config;
              }  // container state
            }  // list table
          }  // container tables

          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 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 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 config

                  container state {
                    config false;
                    description
                      "Operational state parameters relating to the
                    endpoint";
                    uses instance-endpoint-config;

                    uses instance-endpoint-state;
                  }  // container 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 config

                    container state {
                      config false;
                      description
                        "Operational state parameters relating to a
                      local endpoint";
                      uses instance-endpoint-local-config;
                    }  // container state
                  }  // container local

                  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 config

                    container state {
                      config false;
                      description
                        "Operational state parameters relating to
                      a remote endpoint";
                      uses instance-endpoint-remote-config;
                    }  // container state
                  }  // container remote
                }  // list endpoint
              }  // container endpoints
            }  // list connection-point
          }  // container connection-points

          uses oc-mpls:mpls-top {
            when
              "../config/type = 'DEFAULT_INSTANCE'" {
              description
                "MPLS configuration is only valid within the default
              network instance.";
            }
          }

          uses oc-sr:sr-top {
            when
              "../config/type = 'DEFAULT_INSTANCE'" {
              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 config

              container state {
                config false;
                description
                  "State parameters relating to the routing protocol
                instance";
                uses protocols-config;

                uses protocols-state;
              }  // container 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).";
              }
            }  // list protocol
          }  // container protocols
        }  // list network-instance
      }  // container network-instances
    }  // grouping network-instance-top

    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 network-instance-type-dependent-config

    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-config

    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-local-config

    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-remote-config

    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-endpoint-state

    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-config

    grouping instance-connection-point-state {
      description
        "Operational state data relating to a forwarding-instance
      connection point";
    }  // grouping instance-connection-point-state

    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 table-config

    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-config

    grouping instance-interfaces-state {
      description
        "Operational state parameters relating to an interface
      associated with this network instance";
    }  // grouping instance-interfaces-state

    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 {
          path
            "../../../../tables/table/config/protocol";
        }
        description
          "The source protocol for the table connection";
      }

      leaf address-family {
        type leafref {
          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 inter-table-policies-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-config

    grouping network-instance-state {
      description
        "Operational state parameters relating to a network instance";
    }  // grouping network-instance-state

    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-config

    grouping protocols-state {
      description
        "Operational state parameters relating to a protocol instance";
    }  // grouping protocols-state

    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 instance-interface-association-config

    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";
      }

      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";
      }
    }  // grouping encapsulation-config

    uses network-instance-top;
  }  // module openconfig-network-instance