
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from decimal import Decimal
from bitarray import bitarray
import __builtin__
class collector_profile(PybindBase):
  """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module brocade-telemetry - based on the path /telemetry/collector/collector-profile. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.
  """
  __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_rest_name', '_extmethods', '__collector_profiletype','__collector_profilename',)

  _yang_name = 'collector-profile'
  _rest_name = 'profile'

  _pybind_generated_by = 'container'

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

    path_helper_ = kwargs.pop("path_helper", None)
    if path_helper_ is False:
      self._path_helper = False
    elif path_helper_ is not None and isinstance(path_helper_, xpathhelper.YANGPathHelper):
      self._path_helper = path_helper_
    elif hasattr(self, "_parent"):
      path_helper_ = getattr(self._parent, "_path_helper", False)
      self._path_helper = path_helper_
    else:
      self._path_helper = False

    extmethods = kwargs.pop("extmethods", None)
    if extmethods is False:
      self._extmethods = False
    elif extmethods is not None and isinstance(extmethods, dict):
      self._extmethods = extmethods
    elif hasattr(self, "_parent"):
      extmethods = getattr(self._parent, "_extmethods", None)
      self._extmethods = extmethods
    else:
      self._extmethods = False
    self.__collector_profiletype = YANGDynClass(base=RestrictedClassType(base_type=unicode,                                     restriction_type="dict_key",                                     restriction_arg={u'mpls-traffic-bypass-profile': {'value': 7}, u'mpls-traffic-lsp-profile': {'value': 6}, u'enhanced-voq-discard-pkts-profile': {'value': 3}, u'enhanced-voq-max-queue-depth-profile': {'value': 4}, u'tm-voq-profile': {'value': 5}, u'mpls-traffic-fec-profile': {'value': 8}, u'interface-profile': {'value': 2}, u'system-profile': {'value': 1}},), is_leaf=True, yang_name="collector-profiletype", rest_name="collector-profiletype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'info': u'Collector profile type'}}, is_keyval=True, namespace='urn:brocade.com:mgmt:brocade-telemetry', defining_module='brocade-telemetry', yang_type='telemetry-profile-type', is_config=True)
    self.__collector_profilename = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'default_system_utilization_statistics|default_interface_statistics|default_enhanced_voq_discard_pkts_statistics|default_enhanced_voq_max_queue_depth_statistics|default_tm_voq_statistics|default_mpls_traffic_lsp_statistics|default_mpls_traffic_bypass_statistics|default_mpls_traffic_fec_statistics', 'length': [u'3..64']}), is_leaf=True, yang_name="collector-profilename", rest_name="collector-profilename", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'info': u'Name of Telemetry profile to be added to the collector'}}, is_keyval=True, namespace='urn:brocade.com:mgmt:brocade-telemetry', defining_module='brocade-telemetry', yang_type='collector-profile-name-type', is_config=True)

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

  def _path(self):
    if hasattr(self, "_parent"):
      return self._parent._path()+[self._yang_name]
    else:
      return [u'telemetry', u'collector', u'collector-profile']

  def _rest_path(self):
    if hasattr(self, "_parent"):
      if self._rest_name:
        return self._parent._rest_path()+[self._rest_name]
      else:
        return self._parent._rest_path()
    else:
      return [u'telemetry', u'collector', u'profile']

  def _get_collector_profiletype(self):
    """
    Getter method for collector_profiletype, mapped from YANG variable /telemetry/collector/collector_profile/collector_profiletype (telemetry-profile-type)
    """
    return self.__collector_profiletype
      
  def _set_collector_profiletype(self, v, load=False):
    """
    Setter method for collector_profiletype, mapped from YANG variable /telemetry/collector/collector_profile/collector_profiletype (telemetry-profile-type)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_collector_profiletype is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_collector_profiletype() directly.
    """
    parent = getattr(self, "_parent", None)
    if parent is not None and load is False:
      raise AttributeError("Cannot set keys directly when" +
                             " within an instantiated list")

    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode,                                     restriction_type="dict_key",                                     restriction_arg={u'mpls-traffic-bypass-profile': {'value': 7}, u'mpls-traffic-lsp-profile': {'value': 6}, u'enhanced-voq-discard-pkts-profile': {'value': 3}, u'enhanced-voq-max-queue-depth-profile': {'value': 4}, u'tm-voq-profile': {'value': 5}, u'mpls-traffic-fec-profile': {'value': 8}, u'interface-profile': {'value': 2}, u'system-profile': {'value': 1}},), is_leaf=True, yang_name="collector-profiletype", rest_name="collector-profiletype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'info': u'Collector profile type'}}, is_keyval=True, namespace='urn:brocade.com:mgmt:brocade-telemetry', defining_module='brocade-telemetry', yang_type='telemetry-profile-type', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """collector_profiletype must be of a type compatible with telemetry-profile-type""",
          'defined-type': "brocade-telemetry:telemetry-profile-type",
          'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode,                                     restriction_type="dict_key",                                     restriction_arg={u'mpls-traffic-bypass-profile': {'value': 7}, u'mpls-traffic-lsp-profile': {'value': 6}, u'enhanced-voq-discard-pkts-profile': {'value': 3}, u'enhanced-voq-max-queue-depth-profile': {'value': 4}, u'tm-voq-profile': {'value': 5}, u'mpls-traffic-fec-profile': {'value': 8}, u'interface-profile': {'value': 2}, u'system-profile': {'value': 1}},), is_leaf=True, yang_name="collector-profiletype", rest_name="collector-profiletype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'info': u'Collector profile type'}}, is_keyval=True, namespace='urn:brocade.com:mgmt:brocade-telemetry', defining_module='brocade-telemetry', yang_type='telemetry-profile-type', is_config=True)""",
        })

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

  def _unset_collector_profiletype(self):
    self.__collector_profiletype = YANGDynClass(base=RestrictedClassType(base_type=unicode,                                     restriction_type="dict_key",                                     restriction_arg={u'mpls-traffic-bypass-profile': {'value': 7}, u'mpls-traffic-lsp-profile': {'value': 6}, u'enhanced-voq-discard-pkts-profile': {'value': 3}, u'enhanced-voq-max-queue-depth-profile': {'value': 4}, u'tm-voq-profile': {'value': 5}, u'mpls-traffic-fec-profile': {'value': 8}, u'interface-profile': {'value': 2}, u'system-profile': {'value': 1}},), is_leaf=True, yang_name="collector-profiletype", rest_name="collector-profiletype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'info': u'Collector profile type'}}, is_keyval=True, namespace='urn:brocade.com:mgmt:brocade-telemetry', defining_module='brocade-telemetry', yang_type='telemetry-profile-type', is_config=True)


  def _get_collector_profilename(self):
    """
    Getter method for collector_profilename, mapped from YANG variable /telemetry/collector/collector_profile/collector_profilename (collector-profile-name-type)
    """
    return self.__collector_profilename
      
  def _set_collector_profilename(self, v, load=False):
    """
    Setter method for collector_profilename, mapped from YANG variable /telemetry/collector/collector_profile/collector_profilename (collector-profile-name-type)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_collector_profilename is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_collector_profilename() directly.
    """
    parent = getattr(self, "_parent", None)
    if parent is not None and load is False:
      raise AttributeError("Cannot set keys directly when" +
                             " within an instantiated list")

    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'default_system_utilization_statistics|default_interface_statistics|default_enhanced_voq_discard_pkts_statistics|default_enhanced_voq_max_queue_depth_statistics|default_tm_voq_statistics|default_mpls_traffic_lsp_statistics|default_mpls_traffic_bypass_statistics|default_mpls_traffic_fec_statistics', 'length': [u'3..64']}), is_leaf=True, yang_name="collector-profilename", rest_name="collector-profilename", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'info': u'Name of Telemetry profile to be added to the collector'}}, is_keyval=True, namespace='urn:brocade.com:mgmt:brocade-telemetry', defining_module='brocade-telemetry', yang_type='collector-profile-name-type', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """collector_profilename must be of a type compatible with collector-profile-name-type""",
          'defined-type': "brocade-telemetry:collector-profile-name-type",
          'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'default_system_utilization_statistics|default_interface_statistics|default_enhanced_voq_discard_pkts_statistics|default_enhanced_voq_max_queue_depth_statistics|default_tm_voq_statistics|default_mpls_traffic_lsp_statistics|default_mpls_traffic_bypass_statistics|default_mpls_traffic_fec_statistics', 'length': [u'3..64']}), is_leaf=True, yang_name="collector-profilename", rest_name="collector-profilename", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'info': u'Name of Telemetry profile to be added to the collector'}}, is_keyval=True, namespace='urn:brocade.com:mgmt:brocade-telemetry', defining_module='brocade-telemetry', yang_type='collector-profile-name-type', is_config=True)""",
        })

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

  def _unset_collector_profilename(self):
    self.__collector_profilename = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'default_system_utilization_statistics|default_interface_statistics|default_enhanced_voq_discard_pkts_statistics|default_enhanced_voq_max_queue_depth_statistics|default_tm_voq_statistics|default_mpls_traffic_lsp_statistics|default_mpls_traffic_bypass_statistics|default_mpls_traffic_fec_statistics', 'length': [u'3..64']}), is_leaf=True, yang_name="collector-profilename", rest_name="collector-profilename", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'info': u'Name of Telemetry profile to be added to the collector'}}, is_keyval=True, namespace='urn:brocade.com:mgmt:brocade-telemetry', defining_module='brocade-telemetry', yang_type='collector-profile-name-type', is_config=True)

  collector_profiletype = __builtin__.property(_get_collector_profiletype, _set_collector_profiletype)
  collector_profilename = __builtin__.property(_get_collector_profilename, _set_collector_profilename)


  _pyangbind_elements = {'collector_profiletype': collector_profiletype, 'collector_profilename': collector_profilename, }


