mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-03 04:18:15 +00:00
Wifi 7772 (#493)
* Added Entity library of Provision Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com> * Added Entity Library support Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com> * Added Entity Related testcases Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>
This commit is contained in:
@@ -344,6 +344,37 @@ class ProvUtils(ConfigureController):
|
||||
self.check_response("DELETE", resp, self.make_headers(), "", uri)
|
||||
return resp
|
||||
|
||||
def get_entity(self):
|
||||
uri = self.build_url_prov("entity")
|
||||
print(uri)
|
||||
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
|
||||
self.check_response("GET", resp, self.make_headers(), "", uri)
|
||||
return resp
|
||||
|
||||
def get_entity_by_id(self,entity_id):
|
||||
uri = self.build_url_prov("entity/" + entity_id)
|
||||
print(uri)
|
||||
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
|
||||
self.check_response("GET", resp, self.make_headers(), "", uri)
|
||||
return resp
|
||||
|
||||
def add_entity(self, payload):
|
||||
uri = self.build_url_prov("entity/1")
|
||||
print(uri)
|
||||
print(payload)
|
||||
payload = json.dumps(payload)
|
||||
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
|
||||
print(resp)
|
||||
self.check_response("POST", resp, self.make_headers(), payload, uri)
|
||||
return resp
|
||||
|
||||
def delete_entity(self, entity_id):
|
||||
uri = self.build_url_prov("entity/" + entity_id)
|
||||
print(uri)
|
||||
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=100)
|
||||
self.check_response("DELETE", resp, self.make_headers(), "", uri)
|
||||
return resp
|
||||
|
||||
class UProfileUtility:
|
||||
|
||||
def __init__(self, sdk_client=None, controller_data=None):
|
||||
|
||||
@@ -74,7 +74,7 @@ class TestUcentralProvisionService(object):
|
||||
if resp.status_code != 200:
|
||||
assert False
|
||||
|
||||
resp = setup_prov_controller.request("prov", "inventory/" + device_name, "DELETE", None, None)
|
||||
resp = setup_prov_controller.delete_device_from_inventory(device_name)
|
||||
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
|
||||
allure.attach(name="Prov created device-delete", body=body)
|
||||
if resp.status_code != 200:
|
||||
@@ -86,3 +86,45 @@ class TestUcentralProvisionService(object):
|
||||
print(system_info.json())
|
||||
allure.attach(name="system info", body=str(system_info.json()), attachment_type=allure.attachment_type.JSON)
|
||||
assert system_info.status_code == 200
|
||||
|
||||
@pytest.mark.prov_api_entity_test
|
||||
def test_prov_service_create_entity(self, setup_prov_controller, testbed):
|
||||
"""
|
||||
Test the create Entity in provision Inventory
|
||||
"""
|
||||
payload = {"name": "Testing_prov",
|
||||
"rrm": "inherit",
|
||||
"description": "For testing Purposes through Automation",
|
||||
"notes": [{"note": "For testing Purposes through Automation"}],
|
||||
"parent": "0000-0000-0000"
|
||||
}
|
||||
print(json.dumps(payload))
|
||||
resp = setup_prov_controller.add_entity(payload)
|
||||
allure.attach(name="response: ", body=str(resp.json()))
|
||||
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
|
||||
allure.attach(name="Prov create entity", body=body)
|
||||
if resp.status_code != 200:
|
||||
assert False
|
||||
entitiy = json.loads(resp.text)
|
||||
print(entitiy)
|
||||
entity_id = entitiy['id']
|
||||
|
||||
resp = setup_prov_controller.get_entity_by_id(entity_id)
|
||||
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
|
||||
allure.attach(name="Prov create device-verify", body=body)
|
||||
if resp.status_code != 200:
|
||||
assert False
|
||||
|
||||
resp = setup_prov_controller.delete_entity(entity_id)
|
||||
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
|
||||
allure.attach(name="Prov created device-delete", body=body)
|
||||
if resp.status_code != 200:
|
||||
assert False
|
||||
|
||||
@pytest.mark.prov_api_entity
|
||||
def test_get_entities(self, setup_prov_controller):
|
||||
resp = setup_prov_controller.get_entity()
|
||||
print(resp.json())
|
||||
allure.attach(name="Entities", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
|
||||
assert resp.status_code == 200
|
||||
|
||||
|
||||
Reference in New Issue
Block a user