I'm trying to optimize a script that connects to some routers based on a list that I provide with IPs.
however, it's taking a quite long time to finish the configuration once starts the configuration once when it finishes the previous router, my question is, would be possible to create a function that doesn't need to wait for it, maybe a multithreading function that can configure a few elements simultaneously.
def configure_routers():
hosts = create_vrdc_dic() # -> it's the dictonary that pass the variables
for i in hosts .keys():
hostname = hosts [i].get('hostname')
mgmt_ip = hosts [i].get('mgmt_ip')
console_config.config_vrdc(hostname, mgmt_ip) # -> here I'm calling another module that configures the routers using pexpect
Thanks for any help here.