# -*- 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-network-instance - based on the path /network-instances/network-instance/segment-routing/te-policies/te-policy/candidate-paths/candidate-path/segment-lists/segment-list/state. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Operational state parameters associated with a
segment-list in a SR-TE candidate paths.
  """
  __slots__ = ('_path_helper', '_extmethods', '__id','__valid','__invalid_reason','__weight','__counters',)

  _yang_name = 'state'

  _pybind_generated_by = 'container'

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

    self._path_helper = False

    self._extmethods = False
    self.__id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), 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='uint32', is_config=False)
    self.__valid = YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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.__invalid_reason = YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)
    self.__weight = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="weight", 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='uint32', 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/network-instance', defining_module='openconfig-network-instance', yang_type='container', 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', 'segment-routing', 'te-policies', 'te-policy', 'candidate-paths', 'candidate-path', 'segment-lists', 'segment-list', 'state']

  def _get_id(self):
    """
    Getter method for id, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/id (uint32)

    YANG Description: A unique id identifying the segment-list.
    """
    return self.__id
      
  def _set_id(self, v, load=False):
    """
    Setter method for id, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/id (uint32)
    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: A unique id identifying the segment-list.
    """
    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="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='uint32', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """id 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="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='uint32', is_config=False)""",
        })

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

  def _unset_id(self):
    self.__id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), 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='uint32', is_config=False)


  def _get_valid(self):
    """
    Getter method for valid, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/valid (boolean)

    YANG Description: The validity of a segment-list should marked as true
when it is usable.
    """
    return self.__valid
      
  def _set_valid(self, v, load=False):
    """
    Setter method for valid, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/valid (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_valid is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_valid() directly.

    YANG Description: The validity of a segment-list should marked as true
when it is usable.
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name="valid", 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': """valid must be of a type compatible with boolean""",
          'defined-type': "boolean",
          'generated-type': """YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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.__valid = t
    if hasattr(self, '_set'):
      self._set()

  def _unset_valid(self):
    self.__valid = YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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_invalid_reason(self):
    """
    Getter method for invalid_reason, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/invalid_reason (oc-srt:srte-invalid-sl-reason)

    YANG Description: If a segment-list is marked as invalid, this leaf should
indicate the reason.
    """
    return self.__invalid_reason
      
  def _set_invalid_reason(self, v, load=False):
    """
    Setter method for invalid_reason, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/invalid_reason (oc-srt:srte-invalid-sl-reason)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_invalid_reason is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_invalid_reason() directly.

    YANG Description: If a segment-list is marked as invalid, this leaf should
indicate the reason.
    """
    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={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """invalid_reason must be of a type compatible with oc-srt:srte-invalid-sl-reason""",
          'defined-type': "oc-srt:srte-invalid-sl-reason",
          'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)""",
        })

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

  def _unset_invalid_reason(self):
    self.__invalid_reason = YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)


  def _get_weight(self):
    """
    Getter method for weight, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/weight (uint32)

    YANG Description: The weight of the segment list within the set of
segment lists specified for the candidate path. The
traffic that is forwarded according to the policy is
distributed across the set of segment-lists such that
each list receives weight/(sum of all weights) traffic.
    """
    return self.__weight
      
  def _set_weight(self, v, load=False):
    """
    Setter method for weight, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/weight (uint32)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_weight is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_weight() directly.

    YANG Description: The weight of the segment list within the set of
segment lists specified for the candidate path. The
traffic that is forwarded according to the policy is
distributed across the set of segment-lists such that
each list receives weight/(sum of all weights) traffic.
    """
    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="weight", 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='uint32', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """weight 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="weight", 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='uint32', is_config=False)""",
        })

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

  def _unset_weight(self):
    self.__weight = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="weight", 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='uint32', is_config=False)


  def _get_counters(self):
    """
    Getter method for counters, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/counters (container)

    YANG Description: The counters of traffic steered to the segment-list.
    """
    return self.__counters
      
  def _set_counters(self, v, load=False):
    """
    Setter method for counters, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/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: The counters of traffic steered to the segment-list.
    """
    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/network-instance', defining_module='openconfig-network-instance', 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/network-instance', defining_module='openconfig-network-instance', 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/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=False)

  id = __builtin__.property(_get_id)
  valid = __builtin__.property(_get_valid)
  invalid_reason = __builtin__.property(_get_invalid_reason)
  weight = __builtin__.property(_get_weight)
  counters = __builtin__.property(_get_counters)


  _pyangbind_elements = OrderedDict([('id', id), ('valid', valid), ('invalid_reason', invalid_reason), ('weight', weight), ('counters', counters), ])


from . import counters
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/segment-routing/te-policies/te-policy/candidate-paths/candidate-path/segment-lists/segment-list/state. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Operational state parameters associated with a
segment-list in a SR-TE candidate paths.
  """
  __slots__ = ('_path_helper', '_extmethods', '__id','__valid','__invalid_reason','__weight','__counters',)

  _yang_name = 'state'

  _pybind_generated_by = 'container'

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

    self._path_helper = False

    self._extmethods = False
    self.__id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), 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='uint32', is_config=False)
    self.__valid = YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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.__invalid_reason = YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)
    self.__weight = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="weight", 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='uint32', 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/network-instance', defining_module='openconfig-network-instance', yang_type='container', 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', 'segment-routing', 'te-policies', 'te-policy', 'candidate-paths', 'candidate-path', 'segment-lists', 'segment-list', 'state']

  def _get_id(self):
    """
    Getter method for id, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/id (uint32)

    YANG Description: A unique id identifying the segment-list.
    """
    return self.__id
      
  def _set_id(self, v, load=False):
    """
    Setter method for id, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/id (uint32)
    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: A unique id identifying the segment-list.
    """
    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="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='uint32', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """id 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="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='uint32', is_config=False)""",
        })

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

  def _unset_id(self):
    self.__id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), 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='uint32', is_config=False)


  def _get_valid(self):
    """
    Getter method for valid, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/valid (boolean)

    YANG Description: The validity of a segment-list should marked as true
when it is usable.
    """
    return self.__valid
      
  def _set_valid(self, v, load=False):
    """
    Setter method for valid, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/valid (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_valid is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_valid() directly.

    YANG Description: The validity of a segment-list should marked as true
when it is usable.
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name="valid", 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': """valid must be of a type compatible with boolean""",
          'defined-type': "boolean",
          'generated-type': """YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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.__valid = t
    if hasattr(self, '_set'):
      self._set()

  def _unset_valid(self):
    self.__valid = YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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_invalid_reason(self):
    """
    Getter method for invalid_reason, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/invalid_reason (oc-srt:srte-invalid-sl-reason)

    YANG Description: If a segment-list is marked as invalid, this leaf should
indicate the reason.
    """
    return self.__invalid_reason
      
  def _set_invalid_reason(self, v, load=False):
    """
    Setter method for invalid_reason, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/invalid_reason (oc-srt:srte-invalid-sl-reason)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_invalid_reason is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_invalid_reason() directly.

    YANG Description: If a segment-list is marked as invalid, this leaf should
indicate the reason.
    """
    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={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """invalid_reason must be of a type compatible with oc-srt:srte-invalid-sl-reason""",
          'defined-type': "oc-srt:srte-invalid-sl-reason",
          'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)""",
        })

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

  def _unset_invalid_reason(self):
    self.__invalid_reason = YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)


  def _get_weight(self):
    """
    Getter method for weight, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/weight (uint32)

    YANG Description: The weight of the segment list within the set of
segment lists specified for the candidate path. The
traffic that is forwarded according to the policy is
distributed across the set of segment-lists such that
each list receives weight/(sum of all weights) traffic.
    """
    return self.__weight
      
  def _set_weight(self, v, load=False):
    """
    Setter method for weight, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/weight (uint32)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_weight is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_weight() directly.

    YANG Description: The weight of the segment list within the set of
segment lists specified for the candidate path. The
traffic that is forwarded according to the policy is
distributed across the set of segment-lists such that
each list receives weight/(sum of all weights) traffic.
    """
    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="weight", 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='uint32', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """weight 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="weight", 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='uint32', is_config=False)""",
        })

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

  def _unset_weight(self):
    self.__weight = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="weight", 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='uint32', is_config=False)


  def _get_counters(self):
    """
    Getter method for counters, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/counters (container)

    YANG Description: The counters of traffic steered to the segment-list.
    """
    return self.__counters
      
  def _set_counters(self, v, load=False):
    """
    Setter method for counters, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/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: The counters of traffic steered to the segment-list.
    """
    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/network-instance', defining_module='openconfig-network-instance', 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/network-instance', defining_module='openconfig-network-instance', 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/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=False)

  id = __builtin__.property(_get_id)
  valid = __builtin__.property(_get_valid)
  invalid_reason = __builtin__.property(_get_invalid_reason)
  weight = __builtin__.property(_get_weight)
  counters = __builtin__.property(_get_counters)


  _pyangbind_elements = OrderedDict([('id', id), ('valid', valid), ('invalid_reason', invalid_reason), ('weight', weight), ('counters', counters), ])


from . import counters
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/segment-routing/te-policies/te-policy/candidate-paths/candidate-path/segment-lists/segment-list/state. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Operational state parameters associated with a
segment-list in a SR-TE candidate paths.
  """
  __slots__ = ('_path_helper', '_extmethods', '__id','__valid','__invalid_reason','__weight','__counters',)

  _yang_name = 'state'

  _pybind_generated_by = 'container'

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

    self._path_helper = False

    self._extmethods = False
    self.__id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), 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='uint32', is_config=False)
    self.__valid = YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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.__invalid_reason = YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)
    self.__weight = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="weight", 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='uint32', 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/network-instance', defining_module='openconfig-network-instance', yang_type='container', 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', 'segment-routing', 'te-policies', 'te-policy', 'candidate-paths', 'candidate-path', 'segment-lists', 'segment-list', 'state']

  def _get_id(self):
    """
    Getter method for id, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/id (uint32)

    YANG Description: A unique id identifying the segment-list.
    """
    return self.__id
      
  def _set_id(self, v, load=False):
    """
    Setter method for id, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/id (uint32)
    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: A unique id identifying the segment-list.
    """
    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="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='uint32', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """id 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="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='uint32', is_config=False)""",
        })

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

  def _unset_id(self):
    self.__id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), 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='uint32', is_config=False)


  def _get_valid(self):
    """
    Getter method for valid, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/valid (boolean)

    YANG Description: The validity of a segment-list should marked as true
when it is usable.
    """
    return self.__valid
      
  def _set_valid(self, v, load=False):
    """
    Setter method for valid, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/valid (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_valid is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_valid() directly.

    YANG Description: The validity of a segment-list should marked as true
when it is usable.
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name="valid", 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': """valid must be of a type compatible with boolean""",
          'defined-type': "boolean",
          'generated-type': """YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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.__valid = t
    if hasattr(self, '_set'):
      self._set()

  def _unset_valid(self):
    self.__valid = YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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_invalid_reason(self):
    """
    Getter method for invalid_reason, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/invalid_reason (oc-srt:srte-invalid-sl-reason)

    YANG Description: If a segment-list is marked as invalid, this leaf should
indicate the reason.
    """
    return self.__invalid_reason
      
  def _set_invalid_reason(self, v, load=False):
    """
    Setter method for invalid_reason, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/invalid_reason (oc-srt:srte-invalid-sl-reason)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_invalid_reason is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_invalid_reason() directly.

    YANG Description: If a segment-list is marked as invalid, this leaf should
indicate the reason.
    """
    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={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """invalid_reason must be of a type compatible with oc-srt:srte-invalid-sl-reason""",
          'defined-type': "oc-srt:srte-invalid-sl-reason",
          'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)""",
        })

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

  def _unset_invalid_reason(self):
    self.__invalid_reason = YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)


  def _get_weight(self):
    """
    Getter method for weight, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/weight (uint32)

    YANG Description: The weight of the segment list within the set of
segment lists specified for the candidate path. The
traffic that is forwarded according to the policy is
distributed across the set of segment-lists such that
each list receives weight/(sum of all weights) traffic.
    """
    return self.__weight
      
  def _set_weight(self, v, load=False):
    """
    Setter method for weight, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/weight (uint32)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_weight is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_weight() directly.

    YANG Description: The weight of the segment list within the set of
segment lists specified for the candidate path. The
traffic that is forwarded according to the policy is
distributed across the set of segment-lists such that
each list receives weight/(sum of all weights) traffic.
    """
    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="weight", 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='uint32', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """weight 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="weight", 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='uint32', is_config=False)""",
        })

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

  def _unset_weight(self):
    self.__weight = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="weight", 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='uint32', is_config=False)


  def _get_counters(self):
    """
    Getter method for counters, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/counters (container)

    YANG Description: The counters of traffic steered to the segment-list.
    """
    return self.__counters
      
  def _set_counters(self, v, load=False):
    """
    Setter method for counters, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/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: The counters of traffic steered to the segment-list.
    """
    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/network-instance', defining_module='openconfig-network-instance', 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/network-instance', defining_module='openconfig-network-instance', 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/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=False)

  id = __builtin__.property(_get_id)
  valid = __builtin__.property(_get_valid)
  invalid_reason = __builtin__.property(_get_invalid_reason)
  weight = __builtin__.property(_get_weight)
  counters = __builtin__.property(_get_counters)


  _pyangbind_elements = OrderedDict([('id', id), ('valid', valid), ('invalid_reason', invalid_reason), ('weight', weight), ('counters', counters), ])


from . import counters
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/segment-routing/te-policies/te-policy/candidate-paths/candidate-path/segment-lists/segment-list/state. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Operational state parameters associated with a
segment-list in a SR-TE candidate paths.
  """
  __slots__ = ('_path_helper', '_extmethods', '__id','__valid','__invalid_reason','__weight','__counters',)

  _yang_name = 'state'

  _pybind_generated_by = 'container'

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

    self._path_helper = False

    self._extmethods = False
    self.__id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), 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='uint32', is_config=False)
    self.__valid = YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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.__invalid_reason = YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)
    self.__weight = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="weight", 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='uint32', 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/network-instance', defining_module='openconfig-network-instance', yang_type='container', 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', 'segment-routing', 'te-policies', 'te-policy', 'candidate-paths', 'candidate-path', 'segment-lists', 'segment-list', 'state']

  def _get_id(self):
    """
    Getter method for id, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/id (uint32)

    YANG Description: A unique id identifying the segment-list.
    """
    return self.__id
      
  def _set_id(self, v, load=False):
    """
    Setter method for id, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/id (uint32)
    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: A unique id identifying the segment-list.
    """
    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="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='uint32', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """id 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="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='uint32', is_config=False)""",
        })

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

  def _unset_id(self):
    self.__id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), 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='uint32', is_config=False)


  def _get_valid(self):
    """
    Getter method for valid, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/valid (boolean)

    YANG Description: The validity of a segment-list should marked as true
when it is usable.
    """
    return self.__valid
      
  def _set_valid(self, v, load=False):
    """
    Setter method for valid, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/valid (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_valid is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_valid() directly.

    YANG Description: The validity of a segment-list should marked as true
when it is usable.
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name="valid", 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': """valid must be of a type compatible with boolean""",
          'defined-type': "boolean",
          'generated-type': """YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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.__valid = t
    if hasattr(self, '_set'):
      self._set()

  def _unset_valid(self):
    self.__valid = YANGDynClass(base=YANGBool, is_leaf=True, yang_name="valid", 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_invalid_reason(self):
    """
    Getter method for invalid_reason, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/invalid_reason (oc-srt:srte-invalid-sl-reason)

    YANG Description: If a segment-list is marked as invalid, this leaf should
indicate the reason.
    """
    return self.__invalid_reason
      
  def _set_invalid_reason(self, v, load=False):
    """
    Setter method for invalid_reason, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/invalid_reason (oc-srt:srte-invalid-sl-reason)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_invalid_reason is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_invalid_reason() directly.

    YANG Description: If a segment-list is marked as invalid, this leaf should
indicate the reason.
    """
    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={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """invalid_reason must be of a type compatible with oc-srt:srte-invalid-sl-reason""",
          'defined-type': "oc-srt:srte-invalid-sl-reason",
          'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)""",
        })

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

  def _unset_invalid_reason(self):
    self.__invalid_reason = YANGDynClass(base=RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'EMPTY_SL': {}, 'ZERO_WEIGHT': {}, 'FIRST_SID_UNRESOLVABLE': {}, 'OTHER_SID_UNRESOLVABLE': {}, 'VERIFICATION_FAIL': {}},), is_leaf=True, yang_name="invalid-reason", 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-srt:srte-invalid-sl-reason', is_config=False)


  def _get_weight(self):
    """
    Getter method for weight, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/weight (uint32)

    YANG Description: The weight of the segment list within the set of
segment lists specified for the candidate path. The
traffic that is forwarded according to the policy is
distributed across the set of segment-lists such that
each list receives weight/(sum of all weights) traffic.
    """
    return self.__weight
      
  def _set_weight(self, v, load=False):
    """
    Setter method for weight, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/weight (uint32)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_weight is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_weight() directly.

    YANG Description: The weight of the segment list within the set of
segment lists specified for the candidate path. The
traffic that is forwarded according to the policy is
distributed across the set of segment-lists such that
each list receives weight/(sum of all weights) traffic.
    """
    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="weight", 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='uint32', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """weight 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="weight", 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='uint32', is_config=False)""",
        })

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

  def _unset_weight(self):
    self.__weight = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="weight", 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='uint32', is_config=False)


  def _get_counters(self):
    """
    Getter method for counters, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/state/counters (container)

    YANG Description: The counters of traffic steered to the segment-list.
    """
    return self.__counters
      
  def _set_counters(self, v, load=False):
    """
    Setter method for counters, mapped from YANG variable /network_instances/network_instance/segment_routing/te_policies/te_policy/candidate_paths/candidate_path/segment_lists/segment_list/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: The counters of traffic steered to the segment-list.
    """
    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/network-instance', defining_module='openconfig-network-instance', 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/network-instance', defining_module='openconfig-network-instance', 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/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=False)

  id = __builtin__.property(_get_id)
  valid = __builtin__.property(_get_valid)
  invalid_reason = __builtin__.property(_get_invalid_reason)
  weight = __builtin__.property(_get_weight)
  counters = __builtin__.property(_get_counters)


  _pyangbind_elements = OrderedDict([('id', id), ('valid', valid), ('invalid_reason', invalid_reason), ('weight', weight), ('counters', counters), ])


