# -*- 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 lsp
from . import iih
from . import ish
from . import esh
from . import psnp
from . import cnsp
from . import unknown


class packet_counters(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/isis/interfaces/interface/levels/level/packet-counters. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: This container defines ISIS interface packet counters.
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__lsp",
        "__iih",
        "__ish",
        "__esh",
        "__psnp",
        "__cnsp",
        "__unknown",
    )

    _yang_name = "packet-counters"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__lsp = YANGDynClass(
            base=lsp.lsp,
            is_container="container",
            yang_name="lsp",
            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=True,
        )
        self.__iih = YANGDynClass(
            base=iih.iih,
            is_container="container",
            yang_name="iih",
            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=True,
        )
        self.__ish = YANGDynClass(
            base=ish.ish,
            is_container="container",
            yang_name="ish",
            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=True,
        )
        self.__esh = YANGDynClass(
            base=esh.esh,
            is_container="container",
            yang_name="esh",
            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=True,
        )
        self.__psnp = YANGDynClass(
            base=psnp.psnp,
            is_container="container",
            yang_name="psnp",
            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=True,
        )
        self.__cnsp = YANGDynClass(
            base=cnsp.cnsp,
            is_container="container",
            yang_name="cnsp",
            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=True,
        )
        self.__unknown = YANGDynClass(
            base=unknown.unknown,
            is_container="container",
            yang_name="unknown",
            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=True,
        )

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

    def _path(self):
        if hasattr(self, "_parent"):
            return self._parent._path() + [self._yang_name]
        else:
            return [
                "network-instances",
                "network-instance",
                "protocols",
                "protocol",
                "isis",
                "interfaces",
                "interface",
                "levels",
                "level",
                "packet-counters",
            ]

    def _get_lsp(self):
        """
    Getter method for lsp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/lsp (container)

    YANG Description: This container defines LSP packet counters.
    """
        return self.__lsp

    def _set_lsp(self, v, load=False):
        """
    Setter method for lsp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/lsp (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_lsp is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_lsp() directly.

    YANG Description: This container defines LSP packet counters.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=lsp.lsp,
                is_container="container",
                yang_name="lsp",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """lsp must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=lsp.lsp, is_container='container', yang_name="lsp", 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=True)""",
                }
            )

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

    def _unset_lsp(self):
        self.__lsp = YANGDynClass(
            base=lsp.lsp,
            is_container="container",
            yang_name="lsp",
            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=True,
        )

    def _get_iih(self):
        """
    Getter method for iih, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/iih (container)

    YANG Description: This container defines IIH packet counters.
    """
        return self.__iih

    def _set_iih(self, v, load=False):
        """
    Setter method for iih, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/iih (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_iih is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_iih() directly.

    YANG Description: This container defines IIH packet counters.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=iih.iih,
                is_container="container",
                yang_name="iih",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """iih must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=iih.iih, is_container='container', yang_name="iih", 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=True)""",
                }
            )

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

    def _unset_iih(self):
        self.__iih = YANGDynClass(
            base=iih.iih,
            is_container="container",
            yang_name="iih",
            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=True,
        )

    def _get_ish(self):
        """
    Getter method for ish, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/ish (container)

    YANG Description: This container defines ISH packet counters.
    """
        return self.__ish

    def _set_ish(self, v, load=False):
        """
    Setter method for ish, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/ish (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_ish is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_ish() directly.

    YANG Description: This container defines ISH packet counters.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=ish.ish,
                is_container="container",
                yang_name="ish",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """ish must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=ish.ish, is_container='container', yang_name="ish", 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=True)""",
                }
            )

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

    def _unset_ish(self):
        self.__ish = YANGDynClass(
            base=ish.ish,
            is_container="container",
            yang_name="ish",
            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=True,
        )

    def _get_esh(self):
        """
    Getter method for esh, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/esh (container)

    YANG Description: This container defines ESH packet counters.
    """
        return self.__esh

    def _set_esh(self, v, load=False):
        """
    Setter method for esh, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/esh (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_esh is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_esh() directly.

    YANG Description: This container defines ESH packet counters.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=esh.esh,
                is_container="container",
                yang_name="esh",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """esh must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=esh.esh, is_container='container', yang_name="esh", 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=True)""",
                }
            )

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

    def _unset_esh(self):
        self.__esh = YANGDynClass(
            base=esh.esh,
            is_container="container",
            yang_name="esh",
            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=True,
        )

    def _get_psnp(self):
        """
    Getter method for psnp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/psnp (container)

    YANG Description: This container defines PSNP packet counters.
    """
        return self.__psnp

    def _set_psnp(self, v, load=False):
        """
    Setter method for psnp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/psnp (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_psnp is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_psnp() directly.

    YANG Description: This container defines PSNP packet counters.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=psnp.psnp,
                is_container="container",
                yang_name="psnp",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """psnp must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=psnp.psnp, is_container='container', yang_name="psnp", 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=True)""",
                }
            )

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

    def _unset_psnp(self):
        self.__psnp = YANGDynClass(
            base=psnp.psnp,
            is_container="container",
            yang_name="psnp",
            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=True,
        )

    def _get_cnsp(self):
        """
    Getter method for cnsp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/cnsp (container)

    YANG Description: Operational state parameters relating to CNSPs.
    """
        return self.__cnsp

    def _set_cnsp(self, v, load=False):
        """
    Setter method for cnsp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/cnsp (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_cnsp is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_cnsp() directly.

    YANG Description: Operational state parameters relating to CNSPs.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=cnsp.cnsp,
                is_container="container",
                yang_name="cnsp",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """cnsp must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=cnsp.cnsp, is_container='container', yang_name="cnsp", 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=True)""",
                }
            )

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

    def _unset_cnsp(self):
        self.__cnsp = YANGDynClass(
            base=cnsp.cnsp,
            is_container="container",
            yang_name="cnsp",
            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=True,
        )

    def _get_unknown(self):
        """
    Getter method for unknown, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/unknown (container)

    YANG Description: Operational state parameters relating to IS-IS PDUs that are not
otherwise classified - referred to as Unknown PDUs.
    """
        return self.__unknown

    def _set_unknown(self, v, load=False):
        """
    Setter method for unknown, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/unknown (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_unknown is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_unknown() directly.

    YANG Description: Operational state parameters relating to IS-IS PDUs that are not
otherwise classified - referred to as Unknown PDUs.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=unknown.unknown,
                is_container="container",
                yang_name="unknown",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """unknown must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=unknown.unknown, is_container='container', yang_name="unknown", 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=True)""",
                }
            )

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

    def _unset_unknown(self):
        self.__unknown = YANGDynClass(
            base=unknown.unknown,
            is_container="container",
            yang_name="unknown",
            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=True,
        )

    lsp = __builtin__.property(_get_lsp, _set_lsp)
    iih = __builtin__.property(_get_iih, _set_iih)
    ish = __builtin__.property(_get_ish, _set_ish)
    esh = __builtin__.property(_get_esh, _set_esh)
    psnp = __builtin__.property(_get_psnp, _set_psnp)
    cnsp = __builtin__.property(_get_cnsp, _set_cnsp)
    unknown = __builtin__.property(_get_unknown, _set_unknown)

    _pyangbind_elements = OrderedDict(
        [
            ("lsp", lsp),
            ("iih", iih),
            ("ish", ish),
            ("esh", esh),
            ("psnp", psnp),
            ("cnsp", cnsp),
            ("unknown", unknown),
        ]
    )


from . import lsp
from . import iih
from . import ish
from . import esh
from . import psnp
from . import cnsp
from . import unknown


class packet_counters(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/isis/interfaces/interface/levels/level/packet-counters. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: This container defines ISIS interface packet counters.
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__lsp",
        "__iih",
        "__ish",
        "__esh",
        "__psnp",
        "__cnsp",
        "__unknown",
    )

    _yang_name = "packet-counters"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__lsp = YANGDynClass(
            base=lsp.lsp,
            is_container="container",
            yang_name="lsp",
            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=True,
        )
        self.__iih = YANGDynClass(
            base=iih.iih,
            is_container="container",
            yang_name="iih",
            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=True,
        )
        self.__ish = YANGDynClass(
            base=ish.ish,
            is_container="container",
            yang_name="ish",
            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=True,
        )
        self.__esh = YANGDynClass(
            base=esh.esh,
            is_container="container",
            yang_name="esh",
            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=True,
        )
        self.__psnp = YANGDynClass(
            base=psnp.psnp,
            is_container="container",
            yang_name="psnp",
            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=True,
        )
        self.__cnsp = YANGDynClass(
            base=cnsp.cnsp,
            is_container="container",
            yang_name="cnsp",
            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=True,
        )
        self.__unknown = YANGDynClass(
            base=unknown.unknown,
            is_container="container",
            yang_name="unknown",
            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=True,
        )

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

    def _path(self):
        if hasattr(self, "_parent"):
            return self._parent._path() + [self._yang_name]
        else:
            return [
                "network-instances",
                "network-instance",
                "protocols",
                "protocol",
                "isis",
                "interfaces",
                "interface",
                "levels",
                "level",
                "packet-counters",
            ]

    def _get_lsp(self):
        """
    Getter method for lsp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/lsp (container)

    YANG Description: This container defines LSP packet counters.
    """
        return self.__lsp

    def _set_lsp(self, v, load=False):
        """
    Setter method for lsp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/lsp (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_lsp is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_lsp() directly.

    YANG Description: This container defines LSP packet counters.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=lsp.lsp,
                is_container="container",
                yang_name="lsp",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """lsp must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=lsp.lsp, is_container='container', yang_name="lsp", 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=True)""",
                }
            )

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

    def _unset_lsp(self):
        self.__lsp = YANGDynClass(
            base=lsp.lsp,
            is_container="container",
            yang_name="lsp",
            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=True,
        )

    def _get_iih(self):
        """
    Getter method for iih, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/iih (container)

    YANG Description: This container defines IIH packet counters.
    """
        return self.__iih

    def _set_iih(self, v, load=False):
        """
    Setter method for iih, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/iih (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_iih is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_iih() directly.

    YANG Description: This container defines IIH packet counters.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=iih.iih,
                is_container="container",
                yang_name="iih",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """iih must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=iih.iih, is_container='container', yang_name="iih", 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=True)""",
                }
            )

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

    def _unset_iih(self):
        self.__iih = YANGDynClass(
            base=iih.iih,
            is_container="container",
            yang_name="iih",
            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=True,
        )

    def _get_ish(self):
        """
    Getter method for ish, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/ish (container)

    YANG Description: This container defines ISH packet counters.
    """
        return self.__ish

    def _set_ish(self, v, load=False):
        """
    Setter method for ish, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/ish (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_ish is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_ish() directly.

    YANG Description: This container defines ISH packet counters.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=ish.ish,
                is_container="container",
                yang_name="ish",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """ish must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=ish.ish, is_container='container', yang_name="ish", 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=True)""",
                }
            )

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

    def _unset_ish(self):
        self.__ish = YANGDynClass(
            base=ish.ish,
            is_container="container",
            yang_name="ish",
            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=True,
        )

    def _get_esh(self):
        """
    Getter method for esh, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/esh (container)

    YANG Description: This container defines ESH packet counters.
    """
        return self.__esh

    def _set_esh(self, v, load=False):
        """
    Setter method for esh, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/esh (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_esh is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_esh() directly.

    YANG Description: This container defines ESH packet counters.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=esh.esh,
                is_container="container",
                yang_name="esh",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """esh must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=esh.esh, is_container='container', yang_name="esh", 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=True)""",
                }
            )

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

    def _unset_esh(self):
        self.__esh = YANGDynClass(
            base=esh.esh,
            is_container="container",
            yang_name="esh",
            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=True,
        )

    def _get_psnp(self):
        """
    Getter method for psnp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/psnp (container)

    YANG Description: This container defines PSNP packet counters.
    """
        return self.__psnp

    def _set_psnp(self, v, load=False):
        """
    Setter method for psnp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/psnp (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_psnp is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_psnp() directly.

    YANG Description: This container defines PSNP packet counters.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=psnp.psnp,
                is_container="container",
                yang_name="psnp",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """psnp must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=psnp.psnp, is_container='container', yang_name="psnp", 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=True)""",
                }
            )

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

    def _unset_psnp(self):
        self.__psnp = YANGDynClass(
            base=psnp.psnp,
            is_container="container",
            yang_name="psnp",
            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=True,
        )

    def _get_cnsp(self):
        """
    Getter method for cnsp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/cnsp (container)

    YANG Description: Operational state parameters relating to CNSPs.
    """
        return self.__cnsp

    def _set_cnsp(self, v, load=False):
        """
    Setter method for cnsp, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/cnsp (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_cnsp is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_cnsp() directly.

    YANG Description: Operational state parameters relating to CNSPs.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=cnsp.cnsp,
                is_container="container",
                yang_name="cnsp",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """cnsp must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=cnsp.cnsp, is_container='container', yang_name="cnsp", 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=True)""",
                }
            )

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

    def _unset_cnsp(self):
        self.__cnsp = YANGDynClass(
            base=cnsp.cnsp,
            is_container="container",
            yang_name="cnsp",
            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=True,
        )

    def _get_unknown(self):
        """
    Getter method for unknown, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/unknown (container)

    YANG Description: Operational state parameters relating to IS-IS PDUs that are not
otherwise classified - referred to as Unknown PDUs.
    """
        return self.__unknown

    def _set_unknown(self, v, load=False):
        """
    Setter method for unknown, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/unknown (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_unknown is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_unknown() directly.

    YANG Description: Operational state parameters relating to IS-IS PDUs that are not
otherwise classified - referred to as Unknown PDUs.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=unknown.unknown,
                is_container="container",
                yang_name="unknown",
                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=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """unknown must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=unknown.unknown, is_container='container', yang_name="unknown", 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=True)""",
                }
            )

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

    def _unset_unknown(self):
        self.__unknown = YANGDynClass(
            base=unknown.unknown,
            is_container="container",
            yang_name="unknown",
            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=True,
        )

    lsp = __builtin__.property(_get_lsp, _set_lsp)
    iih = __builtin__.property(_get_iih, _set_iih)
    ish = __builtin__.property(_get_ish, _set_ish)
    esh = __builtin__.property(_get_esh, _set_esh)
    psnp = __builtin__.property(_get_psnp, _set_psnp)
    cnsp = __builtin__.property(_get_cnsp, _set_cnsp)
    unknown = __builtin__.property(_get_unknown, _set_unknown)

    _pyangbind_elements = OrderedDict(
        [
            ("lsp", lsp),
            ("iih", iih),
            ("ish", ish),
            ("esh", esh),
            ("psnp", psnp),
            ("cnsp", cnsp),
            ("unknown", unknown),
        ]
    )
