new 'osm version' command to get server version 87/7887/3
authortierno <alfonso.tiernosepulveda@telefonica.com>
Sat, 23 Nov 2019 23:01:26 +0000 (23:01 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 2 Dec 2019 08:49:38 +0000 (09:49 +0100)
Change-Id: Ic01afc3dec3475dd390f0e6a464bd08d6d596faf
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osmclient/scripts/osm.py
osmclient/sol005/client.py

index d66bcfe..7178d26 100755 (executable)
@@ -3018,6 +3018,16 @@ def ns_metric_export(ctx, ns, vnf, vdu, metric, interval):
 # Other operations
 ####################
 
+@cli.command(name='version')
+@click.pass_context
+def get_version(ctx):
+    try:
+        check_client_version(ctx.obj, "version")
+        print (ctx.obj.get_version())
+    except ClientException as e:
+        print(str(e))
+        exit(1)
+
 @cli.command(name='upload-package', short_help='uploads a VNF package or NS package')
 @click.argument('filename')
 @click.pass_context
index 482cd73..2de6a4c 100644 (file)
@@ -116,3 +116,8 @@ class Client(object):
                 http_header = ['{}: {}'.format(key, val)
                                for (key, val) in list(self._headers.items())]
                 self._http_client.set_http_header(http_header)
+
+    def get_version(self):
+        resp = self._http_client.get_cmd(endpoint="/version")
+        return "{} {}".format(resp.get("version"), resp.get("date"))
+