Fixed some library errors and environment setup script issues

Signed-off-by: shivam <shivam.thakur@candelatech.com>
This commit is contained in:
shivam
2022-08-05 14:57:26 +05:30
committed by haricharan-jaka
parent 3494632531
commit aa3dacbdf5
3 changed files with 20 additions and 10 deletions

View File

@@ -86,6 +86,7 @@ class tip_2x:
self.controller_data = controller_data
self.device_under_tests_info = device_under_tests_info
self.setup_metadata()
self.setup_objects()
"""
Controller and Access Point specific metadata that is related to OpenWifi 2.x
@@ -221,7 +222,7 @@ class tip_2x:
# Setup Config Apply on all AP's
for i in range(0, len(self.device_under_tests_info)):
resp = profile_object.push_config(serial_number=self.device_under_tests_info[i]["identifier"])
logging.info("Response for Config apply: " + resp.status_code)
logging.info("Response for Config apply: " + str(resp.status_code))
if resp.status_code != 200:
logging.info("Failed to apply Configuration to AP. Response Code" +
resp.status_code +
@@ -229,8 +230,8 @@ class tip_2x:
time.sleep(5)
resp = profile_object.push_config(serial_number=self.device_under_tests_info[i]["identifier"])
if resp.status_code != 200:
logging.error("Failed to apply Config, Response code:" + resp.status_code)
pytest.fail("Failed to apply Config, Response code :" + resp.status_code)
logging.error("Failed to apply Config, Response code:" + str(resp.status_code))
pytest.fail("Failed to apply Config, Response code :" + str(resp.status_code))
if resp.status_code == 200:
r_val.append(True)
@@ -295,7 +296,7 @@ class tip_2x:
for dut in self.device_under_tests_info:
resp = profile_object.push_config(serial_number=dut["identifier"])
logging.info("Response for Config apply: " + resp.status_code)
logging.info("Response for Config apply: " + str(resp.status_code))
if resp.status_code != 200:
logging.info("Failed to apply Configuration to AP. Response Code" +
resp.status_code +
@@ -303,8 +304,8 @@ class tip_2x:
time.sleep(5)
resp = profile_object.push_config(serial_number=dut["identifier"])
if resp.status_code != 200:
logging.info("Failed to apply Config, Response code:" + resp.status_code)
pytest.fail("Failed to apply Config, Response code :" + resp.status_code)
logging.info("Failed to apply Config, Response code:" + str(resp.status_code))
pytest.fail("Failed to apply Config, Response code :" + str(resp.status_code))
if resp.status_code == 200:
r_val = True
# TODO

View File

@@ -1,4 +1,7 @@
#!/bin/bash
# Setup python environment variable and pip environment variable like
# export PYTHON=/usr/bin/python3
# export PIP=/usr/bin/pip3
#sh setup_env.bash -t tip_2x -d all -n "Shivam Thakur" -o TIP -e shivam.thakur@candelatech.com -i "TIP OpenWIFI 2.X Library"
helpFunction()
{
@@ -38,12 +41,12 @@ echo "Target SDK for " "$target"
echo "$device"
# Check Python version and pip version
if ! hash python; then
if ! hash $PYTHON; then
echo "python is not installed"
exit 1
fi
ver=$(python -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/')
ver=$($PYTHON -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/')
if [ "$ver" -lt "38" ]; then
echo "This script requires python 3.8 or greater"
exit 1
@@ -71,8 +74,10 @@ then
touch tests/imports.py
if [ $target == "tip_2x" ]
then
python libs/tip_2x/setup.py libs/tip_2x/bdist_wheel
pip install libs/tip_2x/dist/*.whl
cd libs/tip_2x
python setup.py bdist_wheel
pip install dist/*.whl --force-reinstall
cd ../../
fi
echo -e "\"\"\"\nRegistered Target Imports\n\"\"\"\nimport sys\nimport importlib\n\nsys.path.append('/usr/local/bin')\n\n" >> tests/imports.py
echo -e "########################################################################################################################" >> tests/imports.py

View File

@@ -3,12 +3,16 @@ import pytest
@pytest.fixture(scope="class")
def setup_configuration(request, get_markers, get_target_object):
# Predefined selected markers and selected configuration
configuration = dict(request.param)
requested_combination = []
for key in get_markers:
if get_markers[key]:
requested_combination.append(get_markers[key])
print(requested_combination)
# Method to setup the basic configuration
status = get_target_object.setup_basic_configuration(configuration=configuration,
requested_combination=requested_combination)
yield status