#pbr configuration switch = sys.argv[1] no_of_vrfs = int(sys.argv[2]) vrf_list = ['enable', 'configure'] port_channel_list = ['enable', 'configure'] routing_enable = ['enable', 'configure'] i = 1 j = 0 for k in range(289, no_of_vrfs, 2): vrf_name = 'vrf definition vrf-' + str(k) print vrf_name vrf_list.append(vrf_name) print vrf_list for k in range(289, no_of_vrfs, 2): port_channel_config = 'interface port-Channel ' + str(k + 1) + ',' + str(k + 2) ipv4_route_enable = 'ip routing vrf vrf-' + str(k) ipv6_route_enable = 'ipv6 unicast-routing vrf vrf-' + str(k) routing_enable.append(ipv4_route_enable) routing_enable.append(ipv6_route_enable) vrf_allocation = 'vrf forwarding vrf-' + str(k) port_channel_list.append(port_channel_config) port_channel_list.append(vrf_allocation) print port_channel_list print routing_enable capiCmd(switch, vrf_list) capiCmd(switch, port_channel_list) capiCmd(switch, routing_enable)
# Copyright (c) 2017 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. from arstCliLib import capiCmd import sys switch = sys.argv[1] n = 2 interface_list = [] for i in range(25, 49): interface_list.append('Ethernet' + ' ' + str(i)) print(interface_list) interface_list1 = interface_list[0:12] interface_list2 = interface_list[12:24] print(interface_list1) print(interface_list2) fabric_snake_config = ['enable', 'configure'] n = len(interface_list1) print n for i in range(0, n): fabric_snake_config.append('interface' + ' ' + interface_list1[i] + ',' + interface_list2[n - 2]) fabric_snake_config.append('switchport access vlan %d' % (i + 22)) n = n - 1 print(fabric_snake_config) capiCmd(switch, fabric_snake_config)
"enable", "configure", "interface ethernet 3/11/1-4,3/12/1-4,3/21/1,4/11/1-4,4/13/1-4,4/21/1,5/3/1,5/29/1", "shutdown" ] noshut_list5 = [ "enable", "configure", "interface ethernet 3/11/1-4,3/12/1-4,3/21/1,4/11/1-4,4/13/1-4,4/21/1,5/3/1,5/29/1", "no shutdown" ] terminate_list1 = ["enable", "configure", "agent SandL3Unicast terminate"] terminate_list2 = ["enable", "configure", "agent SandFap-Linecard4 terminate"] terminate_list3 = ["enable", "configure", "agent SandAcl terminate"] terminate_list4 = ["enable", "configure", "agent SandTcam terminate"] for i in range(0, no_of_flaps): print 'iteration' + str(i) capiCmd(switch, shut_list4) time.sleep(t) capiCmd(switch, noshut_list4) time.sleep(t) '''capiCmd(switch,speed_list1) time.sleep(t) capiCmd(switch,speed_list2) time.sleep(t) capiCmd(switch,speed_list3) time.sleep(t)''' '''capiCmd(switch,shut_list5) capiCmd(switch,shut_list6)''' '''time.sleep(t) capiCmd(switch,shut_list3) time.sleep(t) capiCmd(switch,noshut_list3)
'show platform sand l3 summary', 'show ip mroute vrf AssetClass-1 count', 'show ip msdp vrf AssetClass-2 sa-cache', 'show ip pim vrf AssetClass-4 neighbor', 'show ip route vrf SecureEnclave-3 summary', 'show vrrp all', 'show ip mroute vrf AssetClass-2', 'show ip msdp vrf AssetClass-2 summary', 'show ip pim vrf default neighbor', 'show ip route vrf SecureEnclave-4 summary', 'show vrrp vrf all brief all', 'show ip mroute vrf AssetClass-2 count', 'show ip msdp vrf AssetClass-3 sa-cache', 'show ip rip database vrf all', 'show ip route vrf SecureEnclave-5 summary', 'show ip mroute vrf AssetClass-3', 'show ip msdp vrf AssetClass-3 summary', 'show ip rip neighbors vrf all', 'show ip route vrf SecureEnclave-6 summary', 'show ip mroute vrf AssetClass-3 count', 'show ip msdp vrf AssetClass-4 sa-cache', 'show ip route vrf AssetClass-1 summary', 'show ip route vrf SecureEnclave-7 summary' ] show_commands_list1 = [] for each_command in show_commands_list: each_command1 = each_command.replace(' ', '_') show_commands_list1.append(each_command1) for switch in switches: send_command = ['enable', 'configure', 'mkdir' + ' ' + switch] for i in range(len(show_commands_list)): command = show_commands_list[ i] + ' > ' + 'flash:' + switch + '/' + show_commands_list1[i] send_command.append(command) print send_command capiCmd(switch, send_command, capiFormat='text')
neighbor_activate = n[0] + ' ' + 'activate' neighbor_activate_list.append(neighbor_activate) as_no = as_no + 2 #print neighbor_as_list #print neighbor_activate_list #print len(neighbor_as_list) vrf_no = 3 r = 0 s = 1 for i in range(0, (len(neighbor_as_list)), 4): router_bgp_vrf = 'vrf vrf-' + str(vrf_no) vrf_no = vrf_no + 2 if i >= 1150: break else: bgp_vrf.append(router_bgp_vrf) bgp_vrf.extend([ neighbor_as_list[j], neighbor_as_list[k], neighbor_as_list[p], neighbor_as_list[q] ]) bgp_vrf.append('address-family ipv6') bgp_vrf.extend([neighbor_activate_list[r], neighbor_activate_list[s]]) j = j + 4 k = k + 4 p = p + 4 q = q + 4 r = r + 2 s = s + 2 print bgp_vrf capiCmd(switch, bgp_vrf)
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys from arstCliLib import capiCmd #pbr configuration switch = sys.argv[1] no_of_entries = int(sys.argv[2]) acl_list = [ 'enable', 'configure', 'ip access-list acl-pbr1', 'statistics per-entry' ] i = 2 j = 0 for k in range(no_of_entries): if i > 255: j = j + 1 i = 0 cmd2 = "permit ip 104.1.%s.%s/32 101.1.%s.%s/32" % (j, i, j, i) acl_list.append(cmd2) i = i + 1 print acl_list capiCmd(switch, acl_list)
# Copyright (c) 2017 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys from arstCliLib import capiCmd switches = sys.argv[1:] print len(switches) clear_counters = ['enable','configure','clear counters','clear platform fap counters','clear hardware counter drop'] for each in switches: print each capiCmd(each,clear_counters)
# Copyright (c) 2018 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys import time from arstCliLib import capiCmd switch = sys.argv[1] svi_list = ['enable', 'configure'] j = 0 k = 0 for i in range(2, 4002): svi = 'interface vlan %d' % (i) svi_list.append(svi) if j > 255: j = 0 k = k + 1 svi_ip = 'ip address virtual 20.%d.%d.4/24' % (k, j) svi_list.append(svi_ip) j = j + 1 print svi_list capiCmd(switch, svi_list)