Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
['info', 'instance', '(?P.*)', 'vrf', '(?P.*)', 'neighbor', '(?P.*)', 'session_state', 'established'],
['info', 'instance', '(?P.*)', 'bgp_id', '(?P.*)']],
'all_keys':True,
'kwargs': {'attributes': ['info']},
'exclude': bgp_exclude}},
config_info={\
'conf.bgp.Bgp': {
'requirements': [\
['device_attr', '{uut}', 'vrf_attr', '(?P.*)', 'keepalive_interval', '(?P.*)'],
['device_attr', '{uut}', 'vrf_attr', '(?P.*)', 'holdtime', '(?P.*)']],
'verify_conf': False,
'kwargs':{'mandatory':{'bgp_id': '(?P.*)'}}}},
verify_ops={\
'conf.bgp.Bgp': {
'requirements': [\
['device_attr', '{uut}', '_vrf_attr', '(?P.*)', NotExists('keepalive_interval')],
['device_attr', '{uut}', '_vrf_attr', '(?P.*)', NotExists('holdtime')]],
'exclude': bgp_exclude}},
num_values={'device': 1, 'bgp_id': 1, 'vrf': 1, 'instance': 1, 'neighbor': 1})
class TriggerUnconfigConfigBgpFastExternalFallover(TriggerUnconfigConfig):
"""Unconfigure fast-external-fallover and reapply the whole configurations for learned BGP pid"""
__description__ = """Unconfigure fast-external-fallover under a BGP and
reapply the whole configurations for learned BGP pid
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
['info', 'instance', '(?P.*)', 'vrf', '(?P.*)', 'neighbor', '(?P.*)', 'address_family', '(?P.*)', 'default_originate', True],
['info', 'instance', '(?P.*)', 'vrf', '(?P.*)', 'neighbor', '(?P.*)', 'session_state', 'established'],
['info', 'instance', '(?P.*)', 'bgp_id', '(?P.*)']],
'all_keys': True,
'kwargs':{'attributes':['info']},
'exclude': bgp_exclude}},
config_info={\
'conf.bgp.Bgp':{
'requirements':[\
['device_attr', '{uut}', 'vrf_attr', '(?P.*)', 'neighbor_attr', '(?P.*)', 'address_family_attr', '(?P.*)', 'nbr_af_default_originate', True]],
'verify_conf':False,
'kwargs':{'mandatory':{'bgp_id': '(?P.*)'}}}},
verify_ops={\
'ops.bgp.bgp.Bgp':{
'requirements':[\
['info', 'instance', '(?P.*)', 'vrf', '(?P.*)', 'neighbor', '(?P.*)', 'address_family', '(?P.*)', NotExists('default_originate')]],
'kwargs':{'attributes':['info']},
'exclude': bgp_exclude}},
num_values={'instance':1, 'vrf':1, 'neighbor':1})
class TriggerUnconfigConfigBgpNeighborNextHopSelf(TriggerUnconfigConfig):
"""Unconfigure next hop self configured under BGP neighbor and then
reapply the whole configuration of dynamically learned BGP instance(s)."""
__description__ = """Unconfigure next hop self configured under BGP neighbor and then
reapply the whole configuration of dynamically learned BGP instance(s).
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
"""
mapping = Mapping(requirements={'ops.interface.interface.Interface':{
'requirements':[['info', '(?P(GigabitEthernet|gigabitEthernet|TenGigE|HundredGigE)[0-9\/]+)',
'enabled', True],
['info', '(?P(GigabitEthernet|gigabitEthernet|TenGigE|HundredGigE)[0-9\/]+)',
'oper_status', 'up']],
'exclude': interface_exclude}},
config_info={'conf.interface.Interface':{
'requirements':[],
'verify_conf':False,
'kwargs':{'mandatory':{'name': '(?P.*)',
'attach': False}}}},
verify_ops={'ops.interface.interface.Interface':{
'requirements':[['info', '(?P.*)', NotExists('access_vlan')],
['info', '(?P.*)', NotExists('switchport_enable')],
['info', '(?P.*)', NotExists('switchport_mode')],
['info', '(?P.*)', NotExists('trunk_vlans')],
['info', '(?P.*)', NotExists('vrf')],
['info', '(?P.*)', NotExists('duplex_mode')],
['info', '(?P.*)', NotExists('mac_address')],
['info', '(?P.*)', 'oper_status', '(.*down.*)']],
'exclude': interface_exclude}},
num_values={'interface': 1})
5. Recover the device configurations to the one in step 2
6. Learn BGP Ops again and verify it is the same as the Ops in step 1
"""
mapping = Mapping(requirements={'ops.bgp.bgp.Bgp':{
'requirements':[['info', 'instance', '(?P.*)',
'bgp_id', '(?P.*)']],
'kwargs':{'attributes':['info']},
'exclude': bgp_exclude}},
config_info={'conf.bgp.Bgp':{
'requirements':[['device_attr', '{uut}']],
'verify_conf':False,
'kwargs':{'mandatory':{'bgp_id': '(?P.*)'}}}},
verify_ops={'ops.bgp.bgp.Bgp':{
'requirements': [[NotExists('info')]],
'kwargs':{'attributes':['info']},
'exclude': bgp_exclude}},
num_values={'bgp_id':'all', 'instance':'all'})
'verify_conf':False,
'kwargs':{'mandatory':{'name': '(?P.*)',
'attach': False}}}},
verify_ops={'ops.interface.interface.Interface':{
'requirements':[['info', '(?P.*)', 'enabled', False],
['info', '(?P.*)', 'oper_status', 'down'],
['info', '(?P.*)', 'switchport_enable', False]],
'kwargs': {'attributes': ['info[(.*)][switchport_mode]',
'info[(.*)][oper_status]',
'info[(.*)][enabled]',
'info[(.*)][switchport_enable]',
'info[(.*)][operational_mode]']},
'exclude': interface_exclude},
'ops.fdb.fdb.Fdb':{
'requirements':[['info', 'mac_table', 'vlans', '(?P.*)',
'mac_addresses', NotExists('(?P.*)')]],
'kwargs':{'attributes':['info[mac_table][vlans][(.*)]']},
'exclude': fdb_exclude + ['mac_addresses']},
'ops.dot1x.dot1x.Dot1x':{
'requirements':[['info', 'interfaces', NotExists('(?P.*)')]],
'kwargs':{'attributes':['info[interfaces][(.*)][clients][(.*)][status]']},
'all_keys': True,
'exclude': dot1x_exclude + ['attributes']}},
num_values={'interface': 'all'})
3. Unconfigure the evpn msite bgw with Vxlan Conf object
4. Verify the evpn msite bgw from step 3 are no longer existed
5. Recover the device configurations to the one in step 2
6. Learn Vxlan Ops again and verify it is the same as the Ops in step 1
"""
mapping = Mapping(requirements={'ops.vxlan.vxlan.Vxlan': {
'requirements': [['nve', 'evpn_multisite_border_gateway', '(?P.*)']],
'kwargs': {'attributes': ['nve','l2route']},
'all_keys': True,
'exclude': vxlan_base_exclude + ['uptime','peer_id','tx_id','flags']}},
config_info={'conf.vxlan.Vxlan': {
'requirements': [['device_attr', '{uut}', 'evpn_msite_attr', '(?P.*)']],
'verify_conf': False,
'kwargs': {}}},
verify_ops={'ops.vxlan.vxlan.Vxlan': {
'requirements': [['nve', NotExists('evpn_multisite_border_gateway')]],
'kwargs': {'attributes': ['nve','l2route']},
'exclude': vxlan_base_exclude + ['l2route','uptime']}},
num_values={'evpn_multisite_border_gateway': 1 })
class TriggerUnconfigConfigNveMultisiteBgwInterface(TriggerUnconfigConfig):
"""Unconfigure multisite bgw interface and reapply the whole
configurations of dynamically learned Vxlan(s)."""
__description__ = """Unconfigure multisite bgw interface and reapply the whole configurations of
dynamically learned Vxlan(s).
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
'exclude': bgp_exclude}},
config_info={'conf.bgp.Bgp':{
'requirements':[[partial(unconfigure_route_ref, path = ['device_attr', '{uut}', 'vrf_attr',
'(?P.*)', 'neighbor_attr',
'(?P.*)', 'address_family_attr',
'(?P.*)',
'nbr_af_route_reflector_client', True])
]],
'verify_conf':False,
'kwargs':{'mandatory':{'bgp_id': '(?P.*)'}}}},
verify_ops={'ops.bgp.bgp.Bgp':{
'requirements': [['info', 'instance', '(?P.*)',
'vrf', '(?P.*)', 'neighbor',
'(?P.*)', 'address_family',
'(?P.*)',
NotExists('route_reflector_client')]],
'kwargs':{'attributes':['info']},
'exclude': bgp_exclude}},
num_values={'vrf':'all', 'instance':'all', 'neighbor': 'all',
'address_family':'all', 'rd': 'all'})
class TriggerUnconfigConfigBgpNeighborIpv4(TriggerUnconfigConfig):
"""Unconfigure and reapply the whole configurations of dynamically learned BGP IPv4 neighbor(s)."""
__description__ = """Unconfigure and reapply the whole configurations of dynamically learned BGP IPv4 neighbor(s).
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
'''need to sleep for the changed time interval taken place
'''
super().remove_configuration(uut, abstract, steps)
# sleep default value since it will use default when removing the keepalive configs
log.info('sleep %s for msdp re-connect after changing the '
'keepalive/holdtime interval' % '90')
sleep(90)
# Mapping of Information between Ops and Conf
# Also permit to dictate which key to verify
mapping = Mapping(requirements={'conf.msdp.Msdp':{
'requirements':[\
['device_attr', '{uut}', '_vrf_attr', '(?P.*)',
'_peer_attr', '(?P.*)', NotExists('keepalive_interval')],
['device_attr', '{uut}', '_vrf_attr', '(?P.*)',
'_peer_attr', '(?P.*)', NotExists('holdtime_interval')]],
'all_keys': True,
'kwargs':{'attributes': [
'msdp[vrf_attr][(.*)][peer_attr][(.*)]']},
'exclude': msdp_exclude},
'ops.msdp.msdp.Msdp':{
'requirements':[\
['info', 'vrf', '(?P.*)', 'peer', '(?P.*)',
'session_state', 'established']],
'kwargs':{'attributes': [
'info[vrf][(.*)][peer][(.*)][session_state]',
'info[vrf][(.*)][peer][(.*)][timer][holdtime_interval]',
'info[vrf][(.*)][peer][(.*)][timer][keepalive_interval]']},
'exclude': msdp_exclude}},
config_info={'conf.msdp.Msdp':{
'requirements':[
['device_attr', '{uut}', 'vrf_attr', '(?P.*)', 'peer_attr',
mapping = Mapping(requirements={'ops.vxlan.vxlan.Vxlan': {
'requirements': [[['nve', 'multisite', 'fabric_links', '(?P.*)', 'if_state', 'up']],
[['nve', '(?P.*)', \
'multisite_bgw_if_oper_state', 'up']]],
'kwargs': {'attributes': ['nve[(.*)][vni][(.*)][vni]',
'nve[(.*)][multisite_bgw_if_oper_state]',
'nve[multisite]',
'bgp_l2vpn_evpn']},
'exclude': vxlan_base_exclude + multisite_exclude +['fd','resetreason','resettime','prefixreceived',
'bestpathnr','pathnr','advertisedto']}},
config_info={'conf.interface.Interface': {
'requirements': [['evpn_multisite_fabric_tracking',True]],
'verify_conf': False,
'kwargs': {'mandatory': {'name': '(?P.*)', 'attach': False}}}},
verify_ops={'ops.vxlan.vxlan.Vxlan': {
'requirements': [['nve','multisite',NotExists('fabric_links')],
['nve', '(?P.*)', 'multisite_bgw_if_oper_state', 'down']],
'kwargs': {'attributes': ['nve[(.*)][vni][(.*)][vni]',
'nve[(.*)][multisite_bgw_if_oper_state]',
'nve[multisite]',
'bgp_l2vpn_evpn']},
'exclude': vxlan_base_exclude +['bgp_l2vpn_evpn']}},
num_values={'fabric_link': 'all', 'nve_name': 1})
class TriggerUnconfigConfigNveAdvertiseVirtualRmac(TriggerUnconfigConfig):
"""Unconfigure virtual rmac advertised and reapply
the whole configurations of dynamically learned Vxlan(s)."""
__description__ = """Unconfigure virtual rmac advertised and reapply
the whole configurations of dynamically learned Vxlan(s).
trigger_datafile:
# Mapping of Information between Ops and Conf
# Also permit to dictate which key to verify
mapping = Mapping(requirements={'ops.interface.interface.Interface':{
'requirements':[['info', '(?P[p|P]ort-channel[\d\.]+)',
'switchport_mode', 'trunk'],
['info', '(?P[p|P]ort-channel[\d\.]+)',
'port_channel', 'port_channel_member', False]],
'exclude': interface_exclude}},
config_info={'conf.interface.Interface':{
'requirements':[],
'verify_conf':False,
'kwargs':{'mandatory':{'name': '(?P.*)',
'attach': False}}}},
verify_ops={'ops.interface.interface.Interface':{
'requirements':[['info', NotExists('(?P.*)')]],
'exclude': interface_exclude}},
num_values={'interface':1})