Date created: Tuesday, February 9, 2016 10:45:27 AM. Last modified: Wednesday, December 2, 2020 5:47:55 PM

rand() with ios_config

On a test PE with 125 VRFs each configured with "redistributed connected" under BGP, this small script will create some route churn by withdrawing those routes and then advertising them again

NOTE: "while 1" does of course mean this run in an infinite loop!

proc rand_range { min max } { return [expr int(rand() * ($max - $min)) + $min] }

while 1 {
	
	set i [rand_range 1 125]

	set OUTPUT [ ios_config "router bgp 12345" "address-family ipv4 vrf CUST$i" "no redistribute static" ]
	puts $OUTPUT

	after 5000

	set OUTPUT [ ios_config "router bgp 12345" "address-family ipv4 vrf CUST$i" "redistribute static" ]
	puts $OUTPUT

}