Setter method for mode, mapped from YANG variable /brocade_interface_ext_rpc/get_interface_switchport/output/switchport/mode (interface:switchport-mode-type)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_mode is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_mode() directly.

    YANG Description: This indicates the mode of Layer2 interface.

def _set_mode(self, v, load=False):
    """
    Setter method for mode, mapped from YANG variable /brocade_interface_ext_rpc/get_interface_switchport/output/switchport/mode (interface:switchport-mode-type)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_mode is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_mode() directly.

    YANG Description: This indicates the mode of Layer2 interface.
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode,                                     restriction_type="dict_key",                                     restriction_arg={u'pvlan-promiscuous': {'value': 4}, u'trunk-no-default-native': {'value': 9}, u'pvlan-trunk-promiscuous': {'value': 5}, u'pvlan-trunk-host': {'value': 7}, u'unknown': {'value': 0}, u'pvlan-host': {'value': 6}, u'access': {'value': 1}, u'pvlan-trunk': {'value': 8}, u'trunk': {'value': 2}, u'converged': {'value': 3}},), is_leaf=True, yang_name="mode", rest_name="mode", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, namespace='urn:brocade.com:mgmt:brocade-interface-ext', defining_module='brocade-interface-ext', yang_type='interface:switchport-mode-type', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """mode must be of a type compatible with interface:switchport-mode-type""",
          'defined-type': "interface:switchport-mode-type",
          'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode,                                     restriction_type="dict_key",                                     restriction_arg={u'pvlan-promiscuous': {'value': 4}, u'trunk-no-default-native': {'value': 9}, u'pvlan-trunk-promiscuous': {'value': 5}, u'pvlan-trunk-host': {'value': 7}, u'unknown': {'value': 0}, u'pvlan-host': {'value': 6}, u'access': {'value': 1}, u'pvlan-trunk': {'value': 8}, u'trunk': {'value': 2}, u'converged': {'value': 3}},), is_leaf=True, yang_name="mode", rest_name="mode", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=False, namespace='urn:brocade.com:mgmt:brocade-interface-ext', defining_module='brocade-interface-ext', yang_type='interface:switchport-mode-type', is_config=True)""",
        })

    self.__mode = t
    if hasattr(self, '_set'):
      self._set()