mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-10-31 19:08:01 +00:00
uci api test cases
Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
@@ -20,7 +20,7 @@ class ConfigureController:
|
||||
self.password = controller_data["password"]
|
||||
self.host = urlparse(controller_data["url"])
|
||||
self.access_token = ""
|
||||
self.login()
|
||||
self.login_resp = self.login()
|
||||
|
||||
def build_uri(self, path):
|
||||
new_uri = 'https://%s:%d/api/v1/%s' % (self.host.hostname, self.host.port, path)
|
||||
@@ -34,6 +34,7 @@ class ConfigureController:
|
||||
self.check_response("POST", resp, "", payload, uri)
|
||||
token = resp.json()
|
||||
self.access_token = token["access_token"]
|
||||
return resp
|
||||
|
||||
def logout(self):
|
||||
global access_token
|
||||
@@ -41,6 +42,7 @@ class ConfigureController:
|
||||
resp = requests.delete(uri, headers=self.make_headers(), verify=False)
|
||||
self.check_response("DELETE", resp, self.make_headers(), "", uri)
|
||||
print('Logged out:', resp.status_code)
|
||||
return resp
|
||||
|
||||
def make_headers(self):
|
||||
headers = {'Authorization': 'Bearer %s' % self.access_token}
|
||||
@@ -390,8 +392,8 @@ class UProfileUtility:
|
||||
# }
|
||||
#
|
||||
controller = {
|
||||
'url': "https://tip-f34.candelatech.com:16001/api/v1/oauth2", # API base url for the controller
|
||||
# 'url': 'https://restapi-ucentral-2.cicd.lab.wlan.tip.build/api/v1/oauth2',
|
||||
# 'url': "https://tip-f34.candelatech.com:16001/api/v1/oauth2", # API base url for the controller
|
||||
'url': 'https://sdk-ucentral-2.cicd.lab.wlan.tip.build:16001/api/v1/oauth2',
|
||||
'username': "tip@ucentral.com",
|
||||
'password': 'openwifi',
|
||||
# 'version': "1.1.0-SNAPSHOT",
|
||||
@@ -408,19 +410,19 @@ profile_data = {
|
||||
"radius": False
|
||||
}
|
||||
obj = UController(controller_data=controller)
|
||||
print(obj.get_devices())
|
||||
# print(obj.get_devices())
|
||||
# print(obj.get_device_uuid(serial_number="903cb3944873"))
|
||||
# obj.get_device_uuid(serial_number="c4411ef53f23")
|
||||
# obj.get_device_uuid(serial_number="c4411ef53f23")
|
||||
profile_client = UProfileUtility(sdk_client=obj)
|
||||
profile_client.set_radio_config()
|
||||
profile_client.set_mode(mode="VLAN")
|
||||
ssid_data = {"ssid_name": "ssid_wpa_test_3", "vlan": 200, "appliedRadios": ["2G", "5G"], "security_key": "something", "security": "none"}
|
||||
profile_client.add_ssid(ssid_data=ssid_data)
|
||||
print(profile_client.base_profile_config)
|
||||
profile_client.push_config(serial_number="c4411ef53f23")
|
||||
# profile_client = UProfileUtility(sdk_client=obj)
|
||||
# profile_client.set_radio_config()
|
||||
# profile_client.set_mode(mode="VLAN")
|
||||
# ssid_data = {"ssid_name": "ssid_wpa_test_3_vlan", "vlan": 100, "appliedRadios": ["2G", "5G"], "security_key": "something", "security": "none"}
|
||||
# profile_client.add_ssid(ssid_data=ssid_data)
|
||||
# print(profile_client.base_profile_config)
|
||||
# profile_client.push_config(serial_number="903cb3944873")
|
||||
# print(profile_client.base_profile_config)
|
||||
# equipments = obj.get_devices()
|
||||
# # print(equipments)
|
||||
# print(equipments)
|
||||
# for i in equipments:
|
||||
# for j in equipments[i]:
|
||||
# for k in j:
|
||||
|
||||
@@ -174,18 +174,18 @@ CONFIGURATION = {
|
||||
'mode': 'wifi5',
|
||||
'serial': 'c4411ef53f23',
|
||||
'jumphost': True,
|
||||
'ip': "192.168.100.164", # localhost
|
||||
'ip': "192.168.52.100", # localhost
|
||||
'username': "lanforge",
|
||||
'password': "lanforge",
|
||||
'port': 22, # 22,
|
||||
'jumphost_tty': '/dev/ttyUSB0',
|
||||
'jumphost_tty': '/dev/ttyAP1',
|
||||
'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/ecw5410/trunk/ecw5410-1.1.0.tar.gz"
|
||||
}
|
||||
],
|
||||
"traffic_generator": {
|
||||
"name": "lanforge",
|
||||
"details": {
|
||||
"ip": "192.168.100.209", # localhost,
|
||||
"ip": "192.168.52.100", # localhost,
|
||||
"port": 8080, # 8802,
|
||||
"ssh_port": 22,
|
||||
"2.4G-Radio": ["wiphy4"],
|
||||
|
||||
0
tests/controller_tests/ucentral_gateway/__init__.py
Normal file
0
tests/controller_tests/ucentral_gateway/__init__.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
|
||||
UCI Rest API Tests: Test Login, Logout API's
|
||||
|
||||
"""
|
||||
import pytest
|
||||
|
||||
|
||||
class TestUCIAUTHDEAUTH(object):
|
||||
"""
|
||||
pytest -m "uci_login or uci_logout" --ucentral
|
||||
"""
|
||||
|
||||
@pytest.mark.uci_login
|
||||
def test_uci_auth(self, setup_controller):
|
||||
"""
|
||||
pytest -m "uci_login" --ucentral
|
||||
"""
|
||||
print(setup_controller.login_resp)
|
||||
assert setup_controller.login_resp.status_code == 200
|
||||
|
||||
@pytest.mark.uci_logout
|
||||
def test_uci_deauth(self, setup_controller):
|
||||
"""
|
||||
pytest -m "uci_logout" --ucentral
|
||||
"""
|
||||
resp = setup_controller.logout()
|
||||
print(resp)
|
||||
assert resp.status_code == 200
|
||||
Reference in New Issue
Block a user