mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-03 20:27:54 +00:00 
			
		
		
		
	Merge remote-tracking branch 'origin/master'
This commit is contained in:
		@@ -95,7 +95,7 @@ def main():
 | 
				
			|||||||
                       choices=["a", "b", "abgn"])
 | 
					                       choices=["a", "b", "abgn"])
 | 
				
			||||||
   parser.add_argument("--action",        type=str, help="perform action",
 | 
					   parser.add_argument("--action",        type=str, help="perform action",
 | 
				
			||||||
      choices=["config", "country", "ap_country", "enable", "disable", "summary", "advanced",
 | 
					      choices=["config", "country", "ap_country", "enable", "disable", "summary", "advanced",
 | 
				
			||||||
      "cmd", "txPower", "bandwidth", "manual", "auto","ap_channel", "channel", "show", "wlan", "enable_wlan", "delete_wlan", "wlan_qos" ])
 | 
					      "cmd", "txPower", "bandwidth", "manual", "auto", "open_wlan","no_open_wlan","show_wlan_summary","ap_channel", "channel", "show", "wlan", "enable_wlan", "delete_wlan", "wlan_qos" ])
 | 
				
			||||||
   parser.add_argument("--value",       type=str, help="set value")
 | 
					   parser.add_argument("--value",       type=str, help="set value")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   args = None
 | 
					   args = None
 | 
				
			||||||
@@ -475,6 +475,80 @@ def main():
 | 
				
			|||||||
      else:
 | 
					      else:
 | 
				
			||||||
         command = "show ap channel %s"%(args.ap)
 | 
					         command = "show ap channel %s"%(args.ap)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   if (args.action == "open_wlan"):
 | 
				
			||||||
 | 
					      print("Configure a open wlan 9800 series")
 | 
				
			||||||
 | 
					      egg.sendline("config t")
 | 
				
			||||||
 | 
					      i = egg.expect_exact(["(config)#",pexpect.TIMEOUT],timeout=2)
 | 
				
			||||||
 | 
					      if i == 0:
 | 
				
			||||||
 | 
					         print("elevated to (config)#")
 | 
				
			||||||
 | 
					         egg.sendline("wlan open-wlan 1 open-wlan")
 | 
				
			||||||
 | 
					         j = egg.expect_exact(["(config-wlan)#",pexpect.TIMEOUT],timeout=2)
 | 
				
			||||||
 | 
					         if j == 0:
 | 
				
			||||||
 | 
					            for command in ["no security wpa","no security wpa wpa2","no security wpa wpa2 ciphers aes",
 | 
				
			||||||
 | 
					                        "no security wpa akm dot1x","no shutdown","end"]:
 | 
				
			||||||
 | 
					               egg.sendline(command)
 | 
				
			||||||
 | 
					               sleep(0.1)
 | 
				
			||||||
 | 
					               k = egg.expect_exact(["(config-wlan)#",pexpect.TIMEOUT],timeout=2)
 | 
				
			||||||
 | 
					               if k == 0:
 | 
				
			||||||
 | 
					                  print("command sent: {}".format(command))
 | 
				
			||||||
 | 
					               if k == 1:
 | 
				
			||||||
 | 
					                  if command == "end":
 | 
				
			||||||
 | 
					                     pass
 | 
				
			||||||
 | 
					                  else:
 | 
				
			||||||
 | 
					                     print("command time out: {}".format(command))
 | 
				
			||||||
 | 
					         if j == 1:
 | 
				
			||||||
 | 
					            print("did not get the (config-wlan)# prompt")
 | 
				
			||||||
 | 
					      if i == 0:
 | 
				
			||||||
 | 
					         print("did not get the (config)# prompt")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      print("send wireless tag policy")
 | 
				
			||||||
 | 
					      egg.sendline("config t")
 | 
				
			||||||
 | 
					      sleep(0.1)
 | 
				
			||||||
 | 
					      i = egg.expect_exact(["(config)#",pexpect.TIMEOUT],timeout=2)
 | 
				
			||||||
 | 
					      if i == 0:
 | 
				
			||||||
 | 
					         for command in ["wireless tag policy default-policy-tag","wlan open-wlan policy default-policy-profile","end"]:
 | 
				
			||||||
 | 
					            egg.sendline(command)
 | 
				
			||||||
 | 
					            sleep(0.1)
 | 
				
			||||||
 | 
					            j = egg.expect_exact(["(config-policy-tag)#",pexpect.TIMEOUT],timeout=2)
 | 
				
			||||||
 | 
					            if j == 0:
 | 
				
			||||||
 | 
					               print("command sent: {}".format(command))
 | 
				
			||||||
 | 
					            if j == 1:
 | 
				
			||||||
 | 
					               if command == "end":
 | 
				
			||||||
 | 
					                  pass
 | 
				
			||||||
 | 
					               else:
 | 
				
			||||||
 | 
					                  print("command time out: {}".format(command))
 | 
				
			||||||
 | 
					      if i == 1:
 | 
				
			||||||
 | 
					         print("did not get the (config)# prompt")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   if (args.action == "no_open_wlan"):
 | 
				
			||||||
 | 
					      egg.sendline("config t")
 | 
				
			||||||
 | 
					      sleep(0.1)
 | 
				
			||||||
 | 
					      i = egg.expect_exact(["(config)#",pexpect.TIMEOUT],timeout=2)
 | 
				
			||||||
 | 
					      if i == 0:
 | 
				
			||||||
 | 
					         for command in ["no wlan open-wlan","end"]:
 | 
				
			||||||
 | 
					            egg.sendline(command)
 | 
				
			||||||
 | 
					            sleep(0.1)
 | 
				
			||||||
 | 
					            j = egg.expect_exact(["(config)#",pexpect.TIMEOUT],timeout=2)
 | 
				
			||||||
 | 
					            if j == 0:
 | 
				
			||||||
 | 
					               print("command sent: {}".format(command))
 | 
				
			||||||
 | 
					            if j == 1:
 | 
				
			||||||
 | 
					               if command == "end":
 | 
				
			||||||
 | 
					                  pass
 | 
				
			||||||
 | 
					               else:
 | 
				
			||||||
 | 
					                  print("command time out: {}".format(command))
 | 
				
			||||||
 | 
					      if i == 1:
 | 
				
			||||||
 | 
					         print("did not get the (config)# prompt")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   if (args.action == "show_wlan_summary"):
 | 
				
			||||||
 | 
					      egg.sendline("show wlan summary")
 | 
				
			||||||
 | 
					      sleep(0.1)
 | 
				
			||||||
 | 
					      i = egg.expect(["#",pexpect.TIMEOUT],timeout=2)
 | 
				
			||||||
 | 
					      if i == 0:
 | 
				
			||||||
 | 
					         print("show wlan summary sent")
 | 
				
			||||||
 | 
					      if i == 1:
 | 
				
			||||||
 | 
					         print("show wlan summary timed out")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   if (args.action == "wlan" and (args.wlanID is None)):
 | 
					   if (args.action == "wlan" and (args.wlanID is None)):
 | 
				
			||||||
      raise Exception("wlan ID is required")
 | 
					      raise Exception("wlan ID is required")
 | 
				
			||||||
   if (args.action == "wlan"):
 | 
					   if (args.action == "wlan"):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user