X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Ftests%2Ftest_ns.py;h=07cc1a1b9db9201a409866b98b20e416ca503332;hb=refs%2Fchanges%2F96%2F8096%2F6;hp=4d191ce56ef7251dd802af48c9e7976495e7ab5e;hpb=e64f7fb3e0efd6fcc78ea322c90106c7403a8a62;p=osm%2FLCM.git diff --git a/osm_lcm/tests/test_ns.py b/osm_lcm/tests/test_ns.py index 4d191ce..07cc1a1 100644 --- a/osm_lcm/tests/test_ns.py +++ b/osm_lcm/tests/test_ns.py @@ -1089,7 +1089,9 @@ class TestMyNS(asynctest.TestCase): self.my_ns.RO.get_list = asynctest.CoroutineMock(self.my_ns.RO.get_list, return_value=[]) self.my_ns.RO.create = asynctest.CoroutineMock(self.my_ns.RO.create, side_effect=self._ro_create()) self.my_ns.RO.show = asynctest.CoroutineMock(self.my_ns.RO.show, side_effect=self._ro_show()) - self.my_ns.RO.create_action = asynctest.CoroutineMock(self.my_ns.RO.create_action) + self.my_ns.RO.create_action = asynctest.CoroutineMock(self.my_ns.RO.create_action, + return_value={"vm-id": {"vim_result": 200, + "description": "done"}}) @asynctest.fail_on(active_handles=True) # all async tasks must be completed async def test_instantiate(self): @@ -1131,6 +1133,32 @@ class TestMyNS(asynctest.TestCase): # TODO add more checks of called methods # TODO add a terminate + def test_ns_params_2_RO(self): + vim = self._db_get_list("vim_accounts")[0] + vim_id = vim["_id"] + ro_vim_id = vim["_admin"]["deployed"]["RO"] + ns_params = {"vimAccountId": vim_id} + mgmt_interface = {"cp": "cp"} + vdu = [{"id": "vdu_id", "interface": [{"external-connection-point-ref": "cp"}]}] + vnfd_dict = { + "1": {"vdu": vdu, "mgmt-interface": mgmt_interface}, + "2": {"vdu": vdu, "mgmt-interface": mgmt_interface, "vnf-configuration": None}, + "3": {"vdu": vdu, "mgmt-interface": mgmt_interface, "vnf-configuration": {"config-access": None}}, + "4": {"vdu": vdu, "mgmt-interface": mgmt_interface, + "vnf-configuration": {"config-access": {"ssh-access": None}}}, + "5": {"vdu": vdu, "mgmt-interface": mgmt_interface, + "vnf-configuration": {"config-access": {"ssh-access": {"required": True, "default_user": "U"}}}}, + } + nsd = {"constituent-vnfd": []} + for k in vnfd_dict.keys(): + nsd["constituent-vnfd"].append({"vnfd-id-ref": k, "member-vnf-index": k}) + + n2vc_key_list = ["key"] + ro_ns_params = self.my_ns.ns_params_2_RO(ns_params, nsd, vnfd_dict, n2vc_key_list) + ro_params_expected = {'wim_account': None, "datacenter": ro_vim_id, + "vnfs": {"5": {"vdus": {"vdu_id": {"mgmt_keys": n2vc_key_list}}}}} + self.assertEqual(ro_ns_params, ro_params_expected) + @asynctest.fail_on(active_handles=True) # all async tasks must be completed async def test_scale(self): pass