mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-27 16:23:41 +00:00
pytest: Make cmd-line args match what the stand-alone tools were using.
And create cmd-line-args based on pytest input so we can pass it into the library guts.
This commit is contained in:
@@ -531,9 +531,9 @@ class CloudSDK:
|
||||
url_base = cloudSDK_url + "/portal/location/forCustomer" + "?customerId=" + customer_id
|
||||
return self.get_paged_url(bearer, url_base)
|
||||
|
||||
def get_customer_equipment(self, cloudSDK_url, bearer, customer_id):
|
||||
url_base = cloudSDK_url + "/portal/equipment/forCustomer" + "?customerId=" + customer_id
|
||||
return self.get_paged_url(bearer, url_base)
|
||||
def get_customer_equipment(self, customer_id):
|
||||
url = self.base_url + "/portal/equipment/forCustomer" + "?customerId=" + customer_id
|
||||
return self.get_paged_url(self.bearer, url)
|
||||
|
||||
def get_customer_portal_users(self, cloudSDK_url, bearer, customer_id):
|
||||
url_base = cloudSDK_url + "/portal/portalUser/forCustomer" + "?customerId=" + customer_id
|
||||
|
||||
@@ -49,7 +49,7 @@ class NightlySanity:
|
||||
print("EQ Id: %s" % (eq_id))
|
||||
|
||||
# Now, query equipment to find something that matches.
|
||||
eq = self.cloud.get_customer_equipment(args.sdk_base_url, self.bearer, self.customer_id)
|
||||
eq = self.cloud.get_customer_equipment(self.customer_id)
|
||||
for item in eq:
|
||||
for e in item['items']:
|
||||
print(e['id'], " ", e['inventoryId'])
|
||||
|
||||
@@ -92,117 +92,262 @@ from lab_ap_info import cloud_type
|
||||
from lab_ap_info import test_cases
|
||||
from lab_ap_info import radius_info
|
||||
|
||||
# keep in sync with that below.
|
||||
def add_base_parse_args(parser):
|
||||
parser.add_argument("-b", "--build-id", type=str,
|
||||
help="FW commit ID (latest pending build on dev is default)",
|
||||
default="pending")
|
||||
parser.add_argument("--skip-upgrade", type=bool, help="Skip upgrading firmware",
|
||||
default=False)
|
||||
parser.add_argument("--force-upgrade", type=bool,
|
||||
help="Force upgrading firmware even if it is already current version",
|
||||
default=False)
|
||||
parser.add_argument("-m", "--model", type=str,
|
||||
choices=['ea8300', 'ecw5410', 'ecw5211', 'ec420', 'wf188n', 'eap102', 'None'],
|
||||
help="AP model to be run", required=True)
|
||||
parser.add_argument("--equipment-id", type=str,
|
||||
help="AP model ID, as exists in the cloud-sdk. -1 to auto-detect.",
|
||||
default="-1")
|
||||
parser.add_argument("--object-id", type=str,
|
||||
help="Used when querying and deleting individual objects.",
|
||||
default=None)
|
||||
parser.add_argument("--customer-id", type=str,
|
||||
help="Specify cloud customer-id, default is 2",
|
||||
default="2")
|
||||
parser.add_argument("--testbed", type=str,
|
||||
help="Testbed name, will be prefixed to profile names and similar",
|
||||
default=None)
|
||||
|
||||
parser.add_argument("--sdk-base-url", type=str,
|
||||
help="cloudsdk base url, default: https://wlan-portal-svc.cicd.lab.wlan.tip.build",
|
||||
default="https://wlan-portal-svc.cicd.lab.wlan.tip.build")
|
||||
parser.add_argument("--sdk-user-id", type=str, help="cloudsdk user id, default: support@example.conf",
|
||||
default="support@example.com")
|
||||
parser.add_argument("--sdk-user-password", type=str, help="cloudsdk user password, default: support",
|
||||
default="support")
|
||||
|
||||
parser.add_argument("--jfrog-base-url", type=str, help="jfrog base url",
|
||||
default="tip.jFrog.io/artifactory/tip-wlan-ap-firmware")
|
||||
parser.add_argument("--jfrog-user-id", type=str, help="jfrog user id",
|
||||
default="tip-read")
|
||||
parser.add_argument("--jfrog-user-password", type=str, help="jfrog user password",
|
||||
default="tip-read")
|
||||
|
||||
parser.add_argument("--testrail-base-url", type=str, help="testrail base url",
|
||||
# was os.getenv('TESTRAIL_URL')
|
||||
default="https://telecominfraproject.testrail.com")
|
||||
parser.add_argument("--testrail-project", type=str, help="testrail project name",
|
||||
default="opsfleet-wlan")
|
||||
parser.add_argument("--testrail-user-id", type=str,
|
||||
help="testrail user id. Use 'NONE' to disable use of testrails.",
|
||||
default="NONE")
|
||||
parser.add_argument("--testrail-user-password", type=str, help="testrail user password",
|
||||
default="password")
|
||||
parser.add_argument("--testrail-run-prefix", type=str, help="testrail run prefix",
|
||||
default="prefix-1")
|
||||
parser.add_argument("--milestone", type=str, help="testrail milestone ID",
|
||||
default="milestone-1")
|
||||
|
||||
parser.add_argument("--lanforge-ip-address", type=str, help="ip address of the lanforge gui",
|
||||
default="127.0.0.1")
|
||||
parser.add_argument("--lanforge-port-number", type=str, help="port of the lanforge gui",
|
||||
default="8080")
|
||||
parser.add_argument("--lanforge-prefix", type=str, help="LANforge api prefix string",
|
||||
default="sdk")
|
||||
parser.add_argument("--lanforge-2g-radio", type=str, help="LANforge 2Ghz radio to use for testing",
|
||||
default="1.1.wiphy0")
|
||||
parser.add_argument("--lanforge-5g-radio", type=str, help="LANforge 5Ghz radio to use for testing",
|
||||
default="1.1.wiphy1")
|
||||
|
||||
parser.add_argument("--local_dir", type=str, help="Sanity logging directory",
|
||||
default="logs")
|
||||
parser.add_argument("--report-path", type=str, help="Sanity report directory",
|
||||
default="reports")
|
||||
parser.add_argument("--report-template", type=str, help="Sanity report template",
|
||||
default="reports/report_template.php")
|
||||
|
||||
parser.add_argument("--eap-id", type=str, help="EAP indentity",
|
||||
default="lanforge")
|
||||
parser.add_argument("--ttls-password", type=str, help="TTLS password",
|
||||
default="lanforge")
|
||||
|
||||
parser.add_argument("--ap-ip", type=str, help="AP IP Address, for direct ssh access if not using jumphost",
|
||||
default="127.0.0.1")
|
||||
parser.add_argument("--ap-username", type=str, help="AP username",
|
||||
default="root")
|
||||
parser.add_argument("--ap-password", type=str, help="AP password",
|
||||
default="root")
|
||||
parser.add_argument("--ap-jumphost-address", type=str,
|
||||
help="IP of system that we can ssh in to get serial console access to AP",
|
||||
default=None)
|
||||
parser.add_argument("--ap-jumphost-port", type=str,
|
||||
help="SSH port to use in case we are using ssh tunneling or other non-standard ports",
|
||||
default="22")
|
||||
parser.add_argument("--ap-jumphost-username", type=str,
|
||||
help="User-ID for system that we can ssh in to get serial console access to AP",
|
||||
default="lanforge")
|
||||
parser.add_argument("--ap-jumphost-password", type=str,
|
||||
help="Passwort for system that we can ssh in to get serial console access to AP",
|
||||
default="lanforge")
|
||||
parser.add_argument("--ap-jumphost-wlan-testing", type=str, help="wlan-testing repo dir on the jumphost",
|
||||
default="git/wlan-testing")
|
||||
parser.add_argument("--ap-jumphost-tty", type=str, help="Serial port for the AP we wish to talk to",
|
||||
default="UNCONFIGURED-JUMPHOST-TTY")
|
||||
|
||||
parser.add_argument('--skip-update-firmware', dest='update_firmware', action='store_false')
|
||||
parser.set_defaults(update_firmware=True)
|
||||
|
||||
parser.add_argument('--verbose', dest='verbose', action='store_true')
|
||||
parser.set_defaults(verbose=False)
|
||||
|
||||
|
||||
# Keep in sync with that above
|
||||
def add_base_parse_args_pytest(parser):
|
||||
parser.addoption("--default-ap-profile", type=str,
|
||||
help="Default AP profile to use as basis for creating new ones, typically: TipWlan-2-Radios or TipWlan-3-Radios",
|
||||
default="TipWlan-2-Radios")
|
||||
parser.addoption("--skip-radius", dest="skip_radius", action='store_true',
|
||||
help="Should we skip the RADIUS configs or not")
|
||||
parser.addoption("--skip-profiles", dest="skip_profiles", action='store_true',
|
||||
help="Should we skip applying profiles?")
|
||||
parser.addoption("--skip-wpa", dest="skip_wpa", action='store_false',
|
||||
help="Should we skip applying profiles?")
|
||||
parser.addoption("--skip-wpa2", dest="skip_wpa2", action='store_false',
|
||||
help="Should we skip applying profiles?")
|
||||
|
||||
parser.addoption("--psk-5g-wpa2", dest="psk_5g_wpa2", type=str,
|
||||
help="Allow over-riding the 5g-wpa2 PSK value.")
|
||||
parser.addoption("--psk-5g-wpa", dest="psk_5g_wpa", type=str,
|
||||
help="Allow over-riding the 5g-wpa PSK value.")
|
||||
parser.addoption("--psk-2g-wpa2", dest="psk_2g_wpa2", type=str,
|
||||
help="Allow over-riding the 2g-wpa2 PSK value.")
|
||||
parser.addoption("--psk-2g-wpa", dest="psk_2g_wpa", type=str,
|
||||
help="Allow over-riding the 2g-wpa PSK value.")
|
||||
|
||||
parser.addoption("--ssid-5g-wpa2", dest="ssid_5g_wpa2", type=str,
|
||||
help="Allow over-riding the 5g-wpa2 SSID value.")
|
||||
parser.addoption("--ssid-5g-wpa", dest="ssid_5g_wpa", type=str,
|
||||
help="Allow over-riding the 5g-wpa SSID value.")
|
||||
parser.addoption("--ssid-2g-wpa2", dest="ssid_2g_wpa2", type=str,
|
||||
help="Allow over-riding the 2g-wpa2 SSID value.")
|
||||
parser.addoption("--ssid-2g-wpa", dest="ssid_2g_wpa", type=str,
|
||||
help="Allow over-riding the 2g-wpa SSID value.")
|
||||
|
||||
parser.addoption("--mode", dest="mode", choices=['bridge', 'nat', 'vlan'], type=str,
|
||||
help="Mode of AP Profile [bridge/nat/vlan]", default="bridge")
|
||||
|
||||
parser.addoption("--build-id", type=str,
|
||||
help="FW commit ID (latest pending build on dev is default)",
|
||||
default="pending")
|
||||
parser.addoption("--skip-upgrade", type=bool, help="Skip upgrading firmware",
|
||||
default=False)
|
||||
parser.addoption("--force-upgrade", type=bool,
|
||||
help="Force upgrading firmware even if it is already current version",
|
||||
default=False)
|
||||
# --access-points instead
|
||||
# parser.addoption("--model", type=str,
|
||||
# choices=['ea8300', 'ecw5410', 'ecw5211', 'ec420', 'wf188n', 'eap102', 'None'],
|
||||
# help="AP model to be run", required=True)
|
||||
parser.addoption("--equipment-id", type=str,
|
||||
help="AP model ID, as exists in the cloud-sdk. -1 to auto-detect.",
|
||||
default="-1")
|
||||
parser.addoption("--object-id", type=str,
|
||||
help="Used when querying and deleting individual objects.",
|
||||
default=None)
|
||||
parser.addoption("--customer-id", type=str,
|
||||
help="Specify cloud customer-id, default is 2",
|
||||
default="2")
|
||||
parser.addoption("--testbed", type=str,
|
||||
help="Testbed name, will be prefixed to profile names and similar",
|
||||
default=None)
|
||||
|
||||
parser.addoption("--sdk-base-url", type=str,
|
||||
help="cloudsdk base url, default: https://wlan-portal-svc.cicd.lab.wlan.tip.build",
|
||||
default="https://wlan-portal-svc.cicd.lab.wlan.tip.build")
|
||||
parser.addoption("--sdk-user-id", type=str, help="cloudsdk user id, default: support@example.conf",
|
||||
default="support@example.com")
|
||||
parser.addoption("--sdk-user-password", type=str, help="cloudsdk user password, default: support",
|
||||
default="support")
|
||||
|
||||
parser.addoption("--jfrog-base-url", type=str, help="jfrog base url",
|
||||
default="tip.jFrog.io/artifactory/tip-wlan-ap-firmware")
|
||||
parser.addoption("--jfrog-user-id", type=str, help="jfrog user id",
|
||||
default="tip-read")
|
||||
parser.addoption("--jfrog-user-password", type=str, help="jfrog user password",
|
||||
default="tip-read")
|
||||
|
||||
parser.addoption("--testrail-base-url", type=str, help="testrail base url",
|
||||
# was os.getenv('TESTRAIL_URL')
|
||||
default="https://telecominfraproject.testrail.com")
|
||||
parser.addoption("--testrail-project", type=str, help="testrail project name",
|
||||
default="opsfleet-wlan")
|
||||
parser.addoption("--testrail-user-id", type=str,
|
||||
help="testrail user id. Use 'NONE' to disable use of testrails.",
|
||||
default="NONE")
|
||||
parser.addoption("--testrail-user-password", type=str, help="testrail user password",
|
||||
default="password")
|
||||
parser.addoption("--testrail-run-prefix", type=str, help="testrail run prefix",
|
||||
default="prefix-1")
|
||||
parser.addoption("--milestone", type=str, help="testrail milestone ID",
|
||||
default="milestone-1")
|
||||
|
||||
parser.addoption("--lanforge-ip-address", type=str, help="ip address of the lanforge gui",
|
||||
default="127.0.0.1")
|
||||
parser.addoption("--lanforge-port-number", type=str, help="port of the lanforge gui",
|
||||
default="8080")
|
||||
parser.addoption("--lanforge-prefix", type=str, help="LANforge api prefix string",
|
||||
default="sdk")
|
||||
parser.addoption("--lanforge-2g-radio", type=str, help="LANforge 2Ghz radio to use for testing",
|
||||
default="1.1.wiphy0")
|
||||
parser.addoption("--lanforge-5g-radio", type=str, help="LANforge 5Ghz radio to use for testing",
|
||||
default="1.1.wiphy1")
|
||||
|
||||
parser.addoption("--local_dir", type=str, help="Sanity logging directory",
|
||||
default="logs")
|
||||
parser.addoption("--report-path", type=str, help="Sanity report directory",
|
||||
default="reports")
|
||||
parser.addoption("--report-template", type=str, help="Sanity report template",
|
||||
default="reports/report_template.php")
|
||||
|
||||
parser.addoption("--eap-id", type=str, help="EAP indentity",
|
||||
default="lanforge")
|
||||
parser.addoption("--ttls-password", type=str, help="TTLS password",
|
||||
default="lanforge")
|
||||
|
||||
parser.addoption("--ap-ip", type=str, help="AP IP Address, for direct ssh access if not using jumphost",
|
||||
default="127.0.0.1")
|
||||
parser.addoption("--ap-username", type=str, help="AP username",
|
||||
default="root")
|
||||
parser.addoption("--ap-password", type=str, help="AP password",
|
||||
default="root")
|
||||
parser.addoption("--ap-jumphost-address", type=str,
|
||||
help="IP of system that we can ssh in to get serial console access to AP",
|
||||
default=None)
|
||||
parser.addoption("--ap-jumphost-port", type=str,
|
||||
help="SSH port to use in case we are using ssh tunneling or other non-standard ports",
|
||||
default="22")
|
||||
parser.addoption("--ap-jumphost-username", type=str,
|
||||
help="User-ID for system that we can ssh in to get serial console access to AP",
|
||||
default="lanforge")
|
||||
parser.addoption("--ap-jumphost-password", type=str,
|
||||
help="Passwort for system that we can ssh in to get serial console access to AP",
|
||||
default="lanforge")
|
||||
parser.addoption("--ap-jumphost-wlan-testing", type=str, help="wlan-testing repo dir on the jumphost",
|
||||
default="git/wlan-testing")
|
||||
parser.addoption("--ap-jumphost-tty", type=str, help="Serial port for the AP we wish to talk to",
|
||||
default="UNCONFIGURED-JUMPHOST-TTY")
|
||||
|
||||
parser.addoption('--skip-update-firmware', dest='update_firmware', action='store_false', default=True)
|
||||
|
||||
parser.addoption('--tip-verbose', dest='verbose', action='store_true', default=False)
|
||||
|
||||
|
||||
class UnitTestBase:
|
||||
|
||||
def __init__(self, log_name, args, reporting=None):
|
||||
self.parser = argparse.ArgumentParser(description="Sanity Testing on Firmware Build", parents=[args])
|
||||
|
||||
self.parser.add_argument("-b", "--build-id", type=str,
|
||||
help="FW commit ID (latest pending build on dev is default)",
|
||||
default="pending")
|
||||
self.parser.add_argument("--skip-upgrade", type=bool, help="Skip upgrading firmware",
|
||||
default=False)
|
||||
self.parser.add_argument("--force-upgrade", type=bool,
|
||||
help="Force upgrading firmware even if it is already current version",
|
||||
default=False)
|
||||
self.parser.add_argument("-m", "--model", type=str,
|
||||
choices=['ea8300', 'ecw5410', 'ecw5211', 'ec420', 'wf188n', 'eap102', 'None'],
|
||||
help="AP model to be run", required=True)
|
||||
self.parser.add_argument("--equipment_id", type=str,
|
||||
help="AP model ID, as exists in the cloud-sdk. -1 to auto-detect.",
|
||||
default="-1")
|
||||
self.parser.add_argument("--object_id", type=str,
|
||||
help="Used when querying and deleting individual objects.",
|
||||
default=None)
|
||||
self.parser.add_argument("--customer-id", type=str,
|
||||
help="Specify cloud customer-id, default is 2",
|
||||
default="2")
|
||||
self.parser.add_argument("--testbed", type=str,
|
||||
help="Testbed name, will be prefixed to profile names and similar",
|
||||
default=None)
|
||||
|
||||
self.parser.add_argument("--sdk-base-url", type=str,
|
||||
help="cloudsdk base url, default: https://wlan-portal-svc.cicd.lab.wlan.tip.build",
|
||||
default="https://wlan-portal-svc.cicd.lab.wlan.tip.build")
|
||||
self.parser.add_argument("--sdk-user-id", type=str, help="cloudsdk user id, default: support@example.conf",
|
||||
default="support@example.com")
|
||||
self.parser.add_argument("--sdk-user-password", type=str, help="cloudsdk user password, default: support",
|
||||
default="support")
|
||||
|
||||
self.parser.add_argument("--jfrog-base-url", type=str, help="jfrog base url",
|
||||
default="tip.jFrog.io/artifactory/tip-wlan-ap-firmware")
|
||||
self.parser.add_argument("--jfrog-user-id", type=str, help="jfrog user id",
|
||||
default="tip-read")
|
||||
self.parser.add_argument("--jfrog-user-password", type=str, help="jfrog user password",
|
||||
default="tip-read")
|
||||
|
||||
self.parser.add_argument("--testrail-base-url", type=str, help="testrail base url",
|
||||
# was os.getenv('TESTRAIL_URL')
|
||||
default="https://telecominfraproject.testrail.com")
|
||||
self.parser.add_argument("--testrail-project", type=str, help="testrail project name",
|
||||
default="opsfleet-wlan")
|
||||
self.parser.add_argument("--testrail-user-id", type=str,
|
||||
help="testrail user id. Use 'NONE' to disable use of testrails.",
|
||||
default="gleb@opsfleet.com")
|
||||
self.parser.add_argument("--testrail-user-password", type=str, help="testrail user password",
|
||||
default="password")
|
||||
self.parser.add_argument("--testrail-run-prefix", type=str, help="testrail run prefix",
|
||||
default="prefix-1")
|
||||
self.parser.add_argument("--milestone", type=str, help="testrail milestone ID",
|
||||
default="milestone-1")
|
||||
|
||||
self.parser.add_argument("--lanforge-ip-address", type=str, help="ip address of the lanforge gui",
|
||||
default="127.0.0.1")
|
||||
self.parser.add_argument("--lanforge-port-number", type=str, help="port of the lanforge gui",
|
||||
default="8080")
|
||||
self.parser.add_argument("--lanforge-prefix", type=str, help="LANforge api prefix string",
|
||||
default="sdk")
|
||||
self.parser.add_argument("--lanforge-2g-radio", type=str, help="LANforge 2Ghz radio to use for testing",
|
||||
default="1.1.wiphy0")
|
||||
self.parser.add_argument("--lanforge-5g-radio", type=str, help="LANforge 5Ghz radio to use for testing",
|
||||
default="1.1.wiphy1")
|
||||
|
||||
self.parser.add_argument("--local_dir", type=str, help="Sanity logging directory",
|
||||
default="logs")
|
||||
self.parser.add_argument("--report-path", type=str, help="Sanity report directory",
|
||||
default="reports")
|
||||
self.parser.add_argument("--report-template", type=str, help="Sanity report template",
|
||||
default="reports/report_template.php")
|
||||
|
||||
self.parser.add_argument("--eap-id", type=str, help="EAP indentity",
|
||||
default="lanforge")
|
||||
self.parser.add_argument("--ttls-password", type=str, help="TTLS password",
|
||||
default="lanforge")
|
||||
|
||||
self.parser.add_argument("--ap-ip", type=str, help="AP IP Address, for direct ssh access if not using jumphost",
|
||||
default="127.0.0.1")
|
||||
self.parser.add_argument("--ap-username", type=str, help="AP username",
|
||||
default="root")
|
||||
self.parser.add_argument("--ap-password", type=str, help="AP password",
|
||||
default="root")
|
||||
self.parser.add_argument("--ap-jumphost-address", type=str,
|
||||
help="IP of system that we can ssh in to get serial console access to AP",
|
||||
default=None)
|
||||
self.parser.add_argument("--ap-jumphost-port", type=str,
|
||||
help="SSH port to use in case we are using ssh tunneling or other non-standard ports",
|
||||
default="22")
|
||||
self.parser.add_argument("--ap-jumphost-username", type=str,
|
||||
help="User-ID for system that we can ssh in to get serial console access to AP",
|
||||
default="lanforge")
|
||||
self.parser.add_argument("--ap-jumphost-password", type=str,
|
||||
help="Passwort for system that we can ssh in to get serial console access to AP",
|
||||
default="lanforge")
|
||||
self.parser.add_argument("--ap-jumphost-wlan-testing", type=str, help="wlan-testing repo dir on the jumphost",
|
||||
default="git/wlan-testing")
|
||||
self.parser.add_argument("--ap-jumphost-tty", type=str, help="Serial port for the AP we wish to talk to",
|
||||
default="UNCONFIGURED-JUMPHOST-TTY")
|
||||
|
||||
self.parser.add_argument('--skip-update-firmware', dest='update_firmware', action='store_false')
|
||||
self.parser.set_defaults(update_firmware=True)
|
||||
|
||||
self.parser.add_argument('--verbose', dest='verbose', action='store_true')
|
||||
self.parser.set_defaults(verbose=False)
|
||||
add_base_parse_args(self.parser)
|
||||
|
||||
self.command_line_args = self.parser.parse_args()
|
||||
|
||||
|
||||
10
tests/pytest/EXAMPLE-USAGE.txt
Normal file
10
tests/pytest/EXAMPLE-USAGE.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
# This assumes you have ssh tunnels set up as suggested in ../tools/USAGE_EXAMPLES.txt
|
||||
|
||||
# Attempt to run pytest against nola-12. Doesn't work, cloud is down, but of course maybe more problems too.
|
||||
|
||||
pytest test_24ghz.py --testrail-user-id NONE --ap-jumphost-address localhost --ap-jumphost-port 8823 \
|
||||
--ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 --lanforge-ip-address localhost --lanforge-port-number 8822 \
|
||||
--default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build \
|
||||
--skip-radius --skip-wpa --verbose --testbed "NOLA-12c" --ssid-5g-wpa2 Default-SSID-5gl --psk-5g-wpa2 12345678 \
|
||||
--ssid-2g-wpa2 Default-SSID-2g --psk-2g-wpa2 12345678 --mode bridge --access-points wf188n
|
||||
|
||||
@@ -3,7 +3,7 @@ from time import sleep, gmtime, strftime
|
||||
|
||||
import sys
|
||||
import os
|
||||
#sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers'))
|
||||
|
||||
sys.path.append(f'..')
|
||||
|
||||
@@ -19,6 +19,7 @@ sys.path.append(f'../../libs/')
|
||||
|
||||
sys.path.append(f'../test_utility/')
|
||||
|
||||
from utils import *
|
||||
from UnitTestBase import *
|
||||
from JfrogHelper import *
|
||||
from cloudsdk import *
|
||||
@@ -29,11 +30,43 @@ def pytest_addoption(parser):
|
||||
parser.addini("jfrog-base-url", "jfrog base url")
|
||||
parser.addini("jfrog-user-id", "jfrog username")
|
||||
parser.addini("jfrog-user-password", "jfrog password")
|
||||
|
||||
parser.addini("sdk-base-url", "cloud sdk base url")
|
||||
parser.addini("sdk-user-id", "cloud sdk username")
|
||||
parser.addini("sdk-user-password", "cloud sdk user password")
|
||||
parser.addini("sdk-customer-id", "cloud sdk customer id for the access points")
|
||||
parser.addini("sdk-equipment-id", "cloud sdk equipment id for the access point")
|
||||
parser.addini("customer-id", "cloud sdk customer id for the access points")
|
||||
parser.addini("equipment-id", "cloud sdk equipment id for the access point")
|
||||
parser.addini("default-ap-profile", "cloud sdk default AP profile name")
|
||||
|
||||
parser.addini("verbose", "Enable verbose logs?")
|
||||
|
||||
parser.addini("ap-ip", "AP IP address (or can use serial)")
|
||||
parser.addini("ap-username", "AP username")
|
||||
parser.addini("ap-password", "AP password")
|
||||
parser.addini("ap-jumphost-address", "AP jumphost IP address")
|
||||
parser.addini("ap-jumphost-username", "AP jumphost username")
|
||||
parser.addini("ap-jumphost-password", "AP jumphost password")
|
||||
parser.addini("ap-jumphost-port", "AP jumphost port")
|
||||
parser.addini("ap-jumphost-wlan-testing", "AP jumphost wlan-testing code directory")
|
||||
parser.addini("ap-jumphost-tty", "AP jumphost TTY")
|
||||
|
||||
parser.addini("build-id", "What build flavor to use, ie 'pending'")
|
||||
parser.addini("testbed", "Testbed name")
|
||||
parser.addini("mode", "AP Mode, bridge/vlan/nat")
|
||||
parser.addini("skip-wpa", "Should we skip setting up WPA?")
|
||||
parser.addini("skip-wpa2", "Should we skip setting up WPA2?")
|
||||
parser.addini("skip-radius", "Should we skip setting up EAP/Radius?")
|
||||
parser.addini("skip-profiles", "Should we skip setting up profiles")
|
||||
|
||||
parser.addini("ssid-2g-wpa", "Configure ssid-2g-wpa")
|
||||
parser.addini("psk-2g-wpa", "Configure psk-2g-wpa")
|
||||
parser.addini("ssid-5g-wpa", "Configure ssid-5g-wpa")
|
||||
parser.addini("psk-5g-wpa", "Configure psk-5g-wpa")
|
||||
parser.addini("ssid-2g-wpa2", "Configure ssid-2g-wpa2")
|
||||
parser.addini("psk-2g-wpa2", "Configure psk-2g-wpa2")
|
||||
parser.addini("ssid-5g-wpa2", "Configure ssid-5g-wpa2")
|
||||
parser.addini("psk-5g-wpa2", "Configure psk-5g-wpa2")
|
||||
|
||||
parser.addini("testrail-base-url", "testrail base url")
|
||||
parser.addini("testrail-project", "testrail project name to use to generate test reports")
|
||||
parser.addini("testrail-user-id", "testrail username")
|
||||
@@ -43,127 +76,8 @@ def pytest_addoption(parser):
|
||||
parser.addini("lanforge-radio", "LANforge radio to use")
|
||||
parser.addini("lanforge-ethernet-port", "LANforge ethernet adapter to use")
|
||||
|
||||
parser.addoption(
|
||||
"--testrail-user-password",
|
||||
action="store",
|
||||
default="password",
|
||||
help="testrail user password",
|
||||
type=str
|
||||
)
|
||||
add_base_parse_args_pytest(parser)
|
||||
|
||||
parser.addoption(
|
||||
"--sdk-equipment-id",
|
||||
action="store",
|
||||
default="-1",
|
||||
help="SDK equipment ID for AP",
|
||||
type=str
|
||||
)
|
||||
|
||||
# # Cloud SDK
|
||||
# parser.addoption(
|
||||
# "--sdk-base-url",
|
||||
# action="store",
|
||||
# default="wlan-portal-svc.cicd.lab.wlan.tip.build",
|
||||
# help="cloudsdk base url",
|
||||
# type=str
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--sdk-user-id",
|
||||
# action="store",
|
||||
# default="support@example.com",
|
||||
# help="cloudsdk user id",
|
||||
# type=str
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--sdk-user-password",
|
||||
# action="store",
|
||||
# default="support",
|
||||
# help="cloudsdk user password",
|
||||
# type=str
|
||||
# )
|
||||
|
||||
# # jFrog
|
||||
# parser.addoption(
|
||||
# "--jfrog-base-url",
|
||||
# action="store",
|
||||
# default="tip.jFrog.io/artifactory/tip-wlan-ap-firmware",
|
||||
# help="jfrog base url",
|
||||
# type=str
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--jfrog-user-id",
|
||||
# action="store",
|
||||
# default="tip-read",
|
||||
# help="jfrog user id",
|
||||
# type=str
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--jfrog-user-password",
|
||||
# action="store",
|
||||
# default="tip-read",
|
||||
# help="jfrog user password",
|
||||
# type=str
|
||||
# )
|
||||
|
||||
# # testrail
|
||||
# parser.addoption(
|
||||
# "--testrail-base-url",
|
||||
# action="store",
|
||||
# default="telecominfraproject.testrail.com",
|
||||
# help="testrail base url",
|
||||
# type=str
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--testrail-project",
|
||||
# action="store",
|
||||
# default="opsfleet-wlan",
|
||||
# help="testrail project name",
|
||||
# type=str
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--testrail-user-id",
|
||||
# action="store",
|
||||
# default="gleb@opsfleet.com",
|
||||
# help="testrail user id",
|
||||
# type=str
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--testrail-user-password",
|
||||
# action="store",
|
||||
# default="password",
|
||||
# help="testrail user password",
|
||||
# type=str
|
||||
# )
|
||||
|
||||
# # lanforge
|
||||
# parser.addoption(
|
||||
# "--lanforge-ip-address",
|
||||
# action="store",
|
||||
# default="10.28.3.6",
|
||||
# help="ip address of the lanforge gui",
|
||||
# type=str
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--lanforge-port-number",
|
||||
# action="store",
|
||||
# default="8080",
|
||||
# help="port of the lanforge gui",
|
||||
# type=str
|
||||
# )
|
||||
|
||||
# change behaviour
|
||||
parser.addoption(
|
||||
"--skip-update-firmware",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="skip updating firmware on the AP (useful for local testing)"
|
||||
)
|
||||
parser.addoption(
|
||||
"--no-testrails",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="do not generate testrails tests"
|
||||
)
|
||||
# this has to be the last argument
|
||||
# example: --access-points ECW5410 EA8300-EU
|
||||
parser.addoption(
|
||||
@@ -182,9 +96,10 @@ def pytest_unconfigure(config):
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def setup_testrails(request, instantiate_testrail, access_points):
|
||||
if request.config.getoption("--no-testrails"):
|
||||
if request.config.getoption("--testrail-user-id") == "NONE":
|
||||
yield -1
|
||||
return # needed to stop fixture execution
|
||||
|
||||
if request.config.getoption("--skip-update-firmware"):
|
||||
firmware_update_case = []
|
||||
else:
|
||||
@@ -215,22 +130,73 @@ def setup_cloudsdk(request, instantiate_cloudsdk):
|
||||
print("Cloud SDK cleanup done")
|
||||
request.addfinalizer(fin)
|
||||
|
||||
# This is broken, see sdk_set_profile for correct way to do this.
|
||||
#instantiate_cloudsdk.set_ap_profile(3, 6)
|
||||
#yield {
|
||||
# "LANforge": {
|
||||
# "host": request.config.getini("lanforge-ip-address"),
|
||||
# "port": request.config.getini("lanforge-port-number"),
|
||||
# "radio": request.config.getini("lanforge-radio"),
|
||||
# "eth_port": request.config.getini("lanforge-ethernet-port"),
|
||||
# "runtime_duration": 15
|
||||
# },
|
||||
# "24ghz": {
|
||||
# "ssid": "TipWlan-cloud-wifi",
|
||||
# "password": "w1r3l3ss-fr33d0m",
|
||||
# "station_names": [ "sta2237" ]
|
||||
# }
|
||||
#}
|
||||
# Set up bridged setup by default.
|
||||
|
||||
command_line_args = create_command_line_args(request)
|
||||
|
||||
cloud = instantiate_cloudsdk
|
||||
|
||||
cloud.assert_bad_response = True
|
||||
|
||||
model_id = command_line_args.model
|
||||
equipment_id = instantiate_cloudsdk.equipment_id
|
||||
|
||||
print("equipment-id: %s" % (equipment_id))
|
||||
if equipment_id == "-1":
|
||||
print("ERROR: Could not find equipment-id.")
|
||||
sys.exit(1)
|
||||
|
||||
###Get Current AP info
|
||||
try:
|
||||
ap_cli_info = ssh_cli_active_fw(command_line_args)
|
||||
ap_cli_fw = ap_cli_info['active_fw']
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
logging.error(logging.traceback.format_exc())
|
||||
ap_cli_info = "ERROR"
|
||||
print("FAILED: Cannot Reach AP CLI.");
|
||||
sys.exit(1)
|
||||
|
||||
fw_model = ap_cli_fw.partition("-")[0]
|
||||
|
||||
print('Current Active AP FW from CLI:', ap_cli_fw)
|
||||
|
||||
radius_name = "%s-%s-%s" % (command_line_args.testbed, fw_model, "Radius")
|
||||
|
||||
print("Create profiles")
|
||||
ap_object = CreateAPProfiles(command_line_args, cloud=cloud, client=client, fw_model=fw_model)
|
||||
|
||||
# Logic to create AP Profiles (Bridge Mode)
|
||||
|
||||
ap_object.set_ssid_psk_data(ssid_2g_wpa=command_line_args.ssid_2g_wpa,
|
||||
ssid_5g_wpa=command_line_args.ssid_5g_wpa,
|
||||
psk_2g_wpa=command_line_args.psk_2g_wpa,
|
||||
psk_5g_wpa=command_line_args.psk_5g_wpa,
|
||||
ssid_2g_wpa2=command_line_args.ssid_2g_wpa2,
|
||||
ssid_5g_wpa2=command_line_args.ssid_5g_wpa2,
|
||||
psk_2g_wpa2=command_line_args.psk_2g_wpa2,
|
||||
psk_5g_wpa2=command_line_args.psk_5g_wpa2)
|
||||
|
||||
print(ap_object)
|
||||
|
||||
print("creating Profiles")
|
||||
ssid_template = "TipWlan-Cloud-Wifi"
|
||||
|
||||
if not command_line_args.skip_profiles:
|
||||
if not command_line_args.skip_radius:
|
||||
# Radius Profile needs to be set here
|
||||
# obj.create_radius_profile(radius_name, rid, key)
|
||||
pass
|
||||
ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, skip_wpa=command_line_args.skip_wpa,
|
||||
skip_wpa2=command_line_args.skip_wpa2, mode=command_line_args.mode)
|
||||
|
||||
print("Create AP with equipment-id: ", equipment_id)
|
||||
ap_object.create_ap_profile(eq_id=equipment_id, fw_model=fw_model, mode=command_line_args.mode)
|
||||
ap_object.validate_changes(mode=command_line_args.mode)
|
||||
|
||||
print("Profiles Created")
|
||||
|
||||
yield ap_object
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def update_firmware(request, setup_testrails, instantiate_jFrog, instantiate_cloudsdk, access_points):
|
||||
@@ -254,11 +220,8 @@ def update_firmware(request, setup_testrails, instantiate_jFrog, instantiate_clo
|
||||
jfrog_user = instantiate_jFrog.get_user()
|
||||
jfrog_pwd = instantiate_jFrog.get_passwd()
|
||||
testrail_rid = 0
|
||||
customer_id = request.config.getini("sdk-customer-id")
|
||||
equipment_id = request.config.getoption("--sdk-equipment-id")
|
||||
if equipment_id == "-1":
|
||||
print("EQ ID invalid: ", equipment_id)
|
||||
sys.exit(1)
|
||||
customer_id = request.config.getoption("--customer-id")
|
||||
equipment_id = instantiate_cloudsdk.equipment_id
|
||||
pf = instantiate_cloudsdk.do_upgrade_ap_fw(request.config, report_data, test_cases, testrail_client,
|
||||
latest_image, cloudModel, ap, jfrog_user, jfrog_pwd, testrail_rid,
|
||||
customer_id, equipment_id, logger)
|
||||
@@ -267,13 +230,35 @@ def update_firmware(request, setup_testrails, instantiate_jFrog, instantiate_clo
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def instantiate_cloudsdk(request):
|
||||
yield CloudSDK(
|
||||
rv = CloudSDK(
|
||||
request.config.getini("sdk-user-id"),
|
||||
request.config.getini("sdk-user-password"),
|
||||
request.config.getini("sdk-base-url"),
|
||||
False # verbose TODO: Make this configurable
|
||||
)
|
||||
|
||||
equipment_id = request.config.getoption("--equipment-id")
|
||||
if equipment_id == "-1":
|
||||
eq_id = ap_ssh_ovsh_nodec(create_command_line_args(request), 'id')
|
||||
print("EQ Id: %s" % (eq_id))
|
||||
|
||||
# Now, query equipment to find something that matches.
|
||||
eq = rv.get_customer_equipment(customer_id)
|
||||
for item in eq:
|
||||
for e in item['items']:
|
||||
print(e['id'], " ", e['inventoryId'])
|
||||
if e['inventoryId'].endswith("_%s" % (eq_id)):
|
||||
print("Found equipment ID: %s inventoryId: %s" % (e['id'], e['inventoryId']))
|
||||
equipment_id = str(e['id'])
|
||||
|
||||
rv.equipment_id = equipment_id
|
||||
|
||||
if equipment_id == "-1":
|
||||
print("EQ ID invalid: ", equipment_id)
|
||||
sys.exit(1)
|
||||
|
||||
yield rv
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def instantiate_testrail(request):
|
||||
yield TestRail_Client(
|
||||
|
||||
@@ -1,114 +1,7 @@
|
||||
import re
|
||||
import requests
|
||||
import json
|
||||
|
||||
# Class to interact with Testrail
|
||||
class TestRail_Client:
|
||||
def __init__(self, url, user, password):
|
||||
self.user = user
|
||||
self.password = password
|
||||
self.__url = f"https://{url}/index.php?/api/v2/"
|
||||
|
||||
def send_get(self, uri, filepath=None):
|
||||
"""Issue a GET request (read) against the API.
|
||||
|
||||
Args:
|
||||
uri: The API method to call including parameters, e.g. get_case/1.
|
||||
filepath: The path and file name for attachment download; used only
|
||||
for "get_attachment/:attachment_id".
|
||||
|
||||
Returns:
|
||||
A dict containing the result of the request.
|
||||
"""
|
||||
return self.__send_request("GET", uri, filepath)
|
||||
|
||||
def send_post(self, uri, data):
|
||||
"""Issue a POST request (write) against the API.
|
||||
|
||||
Args:
|
||||
uri: The API method to call, including parameters, e.g. add_case/1.
|
||||
data: The data to submit as part of the request as a dict; strings
|
||||
must be UTF-8 encoded. If adding an attachment, must be the
|
||||
path to the file.
|
||||
|
||||
Returns:
|
||||
A dict containing the result of the request.
|
||||
"""
|
||||
return self.__send_request("POST", uri, data)
|
||||
|
||||
def __send_request(self, method, uri, data):
|
||||
url = self.__url + uri
|
||||
headers = {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
if method == "POST":
|
||||
if uri[:14] == "add_attachment": # add_attachment API method
|
||||
files = { "attachment": open(data, "rb") }
|
||||
response = requests.post(url, headers=headers, files=files, auth=(self.user, self.password))
|
||||
files["attachment"].close()
|
||||
else:
|
||||
payload = bytes(json.dumps(data), "utf-8")
|
||||
response = requests.post(url, headers=headers, data=payload, auth=(self.user, self.password))
|
||||
else:
|
||||
response = requests.get(url, headers=headers, auth=(self.user, self.password))
|
||||
|
||||
if response.status_code > 201:
|
||||
try:
|
||||
error = response.json()
|
||||
except: # response.content not formatted as JSON
|
||||
error = str(response.content)
|
||||
return
|
||||
else:
|
||||
if uri[:15] == "get_attachments": # Expecting file, not JSON
|
||||
try:
|
||||
logging.info (str(response.content))
|
||||
open(data, "wb").write(response.content)
|
||||
return (data)
|
||||
except:
|
||||
return ("Error saving attachment.")
|
||||
else:
|
||||
try:
|
||||
return response.json()
|
||||
except: # Nothing to return
|
||||
return {}
|
||||
|
||||
def get_project_id(self, project_name):
|
||||
"Get the project ID using project name"
|
||||
projects = self.send_get("get_projects")
|
||||
for project in projects:
|
||||
if project["name"] == project_name:
|
||||
return project["id"]
|
||||
|
||||
def update_testrail(self, case_id, run_id, status_id, msg):
|
||||
result = self.send_post(
|
||||
f"add_result_for_case/{run_id}/{case_id}",
|
||||
{ "status_id": status_id, "comment": msg }
|
||||
)
|
||||
|
||||
def create_testrun(self, name, case_ids, project_id):
|
||||
result = self.send_post(
|
||||
f"add_run/{project_id}",
|
||||
{"name": name, "case_ids": case_ids, "include_all": False}
|
||||
)
|
||||
return result["id"]
|
||||
|
||||
# Class for jFrog Interaction
|
||||
class jFrog_Client:
|
||||
def __init__(self, url, user, password):
|
||||
self.user = user
|
||||
self.password = password
|
||||
self.baseUrl = f"https://{url}"
|
||||
|
||||
def get_latest_image(self, model):
|
||||
# todo handle auth errors
|
||||
response = requests.get(f"{self.baseUrl}/{model}/dev/", auth=(self.user, self.password))
|
||||
return re.findall('href="(.+pending.+).tar.gz"', response.text)[-1]
|
||||
|
||||
def get_latest_image_url(self, model, latest_image):
|
||||
return f"https://{self.user}:{self.password}@{self.baseUrl}/{model}/dev/{latest_image}.tar.gz"
|
||||
|
||||
# Class for CloudSDK Interaction via RestAPI
|
||||
import argparse
|
||||
|
||||
# Map firmware directory name to cloud's model name.
|
||||
cloud_sdk_models = {
|
||||
@@ -119,78 +12,45 @@ cloud_sdk_models = {
|
||||
"wf188n": "WF188N"
|
||||
}
|
||||
|
||||
class CloudSDK_Client:
|
||||
def __init__(self, url, user, password):
|
||||
self.baseUrl = f"https://{url}"
|
||||
cloud_login_url = f"{self.baseUrl}/management/v1/oauth2/token"
|
||||
payload = {
|
||||
"userId": user,
|
||||
"password": password
|
||||
}
|
||||
headers = {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
try:
|
||||
token_response = requests.post(cloud_login_url, headers=headers, data=json.dumps(payload))
|
||||
except requests.exceptions.RequestException as e:
|
||||
raise SystemExit(f"Exiting Script! Cloud not get bearer token for reason: {e}")
|
||||
token_data = token_response.json()
|
||||
self.headers = {
|
||||
"Authorization": f"Bearer {token_data['access_token']}"
|
||||
}
|
||||
# To better interoperate with libs that want to take a cmd-line-args thing vs
|
||||
# the pytest request config.
|
||||
def create_command_line_args(request):
|
||||
parser = argparse.ArgumentParser(description="Fake")
|
||||
command_line_args, unknown = parser.parse_known_args()
|
||||
|
||||
def ap_firmware(self, customer_id, equipment_id):
|
||||
equip_fw_url = f"{self.baseUrl}/portal/status/forEquipment?customerId={customer_id}&equipmentId={equipment_id}&statusDataTypes="
|
||||
status_response = requests.get(equip_fw_url, headers=self.headers)
|
||||
return (status_response.json())[2]["details"]["reportedSwVersion"]
|
||||
# And then overwrite it with whatever pytest is using (which is likely same in many cases)
|
||||
command_line_args.equipment_id = request.config.getoption("--equipment-id")
|
||||
command_line_args.customer_id = request.config.getoption("--customer-id")
|
||||
command_line_args.sdk_base_url = request.config.getoption("--sdk-base-url")
|
||||
command_line_args.sdk_user_id = request.config.getoption("--sdk-user-id")
|
||||
command_line_args.sdk_user_password = request.config.getoption("--sdk-user-password")
|
||||
command_line_args.default_ap_profile = request.config.getoption("--default-ap-profile")
|
||||
|
||||
def get_images(self, apModel):
|
||||
getFW_url = f"{self.baseUrl}/portal/firmware/version/byEquipmentType?equipmentType=AP&modelId={apModel}"
|
||||
status_response = requests.get(getFW_url, headers=self.headers)
|
||||
return([ version.get("versionName") for version in status_response.json()])
|
||||
command_line_args.verbose = request.config.getoption("--verbose")
|
||||
|
||||
def firwmare_upload(self, apModel, latest_image, fw_url):
|
||||
fw_upload_url = f"{self.baseUrl}/portal/firmware/version"
|
||||
payload = {
|
||||
"model_type": "FirmwareVersion",
|
||||
"id": 0,
|
||||
"equipmentType": "AP",
|
||||
"modelId": apModel,
|
||||
"versionName": latest_image,
|
||||
"description": "",
|
||||
"filename": fw_url,
|
||||
"commit": latest_image.split("-")[-1],
|
||||
"validationMethod": "MD5_CHECKSUM",
|
||||
"validationCode": "19494befa87eb6bb90a64fd515634263",
|
||||
"releaseDate": 1596192028877,
|
||||
"createdTimestamp": 0,
|
||||
"lastModifiedTimestamp": 0
|
||||
}
|
||||
self.headers["Content-Type"] = "application/json"
|
||||
response = requests.post(fw_upload_url, headers=self.headers, data=json.dumps(payload))
|
||||
self.headers.pop("Content-Type", None)
|
||||
return(response.json())
|
||||
command_line_args.ap_ip = request.config.getoption("--ap-ip")
|
||||
command_line_args.ap_username = request.config.getoption("--ap-username")
|
||||
command_line_args.ap_password = request.config.getoption("--ap-password")
|
||||
command_line_args.ap_jumphost_address = request.config.getoption("--ap-jumphost-address")
|
||||
command_line_args.ap_jumphost_username = request.config.getoption("--ap-jumphost-username")
|
||||
command_line_args.ap_jumphost_password = request.config.getoption("--ap-jumphost-password")
|
||||
command_line_args.ap_jumphost_port = request.config.getoption("--ap-jumphost-port")
|
||||
command_line_args.ap_jumphost_wlan_testing = request.config.getoption("--ap-jumphost-wlan-testing") # directory
|
||||
command_line_args.ap_jumphost_tty = request.config.getoption("--ap-jumphost-tty")
|
||||
|
||||
def get_firmware_id(self, image):
|
||||
fw_id_url = f"{self.baseUrl}/portal/firmware/version/byName?firmwareVersionName={image}"
|
||||
response = requests.get(fw_id_url, headers=self.headers)
|
||||
fw_data = response.json()
|
||||
return fw_data["id"]
|
||||
|
||||
def update_firmware(self, equipment_id, latest_firmware_id):
|
||||
url = f"{self.baseUrl}/portal/equipmentGateway/requestFirmwareUpdate?equipmentId={equipment_id}&firmwareVersionId={latest_firmware_id}"
|
||||
response = requests.post(url, headers=self.headers)
|
||||
|
||||
def set_ap_profile(self, equipment_id, test_profile_id):
|
||||
url = f"{self.baseUrl}/portal/equipment?equipmentId={equipment_id}"
|
||||
response = requests.get(url, headers=self.headers)
|
||||
|
||||
# Add Lab Profile ID to Equipment
|
||||
equipment_info = response.json()
|
||||
equipment_info["profileId"] = test_profile_id
|
||||
|
||||
# Update AP Info with Required Profile ID
|
||||
url = f"{self.baseUrl}/portal/equipment"
|
||||
self.headers["Content-Type"] = "application/json"
|
||||
response = requests.put(url, headers=self.headers, data=json.dumps(equipment_info))
|
||||
self.headers.pop("Content-Type", None)
|
||||
command_line_args.build_id = request.config.getoption("--build-id")
|
||||
command_line_args.testbed = request.config.getoption("--testbed")
|
||||
command_line_args.mode = request.config.getoption("--mode")
|
||||
command_line_args.skip_wpa = request.config.getoption("--skip-wpa")
|
||||
command_line_args.skip_wpa2 = request.config.getoption("--skip-wpa2")
|
||||
command_line_args.skip_radius = request.config.getoption("--skip-radius")
|
||||
command_line_args.skip_profiles = request.config.getoption("--skip-profiles")
|
||||
command_line_args.ssid_2g_wpa = request.config.getoption("--ssid-2g-wpa")
|
||||
command_line_args.ssid_5g_wpa = request.config.getoption("--ssid-5g-wpa")
|
||||
command_line_args.psk_2g_wpa = request.config.getoption("--psk-2g-wpa")
|
||||
command_line_args.psk_5g_wpa = request.config.getoption("--psk-5g-wpa")
|
||||
command_line_args.ssid_2g_wpa2 = request.config.getoption("--ssid-2g-wpa2")
|
||||
command_line_args.ssid_5g_wpa2 = request.config.getoption("--ssid-5g-wpa2")
|
||||
command_line_args.psk_2g_wpa2 = request.config.getoption("--psk-2g-wpa2")
|
||||
command_line_args.psk_5g_wpa2 = request.config.getoption("--psk-5g-wpa2")
|
||||
return command_line_args
|
||||
|
||||
@@ -20,9 +20,9 @@ lanforge-radio=wiphy4
|
||||
lanforge-ethernet-port=eth2
|
||||
|
||||
# Cloud SDK settings
|
||||
sdk-customer-id=2
|
||||
customer-id=2
|
||||
# equipment ID is unique for each AP, have to be told what to use or query it based on other info.
|
||||
sdk-equipment-id=-1
|
||||
equipment-id=-1
|
||||
|
||||
markers =
|
||||
featureA: marks tests as slow (deselect with '-m "not slow"')
|
||||
|
||||
@@ -136,7 +136,7 @@ if qtype == 'all' or qtype == 'equipment':
|
||||
# Get equipment info
|
||||
try:
|
||||
if cmd == "get":
|
||||
rv = base.cloud.get_customer_equipment(base.cloudSDK_url, base.bearer, base.customer_id)
|
||||
rv = base.cloud.get_customer_equipment(base.customer_id)
|
||||
print("Equipment for customer %s:"%(base.customer_id))
|
||||
#jobj = json.load(ssids)
|
||||
for e in rv:
|
||||
|
||||
@@ -94,8 +94,6 @@ def main():
|
||||
lanforge_ip = command_line_args.lanforge_ip_address
|
||||
lanforge_port = command_line_args.lanforge_port_number
|
||||
lanforge_prefix = command_line_args.lanforge_prefix
|
||||
lanforge_2g_radio = command_line_args.lanforge_2g_radio
|
||||
lanforge_5g_radio = command_line_args.lanforge_5g_radio
|
||||
|
||||
build = command_line_args.build_id
|
||||
|
||||
@@ -124,7 +122,7 @@ def main():
|
||||
print("EQ Id: %s" % (eq_id))
|
||||
|
||||
# Now, query equipment to find something that matches.
|
||||
eq = cloud.get_customer_equipment(cloudSDK_url, bearer, customer_id)
|
||||
eq = cloud.get_customer_equipment(customer_id)
|
||||
for item in eq:
|
||||
for e in item['items']:
|
||||
print(e['id'], " ", e['inventoryId'])
|
||||
|
||||
@@ -88,7 +88,7 @@ if equipment_id == "-1":
|
||||
print("EQ Id: %s"%(eq_id))
|
||||
|
||||
# Now, query equipment to find something that matches.
|
||||
eq = cloud.get_customer_equipment(cloudSDK_url, bearer, customer_id)
|
||||
eq = cloud.get_customer_equipment(customer_id)
|
||||
for item in eq:
|
||||
for e in item['items']:
|
||||
print(e['id'], " ", e['inventoryId'])
|
||||
|
||||
Reference in New Issue
Block a user