Skip to content
Permalink
Browse files

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
  • Loading branch information
kambiz-aghaiepour committed Dec 20, 2019
1 parent 1307a49 commit 082cc0c8c2bd46780fbea16bde4a30d1e6c62861
Showing with 19 additions and 1 deletion.
  1. +1 −1 bin/quads-cli
  2. +18 −0 quads/api_v2.py
@@ -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')
@@ -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()

0 comments on commit 082cc0c

Please sign in to comment.
You can’t perform that action at this time.