diff options
author | yangyan <yangyanyj@chinamobile.com> | 2019-09-24 10:51:44 +0800 |
---|---|---|
committer | Yan Yang <yangyanyj@chinamobile.com> | 2019-09-24 03:18:30 +0000 |
commit | 43fdf7b1938877fec2a10022a533c0491b6e8c95 (patch) | |
tree | cff87934c5467dd123990ba3131e999cdf24c8dd | |
parent | 50fce384f46a6d961e8062abcffeca717edab725 (diff) |
add terminate and del function to hpy_automation scripts
Change-Id: Ie669261bde3723d892706d3d767c08b325afc3e0
Issue-ID: INT-1239
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
-rwxr-xr-x | test/hpa_automation/tosca/hpa_automation.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/hpa_automation/tosca/hpa_automation.py b/test/hpa_automation/tosca/hpa_automation.py index 4eeabbf0e..86b51f562 100755 --- a/test/hpa_automation/tosca/hpa_automation.py +++ b/test/hpa_automation/tosca/hpa_automation.py @@ -408,6 +408,19 @@ def instantiate_ns(parameters, ns_instance_id): ns_instantiate_out = (os.popen(ns_instantiate_string)).read() return ns_instantiate_out +def terminate_ns(parameters, ns_instance_id): + ns_terminate_string = 'oclip vfc-nslcm-terminate -m {} -i {}'.format(parameters["vfc-url"], ns_instance_id) + print ns_terminate_string + ns_terminate_out = (os.popen(ns_terminate_string)).read() + print ns_terminate_out + return ns_terminate_out + +def delete_ns(parameters, ns_instance_id): + ns_delete_string = 'oclip vfc-nslcm-delete -m {} -c {}'.format(parameters["vfc-url"], ns_instance_id) + print ns_delete_string + ns_delete_out = (os.popen(ns_delete_string)).read() + return ns_delete_out + def create_ns_package(parameters): ns = parameters["ns"] create_ns_string = 'oclip vfc-catalog-create-ns -m {} -c {} -e {}'.format(parameters["vfc-url"], \ @@ -517,3 +530,14 @@ ns_instance_id = create_ns(parameters, ns_out) print ns_instance_id instantiate_ns_output = instantiate_ns(parameters, ns_instance_id) print instantiate_ns_output + +#terminate and delete ns; +#option args add the end of json file + +if sys.argv[3] == "terminate": + terminate_ns_output = terminate_ns(parameters, ns_instance_id) + print terminate_ns_output + +elif sys.argv[3] == "delete": + delete_ns_output = delete_ns(parameters, ns_instance_id) + print delete_ns_output |