I am using a list at the moment for my script to store the config commands I am sending to the access points. This is my syntax for that.
output = net_connect.send_config_set(ap_config, delay_factor = 4) print(output) Script works fine, but I co-worker said I could use a different method for storing the commands that she uses, but I can't get it to work. This is the format she has her commands in. She says this works in her scripts. The main difference is she is calling this from another script instead of it being imbedded in the same script like I am doing. Just wanted to ask the community if I am missing something or not.
ap_config = f"""conf t int dot 0 power local ofdm max power local cck max speed basic 6.0 9.0 12.0 18.0 24.0 36.0 48.0 54.0 end """
2 Answers
you need to use in ap_config type list not string
Best way is to convert ap_config to a list, every command should be considered a list item. You shouldnt need conf t
ap_config = [ "int dot 0", "power local ...", "commands", "etc"] Probably dont need the delay_factor=4.
You can make your script a little more robust by passing the commands through a text file.
my_cmds = "my_commands.txt" with ConnectHandler(**device1) as net_connect: output = net_connect.send_config_from_file(my_cmds) output += net_connect.save_config() Take a look here for examples and usage.