X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fns.py;h=c84d090f05fa346caebcdf6498bc352b32edf041;hb=refs%2Fchanges%2F30%2F13530%2F6;hp=e1a4f6971f77ec72e99b4ac30d813f102cb30a11;hpb=8f4936bbd22fc700b9d1e64eb6b056bf7744b0a4;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/ns.py b/osmclient/sol005/ns.py index e1a4f69..c84d090 100644 --- a/osmclient/sol005/ns.py +++ b/osmclient/sol005/ns.py @@ -278,10 +278,7 @@ class Ns(object): ) headers = self._client._headers headers["Content-Type"] = "application/yaml" - http_header = [ - "{}: {}".format(key, val) for (key, val) in list(headers.items()) - ] - self._http.set_http_header(http_header) + self._http.set_http_header(headers) http_code, resp = self._http.post_cmd( endpoint=self._apiBase, postfields_dict=ns ) @@ -667,3 +664,23 @@ class Ns(object): return nsr[field] raise NotFound("failed to find {} in ns {}".format(field, ns_name)) + + def heal( + self, + ns_name, + heal_dict, + wait=False, + timeout=None, + ): + """Heals a NS""" + self._logger.debug("") + self._client.get_token() + try: + op_data = heal_dict + if timeout: + op_data["timeout_ns_heal"] = timeout + op_id = self.exec_op(ns_name, op_name="heal", op_data=op_data, wait=wait) + print(str(op_id)) + except ClientException as exc: + message = "failed to heal ns {}:\nerror:\n{}".format(ns_name, str(exc)) + raise ClientException(message)