interface = "interface ethernet" x = 2 y = 36 for i in range(x, y): if i == y - 1: interface += " 5/" + str(i) + "/1" else: interface += " 5/" + str(i) + "/1" + "," start.append(interface) speed_1 = ['enable', 'configure'] speed_2 = ['enable', 'configure'] speed_3 = ['enable', 'configure'] speed_4 = ['enable', 'configure'] speed_1.append(interface) speed_1.append('speed forced 10gfull') speed_2.append(interface) speed_2.append('speed forced 100gfull') speed_3.append(interface) speed_3.append('speed forced 40gfull') speed_4.append(interface) speed_4.append('speed forced 100gfull') for n in range(0, flaps): capiCmd(switch, speed_1) time.sleep(t) capiCmd(switch, speed_2) time.sleep(t) capiCmd(switch, speed_3) time.sleep(t) capiCmd(switch, speed_4) time.sleep(t)
'enable', 'configure', 'interface ethernet 10/6/1', 'speed forced 100gfull' ] #interface_list4 = ['enable','configure','interface ethernet 3/25/1,3/26/1','speed auto 10gfull'] interface_list5 = [ 'enable', 'configure', 'interface ethernet 10/6/1', 'speed forced 10gfull' ] interface_list7 = [ 'enable', 'configure', 'interface ethernet 10/6/1', 'speed forced 100gfull' ] interface_list9 = [ 'enable', 'configure', 'interface ethernet 10/6/1', 'no error-correction encoding' ] interface_list11 = [ 'enable', 'configure', 'interface ethernet 10/6/1', 'error-correction encoding reed-solomon' ] for i in range(0, flaps): capiCmd(switch, interface_list1) time.sleep(t) capiCmd(switch, interface_list3) time.sleep(t) capiCmd(switch, interface_list5) time.sleep(t) capiCmd(switch, interface_list7) time.sleep(t) capiCmd(switch, interface_list9) time.sleep(t) capiCmd(switch, interface_list11) time.sleep(t)
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys import time from cliLib import capiCmd switch = sys.argv[1] no_of_linecards = int(sys.argv[2]) for n in range(3, no_of_linecards): ip_list = [] lldp_ne = ["enable", "show lldp neighbors | grep Et" + str(n) + "/"] sh_lldp_raw = capiCmd(switch, lldp_ne, capiFormat='text') for each in sh_lldp_raw: if each['output'] != "": lldp_raw = each['output'] lldp_raw_wo_white_spaces = lldp_raw.replace(" ", "") lldp_raw_wo_ttl = lldp_raw_wo_white_spaces.replace("120", "") lldp_raw_wo_newline = lldp_raw_wo_ttl.split("\n") for each in lldp_raw_wo_newline: lldp_interfaces = each.split("bn201.sjc.aristanetworks.com") if len(lldp_interfaces) > 1: self_interfaces = lldp_interfaces[0] neighbor_interface = lldp_interfaces[1] interface_self = "interface " + self_interfaces ip_list.append(interface_self) del ip_list[0] #print ip_list j = 1 k = 2 for i in range(0, (len(ip_list) / 2)):
# Arista Networks, Inc. Confidential and Proprietary. import sys import time import itertools #package to join list of lists from cliLib import capiCmd switch = sys.argv[1] no_of_linecards = int(sys.argv[2]) lldp_list = [] lldp_list1 = [] for n in range(3, no_of_linecards): ip_list = [] lldp_ne = ["enable", "show lldp neighbors | grep " + switch] sh_lldp_raw = capiCmd( switch, lldp_ne, capiFormat='text') #output of sh_lldp_raw is of type list #print sh_lldp_raw #print type(sh_lldp_raw) #print len(sh_lldp_raw) for each in sh_lldp_raw: if each['output'] != "": lldp_raw = each['output'] #print lldp_raw #print type(lldp_raw) lldp_raw_wo_white_spaces = lldp_raw.replace(" ", "") #print lldp_raw_wo_white_spaces lldp_raw_wo_ttl = lldp_raw_wo_white_spaces.replace("120", "") lldp_raw_wo_newline = lldp_raw_wo_ttl.split("\n") #print lldp_raw_wo_newline #print type(lldp_raw_wo_newline)
import sys import time from cliLib import capiCmd switch = sys.argv[1] max_vtep = int(sys.argv[2]) n = 0 flood_list_add = ['enable', 'configure', 'interface vxlan 1'] flood_list_remove = ['enable', 'configure', 'interface vxlan 1'] vtep_add = 'vxlan flood vtep add' vtep_remove = 'vxlan flood vtep remove' for i in range(0, 50): for j in range(0, 256): if n == max_vtep: break vtep_add += (' 9.0.%d.%d' % (i, j)) vtep_remove += (' 9.0.%d.%d' % (i, j)) #vtep =+ 'vxlan flood vtep add 9.0.%d.%d' %(i,j) #flood_list.append(vtep) #print(n) n = n + 1 flood_list_add.append(vtep_add) flood_list_remove.append(vtep_remove) print flood_list_add print flood_list_remove time = int(sys.argv[3]) for t in range(0, time): capiCmd(switch, flood_list_add) capiCmd(switch, flood_list_remove) capiCmd(switch, flood_list_add)
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys import time from cliLib import capiCmd switch = sys.argv[1] flaps = int(sys.argv[2]) t = int(sys.argv[3]) interface_list1 = ['enable','configure','interface ethernet 3/28/1','speed forced 10gfull'] #interface_list2 = ['enable','configure','interface ethernet 3/25/1,3/26/1','speed auto 10gfull'] interface_list3 = ['enable','configure','interface ethernet 3/28/1','speed forced 40gfull'] #interface_list4 = ['enable','configure','interface ethernet 3/25/1,3/26/1','speed auto 10gfull'] interface_list5 = ['enable','configure','interface ethernet 3/12/1','speed forced 10gfull'] interface_list7 = ['enable','configure','interface ethernet 3/12/1','speed forced 100gfull'] interface_list9 = ['enable','configure','interface ethernet 3/12/1','no error-correction encoding'] interface_list11 = ['enable','configure','interface ethernet 3/12/1','error-correction encoding reed-solomon'] for i in range(0,flaps): capiCmd(switch,interface_list1) time.sleep(t) capiCmd(switch,interface_list3) time.sleep(t) capiCmd(switch,interface_list1)
from cliLib import capiCmd switch = sys.argv[1] '''import json import stDutConnectUtils import stConfigCommands from jsonrpclib import Server from pprint import pprint switch = Server ("http://admin:@%s/command-api" %(switch)) ''' ip_list = [] ip_list_neighbor = [] ipv6_list = [] ipv6_list_neighbor = [] lldp_ne = ["enable", "show lldp neighbors | grep bn202"] sh_lldp_raw = capiCmd(switch, lldp_ne, capiFormat='text') #sh_lldp_raw = switch.runCmds(1,["enable","show lldp neighbors | grep ol515"],"text") # output of show commands is a list of dictionaries po = 1 for each in sh_lldp_raw: if each['output'] != "": lldp_raw = each['output'] lldp_raw_wo_white_spaces = lldp_raw.replace(" ", "") lldp_raw_wo_ttl = lldp_raw_wo_white_spaces.replace("120", "") lldp_raw_wo_newline = lldp_raw_wo_ttl.split("\n") for each in lldp_raw_wo_newline: lldp_interfaces = each.split("bn202.sjc.aristanetworks.com") if len(lldp_interfaces) > 1: self_interfaces = lldp_interfaces[0] neighbor_interface = lldp_interfaces[1] interface_self = "interface " + self_interfaces ipv6_list.append(interface_self)
noshut_list3 = ["enable","configure","interface Ethernet 3/13/1,4/13/1,5/13/1,6/13/1,7/9/1,8/13/1,9/13/1","ip access-group acl-3k in"] shut_list4 = ["enable","configure","interface port-channel 2","no ip access-group acl-3k in"] noshut_list4 = ["enable","configure","interface port-channel 2","ip access-group acl-3k in"] shut_list5 = ["enable","configure","interface port-channel 3.1","no ip access-group acl-3k in"] noshut_list5 = ["enable","configure","interface port-channel 3.1","ip access-group acl-3k in"] shut_list6 = ["enable","configure","interface ethernet 6/1/1,7/1/1","no switchport mode trunk"] noshut_list6 = ["enable","configure","interface ethernet 6/1/1,7/1/1","switchport mode trunk"] shut_list7 = ["enable","configure","interface ethernet 3/1/1,4/1/1,5/1/1,8/1/1,9/1/1","no switchport mode trunk"] noshut_list7 = ["enable","configure","interface ethernet 3/1/1,4/1/1,5/1/1,8/1/1,9/1/1","switchport mode trunk"] for i in range (n): '''capiCmd(switch,shut_list1) capiCmd(switch,shut_list2) capiCmd(switch,shut_list3) capiCmd(switch,shut_list4) capiCmd(switch,shut_list5) time.sleep(3)''' capiCmd(switch,shut_list6) time.sleep(t) capiCmd(switch,noshut_list6) '''capiCmd(switch,noshut_list1) capiCmd(switch,noshut_list2) capiCmd(switch,noshut_list3) capiCmd(switch,noshut_list4) capiCmd(switch,noshut_list5)''' capiCmd(switch,shut_list7) time.sleep(t) capiCmd(switch,noshut_list7)
"enable", "configure", "interface vlan 203", "service-policy type pbr input pbr-81000" ] shut_list5 = [ "enable", "configure", "interface ethernet 4/10/1", "service-policy type pbr input pbr-5100" ] noshut_list5 = [ "enable", "configure", "interface ethernet 4/10/1", "service-policy type pbr input pbr-51000" ] shut_list6 = [ "enable", "configure", "interface port-channel 1", "no service-policy type pbr input pbr-82000" ] noshut_list6 = [ "enable", "configure", "interface port-channel 1", "service-policy type pbr input pbr-82000" ] for i in range(0, no_of_flaps): capiCmd(switch, shut_list2) capiCmd(switch, shut_list3) capiCmd(switch, shut_list5) capiCmd(switch, shut_list6) time.sleep(t) capiCmd(switch, noshut_list2) capiCmd(switch, noshut_list3) capiCmd(switch, noshut_list5) capiCmd(switch, noshut_list6) time.sleep(t)
#if n < 561 or n > 1040: svi = "interface vlan " + str(n) vlan_list.append(svi) #vlan_list.append("service-policy type pbr input pbr-" + str(n)) if i > 255: i = 0 j = j + 1 ip_address = "ip address 150." + str(j) + "." + str(i) + "." + "15/24" next_hop = "150." + str(j) + "." + str(i) + ".5" #next_hop2 = "150." + str(j) + "." + str(i) + ".10" #ping_ip = "150." + str(j) + "." + str(i) + ".1" #ping_list.append("ping" + " " + ping_ip) network = "network 150." + str(j) + "." + str(i) + "." + "0/24 area 0" policy_list.append("policy-map type pbr pbr-" + str(n)) match_ip = "150." + str(j) + "." + str(i) + ".1/24" #policy_list.append("10 match ip " + match_ip + " any" + " set nexthop " + next_hop) policy_list.append("10 match ip " + match_ip + " any" + " set nexthop " + next_hop) #policy_list.append("10 match ip " + match_ip + " any" + " set nexthop 150.0.0.5 150.0.1.5 150.0.2.5 150.0.3.5 150.0.4.5 150.0.5.5 150.0.6.5 150.0.7.5 150.0.8.5 150.0.9.5 150.0.10.5 150.0.11.5 150.0.12.5 150.0.13.5 150.0.14.5 150.0.15.5 150.0.16.5 150.0.17.5 150.0.18.5 150.0.19.5 150.0.20.5 150.0.21.5 150.0.22.5 150.0.23.5 150.0.24.5 150.0.25.5 150.0.26.5 150.0.27.5 150.0.28.5 150.0.29.5 150.0.30.5 150.0.31.5 150.0.32.5 150.0.33.5 150.0.34.5 150.0.35.5 150.0.36.5 150.0.37.5 150.0.38.5 150.0.39.5 150.0.40.5 150.0.41.5 150.0.42.5 150.0.43.5 150.0.44.5 150.0.45.5 150.0.46.5 150.0.47.5 150.0.48.5 150.0.49.5 150.0.50.5 150.0.51.5 150.0.52.5 150.0.53.5 150.0.54.5 150.0.55.5 150.0.56.5 150.0.57.5 150.0.58.5 150.0.59.5 150.0.60.5 150.0.61.5 150.0.62.5 150.0.63.5 150.0.64.5 150.0.65.5 150.0.66.5 150.0.67.5 150.0.68.5 150.0.69.5 150.0.70.5 150.0.71.5 150.0.72.5 150.0.73.5 150.0.74.5 150.0.75.5 150.0.76.5 150.0.77.5 150.0.78.5 150.0.79.5 150.0.80.5 150.0.81.5 150.0.82.5 150.0.83.5 150.0.84.5 150.0.85.5 150.0.86.5 150.0.87.5 150.0.88.5 150.0.89.5 150.0.90.5 150.0.91.5 150.0.92.5 150.0.93.5 150.0.94.5 150.0.95.5 150.0.96.5 150.0.97.5 150.0.98.5 150.0.99.5 150.0.100.5 150.0.101.5 150.0.102.5 150.0.103.5 150.0.104.5 150.0.105.5 150.0.106.5 150.0.107.5 150.0.108.5 150.0.109.5 150.0.110.5 150.0.111.5 150.0.112.5 150.0.113.5 150.0.114.5 150.0.115.5 150.0.116.5 150.0.117.5 150.0.118.5 150.0.119.5 150.0.120.5 150.0.121.5 150.0.122.5 150.0.123.5 150.0.124.5 150.0.125.5 150.0.126.5 150.0.127.5") ospf_adv.append(network) #neighbor_list.append(neighbor) vlan_list.append(ip_address) i = i + 1 #prin vlan_list capiCmd(switch, ospf_adv) print vlan_list capiCmd(switch, vlan_list) #capiCmd(switch,policy_list) #capiCmd(switch,ping_list) #capiCmd(switch,neighbor_list)
import sys import time from cliLib import capiCmd switch = sys.argv[1] no_of_swaps = int(sys.argv[2]) t = int(sys.argv[3]) swap_list3 = ["enable", "configure", "platform module Fabric5 remove"] noswap_list3 = ["enable", "configure", "platform module Fabric5 insert"] swap_list4 = ["enable", "configure", "platform module Linecard4 remove"] noswap_list4 = ["enable", "configure", "platform module Linecard4 insert"] swap_list5 = ["enable", "configure", "platform module Linecard5 remove"] noswap_list5 = ["enable", "configure", "platform module Linecard5 insert"] swap_list6 = ["enable", "configure", "platform module Linecard6 remove"] noswap_list6 = ["enable", "configure", "platform module Linecard6 insert"] swap_list7 = ["enable", "configure", "platform module Linecard7 remove"] noswap_list7 = ["enable", "configure", "platform module Linecard7 insert"] swap_list8 = ["enable", "configure", "platform module Linecard8 remove"] noswap_list8 = ["enable", "configure", "platform module Linecard8 insert"] swap_list9 = ["enable", "configure", "platform module Linecard9 remove"] noswap_list9 = ["enable", "configure", "platform module Linecard9 insert"] swap_list10 = ["enable", "configure", "platform module Linecard10 remove"] noswap_list10 = ["enable", "configure", "platform module Linecard10 insert"] for i in range(0, no_of_swaps): capiCmd(switch, swap_list6) capiCmd(switch, swap_list7) time.sleep(t) capiCmd(switch, noswap_list6) capiCmd(switch, noswap_list7) time.sleep(t)
# Copyright (c) 2017 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys import time from cliLib import capiCmd switch = sys.argv[1] flaps = int(sys.argv[2]) t = int(sys.argv[3]) err_disable = ['enable','configure','errdisable test interface port-channel1'] shut_list1 = ['enable','configure','interface port-channel1'] shut_list1.append('shutdown') shut_list1.append('no shutdown') for i in range(0,flaps): #shut_list1.append('shutdown') #shut_list1.append('no shutdown') #print shut_list1 time.sleep(t) capiCmd(switch,err_disable) capiCmd(switch,shut_list1) time.sleep(t)
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys from cliLib import capiCmd i = 0 j = 0 payloadtype = sys.argv[3] no_of_nhg = int(sys.argv[2]) switch = sys.argv[1] mpls_static_route = ["enable", "configure"] if payloadtype == 'ipv4': for n in range(0, no_of_nhg): if i > 255: i = 0 j = j + 1 mpls_route = "mpls static top-label" + " " + str( n + 16) + " " + "1.1.1.1 " + "pop payload-type ipv4" #mpls_route = "mpls static top-label" + " " + str(n+16) + " " + "51.0." + str(j) + "." + str(i) + " " + "pop payload-type ipv4" mpls_static_route.append(mpls_route) i = i + 1 elif payloadtype == 'ipv6': for n in range(0, no_of_nhg): mpls_route = "mpls static top-label" + " " + str( n + 16) + " " + "1111::1111" + " " + "pop payload-type ipv6" mpls_static_route.append(mpls_route) i = i + 1 print mpls_static_route capiCmd(switch, mpls_static_route)
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys from cliLib import capiCmd #pbr configuration switch = sys.argv[1] no_of_entries = int(sys.argv[2]) acl_list = ['enable','configure','ip access-list acl-3k-rp-egress','statistics per-entry'] i = 0 j = 0 for k in range(no_of_entries): if i > 255: j = j+1 i = 0 cmd2 = "deny ip any 104.%s.%s.1/24" %(j,i) acl_list.append(cmd2) i = i + 1 capiCmd(switch,acl_list)
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys from cliLib import capiCmd switch = sys.argv[1] vlan_list = ["enable", "configure"] for n in range(1501, 1511): svi = "interface vlan " + str(n) vlan_list.append(svi) #if n < 561 or n > 1040: for i in range(1, 11): vlan_list.append("no service-policy type pbr input pbr-" + str(n)) vlan_list.append("service-policy type pbr input pbr-" + str(n)) #prin vlan_list #capiCmd(switch,ospf_adv) print vlan_list capiCmd(switch, vlan_list) #capiCmd(switch,policy_list) #capiCmd(switch,ping_list) #capiCmd(switch,neighbor_list)
for j in range(0,nhentries,2): if k > 255: k = 0 l = l+1 #nexthopgroup_list.append("tunnel-source" + " 150." + str(l) + "." + str(k) + ".1") nonexthopgroup_list.append("no entry " + str(j) + " tunnel-destination" + " 150." + str(l) + "." + str(k) + ".15") nonexthopgroup_list.append("no entry " + str(j+1) + " tunnel-destination" + " 150." + str(l) + "." + str(k) + ".15") k = k+1 elif type == "gre": nonexthopgroup_list.append("nexthop-group " + type + str(i) + " " + "type" + " " + type) #nexthopgroup_list.append("no size ") #+ str(nhentries)) k = 254 l = 3 for j in range(0,nhentries): if k > 255: k = 0 l = l+1 #nexthopgroup_list.append("tunnel-source" + " 150." + str(l) + "." + str(k) + ".1") nonexthopgroup_list.append("entry " + str(j) + " tunnel-destination" + " 150." + str(l) + "." + str(k) + ".15") #nexthopgroup_list.append("entry " + str(j+1) + " tunnel-destination" + " 150." + str(l) + "." + str(k) + ".15") k = k+1''' #print nexthopgroup_list #print nonexthopgroup_list for x in range(0, toggles): capiCmd(switch, nexthopgroup_list) #time.sleep(1.1) #capiCmd(switch,nonexthopgroup_list) #time.sleep(1.1) #capiCmd(switch,nexthopgroup_list)
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys import time from cliLib import capiCmd switch = sys.argv[1] ospfadv = ['enable', 'configure', 'router ospf 1'] for i in range(0, 16, 2): ospfadv.append("network 20.0.0." + str(i) + "/31 area 0") print ospfadv capiCmd(switch, ospfadv)
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys import time from cliLib import capiCmd switch = sys.argv[1] interface_list = ['enable', 'configure'] for i in range(1, 36, 2): interface = "interface ethernet" + " 9/" + str(i) + "/1" + ",9/" + str( i + 1) + "/1" interface_list.append(interface) interface_list.append("switchport mode access") switchport = "switchport access vlan " + str(i + 101) interface_list.append(switchport) interface_list.append("vlan " + str(i + 101)) print interface_list capiCmd(switch, interface_list)
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys from cliLib import capiCmd i = 0 j = 0 type = sys.argv[3] no_of_routes = int(sys.argv[2]) switch = sys.argv[1] static_route = ["enable", "configure"] for n in range(0, no_of_routes): ip_route1 = "no ipv6 route 3000::" + str( i) + "/128" + " nexthop-Group" + " " + type + str(n) static_route.append(ip_route1) i = i + 1 #print static_route capiCmd(switch, static_route)
switch = Server ("http://admin:@%s/command-api" %(switch)) ''' ip_list = [] ip_list_neighbor = [] ipv6_list = [] ipv6_list_neighbor = [] lldp_ne = ["enable", "show lldp neighbors | grep bn202"] bgp = ["enable", "configure", "router bgp 100"] bgp_ne = ["enable", "configure", "router bgp 200"] address_family = [ 'enable', 'configure', 'router bgp 100', 'address-family ipv6' ] address_family_neighbor = [ 'enable', 'configure', 'router bgp 200', 'address-family ipv6' ] sh_lldp_raw = capiCmd(switch, lldp_ne, capiFormat='text') #sh_lldp_raw = switch.runCmds(1,["enable","show lldp neighbors | grep ol515"],"text") # output of show commands is a list of dictionaries for each in sh_lldp_raw: if each['output'] != "": lldp_raw = each['output'] lldp_raw_wo_white_spaces = lldp_raw.replace(" ", "") lldp_raw_wo_ttl = lldp_raw_wo_white_spaces.replace("120", "") lldp_raw_wo_newline = lldp_raw_wo_ttl.split("\n") for each in lldp_raw_wo_newline: lldp_interfaces = each.split("bn202.sjc.aristanetworks.com") if len(lldp_interfaces) > 1: self_interfaces = lldp_interfaces[0] neighbor_interface = lldp_interfaces[1] interface_self = "interface " + self_interfaces ipv6_list.append(interface_self) ipv6_list.append("no switchport")
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys from cliLib import capiCmd switch = sys.argv[1] sh_list = ['enable', 'show platform trident l3 shadow next-hops multipath'] sh = capiCmd(switch, sh_list, capiFormat='text') i = 0 for each in sh: if 'Multipath Egress Object' in each['output']: split_list = each['output'].split('Multipath Egress Object') for each in split_list: if 'Interfaces' in each: wo_interfaces = each.replace( 'Interfaces: ', '') #Deleted interfaces word from the string nh_group_entries = wo_interfaces.split() nh_group_id = nh_group_entries.pop(0) print 'no of entries in nexthop group ' + nh_group_id + " is " + str( (len(nh_group_entries))) print "======================================"
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys from cliLib import capiCmd switch = sys.argv[1] dcgs = int(sys.argv[2]) #no of decap groups decapgroup_list = ['enable', 'configure'] type = sys.argv[3] i = 0 j = 0 for n in range(0, dcgs): decapgroup_list.append("no ip decap-group " + type + str(n)) print decapgroup_list capiCmd(switch, decapgroup_list)
cmd7 = "permit ip any " + dest_ip pbr_list.append(cmd7) if "54.0" in dest_ip: class_name = class_name + "_Dest8" acl_name = acl_name + "_Dest8" cmd2 = "class " + class_name pbr_list.append(cmd2) cmd3 = "set nexthop 11.0.1.0" pbr_list.append(cmd3) cmd4 = "class-map type pbr match-any " + class_name pbr_list.append(cmd4) cmd5 = "match ip access-group " + acl_name pbr_list.append(cmd5) cmd6 = "ip access-list " + acl_name pbr_list.append(cmd6) cmd7 = "permit ip any " + dest_ip pbr_list.append(cmd7) for n in range(no_of_classmaps): class_name = "class_" + str(n) acl_name = "acl_" + str(n) if i > 255: j = j + 1 i = 0 dest_ip = "%s.0.%s.%s" % (str(k), str(j), str(i)) + "/32" pbr_config(pbr_name, class_name, acl_name, dest_ip) i = i + 1 #capiCmd(switch,classmap_list) capiCmd(switch, pbr_list)
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import sys from cliLib import capiCmd i = 0 j = 0 no_of_nhgs = int(sys.argv[2]) switch = sys.argv[1] nhg_list = ["enable", "configure"] type = sys.argv[3] for n in range(1, no_of_nhgs): nhg = "no nexthop-Group" + " " + type + str(n) nhg_list.append(nhg) #print static_route capiCmd(switch, nhg_list)