def test_post_cs_instances_nsinstanceid_instantiate(
        post_cs_instances_nsinstanceid_instantiate_keys):
    """Tests API call to instantiate an NS"""
    sonata_pishahang = SONATAClient.Pishahang(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)

    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _cosd_list = json.loads(
        sonata_pishahang.get_cosd_descriptors(
            token=_token["token"]["access_token"]))
    _cosd_list = json.loads(_cosd_list["data"])

    _ns = None
    for _n in _cosd_list:
        if "scramble-cosd" == _n['cosd']['name']:
            _ns = _n['uuid']

    print(_ns)
    if _ns:
        response = json.loads(
            sonata_pishahang.post_cs_instances_nsinstanceid_instantiate(
                token=_token["token"]["access_token"], nsInstanceId=_ns))

        print(response)
        assert response['error'] == False
        response = json.loads(response["data"])
        assert isinstance(response, dict)
        assert set(post_cs_instances_nsinstanceid_instantiate_keys).issubset(
            response.keys()), "All keys should be in the response"
    else:
        return False
Beispiel #2
0
def test_put_ns_descriptors_nsdinfoid():
    sonata_nsd = SONATAClient.Nsd(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    Helpers._upload_test_nsd(_token=_token["token"]["access_token"])

    _nsd_list = json.loads(
        sonata_nsd.get_ns_descriptors(token=_token["token"]["access_token"]))
    _nsd_list = json.loads(_nsd_list["data"])

    _nsd = None
    for _n in _nsd_list:
        if "sonata-demo" == _n['nsd']['name']:
            _nsd = _n['uuid']

    response = json.loads(
        sonata_nsd.put_ns_descriptors_nsdinfoid(
            token=_token["token"]["access_token"],
            data_path="tests/samples/Sonata/sonata_simple_nsd.json",
            nsdinfoid=_nsd))

    Helpers._delete_test_nsd("sonata-demo")
    if response["error"]:
        return True
    else:
        return False
def sonata_cleanup():
    sonata_nsd = SONATAClient.Nsd(HOST_URL)
    sonata_pishahang = SONATAClient.Pishahang(HOST_URL)
    sonata_nslcm = SONATAClient.Nslcm(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    sonata_vnfpkgm = SONATAClient.VnfPkgm(HOST_URL)

    print("Sonata NSD/VNFD Cleanup")

    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _csd_list = json.loads(
        sonata_pishahang.get_csd_descriptors(
            token=_token,
            limit=1000,
        ))
    _csd_list = json.loads(_csd_list["data"])

    print(len(_csd_list))
    for _csd in _csd_list:
        sonata_pishahang.delete_csd_descriptors_csdpkgid(token=_token,
                                                         csdpkgid=_csd['uuid'])

    _cosd_list = json.loads(
        sonata_pishahang.get_cosd_descriptors(token=_token, limit=1000))
    _cosd_list = json.loads(_cosd_list["data"])

    print(len(_cosd_list))
    for _cosd in _cosd_list:
        sonata_pishahang.delete_cosd_descriptors_cosdpkgid(
            token=_token, cosdpkgid=_cosd['uuid'])
Beispiel #4
0
def test_put_vnf_packages_vnfpkgid():
    """Tests API call to update NS descriptor resources"""
    sonata_vnfpkgm = SONATAClient.VnfPkgm(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _vnfd_list = json.loads(
        sonata_vnfpkgm.get_vnf_packages(token=_token["token"]["access_token"]))
    _vnfd_list = json.loads(_vnfd_list["data"])

    _vnfd = None
    for _v in _vnfd_list:
        if "vnfd_example" == _v['uuid']:
            _vnfd = _v['uuid']

    response = json.loads(
        sonata_vnfpkgm.put_vnf_packages_vnfpkgid(
            token=_token["token"]["access_token"],
            data_path="tests/samples/Sonata/sonata_simple_vnfd.json",
            vnfPkgId=_vnfd))
    print(response)
    Helpers._delete_test_vnf("vnfd_example")
    if response["error"]:
        return True
    else:
        return False
def test_put_son_packages_PackageId():
    sonata_package = SONATAClient.Package(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    Helpers._upload_test_package(_token=_token["token"]["access_token"])

    _package_list = json.loads(
        sonata_package.get_son_packages(token=_token["token"]["access_token"]))
    _package_list = json.loads(_package_list["data"])

    _package = None
    for _p in _package_list:
        if "sonata_example.son" == _p['grid_fs_name']:
            _package = _p['uuid']

    response = json.loads(
        sonata_package.put_son_packages_PackageId(
            token=_token["token"]["access_token"],
            data_path="tests/samples/Sonata/sonata_simple_package.json",
            id=_package))

    Helpers._delete_test_package("sonata_example.son")
    if response["error"]:
        return True
    else:
        return False
def test_post_ns_instances_nsinstanceid_instantiate(
        post_ns_instances_nsinstanceid_instantiate_keys):
    """Tests API call to instantiate an NS"""
    sonata_nslcm = SONATAClient.Nslcm(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    sonata_nsd = SONATAClient.Nsd(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _nsd_list = json.loads(
        sonata_nsd.get_ns_descriptors(token=_token["token"]["access_token"]))
    _nsd_list = json.loads(_nsd_list["data"])

    _ns = None
    for _n in _nsd_list:
        if "A dummy Example." == _n['nsd']['description']:
            _ns = _n['uuid']

    if _ns:
        response = json.loads(
            sonata_nslcm.post_ns_instances_nsinstanceid_instantiate(
                token=_token["token"]["access_token"], nsInstanceId=_ns))

        assert response['error'] == False
        response = json.loads(response["data"])
        assert isinstance(response, dict)
        assert set(post_ns_instances_nsinstanceid_instantiate_keys).issubset(
            response.keys()), "All keys should be in the response"
    else:
        return False
def test_get_ns_instances_nsinstanceid(
        test_get_ns_instances_nsinstanceid_keys):
    """Tests API call to read an individual NS instance resource"""
    sonata_nslcm = SONATAClient.Nslcm(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    sonata_nsd = SONATAClient.Nsd(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _nsd_list = json.loads(
        sonata_nsd.get_ns_descriptors(token=_token["token"]["access_token"]))
    _nsd_list = json.loads(_nsd_list["data"])

    _ns_list = json.loads(
        sonata_nslcm.get_ns_instances(token=_token["token"]["access_token"]))
    _ns_list = json.loads(_ns_list["data"])

    _ns = None
    for _n in _nsd_list:
        if "A dummy Example." == _n['nsd']['description']:
            for _n2 in _ns_list:
                if _n['uuid'] == _n2['descriptor_reference']:
                    _ns = _n2['uuid']

    response = json.loads(
        sonata_nslcm.get_ns_instances_nsinstanceid(
            token=_token["token"]["access_token"], nsInstanceId=_ns))

    print(response)
    assert response['error'] == False
    response = json.loads(response["data"])
    assert isinstance(response, dict)
    assert set(test_get_ns_instances_nsinstanceid_keys).issubset(
        response.keys()), "All keys should be in the response"
def get_individual_times(individual_init_times, folder_path, init_time, _ns_list):
    time.sleep(10)
    try:
        v1 = client.CoreV1Api(aApiClient)
        print("Listing pods with their IPs:")
        _servers = v1.list_namespaced_pod(namespace='default', watch=False)

        sonata_nslcm = SONATAClient.Nslcm(HOST_URL) 
        sonata_auth = SONATAClient.Auth(HOST_URL)

        _token = json.loads(sonata_auth.auth(
                        username=USERNAME,
                        password=PASSWORD))
        _token = json.loads(_token["data"])

        _individual_init_times = {}
        for _i, _v in individual_init_times.items():
            # service_instance_uuid
            request = json.loads(sonata_nslcm.get_ns_instances_request_status(
                                token=_token["token"]["access_token"], nsInstanceId=_i))
            request = json.loads(request["data"])

            print(request)
            _individual_init_times[request['service_instance_uuid']] = _v
            time.sleep(1)

        with open('./{nit}/individual-build-times.csv'.format(nit=nit), 'w') as _file:
            _file.write("id,mano_time,ns_mano_time,vim_time\n")
            _id = 0
            for _s in _servers.items:

                # ns_init_time = next((item for item in _ns_list if item["short-name"] == "{}-{}".format(_s.name.split("-")[0], _s.name.split("-")[1])), False)
                # if not ns_init_time:
                #     ns_init_time = 0
                # else:
                #     ns_init_time = ns_init_time['crete-time']
                # print(_s.status.container_statuses)

                server_created = _s.metadata.creation_timestamp
                launch_time = _s.status.container_statuses[0].state.running.started_at

                if int(server_created.strftime("%s")) >= int(init_time):
                    # print(server_created.strftime("%s"), nsname, individual_init_times[int(_s.name.split("-")[1])])
                    _mano_time = float(server_created.strftime("%s")) - float(_individual_init_times[_s.metadata.labels['service']])
                    ns_mano_time = float(server_created.strftime("%s")) - float(_individual_init_times[_s.metadata.labels['service']])
                    # ns_mano_time = float(server_created.strftime("%s")) - float(ns_init_time)
                    _vim_time = float(launch_time.strftime("%s")) - float(server_created.strftime("%s"))

                    print("{},{},{},{}\n".format(_id, _mano_time, ns_mano_time, _vim_time))
                    _file.write("{},{},{},{}\n".format(_id, _mano_time, ns_mano_time, _vim_time))
                    _id += 1
    
    except Exception as e:
        print(e)
        print("get_individual_times")    
Beispiel #9
0
def test_auth(auth_keys):
	"""Tests API call to fetch Auth token"""
	sonata_auth = SONATAClient.Auth(HOST_URL)
	response = json.loads(sonata_auth.auth(
							username=USERNAME,
							password=PASSWORD))
	response = json.loads(response["data"])

	assert isinstance(response, dict)
	assert set(auth_keys).issubset(
				response.keys()), "All keys should be in the response"
def test_get_packages(get_packages_keys):
    sonata_admin = SONATAClient.Admin(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    response = json.loads(sonata_admin.get_packages(token=_token["token"]["access_token"]))
    response = json.loads(response["data"])
    
    assert isinstance(response, list)
    if len(response) > 0:
         assert set(get_packages_keys).issubset(
                    response[0].keys()), "All keys should be in the response"
def test_get_ns_records(get_ns_records_keys):
    time.sleep(2) #Wait 
    sonata_admin = SONATAClient.Admin(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    response = json.loads(sonata_admin.get_ns_records(token=_token["token"]["access_token"]))
    
    
    if response["error"]:
            return True
    else:
            return False 
def test_post_son_packages(post_son_packages_keys):
    sonata_package = SONATAClient.Package(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    Helpers._delete_test_package(_token=_token["token"]["access_token"])

    response = json.loads(
        sonata_package.post_son_packages(
            token=_token["token"]["access_token"],
            package_path="tests/samples/sonata_example.son"))

    assert response['error'] == True
    assert response['data'] == ''
def test_get_vnf_instances(get_vnf_instances_keys):
    """Tests API call query multiple VNF instances"""
    sonata_nslcm = SONATAClient.Nslcm(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    response = json.loads(sonata_nslcm.get_vnf_instances(
                            token=_token["token"]["access_token"], limit=1000))
    response = json.loads(response["data"])

    assert isinstance(response, list)
    if len(response) > 0:
         assert set(get_vnf_instances_keys).issubset(
                    response[0].keys()), "All keys should be in the response"
def test_get_son_packages(get_son_packages_keys):
    """Tests API call to fetch multiple sonata packages"""
    sonata_package = SONATAClient.Package(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    response = json.loads(
        sonata_package.get_son_packages(token=_token["token"]["access_token"]))
    response = json.loads(response["data"])

    assert isinstance(response, list)
    if len(response) > 0:
        assert set(get_son_packages_keys).issubset(
            response[0].keys()), "All keys should be in the response"
def test_get_ns_instances_request_status(get_ns_instances_request_status_keys):
    """Tests API call query multiple NS instances"""
    sonata_nslcm = SONATAClient.Nslcm(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    response = json.loads(sonata_nslcm.get_ns_instances_request_status(
                            token=_token["token"]["access_token"],
                            nsInstanceId="3f2a59c5-b1d2-4a56-a6ad-21f7a402bc77",
                            limit=1000))
    response = json.loads(response["data"])
    print(len(response))
    print(response)
    # print(response[0].keys())
    assert isinstance(response, list) or isinstance(response, dict)
Beispiel #16
0
def test_post_vnf_packages(post_vnf_packages_keys):
    """Tests API call to onboard VNF descriptor resources"""
    sonata_vnfpkgm = SONATAClient.VnfPkgm(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)

    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    Helpers._delete_test_vnf(_token=_token["token"]["access_token"])

    response = json.loads(
        sonata_vnfpkgm.post_vnf_packages(
            token=_token["token"]["access_token"],
            package_path="tests/samples/vnfd_example.yml"))

    assert response['error'] == True
    assert response['data'] != ''
def test_post_cosd_descriptors(post_cosd_descriptors_keys):
    """Tests API call to onboard NS descriptor resources"""
    sonata_pishahang = SONATAClient.Pishahang(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)

    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    Helpers._delete_test_cosds(_token=_token["token"]["access_token"])

    response = json.loads(
        sonata_pishahang.post_cosd_descriptors(
            token=_token["token"]["access_token"],
            package_path="tests/samples/cosd_example.yml"))

    assert response['error'] == False
    assert response['data'] != ''
def test_get_csd_descriptors(get_csd_descriptors_keys):
    """Tests API call to fetch multiple NS descriptor resources"""
    sonata_pishahang = SONATAClient.Pishahang(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    response = json.loads(
        sonata_pishahang.get_csd_descriptors(
            token=_token["token"]["access_token"], limit=1000))

    response = json.loads(response["data"])
    assert isinstance(response, list)
    if len(response) > 0:
        assert set(get_csd_descriptors_keys).issubset(
            response[0].keys()), "All keys should be in the response"
def test_get_user_info(get_user_info_keys):
    time.sleep(2) #Wait 
    sonata_admin = SONATAClient.Admin(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _u_list = json.loads(sonata_admin.get_user_list(token=_token["token"]["access_token"]))
    _u_list = json.loads(_u_list["data"])

    for _u in _u_list:
        if "Admin" == _u['first_name']:            
            _usr = _u['uuid']

    response = json.loads(sonata_admin.get_user_info(token=_token["token"]["access_token"], id=_usr))
    if response["error"]:
            return True
    else:
            return False
Beispiel #20
0
def test_get_vnf_packages_vnfpkgid(get_vnf_packages_vnfpkgid_keys):
    """Tests API call to onboard VNF descriptor resources"""
    sonata_vnfpkgm = SONATAClient.VnfPkgm(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _vnfd_list = json.loads(
        sonata_vnfpkgm.get_vnf_packages(token=_token["token"]["access_token"]))
    _vnfd_list = json.loads(_vnfd_list["data"])

    _vnfd = None
    for _v in _vnfd_list:
        if "vnfd_example" == _v['uuid']:
            _vnfd = _v['uuid']

    response = json.loads(
        sonata_vnfpkgm.get_vnf_packages_vnfpkgid(
            token=_token["token"]["access_token"], vnfPkgId=_vnfd))
def test_get_vnf_instances_vnfinstanceid(get_vnf_instances_vnfinstanceid_keys):
    """Tests API call to read an individual VNF instance resource"""
    sonata_nslcm = SONATAClient.Nslcm(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _vnf_list = json.loads(sonata_nslcm.get_vnf_instances(
                            token=_token["token"]["access_token"]))
    _vnf_list = json.loads(_vnf_list["data"])

    response = json.loads(sonata_nslcm.get_vnf_instances_vnfinstanceid(
                            token=_token["token"]["access_token"], vnfInstanceId=_vnf_list[0]["uuid"]))

    assert response['error'] == False
    response = json.loads(response["data"])
    assert isinstance(response, dict)
    assert set(get_vnf_instances_vnfinstanceid_keys).issubset(
                response.keys()), "All keys should be in the response"
def test_get_instantions_requests_requestId(get_instantions_requests_requestId_keys):
    time.sleep(2) #Wait 
    sonata_admin = SONATAClient.Admin(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _r_list = json.loads(sonata_admin.get_instantions_requests(token=_token["token"]["access_token"]))
    _r_list = json.loads(_r_list["data"])

    for _r in _r_list:
        if "http://son-gtkkpi:5400/service-instantiation-time" == _r['callback']:            
            _ir = _r['id']

    response = json.loads(sonata_admin.get_instantions_requests_requestId(token=_token["token"]["access_token"], id=_ir))
    if response["error"]:
            return True
    else:
            return False
Beispiel #23
0
def test_delete_ns_descriptors_nsdinfoid(delete_ns_descriptors_nsdinfoid_keys):
    """Tests API call to delete NS descriptor resources"""
    sonata_vnfpkgm = SONATAClient.VnfPkgm(HOST_URL)
    sonata_nsd = SONATAClient.Nsd(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _nsd_list = json.loads(
        sonata_nsd.get_ns_descriptors(token=_token["token"]["access_token"]))
    _nsd_list = json.loads(_nsd_list["data"])

    _nsd = None
    for _n in _nsd_list:
        if "sonata-demo" == _n['nsd']['name']:
            _nsd = _n['uuid']

    time.sleep(10)  # Wait for NSD onboarding
    response = json.loads(
        sonata_nsd.delete_ns_descriptors_nsdinfoid(
            token=_token["token"]["access_token"], nsdinfoid=_nsd))
    assert isinstance(response, dict)
    assert response["data"] == "{\"error\":\"The NSD ID None does not exist\"}"

    time.sleep(2)  #Wait for NSD onboarding

    _vnfd_list = json.loads(
        sonata_vnfpkgm.get_vnf_packages(token=_token["token"]["access_token"]))
    _vnfd_list = json.loads(_vnfd_list["data"])

    _vnfd = None
    for _v in _vnfd_list:
        if "vnfd_example" == _v['uuid']:
            _vnfd = _v['uuid']

    response = None
    if _vnfd:
        response = json.loads(
            sonata_vnfpkgm.delete_vnf_packages_vnfpkgid(
                token=_token["token"]["access_token"], vnfPkgId=_vnfd))
        assert isinstance(response, dict)
        assert response["data"] == ""
def test_get_nsinstances_records_instanceId(get_nsinstances_records_instanceId_keys):
    time.sleep(2) #Wait 
    sonata_admin = SONATAClient.Admin(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _nsr_list = json.loads(sonata_admin.get_nsinstances_records(token=_token["token"]["access_token"]))
    _nsr_list = json.loads(_nsr_list["data"])
    
    _nsr = None
    for _n in _nsr_list:
        if "nsr-schema-01" == _n['descriptor_version']:         
            _nsr = _n['uuid']

    response = json.loads(sonata_admin.get_nsinstances_records_instanceId(token=_token["token"]["access_token"], id=_nsr))
    if response["error"]:
            return True
    else:
            return False
def test_get_functions_functionId(get_functions_functionId_keys):
    time.sleep(2) #Wait 
    sonata_admin = SONATAClient.Admin(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    _f_list = json.loads(sonata_admin.get_functions(token=_token["token"]["access_token"]))
    _f_list = json.loads(_f_list["data"])

    _fun = None
    for _f in _f_list:
        if "dummy-vnf" == _f['vnfd']['name']:            
            _fun = _f['uuid']

    response = json.loads(sonata_admin.get_functions_functionId(token=_token["token"]["access_token"], id=_fun))

    if response["error"]:
            return True
    else:
            return False
def test_get_services_serviceId(get_services_serviceId_keys):
    time.sleep(2) #Wait
    sonata_admin = SONATAClient.Admin(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _s_list = json.loads(sonata_admin.get_services(token=_token["token"]["access_token"]))
    _s_list = json.loads(_s_list["data"])

    _ser = None
    for _s in _s_list:
        if "Pishahang-Service" == _s['nsd']['name']:            
            _ser = _s['uuid']

    response = json.loads(sonata_admin.get_services_serviceId(token=_token["token"]["access_token"], id=_ser))

    if response["error"]:
            return True
    else:
            return False
def test_delete_son_packages_PackageId(delete_son_packages_PackageId_keys):
    sonata_package = SONATAClient.Package(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _package_list = json.loads(
        sonata_package.get_son_packages(token=_token["token"]["access_token"]))
    _package_list = json.loads(_package_list["data"])

    _package = None
    for _p in _package_list:
        if "sonata_example.son" == _p['grid_fs_name']:
            _package = _p['uuid']

    response = None
    if _package:
        response = json.loads(
            sonata_package.delete_son_packages_PackageId(
                token=_token["token"]["access_token"], id=_package))
        assert isinstance(response, dict)
        assert response["data"] == ""
Beispiel #28
0
def test_delete_vnf_packages_vnfpkgid(delete_vnf_packages_vnfpkgid_keys):
    """Tests API call to delete NS descriptor resources"""
    sonata_vnfpkgm = SONATAClient.VnfPkgm(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])

    _vnfd_list = json.loads(
        sonata_vnfpkgm.get_vnf_packages(token=_token["token"]["access_token"]))
    _vnfd_list = json.loads(_vnfd_list["data"])

    _vnfd = None
    for _v in _vnfd_list:
        if "vnfd_example" == _v['uuid']:
            _vnfd = _v['uuid']

    response = None
    if _vnfd:
        response = json.loads(
            sonata_vnfpkgm.delete_vnf_packages_vnfpkgid(
                token=_token["token"]["access_token"], vnfPkgId=_vnfd))
        assert isinstance(response, dict)
        assert response["data"] == ""
def test_get_vims_requestId(get_vims_requestId_keys):
    time.sleep(2) #Wait 
    sonata_admin = SONATAClient.Admin(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    response = json.loads(sonata_admin.get_vims_list(token=_token["token"]["access_token"]))
    response = json.loads(response["data"])


    _v_list = json.loads(sonata_admin.get_vims_list(token=_token["token"]["access_token"]))
    _v_list = json.loads(_v_list["data"])

    _vim = None
    for _v in _v_list:
        if 1 in _v_list:            
            _vim = _v['items']['request_uuid']

    response = json.loads(sonata_admin.get_vims_requestId(token=_token["token"]["access_token"], id=_vim))

    if response["error"]:
            return True
    else:
            return False
Beispiel #30
0
def test_get_ns_descriptors_nsdinfoid():
    """Tests API call to read information about an  NS descriptor resources"""
    sonata_nsd = SONATAClient.Nsd(HOST_URL)
    sonata_auth = SONATAClient.Auth(HOST_URL)
    _token = json.loads(sonata_auth.auth(username=USERNAME, password=PASSWORD))
    _token = json.loads(_token["data"])
    _nsd_list = json.loads(
        sonata_nsd.get_ns_descriptors(token=_token["token"]["access_token"]))
    _nsd_list = json.loads(_nsd_list["data"])
    Helpers._upload_test_nsd(_token=_token["token"]["access_token"])

    for _n in _nsd_list:
        if "sonata-demo" == _n['nsd']['name']:
            _nsd = _n['uuid']

    response = json.loads(
        sonata_nsd.get_ns_descriptors_nsdinfoid(
            token=_token["token"]["access_token"], nsdinfoid=_nsd))

    Helpers._delete_test_nsd(_token=_token["token"]["access_token"])
    if response["error"]:
        return True
    else:
        return False