# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.yangtypes import YANGDynClass
from pyangbind.lib.yangtypes import ReferenceType
from pyangbind.lib.base import PybindBase
from collections import OrderedDict
from decimal import Decimal
from bitarray import bitarray
import six

# PY3 support of some PY2 keywords (needs improved)
if six.PY3:
    import builtins as __builtin__

    long = int
elif six.PY2:
    import __builtin__


class config(PybindBase):
    """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-network-instance - based on the path /network-instances/network-instance/mpls/lsps/constrained-path/tunnels/tunnel/config. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Configuration parameters related to TE tunnels:
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__name",
        "__type",
        "__signaling_protocol",
        "__description",
        "__admin_status",
        "__preference",
        "__metric_type",
        "__metric",
        "__shortcut_eligible",
        "__protection_style_requested",
        "__reoptimize_timer",
        "__source",
        "__soft_preemption",
        "__setup_priority",
        "__hold_priority",
    )

    _yang_name = "config"

    _pybind_generated_by = "container"

    def __init__(self, *args, **kwargs):

        self._path_helper = False

        self._extmethods = False
        self.__name = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="name",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=True,
        )
        self.__type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )
        self.__signaling_protocol = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="signaling-protocol",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )
        self.__description = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="description",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=True,
        )
        self.__admin_status = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:ADMIN_UP"),
            is_leaf=True,
            yang_name="admin-status",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )
        self.__preference = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["1..255"]},
            ),
            is_leaf=True,
            yang_name="preference",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )
        self.__metric_type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:LSP_METRIC_INHERITED"),
            is_leaf=True,
            yang_name="metric-type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )
        self.__metric = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["-2147483648..2147483647"]},
                int_size=32,
            ),
            is_leaf=True,
            yang_name="metric",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="int32",
            is_config=True,
        )
        self.__shortcut_eligible = YANGDynClass(
            base=YANGBool,
            default=YANGBool("true"),
            is_leaf=True,
            yang_name="shortcut-eligible",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=True,
        )
        self.__protection_style_requested = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:UNPROTECTED"),
            is_leaf=True,
            yang_name="protection-style-requested",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )
        self.__reoptimize_timer = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="reoptimize-timer",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint16",
            is_config=True,
        )
        self.__source = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "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])(%[\\p{N}\\p{L}]+)?"
                    },
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\\p{N}\\p{L}]+)?"
                    },
                ),
            ],
            is_leaf=True,
            yang_name="source",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="inet:ip-address",
            is_config=True,
        )
        self.__soft_preemption = YANGDynClass(
            base=YANGBool,
            default=YANGBool("false"),
            is_leaf=True,
            yang_name="soft-preemption",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=True,
        )
        self.__setup_priority = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["0..7"]},
            ),
            default=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
            )(
                7
            ),
            is_leaf=True,
            yang_name="setup-priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )
        self.__hold_priority = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["0..7"]},
            ),
            default=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
            )(
                0
            ),
            is_leaf=True,
            yang_name="hold-priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )

        load = kwargs.pop("load", None)
        if args:
            if len(args) > 1:
                raise TypeError("cannot create a YANG container with >1 argument")
            all_attr = True
            for e in self._pyangbind_elements:
                if not hasattr(args[0], e):
                    all_attr = False
                    break
            if not all_attr:
                raise ValueError("Supplied object did not have the correct attributes")
            for e in self._pyangbind_elements:
                nobj = getattr(args[0], e)
                if nobj._changed() is False:
                    continue
                setmethod = getattr(self, "_set_%s" % e)
                if load is None:
                    setmethod(getattr(args[0], e))
                else:
                    setmethod(getattr(args[0], e), load=load)

    def _path(self):
        if hasattr(self, "_parent"):
            return self._parent._path() + [self._yang_name]
        else:
            return [
                "network-instances",
                "network-instance",
                "mpls",
                "lsps",
                "constrained-path",
                "tunnels",
                "tunnel",
                "config",
            ]

    def _get_name(self):
        """
    Getter method for name, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/name (string)

    YANG Description: The tunnel name
    """
        return self.__name

    def _set_name(self, v, load=False):
        """
    Setter method for name, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/name (string)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_name is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_name() directly.

    YANG Description: The tunnel name
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="name",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="string",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """name must be of a type compatible with string""",
                    "defined-type": "string",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)""",
                }
            )

        self.__name = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_name(self):
        self.__name = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="name",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=True,
        )

    def _get_type(self):
        """
    Getter method for type, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/type (identityref)

    YANG Description: Tunnel type, p2p or p2mp
    """
        return self.__type

    def _set_type(self, v, load=False):
        """
    Setter method for type, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/type (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_type is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_type() directly.

    YANG Description: Tunnel type, p2p or p2mp
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "P2P": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:P2P": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:P2P": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:P2P": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "P2MP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:P2MP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:P2MP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:P2MP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                    },
                ),
                is_leaf=True,
                yang_name="type",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """type must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'P2P': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:P2P': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:P2P': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:P2P': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'P2MP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:P2MP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:P2MP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:P2MP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}},), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__type = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_type(self):
        self.__type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    def _get_signaling_protocol(self):
        """
    Getter method for signaling_protocol, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/signaling_protocol (identityref)

    YANG Description: Signaling protocol used to set up this tunnel
    """
        return self.__signaling_protocol

    def _set_signaling_protocol(self, v, load=False):
        """
    Setter method for signaling_protocol, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/signaling_protocol (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_signaling_protocol is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_signaling_protocol() directly.

    YANG Description: Signaling protocol used to set up this tunnel
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "PATH_SETUP_RSVP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:PATH_SETUP_RSVP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:PATH_SETUP_RSVP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:PATH_SETUP_RSVP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "PATH_SETUP_SR": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:PATH_SETUP_SR": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:PATH_SETUP_SR": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:PATH_SETUP_SR": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "PATH_SETUP_LDP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:PATH_SETUP_LDP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:PATH_SETUP_LDP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:PATH_SETUP_LDP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                    },
                ),
                is_leaf=True,
                yang_name="signaling-protocol",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """signaling_protocol must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'PATH_SETUP_RSVP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:PATH_SETUP_RSVP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:PATH_SETUP_RSVP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:PATH_SETUP_RSVP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'PATH_SETUP_SR': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:PATH_SETUP_SR': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:PATH_SETUP_SR': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:PATH_SETUP_SR': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'PATH_SETUP_LDP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:PATH_SETUP_LDP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:PATH_SETUP_LDP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:PATH_SETUP_LDP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}},), is_leaf=True, yang_name="signaling-protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__signaling_protocol = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_signaling_protocol(self):
        self.__signaling_protocol = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="signaling-protocol",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    def _get_description(self):
        """
    Getter method for description, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/description (string)

    YANG Description: optional text description for the tunnel
    """
        return self.__description

    def _set_description(self, v, load=False):
        """
    Setter method for description, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/description (string)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_description is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_description() directly.

    YANG Description: optional text description for the tunnel
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="description",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="string",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """description must be of a type compatible with string""",
                    "defined-type": "string",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)""",
                }
            )

        self.__description = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_description(self):
        self.__description = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="description",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=True,
        )

    def _get_admin_status(self):
        """
    Getter method for admin_status, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/admin_status (identityref)

    YANG Description: TE tunnel administrative state.
    """
        return self.__admin_status

    def _set_admin_status(self, v, load=False):
        """
    Setter method for admin_status, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/admin_status (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_admin_status is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_admin_status() directly.

    YANG Description: TE tunnel administrative state.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "ADMIN_DOWN": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:ADMIN_DOWN": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:ADMIN_DOWN": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:ADMIN_DOWN": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "ADMIN_UP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:ADMIN_UP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:ADMIN_UP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:ADMIN_UP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                    },
                ),
                default=six.text_type("oc-mplst:ADMIN_UP"),
                is_leaf=True,
                yang_name="admin-status",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """admin_status must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'ADMIN_DOWN': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:ADMIN_DOWN': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:ADMIN_DOWN': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:ADMIN_DOWN': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'ADMIN_UP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:ADMIN_UP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:ADMIN_UP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:ADMIN_UP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}},), default=six.text_type("oc-mplst:ADMIN_UP"), is_leaf=True, yang_name="admin-status", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__admin_status = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_admin_status(self):
        self.__admin_status = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:ADMIN_UP"),
            is_leaf=True,
            yang_name="admin-status",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    def _get_preference(self):
        """
    Getter method for preference, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/preference (uint8)

    YANG Description: Specifies a preference for this tunnel.
A lower number signifies a better preference
    """
        return self.__preference

    def _set_preference(self, v, load=False):
        """
    Setter method for preference, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/preference (uint8)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_preference is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_preference() directly.

    YANG Description: Specifies a preference for this tunnel.
A lower number signifies a better preference
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..255"]},
                        int_size=8,
                    ),
                    restriction_dict={"range": ["1..255"]},
                ),
                is_leaf=True,
                yang_name="preference",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="uint8",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """preference must be of a type compatible with uint8""",
                    "defined-type": "uint8",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['1..255']}), is_leaf=True, yang_name="preference", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='uint8', is_config=True)""",
                }
            )

        self.__preference = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_preference(self):
        self.__preference = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["1..255"]},
            ),
            is_leaf=True,
            yang_name="preference",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )

    def _get_metric_type(self):
        """
    Getter method for metric_type, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/metric_type (identityref)

    YANG Description: The type of metric specification that should be used to set
the LSP(s) metric
    """
        return self.__metric_type

    def _set_metric_type(self, v, load=False):
        """
    Setter method for metric_type, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/metric_type (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_metric_type is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_metric_type() directly.

    YANG Description: The type of metric specification that should be used to set
the LSP(s) metric
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "LSP_METRIC_RELATIVE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:LSP_METRIC_RELATIVE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:LSP_METRIC_RELATIVE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:LSP_METRIC_RELATIVE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "LSP_METRIC_ABSOLUTE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:LSP_METRIC_ABSOLUTE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:LSP_METRIC_ABSOLUTE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:LSP_METRIC_ABSOLUTE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "LSP_METRIC_INHERITED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:LSP_METRIC_INHERITED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:LSP_METRIC_INHERITED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:LSP_METRIC_INHERITED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                    },
                ),
                default=six.text_type("oc-mplst:LSP_METRIC_INHERITED"),
                is_leaf=True,
                yang_name="metric-type",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """metric_type must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'LSP_METRIC_RELATIVE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:LSP_METRIC_RELATIVE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:LSP_METRIC_RELATIVE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:LSP_METRIC_RELATIVE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'LSP_METRIC_ABSOLUTE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:LSP_METRIC_ABSOLUTE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:LSP_METRIC_ABSOLUTE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:LSP_METRIC_ABSOLUTE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'LSP_METRIC_INHERITED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:LSP_METRIC_INHERITED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:LSP_METRIC_INHERITED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:LSP_METRIC_INHERITED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}},), default=six.text_type("oc-mplst:LSP_METRIC_INHERITED"), is_leaf=True, yang_name="metric-type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__metric_type = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_metric_type(self):
        self.__metric_type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:LSP_METRIC_INHERITED"),
            is_leaf=True,
            yang_name="metric-type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    def _get_metric(self):
        """
    Getter method for metric, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/metric (int32)

    YANG Description: The value of the metric that should be specified. The value
supplied in this leaf is used in conjunction with the metric
type to determine the value of the metric used by the system.
Where the metric-type is set to LSP_METRIC_ABSOLUTE - the
value of this leaf is used directly; where it is set to
LSP_METRIC_RELATIVE, the relevant (positive or negative)
offset is used to formulate the metric; where metric-type
is LSP_METRIC_INHERITED, the value of this leaf is not
utilised
    """
        return self.__metric

    def _set_metric(self, v, load=False):
        """
    Setter method for metric, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/metric (int32)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_metric is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_metric() directly.

    YANG Description: The value of the metric that should be specified. The value
supplied in this leaf is used in conjunction with the metric
type to determine the value of the metric used by the system.
Where the metric-type is set to LSP_METRIC_ABSOLUTE - the
value of this leaf is used directly; where it is set to
LSP_METRIC_RELATIVE, the relevant (positive or negative)
offset is used to formulate the metric; where metric-type
is LSP_METRIC_INHERITED, the value of this leaf is not
utilised
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=long,
                    restriction_dict={"range": ["-2147483648..2147483647"]},
                    int_size=32,
                ),
                is_leaf=True,
                yang_name="metric",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="int32",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """metric must be of a type compatible with int32""",
                    "defined-type": "int32",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_size=32), is_leaf=True, yang_name="metric", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='int32', is_config=True)""",
                }
            )

        self.__metric = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_metric(self):
        self.__metric = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["-2147483648..2147483647"]},
                int_size=32,
            ),
            is_leaf=True,
            yang_name="metric",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="int32",
            is_config=True,
        )

    def _get_shortcut_eligible(self):
        """
    Getter method for shortcut_eligible, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/shortcut_eligible (boolean)

    YANG Description: Whether this LSP is considered to be eligible for us as a
shortcut in the IGP. In the case that this leaf is set to
true, the IGP SPF calculation uses the metric specified to
determine whether traffic should be carried over this LSP
    """
        return self.__shortcut_eligible

    def _set_shortcut_eligible(self, v, load=False):
        """
    Setter method for shortcut_eligible, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/shortcut_eligible (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_shortcut_eligible is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_shortcut_eligible() directly.

    YANG Description: Whether this LSP is considered to be eligible for us as a
shortcut in the IGP. In the case that this leaf is set to
true, the IGP SPF calculation uses the metric specified to
determine whether traffic should be carried over this LSP
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                default=YANGBool("true"),
                is_leaf=True,
                yang_name="shortcut-eligible",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="boolean",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """shortcut_eligible must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, default=YANGBool("true"), is_leaf=True, yang_name="shortcut-eligible", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=True)""",
                }
            )

        self.__shortcut_eligible = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_shortcut_eligible(self):
        self.__shortcut_eligible = YANGDynClass(
            base=YANGBool,
            default=YANGBool("true"),
            is_leaf=True,
            yang_name="shortcut-eligible",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=True,
        )

    def _get_protection_style_requested(self):
        """
    Getter method for protection_style_requested, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/protection_style_requested (identityref)

    YANG Description: style of mpls frr protection desired: can be
link, link-node or unprotected.
    """
        return self.__protection_style_requested

    def _set_protection_style_requested(self, v, load=False):
        """
    Setter method for protection_style_requested, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/protection_style_requested (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_protection_style_requested is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_protection_style_requested() directly.

    YANG Description: style of mpls frr protection desired: can be
link, link-node or unprotected.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "UNPROTECTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:UNPROTECTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:UNPROTECTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:UNPROTECTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "LINK_PROTECTION_REQUIRED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:LINK_PROTECTION_REQUIRED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:LINK_PROTECTION_REQUIRED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:LINK_PROTECTION_REQUIRED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "LINK_NODE_PROTECTION_REQUESTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:LINK_NODE_PROTECTION_REQUESTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:LINK_NODE_PROTECTION_REQUESTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:LINK_NODE_PROTECTION_REQUESTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                    },
                ),
                default=six.text_type("oc-mplst:UNPROTECTED"),
                is_leaf=True,
                yang_name="protection-style-requested",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """protection_style_requested must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'UNPROTECTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:UNPROTECTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:UNPROTECTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:UNPROTECTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'LINK_PROTECTION_REQUIRED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:LINK_PROTECTION_REQUIRED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:LINK_PROTECTION_REQUIRED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:LINK_PROTECTION_REQUIRED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'LINK_NODE_PROTECTION_REQUESTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:LINK_NODE_PROTECTION_REQUESTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:LINK_NODE_PROTECTION_REQUESTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:LINK_NODE_PROTECTION_REQUESTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}},), default=six.text_type("oc-mplst:UNPROTECTED"), is_leaf=True, yang_name="protection-style-requested", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__protection_style_requested = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_protection_style_requested(self):
        self.__protection_style_requested = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:UNPROTECTED"),
            is_leaf=True,
            yang_name="protection-style-requested",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    def _get_reoptimize_timer(self):
        """
    Getter method for reoptimize_timer, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/reoptimize_timer (uint16)

    YANG Description: frequency of reoptimization of
a traffic engineered LSP
    """
        return self.__reoptimize_timer

    def _set_reoptimize_timer(self, v, load=False):
        """
    Setter method for reoptimize_timer, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/reoptimize_timer (uint16)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_reoptimize_timer is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_reoptimize_timer() directly.

    YANG Description: frequency of reoptimization of
a traffic engineered LSP
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
                ),
                is_leaf=True,
                yang_name="reoptimize-timer",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="uint16",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """reoptimize_timer must be of a type compatible with uint16""",
                    "defined-type": "uint16",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), is_leaf=True, yang_name="reoptimize-timer", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='uint16', is_config=True)""",
                }
            )

        self.__reoptimize_timer = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_reoptimize_timer(self):
        self.__reoptimize_timer = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="reoptimize-timer",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint16",
            is_config=True,
        )

    def _get_source(self):
        """
    Getter method for source, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/source (inet:ip-address)

    YANG Description: RSVP-TE tunnel source address
    """
        return self.__source

    def _set_source(self, v, load=False):
        """
    Setter method for source, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/source (inet:ip-address)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_source is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_source() directly.

    YANG Description: RSVP-TE tunnel source address
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_dict={
                            "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])(%[\\p{N}\\p{L}]+)?"
                        },
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_dict={
                            "pattern": "((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\\p{N}\\p{L}]+)?"
                        },
                    ),
                ],
                is_leaf=True,
                yang_name="source",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="inet:ip-address",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """source must be of a type compatible with inet:ip-address""",
                    "defined-type": "inet:ip-address",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={'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])(%[\\p{N}\\p{L}]+)?'}),RestrictedClassType(base_type=six.text_type, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\\p{N}\\p{L}]+)?'}),], is_leaf=True, yang_name="source", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='inet:ip-address', is_config=True)""",
                }
            )

        self.__source = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_source(self):
        self.__source = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "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])(%[\\p{N}\\p{L}]+)?"
                    },
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\\p{N}\\p{L}]+)?"
                    },
                ),
            ],
            is_leaf=True,
            yang_name="source",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="inet:ip-address",
            is_config=True,
        )

    def _get_soft_preemption(self):
        """
    Getter method for soft_preemption, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/soft_preemption (boolean)

    YANG Description: Enables RSVP soft-preemption on this LSP
    """
        return self.__soft_preemption

    def _set_soft_preemption(self, v, load=False):
        """
    Setter method for soft_preemption, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/soft_preemption (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_soft_preemption is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_soft_preemption() directly.

    YANG Description: Enables RSVP soft-preemption on this LSP
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                default=YANGBool("false"),
                is_leaf=True,
                yang_name="soft-preemption",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="boolean",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """soft_preemption must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="soft-preemption", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=True)""",
                }
            )

        self.__soft_preemption = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_soft_preemption(self):
        self.__soft_preemption = YANGDynClass(
            base=YANGBool,
            default=YANGBool("false"),
            is_leaf=True,
            yang_name="soft-preemption",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=True,
        )

    def _get_setup_priority(self):
        """
    Getter method for setup_priority, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/setup_priority (uint8)

    YANG Description: RSVP-TE preemption priority during LSP setup, lower is
higher priority; default 7 indicates that LSP will not
preempt established LSPs during setup
    """
        return self.__setup_priority

    def _set_setup_priority(self, v, load=False):
        """
    Setter method for setup_priority, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/setup_priority (uint8)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_setup_priority is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_setup_priority() directly.

    YANG Description: RSVP-TE preemption priority during LSP setup, lower is
higher priority; default 7 indicates that LSP will not
preempt established LSPs during setup
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..255"]},
                        int_size=8,
                    ),
                    restriction_dict={"range": ["0..7"]},
                ),
                default=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                )(
                    7
                ),
                is_leaf=True,
                yang_name="setup-priority",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="uint8",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """setup_priority must be of a type compatible with uint8""",
                    "defined-type": "uint8",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..7']}), default=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8)(7), is_leaf=True, yang_name="setup-priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='uint8', is_config=True)""",
                }
            )

        self.__setup_priority = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_setup_priority(self):
        self.__setup_priority = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["0..7"]},
            ),
            default=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
            )(
                7
            ),
            is_leaf=True,
            yang_name="setup-priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )

    def _get_hold_priority(self):
        """
    Getter method for hold_priority, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/hold_priority (uint8)

    YANG Description: preemption priority once the LSP is established,
lower is higher priority; default 0 indicates other LSPs
will not preempt the LSPs once established
    """
        return self.__hold_priority

    def _set_hold_priority(self, v, load=False):
        """
    Setter method for hold_priority, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/hold_priority (uint8)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_hold_priority is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_hold_priority() directly.

    YANG Description: preemption priority once the LSP is established,
lower is higher priority; default 0 indicates other LSPs
will not preempt the LSPs once established
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..255"]},
                        int_size=8,
                    ),
                    restriction_dict={"range": ["0..7"]},
                ),
                default=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                )(
                    0
                ),
                is_leaf=True,
                yang_name="hold-priority",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="uint8",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """hold_priority must be of a type compatible with uint8""",
                    "defined-type": "uint8",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..7']}), default=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8)(0), is_leaf=True, yang_name="hold-priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='uint8', is_config=True)""",
                }
            )

        self.__hold_priority = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_hold_priority(self):
        self.__hold_priority = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["0..7"]},
            ),
            default=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
            )(
                0
            ),
            is_leaf=True,
            yang_name="hold-priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )

    name = __builtin__.property(_get_name, _set_name)
    type = __builtin__.property(_get_type, _set_type)
    signaling_protocol = __builtin__.property(
        _get_signaling_protocol, _set_signaling_protocol
    )
    description = __builtin__.property(_get_description, _set_description)
    admin_status = __builtin__.property(_get_admin_status, _set_admin_status)
    preference = __builtin__.property(_get_preference, _set_preference)
    metric_type = __builtin__.property(_get_metric_type, _set_metric_type)
    metric = __builtin__.property(_get_metric, _set_metric)
    shortcut_eligible = __builtin__.property(
        _get_shortcut_eligible, _set_shortcut_eligible
    )
    protection_style_requested = __builtin__.property(
        _get_protection_style_requested, _set_protection_style_requested
    )
    reoptimize_timer = __builtin__.property(
        _get_reoptimize_timer, _set_reoptimize_timer
    )
    source = __builtin__.property(_get_source, _set_source)
    soft_preemption = __builtin__.property(_get_soft_preemption, _set_soft_preemption)
    setup_priority = __builtin__.property(_get_setup_priority, _set_setup_priority)
    hold_priority = __builtin__.property(_get_hold_priority, _set_hold_priority)

    _pyangbind_elements = OrderedDict(
        [
            ("name", name),
            ("type", type),
            ("signaling_protocol", signaling_protocol),
            ("description", description),
            ("admin_status", admin_status),
            ("preference", preference),
            ("metric_type", metric_type),
            ("metric", metric),
            ("shortcut_eligible", shortcut_eligible),
            ("protection_style_requested", protection_style_requested),
            ("reoptimize_timer", reoptimize_timer),
            ("source", source),
            ("soft_preemption", soft_preemption),
            ("setup_priority", setup_priority),
            ("hold_priority", hold_priority),
        ]
    )


class config(PybindBase):
    """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-network-instance-l2 - based on the path /network-instances/network-instance/mpls/lsps/constrained-path/tunnels/tunnel/config. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Configuration parameters related to TE tunnels:
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__name",
        "__type",
        "__signaling_protocol",
        "__description",
        "__admin_status",
        "__preference",
        "__metric_type",
        "__metric",
        "__shortcut_eligible",
        "__protection_style_requested",
        "__reoptimize_timer",
        "__source",
        "__soft_preemption",
        "__setup_priority",
        "__hold_priority",
    )

    _yang_name = "config"

    _pybind_generated_by = "container"

    def __init__(self, *args, **kwargs):

        self._path_helper = False

        self._extmethods = False
        self.__name = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="name",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=True,
        )
        self.__type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )
        self.__signaling_protocol = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="signaling-protocol",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )
        self.__description = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="description",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=True,
        )
        self.__admin_status = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:ADMIN_UP"),
            is_leaf=True,
            yang_name="admin-status",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )
        self.__preference = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["1..255"]},
            ),
            is_leaf=True,
            yang_name="preference",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )
        self.__metric_type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:LSP_METRIC_INHERITED"),
            is_leaf=True,
            yang_name="metric-type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )
        self.__metric = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["-2147483648..2147483647"]},
                int_size=32,
            ),
            is_leaf=True,
            yang_name="metric",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="int32",
            is_config=True,
        )
        self.__shortcut_eligible = YANGDynClass(
            base=YANGBool,
            default=YANGBool("true"),
            is_leaf=True,
            yang_name="shortcut-eligible",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=True,
        )
        self.__protection_style_requested = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:UNPROTECTED"),
            is_leaf=True,
            yang_name="protection-style-requested",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )
        self.__reoptimize_timer = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="reoptimize-timer",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint16",
            is_config=True,
        )
        self.__source = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "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])(%[\\p{N}\\p{L}]+)?"
                    },
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\\p{N}\\p{L}]+)?"
                    },
                ),
            ],
            is_leaf=True,
            yang_name="source",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="inet:ip-address",
            is_config=True,
        )
        self.__soft_preemption = YANGDynClass(
            base=YANGBool,
            default=YANGBool("false"),
            is_leaf=True,
            yang_name="soft-preemption",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=True,
        )
        self.__setup_priority = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["0..7"]},
            ),
            default=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
            )(
                7
            ),
            is_leaf=True,
            yang_name="setup-priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )
        self.__hold_priority = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["0..7"]},
            ),
            default=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
            )(
                0
            ),
            is_leaf=True,
            yang_name="hold-priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )

        load = kwargs.pop("load", None)
        if args:
            if len(args) > 1:
                raise TypeError("cannot create a YANG container with >1 argument")
            all_attr = True
            for e in self._pyangbind_elements:
                if not hasattr(args[0], e):
                    all_attr = False
                    break
            if not all_attr:
                raise ValueError("Supplied object did not have the correct attributes")
            for e in self._pyangbind_elements:
                nobj = getattr(args[0], e)
                if nobj._changed() is False:
                    continue
                setmethod = getattr(self, "_set_%s" % e)
                if load is None:
                    setmethod(getattr(args[0], e))
                else:
                    setmethod(getattr(args[0], e), load=load)

    def _path(self):
        if hasattr(self, "_parent"):
            return self._parent._path() + [self._yang_name]
        else:
            return [
                "network-instances",
                "network-instance",
                "mpls",
                "lsps",
                "constrained-path",
                "tunnels",
                "tunnel",
                "config",
            ]

    def _get_name(self):
        """
    Getter method for name, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/name (string)

    YANG Description: The tunnel name
    """
        return self.__name

    def _set_name(self, v, load=False):
        """
    Setter method for name, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/name (string)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_name is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_name() directly.

    YANG Description: The tunnel name
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="name",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="string",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """name must be of a type compatible with string""",
                    "defined-type": "string",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)""",
                }
            )

        self.__name = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_name(self):
        self.__name = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="name",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=True,
        )

    def _get_type(self):
        """
    Getter method for type, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/type (identityref)

    YANG Description: Tunnel type, p2p or p2mp
    """
        return self.__type

    def _set_type(self, v, load=False):
        """
    Setter method for type, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/type (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_type is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_type() directly.

    YANG Description: Tunnel type, p2p or p2mp
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "P2P": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:P2P": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:P2P": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:P2P": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "P2MP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:P2MP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:P2MP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:P2MP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                    },
                ),
                is_leaf=True,
                yang_name="type",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """type must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'P2P': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:P2P': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:P2P': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:P2P': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'P2MP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:P2MP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:P2MP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:P2MP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}},), is_leaf=True, yang_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__type = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_type(self):
        self.__type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:P2P": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:P2MP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    def _get_signaling_protocol(self):
        """
    Getter method for signaling_protocol, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/signaling_protocol (identityref)

    YANG Description: Signaling protocol used to set up this tunnel
    """
        return self.__signaling_protocol

    def _set_signaling_protocol(self, v, load=False):
        """
    Setter method for signaling_protocol, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/signaling_protocol (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_signaling_protocol is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_signaling_protocol() directly.

    YANG Description: Signaling protocol used to set up this tunnel
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "PATH_SETUP_RSVP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:PATH_SETUP_RSVP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:PATH_SETUP_RSVP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:PATH_SETUP_RSVP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "PATH_SETUP_SR": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:PATH_SETUP_SR": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:PATH_SETUP_SR": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:PATH_SETUP_SR": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "PATH_SETUP_LDP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:PATH_SETUP_LDP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:PATH_SETUP_LDP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:PATH_SETUP_LDP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                    },
                ),
                is_leaf=True,
                yang_name="signaling-protocol",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """signaling_protocol must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'PATH_SETUP_RSVP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:PATH_SETUP_RSVP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:PATH_SETUP_RSVP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:PATH_SETUP_RSVP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'PATH_SETUP_SR': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:PATH_SETUP_SR': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:PATH_SETUP_SR': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:PATH_SETUP_SR': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'PATH_SETUP_LDP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:PATH_SETUP_LDP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:PATH_SETUP_LDP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:PATH_SETUP_LDP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}},), is_leaf=True, yang_name="signaling-protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__signaling_protocol = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_signaling_protocol(self):
        self.__signaling_protocol = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_RSVP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_SR": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:PATH_SETUP_LDP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="signaling-protocol",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    def _get_description(self):
        """
    Getter method for description, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/description (string)

    YANG Description: optional text description for the tunnel
    """
        return self.__description

    def _set_description(self, v, load=False):
        """
    Setter method for description, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/description (string)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_description is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_description() directly.

    YANG Description: optional text description for the tunnel
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="description",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="string",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """description must be of a type compatible with string""",
                    "defined-type": "string",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)""",
                }
            )

        self.__description = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_description(self):
        self.__description = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="description",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=True,
        )

    def _get_admin_status(self):
        """
    Getter method for admin_status, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/admin_status (identityref)

    YANG Description: TE tunnel administrative state.
    """
        return self.__admin_status

    def _set_admin_status(self, v, load=False):
        """
    Setter method for admin_status, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/admin_status (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_admin_status is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_admin_status() directly.

    YANG Description: TE tunnel administrative state.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "ADMIN_DOWN": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:ADMIN_DOWN": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:ADMIN_DOWN": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:ADMIN_DOWN": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "ADMIN_UP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:ADMIN_UP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:ADMIN_UP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:ADMIN_UP": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                    },
                ),
                default=six.text_type("oc-mplst:ADMIN_UP"),
                is_leaf=True,
                yang_name="admin-status",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """admin_status must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'ADMIN_DOWN': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:ADMIN_DOWN': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:ADMIN_DOWN': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:ADMIN_DOWN': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'ADMIN_UP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:ADMIN_UP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:ADMIN_UP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:ADMIN_UP': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}},), default=six.text_type("oc-mplst:ADMIN_UP"), is_leaf=True, yang_name="admin-status", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__admin_status = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_admin_status(self):
        self.__admin_status = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:ADMIN_DOWN": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:ADMIN_UP": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:ADMIN_UP"),
            is_leaf=True,
            yang_name="admin-status",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    def _get_preference(self):
        """
    Getter method for preference, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/preference (uint8)

    YANG Description: Specifies a preference for this tunnel.
A lower number signifies a better preference
    """
        return self.__preference

    def _set_preference(self, v, load=False):
        """
    Setter method for preference, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/preference (uint8)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_preference is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_preference() directly.

    YANG Description: Specifies a preference for this tunnel.
A lower number signifies a better preference
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..255"]},
                        int_size=8,
                    ),
                    restriction_dict={"range": ["1..255"]},
                ),
                is_leaf=True,
                yang_name="preference",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="uint8",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """preference must be of a type compatible with uint8""",
                    "defined-type": "uint8",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['1..255']}), is_leaf=True, yang_name="preference", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='uint8', is_config=True)""",
                }
            )

        self.__preference = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_preference(self):
        self.__preference = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["1..255"]},
            ),
            is_leaf=True,
            yang_name="preference",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )

    def _get_metric_type(self):
        """
    Getter method for metric_type, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/metric_type (identityref)

    YANG Description: The type of metric specification that should be used to set
the LSP(s) metric
    """
        return self.__metric_type

    def _set_metric_type(self, v, load=False):
        """
    Setter method for metric_type, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/metric_type (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_metric_type is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_metric_type() directly.

    YANG Description: The type of metric specification that should be used to set
the LSP(s) metric
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "LSP_METRIC_RELATIVE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:LSP_METRIC_RELATIVE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:LSP_METRIC_RELATIVE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:LSP_METRIC_RELATIVE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "LSP_METRIC_ABSOLUTE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:LSP_METRIC_ABSOLUTE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:LSP_METRIC_ABSOLUTE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:LSP_METRIC_ABSOLUTE": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "LSP_METRIC_INHERITED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:LSP_METRIC_INHERITED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:LSP_METRIC_INHERITED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:LSP_METRIC_INHERITED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                    },
                ),
                default=six.text_type("oc-mplst:LSP_METRIC_INHERITED"),
                is_leaf=True,
                yang_name="metric-type",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """metric_type must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'LSP_METRIC_RELATIVE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:LSP_METRIC_RELATIVE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:LSP_METRIC_RELATIVE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:LSP_METRIC_RELATIVE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'LSP_METRIC_ABSOLUTE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:LSP_METRIC_ABSOLUTE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:LSP_METRIC_ABSOLUTE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:LSP_METRIC_ABSOLUTE': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'LSP_METRIC_INHERITED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:LSP_METRIC_INHERITED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:LSP_METRIC_INHERITED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:LSP_METRIC_INHERITED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}},), default=six.text_type("oc-mplst:LSP_METRIC_INHERITED"), is_leaf=True, yang_name="metric-type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__metric_type = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_metric_type(self):
        self.__metric_type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_RELATIVE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_ABSOLUTE": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LSP_METRIC_INHERITED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:LSP_METRIC_INHERITED"),
            is_leaf=True,
            yang_name="metric-type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    def _get_metric(self):
        """
    Getter method for metric, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/metric (int32)

    YANG Description: The value of the metric that should be specified. The value
supplied in this leaf is used in conjunction with the metric
type to determine the value of the metric used by the system.
Where the metric-type is set to LSP_METRIC_ABSOLUTE - the
value of this leaf is used directly; where it is set to
LSP_METRIC_RELATIVE, the relevant (positive or negative)
offset is used to formulate the metric; where metric-type
is LSP_METRIC_INHERITED, the value of this leaf is not
utilised
    """
        return self.__metric

    def _set_metric(self, v, load=False):
        """
    Setter method for metric, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/metric (int32)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_metric is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_metric() directly.

    YANG Description: The value of the metric that should be specified. The value
supplied in this leaf is used in conjunction with the metric
type to determine the value of the metric used by the system.
Where the metric-type is set to LSP_METRIC_ABSOLUTE - the
value of this leaf is used directly; where it is set to
LSP_METRIC_RELATIVE, the relevant (positive or negative)
offset is used to formulate the metric; where metric-type
is LSP_METRIC_INHERITED, the value of this leaf is not
utilised
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=long,
                    restriction_dict={"range": ["-2147483648..2147483647"]},
                    int_size=32,
                ),
                is_leaf=True,
                yang_name="metric",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="int32",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """metric must be of a type compatible with int32""",
                    "defined-type": "int32",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_size=32), is_leaf=True, yang_name="metric", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='int32', is_config=True)""",
                }
            )

        self.__metric = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_metric(self):
        self.__metric = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["-2147483648..2147483647"]},
                int_size=32,
            ),
            is_leaf=True,
            yang_name="metric",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="int32",
            is_config=True,
        )

    def _get_shortcut_eligible(self):
        """
    Getter method for shortcut_eligible, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/shortcut_eligible (boolean)

    YANG Description: Whether this LSP is considered to be eligible for us as a
shortcut in the IGP. In the case that this leaf is set to
true, the IGP SPF calculation uses the metric specified to
determine whether traffic should be carried over this LSP
    """
        return self.__shortcut_eligible

    def _set_shortcut_eligible(self, v, load=False):
        """
    Setter method for shortcut_eligible, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/shortcut_eligible (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_shortcut_eligible is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_shortcut_eligible() directly.

    YANG Description: Whether this LSP is considered to be eligible for us as a
shortcut in the IGP. In the case that this leaf is set to
true, the IGP SPF calculation uses the metric specified to
determine whether traffic should be carried over this LSP
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                default=YANGBool("true"),
                is_leaf=True,
                yang_name="shortcut-eligible",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="boolean",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """shortcut_eligible must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, default=YANGBool("true"), is_leaf=True, yang_name="shortcut-eligible", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=True)""",
                }
            )

        self.__shortcut_eligible = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_shortcut_eligible(self):
        self.__shortcut_eligible = YANGDynClass(
            base=YANGBool,
            default=YANGBool("true"),
            is_leaf=True,
            yang_name="shortcut-eligible",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=True,
        )

    def _get_protection_style_requested(self):
        """
    Getter method for protection_style_requested, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/protection_style_requested (identityref)

    YANG Description: style of mpls frr protection desired: can be
link, link-node or unprotected.
    """
        return self.__protection_style_requested

    def _set_protection_style_requested(self, v, load=False):
        """
    Setter method for protection_style_requested, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/protection_style_requested (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_protection_style_requested is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_protection_style_requested() directly.

    YANG Description: style of mpls frr protection desired: can be
link, link-node or unprotected.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "UNPROTECTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:UNPROTECTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:UNPROTECTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:UNPROTECTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "LINK_PROTECTION_REQUIRED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:LINK_PROTECTION_REQUIRED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:LINK_PROTECTION_REQUIRED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:LINK_PROTECTION_REQUIRED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "LINK_NODE_PROTECTION_REQUESTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:LINK_NODE_PROTECTION_REQUESTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:LINK_NODE_PROTECTION_REQUESTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:LINK_NODE_PROTECTION_REQUESTED": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                    },
                ),
                default=six.text_type("oc-mplst:UNPROTECTED"),
                is_leaf=True,
                yang_name="protection-style-requested",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """protection_style_requested must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'UNPROTECTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:UNPROTECTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:UNPROTECTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:UNPROTECTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'LINK_PROTECTION_REQUIRED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:LINK_PROTECTION_REQUIRED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:LINK_PROTECTION_REQUIRED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:LINK_PROTECTION_REQUIRED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'LINK_NODE_PROTECTION_REQUESTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:LINK_NODE_PROTECTION_REQUESTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:LINK_NODE_PROTECTION_REQUESTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:LINK_NODE_PROTECTION_REQUESTED': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}},), default=six.text_type("oc-mplst:UNPROTECTED"), is_leaf=True, yang_name="protection-style-requested", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__protection_style_requested = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_protection_style_requested(self):
        self.__protection_style_requested = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:UNPROTECTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LINK_PROTECTION_REQUIRED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:LINK_NODE_PROTECTION_REQUESTED": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                },
            ),
            default=six.text_type("oc-mplst:UNPROTECTED"),
            is_leaf=True,
            yang_name="protection-style-requested",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    def _get_reoptimize_timer(self):
        """
    Getter method for reoptimize_timer, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/reoptimize_timer (uint16)

    YANG Description: frequency of reoptimization of
a traffic engineered LSP
    """
        return self.__reoptimize_timer

    def _set_reoptimize_timer(self, v, load=False):
        """
    Setter method for reoptimize_timer, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/reoptimize_timer (uint16)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_reoptimize_timer is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_reoptimize_timer() directly.

    YANG Description: frequency of reoptimization of
a traffic engineered LSP
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
                ),
                is_leaf=True,
                yang_name="reoptimize-timer",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="uint16",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """reoptimize_timer must be of a type compatible with uint16""",
                    "defined-type": "uint16",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), is_leaf=True, yang_name="reoptimize-timer", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='uint16', is_config=True)""",
                }
            )

        self.__reoptimize_timer = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_reoptimize_timer(self):
        self.__reoptimize_timer = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="reoptimize-timer",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint16",
            is_config=True,
        )

    def _get_source(self):
        """
    Getter method for source, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/source (inet:ip-address)

    YANG Description: RSVP-TE tunnel source address
    """
        return self.__source

    def _set_source(self, v, load=False):
        """
    Setter method for source, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/source (inet:ip-address)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_source is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_source() directly.

    YANG Description: RSVP-TE tunnel source address
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_dict={
                            "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])(%[\\p{N}\\p{L}]+)?"
                        },
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_dict={
                            "pattern": "((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\\p{N}\\p{L}]+)?"
                        },
                    ),
                ],
                is_leaf=True,
                yang_name="source",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="inet:ip-address",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """source must be of a type compatible with inet:ip-address""",
                    "defined-type": "inet:ip-address",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={'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])(%[\\p{N}\\p{L}]+)?'}),RestrictedClassType(base_type=six.text_type, restriction_dict={'pattern': '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\\p{N}\\p{L}]+)?'}),], is_leaf=True, yang_name="source", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='inet:ip-address', is_config=True)""",
                }
            )

        self.__source = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_source(self):
        self.__source = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "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])(%[\\p{N}\\p{L}]+)?"
                    },
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\\p{N}\\p{L}]+)?"
                    },
                ),
            ],
            is_leaf=True,
            yang_name="source",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="inet:ip-address",
            is_config=True,
        )

    def _get_soft_preemption(self):
        """
    Getter method for soft_preemption, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/soft_preemption (boolean)

    YANG Description: Enables RSVP soft-preemption on this LSP
    """
        return self.__soft_preemption

    def _set_soft_preemption(self, v, load=False):
        """
    Setter method for soft_preemption, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/soft_preemption (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_soft_preemption is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_soft_preemption() directly.

    YANG Description: Enables RSVP soft-preemption on this LSP
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                default=YANGBool("false"),
                is_leaf=True,
                yang_name="soft-preemption",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="boolean",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """soft_preemption must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="soft-preemption", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=True)""",
                }
            )

        self.__soft_preemption = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_soft_preemption(self):
        self.__soft_preemption = YANGDynClass(
            base=YANGBool,
            default=YANGBool("false"),
            is_leaf=True,
            yang_name="soft-preemption",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=True,
        )

    def _get_setup_priority(self):
        """
    Getter method for setup_priority, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/setup_priority (uint8)

    YANG Description: RSVP-TE preemption priority during LSP setup, lower is
higher priority; default 7 indicates that LSP will not
preempt established LSPs during setup
    """
        return self.__setup_priority

    def _set_setup_priority(self, v, load=False):
        """
    Setter method for setup_priority, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/setup_priority (uint8)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_setup_priority is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_setup_priority() directly.

    YANG Description: RSVP-TE preemption priority during LSP setup, lower is
higher priority; default 7 indicates that LSP will not
preempt established LSPs during setup
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..255"]},
                        int_size=8,
                    ),
                    restriction_dict={"range": ["0..7"]},
                ),
                default=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                )(
                    7
                ),
                is_leaf=True,
                yang_name="setup-priority",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="uint8",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """setup_priority must be of a type compatible with uint8""",
                    "defined-type": "uint8",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..7']}), default=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8)(7), is_leaf=True, yang_name="setup-priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='uint8', is_config=True)""",
                }
            )

        self.__setup_priority = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_setup_priority(self):
        self.__setup_priority = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["0..7"]},
            ),
            default=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
            )(
                7
            ),
            is_leaf=True,
            yang_name="setup-priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )

    def _get_hold_priority(self):
        """
    Getter method for hold_priority, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/hold_priority (uint8)

    YANG Description: preemption priority once the LSP is established,
lower is higher priority; default 0 indicates other LSPs
will not preempt the LSPs once established
    """
        return self.__hold_priority

    def _set_hold_priority(self, v, load=False):
        """
    Setter method for hold_priority, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/hold_priority (uint8)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_hold_priority is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_hold_priority() directly.

    YANG Description: preemption priority once the LSP is established,
lower is higher priority; default 0 indicates other LSPs
will not preempt the LSPs once established
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..255"]},
                        int_size=8,
                    ),
                    restriction_dict={"range": ["0..7"]},
                ),
                default=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                )(
                    0
                ),
                is_leaf=True,
                yang_name="hold-priority",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="uint8",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """hold_priority must be of a type compatible with uint8""",
                    "defined-type": "uint8",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..7']}), default=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8)(0), is_leaf=True, yang_name="hold-priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='uint8', is_config=True)""",
                }
            )

        self.__hold_priority = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_hold_priority(self):
        self.__hold_priority = YANGDynClass(
            base=RestrictedClassType(
                base_type=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                restriction_dict={"range": ["0..7"]},
            ),
            default=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
            )(
                0
            ),
            is_leaf=True,
            yang_name="hold-priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=True,
        )

    name = __builtin__.property(_get_name, _set_name)
    type = __builtin__.property(_get_type, _set_type)
    signaling_protocol = __builtin__.property(
        _get_signaling_protocol, _set_signaling_protocol
    )
    description = __builtin__.property(_get_description, _set_description)
    admin_status = __builtin__.property(_get_admin_status, _set_admin_status)
    preference = __builtin__.property(_get_preference, _set_preference)
    metric_type = __builtin__.property(_get_metric_type, _set_metric_type)
    metric = __builtin__.property(_get_metric, _set_metric)
    shortcut_eligible = __builtin__.property(
        _get_shortcut_eligible, _set_shortcut_eligible
    )
    protection_style_requested = __builtin__.property(
        _get_protection_style_requested, _set_protection_style_requested
    )
    reoptimize_timer = __builtin__.property(
        _get_reoptimize_timer, _set_reoptimize_timer
    )
    source = __builtin__.property(_get_source, _set_source)
    soft_preemption = __builtin__.property(_get_soft_preemption, _set_soft_preemption)
    setup_priority = __builtin__.property(_get_setup_priority, _set_setup_priority)
    hold_priority = __builtin__.property(_get_hold_priority, _set_hold_priority)

    _pyangbind_elements = OrderedDict(
        [
            ("name", name),
            ("type", type),
            ("signaling_protocol", signaling_protocol),
            ("description", description),
            ("admin_status", admin_status),
            ("preference", preference),
            ("metric_type", metric_type),
            ("metric", metric),
            ("shortcut_eligible", shortcut_eligible),
            ("protection_style_requested", protection_style_requested),
            ("reoptimize_timer", reoptimize_timer),
            ("source", source),
            ("soft_preemption", soft_preemption),
            ("setup_priority", setup_priority),
            ("hold_priority", hold_priority),
        ]
    )
