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


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

  YANG Description: State variables for Ethernet interfaces
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__mac_address",
        "__auto_negotiate",
        "__duplex_mode",
        "__port_speed",
        "__enable_flow_control",
        "__hw_mac_address",
        "__effective_speed",
        "__negotiated_duplex_mode",
        "__negotiated_port_speed",
        "__counters",
        "__aggregate_id",
    )

    _yang_name = "state"

    _pybind_generated_by = "container"

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

        self._path_helper = False

        self._extmethods = False
        self.__mac_address = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_dict={"pattern": "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}"},
            ),
            is_leaf=True,
            yang_name="mac-address",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="yang:mac-address",
            is_config=False,
        )
        self.__auto_negotiate = YANGDynClass(
            base=YANGBool,
            default=YANGBool("true"),
            is_leaf=True,
            yang_name="auto-negotiate",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="boolean",
            is_config=False,
        )
        self.__duplex_mode = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={"FULL": {}, "HALF": {}},
            ),
            is_leaf=True,
            yang_name="duplex-mode",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="enumeration",
            is_config=False,
        )
        self.__port_speed = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "SPEED_10MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_10MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_100MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_100MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_1GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_1GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_10GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_10GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_25GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_25GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_40GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_40GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_50GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_50GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_100GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_100GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_UNKNOWN": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_UNKNOWN": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                },
            ),
            is_leaf=True,
            yang_name="port-speed",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="identityref",
            is_config=False,
        )
        self.__enable_flow_control = YANGDynClass(
            base=YANGBool,
            default=YANGBool("false"),
            is_leaf=True,
            yang_name="enable-flow-control",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="boolean",
            is_config=False,
        )
        self.__hw_mac_address = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_dict={"pattern": "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}"},
            ),
            is_leaf=True,
            yang_name="hw-mac-address",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="yang:mac-address",
            is_config=False,
        )
        self.__effective_speed = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..4294967295"]},
                int_size=32,
            ),
            is_leaf=True,
            yang_name="effective-speed",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="uint32",
            is_config=False,
        )
        self.__negotiated_duplex_mode = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={"FULL": {}, "HALF": {}},
            ),
            is_leaf=True,
            yang_name="negotiated-duplex-mode",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="enumeration",
            is_config=False,
        )
        self.__negotiated_port_speed = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "SPEED_10MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_10MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_100MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_100MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_1GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_1GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_10GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_10GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_25GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_25GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_40GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_40GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_50GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_50GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_100GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_100GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_UNKNOWN": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_UNKNOWN": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                },
            ),
            is_leaf=True,
            yang_name="negotiated-port-speed",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="identityref",
            is_config=False,
        )
        self.__counters = YANGDynClass(
            base=counters.counters,
            is_container="container",
            yang_name="counters",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="container",
            is_config=False,
        )
        self.__aggregate_id = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="aggregate-id",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/aggregate",
            defining_module="openconfig-if-aggregate",
            yang_type="leafref",
            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 ["interfaces", "interface", "ethernet", "state"]

    def _get_mac_address(self):
        """
    Getter method for mac_address, mapped from YANG variable /interfaces/interface/ethernet/state/mac_address (yang:mac-address)

    YANG Description: Assigns a MAC address to the Ethernet interface.  If not
specified, the corresponding operational state leaf is
expected to show the system-assigned MAC address.
    """
        return self.__mac_address

    def _set_mac_address(self, v, load=False):
        """
    Setter method for mac_address, mapped from YANG variable /interfaces/interface/ethernet/state/mac_address (yang:mac-address)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_mac_address is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_mac_address() directly.

    YANG Description: Assigns a MAC address to the Ethernet interface.  If not
specified, the corresponding operational state leaf is
expected to show the system-assigned MAC address.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={"pattern": "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}"},
                ),
                is_leaf=True,
                yang_name="mac-address",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/interfaces/ethernet",
                defining_module="openconfig-if-ethernet",
                yang_type="yang:mac-address",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """mac_address must be of a type compatible with yang:mac-address""",
                    "defined-type": "yang:mac-address",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="mac-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/interfaces/ethernet', defining_module='openconfig-if-ethernet', yang_type='yang:mac-address', is_config=False)""",
                }
            )

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

    def _unset_mac_address(self):
        self.__mac_address = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_dict={"pattern": "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}"},
            ),
            is_leaf=True,
            yang_name="mac-address",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="yang:mac-address",
            is_config=False,
        )

    def _get_auto_negotiate(self):
        """
    Getter method for auto_negotiate, mapped from YANG variable /interfaces/interface/ethernet/state/auto_negotiate (boolean)

    YANG Description: Set to TRUE to request the interface to auto-negotiate
transmission parameters with its peer interface.  When
set to FALSE, the transmission parameters are specified
manually.
    """
        return self.__auto_negotiate

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

    YANG Description: Set to TRUE to request the interface to auto-negotiate
transmission parameters with its peer interface.  When
set to FALSE, the transmission parameters are specified
manually.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                default=YANGBool("true"),
                is_leaf=True,
                yang_name="auto-negotiate",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/interfaces/ethernet",
                defining_module="openconfig-if-ethernet",
                yang_type="boolean",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """auto_negotiate must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, default=YANGBool("true"), is_leaf=True, yang_name="auto-negotiate", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/interfaces/ethernet', defining_module='openconfig-if-ethernet', yang_type='boolean', is_config=False)""",
                }
            )

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

    def _unset_auto_negotiate(self):
        self.__auto_negotiate = YANGDynClass(
            base=YANGBool,
            default=YANGBool("true"),
            is_leaf=True,
            yang_name="auto-negotiate",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="boolean",
            is_config=False,
        )

    def _get_duplex_mode(self):
        """
    Getter method for duplex_mode, mapped from YANG variable /interfaces/interface/ethernet/state/duplex_mode (enumeration)

    YANG Description: When auto-negotiate is TRUE, this optionally sets the
duplex mode that will be advertised to the peer.  If
unspecified, the interface should negotiate the duplex mode
directly (typically full-duplex).  When auto-negotiate is
FALSE, this sets the duplex mode on the interface directly.
    """
        return self.__duplex_mode

    def _set_duplex_mode(self, v, load=False):
        """
    Setter method for duplex_mode, mapped from YANG variable /interfaces/interface/ethernet/state/duplex_mode (enumeration)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_duplex_mode is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_duplex_mode() directly.

    YANG Description: When auto-negotiate is TRUE, this optionally sets the
duplex mode that will be advertised to the peer.  If
unspecified, the interface should negotiate the duplex mode
directly (typically full-duplex).  When auto-negotiate is
FALSE, this sets the duplex mode on the interface directly.
    """
        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={"FULL": {}, "HALF": {}},
                ),
                is_leaf=True,
                yang_name="duplex-mode",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/interfaces/ethernet",
                defining_module="openconfig-if-ethernet",
                yang_type="enumeration",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """duplex_mode must be of a type compatible with enumeration""",
                    "defined-type": "openconfig-if-ethernet:enumeration",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'FULL': {}, 'HALF': {}},), is_leaf=True, yang_name="duplex-mode", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/interfaces/ethernet', defining_module='openconfig-if-ethernet', yang_type='enumeration', is_config=False)""",
                }
            )

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

    def _unset_duplex_mode(self):
        self.__duplex_mode = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={"FULL": {}, "HALF": {}},
            ),
            is_leaf=True,
            yang_name="duplex-mode",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="enumeration",
            is_config=False,
        )

    def _get_port_speed(self):
        """
    Getter method for port_speed, mapped from YANG variable /interfaces/interface/ethernet/state/port_speed (identityref)

    YANG Description: When auto-negotiate is TRUE, this optionally sets the
port-speed mode that will be advertised to the peer for
negotiation.  If unspecified, it is expected that the
interface will select the highest speed available based on
negotiation.  When auto-negotiate is set to FALSE, sets the
link speed to a fixed value -- supported values are defined
by ETHERNET_SPEED identities
    """
        return self.__port_speed

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

    YANG Description: When auto-negotiate is TRUE, this optionally sets the
port-speed mode that will be advertised to the peer for
negotiation.  If unspecified, it is expected that the
interface will select the highest speed available based on
negotiation.  When auto-negotiate is set to FALSE, sets the
link speed to a fixed value -- supported values are defined
by ETHERNET_SPEED identities
    """
        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={
                        "SPEED_10MB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_10MB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_100MB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_100MB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_1GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_1GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_10GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_10GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_25GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_25GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_40GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_40GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_50GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_50GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_100GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_100GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_UNKNOWN": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_UNKNOWN": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                    },
                ),
                is_leaf=True,
                yang_name="port-speed",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/interfaces/ethernet",
                defining_module="openconfig-if-ethernet",
                yang_type="identityref",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """port_speed must be of a type compatible with identityref""",
                    "defined-type": "openconfig-if-ethernet:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'SPEED_10MB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_10MB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_100MB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_100MB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_1GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_1GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_10GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_10GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_25GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_25GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_40GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_40GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_50GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_50GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_100GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_100GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_UNKNOWN': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_UNKNOWN': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}},), is_leaf=True, yang_name="port-speed", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/interfaces/ethernet', defining_module='openconfig-if-ethernet', yang_type='identityref', is_config=False)""",
                }
            )

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

    def _unset_port_speed(self):
        self.__port_speed = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "SPEED_10MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_10MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_100MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_100MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_1GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_1GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_10GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_10GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_25GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_25GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_40GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_40GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_50GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_50GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_100GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_100GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_UNKNOWN": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_UNKNOWN": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                },
            ),
            is_leaf=True,
            yang_name="port-speed",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="identityref",
            is_config=False,
        )

    def _get_enable_flow_control(self):
        """
    Getter method for enable_flow_control, mapped from YANG variable /interfaces/interface/ethernet/state/enable_flow_control (boolean)

    YANG Description: Enable or disable flow control for this interface.
Ethernet flow control is a mechanism by which a receiver
may send PAUSE frames to a sender to stop transmission for
a specified time.

This setting should override auto-negotiated flow control
settings.  If left unspecified, and auto-negotiate is TRUE,
flow control mode is negotiated with the peer interface.
    """
        return self.__enable_flow_control

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

    YANG Description: Enable or disable flow control for this interface.
Ethernet flow control is a mechanism by which a receiver
may send PAUSE frames to a sender to stop transmission for
a specified time.

This setting should override auto-negotiated flow control
settings.  If left unspecified, and auto-negotiate is TRUE,
flow control mode is negotiated with the peer interface.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=YANGBool,
                default=YANGBool("false"),
                is_leaf=True,
                yang_name="enable-flow-control",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/interfaces/ethernet",
                defining_module="openconfig-if-ethernet",
                yang_type="boolean",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """enable_flow_control must be of a type compatible with boolean""",
                    "defined-type": "boolean",
                    "generated-type": """YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="enable-flow-control", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/interfaces/ethernet', defining_module='openconfig-if-ethernet', yang_type='boolean', is_config=False)""",
                }
            )

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

    def _unset_enable_flow_control(self):
        self.__enable_flow_control = YANGDynClass(
            base=YANGBool,
            default=YANGBool("false"),
            is_leaf=True,
            yang_name="enable-flow-control",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="boolean",
            is_config=False,
        )

    def _get_hw_mac_address(self):
        """
    Getter method for hw_mac_address, mapped from YANG variable /interfaces/interface/ethernet/state/hw_mac_address (yang:mac-address)

    YANG Description: Represenets the 'burned-in',  or system-assigned, MAC
address for the Ethernet interface.
    """
        return self.__hw_mac_address

    def _set_hw_mac_address(self, v, load=False):
        """
    Setter method for hw_mac_address, mapped from YANG variable /interfaces/interface/ethernet/state/hw_mac_address (yang:mac-address)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_hw_mac_address is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_hw_mac_address() directly.

    YANG Description: Represenets the 'burned-in',  or system-assigned, MAC
address for the Ethernet interface.
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={"pattern": "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}"},
                ),
                is_leaf=True,
                yang_name="hw-mac-address",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/interfaces/ethernet",
                defining_module="openconfig-if-ethernet",
                yang_type="yang:mac-address",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """hw_mac_address must be of a type compatible with yang:mac-address""",
                    "defined-type": "yang:mac-address",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_dict={'pattern': '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="hw-mac-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/interfaces/ethernet', defining_module='openconfig-if-ethernet', yang_type='yang:mac-address', is_config=False)""",
                }
            )

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

    def _unset_hw_mac_address(self):
        self.__hw_mac_address = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_dict={"pattern": "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}"},
            ),
            is_leaf=True,
            yang_name="hw-mac-address",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="yang:mac-address",
            is_config=False,
        )

    def _get_effective_speed(self):
        """
    Getter method for effective_speed, mapped from YANG variable /interfaces/interface/ethernet/state/effective_speed (uint32)

    YANG Description: Reports the effective speed of the interface, e.g., the
negotiated speed if auto-negotiate is enabled
    """
        return self.__effective_speed

    def _set_effective_speed(self, v, load=False):
        """
    Setter method for effective_speed, mapped from YANG variable /interfaces/interface/ethernet/state/effective_speed (uint32)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_effective_speed is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_effective_speed() directly.

    YANG Description: Reports the effective speed of the interface, e.g., the
negotiated speed if auto-negotiate is enabled
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=RestrictedClassType(
                    base_type=long,
                    restriction_dict={"range": ["0..4294967295"]},
                    int_size=32,
                ),
                is_leaf=True,
                yang_name="effective-speed",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/interfaces/ethernet",
                defining_module="openconfig-if-ethernet",
                yang_type="uint32",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """effective_speed must be of a type compatible with uint32""",
                    "defined-type": "uint32",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="effective-speed", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/interfaces/ethernet', defining_module='openconfig-if-ethernet', yang_type='uint32', is_config=False)""",
                }
            )

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

    def _unset_effective_speed(self):
        self.__effective_speed = YANGDynClass(
            base=RestrictedClassType(
                base_type=long,
                restriction_dict={"range": ["0..4294967295"]},
                int_size=32,
            ),
            is_leaf=True,
            yang_name="effective-speed",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="uint32",
            is_config=False,
        )

    def _get_negotiated_duplex_mode(self):
        """
    Getter method for negotiated_duplex_mode, mapped from YANG variable /interfaces/interface/ethernet/state/negotiated_duplex_mode (enumeration)

    YANG Description: When auto-negotiate is set to TRUE, and the interface has
completed auto-negotiation with the remote peer, this value
shows the duplex mode that has been negotiated.
    """
        return self.__negotiated_duplex_mode

    def _set_negotiated_duplex_mode(self, v, load=False):
        """
    Setter method for negotiated_duplex_mode, mapped from YANG variable /interfaces/interface/ethernet/state/negotiated_duplex_mode (enumeration)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_negotiated_duplex_mode is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_negotiated_duplex_mode() directly.

    YANG Description: When auto-negotiate is set to TRUE, and the interface has
completed auto-negotiation with the remote peer, this value
shows the duplex mode that has been negotiated.
    """
        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={"FULL": {}, "HALF": {}},
                ),
                is_leaf=True,
                yang_name="negotiated-duplex-mode",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/interfaces/ethernet",
                defining_module="openconfig-if-ethernet",
                yang_type="enumeration",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """negotiated_duplex_mode must be of a type compatible with enumeration""",
                    "defined-type": "openconfig-if-ethernet:enumeration",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'FULL': {}, 'HALF': {}},), is_leaf=True, yang_name="negotiated-duplex-mode", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/interfaces/ethernet', defining_module='openconfig-if-ethernet', yang_type='enumeration', is_config=False)""",
                }
            )

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

    def _unset_negotiated_duplex_mode(self):
        self.__negotiated_duplex_mode = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={"FULL": {}, "HALF": {}},
            ),
            is_leaf=True,
            yang_name="negotiated-duplex-mode",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="enumeration",
            is_config=False,
        )

    def _get_negotiated_port_speed(self):
        """
    Getter method for negotiated_port_speed, mapped from YANG variable /interfaces/interface/ethernet/state/negotiated_port_speed (identityref)

    YANG Description: When auto-negotiate is set to TRUE, and the interface has
completed auto-negotiation with the remote peer, this value
shows the interface speed that has been negotiated.
    """
        return self.__negotiated_port_speed

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

    YANG Description: When auto-negotiate is set to TRUE, and the interface has
completed auto-negotiation with the remote peer, this value
shows the interface speed that has been negotiated.
    """
        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={
                        "SPEED_10MB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_10MB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_100MB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_100MB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_1GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_1GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_10GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_10GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_25GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_25GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_40GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_40GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_50GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_50GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_100GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_100GB": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "SPEED_UNKNOWN": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                        "oc-eth:SPEED_UNKNOWN": {
                            "@module": "openconfig-if-ethernet",
                            "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                        },
                    },
                ),
                is_leaf=True,
                yang_name="negotiated-port-speed",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/interfaces/ethernet",
                defining_module="openconfig-if-ethernet",
                yang_type="identityref",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """negotiated_port_speed must be of a type compatible with identityref""",
                    "defined-type": "openconfig-if-ethernet:identityref",
                    "generated-type": """YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'SPEED_10MB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_10MB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_100MB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_100MB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_1GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_1GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_10GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_10GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_25GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_25GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_40GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_40GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_50GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_50GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_100GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_100GB': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'SPEED_UNKNOWN': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}, 'oc-eth:SPEED_UNKNOWN': {'@module': 'openconfig-if-ethernet', '@namespace': 'http://openconfig.net/yang/interfaces/ethernet'}},), is_leaf=True, yang_name="negotiated-port-speed", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/interfaces/ethernet', defining_module='openconfig-if-ethernet', yang_type='identityref', is_config=False)""",
                }
            )

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

    def _unset_negotiated_port_speed(self):
        self.__negotiated_port_speed = YANGDynClass(
            base=RestrictedClassType(
                base_type=six.text_type,
                restriction_type="dict_key",
                restriction_arg={
                    "SPEED_10MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_10MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_100MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_100MB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_1GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_1GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_10GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_10GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_25GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_25GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_40GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_40GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_50GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_50GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_100GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_100GB": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "SPEED_UNKNOWN": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                    "oc-eth:SPEED_UNKNOWN": {
                        "@module": "openconfig-if-ethernet",
                        "@namespace": "http://openconfig.net/yang/interfaces/ethernet",
                    },
                },
            ),
            is_leaf=True,
            yang_name="negotiated-port-speed",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="identityref",
            is_config=False,
        )

    def _get_counters(self):
        """
    Getter method for counters, mapped from YANG variable /interfaces/interface/ethernet/state/counters (container)

    YANG Description: Ethernet interface counters
    """
        return self.__counters

    def _set_counters(self, v, load=False):
        """
    Setter method for counters, mapped from YANG variable /interfaces/interface/ethernet/state/counters (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_counters is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_counters() directly.

    YANG Description: Ethernet interface counters
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=counters.counters,
                is_container="container",
                yang_name="counters",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                extensions=None,
                namespace="http://openconfig.net/yang/interfaces/ethernet",
                defining_module="openconfig-if-ethernet",
                yang_type="container",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """counters must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=counters.counters, is_container='container', yang_name="counters", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/interfaces/ethernet', defining_module='openconfig-if-ethernet', yang_type='container', is_config=False)""",
                }
            )

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

    def _unset_counters(self):
        self.__counters = YANGDynClass(
            base=counters.counters,
            is_container="container",
            yang_name="counters",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/interfaces/ethernet",
            defining_module="openconfig-if-ethernet",
            yang_type="container",
            is_config=False,
        )

    def _get_aggregate_id(self):
        """
    Getter method for aggregate_id, mapped from YANG variable /interfaces/interface/ethernet/state/aggregate_id (leafref)

    YANG Description: Specify the logical aggregate interface to which
this interface belongs
    """
        return self.__aggregate_id

    def _set_aggregate_id(self, v, load=False):
        """
    Setter method for aggregate_id, mapped from YANG variable /interfaces/interface/ethernet/state/aggregate_id (leafref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_aggregate_id is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_aggregate_id() directly.

    YANG Description: Specify the logical aggregate interface to which
this interface belongs
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="aggregate-id",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/interfaces/aggregate",
                defining_module="openconfig-if-aggregate",
                yang_type="leafref",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """aggregate_id must be of a type compatible with leafref""",
                    "defined-type": "leafref",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="aggregate-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/interfaces/aggregate', defining_module='openconfig-if-aggregate', yang_type='leafref', is_config=False)""",
                }
            )

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

    def _unset_aggregate_id(self):
        self.__aggregate_id = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="aggregate-id",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/interfaces/aggregate",
            defining_module="openconfig-if-aggregate",
            yang_type="leafref",
            is_config=False,
        )

    mac_address = __builtin__.property(_get_mac_address)
    auto_negotiate = __builtin__.property(_get_auto_negotiate)
    duplex_mode = __builtin__.property(_get_duplex_mode)
    port_speed = __builtin__.property(_get_port_speed)
    enable_flow_control = __builtin__.property(_get_enable_flow_control)
    hw_mac_address = __builtin__.property(_get_hw_mac_address)
    effective_speed = __builtin__.property(_get_effective_speed)
    negotiated_duplex_mode = __builtin__.property(_get_negotiated_duplex_mode)
    negotiated_port_speed = __builtin__.property(_get_negotiated_port_speed)
    counters = __builtin__.property(_get_counters)
    aggregate_id = __builtin__.property(_get_aggregate_id)

    _pyangbind_elements = OrderedDict(
        [
            ("mac_address", mac_address),
            ("auto_negotiate", auto_negotiate),
            ("duplex_mode", duplex_mode),
            ("port_speed", port_speed),
            ("enable_flow_control", enable_flow_control),
            ("hw_mac_address", hw_mac_address),
            ("effective_speed", effective_speed),
            ("negotiated_duplex_mode", negotiated_duplex_mode),
            ("negotiated_port_speed", negotiated_port_speed),
            ("counters", counters),
            ("aggregate_id", aggregate_id),
        ]
    )
