Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'kwargs':{'mandatory':{'bgp_id': '(?P.*)'}}}},
verify_ops={'ops.bgp.bgp.Bgp':{
'requirements': [[partial(verify_ops_or_logic,
requires=[['info', 'instance', '(?P.*)', 'vrf',
'(?P.*)', 'neighbor', NotExists('(?P.*)')],
['info', 'instance', '(?P.*)', 'vrf',
'(?P.*)', NotExists('neighbor')]
])
]],
'kwargs':{'attributes':['info']},
'exclude': bgp_exclude + ['vpnv4 unicast']}},
num_values={'vrf':'all', 'instance':'all',
'neighbor':'all'})
class TriggerUnconfigConfigBgpVpnRd(TriggerUnconfigConfig):
"""Unconfigure and reapply the whole configurations of dynamically
learned BGP vrf(s) route-distinguisher."""
__description__ = """Unconfigure and reapply the whole configurations of dynamically
learned BGP vrf(s) route-distinguisher.
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
interval (`int`): Wait time between iteration when looping is needed,
in second. Default: 15
method (`str`): Method to recover the device configuration,
Support methods:
'checkpoint': Rollback the configuration by
'''NXOS Implementation for Pim unconfigconfig triggers'''
# ats
from pyats.utils.objects import NotExists
# Genie Libs
from genie.libs.sdk.libs.utils.mapping import Mapping
from genie.libs.sdk.triggers.unconfigconfig.unconfigconfig import TriggerUnconfigConfig
# Which key to exclude for Pim Ops comparison
pim_exclude = ['maker', ]
class TriggerUnconfigConfigPimNeighborFilter(TriggerUnconfigConfig):
"""Unconfigure and reapply the whole configurations of dynamically
learned PIM interface(s)'s neighbor-filter."""
__description__ = """Unconfigure and reapply the whole configurations of dynamically
learned PIM interface(s)'s neighbor-filter.
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
interval (`int`): Wait time between iteration when looping is needed,
in second. Default: 15
method (`str`): Method to recover the device configuration,
Support methods:
'checkpoint': Rollback the configuration by
NotExists('(?P.*)')],
['info', 'vrf', '(?P^(?!default)\w+$)',
'address_family','(?P.*)', 'rp', NotExists('static_rp')],
['info', 'vrf', '(?P.*)',
'address_family','(?P.*)', 'rp', 'static_rp',
'(?P.*)', '(?P.*)'],
])
],
],
'kwargs': {'attributes': [
'info[vrf][(.*)][address_family][(.*)][rp][static_rp][(.*)]']},
'exclude': pim_exclude }},
num_values={'rp_intf': 1, 'vrf': 'all', 'rp_addr': 'all', 'af': 'all'})
class TriggerUnconfigConfigPimNbrInterface(TriggerUnconfigConfig):
"""Unconfigure and reapply the dynamically learned pim neighbor interface(s) under default vrf."""
__description__ = """Unconfigure and reapply the dynamically learned pim neighbor interface(s) under default vrf.
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
interval (`int`): Wait time between iteration when looping is needed,
in second. Default: 15
Optional:
tgn_timeout (`int`): Maximum wait time for all traffic threads to be
restored to the reference rate,
in second. Default: 60
tgn_delay (`int`): Wait time between each poll to verify if traffic is resumed,
mapping = Mapping(requirements={'ops.interface.interface.Interface':{
'requirements':[['info', '(?P[p|P]ort-channel[\d\.]+)',
'switchport_mode', 'trunk']],
'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})
class TriggerUnconfigConfigEthernetInterface(TriggerUnconfigConfig):
"""Unconfigure and reapply the whole configurations of dynamically learned Ethernet interface(s)."""
__description__ = """Unconfigure and reapply the whole configurations of dynamically learned Ethernet interface(s).
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
interval (`int`): Wait time between iteration when looping is needed,
in second. Default: 15
method (`str`): Method to recover the device configuration,
Support methods:
'checkpoint': Rollback the configuration by
checkpoint (nxos),
archive file (iosxe),
['device_attr', '{uut}', 'vrf_attr', '(?P.*)',
'global_connect_retry_interval', '(?P.*)']],
'verify_conf':False,
'kwargs':{}}},
verify_ops={'ops.msdp.msdp.Msdp':{
'requirements':[\
['info', 'vrf', '(?P.*)', 'peer', '(?P.*)', 'timer',
'connect_retry_interval', 10]], # change to default value
'kwargs':{'attributes': [
'info[vrf][(.*)][peer][(.*)][session_state]',
'info[vrf][(.*)][peer][(.*)][timer]']},
'exclude': msdp_exclude}},
num_values={'vrf': 1, 'peer': 'all'})
class TriggerUnconfigConfigMsdpDescription(TriggerUnconfigConfig):
"""Unconfigure and reapply the whole configurations of dynamically
learned MSDP peer(s) description."""
__description__ = """Unconfigure and reapply the whole configurations of dynamically
learned MSDP peer(s) description.
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
interval (`int`): Wait time between iteration when looping is needed,
in second. Default: 15
method (`str`): Method to recover the device configuration,
Support methods:
'checkpoint': Rollback the configuration by
verify_ops={'ops.bgp.bgp.Bgp':{
'requirements': [[partial(verify_ops_or_logic,
requires=[['info', 'instance', '(?P.*)', NotExists('vrf')],
['info', 'instance', '(?P.*)', 'vrf',
NotExists('(?P.*)')],
['info', 'instance', '(?P.*)', 'vrf',
'(?P.*)', NotExists('neighbor')]
])
]],
'kwargs':{'attributes':['info']},
'exclude': bgp_exclude}},
num_values={'vrf':'all', 'instance':'all',
'neighbor':'all'})
class TriggerUnconfigConfigBgpNeighborAsOverride(TriggerUnconfigConfig):
"""Unconfigure and reapply the whole configurations of dynamically
learned BGP neighbors(s) as_override."""
__description__ = """Unconfigure and reapply the whole configurations of dynamically
learned BGP neighbors(s) as_override.
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
interval (`int`): Wait time between iteration when looping is needed,
in second. Default: 15
method (`str`): Method to recover the device configuration,
Support methods:
'checkpoint': Rollback the configuration by
['device_attr', '{uut}', 'vrf_attr', '(?P.*)',
'interface_attr', '(?P.*)', 'enable', True]],
'verify_conf':False,
'kwargs':{}}},
verify_ops={
'ops.mld.mld.Mld':{
'requirements':[\
['info', 'vrfs', '(?P.*)', 'interfaces',
NotExists('(?P.*)')]],
'kwargs':{'attributes': [
'info[vrfs][(.*)][interfaces][(.*)]']},
'exclude': mld_exclude}},
num_values={'vrf': 1, 'interface': 1})
class TriggerUnconfigConfigMldVersion(TriggerUnconfigConfig):
"""Unconfigure and reapply the whole configurations of dynamically
learned enabled Mld interface(s)'s version."""
__description__ = """Unconfigure and reapply the whole configurations
of dynamically learned enabled Mld interface(s)'s version.
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
interval (`int`): Wait time between iteration when looping is needed,
in second. Default: 15
method (`str`): Method to recover the device configuration,
Support methods:
'checkpoint': Rollback the configuration by
'_protocol_attr', NotExists('(?P(?!evpn).*)')],
['device_attr', '{uut}', 'address_family_attr',
'(?P.*)', '_route_target_attr','(?P<rt>.*)',
NotExists('_protocol_attr')],
])
]
],
'exclude': trm_exclude},
'ops.vrf.vrf.Vrf':{
'requirements': [ \
['info', 'vrfs', '(?P.*)', '(.*)']],
'kwargs': {'attributes': ['info']},
'exclude': trm_exclude}},
num_values={'protocol_name': 1, 'vrf': 1, 'rt': 1, 'address_family': 1})
class TriggerUnconfigConfigAdvertiseEvpnMulticast(TriggerUnconfigConfig):
"""Unconfigure advertise evpn multisite and reapply the whole configurations of dynamically learned Conf Vxlan."""
__description__ = """Unconfigure advertise evpn multisite and reapply the whole configurations of dynamically learned Vxlan.
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
interval (`int`): Wait time between iteration when looping is needed,
in second. Default: 15
method (`str`): Method to recover the device configuration,
Support methods:
'checkpoint': Rollback the configuration by
checkpoint (nxos),
archive file (iosxe),</rt>
'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:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
interval (`int`): Wait time between iteration when looping is needed,
in second. Default: 15
method (`str`): Method to recover the device configuration,
Support methods:
'checkpoint': Rollback the configuration by
# import pyats
from pyats import aetest
from pyats.utils.objects import Not, NotExists
# Which key to exclude for Interface Ops comparison
interface_exclude = ['maker', 'last_change','in_rate','in_rate_pkts',
'out_rate', 'out_rate_pkts', 'in_octets',
'in_pkts', 'in_unicast_pkts', 'out_octets',
'out_pkts', 'out_unicast_pkts', 'out_multicast_pkts',
'in_multicast_pkts', 'last_clear', 'in_broadcast_pkts',
'out_broadcast_pkts', 'bandwidth', 'load_interval',
'port_speed', 'in_crc_errors', 'in_discards',
'unnumbered', '(Tunnel.*)', 'accounting']
class TriggerUnconfigConfigLoopbackInterface(TriggerUnconfigConfig):
"""Unconfigure and reapply the whole configurations of dynamically
learned Loopback interface(s)."""
__description__ = """Unconfigure and reapply the whole configurations of dynamically
learned Loopback interface(s).
trigger_datafile:
Mandatory:
timeout:
max_time (`int`): Maximum wait time for the trigger,
in second. Default: 180
interval (`int`): Wait time between iteration when looping is needed,
in second. Default: 15
method (`str`): Method to recover the device configuration,
Support methods:
'checkpoint': Rollback the configuration by