Skip to content

Commit

Permalink
feat/fix: make qinq easier, fix behavior
Browse files Browse the repository at this point in the history
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 082cc0c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/quads-cli
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ if __name__ == '__main__':
help='date and time to query; e.g. "2016-06-01 08:00"') 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('--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('--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', parser.add_argument('--no-wipe', dest='wipe', action='store_false',
help='Define no wipe for safeguarding data after assignment') help='Define no wipe for safeguarding data after assignment')
parser.add_argument('--cloud-ticket', dest='cloudticket', type=str, default=None, help='Define environment ticket') parser.add_argument('--cloud-ticket', dest='cloudticket', type=str, default=None, help='Define environment ticket')
Expand Down
18 changes: 18 additions & 0 deletions quads/api_v2.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -172,6 +172,24 @@ def GET(self, **data):
) )


return json.dumps(clouds_summary) 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) objs = self.model.objects(**args)
if objs: if objs:
return objs.to_json() return objs.to_json()
Expand Down

0 comments on commit 082cc0c

Please sign in to comment.