From af759326472a5e2ab802f83555cc60a48c197078 Mon Sep 17 00:00:00 2001 From: Kiran Kashalkar Date: Wed, 1 Feb 2017 03:02:48 +0000 Subject: [PATCH] NOTICKET: Fix onboard_pkg utility for new package management semantics Signed-off-by: Kiran Kashalkar --- .../rift/tasklets/rwlaunchpad/onboard.py | 2 +- .../rwlaunchpadtasklet/scripts/onboard_pkg | 20 ++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/onboard.py b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/onboard.py index f777c978..b12e192f 100644 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/onboard.py +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/onboard.py @@ -51,7 +51,7 @@ class DescriptorOnboarder(object): } HEADERS = {"content-type": "application/vnd.yang.data+json"} - TIMEOUT_SECS = 5 + TIMEOUT_SECS = 60 AUTH = ('admin', 'admin') def __init__(self, log, host="127.0.0.1", port=8008, use_ssl=False, ssl_cert=None, ssl_key=None): diff --git a/rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg b/rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg index 741fbae2..2b2eb911 100755 --- a/rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg +++ b/rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg @@ -108,15 +108,23 @@ class OnboardPackage: self._account = None self._ip = args.so_ip + self._api_server_ip = "localhost" self._uport = args.upload_port + self._onboard_port = args.onboard_port + self._rport = args.restconf_port + self._user = args.restconf_user + self._password = args.restconf_password + self._onboard_url = "curl -k --user \"{user}:{passwd}\" \"https://{ip}:{port}/composer/upload?api_server=https://{api_server_ip}&upload_server=https://{ip}\"". \ + format(ip=self._ip, + port=self._onboard_port, + user=self._user, + passwd=self._password, + api_server_ip=self._api_server_ip) self._upload_url = "curl -k https://{ip}:{port}/api/upload". \ format(ip=self._ip, port=self._uport) - self._rport = args.restconf_port - self._user = args.restconf_user - self._password = args.restconf_password self._headers = '-H "accept: application/json"' + \ ' -H "content-type: application/json"' self._conf_url = "curl -k {header} --user \"{user}:{passwd}\" https://{ip}:{port}/api/config". \ @@ -236,8 +244,8 @@ class OnboardPackage: def _upload_package(self, pkg): - upload_cmd = "{url} -F \"descriptor=@{pkg}\" ". \ - format(url=self._upload_url, + upload_cmd = "{url} -F \"package=@{pkg}\" ". \ + format(url=self._onboard_url, pkg=pkg) self.log.debug("Upload pkg {} cmd: {}".format(pkg, upload_cmd)) @@ -398,6 +406,8 @@ if __name__ == "__main__": parser.add_argument("-c", "--vim-account", help="Cloud/VIM account to instantiate on") + parser.add_argument("-o", "--onboard-port", default=8443, type=int, + help="Onboarding port number - node port number, default 8443") parser.add_argument("-p", "--upload-port", default=4567, type=int, help="Upload port number, default 4567") parser.add_argument("-P", "--restconf-port", default=8008, type=int, -- 2.25.1