X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=tools%2FOVF_converter%2Fovf_uploader_cli.py;fp=tools%2FOVF_converter%2Fovf_uploader_cli.py;h=e487877e7c3c85f411b6949751f32570872ed595;hb=c6b00f0466ffe9141d9b933fa131780247af8583;hp=0000000000000000000000000000000000000000;hpb=c33cdc3359627245f605fbc1ab0084e03f30837c;p=osm%2Fdevops.git diff --git a/tools/OVF_converter/ovf_uploader_cli.py b/tools/OVF_converter/ovf_uploader_cli.py new file mode 100644 index 00000000..e487877e --- /dev/null +++ b/tools/OVF_converter/ovf_uploader_cli.py @@ -0,0 +1,75 @@ +## +# Copyright 2019 VMware Inc. +# This file is part of ETSI OSM +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# For those usages not covered by the Apache License, Version 2.0 please +# contact: osslegalrouting@vmware.com +## + +import argparse +from uploader import OVFUploader, get_version + + +def execute_cli(): + + """ + Method to parse CLI arguments and execute commands accordingly + Args : None + Return : None + """ + parser = argparse.ArgumentParser(description='Utility to upload an OVF package to vCD') + + parser.add_argument("-v", "--version", action="version", version=str(get_version()), + help="shows version of vCD Uploader tool") + + parser.add_argument("ovf_file", action="store", + help="filename of OVF file to upload to vCD") + + parser.add_argument("-l", "--vcd_url", action="store", + required=True, + help="URL for vCD login (ie: https://vcd.local/") + + parser.add_argument("-u", "--username", action="store", + required=True, + help="Username for vCD login") + + parser.add_argument("-p", "--password", action="store", + required=True, + help="Password for vCD login") + + parser.add_argument("-o", "--orgname", action="store", + required=True, + help="Organization name for vCD login") + + args = parser.parse_args() + + if args.ovf_file: + try: + uploader = OVFUploader(args.ovf_file, + vcd_url=args.vcd_url, + username=args.username, + password=args.password, + orgname=args.orgname) + uploader.make_catalog() + uploader.upload_ovf() + uploader.wait_for_task_completion() + except Exception as exp: + print(exp) + exit(1) + + +if __name__ == "__main__": + execute_cli()