X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=openmano;h=9351c81c7b5ca038055cc4bfe1c67af43e9155b0;hb=6082b7d161e7ccfbb38c1b7938c88c2619b8f690;hp=ccd22e7123cc854f42de347558e017de9c4918db;hpb=16e3dd4ed7547fe4a4273c53a6deb23c00fdbfb3;p=osm%2FRO.git diff --git a/openmano b/openmano index ccd22e71..9351c81c 100755 --- a/openmano +++ b/openmano @@ -28,8 +28,8 @@ openmano client used to interact with openmano-server (openmanod) """ __author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes" __date__ = "$09-oct-2014 09:09:48$" -__version__ = "0.4.22-r532" -version_date = "Oct 2017" +__version__ = "0.4.23-r533" +version_date = "May 2018" from argcomplete.completers import FilesCompleter import os @@ -926,7 +926,7 @@ def instance_scenario_action(args): tenant = _get_tenant() toact = _get_item_uuid("instances", args.name, tenant=tenant) action={} - action[ args.action ] = args.param + action[ args.action ] = yaml.safe_load(args.param) if args.vnf: action["vnfs"] = args.vnf if args.vm: @@ -940,13 +940,16 @@ def instance_scenario_action(args): logger.debug("openmano response: %s", mano_response.text ) result = 0 if mano_response.status_code==200 else mano_response.status_code content = mano_response.json() - #print json.dumps(content, indent=4) + # print json.dumps(content, indent=4) if mano_response.status_code == 200: if args.verbose: print yaml.safe_dump(content, indent=4, default_flow_style=False) return result - for uuid,c in content.iteritems(): - print ("{:38} {:20} {:20}".format(uuid, c['name'], c['description'])) + if "instance_action_id" in content: + print("instance_action_id={}".format(content["instance_action_id"])) + else: + for uuid,c in content.iteritems(): + print ("{:38} {:20} {:20}".format(uuid, c.get('name'), c.get('description'))) else: print content['error']['description'] return result @@ -1777,9 +1780,9 @@ if __name__=="__main__": instance_scenario_action_parser = subparsers.add_parser('instance-scenario-action', parents=[parent_parser], help="invoke an action over part or the whole scenario instance") instance_scenario_action_parser.add_argument("name", action="store", help="name or uuid of the scenario instance") instance_scenario_action_parser.add_argument("action", action="store", type=str, \ - choices=["start","pause","resume","shutoff","shutdown","forceOff","rebuild","reboot", "console", "add_public_key"],\ + choices=["start","pause","resume","shutoff","shutdown","forceOff","rebuild","reboot", "console", "add_public_key","vdu-scaling"],\ help="action to send") - instance_scenario_action_parser.add_argument("param", nargs='?', help="addional param of the action. e.g. console type (novnc, ...), reboot type (TODO)") + instance_scenario_action_parser.add_argument("param", nargs='?', help="addional param of the action. e.g. console: novnc; reboot: type; vdu-scaling: '[{vdu-id: xxx, type: create|delete, count: 1}]'") instance_scenario_action_parser.add_argument("--vnf", action="append", help="VNF to act on (can use several entries)") instance_scenario_action_parser.add_argument("--vm", action="append", help="VM to act on (can use several entries)") instance_scenario_action_parser.set_defaults(func=instance_scenario_action)