
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 graceful_restart
import config
import state
import apply_policy
import ipv4_unicast
import ipv6_unicast
import ipv4_labeled_unicast
import ipv6_labeled_unicast
import l3vpn_ipv4_unicast
import l3vpn_ipv6_unicast
import l3vpn_ipv4_multicast
import l3vpn_ipv6_multicast
import l2vpn_vpls
import l2vpn_evpn
import use_multiple_paths
import route_selection_options
class afi_safi(PybindBase):
  """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-bgp - based on the path /bgp/peer-groups/peer-group/afi-safis/afi-safi. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: AFI,SAFI configuration available for the
neighbour or group
  """
  __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__afi_safi_name','__graceful_restart','__config','__state','__apply_policy','__ipv4_unicast','__ipv6_unicast','__ipv4_labeled_unicast','__ipv6_labeled_unicast','__l3vpn_ipv4_unicast','__l3vpn_ipv6_unicast','__l3vpn_ipv4_multicast','__l3vpn_ipv6_multicast','__l2vpn_vpls','__l2vpn_evpn','__use_multiple_paths','__route_selection_options',)

  _yang_name = 'afi-safi'

  _pybind_generated_by = 'container'

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

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

    self._extmethods = False
    self.__l3vpn_ipv6_multicast = YANGDynClass(base=l3vpn_ipv6_multicast.l3vpn_ipv6_multicast, is_container='container', yang_name="l3vpn-ipv6-multicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__ipv6_unicast = YANGDynClass(base=ipv6_unicast.ipv6_unicast, is_container='container', yang_name="ipv6-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__l3vpn_ipv4_multicast = YANGDynClass(base=l3vpn_ipv4_multicast.l3vpn_ipv4_multicast, is_container='container', yang_name="l3vpn-ipv4-multicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__afi_safi_name = YANGDynClass(base=ReferenceType(referenced_path='../config/afi-safi-name', caller=self._path() + ['afi-safi-name'], path_helper=self._path_helper, require_instance=True), is_leaf=True, yang_name="afi-safi-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='leafref', is_config=True)
    self.__ipv4_labeled_unicast = YANGDynClass(base=ipv4_labeled_unicast.ipv4_labeled_unicast, is_container='container', yang_name="ipv4-labeled-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__ipv6_labeled_unicast = YANGDynClass(base=ipv6_labeled_unicast.ipv6_labeled_unicast, is_container='container', yang_name="ipv6-labeled-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__use_multiple_paths = YANGDynClass(base=use_multiple_paths.use_multiple_paths, is_container='container', yang_name="use-multiple-paths", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__l2vpn_evpn = YANGDynClass(base=l2vpn_evpn.l2vpn_evpn, is_container='container', yang_name="l2vpn-evpn", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__state = YANGDynClass(base=state.state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__graceful_restart = YANGDynClass(base=graceful_restart.graceful_restart, is_container='container', yang_name="graceful-restart", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__apply_policy = YANGDynClass(base=apply_policy.apply_policy, is_container='container', yang_name="apply-policy", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__route_selection_options = YANGDynClass(base=route_selection_options.route_selection_options, is_container='container', yang_name="route-selection-options", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__l2vpn_vpls = YANGDynClass(base=l2vpn_vpls.l2vpn_vpls, is_container='container', yang_name="l2vpn-vpls", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__l3vpn_ipv6_unicast = YANGDynClass(base=l3vpn_ipv6_unicast.l3vpn_ipv6_unicast, is_container='container', yang_name="l3vpn-ipv6-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__config = YANGDynClass(base=config.config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__l3vpn_ipv4_unicast = YANGDynClass(base=l3vpn_ipv4_unicast.l3vpn_ipv4_unicast, is_container='container', yang_name="l3vpn-ipv4-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    self.__ipv4_unicast = YANGDynClass(base=ipv4_unicast.ipv4_unicast, is_container='container', yang_name="ipv4-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', 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'bgp', u'peer-groups', u'peer-group', u'afi-safis', u'afi-safi']

  def _get_afi_safi_name(self):
    """
    Getter method for afi_safi_name, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/afi_safi_name (leafref)

    YANG Description: Reference to the AFI-SAFI name used as a key
for the AFI-SAFI list
    """
    return self.__afi_safi_name
      
  def _set_afi_safi_name(self, v, load=False):
    """
    Setter method for afi_safi_name, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/afi_safi_name (leafref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_afi_safi_name is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_afi_safi_name() directly.

    YANG Description: Reference to the AFI-SAFI name used as a key
for the AFI-SAFI list
    """
    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")

    try:
      t = YANGDynClass(v,base=ReferenceType(referenced_path='../config/afi-safi-name', caller=self._path() + ['afi-safi-name'], path_helper=self._path_helper, require_instance=True), is_leaf=True, yang_name="afi-safi-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='leafref', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """afi_safi_name must be of a type compatible with leafref""",
          'defined-type': "leafref",
          'generated-type': """YANGDynClass(base=ReferenceType(referenced_path='../config/afi-safi-name', caller=self._path() + ['afi-safi-name'], path_helper=self._path_helper, require_instance=True), is_leaf=True, yang_name="afi-safi-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='leafref', is_config=True)""",
        })

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

  def _unset_afi_safi_name(self):
    self.__afi_safi_name = YANGDynClass(base=ReferenceType(referenced_path='../config/afi-safi-name', caller=self._path() + ['afi-safi-name'], path_helper=self._path_helper, require_instance=True), is_leaf=True, yang_name="afi-safi-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='leafref', is_config=True)


  def _get_graceful_restart(self):
    """
    Getter method for graceful_restart, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/graceful_restart (container)

    YANG Description: Parameters relating to BGP graceful-restart
    """
    return self.__graceful_restart
      
  def _set_graceful_restart(self, v, load=False):
    """
    Setter method for graceful_restart, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/graceful_restart (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_graceful_restart is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_graceful_restart() directly.

    YANG Description: Parameters relating to BGP graceful-restart
    """
    try:
      t = YANGDynClass(v,base=graceful_restart.graceful_restart, is_container='container', yang_name="graceful-restart", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """graceful_restart must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=graceful_restart.graceful_restart, is_container='container', yang_name="graceful-restart", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_graceful_restart(self):
    self.__graceful_restart = YANGDynClass(base=graceful_restart.graceful_restart, is_container='container', yang_name="graceful-restart", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_config(self):
    """
    Getter method for config, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/config (container)

    YANG Description: Configuration parameters for the AFI-SAFI
    """
    return self.__config
      
  def _set_config(self, v, load=False):
    """
    Setter method for config, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/config (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_config is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_config() directly.

    YANG Description: Configuration parameters for the AFI-SAFI
    """
    try:
      t = YANGDynClass(v,base=config.config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """config must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=config.config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_config(self):
    self.__config = YANGDynClass(base=config.config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_state(self):
    """
    Getter method for state, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/state (container)

    YANG Description: State information relating to the AFI-SAFI
    """
    return self.__state
      
  def _set_state(self, v, load=False):
    """
    Setter method for state, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/state (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_state is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_state() directly.

    YANG Description: State information relating to the AFI-SAFI
    """
    try:
      t = YANGDynClass(v,base=state.state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """state must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=state.state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_state(self):
    self.__state = YANGDynClass(base=state.state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_apply_policy(self):
    """
    Getter method for apply_policy, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/apply_policy (container)

    YANG Description: Anchor point for routing policies in the model.
Import and export policies are with respect to the local
routing table, i.e., export (send) and import (receive),
depending on the context.
    """
    return self.__apply_policy
      
  def _set_apply_policy(self, v, load=False):
    """
    Setter method for apply_policy, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/apply_policy (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_apply_policy is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_apply_policy() directly.

    YANG Description: Anchor point for routing policies in the model.
Import and export policies are with respect to the local
routing table, i.e., export (send) and import (receive),
depending on the context.
    """
    try:
      t = YANGDynClass(v,base=apply_policy.apply_policy, is_container='container', yang_name="apply-policy", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """apply_policy must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=apply_policy.apply_policy, is_container='container', yang_name="apply-policy", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_apply_policy(self):
    self.__apply_policy = YANGDynClass(base=apply_policy.apply_policy, is_container='container', yang_name="apply-policy", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_ipv4_unicast(self):
    """
    Getter method for ipv4_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/ipv4_unicast (container)

    YANG Description: IPv4 unicast configuration options
    """
    return self.__ipv4_unicast
      
  def _set_ipv4_unicast(self, v, load=False):
    """
    Setter method for ipv4_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/ipv4_unicast (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_ipv4_unicast is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_ipv4_unicast() directly.

    YANG Description: IPv4 unicast configuration options
    """
    try:
      t = YANGDynClass(v,base=ipv4_unicast.ipv4_unicast, is_container='container', yang_name="ipv4-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """ipv4_unicast must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=ipv4_unicast.ipv4_unicast, is_container='container', yang_name="ipv4-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_ipv4_unicast(self):
    self.__ipv4_unicast = YANGDynClass(base=ipv4_unicast.ipv4_unicast, is_container='container', yang_name="ipv4-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_ipv6_unicast(self):
    """
    Getter method for ipv6_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/ipv6_unicast (container)

    YANG Description: IPv6 unicast configuration options
    """
    return self.__ipv6_unicast
      
  def _set_ipv6_unicast(self, v, load=False):
    """
    Setter method for ipv6_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/ipv6_unicast (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_ipv6_unicast is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_ipv6_unicast() directly.

    YANG Description: IPv6 unicast configuration options
    """
    try:
      t = YANGDynClass(v,base=ipv6_unicast.ipv6_unicast, is_container='container', yang_name="ipv6-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """ipv6_unicast must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=ipv6_unicast.ipv6_unicast, is_container='container', yang_name="ipv6-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_ipv6_unicast(self):
    self.__ipv6_unicast = YANGDynClass(base=ipv6_unicast.ipv6_unicast, is_container='container', yang_name="ipv6-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_ipv4_labeled_unicast(self):
    """
    Getter method for ipv4_labeled_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/ipv4_labeled_unicast (container)

    YANG Description: IPv4 Labeled Unicast configuration options
    """
    return self.__ipv4_labeled_unicast
      
  def _set_ipv4_labeled_unicast(self, v, load=False):
    """
    Setter method for ipv4_labeled_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/ipv4_labeled_unicast (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_ipv4_labeled_unicast is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_ipv4_labeled_unicast() directly.

    YANG Description: IPv4 Labeled Unicast configuration options
    """
    try:
      t = YANGDynClass(v,base=ipv4_labeled_unicast.ipv4_labeled_unicast, is_container='container', yang_name="ipv4-labeled-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """ipv4_labeled_unicast must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=ipv4_labeled_unicast.ipv4_labeled_unicast, is_container='container', yang_name="ipv4-labeled-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_ipv4_labeled_unicast(self):
    self.__ipv4_labeled_unicast = YANGDynClass(base=ipv4_labeled_unicast.ipv4_labeled_unicast, is_container='container', yang_name="ipv4-labeled-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_ipv6_labeled_unicast(self):
    """
    Getter method for ipv6_labeled_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/ipv6_labeled_unicast (container)

    YANG Description: IPv6 Labeled Unicast configuration options
    """
    return self.__ipv6_labeled_unicast
      
  def _set_ipv6_labeled_unicast(self, v, load=False):
    """
    Setter method for ipv6_labeled_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/ipv6_labeled_unicast (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_ipv6_labeled_unicast is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_ipv6_labeled_unicast() directly.

    YANG Description: IPv6 Labeled Unicast configuration options
    """
    try:
      t = YANGDynClass(v,base=ipv6_labeled_unicast.ipv6_labeled_unicast, is_container='container', yang_name="ipv6-labeled-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """ipv6_labeled_unicast must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=ipv6_labeled_unicast.ipv6_labeled_unicast, is_container='container', yang_name="ipv6-labeled-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_ipv6_labeled_unicast(self):
    self.__ipv6_labeled_unicast = YANGDynClass(base=ipv6_labeled_unicast.ipv6_labeled_unicast, is_container='container', yang_name="ipv6-labeled-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_l3vpn_ipv4_unicast(self):
    """
    Getter method for l3vpn_ipv4_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l3vpn_ipv4_unicast (container)

    YANG Description: Unicast IPv4 L3VPN configuration options
    """
    return self.__l3vpn_ipv4_unicast
      
  def _set_l3vpn_ipv4_unicast(self, v, load=False):
    """
    Setter method for l3vpn_ipv4_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l3vpn_ipv4_unicast (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_l3vpn_ipv4_unicast is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_l3vpn_ipv4_unicast() directly.

    YANG Description: Unicast IPv4 L3VPN configuration options
    """
    try:
      t = YANGDynClass(v,base=l3vpn_ipv4_unicast.l3vpn_ipv4_unicast, is_container='container', yang_name="l3vpn-ipv4-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """l3vpn_ipv4_unicast must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=l3vpn_ipv4_unicast.l3vpn_ipv4_unicast, is_container='container', yang_name="l3vpn-ipv4-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_l3vpn_ipv4_unicast(self):
    self.__l3vpn_ipv4_unicast = YANGDynClass(base=l3vpn_ipv4_unicast.l3vpn_ipv4_unicast, is_container='container', yang_name="l3vpn-ipv4-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_l3vpn_ipv6_unicast(self):
    """
    Getter method for l3vpn_ipv6_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l3vpn_ipv6_unicast (container)

    YANG Description: Unicast IPv6 L3VPN configuration options
    """
    return self.__l3vpn_ipv6_unicast
      
  def _set_l3vpn_ipv6_unicast(self, v, load=False):
    """
    Setter method for l3vpn_ipv6_unicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l3vpn_ipv6_unicast (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_l3vpn_ipv6_unicast is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_l3vpn_ipv6_unicast() directly.

    YANG Description: Unicast IPv6 L3VPN configuration options
    """
    try:
      t = YANGDynClass(v,base=l3vpn_ipv6_unicast.l3vpn_ipv6_unicast, is_container='container', yang_name="l3vpn-ipv6-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """l3vpn_ipv6_unicast must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=l3vpn_ipv6_unicast.l3vpn_ipv6_unicast, is_container='container', yang_name="l3vpn-ipv6-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_l3vpn_ipv6_unicast(self):
    self.__l3vpn_ipv6_unicast = YANGDynClass(base=l3vpn_ipv6_unicast.l3vpn_ipv6_unicast, is_container='container', yang_name="l3vpn-ipv6-unicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_l3vpn_ipv4_multicast(self):
    """
    Getter method for l3vpn_ipv4_multicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l3vpn_ipv4_multicast (container)

    YANG Description: Multicast IPv4 L3VPN configuration options
    """
    return self.__l3vpn_ipv4_multicast
      
  def _set_l3vpn_ipv4_multicast(self, v, load=False):
    """
    Setter method for l3vpn_ipv4_multicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l3vpn_ipv4_multicast (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_l3vpn_ipv4_multicast is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_l3vpn_ipv4_multicast() directly.

    YANG Description: Multicast IPv4 L3VPN configuration options
    """
    try:
      t = YANGDynClass(v,base=l3vpn_ipv4_multicast.l3vpn_ipv4_multicast, is_container='container', yang_name="l3vpn-ipv4-multicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """l3vpn_ipv4_multicast must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=l3vpn_ipv4_multicast.l3vpn_ipv4_multicast, is_container='container', yang_name="l3vpn-ipv4-multicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_l3vpn_ipv4_multicast(self):
    self.__l3vpn_ipv4_multicast = YANGDynClass(base=l3vpn_ipv4_multicast.l3vpn_ipv4_multicast, is_container='container', yang_name="l3vpn-ipv4-multicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_l3vpn_ipv6_multicast(self):
    """
    Getter method for l3vpn_ipv6_multicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l3vpn_ipv6_multicast (container)

    YANG Description: Multicast IPv6 L3VPN configuration options
    """
    return self.__l3vpn_ipv6_multicast
      
  def _set_l3vpn_ipv6_multicast(self, v, load=False):
    """
    Setter method for l3vpn_ipv6_multicast, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l3vpn_ipv6_multicast (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_l3vpn_ipv6_multicast is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_l3vpn_ipv6_multicast() directly.

    YANG Description: Multicast IPv6 L3VPN configuration options
    """
    try:
      t = YANGDynClass(v,base=l3vpn_ipv6_multicast.l3vpn_ipv6_multicast, is_container='container', yang_name="l3vpn-ipv6-multicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """l3vpn_ipv6_multicast must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=l3vpn_ipv6_multicast.l3vpn_ipv6_multicast, is_container='container', yang_name="l3vpn-ipv6-multicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_l3vpn_ipv6_multicast(self):
    self.__l3vpn_ipv6_multicast = YANGDynClass(base=l3vpn_ipv6_multicast.l3vpn_ipv6_multicast, is_container='container', yang_name="l3vpn-ipv6-multicast", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_l2vpn_vpls(self):
    """
    Getter method for l2vpn_vpls, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l2vpn_vpls (container)

    YANG Description: BGP-signalled VPLS configuration options
    """
    return self.__l2vpn_vpls
      
  def _set_l2vpn_vpls(self, v, load=False):
    """
    Setter method for l2vpn_vpls, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l2vpn_vpls (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_l2vpn_vpls is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_l2vpn_vpls() directly.

    YANG Description: BGP-signalled VPLS configuration options
    """
    try:
      t = YANGDynClass(v,base=l2vpn_vpls.l2vpn_vpls, is_container='container', yang_name="l2vpn-vpls", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """l2vpn_vpls must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=l2vpn_vpls.l2vpn_vpls, is_container='container', yang_name="l2vpn-vpls", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_l2vpn_vpls(self):
    self.__l2vpn_vpls = YANGDynClass(base=l2vpn_vpls.l2vpn_vpls, is_container='container', yang_name="l2vpn-vpls", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_l2vpn_evpn(self):
    """
    Getter method for l2vpn_evpn, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l2vpn_evpn (container)

    YANG Description: BGP EVPN configuration options
    """
    return self.__l2vpn_evpn
      
  def _set_l2vpn_evpn(self, v, load=False):
    """
    Setter method for l2vpn_evpn, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/l2vpn_evpn (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_l2vpn_evpn is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_l2vpn_evpn() directly.

    YANG Description: BGP EVPN configuration options
    """
    try:
      t = YANGDynClass(v,base=l2vpn_evpn.l2vpn_evpn, is_container='container', yang_name="l2vpn-evpn", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """l2vpn_evpn must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=l2vpn_evpn.l2vpn_evpn, is_container='container', yang_name="l2vpn-evpn", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_l2vpn_evpn(self):
    self.__l2vpn_evpn = YANGDynClass(base=l2vpn_evpn.l2vpn_evpn, is_container='container', yang_name="l2vpn-evpn", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_use_multiple_paths(self):
    """
    Getter method for use_multiple_paths, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/use_multiple_paths (container)

    YANG Description: Parameters related to the use of multiple paths for the
same NLRI
    """
    return self.__use_multiple_paths
      
  def _set_use_multiple_paths(self, v, load=False):
    """
    Setter method for use_multiple_paths, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/use_multiple_paths (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_use_multiple_paths is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_use_multiple_paths() directly.

    YANG Description: Parameters related to the use of multiple paths for the
same NLRI
    """
    try:
      t = YANGDynClass(v,base=use_multiple_paths.use_multiple_paths, is_container='container', yang_name="use-multiple-paths", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """use_multiple_paths must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=use_multiple_paths.use_multiple_paths, is_container='container', yang_name="use-multiple-paths", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_use_multiple_paths(self):
    self.__use_multiple_paths = YANGDynClass(base=use_multiple_paths.use_multiple_paths, is_container='container', yang_name="use-multiple-paths", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)


  def _get_route_selection_options(self):
    """
    Getter method for route_selection_options, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/route_selection_options (container)

    YANG Description: Parameters relating to options for route selection
    """
    return self.__route_selection_options
      
  def _set_route_selection_options(self, v, load=False):
    """
    Setter method for route_selection_options, mapped from YANG variable /bgp/peer_groups/peer_group/afi_safis/afi_safi/route_selection_options (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_route_selection_options is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_route_selection_options() directly.

    YANG Description: Parameters relating to options for route selection
    """
    try:
      t = YANGDynClass(v,base=route_selection_options.route_selection_options, is_container='container', yang_name="route-selection-options", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """route_selection_options must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=route_selection_options.route_selection_options, is_container='container', yang_name="route-selection-options", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)""",
        })

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

  def _unset_route_selection_options(self):
    self.__route_selection_options = YANGDynClass(base=route_selection_options.route_selection_options, is_container='container', yang_name="route-selection-options", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/bgp', defining_module='openconfig-bgp', yang_type='container', is_config=True)

  afi_safi_name = property(_get_afi_safi_name, _set_afi_safi_name)
  graceful_restart = property(_get_graceful_restart, _set_graceful_restart)
  config = property(_get_config, _set_config)
  state = property(_get_state, _set_state)
  apply_policy = property(_get_apply_policy, _set_apply_policy)
  ipv4_unicast = property(_get_ipv4_unicast, _set_ipv4_unicast)
  ipv6_unicast = property(_get_ipv6_unicast, _set_ipv6_unicast)
  ipv4_labeled_unicast = property(_get_ipv4_labeled_unicast, _set_ipv4_labeled_unicast)
  ipv6_labeled_unicast = property(_get_ipv6_labeled_unicast, _set_ipv6_labeled_unicast)
  l3vpn_ipv4_unicast = property(_get_l3vpn_ipv4_unicast, _set_l3vpn_ipv4_unicast)
  l3vpn_ipv6_unicast = property(_get_l3vpn_ipv6_unicast, _set_l3vpn_ipv6_unicast)
  l3vpn_ipv4_multicast = property(_get_l3vpn_ipv4_multicast, _set_l3vpn_ipv4_multicast)
  l3vpn_ipv6_multicast = property(_get_l3vpn_ipv6_multicast, _set_l3vpn_ipv6_multicast)
  l2vpn_vpls = property(_get_l2vpn_vpls, _set_l2vpn_vpls)
  l2vpn_evpn = property(_get_l2vpn_evpn, _set_l2vpn_evpn)
  use_multiple_paths = property(_get_use_multiple_paths, _set_use_multiple_paths)
  route_selection_options = property(_get_route_selection_options, _set_route_selection_options)


  _pyangbind_elements = {'afi_safi_name': afi_safi_name, 'graceful_restart': graceful_restart, 'config': config, 'state': state, 'apply_policy': apply_policy, 'ipv4_unicast': ipv4_unicast, 'ipv6_unicast': ipv6_unicast, 'ipv4_labeled_unicast': ipv4_labeled_unicast, 'ipv6_labeled_unicast': ipv6_labeled_unicast, 'l3vpn_ipv4_unicast': l3vpn_ipv4_unicast, 'l3vpn_ipv6_unicast': l3vpn_ipv6_unicast, 'l3vpn_ipv4_multicast': l3vpn_ipv4_multicast, 'l3vpn_ipv6_multicast': l3vpn_ipv6_multicast, 'l2vpn_vpls': l2vpn_vpls, 'l2vpn_evpn': l2vpn_evpn, 'use_multiple_paths': use_multiple_paths, 'route_selection_options': route_selection_options, }


