+ # make sure ns is running
+ if not utils.wait_for_value(lambda: osm.get_api().ns.get_field(ns_name,'operational-status'),result='running',wait_time=240):
+ nsr=osm.get_api().ns.get(ns_name)
+ pprint.pprint(nsr)
+ assert True, "operational-status != running"
+
+ if ns_scale:
+ # for each descriptor, scale it
+ for scale in nsd_desc['scaling-group-descriptor']:
+ # scale it.
+ assert not osm.get_api().ns.scale(ns_name, scale['name'], 1)
+
+ # ensure ns is scaling-out
+ assert utils.wait_for_value(lambda: osm.get_api().ns.get_field(ns_name,'operational-status'),result='scaling-out',wait_time=120)
+
+ # wait for ns to be in running-state
+ assert utils.wait_for_value(lambda: osm.get_api().ns.get_field(ns_name,'operational-status'),result='running',wait_time=300)
+
+ time.sleep(10)
+
+ assert not osm.get_api().ns.delete(ns_name, wait=True)
+
+ #wait for the ns to delete
+ #try:
+ # utils.wait_for_value( lambda: osm.get_api().ns.get(ns_name), result=False, wait_time=180)
+ #except:
+ # print("Exception: Failed to get NAME after NS DELETE ... ")
+
+ #TODO find the reason for 502 exception from osmclient/nbi
+ try:
+ assert not osm.get_api().nsd.delete(nsd_desc['name'])
+ except:
+ print("Exception: NSD Delete exception ...due to 502 error")
+ time.sleep(10)
+
+ for file in vnfd_file_list:
+ vnfd_desc = osm.get_api().package.get_key_val_from_pkg(file)