Skip to content

Commit

Permalink
Add check of getting wifi IP
Browse files Browse the repository at this point in the history
Signed-off-by: Mariia Azbeleva <[email protected]>
  • Loading branch information
azbeleva committed Oct 19, 2023
1 parent 97070eb commit 1b3a5da
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Robot-Framework/lib/output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,12 @@ def parse_iperf_output(output):
"tx": tx,
"rx": rx
}

def get_wifi_ip_from_ifconfig(output, if_name):
pattern = if_name + r'.*?\n.*?inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'
match = re.search(pattern, output)
if match:
return match.group(1)
else:
print(f"Couldn't find ip with pattern {pattern}")
return None
22 changes: 22 additions & 0 deletions Robot-Framework/resources/ssh_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,25 @@ Install iperf tool
ELSE
Log To Console ${\n}iperf tool was already installed
END

Get Wifi Interface name
${if_name}= Execute Command iw dev | awk '$1=="Interface"{print $2}'
[Return] ${if_name}

Get wifi IP
[Documentation] Parse ifconfig output and looks for wifi IP
${if_name}= Get Wifi Interface name
${is_ready} = Set Variable False
FOR ${i} IN RANGE 20
${output} Execute Command ifconfig
Log ${output}
${ip} Get wifi ip from ifconfig ${output} ${if_name}
${status} Run Keyword And Return Status Should Not Be Equal As Strings ${ip} None
IF ${status}
Log To Console Ip is ${ip}
${is_ready} = Set Variable True
BREAK
END
Sleep 1
END
IF ${status} == False FAIL NetVM hasn't gotten an IP
3 changes: 2 additions & 1 deletion Robot-Framework/test-suites/bat-tests/netvm.robot
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Wifi passthrought into NetVM
... Connect to ghaf host AND Connect to netvm via tunnel AND
... Verify service status service=wpa_supplicant.service
Configure wifi ${netvm} ${SSID} ${wifi_pswd}
Get wifi IP
Check Network Availability ${netwotk_ip} expected_result=True
Log To Console Switch connection to Ghaf Host
Switch Connection ${ghaf_host}
Expand Down Expand Up @@ -216,4 +217,4 @@ Start NetVM if dead
... Pre-condition: requires active ssh connection to ghaf host.
IF '${netvm_state}' == 'dead'
Start NetVM
END
END

0 comments on commit 1b3a5da

Please sign in to comment.