mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-10-30 18:38:06 +00:00
Merge pull request #266 from Telecominfraproject/WIFI-5434
WIFI-5434 : Contention on create device naming is removed, added the …
This commit is contained in:
@@ -3,6 +3,10 @@
|
|||||||
UCentral Gateway Services Rest API Tests
|
UCentral Gateway Services Rest API Tests
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import string
|
||||||
|
import random
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import json
|
import json
|
||||||
import allure
|
import allure
|
||||||
@@ -126,22 +130,26 @@ class TestUcentralGatewayService(object):
|
|||||||
print(devices)
|
print(devices)
|
||||||
|
|
||||||
@pytest.mark.sdk_restapi
|
@pytest.mark.sdk_restapi
|
||||||
def test_gwservice_createdevice(self, setup_controller):
|
def test_gwservice_createdevice(self, setup_controller, testbed):
|
||||||
"""
|
"""
|
||||||
Test the create device endpoint
|
Test the create device endpoint
|
||||||
WIFI-3453
|
WIFI-3453
|
||||||
"""
|
"""
|
||||||
|
device_mac = "02:00:00:%02x:%02x:%02x" % (random.randint(0, 255),
|
||||||
payload = {'serialNumber': 'deadbeef0011',
|
random.randint(0, 255),
|
||||||
|
random.randint(0, 255))
|
||||||
|
device_name = device_mac.replace(":", "")
|
||||||
|
# device_name = "deadbeef0011" + testbed.replace("-","")
|
||||||
|
payload = {'serialNumber': device_name,
|
||||||
'UUID': '123456',
|
'UUID': '123456',
|
||||||
'configuration': self.configuration,
|
'configuration': self.configuration,
|
||||||
'deviceType': 'AP',
|
'deviceType': 'AP',
|
||||||
'location': '',
|
'location': '',
|
||||||
'macAddress': 'DE:AD:BE:EF:00:11',
|
'macAddress': device_mac,
|
||||||
'manufacturer': 'Testing',
|
'manufacturer': 'Testing',
|
||||||
'owner': ''}
|
'owner': ''}
|
||||||
print(json.dumps(payload))
|
print(json.dumps(payload))
|
||||||
resp = setup_controller.request("gw", "device/deadbeef0011", "POST", None, json.dumps(payload))
|
resp = setup_controller.request("gw", "device/" + device_name, "POST", None, json.dumps(payload))
|
||||||
allure.attach(name="response: ", body=str(resp.json()))
|
allure.attach(name="response: ", body=str(resp.json()))
|
||||||
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
|
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
|
||||||
allure.attach(name="gw create devices", body=body)
|
allure.attach(name="gw create devices", body=body)
|
||||||
@@ -150,13 +158,13 @@ class TestUcentralGatewayService(object):
|
|||||||
devices = json.loads(resp.text)
|
devices = json.loads(resp.text)
|
||||||
print(devices)
|
print(devices)
|
||||||
|
|
||||||
resp = setup_controller.request("gw", "device/deadbeef0011", "GET", None, None)
|
resp = setup_controller.request("gw", "device/" + device_name, "GET", None, None)
|
||||||
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
|
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
|
||||||
allure.attach(name="gw create device verify", body=body)
|
allure.attach(name="gw create device verify", body=body)
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
resp = setup_controller.request("gw", "device/deadbeef0011", "DELETE", None, None)
|
resp = setup_controller.request("gw", "device/" + device_name, "DELETE", None, None)
|
||||||
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
|
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
|
||||||
allure.attach(name="gw create device delete", body=body)
|
allure.attach(name="gw create device delete", body=body)
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
|
|||||||
Reference in New Issue
Block a user