From a2999a460707408e636d81fe8e735a7625def0d4 Mon Sep 17 00:00:00 2001 From: tierno Date: Sat, 23 Nov 2019 23:01:26 +0000 Subject: [PATCH] new 'osm version' command to get server version Change-Id: Ic01afc3dec3475dd390f0e6a464bd08d6d596faf Signed-off-by: tierno --- osmclient/scripts/osm.py | 10 ++++++++++ osmclient/sol005/client.py | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index d66bcfe..7178d26 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -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 diff --git a/osmclient/sol005/client.py b/osmclient/sol005/client.py index 482cd73..2de6a4c 100644 --- a/osmclient/sol005/client.py +++ b/osmclient/sol005/client.py @@ -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")) + -- 2.25.1