Upload a Software Image
You must be either a Super User or a Network Admin to upload a software image to Paragon Automation.
Before you upload a software image, ensure that you have downloaded the required software image from the Juniper Software Download page to your local system.
To upload a software image:
Field | Description |
---|---|
Display Name |
Enter or modify the software image name. The Display Name field is automatically populated with the name of the file you uploaded. If the name of the software image file uploaded does not meet the naming criteria, you can modify or enter a name. The name can contain only alphanumeric characters, hyphen, period, underscore, and the maximum length allowed is 254 characters. |
Description |
Enter the description for the software image file. |
Vendor |
Select the vendor of the device from the drop-down list. Paragon Automation supports only Juniper Networks devices. |
Device Series |
Select the model of the device from the drop-down list. |
Release |
Enter the release number of the OS. Release number indicates the minor software update that addresses bugs and performance issues within a version. For example, Junos OS Evolved 22.3R1. |
Version |
Enter the version number of the OS. Version number indicates the major software update that is released every quarter of a year. For example, Junos OS 23.1. |
Expected SHA256 |
Provide the expected checksum SHA256 to validate the uploaded data. The images and their SHA256 can be obtained from the Juniper Software Download page. On the Software Download page, select the device from the Find a Product box. Click and expand the Install Package section, and select the software package and checksums for the release. |
Release Notes Link |
Provide the link to the release notes. You can find the link to the release notes on the Juniper Software Download page. On the Software Download page, select the device from the Find a Product box. Click and expand the Documentation and Release Notes section, and find the release notes link for the release. |
The following is a sample script to upload a software image to Paragon Automation. Enter appropriate values for:
-
host
—The hostname of the server from where the software image is to be uploaded to Paragon Automation. -
user
—The username to access the server. -
password
—The password to access the server. -
image-filename
—The name of the software image to be uploaded. -
path
—The path where the software image is stored on the server.
import base64 import hashlib import json import requests URL = 'https://<host>/api/v1/devicesoftware/' USER = '<user>' PASSWORD = '<password>' ORG_ID = 'ff118da5-000a-483c-91a1-45d478478548' MIN_SIZE = 5 * 1024 * 1024 FILENAME = '<image_filename>' DIRECTORY = '<path>' def file_sha(contents): h = hashlib.sha256() data = contents.read(MIN_SIZE) while data: h.update(data) data = contents.read(MIN_SIZE) return h.hexdigest() def print_sw_images(): response = requests.get(URL + ORG_ID + '/images', auth=(USER, PASSWORD), verify=False) images = decode(response) print('There are %d images' % len(images)) for img in images: print(img.get('name')) def decode(response): if response.status_code != 200: print(response.status_code) print(response.text) exit(1) return json.loads(response.text) def upload(file_name: str, data, file_sha256: str, vendor: str, series: str, release: str, version: str): headers = {'Content-Type': 'application/json'} url = URL + ORG_ID + '/upload' response = requests.post(url, auth=(USER, PASSWORD), headers=headers, verify=False, json={ 'name': file_name, 'expected_sha256': file_sha256, 'device_vendor': vendor, 'device_series_list': [series], 'release': release, 'version': version, }) r = decode(response) upload_id = r.get('id') print('Uploading %s' % upload_id) url = url + '/' + upload_id file_slice = read_min(data) while file_slice: encoded = base64.b64encode(file_slice).decode('utf-8') response = requests.put(url, auth=(USER, PASSWORD), headers=headers, verify=False, json={ 'file_data': 'data:application/octet-stream;base64,' + encoded }) msg = decode(response) print(msg) file_slice = read_min(data) response = requests.put(url, auth=(USER, PASSWORD), headers=headers, verify=False, json={ "complete": True }) msg = decode(response) print(msg) def read_min(file): ret = b'' while len(ret) < MIN_SIZE: file_slice = file.read(MIN_SIZE) ret = ret + file_slice if not file_slice: break return ret if __name__ == '__main__': print_sw_images() with open(DIRECTORY + FILENAME, 'rb') as iso: sha = file_sha(iso) print(sha) with open(DIRECTORY + FILENAME, 'rb') as iso: upload(FILENAME, iso, sha, 'Juniper', 'ACX7100', '22.2R1.12-EVO', '22.2') print_sw_images()
This requirements file can be used to install any dependencies necessary-
requests==2.28.1
Increase VM Disk Space for Software Image Upload
The default quota for image upload is limited to 25% of the total Ceph disk size divided by 3. For example, if you are using minimum recommended 50G Ceph disk space per VM, then the quota for image upload is around 16GB.
If you get a message stating that an error has occurred while uploading an image, increase the maximum size of the Ceph object Storage daemon (OSD) pool to a higher value (for example 20G ) by executing the following command in the installer node of the Paragon Automation cluster:
root@controller-1:~# kubectl patch cephobjectstore -n rook-ceph object-store --type=merge -p '{"spec": {"dataPool": {"quotas": {"maxSize": "20Gi"}}}}' cephobjectstore.ceph.rook.io/object-store patched
To confirm that the Ceph OSD pool size is increased to 20GiB, execute the following command:
root@controller-65:~# kubectl exec -ti -n rook-ceph $(kubectl get po -n rook-ceph -l app=rook-ceph-tools -o jsonpath={..metadata.name}) -- ceph osd pool get-quota object-store.rgw.buckets.data quotas for pool 'object-store.rgw.buckets.data': max objects: N/A max bytes : 20 GiB (current num bytes: 15459654543 bytes)
The max bytes
indicates the Ceph OSD pool size in GiB and bytes.
You can use the software uploaded to Paragon Automation to upgrade the image installed on devices. See Upgrade Software or Upgrade Device Image.