From 082cc0c8c2bd46780fbea16bde4a30d1e6c62861 Mon Sep 17 00:00:00 2001 From: Kambiz Aghaiepour Date: Fri, 20 Dec 2019 10:47:56 -0500 Subject: [PATCH] feat/fix: make qinq easier, fix behavior This changes the argparse behavior of --qinq so that the default if not specified is to use qinq:0 mode or "separated" interfaces. Internally in mongo this is a "True" value for the qinq attribute. When --qinq is specified during cloud definition, it will instead set things up to use qinq:1 mode or "combined" interfaces VLAN design. Additionally the --ls-qinq output is made to be clearer. Change-Id: Idbe53a80073fb5fe6fc4544464e645dc13e4774f --- bin/quads-cli | 2 +- quads/api_v2.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/bin/quads-cli b/bin/quads-cli index e9ef17fdf..27a31858f 100755 --- a/bin/quads-cli +++ b/bin/quads-cli @@ -679,7 +679,7 @@ if __name__ == '__main__': help='date and time to query; e.g. "2016-06-01 08:00"') parser.add_argument('--cloud-owner', dest='cloudowner', type=str, default=None, help='Define environment owner') parser.add_argument('--cc-users', dest='ccusers', type=str, default=None, help='Define environment CC list') - parser.add_argument('--qinq', dest='qinq', action='store_true', help='Define environment qinq state') + parser.add_argument('--qinq', dest='qinq', action='store_false', help='Define environment qinq state') parser.add_argument('--no-wipe', dest='wipe', action='store_false', help='Define no wipe for safeguarding data after assignment') parser.add_argument('--cloud-ticket', dest='cloudticket', type=str, default=None, help='Define environment ticket') diff --git a/quads/api_v2.py b/quads/api_v2.py index 9f1500153..865305e7b 100644 --- a/quads/api_v2.py +++ b/quads/api_v2.py @@ -172,6 +172,24 @@ def GET(self, **data): ) return json.dumps(clouds_summary) + + if self.name == "qinq": + _clouds = model.Cloud.objects().all() + clouds_qinq = [] + for cloud in _clouds: + if cloud.qinq: + qinq_value = "0 (Isolated)" + else: + qinq_value = "1 (Combined)" + clouds_qinq.append( + { + "name": cloud.name, + "qinq": qinq_value, + } + ) + + return json.dumps(clouds_qinq) + objs = self.model.objects(**args) if objs: return objs.to_json()