Wifi 12467 (#832)

* Added 6 gateway service API test cases

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added more gw API's methods

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added 6 test cases

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added sleep

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added methods for gw radius proxy configuration and radius sessions API's

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added 2 test cases

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

* Added ow_sanity_lf marker only in sanity test cases

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>

---------

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
jitendracandela
2023-07-11 17:24:23 +05:30
committed by GitHub
parent 4d8b57c0b9
commit a249728715
2 changed files with 878 additions and 2 deletions

View File

@@ -191,7 +191,7 @@ class ConfigureController:
"Connection": "keep-alive",
"Content-Type": "application/json",
"Keep-Alive": "timeout=10, max=1000"
"conte"
"conte"
}
return headers
@@ -264,6 +264,24 @@ class Controller(ConfigureController):
version = resp.json()
return version['version']
def perform_system_wide_commands(self, payload):
uri = self.build_uri("system")
payload = json.dumps(payload)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
def get_sdk_version_fms(self):
uri = self.build_url_fms("system?command=info")
logging.info("Sending Command: " + "\n" +
@@ -788,6 +806,383 @@ class Controller(ConfigureController):
allure.attach.file(name="file", source="gopi.tar.gz", extension=".tar")
return resp
def get_lists_of_all_default_configurations(self):
uri = self.build_uri("default_configurations")
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
def get_list_of_OUIs(self, maclist):
uri = self.build_uri("ouis" + "?macList=" + maclist)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
def get_list_of_scripts(self):
uri = self.build_uri("scripts")
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
def get_list_of_blacklisted_devices(self):
uri = self.build_uri("blacklist")
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
def get_radius_proxy_configuration(self):
uri = self.build_uri("radiusProxyConfig")
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
def get_country_code_for_ip_address(self, iplist):
uri = self.build_uri("iptocountry" + "?iplist=" + iplist)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
def create_default_configuration(self, name, payload):
uri = self.build_uri("default_configuration/" + name)
payload = json.dumps(payload)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
def get_default_configuration(self, name):
uri = self.build_uri("default_configuration/" + name)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
def edit_default_configuration(self, name, payload):
uri = self.build_uri("default_configuration/" + name)
payload = json.dumps(payload)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.put(uri, data=payload, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("PUT", resp, self.make_headers(), payload, uri)
return resp
def delete_default_configuration(self, name):
uri = self.build_uri("default_configuration/" + name)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("DELETE", resp, self.make_headers(), "", uri)
return resp
def create_to_the_blacklist(self, serial_number, payload):
uri = self.build_uri("blacklist/" + serial_number)
payload = json.dumps(payload)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
def get_blacklist_entry(self, serial_number):
uri = self.build_uri("blacklist/" + serial_number)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
def modify_to_the_blacklist(self, serial_number, payload):
uri = self.build_uri("blacklist/" + serial_number)
payload = json.dumps(payload)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.put(uri, data=payload, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("PUT", resp, self.make_headers(), payload, uri)
return resp
def delete_from_blacklist(self, serial_number):
uri = self.build_uri("blacklist/" + serial_number)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("DELETE", resp, self.make_headers(), "", uri)
return resp
def debug_device(self, serial_number, payload):
uri = self.build_uri("device/" + serial_number + "/script")
payload = json.dumps(payload)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=120)
time.sleep(10)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
def delete_file(self, serial_number, uuid):
uri = self.build_uri("file/" + uuid + "?serialNumber=" + serial_number)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=120)
time.sleep(10)
self.check_response("DELETE", resp, self.make_headers(), "", uri)
return resp
def delete_some_commands(self, serial_number):
uri = self.build_uri("commands" + "?serialNumber=" + serial_number)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("DELETE", resp, self.make_headers(), "", uri)
return resp
def delete_some_device_logs(self, serial_number):
uri = self.build_uri("device/" + serial_number + "/logs")
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("DELETE", resp, self.make_headers(), "", uri)
return resp
def delete_some_device_health_checks(self, serial_number):
uri = self.build_uri("device/" + serial_number + "/healthchecks")
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("DELETE", resp, self.make_headers(), "", uri)
return resp
def delete_capabilities_device(self, serial_number):
uri = self.build_uri("device/" + serial_number + "/capabilities")
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("DELETE", resp, self.make_headers(), "", uri)
return resp
def delete_statistics_device(self, serial_number):
uri = self.build_uri("device/" + serial_number + "/statistics")
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("DELETE", resp, self.make_headers(), "", uri)
return resp
def delete_radius_proxy_configuration(self):
uri = self.build_uri("radiusProxyConfig")
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("DELETE", resp, self.make_headers(), "", uri)
return resp
def modify_radius_proxy_configuration(self, payload):
uri = self.build_uri("radiusProxyConfig")
payload = json.dumps(payload)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.put(uri, data=payload, headers=self.make_headers(), verify=False, timeout=120)
time.sleep(2)
self.check_response("PUT", resp, self.make_headers(), payload, uri)
return resp
def get_radius_proxy_configuration(self):
uri = self.build_uri("radiusProxyConfig")
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
def get_radius_sessions(self, serial_number):
uri = self.build_uri("radiusSessions/" + serial_number)
logging.info("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=120)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
class FMSUtils:

View File

@@ -15,7 +15,6 @@ import pytest
@pytest.mark.uc_sanity
@pytest.mark.ow_sdk_tests
@pytest.mark.ow_sanity_lf
@pytest.mark.ow_sdk_load_tests
@pytest.mark.owgw_api_tests
@allure.parent_suite("SDK Tests")
@@ -125,6 +124,7 @@ class TestUcentralGatewayService(object):
@allure.testcase(name="WIFI-11399",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11399")
@pytest.mark.get_all_devices
@pytest.mark.ow_sanity_lf
def test_gwservice_listdevices(self, get_target_object):
"""
Test the list of devices endpoint
@@ -140,6 +140,7 @@ class TestUcentralGatewayService(object):
@allure.testcase(name="WIFI-11399",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11399")
@pytest.mark.CRUD
@pytest.mark.ow_sanity_lf
def test_gwservice_create_read_edit_delete_device(self, get_target_object, selected_testbed):
"""
Test to create,read,edit and delete device endpoint
@@ -209,6 +210,7 @@ class TestUcentralGatewayService(object):
@allure.testcase(name="WIFI-11436",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11436")
@pytest.mark.OW_gateway_service
@pytest.mark.ow_sanity_lf
def test_system_info_gw(self, get_target_object):
"""
Test to verify OW gateway services
@@ -223,6 +225,7 @@ class TestUcentralGatewayService(object):
@allure.title("Get OW Gateway Commands")
@allure.testcase(name="WIFI-11437",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11437")
@pytest.mark.ow_sanity_lf
def test_gw_commands(self, get_target_object, get_testbed_details):
"""
Test to verify OW gateway commands executed
@@ -239,6 +242,7 @@ class TestUcentralGatewayService(object):
@allure.title("Get Device Logs")
@allure.testcase(name="WIFI-11438",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11438")
@pytest.mark.ow_sanity_lf
def test_gw_service_get_logs(self, get_target_object, get_testbed_details):
"""
Test the device logs present in Gateway UI
@@ -255,6 +259,7 @@ class TestUcentralGatewayService(object):
@allure.title("Get Health Checks")
@allure.testcase(name="WIFI-11439",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11439")
@pytest.mark.ow_sanity_lf
def test_gw_service_get_health_checks(self, get_target_object, get_testbed_details):
"""
Test the device health checks present in Gateway UI
@@ -270,6 +275,7 @@ class TestUcentralGatewayService(object):
@allure.title("Get Capabilities")
@allure.testcase(name="WIFI-11441",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11441")
@pytest.mark.ow_sanity_lf
def test_gw_service_get_capabilities(self, get_target_object, get_testbed_details):
"""
Test the device capabilities present in Gateway UI
@@ -286,6 +292,7 @@ class TestUcentralGatewayService(object):
@allure.title("Get Statistics")
@allure.testcase(name="WIFI-11442",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11442")
@pytest.mark.ow_sanity_lf
def test_gw_service_get_statistics(self, get_target_object, get_testbed_details):
"""
Test the device statistics present in Gateway UI
@@ -301,6 +308,7 @@ class TestUcentralGatewayService(object):
@allure.title("Get Device Status")
@allure.testcase(name="WIFI-11443",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11443")
@pytest.mark.ow_sanity_lf
def test_gw_service_get_status(self, get_target_object, get_testbed_details):
"""
Test the device status present in Gateway UI
@@ -316,6 +324,7 @@ class TestUcentralGatewayService(object):
@allure.title("Ping Device")
@allure.testcase(name="WIFI-11444",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11444")
@pytest.mark.ow_sanity_lf
def test_gw_service_ping_device(self, get_target_object, get_testbed_details):
"""
Test to Ping device present in Gateway UI
@@ -335,6 +344,7 @@ class TestUcentralGatewayService(object):
@allure.title("Blink LED API")
@allure.testcase(name="WIFI-11445",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11445")
@pytest.mark.ow_sanity_lf
def test_gw_service_led_blink_device(self, get_target_object, get_testbed_details):
"""
Test to Blink led on device present in Gateway UI
@@ -358,6 +368,7 @@ class TestUcentralGatewayService(object):
@allure.title("Trace Command")
@allure.testcase(name="WIFI-11446",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11446")
@pytest.mark.ow_sanity_lf
def test_gw_service_trace_device(self, get_target_object, get_testbed_details):
"""
Test to trace device present in Gateway UI
@@ -382,6 +393,7 @@ class TestUcentralGatewayService(object):
@allure.title("Wi-Fi Scan Device")
@allure.testcase(name="WIFI-11447",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11447")
@pytest.mark.ow_sanity_lf
def test_gw_service_wifi_scan_device(self, get_target_object, get_testbed_details):
"""
Test to Wi-Fi scan device present in Gateway UI
@@ -409,6 +421,7 @@ class TestUcentralGatewayService(object):
@allure.title("Request Message Device")
@allure.testcase(name="WIFI-11448",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11448")
@pytest.mark.ow_sanity_lf
def test_gw_service_request_msg_device(self, get_target_object, get_testbed_details):
"""
Test to Request specific msg from device present in Gateway UI
@@ -431,6 +444,7 @@ class TestUcentralGatewayService(object):
@allure.title("Get Event Queue of Device")
@allure.testcase(name="WIFI-11452",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11452")
@pytest.mark.ow_sanity_lf
def test_gw_service_event_queue_device(self, get_target_object, get_testbed_details):
"""
Test to Request Event Queue from device present in Gateway UI
@@ -454,6 +468,7 @@ class TestUcentralGatewayService(object):
@allure.title("Telemetry Device")
@allure.testcase(name="WIFI-11453",
url="https://telecominfraproject.atlassian.net/browse/WIFI-11453")
@pytest.mark.ow_sanity_lf
def test_gw_service_telemetry_device(self, get_target_object, get_testbed_details):
"""
Test to Request telemetry from device present in Gateway UI
@@ -481,6 +496,7 @@ class TestUcentralGatewayService(object):
@pytest.mark.ow_sdk_load_tests
@pytest.mark.owgw_api_tests
@allure.title("RTTY API")
@pytest.mark.ow_sanity_lf
def test_gw_service_get_rtty(self, get_target_object, get_testbed_details):
"""
Test the device rtty parameters in Gateway UI
@@ -494,6 +510,7 @@ class TestUcentralGatewayService(object):
@pytest.mark.gw_asb_non_restricted
@allure.title("Asb script on non restricted AP")
@allure.testcase(name="WIFI-12235", url="https://telecominfraproject.atlassian.net/browse/WIFI-12235")
@pytest.mark.ow_sanity_lf
def test_asb_on_non_restricted_ap(self, get_target_object, get_testbed_details):
device_name = get_testbed_details['device_under_tests'][0]['identifier']
payload = {
@@ -529,6 +546,7 @@ class TestUcentralGatewayService(object):
@pytest.mark.gw_asb_restricted
@allure.title("Asb script on restricted AP")
@allure.testcase(name="WIFI-12236", url="https://telecominfraproject.atlassian.net/browse/WIFI-12236")
@pytest.mark.ow_sanity_lf
def test_asb_on_restricted_ap(self, get_target_object, get_testbed_details):
device_name = get_testbed_details['device_under_tests'][0]['identifier']
payload = {
@@ -565,5 +583,468 @@ class TestUcentralGatewayService(object):
else:
logging.info("Removed Restrictions")
@pytest.mark.gw_list_of_OUIs
@allure.title("Get a list of OUIs")
@allure.testcase(name="WIFI-12554",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12554")
def test_gw_service_get_list_of_OUIs(self, get_target_object, get_testbed_details):
"""
Get a list of OUIs
Unique marker:pytest -m "gw_list_of_OUIs"
"""
device_name = get_testbed_details['device_under_tests'][0]['identifier']
mac_list = ':'.join(device_name[i:i + 2] for i in range(0, len(device_name), 2))
resp = get_target_object.controller_library_object.get_list_of_OUIs(maclist=mac_list)
assert resp.status_code == 200
@pytest.mark.gw_list_of_scripts
@allure.title("Get a list scripts")
@allure.testcase(name="WIFI-12555",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12555")
def test_gw_service_get_list_of_scripts(self, get_target_object, get_testbed_details):
"""
Get a list scripts
Unique marker:pytest -m "gw_list_of_scripts"
"""
resp = get_target_object.controller_library_object.get_list_of_scripts()
assert resp.status_code == 200
@pytest.mark.gw_delete_update_read_radius_proxy_configuration
@allure.title("Delete, Update, Read RADIUS Proxy configuration")
@allure.testcase(name="WIFI-12557",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12557")
def test_gw_service_delete_update_read_radius_proxy_configuration(self, get_target_object, get_testbed_details):
"""
Delete, Update, read RADIUS Proxy configuration
Unique marker:pytest -m "gw_delete_update_read_radius_proxy_configuration"
"""
# Delete RADIUS Proxy configuration
resp = get_target_object.controller_library_object.delete_radius_proxy_configuration()
assert resp.status_code == 200
# Modify RADIUS Proxy configuration
editing_payload = {
"pools": [
{
"acctConfig": {
"methodParameters": [],
"monitor": False,
"monitorMethod": "none",
"servers": [
{
"allowSelfSigned": False,
"certificate": "",
"ignore": False,
"ip": "10.10.1.221",
"name": "svr1",
"port": 1813,
"radsec": False,
"radsecCacerts": [],
"radsecCert": "",
"radsecKey": "",
"radsecPort": 2083,
"radsecRealms": [],
"radsecSecret": "",
"secret": "testing123",
"weight": 10
},
{
"allowSelfSigned": False,
"certificate": "",
"ignore": False,
"ip": "10.10.1.221",
"name": "svr2",
"port": 1813,
"radsec": False,
"radsecCacerts": [],
"radsecCert": "",
"radsecKey": "",
"radsecPort": 2083,
"radsecRealms": [],
"radsecSecret": "",
"secret": "testing123",
"weight": 20
}
],
"strategy": "random"
},
"authConfig": {
"methodParameters": [],
"monitor": False,
"monitorMethod": "none",
"servers": [
{
"allowSelfSigned": False,
"certificate": "",
"ignore": False,
"ip": "10.10.1.221",
"name": "svr1",
"port": 1812,
"radsec": False,
"radsecCacerts": [],
"radsecCert": "",
"radsecKey": "",
"radsecPort": 2083,
"radsecRealms": [],
"radsecSecret": "",
"secret": "testing123",
"weight": 10
},
{
"allowSelfSigned": False,
"certificate": "",
"ignore": False,
"ip": "10.10.1.221",
"name": "svr2",
"port": 1812,
"radsec": False,
"radsecCacerts": [],
"radsecCert": "",
"radsecKey": "",
"radsecPort": 2083,
"radsecRealms": [],
"radsecSecret": "",
"secret": "testing123",
"weight": 20
}
],
"strategy": "weighted"
},
"coaConfig": {
"methodParameters": [],
"monitor": False,
"monitorMethod": "none",
"servers": [
{
"allowSelfSigned": False,
"certificate": "",
"ignore": False,
"ip": "10.10.1.221",
"name": "svr1",
"port": 3799,
"radsec": False,
"radsecCacerts": [],
"radsecCert": "",
"radsecKey": "",
"radsecPort": 2083,
"radsecRealms": [],
"radsecSecret": "",
"secret": "testing123",
"weight": 10
},
{
"allowSelfSigned": False,
"certificate": "",
"ignore": False,
"ip": "10.10.1.221",
"name": "svr2",
"port": 3799,
"radsec": False,
"radsecCacerts": [],
"radsecCert": "",
"radsecKey": "",
"radsecPort": 2083,
"radsecRealms": [],
"radsecSecret": "",
"secret": "testing123",
"weight": 20
}
],
"strategy": "round_robin"
},
"description": "master pool",
"name": "master",
"useByDefault": True
}
]
}
resp = get_target_object.controller_library_object.modify_radius_proxy_configuration(editing_payload)
assert resp.status_code == 200
# Retrieve RADIUS Proxy configuration
resp = get_target_object.controller_library_object.get_radius_proxy_configuration()
assert resp.status_code == 200
@pytest.mark.gw_country_code_for_ip_address
@allure.title("Get the country code for an IP address")
@allure.testcase(name="WIFI-12558",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12558")
def test_gw_service_get_country_code_for_ip_address(self, get_target_object, get_testbed_details):
"""
Get the country code for an IP address
Unique marker:pytest -m "gw_country_code_for_ip_address"
"""
iplist = get_testbed_details['device_under_tests'][0]['host_ip']
print("iplist", iplist)
resp = get_target_object.controller_library_object.get_country_code_for_ip_address(iplist=iplist)
assert resp.status_code == 200
@pytest.mark.gw_lists_of_all_default_configurations
@allure.title("Get lists of all default configurations")
@allure.testcase(name="WIFI-12553",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12553")
def test_gw_service_get_lists_of_all_default_configurations(self, get_target_object, get_testbed_details):
"""
Retrieve the lists of all default configurations
Unique marker:pytest -m "gw_lists_of_all_default_configurations"
"""
resp = get_target_object.controller_library_object.get_lists_of_all_default_configurations()
assert resp.status_code == 200
@allure.title("CRUD a default configuration")
@allure.testcase(name="WIFI-12619",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12619")
@pytest.mark.gw_crud_default_configuration
def test_gw_service_create_read_edit_delete_default_configuration(self, get_target_object, get_testbed_details):
"""
Test to create,read,edit and delete default configuration
Unique marker: pytest -m "gw_crud_default_configuration"
"""
device_mac = "02:00:00:%02x:%02x:%02x" % (random.randint(0, 255),
random.randint(0, 255),
random.randint(0, 255))
device_name = device_mac.replace(":", "")
model = get_testbed_details['device_under_tests'][0]['model']
# device_name = "deadbeef0011" + testbed.replace("-","")
payload = {'name': device_name,
"modelIds": [model],
"description": "Testing through Automation",
'configuration': self.configuration,
"created": 0,
"lastModified": 0
}
resp = get_target_object.controller_library_object.create_default_configuration(device_name, payload)
if resp.status_code != 200:
assert False
resp = get_target_object.controller_library_object.get_default_configuration(device_name)
if resp.status_code != 200:
assert False
editing_payload = {
"description": "edit_default_configuration"
}
# print(json.dumps(editing_payload))
resp = get_target_object.controller_library_object.edit_default_configuration(device_name, editing_payload)
if resp.status_code != 200:
assert False
resp = get_target_object.controller_library_object.delete_default_configuration(device_name)
if resp.status_code != 200:
assert False
@pytest.mark.gw_list_of_blacklisted_devices
@allure.title("Get list blacklisted devices")
@allure.testcase(name="WIFI-12556",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12556")
def test_gw_service_get_list_of_blacklisted_devices(self, get_target_object, get_testbed_details):
"""
Get a list blacklisted devices
Unique marker:pytest -m "gw_list_of_blacklisted_devices"
"""
resp = get_target_object.controller_library_object.get_list_of_blacklisted_devices()
assert resp.status_code == 200
@allure.title("CRUD a blacklist entry")
@allure.testcase(name="WIFI-12620",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12620")
@pytest.mark.gw_crud_blacklist_entry
def test_gw_service_create_read_edit_delete_blacklist_entry(self, get_target_object, get_testbed_details):
"""
Test to create,read,edit and delete blacklist entry
Unique marker: pytest -m "gw_crud_blacklist_entry"
"""
device_mac = "02:00:00:%02x:%02x:%02x" % (random.randint(0, 255),
random.randint(0, 255),
random.randint(0, 255))
device_name = device_mac.replace(":", "")
# Adding dummy ap
payload = {'serialNumber': device_name,
'UUID': '123456',
'configuration': self.configuration,
'deviceType': 'AP',
'location': '',
'macAddress': device_mac,
'manufacturer': 'Testing through Automation',
'owner': ''}
resp = get_target_object.controller_library_object.add_device_to_gw(device_name, payload)
if resp.status_code != 200:
assert False
# Testing blacklist
payload_blacklist = {'serialNumber': device_name,
'reason': 'Testing through Automation'
}
resp = get_target_object.controller_library_object.create_to_the_blacklist(device_name, payload_blacklist)
if resp.status_code != 200:
assert False
resp = get_target_object.controller_library_object.get_blacklist_entry(device_name)
if resp.status_code != 200:
assert False
editing_payload = {
"reason": "edit blacklist entry"
}
resp = get_target_object.controller_library_object.modify_to_the_blacklist(device_name, editing_payload)
if resp.status_code != 200:
assert False
resp = get_target_object.controller_library_object.delete_from_blacklist(device_name)
if resp.status_code != 200:
assert False
# deleting dummy ap
resp = get_target_object.controller_library_object.delete_device_from_gw(device_name)
if resp.status_code != 200:
assert False
@pytest.mark.gw_debug_device
@allure.title("Debug a device")
@allure.testcase(name="WIFI-12628",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12628")
def test_gw_service_debug_device(self, get_target_object, get_testbed_details):
"""
Get a file from the upload directory
Unique marker: pytest -m "gw_debug_device"
"""
device_name = get_testbed_details['device_under_tests'][0]['identifier']
# Running one script
payload = {
"serialNumber": device_name,
"timeout": 30,
"type": "diagnostic",
"script": "",
"scriptId": "",
"when": 0,
"signature": "",
"deferred": True,
"uri": ""
}
resp = get_target_object.controller_library_object.debug_device(device_name, payload)
if resp.status_code != 200:
assert False
@pytest.mark.gw_get_delete_files
@allure.title("Get and Delete file from the upload directory")
@allure.testcase(name="WIFI-12629",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12629")
def test_gw_service_get_delete_files(self, get_target_object, get_testbed_details):
"""
Get and Delete file from the upload directory
Unique marker: pytest -m "gw_get_delete_files"
"""
device_name = get_testbed_details['device_under_tests'][0]['identifier']
# Running one script
payload = {
"serialNumber": device_name,
"timeout": 30,
"type": "diagnostic",
"script": "",
"scriptId": "",
"when": 0,
"signature": "",
"deferred": True,
"uri": ""
}
# Running diagnostic script for uuid
resp = get_target_object.controller_library_object.debug_device(device_name, payload)
if resp.status_code != 200:
assert False
resp = resp.json()
uuid = resp['UUID']
# get file
resp = get_target_object.controller_library_object.get_file(device_name, uuid)
if resp.status_code != 200:
assert False
# Delete file
resp = get_target_object.controller_library_object.delete_file(device_name, uuid)
if resp.status_code != 200:
assert False
@pytest.mark.gw_system
@allure.title("Perform some system wide commands")
@allure.testcase(name="WIFI-12627",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12627")
def test_gw_service_gw_system(self, get_target_object, get_testbed_details):
"""
Perform some system wide commands
Unique marker:pytest -m "gw_system"
"""
payload = {
"command": "setloglevel",
"subsystems": [
{
"tag": "",
"value": ""
}
]
}
resp = get_target_object.controller_library_object.perform_system_wide_commands(payload)
if resp.status_code != 200:
assert False
@allure.title("Delete commands, device logs, health checks, capabilities and statistics")
@allure.testcase(name="WIFI-12626",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12626")
@pytest.mark.gw_delete_commands_logs_healthchecks_capabilities_statistics
def test_gw_service_delete_commands_logs_healthchecks_capabilities_statistics(self, get_target_object,
get_testbed_details):
"""
Delete commands, device logs, health checks, capabilities and statistics
Unique marker: pytest -m "gw_delete_commands_logs_healthchecks_capabilities_statistics"
"""
device_mac = "02:00:00:%02x:%02x:%02x" % (random.randint(0, 255),
random.randint(0, 255),
random.randint(0, 255))
device_name = device_mac.replace(":", "")
# Adding dummy ap
payload = {'serialNumber': device_name,
'UUID': '123456',
'configuration': self.configuration,
'deviceType': 'AP',
'location': '',
'macAddress': device_mac,
'manufacturer': 'Testing through Automation',
'owner': ''}
resp = get_target_object.controller_library_object.add_device_to_gw(device_name, payload)
if resp.status_code != 200:
assert False
# Deleting Delete some commands
resp = get_target_object.controller_library_object.delete_some_commands(device_name)
if resp.status_code != 200:
assert False
# Delete some device logs
resp = get_target_object.controller_library_object.delete_some_device_logs(device_name)
if resp.status_code != 200:
assert False
# Delete some device health checks
resp = get_target_object.controller_library_object.delete_some_device_health_checks(device_name)
if resp.status_code != 200:
assert False
# Delete the capabilities for a given device
resp = get_target_object.controller_library_object.delete_capabilities_device(device_name)
if resp.status_code != 200:
assert False
# Get the latest statistics for a given device
resp = get_target_object.controller_library_object.delete_statistics_device(device_name)
if resp.status_code != 200:
assert False
# Deleting dummy ap
resp = get_target_object.controller_library_object.delete_device_from_gw(device_name)
if resp.status_code != 200:
assert False
@pytest.mark.gw_get_radius_sessions
@allure.title("Get RADIUS sessions for a given AP")
@allure.testcase(name="WIFI-12642",
url="https://telecominfraproject.atlassian.net/browse/WIFI-12642")
def test_gw_service_get_radius_sessions(self, get_target_object, get_testbed_details):
"""
Get RADIUS sessions for a given AP
Unique marker:pytest -m "gw_get_radius_sessions"
"""
device_name = get_testbed_details['device_under_tests'][0]['identifier']
resp = get_target_object.controller_library_object.get_radius_sessions(device_name)
assert resp.status_code == 200