diff options
author | Ruan HE <ruan.he@orange.com> | 2017-10-04 07:34:51 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-10-04 07:34:51 +0000 |
commit | 513ede6dba5a6d49cd1fc0abcddbae2f4eedcc99 (patch) | |
tree | 6b4514a45e894e22303cd371a280e11e0096741f /moonv4/tests/populate_default_values.py | |
parent | 8fafc67326b1b83651aefe3c2a7ab621baab3913 (diff) | |
parent | f28f884b86ad6a01afb3ebe7959a86aed0701539 (diff) |
Merge "Update code to the latest working version: version 4.2"
Diffstat (limited to 'moonv4/tests/populate_default_values.py')
-rw-r--r-- | moonv4/tests/populate_default_values.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/moonv4/tests/populate_default_values.py b/moonv4/tests/populate_default_values.py index 740ad8ed..cd06ab1a 100644 --- a/moonv4/tests/populate_default_values.py +++ b/moonv4/tests/populate_default_values.py @@ -7,8 +7,11 @@ from utils.policies import * parser = argparse.ArgumentParser() parser.add_argument('filename', help='scenario filename', nargs=1) -parser.add_argument("--verbose", "-v", action='store_true', help="verbose mode") +parser.add_argument("--verbose", "-v", action='store_true', + help="verbose mode") parser.add_argument("--debug", "-d", action='store_true', help="debug mode") +parser.add_argument("--keystone-pid", "-k", dest="keystone_pid", default="", + help="Force a particular Keystone Project ID") args = parser.parse_args() FORMAT = '%(asctime)-15s %(levelname)s %(message)s' @@ -202,11 +205,12 @@ def create_policy(model_id, meta_rule_list): def create_pdp(policy_id=None): logger.info("Creating PDP {}".format(scenario.pdp_name)) projects = get_keystone_projects() - admin_project_id = None - for _project in projects['projects']: - if _project['name'] == "admin": - admin_project_id = _project['id'] - assert admin_project_id + project_id = args.keystone_pid + if not project_id: + for _project in projects['projects']: + if _project['name'] == "admin": + project_id = _project['id'] + assert project_id pdps = check_pdp()["pdps"] for pdp_id, pdp_value in pdps.items(): if scenario.pdp_name == pdp_value["name"]: @@ -214,7 +218,7 @@ def create_pdp(policy_id=None): logger.debug("Found existing PDP named {} (will add policy {})".format(scenario.pdp_name, policy_id)) return pdp_id _pdp_id = add_pdp(name=scenario.pdp_name, policy_id=policy_id) - map_to_keystone(pdp_id=_pdp_id, keystone_project_id=admin_project_id) + map_to_keystone(pdp_id=_pdp_id, keystone_project_id=project_id) return _pdp_id if __name__ == "__main__": |