X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwlaunchpad%2Ftest%2Futest_ro_account.py;h=deaca6b122305599026e69b9791690887756c3a4;hb=9ad945aab0b5a992e1df860bede8ecc9b143470e;hp=6e480d4040de2085f1337da4036d441759737f05;hpb=6f07e6f33f751ab4ffe624f6037f887b243bece2;p=osm%2FSO.git diff --git a/rwlaunchpad/test/utest_ro_account.py b/rwlaunchpad/test/utest_ro_account.py old mode 100644 new mode 100755 index 6e480d40..deaca6b1 --- a/rwlaunchpad/test/utest_ro_account.py +++ b/rwlaunchpad/test/utest_ro_account.py @@ -31,10 +31,10 @@ gi.require_version('RwDtsYang', '1.0') from gi.repository import ( RwLaunchpadYang as launchpadyang, RwDts as rwdts, - RwVnfdYang, + RwProjectVnfdYang as RwVnfdYang, RwVnfrYang, RwNsrYang, - RwNsdYang, + RwProjectNsdYang as RwNsdYang, VnfrYang ) @@ -114,27 +114,47 @@ class RoAccountDtsTestCase(rift.test.dts.AbstractDTSTest): mock_orch_acc = launchpadyang.ResourceOrchestrator.from_dict( {'name': 'rift-ro', 'account_type': 'rift_ro', 'rift_ro': {'rift_ro': True}}) - # Test rift-ro plugin - w_xpath = "C,/rw-launchpad:resource-orchestrator" + # Test rift-ro plugin CREATE + w_xpath = "C,/rw-project:project/rw-launchpad:resource-orchestrator" xpath = w_xpath yield from self.publisher.publish(w_xpath, xpath, mock_orch_acc) yield from asyncio.sleep(5, loop=self.loop) assert type(orch.ro_plugin) is cloud.RwNsPlugin - # Test Openmano plugin + # Test Openmano plugin CREATE mock_orch_acc = launchpadyang.ResourceOrchestrator.from_dict( {'name': 'openmano', 'account_type': 'openmano', - 'openmano': {'tenant_id': "abc"}}) + 'openmano': {'tenant_id': "abc", + "port": 9999, + "host": "10.64.11.77"}}) yield from self.publisher.publish(w_xpath, xpath, mock_orch_acc) yield from asyncio.sleep(5, loop=self.loop) - print (type(orch.ro_plugin)) assert type(orch.ro_plugin) is openmano_nsm.OpenmanoNsPlugin + assert orch.ro_plugin._cli_api._port == mock_orch_acc.openmano.port + assert orch.ro_plugin._cli_api._host == mock_orch_acc.openmano.host + + # Test update + mock_orch_acc.openmano.port = 9789 + mock_orch_acc.openmano.host = "10.64.11.78" + yield from self.dts.query_update("C,/rw-project:project/rw-launchpad:resource-orchestrator", + rwdts.XactFlag.ADVISE, mock_orch_acc) + assert orch.ro_plugin._cli_api._port == mock_orch_acc.openmano.port + assert orch.ro_plugin._cli_api._host == mock_orch_acc.openmano.host + + # Test update when a live instance exists + # Exception should be thrown + orch.handle_nsr(None, rwdts.QueryAction.CREATE) + mock_orch_acc.openmano.port = 9788 + + with self.assertRaises(Exception): + yield from self.dts.query_update("C,/rw-project:project/rw-launchpad:resource-orchestrator", + rwdts.XactFlag.ADVISE, mock_orch_acc) # Test delete - yield from self.dts.query_delete("C,/rw-launchpad:resource-orchestrator", + yield from self.dts.query_delete("C,/rw-project:project/rw-launchpad:resource-orchestrator", flags=rwdts.XactFlag.ADVISE) assert orch.ro_plugin == None @@ -150,4 +170,4 @@ def main(argv=sys.argv[1:]): ) if __name__ == '__main__': - main() \ No newline at end of file + main()