Knowledge Search


[CSO] How to upload a VNF image using CLI

  [KB34750] Show Article Properties


This article describes the process to upload a VNF image via the Command Line Interface (CLI).



Generally to upload a VNF image via the CSO GUI, you navigate to the CSO Admin Portal > Resources > Images > Create.

However, the VNF image in CSO (such as a vSRX image for the GWR VM or the Riverbed WAN-OPT VM) could be several GB in file size and the CSO GUI upload might timeout during the file transfer.

In such cases, it is a better option to upload the VNF image into CSO by using CLI commands.



To upload a VNF image into CSO by using CLI commands, perform the following:

  1. Generate a token for cspadmin:
root@centralmsvm:~# curl -i http://<CSO IP or Hostname>:5000/v3/auth/tokens -H "Content-Type: application/json" -d '{"auth":{"identity":{"methods":["password"],"password":{"user":{"name":"cspadmin","domain":{"id":"default" },"password":"<password>"}}},"scope":{"project":{"domain":{"id":"default"},"name":"admin"}}}}' | egrep -i subject-token
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3218  100  3016  100   202  27417   1836 --:--:-- --:--:-- --:--:-- 27669
X-Subject-Token: 89dac74130014b3f90b652c7fbcb4c02*

Note: Refer to KB34116 - How to execute Contrail Service Orchestrator HTTP API requests through CLI for selecting the correct <CSO IP or Hostname> based on whether the CSO deployment is Small, Medium, or Large.

  1. Then use the above token to upload a VNF image (Riverbed image in this example) in the CLI syntax as shown below:

root@centralmsvm:~# curl -v -F "imagefile=@RIVERBED_20170329.tgz" -H "x-auth-token: 89dac74130014b3f90b652c7fbcb4c02" -F "cname=riverbed-img" -F "device_family=riverbed-vx" -F "vendor=Riverbed" -F "major_version=9" -F "minor_version=2" -F "build_num=0" -F "supported_platform=NFX250" -F "image_type=VNF_IMAGE" -k https://<CSO IP or Hostname>/ims-central/upload_image_file
* Hostname was NOT found in DNS cache
*   Trying
* Connected to centralmsvm ( port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
*        subject: C=US; ST=CA; O=Juniper Networks; L=Sunnyvale;; OU=CSP;
*        start date: 2019-01-10 00:33:21 GMT
*        expire date: 2020-01-10 00:33:21 GMT
*        issuer: C=US; ST=CA; O=Juniper Networks; L=Sunnyvale;; OU=CSP;
*        SSL certificate verify result: self signed certificate (18), continuing anyway.
> POST /ims-central/upload_image_file HTTP/1.1
> User-Agent: curl/7.35.0
> Host: centralmsvm
> Accept: */*
> x-auth-token: 89dac74130014b3f90b652c7fbcb4c02
> Content-Length: 763388557
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------86251af7c4ac4d93
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
< X-Request-Id: api_server_db_09b4f7cf-277e-468b-9383-0c8ef4ce8b30
< Date: Tue, 11 Jun 2019 18:35:15 GMT
< Transfer-Encoding: chunked
< Strict-Transport-Security: max-age=15768000
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
* Connection #0 to host centralmsvm left intact
{ "output": {"progress": "..", "status": "SUCCESS", "imagefile_uuid": "076d0e38-4e8f-4a4a-9546-5974329d2035", "failed_list": [], "imagefile_uri": "/v1/AUTH_a74cf29fb1b3499cb0d77e7081d3f524/mycontainer/RIVERBED_20170329.tgz"}}
  1. When a SUCCESS status is returned, it means that the VNF image (riverbed-img) has been uploaded successfully and that the image is available to use in the device template or the network service (the Riverbed WAN-OPT VNF service chain) for all tenants.


Related Links: