X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=openmano;h=6af5ea58091fa8886a61126e2c1e39f8ef299a7a;hb=b2880eb22114090842e92dff6fd09b71d1ed2d41;hp=26ef9b9317d2c214ad718e5f819f9d23e6bae3ce;hpb=f1ba57e5806479a5a38d5c4f48da8799e78e400a;p=osm%2FRO.git diff --git a/openmano b/openmano index 26ef9b93..6af5ea58 100755 --- a/openmano +++ b/openmano @@ -890,6 +890,28 @@ def instance_scenario_delete(args): print content['error']['description'] return result +def get_action(args): + if not args.all: + tenant = _get_tenant() + else: + tenant = "any" + if not args.instance: + instance_id = "any" + else: + instance_id =args.instance + action_id = "" + if args.id: + action_id = "/" + args.id + URLrequest = "http://{}:{}/openmano/{}/instances/{}/action{}".format(mano_host, mano_port, tenant, instance_id, + action_id) + mano_response = requests.get(URLrequest) + logger.debug("openmano response: %s", mano_response.text ) + if args.verbose == None: + args.verbose = 0 + if args.id != None: + args.verbose += 1 + return _print_verbose(mano_response, args.verbose) + def instance_scenario_action(args): #print "instance-scenario-action", args tenant = _get_tenant() @@ -1745,13 +1767,19 @@ 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"],\ + choices=["start","pause","resume","shutoff","shutdown","forceOff","rebuild","reboot", "console", "add_public_key"],\ 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("--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) + action_parser = subparsers.add_parser('action-list', parents=[parent_parser], help="get action over an instance status") + action_parser.add_argument("id", nargs='?', action="store", help="action id") + action_parser.add_argument("--instance", action="store", help="fitler by this instance_id") + action_parser.add_argument("--all", action="store", help="Not filter by tenant") + action_parser.set_defaults(func=get_action) + #instance_scenario_status_parser = subparsers.add_parser('instance-scenario-status', help="show the status of a scenario instance") #instance_scenario_status_parser.add_argument("name", action="store", help="name or uuid of the scenario instance") #instance_scenario_status_parser.set_defaults(func=instance_scenario_status)