# -*- 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 state
from . import extended_prefix_range
from . import prefix_sid
from . import sid_label_binding
from . import unknown_tlv


class tlv(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/protocols/protocol/ospfv2/areas/area/lsdb/lsa-types/lsa-type/lsas/lsa/opaque-lsa/extended-prefix/tlvs/tlv. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: A TLV contained within the extended prefix LSA
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__state",
        "__extended_prefix_range",
        "__prefix_sid",
        "__sid_label_binding",
        "__unknown_tlv",
    )

    _yang_name = "tlv"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            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.__extended_prefix_range = YANGDynClass(
            base=extended_prefix_range.extended_prefix_range,
            is_container="container",
            yang_name="extended-prefix-range",
            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.__prefix_sid = YANGDynClass(
            base=prefix_sid.prefix_sid,
            is_container="container",
            yang_name="prefix-sid",
            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.__sid_label_binding = YANGDynClass(
            base=sid_label_binding.sid_label_binding,
            is_container="container",
            yang_name="sid-label-binding",
            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.__unknown_tlv = YANGDynClass(
            base=unknown_tlv.unknown_tlv,
            is_container="container",
            yang_name="unknown-tlv",
            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",
                "protocols",
                "protocol",
                "ospfv2",
                "areas",
                "area",
                "lsdb",
                "lsa-types",
                "lsa-type",
                "lsas",
                "lsa",
                "opaque-lsa",
                "extended-prefix",
                "tlvs",
                "tlv",
            ]

    def _get_state(self):
        """
    Getter method for state, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/state (container)

    YANG Description: State parameters relating to the sub-TLV of the extended
prefix LSA
    """
        return self.__state

    def _set_state(self, v, load=False):
        """
    Setter method for state, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/state (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_state is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_state() directly.

    YANG Description: State parameters relating to the sub-TLV of the extended
prefix LSA
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=state.state,
                is_container="container",
                yang_name="state",
                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": """state must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=state.state, is_container='container', yang_name="state", 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.__state = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_state(self):
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            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,
        )

    def _get_extended_prefix_range(self):
        """
    Getter method for extended_prefix_range, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/extended_prefix_range (container)

    YANG Description: State parameters relating to the extended prefix range
sub-TLV of the extended prefix LSA
    """
        return self.__extended_prefix_range

    def _set_extended_prefix_range(self, v, load=False):
        """
    Setter method for extended_prefix_range, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/extended_prefix_range (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_extended_prefix_range is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_extended_prefix_range() directly.

    YANG Description: State parameters relating to the extended prefix range
sub-TLV of the extended prefix LSA
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=extended_prefix_range.extended_prefix_range,
                is_container="container",
                yang_name="extended-prefix-range",
                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": """extended_prefix_range must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=extended_prefix_range.extended_prefix_range, is_container='container', yang_name="extended-prefix-range", 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.__extended_prefix_range = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_extended_prefix_range(self):
        self.__extended_prefix_range = YANGDynClass(
            base=extended_prefix_range.extended_prefix_range,
            is_container="container",
            yang_name="extended-prefix-range",
            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,
        )

    def _get_prefix_sid(self):
        """
    Getter method for prefix_sid, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/prefix_sid (container)

    YANG Description: State parameters relating to the Prefix SID sub-TLV of the
extended prefix LSA
    """
        return self.__prefix_sid

    def _set_prefix_sid(self, v, load=False):
        """
    Setter method for prefix_sid, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/prefix_sid (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_prefix_sid is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_prefix_sid() directly.

    YANG Description: State parameters relating to the Prefix SID sub-TLV of the
extended prefix LSA
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=prefix_sid.prefix_sid,
                is_container="container",
                yang_name="prefix-sid",
                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": """prefix_sid must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=prefix_sid.prefix_sid, is_container='container', yang_name="prefix-sid", 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.__prefix_sid = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_prefix_sid(self):
        self.__prefix_sid = YANGDynClass(
            base=prefix_sid.prefix_sid,
            is_container="container",
            yang_name="prefix-sid",
            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,
        )

    def _get_sid_label_binding(self):
        """
    Getter method for sid_label_binding, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/sid_label_binding (container)

    YANG Description: State parameters relating to the SID/Label binding sub-TLV
of the extended prefix LSA
    """
        return self.__sid_label_binding

    def _set_sid_label_binding(self, v, load=False):
        """
    Setter method for sid_label_binding, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/sid_label_binding (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_sid_label_binding is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_sid_label_binding() directly.

    YANG Description: State parameters relating to the SID/Label binding sub-TLV
of the extended prefix LSA
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=sid_label_binding.sid_label_binding,
                is_container="container",
                yang_name="sid-label-binding",
                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": """sid_label_binding must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=sid_label_binding.sid_label_binding, is_container='container', yang_name="sid-label-binding", 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.__sid_label_binding = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_sid_label_binding(self):
        self.__sid_label_binding = YANGDynClass(
            base=sid_label_binding.sid_label_binding,
            is_container="container",
            yang_name="sid-label-binding",
            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,
        )

    def _get_unknown_tlv(self):
        """
    Getter method for unknown_tlv, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/unknown_tlv (container)

    YANG Description: An unknown TLV within the context. Unknown TLVs are
defined to be the set of TLVs that are not modelled
within the OpenConfig model, or are unknown to the
local system such that it cannot decode their value.
    """
        return self.__unknown_tlv

    def _set_unknown_tlv(self, v, load=False):
        """
    Setter method for unknown_tlv, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/unknown_tlv (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_unknown_tlv is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_unknown_tlv() directly.

    YANG Description: An unknown TLV within the context. Unknown TLVs are
defined to be the set of TLVs that are not modelled
within the OpenConfig model, or are unknown to the
local system such that it cannot decode their value.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=unknown_tlv.unknown_tlv,
                is_container="container",
                yang_name="unknown-tlv",
                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": """unknown_tlv must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=unknown_tlv.unknown_tlv, is_container='container', yang_name="unknown-tlv", 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.__unknown_tlv = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_unknown_tlv(self):
        self.__unknown_tlv = YANGDynClass(
            base=unknown_tlv.unknown_tlv,
            is_container="container",
            yang_name="unknown-tlv",
            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,
        )

    state = __builtin__.property(_get_state)
    extended_prefix_range = __builtin__.property(_get_extended_prefix_range)
    prefix_sid = __builtin__.property(_get_prefix_sid)
    sid_label_binding = __builtin__.property(_get_sid_label_binding)
    unknown_tlv = __builtin__.property(_get_unknown_tlv)

    _pyangbind_elements = OrderedDict(
        [
            ("state", state),
            ("extended_prefix_range", extended_prefix_range),
            ("prefix_sid", prefix_sid),
            ("sid_label_binding", sid_label_binding),
            ("unknown_tlv", unknown_tlv),
        ]
    )


from . import state
from . import extended_prefix_range
from . import prefix_sid
from . import sid_label_binding
from . import unknown_tlv


class tlv(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/protocols/protocol/ospfv2/areas/area/lsdb/lsa-types/lsa-type/lsas/lsa/opaque-lsa/extended-prefix/tlvs/tlv. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: A TLV contained within the extended prefix LSA
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__state",
        "__extended_prefix_range",
        "__prefix_sid",
        "__sid_label_binding",
        "__unknown_tlv",
    )

    _yang_name = "tlv"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            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.__extended_prefix_range = YANGDynClass(
            base=extended_prefix_range.extended_prefix_range,
            is_container="container",
            yang_name="extended-prefix-range",
            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.__prefix_sid = YANGDynClass(
            base=prefix_sid.prefix_sid,
            is_container="container",
            yang_name="prefix-sid",
            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.__sid_label_binding = YANGDynClass(
            base=sid_label_binding.sid_label_binding,
            is_container="container",
            yang_name="sid-label-binding",
            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.__unknown_tlv = YANGDynClass(
            base=unknown_tlv.unknown_tlv,
            is_container="container",
            yang_name="unknown-tlv",
            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",
                "protocols",
                "protocol",
                "ospfv2",
                "areas",
                "area",
                "lsdb",
                "lsa-types",
                "lsa-type",
                "lsas",
                "lsa",
                "opaque-lsa",
                "extended-prefix",
                "tlvs",
                "tlv",
            ]

    def _get_state(self):
        """
    Getter method for state, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/state (container)

    YANG Description: State parameters relating to the sub-TLV of the extended
prefix LSA
    """
        return self.__state

    def _set_state(self, v, load=False):
        """
    Setter method for state, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/state (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_state is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_state() directly.

    YANG Description: State parameters relating to the sub-TLV of the extended
prefix LSA
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=state.state,
                is_container="container",
                yang_name="state",
                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": """state must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=state.state, is_container='container', yang_name="state", 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.__state = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_state(self):
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            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,
        )

    def _get_extended_prefix_range(self):
        """
    Getter method for extended_prefix_range, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/extended_prefix_range (container)

    YANG Description: State parameters relating to the extended prefix range
sub-TLV of the extended prefix LSA
    """
        return self.__extended_prefix_range

    def _set_extended_prefix_range(self, v, load=False):
        """
    Setter method for extended_prefix_range, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/extended_prefix_range (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_extended_prefix_range is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_extended_prefix_range() directly.

    YANG Description: State parameters relating to the extended prefix range
sub-TLV of the extended prefix LSA
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=extended_prefix_range.extended_prefix_range,
                is_container="container",
                yang_name="extended-prefix-range",
                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": """extended_prefix_range must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=extended_prefix_range.extended_prefix_range, is_container='container', yang_name="extended-prefix-range", 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.__extended_prefix_range = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_extended_prefix_range(self):
        self.__extended_prefix_range = YANGDynClass(
            base=extended_prefix_range.extended_prefix_range,
            is_container="container",
            yang_name="extended-prefix-range",
            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,
        )

    def _get_prefix_sid(self):
        """
    Getter method for prefix_sid, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/prefix_sid (container)

    YANG Description: State parameters relating to the Prefix SID sub-TLV of the
extended prefix LSA
    """
        return self.__prefix_sid

    def _set_prefix_sid(self, v, load=False):
        """
    Setter method for prefix_sid, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/prefix_sid (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_prefix_sid is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_prefix_sid() directly.

    YANG Description: State parameters relating to the Prefix SID sub-TLV of the
extended prefix LSA
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=prefix_sid.prefix_sid,
                is_container="container",
                yang_name="prefix-sid",
                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": """prefix_sid must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=prefix_sid.prefix_sid, is_container='container', yang_name="prefix-sid", 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.__prefix_sid = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_prefix_sid(self):
        self.__prefix_sid = YANGDynClass(
            base=prefix_sid.prefix_sid,
            is_container="container",
            yang_name="prefix-sid",
            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,
        )

    def _get_sid_label_binding(self):
        """
    Getter method for sid_label_binding, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/sid_label_binding (container)

    YANG Description: State parameters relating to the SID/Label binding sub-TLV
of the extended prefix LSA
    """
        return self.__sid_label_binding

    def _set_sid_label_binding(self, v, load=False):
        """
    Setter method for sid_label_binding, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/sid_label_binding (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_sid_label_binding is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_sid_label_binding() directly.

    YANG Description: State parameters relating to the SID/Label binding sub-TLV
of the extended prefix LSA
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=sid_label_binding.sid_label_binding,
                is_container="container",
                yang_name="sid-label-binding",
                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": """sid_label_binding must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=sid_label_binding.sid_label_binding, is_container='container', yang_name="sid-label-binding", 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.__sid_label_binding = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_sid_label_binding(self):
        self.__sid_label_binding = YANGDynClass(
            base=sid_label_binding.sid_label_binding,
            is_container="container",
            yang_name="sid-label-binding",
            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,
        )

    def _get_unknown_tlv(self):
        """
    Getter method for unknown_tlv, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/unknown_tlv (container)

    YANG Description: An unknown TLV within the context. Unknown TLVs are
defined to be the set of TLVs that are not modelled
within the OpenConfig model, or are unknown to the
local system such that it cannot decode their value.
    """
        return self.__unknown_tlv

    def _set_unknown_tlv(self, v, load=False):
        """
    Setter method for unknown_tlv, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/unknown_tlv (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_unknown_tlv is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_unknown_tlv() directly.

    YANG Description: An unknown TLV within the context. Unknown TLVs are
defined to be the set of TLVs that are not modelled
within the OpenConfig model, or are unknown to the
local system such that it cannot decode their value.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=unknown_tlv.unknown_tlv,
                is_container="container",
                yang_name="unknown-tlv",
                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": """unknown_tlv must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=unknown_tlv.unknown_tlv, is_container='container', yang_name="unknown-tlv", 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.__unknown_tlv = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_unknown_tlv(self):
        self.__unknown_tlv = YANGDynClass(
            base=unknown_tlv.unknown_tlv,
            is_container="container",
            yang_name="unknown-tlv",
            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,
        )

    state = __builtin__.property(_get_state)
    extended_prefix_range = __builtin__.property(_get_extended_prefix_range)
    prefix_sid = __builtin__.property(_get_prefix_sid)
    sid_label_binding = __builtin__.property(_get_sid_label_binding)
    unknown_tlv = __builtin__.property(_get_unknown_tlv)

    _pyangbind_elements = OrderedDict(
        [
            ("state", state),
            ("extended_prefix_range", extended_prefix_range),
            ("prefix_sid", prefix_sid),
            ("sid_label_binding", sid_label_binding),
            ("unknown_tlv", unknown_tlv),
        ]
    )
