WIFI-5434 : mac and serial number missmatch exception fix for device create

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-11-04 01:04:43 +05:30
parent e91fc2633d
commit 10a77781e2

View File

@@ -3,6 +3,10 @@
UCentral Gateway Services Rest API Tests
"""
import string
import random
import pytest
import json
import allure
@@ -131,17 +135,21 @@ class TestUcentralGatewayService(object):
Test the create device endpoint
WIFI-3453
"""
payload = {'serialNumber': 'deadbeef0011',
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(":", "")
# device_name = "deadbeef0011" + testbed.replace("-","")
payload = {'serialNumber': device_name,
'UUID': '123456',
'configuration': self.configuration,
'deviceType': 'AP',
'location': '',
'macAddress': 'DE:AD:BE:EF:00:11',
'macAddress': device_mac,
'manufacturer': 'Testing',
'owner': ''}
print(json.dumps(payload))
resp = setup_controller.request("gw", "device/deadbeef0011" + testbed, "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()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="gw create devices", body=body)
@@ -150,13 +158,13 @@ class TestUcentralGatewayService(object):
devices = json.loads(resp.text)
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
allure.attach(name="gw create device verify", body=body)
if resp.status_code != 200:
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
allure.attach(name="gw create device delete", body=body)
if resp.status_code != 200: