# -*- 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__

from . import sender_tspec


class state(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/signaling-protocols/rsvp-te/sessions/session/state. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Operational state parameters relating to the
RSVP session
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__local_index",
        "__source_address",
        "__destination_address",
        "__tunnel_id",
        "__lsp_id",
        "__session_name",
        "__status",
        "__type",
        "__protection_requested",
        "__label_in",
        "__label_out",
        "__sender_tspec",
    )

    _yang_name = "state"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__local_index = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="local-index",
            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="uint64",
            is_config=False,
        )
        self.__source_address = 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-address",
            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=False,
        )
        self.__destination_address = 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="destination-address",
            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=False,
        )
        self.__tunnel_id = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="tunnel-id",
            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=False,
        )
        self.__lsp_id = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="lsp-id",
            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=False,
        )
        self.__session_name = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="session-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=False,
        )
        self.__status = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={"UP": {}, "DOWN": {}},
            ),
            is_leaf=True,
            yang_name="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="enumeration",
            is_config=False,
        )
        self.__type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:TRANSIT": {
                        "@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=False,
        )
        self.__protection_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",
                    },
                },
            ),
            is_leaf=True,
            yang_name="protection-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=False,
        )
        self.__label_in = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=long,
                        restriction_dict={"range": ["0..4294967295"]},
                        int_size=32,
                    ),
                    restriction_dict={"range": ["16..1048575"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "IPV4_EXPLICIT_NULL": {"value": 0},
                        "ROUTER_ALERT": {"value": 1},
                        "IPV6_EXPLICIT_NULL": {"value": 2},
                        "IMPLICIT_NULL": {"value": 3},
                        "ENTROPY_LABEL_INDICATOR": {"value": 7},
                        "NO_LABEL": {},
                    },
                ),
            ],
            is_leaf=True,
            yang_name="label-in",
            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="oc-mplst:mpls-label",
            is_config=False,
        )
        self.__label_out = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=long,
                        restriction_dict={"range": ["0..4294967295"]},
                        int_size=32,
                    ),
                    restriction_dict={"range": ["16..1048575"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "IPV4_EXPLICIT_NULL": {"value": 0},
                        "ROUTER_ALERT": {"value": 1},
                        "IPV6_EXPLICIT_NULL": {"value": 2},
                        "IMPLICIT_NULL": {"value": 3},
                        "ENTROPY_LABEL_INDICATOR": {"value": 7},
                        "NO_LABEL": {},
                    },
                ),
            ],
            is_leaf=True,
            yang_name="label-out",
            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="oc-mplst:mpls-label",
            is_config=False,
        )
        self.__sender_tspec = YANGDynClass(
            base=sender_tspec.sender_tspec,
            is_container="container",
            yang_name="sender-tspec",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=False,
        )

        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",
                "signaling-protocols",
                "rsvp-te",
                "sessions",
                "session",
                "state",
            ]

    def _get_local_index(self):
        """
    Getter method for local_index, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/local_index (uint64)

    YANG Description: The index used to identify the RSVP session
on the local network element. This index is
generated by the device and is unique only
to the local network element.
    """
        return self.__local_index

    def _set_local_index(self, v, load=False):
        """
    Setter method for local_index, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/local_index (uint64)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_local_index is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_local_index() directly.

    YANG Description: The index used to identify the RSVP session
on the local network element. This index is
generated by the device and is unique only
to the local network element.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=long,
                    restriction_dict={"range": ["0..18446744073709551615"]},
                    int_size=64,
                ),
                is_leaf=True,
                yang_name="local-index",
                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="uint64",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """local_index must be of a type compatible with uint64""",
                    "defined-type": "uint64",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="local-index", 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='uint64', is_config=False)""",
                }
            )

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

    def _unset_local_index(self):
        self.__local_index = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="local-index",
            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="uint64",
            is_config=False,
        )

    def _get_source_address(self):
        """
    Getter method for source_address, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/source_address (inet:ip-address)

    YANG Description: Origin address of RSVP session
    """
        return self.__source_address

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

    YANG Description: Origin address of RSVP session
    """
        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-address",
                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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """source_address 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-address", 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=False)""",
                }
            )

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

    def _unset_source_address(self):
        self.__source_address = 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-address",
            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=False,
        )

    def _get_destination_address(self):
        """
    Getter method for destination_address, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/destination_address (inet:ip-address)

    YANG Description: Destination address of RSVP session
    """
        return self.__destination_address

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

    YANG Description: Destination address of RSVP session
    """
        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="destination-address",
                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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """destination_address 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="destination-address", 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=False)""",
                }
            )

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

    def _unset_destination_address(self):
        self.__destination_address = 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="destination-address",
            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=False,
        )

    def _get_tunnel_id(self):
        """
    Getter method for tunnel_id, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/tunnel_id (uint16)

    YANG Description: The tunnel ID is an identifier used in the
RSVP session, which remains constant over
the life of the tunnel.
    """
        return self.__tunnel_id

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

    YANG Description: The tunnel ID is an identifier used in the
RSVP session, which remains constant over
the life of the tunnel.
    """
        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="tunnel-id",
                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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """tunnel_id 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="tunnel-id", 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=False)""",
                }
            )

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

    def _unset_tunnel_id(self):
        self.__tunnel_id = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="tunnel-id",
            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=False,
        )

    def _get_lsp_id(self):
        """
    Getter method for lsp_id, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/lsp_id (uint16)

    YANG Description: The LSP ID distinguishes between two LSPs
originated from the same headend, and is
commonly used to distinguish RSVP sessions
during make before break operations.
    """
        return self.__lsp_id

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

    YANG Description: The LSP ID distinguishes between two LSPs
originated from the same headend, and is
commonly used to distinguish RSVP sessions
during make before break operations.
    """
        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="lsp-id",
                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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """lsp_id 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="lsp-id", 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=False)""",
                }
            )

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

    def _unset_lsp_id(self):
        self.__lsp_id = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="lsp-id",
            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=False,
        )

    def _get_session_name(self):
        """
    Getter method for session_name, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/session_name (string)

    YANG Description: The signaled name of this RSVP session.
    """
        return self.__session_name

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

    YANG Description: The signaled name of this RSVP session.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="session-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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """session_name must be of a type compatible with string""",
                    "defined-type": "string",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="session-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=False)""",
                }
            )

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

    def _unset_session_name(self):
        self.__session_name = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="session-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=False,
        )

    def _get_status(self):
        """
    Getter method for status, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/status (enumeration)

    YANG Description: Enumeration of RSVP session states
    """
        return self.__status

    def _set_status(self, v, load=False):
        """
    Setter method for status, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/status (enumeration)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_status is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_status() directly.

    YANG Description: Enumeration of RSVP session states
    """
        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={"UP": {}, "DOWN": {}},
                ),
                is_leaf=True,
                yang_name="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="enumeration",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """status must be of a type compatible with enumeration""",
                    "defined-type": "openconfig-network-instance:enumeration",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'UP': {}, 'DOWN': {}},), is_leaf=True, yang_name="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='enumeration', is_config=False)""",
                }
            )

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

    def _unset_status(self):
        self.__status = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={"UP": {}, "DOWN": {}},
            ),
            is_leaf=True,
            yang_name="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="enumeration",
            is_config=False,
        )

    def _get_type(self):
        """
    Getter method for type, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/type (identityref)

    YANG Description: The type/role of the RSVP session, signifing
the session's role on the current device, such as
a transit session vs. an ingress session.
    """
        return self.__type

    def _set_type(self, v, load=False):
        """
    Setter method for type, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/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: The type/role of the RSVP session, signifing
the session's role on the current device, such as
a transit session vs. an ingress session.
    """
        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={
                        "INGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:INGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:INGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:INGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "EGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:EGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:EGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:EGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "TRANSIT": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:TRANSIT": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:TRANSIT": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:TRANSIT": {
                            "@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=False,
            )
        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={'INGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:INGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:INGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:INGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'EGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:EGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:EGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:EGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'TRANSIT': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:TRANSIT': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:TRANSIT': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:TRANSIT': {'@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=False)""",
                }
            )

        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={
                    "INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:TRANSIT": {
                        "@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=False,
        )

    def _get_protection_requested(self):
        """
    Getter method for protection_requested, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/protection_requested (identityref)

    YANG Description: The type of protection requested for the RSVP session
    """
        return self.__protection_requested

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

    YANG Description: The type of protection requested for the RSVP session
    """
        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",
                        },
                    },
                ),
                is_leaf=True,
                yang_name="protection-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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """protection_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'}},), is_leaf=True, yang_name="protection-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=False)""",
                }
            )

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

    def _unset_protection_requested(self):
        self.__protection_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",
                    },
                },
            ),
            is_leaf=True,
            yang_name="protection-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=False,
        )

    def _get_label_in(self):
        """
    Getter method for label_in, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/label_in (oc-mplst:mpls-label)

    YANG Description: Incoming MPLS label associated with this RSVP session
    """
        return self.__label_in

    def _set_label_in(self, v, load=False):
        """
    Setter method for label_in, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/label_in (oc-mplst:mpls-label)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_label_in is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_label_in() directly.

    YANG Description: Incoming MPLS label associated with this RSVP session
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=RestrictedClassType(
                            base_type=long,
                            restriction_dict={"range": ["0..4294967295"]},
                            int_size=32,
                        ),
                        restriction_dict={"range": ["16..1048575"]},
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={
                            "IPV4_EXPLICIT_NULL": {"value": 0},
                            "ROUTER_ALERT": {"value": 1},
                            "IPV6_EXPLICIT_NULL": {"value": 2},
                            "IMPLICIT_NULL": {"value": 3},
                            "ENTROPY_LABEL_INDICATOR": {"value": 7},
                            "NO_LABEL": {},
                        },
                    ),
                ],
                is_leaf=True,
                yang_name="label-in",
                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="oc-mplst:mpls-label",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """label_in must be of a type compatible with oc-mplst:mpls-label""",
                    "defined-type": "oc-mplst:mpls-label",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['16..1048575']}),RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'IPV4_EXPLICIT_NULL': {'value': 0}, 'ROUTER_ALERT': {'value': 1}, 'IPV6_EXPLICIT_NULL': {'value': 2}, 'IMPLICIT_NULL': {'value': 3}, 'ENTROPY_LABEL_INDICATOR': {'value': 7}, 'NO_LABEL': {}},),], is_leaf=True, yang_name="label-in", 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='oc-mplst:mpls-label', is_config=False)""",
                }
            )

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

    def _unset_label_in(self):
        self.__label_in = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=long,
                        restriction_dict={"range": ["0..4294967295"]},
                        int_size=32,
                    ),
                    restriction_dict={"range": ["16..1048575"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "IPV4_EXPLICIT_NULL": {"value": 0},
                        "ROUTER_ALERT": {"value": 1},
                        "IPV6_EXPLICIT_NULL": {"value": 2},
                        "IMPLICIT_NULL": {"value": 3},
                        "ENTROPY_LABEL_INDICATOR": {"value": 7},
                        "NO_LABEL": {},
                    },
                ),
            ],
            is_leaf=True,
            yang_name="label-in",
            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="oc-mplst:mpls-label",
            is_config=False,
        )

    def _get_label_out(self):
        """
    Getter method for label_out, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/label_out (oc-mplst:mpls-label)

    YANG Description: Outgoing MPLS label associated with this RSVP session
    """
        return self.__label_out

    def _set_label_out(self, v, load=False):
        """
    Setter method for label_out, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/label_out (oc-mplst:mpls-label)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_label_out is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_label_out() directly.

    YANG Description: Outgoing MPLS label associated with this RSVP session
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=RestrictedClassType(
                            base_type=long,
                            restriction_dict={"range": ["0..4294967295"]},
                            int_size=32,
                        ),
                        restriction_dict={"range": ["16..1048575"]},
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={
                            "IPV4_EXPLICIT_NULL": {"value": 0},
                            "ROUTER_ALERT": {"value": 1},
                            "IPV6_EXPLICIT_NULL": {"value": 2},
                            "IMPLICIT_NULL": {"value": 3},
                            "ENTROPY_LABEL_INDICATOR": {"value": 7},
                            "NO_LABEL": {},
                        },
                    ),
                ],
                is_leaf=True,
                yang_name="label-out",
                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="oc-mplst:mpls-label",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """label_out must be of a type compatible with oc-mplst:mpls-label""",
                    "defined-type": "oc-mplst:mpls-label",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['16..1048575']}),RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'IPV4_EXPLICIT_NULL': {'value': 0}, 'ROUTER_ALERT': {'value': 1}, 'IPV6_EXPLICIT_NULL': {'value': 2}, 'IMPLICIT_NULL': {'value': 3}, 'ENTROPY_LABEL_INDICATOR': {'value': 7}, 'NO_LABEL': {}},),], is_leaf=True, yang_name="label-out", 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='oc-mplst:mpls-label', is_config=False)""",
                }
            )

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

    def _unset_label_out(self):
        self.__label_out = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=long,
                        restriction_dict={"range": ["0..4294967295"]},
                        int_size=32,
                    ),
                    restriction_dict={"range": ["16..1048575"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "IPV4_EXPLICIT_NULL": {"value": 0},
                        "ROUTER_ALERT": {"value": 1},
                        "IPV6_EXPLICIT_NULL": {"value": 2},
                        "IMPLICIT_NULL": {"value": 3},
                        "ENTROPY_LABEL_INDICATOR": {"value": 7},
                        "NO_LABEL": {},
                    },
                ),
            ],
            is_leaf=True,
            yang_name="label-out",
            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="oc-mplst:mpls-label",
            is_config=False,
        )

    def _get_sender_tspec(self):
        """
    Getter method for sender_tspec, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/sender_tspec (container)

    YANG Description: Operational state statistics relating to the SENDER_TSPEC
received for the RSVP session
    """
        return self.__sender_tspec

    def _set_sender_tspec(self, v, load=False):
        """
    Setter method for sender_tspec, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/sender_tspec (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_sender_tspec is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_sender_tspec() directly.

    YANG Description: Operational state statistics relating to the SENDER_TSPEC
received for the RSVP session
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=sender_tspec.sender_tspec,
                is_container="container",
                yang_name="sender-tspec",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                extensions=None,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="container",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """sender_tspec must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=sender_tspec.sender_tspec, is_container='container', yang_name="sender-tspec", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=False)""",
                }
            )

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

    def _unset_sender_tspec(self):
        self.__sender_tspec = YANGDynClass(
            base=sender_tspec.sender_tspec,
            is_container="container",
            yang_name="sender-tspec",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=False,
        )

    local_index = __builtin__.property(_get_local_index)
    source_address = __builtin__.property(_get_source_address)
    destination_address = __builtin__.property(_get_destination_address)
    tunnel_id = __builtin__.property(_get_tunnel_id)
    lsp_id = __builtin__.property(_get_lsp_id)
    session_name = __builtin__.property(_get_session_name)
    status = __builtin__.property(_get_status)
    type = __builtin__.property(_get_type)
    protection_requested = __builtin__.property(_get_protection_requested)
    label_in = __builtin__.property(_get_label_in)
    label_out = __builtin__.property(_get_label_out)
    sender_tspec = __builtin__.property(_get_sender_tspec)

    _pyangbind_elements = OrderedDict(
        [
            ("local_index", local_index),
            ("source_address", source_address),
            ("destination_address", destination_address),
            ("tunnel_id", tunnel_id),
            ("lsp_id", lsp_id),
            ("session_name", session_name),
            ("status", status),
            ("type", type),
            ("protection_requested", protection_requested),
            ("label_in", label_in),
            ("label_out", label_out),
            ("sender_tspec", sender_tspec),
        ]
    )


from . import sender_tspec


class state(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/signaling-protocols/rsvp-te/sessions/session/state. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Operational state parameters relating to the
RSVP session
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__local_index",
        "__source_address",
        "__destination_address",
        "__tunnel_id",
        "__lsp_id",
        "__session_name",
        "__status",
        "__type",
        "__protection_requested",
        "__label_in",
        "__label_out",
        "__sender_tspec",
    )

    _yang_name = "state"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__local_index = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="local-index",
            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="uint64",
            is_config=False,
        )
        self.__source_address = 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-address",
            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=False,
        )
        self.__destination_address = 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="destination-address",
            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=False,
        )
        self.__tunnel_id = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="tunnel-id",
            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=False,
        )
        self.__lsp_id = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="lsp-id",
            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=False,
        )
        self.__session_name = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="session-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=False,
        )
        self.__status = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={"UP": {}, "DOWN": {}},
            ),
            is_leaf=True,
            yang_name="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="enumeration",
            is_config=False,
        )
        self.__type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:TRANSIT": {
                        "@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=False,
        )
        self.__protection_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",
                    },
                },
            ),
            is_leaf=True,
            yang_name="protection-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=False,
        )
        self.__label_in = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=long,
                        restriction_dict={"range": ["0..4294967295"]},
                        int_size=32,
                    ),
                    restriction_dict={"range": ["16..1048575"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "IPV4_EXPLICIT_NULL": {"value": 0},
                        "ROUTER_ALERT": {"value": 1},
                        "IPV6_EXPLICIT_NULL": {"value": 2},
                        "IMPLICIT_NULL": {"value": 3},
                        "ENTROPY_LABEL_INDICATOR": {"value": 7},
                        "NO_LABEL": {},
                    },
                ),
            ],
            is_leaf=True,
            yang_name="label-in",
            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="oc-mplst:mpls-label",
            is_config=False,
        )
        self.__label_out = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=long,
                        restriction_dict={"range": ["0..4294967295"]},
                        int_size=32,
                    ),
                    restriction_dict={"range": ["16..1048575"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "IPV4_EXPLICIT_NULL": {"value": 0},
                        "ROUTER_ALERT": {"value": 1},
                        "IPV6_EXPLICIT_NULL": {"value": 2},
                        "IMPLICIT_NULL": {"value": 3},
                        "ENTROPY_LABEL_INDICATOR": {"value": 7},
                        "NO_LABEL": {},
                    },
                ),
            ],
            is_leaf=True,
            yang_name="label-out",
            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="oc-mplst:mpls-label",
            is_config=False,
        )
        self.__sender_tspec = YANGDynClass(
            base=sender_tspec.sender_tspec,
            is_container="container",
            yang_name="sender-tspec",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=False,
        )

        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",
                "signaling-protocols",
                "rsvp-te",
                "sessions",
                "session",
                "state",
            ]

    def _get_local_index(self):
        """
    Getter method for local_index, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/local_index (uint64)

    YANG Description: The index used to identify the RSVP session
on the local network element. This index is
generated by the device and is unique only
to the local network element.
    """
        return self.__local_index

    def _set_local_index(self, v, load=False):
        """
    Setter method for local_index, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/local_index (uint64)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_local_index is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_local_index() directly.

    YANG Description: The index used to identify the RSVP session
on the local network element. This index is
generated by the device and is unique only
to the local network element.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=long,
                    restriction_dict={"range": ["0..18446744073709551615"]},
                    int_size=64,
                ),
                is_leaf=True,
                yang_name="local-index",
                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="uint64",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """local_index must be of a type compatible with uint64""",
                    "defined-type": "uint64",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="local-index", 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='uint64', is_config=False)""",
                }
            )

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

    def _unset_local_index(self):
        self.__local_index = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="local-index",
            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="uint64",
            is_config=False,
        )

    def _get_source_address(self):
        """
    Getter method for source_address, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/source_address (inet:ip-address)

    YANG Description: Origin address of RSVP session
    """
        return self.__source_address

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

    YANG Description: Origin address of RSVP session
    """
        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-address",
                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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """source_address 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-address", 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=False)""",
                }
            )

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

    def _unset_source_address(self):
        self.__source_address = 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-address",
            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=False,
        )

    def _get_destination_address(self):
        """
    Getter method for destination_address, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/destination_address (inet:ip-address)

    YANG Description: Destination address of RSVP session
    """
        return self.__destination_address

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

    YANG Description: Destination address of RSVP session
    """
        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="destination-address",
                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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """destination_address 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="destination-address", 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=False)""",
                }
            )

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

    def _unset_destination_address(self):
        self.__destination_address = 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="destination-address",
            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=False,
        )

    def _get_tunnel_id(self):
        """
    Getter method for tunnel_id, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/tunnel_id (uint16)

    YANG Description: The tunnel ID is an identifier used in the
RSVP session, which remains constant over
the life of the tunnel.
    """
        return self.__tunnel_id

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

    YANG Description: The tunnel ID is an identifier used in the
RSVP session, which remains constant over
the life of the tunnel.
    """
        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="tunnel-id",
                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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """tunnel_id 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="tunnel-id", 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=False)""",
                }
            )

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

    def _unset_tunnel_id(self):
        self.__tunnel_id = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="tunnel-id",
            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=False,
        )

    def _get_lsp_id(self):
        """
    Getter method for lsp_id, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/lsp_id (uint16)

    YANG Description: The LSP ID distinguishes between two LSPs
originated from the same headend, and is
commonly used to distinguish RSVP sessions
during make before break operations.
    """
        return self.__lsp_id

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

    YANG Description: The LSP ID distinguishes between two LSPs
originated from the same headend, and is
commonly used to distinguish RSVP sessions
during make before break operations.
    """
        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="lsp-id",
                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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """lsp_id 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="lsp-id", 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=False)""",
                }
            )

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

    def _unset_lsp_id(self):
        self.__lsp_id = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="lsp-id",
            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=False,
        )

    def _get_session_name(self):
        """
    Getter method for session_name, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/session_name (string)

    YANG Description: The signaled name of this RSVP session.
    """
        return self.__session_name

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

    YANG Description: The signaled name of this RSVP session.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="session-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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """session_name must be of a type compatible with string""",
                    "defined-type": "string",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="session-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=False)""",
                }
            )

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

    def _unset_session_name(self):
        self.__session_name = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="session-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=False,
        )

    def _get_status(self):
        """
    Getter method for status, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/status (enumeration)

    YANG Description: Enumeration of RSVP session states
    """
        return self.__status

    def _set_status(self, v, load=False):
        """
    Setter method for status, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/status (enumeration)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_status is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_status() directly.

    YANG Description: Enumeration of RSVP session states
    """
        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={"UP": {}, "DOWN": {}},
                ),
                is_leaf=True,
                yang_name="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="enumeration",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """status must be of a type compatible with enumeration""",
                    "defined-type": "openconfig-network-instance:enumeration",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'UP': {}, 'DOWN': {}},), is_leaf=True, yang_name="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='enumeration', is_config=False)""",
                }
            )

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

    def _unset_status(self):
        self.__status = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={"UP": {}, "DOWN": {}},
            ),
            is_leaf=True,
            yang_name="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="enumeration",
            is_config=False,
        )

    def _get_type(self):
        """
    Getter method for type, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/type (identityref)

    YANG Description: The type/role of the RSVP session, signifing
the session's role on the current device, such as
a transit session vs. an ingress session.
    """
        return self.__type

    def _set_type(self, v, load=False):
        """
    Setter method for type, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/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: The type/role of the RSVP session, signifing
the session's role on the current device, such as
a transit session vs. an ingress session.
    """
        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={
                        "INGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:INGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:INGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:INGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "EGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:EGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:EGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:EGRESS": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "TRANSIT": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-types:TRANSIT": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mplst:TRANSIT": {
                            "@module": "openconfig-mpls-types",
                            "@namespace": "http://openconfig.net/yang/mpls-types",
                        },
                        "oc-mpls-t:TRANSIT": {
                            "@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=False,
            )
        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={'INGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:INGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:INGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:INGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'EGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:EGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:EGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:EGRESS': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'TRANSIT': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-types:TRANSIT': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mplst:TRANSIT': {'@module': 'openconfig-mpls-types', '@namespace': 'http://openconfig.net/yang/mpls-types'}, 'oc-mpls-t:TRANSIT': {'@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=False)""",
                }
            )

        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={
                    "INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:INGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:EGRESS": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-types:TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mplst:TRANSIT": {
                        "@module": "openconfig-mpls-types",
                        "@namespace": "http://openconfig.net/yang/mpls-types",
                    },
                    "oc-mpls-t:TRANSIT": {
                        "@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=False,
        )

    def _get_protection_requested(self):
        """
    Getter method for protection_requested, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/protection_requested (identityref)

    YANG Description: The type of protection requested for the RSVP session
    """
        return self.__protection_requested

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

    YANG Description: The type of protection requested for the RSVP session
    """
        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",
                        },
                    },
                ),
                is_leaf=True,
                yang_name="protection-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=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """protection_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'}},), is_leaf=True, yang_name="protection-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=False)""",
                }
            )

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

    def _unset_protection_requested(self):
        self.__protection_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",
                    },
                },
            ),
            is_leaf=True,
            yang_name="protection-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=False,
        )

    def _get_label_in(self):
        """
    Getter method for label_in, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/label_in (oc-mplst:mpls-label)

    YANG Description: Incoming MPLS label associated with this RSVP session
    """
        return self.__label_in

    def _set_label_in(self, v, load=False):
        """
    Setter method for label_in, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/label_in (oc-mplst:mpls-label)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_label_in is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_label_in() directly.

    YANG Description: Incoming MPLS label associated with this RSVP session
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=RestrictedClassType(
                            base_type=long,
                            restriction_dict={"range": ["0..4294967295"]},
                            int_size=32,
                        ),
                        restriction_dict={"range": ["16..1048575"]},
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={
                            "IPV4_EXPLICIT_NULL": {"value": 0},
                            "ROUTER_ALERT": {"value": 1},
                            "IPV6_EXPLICIT_NULL": {"value": 2},
                            "IMPLICIT_NULL": {"value": 3},
                            "ENTROPY_LABEL_INDICATOR": {"value": 7},
                            "NO_LABEL": {},
                        },
                    ),
                ],
                is_leaf=True,
                yang_name="label-in",
                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="oc-mplst:mpls-label",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """label_in must be of a type compatible with oc-mplst:mpls-label""",
                    "defined-type": "oc-mplst:mpls-label",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['16..1048575']}),RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'IPV4_EXPLICIT_NULL': {'value': 0}, 'ROUTER_ALERT': {'value': 1}, 'IPV6_EXPLICIT_NULL': {'value': 2}, 'IMPLICIT_NULL': {'value': 3}, 'ENTROPY_LABEL_INDICATOR': {'value': 7}, 'NO_LABEL': {}},),], is_leaf=True, yang_name="label-in", 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='oc-mplst:mpls-label', is_config=False)""",
                }
            )

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

    def _unset_label_in(self):
        self.__label_in = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=long,
                        restriction_dict={"range": ["0..4294967295"]},
                        int_size=32,
                    ),
                    restriction_dict={"range": ["16..1048575"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "IPV4_EXPLICIT_NULL": {"value": 0},
                        "ROUTER_ALERT": {"value": 1},
                        "IPV6_EXPLICIT_NULL": {"value": 2},
                        "IMPLICIT_NULL": {"value": 3},
                        "ENTROPY_LABEL_INDICATOR": {"value": 7},
                        "NO_LABEL": {},
                    },
                ),
            ],
            is_leaf=True,
            yang_name="label-in",
            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="oc-mplst:mpls-label",
            is_config=False,
        )

    def _get_label_out(self):
        """
    Getter method for label_out, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/label_out (oc-mplst:mpls-label)

    YANG Description: Outgoing MPLS label associated with this RSVP session
    """
        return self.__label_out

    def _set_label_out(self, v, load=False):
        """
    Setter method for label_out, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/label_out (oc-mplst:mpls-label)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_label_out is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_label_out() directly.

    YANG Description: Outgoing MPLS label associated with this RSVP session
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=RestrictedClassType(
                            base_type=long,
                            restriction_dict={"range": ["0..4294967295"]},
                            int_size=32,
                        ),
                        restriction_dict={"range": ["16..1048575"]},
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={
                            "IPV4_EXPLICIT_NULL": {"value": 0},
                            "ROUTER_ALERT": {"value": 1},
                            "IPV6_EXPLICIT_NULL": {"value": 2},
                            "IMPLICIT_NULL": {"value": 3},
                            "ENTROPY_LABEL_INDICATOR": {"value": 7},
                            "NO_LABEL": {},
                        },
                    ),
                ],
                is_leaf=True,
                yang_name="label-out",
                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="oc-mplst:mpls-label",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """label_out must be of a type compatible with oc-mplst:mpls-label""",
                    "defined-type": "oc-mplst:mpls-label",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['16..1048575']}),RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'IPV4_EXPLICIT_NULL': {'value': 0}, 'ROUTER_ALERT': {'value': 1}, 'IPV6_EXPLICIT_NULL': {'value': 2}, 'IMPLICIT_NULL': {'value': 3}, 'ENTROPY_LABEL_INDICATOR': {'value': 7}, 'NO_LABEL': {}},),], is_leaf=True, yang_name="label-out", 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='oc-mplst:mpls-label', is_config=False)""",
                }
            )

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

    def _unset_label_out(self):
        self.__label_out = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=long,
                        restriction_dict={"range": ["0..4294967295"]},
                        int_size=32,
                    ),
                    restriction_dict={"range": ["16..1048575"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "IPV4_EXPLICIT_NULL": {"value": 0},
                        "ROUTER_ALERT": {"value": 1},
                        "IPV6_EXPLICIT_NULL": {"value": 2},
                        "IMPLICIT_NULL": {"value": 3},
                        "ENTROPY_LABEL_INDICATOR": {"value": 7},
                        "NO_LABEL": {},
                    },
                ),
            ],
            is_leaf=True,
            yang_name="label-out",
            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="oc-mplst:mpls-label",
            is_config=False,
        )

    def _get_sender_tspec(self):
        """
    Getter method for sender_tspec, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/sender_tspec (container)

    YANG Description: Operational state statistics relating to the SENDER_TSPEC
received for the RSVP session
    """
        return self.__sender_tspec

    def _set_sender_tspec(self, v, load=False):
        """
    Setter method for sender_tspec, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/sessions/session/state/sender_tspec (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_sender_tspec is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_sender_tspec() directly.

    YANG Description: Operational state statistics relating to the SENDER_TSPEC
received for the RSVP session
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=sender_tspec.sender_tspec,
                is_container="container",
                yang_name="sender-tspec",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                extensions=None,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="container",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """sender_tspec must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=sender_tspec.sender_tspec, is_container='container', yang_name="sender-tspec", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=False)""",
                }
            )

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

    def _unset_sender_tspec(self):
        self.__sender_tspec = YANGDynClass(
            base=sender_tspec.sender_tspec,
            is_container="container",
            yang_name="sender-tspec",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=False,
        )

    local_index = __builtin__.property(_get_local_index)
    source_address = __builtin__.property(_get_source_address)
    destination_address = __builtin__.property(_get_destination_address)
    tunnel_id = __builtin__.property(_get_tunnel_id)
    lsp_id = __builtin__.property(_get_lsp_id)
    session_name = __builtin__.property(_get_session_name)
    status = __builtin__.property(_get_status)
    type = __builtin__.property(_get_type)
    protection_requested = __builtin__.property(_get_protection_requested)
    label_in = __builtin__.property(_get_label_in)
    label_out = __builtin__.property(_get_label_out)
    sender_tspec = __builtin__.property(_get_sender_tspec)

    _pyangbind_elements = OrderedDict(
        [
            ("local_index", local_index),
            ("source_address", source_address),
            ("destination_address", destination_address),
            ("tunnel_id", tunnel_id),
            ("lsp_id", lsp_id),
            ("session_name", session_name),
            ("status", status),
            ("type", type),
            ("protection_requested", protection_requested),
            ("label_in", label_in),
            ("label_out", label_out),
            ("sender_tspec", sender_tspec),
        ]
    )
