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

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

    long = int
elif six.PY2:
    import __builtin__


class state(PybindBase):
    """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-network-instance - based on the path /network-instances/network-instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Operational state parameters for the interface on which
OSPFv2 is enabled
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__id",
        "__network_type",
        "__priority",
        "__multi_area_adjacency_primary",
        "__authentication_type",
        "__metric",
        "__passive",
        "__hide_network",
    )

    _yang_name = "state"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__id = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="id",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=False,
        )
        self.__network_type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="network-type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=False,
        )
        self.__priority = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
            ),
            is_leaf=True,
            yang_name="priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=False,
        )
        self.__multi_area_adjacency_primary = YANGDynClass(
            base=YANGBool,
            default=YANGBool("true"),
            is_leaf=True,
            yang_name="multi-area-adjacency-primary",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=False,
        )
        self.__authentication_type = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="authentication-type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=False,
        )
        self.__metric = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="metric",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-ospf-types:ospf-metric",
            is_config=False,
        )
        self.__passive = YANGDynClass(
            base=YANGBool,
            is_leaf=True,
            yang_name="passive",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=False,
        )
        self.__hide_network = YANGDynClass(
            base=YANGBool,
            is_leaf=True,
            yang_name="hide-network",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=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",
                "interfaces",
                "interface",
                "state",
            ]

    def _get_id(self):
        """
    Getter method for id, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/id (string)

    YANG Description: An operator-specified string utilised to uniquely
reference this interface
    """
        return self.__id

    def _set_id(self, v, load=False):
        """
    Setter method for id, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/id (string)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_id is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_id() directly.

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

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

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

    def _get_network_type(self):
        """
    Getter method for network_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/network_type (identityref)

    YANG Description: The type of network that OSPFv2 should use for the specified
interface.
    """
        return self.__network_type

    def _set_network_type(self, v, load=False):
        """
    Setter method for network_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/network_type (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_network_type is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_network_type() directly.

    YANG Description: The type of network that OSPFv2 should use for the specified
interface.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "POINT_TO_POINT_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospf-types:POINT_TO_POINT_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospft:POINT_TO_POINT_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospf-types:BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospft:BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "NON_BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospf-types:NON_BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospft:NON_BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                    },
                ),
                is_leaf=True,
                yang_name="network-type",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """network_type must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'POINT_TO_POINT_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospf-types:POINT_TO_POINT_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospft:POINT_TO_POINT_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospf-types:BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospft:BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'NON_BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospf-types:NON_BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospft:NON_BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}},), is_leaf=True, yang_name="network-type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=False)""",
                }
            )

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

    def _unset_network_type(self):
        self.__network_type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="network-type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=False,
        )

    def _get_priority(self):
        """
    Getter method for priority, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/priority (uint8)

    YANG Description: The local system's priority to become the designated
router
    """
        return self.__priority

    def _set_priority(self, v, load=False):
        """
    Setter method for priority, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/priority (uint8)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_priority is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_priority() directly.

    YANG Description: The local system's priority to become the designated
router
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                is_leaf=True,
                yang_name="priority",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="uint8",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """priority must be of a type compatible with uint8""",
                    "defined-type": "uint8",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='uint8', is_config=False)""",
                }
            )

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

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

    def _get_multi_area_adjacency_primary(self):
        """
    Getter method for multi_area_adjacency_primary, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/multi_area_adjacency_primary (boolean)

    YANG Description: When the specified interface is included in more than one
area's configuration, this leaf marks whether the area should
be considered the primary (when the value is true). In the
case that this value is false, the area is considered a
secondary area.
    """
        return self.__multi_area_adjacency_primary

    def _set_multi_area_adjacency_primary(self, v, load=False):
        """
    Setter method for multi_area_adjacency_primary, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/multi_area_adjacency_primary (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_multi_area_adjacency_primary is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_multi_area_adjacency_primary() directly.

    YANG Description: When the specified interface is included in more than one
area's configuration, this leaf marks whether the area should
be considered the primary (when the value is true). In the
case that this value is false, the area is considered a
secondary area.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                default=YANGBool("true"),
                is_leaf=True,
                yang_name="multi-area-adjacency-primary",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="boolean",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """multi_area_adjacency_primary must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, default=YANGBool("true"), is_leaf=True, yang_name="multi-area-adjacency-primary", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=False)""",
                }
            )

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

    def _unset_multi_area_adjacency_primary(self):
        self.__multi_area_adjacency_primary = YANGDynClass(
            base=YANGBool,
            default=YANGBool("true"),
            is_leaf=True,
            yang_name="multi-area-adjacency-primary",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=False,
        )

    def _get_authentication_type(self):
        """
    Getter method for authentication_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/authentication_type (string)

    YANG Description: The type of authentication that should be used on this
interface
    """
        return self.__authentication_type

    def _set_authentication_type(self, v, load=False):
        """
    Setter method for authentication_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/authentication_type (string)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_authentication_type is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_authentication_type() directly.

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

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

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

    def _get_metric(self):
        """
    Getter method for metric, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/metric (oc-ospf-types:ospf-metric)

    YANG Description: The metric for the interface
    """
        return self.__metric

    def _set_metric(self, v, load=False):
        """
    Setter method for metric, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/metric (oc-ospf-types:ospf-metric)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_metric is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_metric() directly.

    YANG Description: The metric for the interface
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
                ),
                is_leaf=True,
                yang_name="metric",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="oc-ospf-types:ospf-metric",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """metric must be of a type compatible with oc-ospf-types:ospf-metric""",
                    "defined-type": "oc-ospf-types:ospf-metric",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), is_leaf=True, yang_name="metric", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-ospf-types:ospf-metric', is_config=False)""",
                }
            )

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

    def _unset_metric(self):
        self.__metric = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="metric",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-ospf-types:ospf-metric",
            is_config=False,
        )

    def _get_passive(self):
        """
    Getter method for passive, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/passive (boolean)

    YANG Description: When this leaf is set to true, the interface should be
advertised within the OSPF area but OSPF adjacencies should
not be established over the interface
    """
        return self.__passive

    def _set_passive(self, v, load=False):
        """
    Setter method for passive, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/passive (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_passive is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_passive() directly.

    YANG Description: When this leaf is set to true, the interface should be
advertised within the OSPF area but OSPF adjacencies should
not be established over the interface
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                is_leaf=True,
                yang_name="passive",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="boolean",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """passive must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, is_leaf=True, yang_name="passive", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=False)""",
                }
            )

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

    def _unset_passive(self):
        self.__passive = YANGDynClass(
            base=YANGBool,
            is_leaf=True,
            yang_name="passive",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=False,
        )

    def _get_hide_network(self):
        """
    Getter method for hide_network, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/hide_network (boolean)

    YANG Description: When this leaf is set to true, the network connected to
the interface should be hidden from OSPFv2 advertisements
per the procedure described in RFC6860.
    """
        return self.__hide_network

    def _set_hide_network(self, v, load=False):
        """
    Setter method for hide_network, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/hide_network (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_hide_network is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_hide_network() directly.

    YANG Description: When this leaf is set to true, the network connected to
the interface should be hidden from OSPFv2 advertisements
per the procedure described in RFC6860.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                is_leaf=True,
                yang_name="hide-network",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="boolean",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """hide_network must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, is_leaf=True, yang_name="hide-network", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=False)""",
                }
            )

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

    def _unset_hide_network(self):
        self.__hide_network = YANGDynClass(
            base=YANGBool,
            is_leaf=True,
            yang_name="hide-network",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=False,
        )

    id = __builtin__.property(_get_id)
    network_type = __builtin__.property(_get_network_type)
    priority = __builtin__.property(_get_priority)
    multi_area_adjacency_primary = __builtin__.property(
        _get_multi_area_adjacency_primary
    )
    authentication_type = __builtin__.property(_get_authentication_type)
    metric = __builtin__.property(_get_metric)
    passive = __builtin__.property(_get_passive)
    hide_network = __builtin__.property(_get_hide_network)

    _pyangbind_elements = OrderedDict(
        [
            ("id", id),
            ("network_type", network_type),
            ("priority", priority),
            ("multi_area_adjacency_primary", multi_area_adjacency_primary),
            ("authentication_type", authentication_type),
            ("metric", metric),
            ("passive", passive),
            ("hide_network", hide_network),
        ]
    )


class state(PybindBase):
    """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-network-instance-l2 - based on the path /network-instances/network-instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Operational state parameters for the interface on which
OSPFv2 is enabled
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__id",
        "__network_type",
        "__priority",
        "__multi_area_adjacency_primary",
        "__authentication_type",
        "__metric",
        "__passive",
        "__hide_network",
    )

    _yang_name = "state"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__id = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="id",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=False,
        )
        self.__network_type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="network-type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=False,
        )
        self.__priority = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
            ),
            is_leaf=True,
            yang_name="priority",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="uint8",
            is_config=False,
        )
        self.__multi_area_adjacency_primary = YANGDynClass(
            base=YANGBool,
            default=YANGBool("true"),
            is_leaf=True,
            yang_name="multi-area-adjacency-primary",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=False,
        )
        self.__authentication_type = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="authentication-type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="string",
            is_config=False,
        )
        self.__metric = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="metric",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-ospf-types:ospf-metric",
            is_config=False,
        )
        self.__passive = YANGDynClass(
            base=YANGBool,
            is_leaf=True,
            yang_name="passive",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=False,
        )
        self.__hide_network = YANGDynClass(
            base=YANGBool,
            is_leaf=True,
            yang_name="hide-network",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=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",
                "interfaces",
                "interface",
                "state",
            ]

    def _get_id(self):
        """
    Getter method for id, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/id (string)

    YANG Description: An operator-specified string utilised to uniquely
reference this interface
    """
        return self.__id

    def _set_id(self, v, load=False):
        """
    Setter method for id, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/id (string)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_id is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_id() directly.

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

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

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

    def _get_network_type(self):
        """
    Getter method for network_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/network_type (identityref)

    YANG Description: The type of network that OSPFv2 should use for the specified
interface.
    """
        return self.__network_type

    def _set_network_type(self, v, load=False):
        """
    Setter method for network_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/network_type (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_network_type is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_network_type() directly.

    YANG Description: The type of network that OSPFv2 should use for the specified
interface.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "POINT_TO_POINT_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospf-types:POINT_TO_POINT_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospft:POINT_TO_POINT_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospf-types:BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospft:BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "NON_BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospf-types:NON_BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                        "oc-ospft:NON_BROADCAST_NETWORK": {
                            "@module": "openconfig-ospf-types",
                            "@namespace": "http://openconfig.net/yang/ospf-types",
                        },
                    },
                ),
                is_leaf=True,
                yang_name="network-type",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """network_type must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'POINT_TO_POINT_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospf-types:POINT_TO_POINT_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospft:POINT_TO_POINT_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospf-types:BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospft:BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'NON_BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospf-types:NON_BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}, 'oc-ospft:NON_BROADCAST_NETWORK': {'@module': 'openconfig-ospf-types', '@namespace': 'http://openconfig.net/yang/ospf-types'}},), is_leaf=True, yang_name="network-type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=False)""",
                }
            )

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

    def _unset_network_type(self):
        self.__network_type = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:POINT_TO_POINT_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospf-types:NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                    "oc-ospft:NON_BROADCAST_NETWORK": {
                        "@module": "openconfig-ospf-types",
                        "@namespace": "http://openconfig.net/yang/ospf-types",
                    },
                },
            ),
            is_leaf=True,
            yang_name="network-type",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=False,
        )

    def _get_priority(self):
        """
    Getter method for priority, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/priority (uint8)

    YANG Description: The local system's priority to become the designated
router
    """
        return self.__priority

    def _set_priority(self, v, load=False):
        """
    Setter method for priority, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/priority (uint8)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_priority is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_priority() directly.

    YANG Description: The local system's priority to become the designated
router
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..255"]}, int_size=8
                ),
                is_leaf=True,
                yang_name="priority",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="uint8",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """priority must be of a type compatible with uint8""",
                    "defined-type": "uint8",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='uint8', is_config=False)""",
                }
            )

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

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

    def _get_multi_area_adjacency_primary(self):
        """
    Getter method for multi_area_adjacency_primary, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/multi_area_adjacency_primary (boolean)

    YANG Description: When the specified interface is included in more than one
area's configuration, this leaf marks whether the area should
be considered the primary (when the value is true). In the
case that this value is false, the area is considered a
secondary area.
    """
        return self.__multi_area_adjacency_primary

    def _set_multi_area_adjacency_primary(self, v, load=False):
        """
    Setter method for multi_area_adjacency_primary, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/multi_area_adjacency_primary (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_multi_area_adjacency_primary is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_multi_area_adjacency_primary() directly.

    YANG Description: When the specified interface is included in more than one
area's configuration, this leaf marks whether the area should
be considered the primary (when the value is true). In the
case that this value is false, the area is considered a
secondary area.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                default=YANGBool("true"),
                is_leaf=True,
                yang_name="multi-area-adjacency-primary",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="boolean",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """multi_area_adjacency_primary must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, default=YANGBool("true"), is_leaf=True, yang_name="multi-area-adjacency-primary", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=False)""",
                }
            )

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

    def _unset_multi_area_adjacency_primary(self):
        self.__multi_area_adjacency_primary = YANGDynClass(
            base=YANGBool,
            default=YANGBool("true"),
            is_leaf=True,
            yang_name="multi-area-adjacency-primary",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=False,
        )

    def _get_authentication_type(self):
        """
    Getter method for authentication_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/authentication_type (string)

    YANG Description: The type of authentication that should be used on this
interface
    """
        return self.__authentication_type

    def _set_authentication_type(self, v, load=False):
        """
    Setter method for authentication_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/authentication_type (string)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_authentication_type is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_authentication_type() directly.

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

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

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

    def _get_metric(self):
        """
    Getter method for metric, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/metric (oc-ospf-types:ospf-metric)

    YANG Description: The metric for the interface
    """
        return self.__metric

    def _set_metric(self, v, load=False):
        """
    Setter method for metric, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/metric (oc-ospf-types:ospf-metric)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_metric is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_metric() directly.

    YANG Description: The metric for the interface
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
                ),
                is_leaf=True,
                yang_name="metric",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="oc-ospf-types:ospf-metric",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """metric must be of a type compatible with oc-ospf-types:ospf-metric""",
                    "defined-type": "oc-ospf-types:ospf-metric",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), is_leaf=True, yang_name="metric", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-ospf-types:ospf-metric', is_config=False)""",
                }
            )

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

    def _unset_metric(self):
        self.__metric = YANGDynClass(
            base=RestrictedClassType(
                base_type=int, restriction_dict={"range": ["0..65535"]}, int_size=16
            ),
            is_leaf=True,
            yang_name="metric",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-ospf-types:ospf-metric",
            is_config=False,
        )

    def _get_passive(self):
        """
    Getter method for passive, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/passive (boolean)

    YANG Description: When this leaf is set to true, the interface should be
advertised within the OSPF area but OSPF adjacencies should
not be established over the interface
    """
        return self.__passive

    def _set_passive(self, v, load=False):
        """
    Setter method for passive, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/passive (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_passive is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_passive() directly.

    YANG Description: When this leaf is set to true, the interface should be
advertised within the OSPF area but OSPF adjacencies should
not be established over the interface
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                is_leaf=True,
                yang_name="passive",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="boolean",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """passive must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, is_leaf=True, yang_name="passive", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=False)""",
                }
            )

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

    def _unset_passive(self):
        self.__passive = YANGDynClass(
            base=YANGBool,
            is_leaf=True,
            yang_name="passive",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=False,
        )

    def _get_hide_network(self):
        """
    Getter method for hide_network, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/hide_network (boolean)

    YANG Description: When this leaf is set to true, the network connected to
the interface should be hidden from OSPFv2 advertisements
per the procedure described in RFC6860.
    """
        return self.__hide_network

    def _set_hide_network(self, v, load=False):
        """
    Setter method for hide_network, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/interfaces/interface/state/hide_network (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_hide_network is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_hide_network() directly.

    YANG Description: When this leaf is set to true, the network connected to
the interface should be hidden from OSPFv2 advertisements
per the procedure described in RFC6860.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                is_leaf=True,
                yang_name="hide-network",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="boolean",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """hide_network must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, is_leaf=True, yang_name="hide-network", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=False)""",
                }
            )

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

    def _unset_hide_network(self):
        self.__hide_network = YANGDynClass(
            base=YANGBool,
            is_leaf=True,
            yang_name="hide-network",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="boolean",
            is_config=False,
        )

    id = __builtin__.property(_get_id)
    network_type = __builtin__.property(_get_network_type)
    priority = __builtin__.property(_get_priority)
    multi_area_adjacency_primary = __builtin__.property(
        _get_multi_area_adjacency_primary
    )
    authentication_type = __builtin__.property(_get_authentication_type)
    metric = __builtin__.property(_get_metric)
    passive = __builtin__.property(_get_passive)
    hide_network = __builtin__.property(_get_hide_network)

    _pyangbind_elements = OrderedDict(
        [
            ("id", id),
            ("network_type", network_type),
            ("priority", priority),
            ("multi_area_adjacency_primary", multi_area_adjacency_primary),
            ("authentication_type", authentication_type),
            ("metric", metric),
            ("passive", passive),
            ("hide_network", hide_network),
        ]
    )
