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

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

    long = int
elif six.PY2:
    import __builtin__


class 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/interface-attributes/interface/bandwidth-reservations/bandwidth-reservation/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 a
bandwidth reservation at a certain priority
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__priority",
        "__available_bandwidth",
        "__reserved_bandwidth",
        "__active_reservations_count",
        "__highwater_mark",
    )

    _yang_name = "state"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__priority = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..255"]},
                        int_size=8,
                    ),
                    restriction_dict={"range": ["0..7"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ALL": {}},
                ),
            ],
            is_leaf=True,
            yang_name="priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="union",
            is_config=False,
        )
        self.__available_bandwidth = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="available-bandwidth",
            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:bandwidth-mbps",
            is_config=False,
        )
        self.__reserved_bandwidth = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="reserved-bandwidth",
            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:bandwidth-mbps",
            is_config=False,
        )
        self.__active_reservations_count = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="active-reservations-count",
            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="yang:gauge64",
            is_config=False,
        )
        self.__highwater_mark = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="highwater-mark",
            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:bandwidth-mbps",
            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",
                "interface-attributes",
                "interface",
                "bandwidth-reservations",
                "bandwidth-reservation",
                "state",
            ]

    def _get_priority(self):
        """
    Getter method for priority, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/interface_attributes/interface/bandwidth_reservations/bandwidth_reservation/state/priority (union)

    YANG Description: RSVP priority level for LSPs traversing the interface
    """
        return self.__priority

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

    YANG Description: RSVP priority level for LSPs traversing the interface
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=RestrictedClassType(
                            base_type=int,
                            restriction_dict={"range": ["0..255"]},
                            int_size=8,
                        ),
                        restriction_dict={"range": ["0..7"]},
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={"ALL": {}},
                    ),
                ],
                is_leaf=True,
                yang_name="priority",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="union",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """priority must be of a type compatible with union""",
                    "defined-type": "openconfig-network-instance:union",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..7']}),RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'ALL': {}},),], is_leaf=True, yang_name="priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='union', is_config=False)""",
                }
            )

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

    def _unset_priority(self):
        self.__priority = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..255"]},
                        int_size=8,
                    ),
                    restriction_dict={"range": ["0..7"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ALL": {}},
                ),
            ],
            is_leaf=True,
            yang_name="priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="union",
            is_config=False,
        )

    def _get_available_bandwidth(self):
        """
    Getter method for available_bandwidth, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/interface_attributes/interface/bandwidth_reservations/bandwidth_reservation/state/available_bandwidth (oc-mplst:bandwidth-mbps)

    YANG Description: Bandwidth currently available with the priority level,
or for the entire interface when the priority is set to
ALL
    """
        return self.__available_bandwidth

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

    YANG Description: Bandwidth currently available with the priority level,
or for the entire interface when the priority is set to
ALL
    """
        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="available-bandwidth",
                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:bandwidth-mbps",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """available_bandwidth must be of a type compatible with oc-mplst:bandwidth-mbps""",
                    "defined-type": "oc-mplst:bandwidth-mbps",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="available-bandwidth", 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:bandwidth-mbps', is_config=False)""",
                }
            )

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

    def _unset_available_bandwidth(self):
        self.__available_bandwidth = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="available-bandwidth",
            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:bandwidth-mbps",
            is_config=False,
        )

    def _get_reserved_bandwidth(self):
        """
    Getter method for reserved_bandwidth, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/interface_attributes/interface/bandwidth_reservations/bandwidth_reservation/state/reserved_bandwidth (oc-mplst:bandwidth-mbps)

    YANG Description: Bandwidth currently reserved within the priority level,
or the sum of all priority levels when the keyword is set
to ALL
    """
        return self.__reserved_bandwidth

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

    YANG Description: Bandwidth currently reserved within the priority level,
or the sum of all priority levels when the keyword is set
to ALL
    """
        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="reserved-bandwidth",
                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:bandwidth-mbps",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """reserved_bandwidth must be of a type compatible with oc-mplst:bandwidth-mbps""",
                    "defined-type": "oc-mplst:bandwidth-mbps",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="reserved-bandwidth", 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:bandwidth-mbps', is_config=False)""",
                }
            )

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

    def _unset_reserved_bandwidth(self):
        self.__reserved_bandwidth = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="reserved-bandwidth",
            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:bandwidth-mbps",
            is_config=False,
        )

    def _get_active_reservations_count(self):
        """
    Getter method for active_reservations_count, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/interface_attributes/interface/bandwidth_reservations/bandwidth_reservation/state/active_reservations_count (yang:gauge64)

    YANG Description: Number of active RSVP reservations in the associated
priority, or the sum of all reservations when the priority
level is set to ALL
    """
        return self.__active_reservations_count

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

    YANG Description: Number of active RSVP reservations in the associated
priority, or the sum of all reservations when the priority
level is set to ALL
    """
        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="active-reservations-count",
                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="yang:gauge64",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """active_reservations_count must be of a type compatible with yang:gauge64""",
                    "defined-type": "yang:gauge64",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="active-reservations-count", 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='yang:gauge64', is_config=False)""",
                }
            )

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

    def _unset_active_reservations_count(self):
        self.__active_reservations_count = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="active-reservations-count",
            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="yang:gauge64",
            is_config=False,
        )

    def _get_highwater_mark(self):
        """
    Getter method for highwater_mark, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/interface_attributes/interface/bandwidth_reservations/bandwidth_reservation/state/highwater_mark (oc-mplst:bandwidth-mbps)

    YANG Description: Maximum bandwidth reserved on the interface within the
priority, or across all priorities in the case that the
priority level is set to ALL
    """
        return self.__highwater_mark

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

    YANG Description: Maximum bandwidth reserved on the interface within the
priority, or across all priorities in the case that the
priority level is set to ALL
    """
        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="highwater-mark",
                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:bandwidth-mbps",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """highwater_mark must be of a type compatible with oc-mplst:bandwidth-mbps""",
                    "defined-type": "oc-mplst:bandwidth-mbps",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="highwater-mark", 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:bandwidth-mbps', is_config=False)""",
                }
            )

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

    def _unset_highwater_mark(self):
        self.__highwater_mark = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="highwater-mark",
            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:bandwidth-mbps",
            is_config=False,
        )

    priority = __builtin__.property(_get_priority)
    available_bandwidth = __builtin__.property(_get_available_bandwidth)
    reserved_bandwidth = __builtin__.property(_get_reserved_bandwidth)
    active_reservations_count = __builtin__.property(_get_active_reservations_count)
    highwater_mark = __builtin__.property(_get_highwater_mark)

    _pyangbind_elements = OrderedDict(
        [
            ("priority", priority),
            ("available_bandwidth", available_bandwidth),
            ("reserved_bandwidth", reserved_bandwidth),
            ("active_reservations_count", active_reservations_count),
            ("highwater_mark", highwater_mark),
        ]
    )


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/interface-attributes/interface/bandwidth-reservations/bandwidth-reservation/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 a
bandwidth reservation at a certain priority
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__priority",
        "__available_bandwidth",
        "__reserved_bandwidth",
        "__active_reservations_count",
        "__highwater_mark",
    )

    _yang_name = "state"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__priority = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..255"]},
                        int_size=8,
                    ),
                    restriction_dict={"range": ["0..7"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ALL": {}},
                ),
            ],
            is_leaf=True,
            yang_name="priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="union",
            is_config=False,
        )
        self.__available_bandwidth = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="available-bandwidth",
            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:bandwidth-mbps",
            is_config=False,
        )
        self.__reserved_bandwidth = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="reserved-bandwidth",
            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:bandwidth-mbps",
            is_config=False,
        )
        self.__active_reservations_count = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="active-reservations-count",
            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="yang:gauge64",
            is_config=False,
        )
        self.__highwater_mark = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="highwater-mark",
            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:bandwidth-mbps",
            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",
                "interface-attributes",
                "interface",
                "bandwidth-reservations",
                "bandwidth-reservation",
                "state",
            ]

    def _get_priority(self):
        """
    Getter method for priority, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/interface_attributes/interface/bandwidth_reservations/bandwidth_reservation/state/priority (union)

    YANG Description: RSVP priority level for LSPs traversing the interface
    """
        return self.__priority

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

    YANG Description: RSVP priority level for LSPs traversing the interface
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=RestrictedClassType(
                            base_type=int,
                            restriction_dict={"range": ["0..255"]},
                            int_size=8,
                        ),
                        restriction_dict={"range": ["0..7"]},
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={"ALL": {}},
                    ),
                ],
                is_leaf=True,
                yang_name="priority",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="union",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """priority must be of a type compatible with union""",
                    "defined-type": "openconfig-network-instance:union",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': ['0..7']}),RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'ALL': {}},),], is_leaf=True, yang_name="priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='union', is_config=False)""",
                }
            )

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

    def _unset_priority(self):
        self.__priority = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..255"]},
                        int_size=8,
                    ),
                    restriction_dict={"range": ["0..7"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ALL": {}},
                ),
            ],
            is_leaf=True,
            yang_name="priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="union",
            is_config=False,
        )

    def _get_available_bandwidth(self):
        """
    Getter method for available_bandwidth, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/interface_attributes/interface/bandwidth_reservations/bandwidth_reservation/state/available_bandwidth (oc-mplst:bandwidth-mbps)

    YANG Description: Bandwidth currently available with the priority level,
or for the entire interface when the priority is set to
ALL
    """
        return self.__available_bandwidth

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

    YANG Description: Bandwidth currently available with the priority level,
or for the entire interface when the priority is set to
ALL
    """
        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="available-bandwidth",
                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:bandwidth-mbps",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """available_bandwidth must be of a type compatible with oc-mplst:bandwidth-mbps""",
                    "defined-type": "oc-mplst:bandwidth-mbps",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="available-bandwidth", 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:bandwidth-mbps', is_config=False)""",
                }
            )

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

    def _unset_available_bandwidth(self):
        self.__available_bandwidth = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="available-bandwidth",
            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:bandwidth-mbps",
            is_config=False,
        )

    def _get_reserved_bandwidth(self):
        """
    Getter method for reserved_bandwidth, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/interface_attributes/interface/bandwidth_reservations/bandwidth_reservation/state/reserved_bandwidth (oc-mplst:bandwidth-mbps)

    YANG Description: Bandwidth currently reserved within the priority level,
or the sum of all priority levels when the keyword is set
to ALL
    """
        return self.__reserved_bandwidth

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

    YANG Description: Bandwidth currently reserved within the priority level,
or the sum of all priority levels when the keyword is set
to ALL
    """
        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="reserved-bandwidth",
                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:bandwidth-mbps",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """reserved_bandwidth must be of a type compatible with oc-mplst:bandwidth-mbps""",
                    "defined-type": "oc-mplst:bandwidth-mbps",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="reserved-bandwidth", 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:bandwidth-mbps', is_config=False)""",
                }
            )

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

    def _unset_reserved_bandwidth(self):
        self.__reserved_bandwidth = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="reserved-bandwidth",
            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:bandwidth-mbps",
            is_config=False,
        )

    def _get_active_reservations_count(self):
        """
    Getter method for active_reservations_count, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/interface_attributes/interface/bandwidth_reservations/bandwidth_reservation/state/active_reservations_count (yang:gauge64)

    YANG Description: Number of active RSVP reservations in the associated
priority, or the sum of all reservations when the priority
level is set to ALL
    """
        return self.__active_reservations_count

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

    YANG Description: Number of active RSVP reservations in the associated
priority, or the sum of all reservations when the priority
level is set to ALL
    """
        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="active-reservations-count",
                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="yang:gauge64",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """active_reservations_count must be of a type compatible with yang:gauge64""",
                    "defined-type": "yang:gauge64",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="active-reservations-count", 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='yang:gauge64', is_config=False)""",
                }
            )

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

    def _unset_active_reservations_count(self):
        self.__active_reservations_count = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="active-reservations-count",
            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="yang:gauge64",
            is_config=False,
        )

    def _get_highwater_mark(self):
        """
    Getter method for highwater_mark, mapped from YANG variable /network_instances/network_instance/mpls/signaling_protocols/rsvp_te/interface_attributes/interface/bandwidth_reservations/bandwidth_reservation/state/highwater_mark (oc-mplst:bandwidth-mbps)

    YANG Description: Maximum bandwidth reserved on the interface within the
priority, or across all priorities in the case that the
priority level is set to ALL
    """
        return self.__highwater_mark

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

    YANG Description: Maximum bandwidth reserved on the interface within the
priority, or across all priorities in the case that the
priority level is set to ALL
    """
        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="highwater-mark",
                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:bandwidth-mbps",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """highwater_mark must be of a type compatible with oc-mplst:bandwidth-mbps""",
                    "defined-type": "oc-mplst:bandwidth-mbps",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="highwater-mark", 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:bandwidth-mbps', is_config=False)""",
                }
            )

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

    def _unset_highwater_mark(self):
        self.__highwater_mark = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..18446744073709551615"]},
                int_size=64,
            ),
            is_leaf=True,
            yang_name="highwater-mark",
            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:bandwidth-mbps",
            is_config=False,
        )

    priority = __builtin__.property(_get_priority)
    available_bandwidth = __builtin__.property(_get_available_bandwidth)
    reserved_bandwidth = __builtin__.property(_get_reserved_bandwidth)
    active_reservations_count = __builtin__.property(_get_active_reservations_count)
    highwater_mark = __builtin__.property(_get_highwater_mark)

    _pyangbind_elements = OrderedDict(
        [
            ("priority", priority),
            ("available_bandwidth", available_bandwidth),
            ("reserved_bandwidth", reserved_bandwidth),
            ("active_reservations_count", active_reservations_count),
            ("highwater_mark", highwater_mark),
        ]
    )
