mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-03 20:27:54 +00:00 
			
		
		
		
	python: Fix wait-for-ip, ipv4 variable time.
Had indentation issue in port wait-for-ip logic, tie in some cmd-line args for ipv4 variable time script.
This commit is contained in:
		@@ -245,7 +245,7 @@ class Realm(LFCliBase):
 | 
				
			|||||||
        while wait_more:
 | 
					        while wait_more:
 | 
				
			||||||
            wait_more = False
 | 
					            wait_more = False
 | 
				
			||||||
            found_cxs = {}
 | 
					            found_cxs = {}
 | 
				
			||||||
            cx_list = list(self.cx_list())
 | 
					            cx_list = self.cx_list()
 | 
				
			||||||
            not_cx = ['warnings', 'errors', 'handler', 'uri', 'items']
 | 
					            not_cx = ['warnings', 'errors', 'handler', 'uri', 'items']
 | 
				
			||||||
            if cx_list is not None:
 | 
					            if cx_list is not None:
 | 
				
			||||||
                for cx_name in cx_list:
 | 
					                for cx_name in cx_list:
 | 
				
			||||||
@@ -394,7 +394,7 @@ class Realm(LFCliBase):
 | 
				
			|||||||
        return LFUtils.name_to_eid(eid)
 | 
					        return LFUtils.name_to_eid(eid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def wait_for_ip(self, station_list=None, ipv4=True, ipv6=False, timeout_sec=60):
 | 
					    def wait_for_ip(self, station_list=None, ipv4=True, ipv6=False, timeout_sec=60):
 | 
				
			||||||
        print("Waiting for ips...")
 | 
					        print("Waiting for ips, timeout: %i..."%(timeout_sec))
 | 
				
			||||||
        #print(station_list)
 | 
					        #print(station_list)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (station_list is None) or (len(station_list) < 1):
 | 
					        if (station_list is None) or (len(station_list) < 1):
 | 
				
			||||||
@@ -423,12 +423,17 @@ class Realm(LFCliBase):
 | 
				
			|||||||
                    if v['ip'] == '0.0.0.0':
 | 
					                    if v['ip'] == '0.0.0.0':
 | 
				
			||||||
                        wait_more = True
 | 
					                        wait_more = True
 | 
				
			||||||
                        print("Waiting for port %s to get IPv4 Address."%(sta_eid))
 | 
					                        print("Waiting for port %s to get IPv4 Address."%(sta_eid))
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
 | 
					                        print("Found IP: %s on port: %s"%(v['ip'], sta_eid))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if ipv6:
 | 
					                if ipv6:
 | 
				
			||||||
                    v = response['interface']
 | 
					                    v = response['interface']
 | 
				
			||||||
                    if v['ipv6 address'] != 'DELETED' and not v['ipv6 address'].startswith('fe80') \
 | 
					                    if v['ipv6 address'] != 'DELETED' and not v['ipv6 address'].startswith('fe80') \
 | 
				
			||||||
                           and v['ipv6 address'] != 'AUTO':
 | 
					                           and v['ipv6 address'] != 'AUTO':
 | 
				
			||||||
                        wait_more = True
 | 
					                        wait_more = True
 | 
				
			||||||
                        print("Waiting for port %s to get IPv6 Address."%(sta_eid))
 | 
					                        print("Waiting for port %s to get IPv6 Address."%(sta_eid))
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
 | 
					                        print("Found IPv6: %s on port: %s"%(v['ipv6 address'], sta_eid))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if wait_more:
 | 
					            if wait_more:
 | 
				
			||||||
                time.sleep(1)
 | 
					                time.sleep(1)
 | 
				
			||||||
@@ -1534,7 +1539,8 @@ class VAPProfile(LFCliBase):
 | 
				
			|||||||
                if self.debug:
 | 
					                if self.debug:
 | 
				
			||||||
                    pprint(command_ref)
 | 
					                    pprint(command_ref)
 | 
				
			||||||
                raise ValueError("flag %s not in map" % name)
 | 
					                raise ValueError("flag %s not in map" % name)
 | 
				
			||||||
            result += command_ref[name]
 | 
					            #print("add-named-flags: %s  %i"%(name, command_ref[name]))
 | 
				
			||||||
 | 
					            result |= command_ref[name]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return result
 | 
					        return result
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1972,7 +1978,8 @@ class StationProfile:
 | 
				
			|||||||
            self.add_sta_data["shelf"] = radio_shelf
 | 
					            self.add_sta_data["shelf"] = radio_shelf
 | 
				
			||||||
            self.add_sta_data["resource"] = radio_resource
 | 
					            self.add_sta_data["resource"] = radio_resource
 | 
				
			||||||
            self.add_sta_data["radio"] = radio_port
 | 
					            self.add_sta_data["radio"] = radio_port
 | 
				
			||||||
            self.add_sta_data["sta_name"] = name
 | 
					            self.add_sta_data["sta_name"] = name # for create station calls
 | 
				
			||||||
 | 
					            self.set_port_data["port"] = name  # for set_port calls.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            self.station_names.append("%s.%s.%s" % (radio_shelf, radio_resource, name))
 | 
					            self.station_names.append("%s.%s.%s" % (radio_shelf, radio_resource, name))
 | 
				
			||||||
            add_sta_r.addPostData(self.add_sta_data)
 | 
					            add_sta_r.addPostData(self.add_sta_data)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,7 @@ import datetime
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class IPV4VariableTime(LFCliBase):
 | 
					class IPV4VariableTime(LFCliBase):
 | 
				
			||||||
    def __init__(self, host, port, ssid, security, password, sta_list, name_prefix, upstream="eth1", radio="wiphy0",
 | 
					    def __init__(self, host, port, ssid, security, password, sta_list, name_prefix, upstream, radio,
 | 
				
			||||||
                 side_a_min_rate=56, side_a_max_rate=0,
 | 
					                 side_a_min_rate=56, side_a_max_rate=0,
 | 
				
			||||||
                 side_b_min_rate=56, side_b_max_rate=0,
 | 
					                 side_b_min_rate=56, side_b_max_rate=0,
 | 
				
			||||||
                 number_template="00000", test_duration="5m", use_ht160=False,
 | 
					                 number_template="00000", test_duration="5m", use_ht160=False,
 | 
				
			||||||
@@ -95,7 +95,7 @@ class IPV4VariableTime(LFCliBase):
 | 
				
			|||||||
    def start(self, print_pass=False, print_fail=False):
 | 
					    def start(self, print_pass=False, print_fail=False):
 | 
				
			||||||
        self.station_profile.admin_up()
 | 
					        self.station_profile.admin_up()
 | 
				
			||||||
        temp_stas = self.station_profile.station_names.copy()
 | 
					        temp_stas = self.station_profile.station_names.copy()
 | 
				
			||||||
        temp_stas.append("eth1")
 | 
					        temp_stas.append(self.upstream)
 | 
				
			||||||
        if self.local_realm.wait_for_ip(temp_stas):
 | 
					        if self.local_realm.wait_for_ip(temp_stas):
 | 
				
			||||||
            self._pass("All stations got IPs", print_pass)
 | 
					            self._pass("All stations got IPs", print_pass)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
@@ -186,13 +186,12 @@ Note:   multiple --radio switches may be entered up to the number of radios avai
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
    parser.add_argument('--mgr', help='--mgr <hostname for where LANforge GUI is running>',default='localhost')
 | 
					    parser.add_argument('--mgr', help='--mgr <hostname for where LANforge GUI is running>',default='localhost')
 | 
				
			||||||
    parser.add_argument('--upstream', help='--upstream <1.eth1, etc>',default='1.eth1')
 | 
					    parser.add_argument('-u', '--upstream_port', help='--upstream_port <1.eth1, etc>',default='1.eth1')
 | 
				
			||||||
    parser.add_argument('--radio', help='--radio <radio EID>',default='wiphy2')
 | 
					    parser.add_argument('--radio', help='--radio <radio EID>',default='wiphy2')
 | 
				
			||||||
    parser.add_argument('--ssid', help='--ssid <SSID>',default='jedway-wpa2-160')
 | 
					    parser.add_argument('--ssid', help='--ssid <SSID>',default='jedway-wpa2-160')
 | 
				
			||||||
    parser.add_argument('--passwd', help='--passwd <Password>',default='jedway-wpa2-160')
 | 
					    parser.add_argument('--passwd', help='--passwd <Password>',default='jedway-wpa2-160')
 | 
				
			||||||
    parser.add_argument('--security', help='--security <wpa2 | open | wpa3>',default='wpa2')
 | 
					    parser.add_argument('--security', help='--security <wpa2 | open | wpa3>',default='wpa2')
 | 
				
			||||||
    parser.add_argument('--debug', help='--debug:  Enable debugging',default=False)
 | 
					    parser.add_argument('--debug', help='--debug:  Enable debugging',default=False, action="store_true")
 | 
				
			||||||
    parser.add_argument('-u', '--upstream_port', help='--upstream_port <cross connect upstream_port> example: --upstream_port eth1',default='eth1')
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    args = parser.parse_args()
 | 
					    args = parser.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -200,7 +199,7 @@ Note:   multiple --radio switches may be entered up to the number of radios avai
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ip_var_test = IPV4VariableTime(args.mgr, lfjson_port, number_template="00", sta_list=station_list,
 | 
					    ip_var_test = IPV4VariableTime(args.mgr, lfjson_port, number_template="00", sta_list=station_list,
 | 
				
			||||||
                                   name_prefix="VT",
 | 
					                                   name_prefix="VT",
 | 
				
			||||||
                                   upstream=args.upstream,
 | 
					                                   upstream=args.upstream_port,
 | 
				
			||||||
                                   ssid=args.ssid,
 | 
					                                   ssid=args.ssid,
 | 
				
			||||||
                                   password=args.passwd,
 | 
					                                   password=args.passwd,
 | 
				
			||||||
                                   radio=args.radio,
 | 
					                                   radio=args.radio,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user