X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fns.py;fp=osmclient%2Fsol005%2Fns.py;h=2fce5ab90fc30d99c66324eefc49fdd070e12281;hb=e0fb4995c67792f01648cbc7e331879fc661a572;hp=7fd1859c071eba0d3c5aa26e2e122cea210b7160;hpb=bcd12ffa6508cdef33058feeb03b34d216608498;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/ns.py b/osmclient/sol005/ns.py index 7fd1859..2fce5ab 100644 --- a/osmclient/sol005/ns.py +++ b/osmclient/sol005/ns.py @@ -100,14 +100,23 @@ class Ns(object): raise NotFound("ns '{}' not found".format(name)) raise NotFound("ns '{}' not found".format(name)) - def delete(self, name, force=False, wait=False): + def delete(self, name, force=False, config=None, wait=False): self._logger.debug("") ns = self.get(name) + querystring_list = [] querystring = '' + if config: + ns_config = yaml.safe_load(config) + querystring_list += ["{}={}".format(k, v) for k, v in ns_config.items()] if force: - querystring = '?FORCE=True' + querystring_list.append('FORCE=True') + if querystring_list: + querystring = "?" + "&".join(querystring_list) http_code, resp = self._http.delete_cmd('{}/{}{}'.format(self._apiBase, ns['_id'], querystring)) + # TODO change to use a POST self._http.post_cmd('{}/{}/terminate{}'.format(_apiBase, ns['_id'], querystring), + # postfields_dict=ns_config) + # seting autoremove as True by default # print('HTTP CODE: {}'.format(http_code)) # print('RESP: {}'.format(resp)) if http_code == 202: