NOTICKET: Fix onboard_pkg utility for new package management semantics 57/1057/1
authorKiran Kashalkar <kiran.kashalkar@riftio.com>
Wed, 1 Feb 2017 03:02:48 +0000 (03:02 +0000)
committerKiran Kashalkar <kiran.kashalkar@riftio.com>
Wed, 1 Feb 2017 03:03:03 +0000 (03:03 +0000)
Signed-off-by: Kiran Kashalkar <kiran.kashalkar@riftio.com>
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/onboard.py
rwlaunchpad/plugins/rwlaunchpadtasklet/scripts/onboard_pkg

index f777c97..b12e192 100644 (file)
@@ -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):
index 741fbae..2b2eb91 100755 (executable)
@@ -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,