Skip to content

Commit

Permalink
Currently, sonic-installer instead of sonic_installer.
Browse files Browse the repository at this point in the history
  • Loading branch information
iMasaruOki committed Aug 12, 2022
1 parent 3f0ba59 commit aed482c
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 38 deletions.
34 changes: 17 additions & 17 deletions doc/SONiC-User-Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,26 +409,26 @@ TBD: Is this enough? Need information from Xin.
## 3.2.3 Upgrade Or Downgrade Version
SONiC software can be installed in two methods, viz, using "ONIE Installer" or by using "sonic_installer tool".
SONiC software can be installed in two methods, viz, using "ONIE Installer" or by using "sonic-installer tool".
"ONIE Installer" shall be used as explained in the [QuickStartGuide](#Quick-Start-Guide)
"sonic_installer" shall be used as given below.
"sonic-installer" shall be used as given below.
### 3.2.3.1 SONiC Installer
This is a command line tool available as part of the SONiC software; If the device is already running the SONiC software, this tool can be used to install an alternate image in the partition.
This tool has facility to install an alternate image, list the available images and to set the next reboot image.
**sonic_installer install**
**sonic-installer install**
This command is used to install a new image on the alternate image partition. This command takes a path to an installable SONiC image or URL and installs the image.
- Usage:
sonic_installer install <path>
sonic-installer install <path>
- Example:
```
admin@sonic:~$ sonic_installer install https://sonic-jenkins.westus.cloudapp.azure.com/job/xxxx/job/buildimage-xxxx-all/xxx/artifact/target/sonic-xxxx.bin
admin@sonic:~$ sonic-installer install https://sonic-jenkins.westus.cloudapp.azure.com/job/xxxx/job/buildimage-xxxx-all/xxx/artifact/target/sonic-xxxx.bin
New image will be installed, continue? [y/N]: y
Downloading image...
...100%, 480 MB, 3357 KB/s, 146 seconds passed
Expand Down Expand Up @@ -460,57 +460,57 @@ This command is used to install a new image on the alternate image partition. T
Done
```
**sonic_installer list**
**sonic-installer list**
This command displays information about currently installed images. It displays a list of installed images, currently running image and image set to be loaded in next reboot.
- Usage:
sonic_installer list
sonic-installer list
- Example:
```
admin@sonic:~$ sonic_installer list
admin@sonic:~$ sonic-installer list
Current: SONiC-OS-HEAD.XXXX
Next: SONiC-OS-HEAD.XXXX
Available:
SONiC-OS-HEAD.XXXX
SONiC-OS-HEAD.YYYY
```
**sonic_installer set_default**
**sonic-installer set_default**
This command is be used to change the image which can be loaded by default in all the subsequent reboots.
- Usage:
sonic_installer set_default <image_name>
sonic-installer set_default <image_name>
- Example:
```
admin@sonic:~$ sonic_installer set_default SONiC-OS-HEAD.XXXX
admin@sonic:~$ sonic-installer set_default SONiC-OS-HEAD.XXXX
```
**sonic_installer set_next_boot**
**sonic-installer set_next_boot**
This command is used to change the image that can be loaded in the *next* reboot only. Note that it will fallback to current image in all other subsequent reboots after the next reboot.
- Usage:
sonic_installer set_next_boot <image_name>
sonic-installer set_next_boot <image_name>
- Example:
```
admin@sonic:~$ sonic_installer set_next_boot SONiC-OS-HEAD.XXXX
admin@sonic:~$ sonic-installer set_next_boot SONiC-OS-HEAD.XXXX
```
**sonic_installer remove**
**sonic-installer remove**
This command is used to remove the unused SONiC image from the disk. Note that it's *not* allowed to remove currently running image.
- Usage:
sonic_installer remove <image_name>
sonic-installer remove <image_name>
- Example:
```
admin@sonic:~$ sonic_installer remove SONiC-OS-HEAD.YYYY
admin@sonic:~$ sonic-installer remove SONiC-OS-HEAD.YYYY
Image will be removed, continue? [y/N]: y
Updating GRUB...
Done
Expand Down
4 changes: 2 additions & 2 deletions doc/fwutil/fwutil.md
Original file line number Diff line number Diff line change
Expand Up @@ -940,15 +940,15 @@ During the sonic image upgrade, all available platform component firmware can be
```bash
PLATFORM_FW_UPDATE="/usr/bin/fwutil"
CURRENT_FW=`sonic_installer list |grep "Current" |awk '{print $2}'`
CURRENT_FW=`sonic-installer list |grep "Current" |awk '{print $2}'`
if grep -q aboot /host/machine.conf; then
TARGET_FW=`unzip -p /tmp/$FILENAME boot0 |grep -m 1 "image_name" |sed -n "s/.*image-\(.*\)\".*/\1/p"`
else
TARGET_FW=`cat -v /tmp/$FILENAME |grep -m 1 "image_version" | sed -n "s/.*image_version=\"\(.*\)\".*/\1/p"`
fi
sonic_installer install -y /tmp/$FILENAME || FAILED=1
sonic-installer install -y /tmp/$FILENAME || FAILED=1
sync;sync;sync || exit 14
Expand Down
2 changes: 1 addition & 1 deletion doc/kdump/SONiC-kdump.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Changes to be done in *sonic-buildimage/build_debian.sh*
- kdump is configured using the SONiC utility *config*.
- kdump status and configuration can be shown using the SONiC utility *show*.
- kdump is disabled by default.
- if kdump is enabled and a new SONiC image is installed using the *sonic_installer* command, kdump will be enabled in the new installed image.
- if kdump is enabled and a new SONiC image is installed using the *sonic-installer* command, kdump will be enabled in the new installed image.

### Configuration commands:

Expand Down
2 changes: 1 addition & 1 deletion doc/sonic-multi-architecture/sonic_arm_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Bootloader configuration for boot image details are also updated in platform.con
SONIC upgrade from SONIC uses python scripts to access bootloader configuration to update the boot image details, to support
image upgrade, image deletion, and change boot order.
For ARM Uboot firmware utilities is used to access boot configuration, as in grub for X86.
- sonic_installer/main.py
- sonic-installer/main.py

### Kernel ARM support

Expand Down
10 changes: 5 additions & 5 deletions doc/warm-reboot/code_implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ WARM_RESTART system enable false

## swss docker upgrade

`sonic_installer upgrade_docker` command line may be used to upgrade swss docker to a new docker image without affect data plane traffic.
`sonic-installer upgrade_docker` command line may be used to upgrade swss docker to a new docker image without affect data plane traffic.

```
sonic_installer upgrade_docker --help
Usage: sonic_installer upgrade_docker [OPTIONS] <container_name> <tag> URL
sonic-installer upgrade_docker --help
Usage: sonic-installer upgrade_docker [OPTIONS] <container_name> <tag> URL
Upgrade docker image from local binary or URL
Expand Down Expand Up @@ -71,7 +71,7 @@ docker-dhcp-relay latest cf68d734ec21
docker-dhcp-relay warm-reboot.0-dirty-20180709.225823 cf68d734ec21 2 days ago 293.1 MB
docker-router-advertiser latest 8e69dcfe794d 2 days ago 289.4 MB
docker-router-advertiser warm-reboot.0-dirty-20180709.225823 8e69dcfe794d 2 days ago 289.4 MB
root@sonic:~# sonic_installer upgrade_docker swss test_v03 docker-orchagent-brcm_v03.gz --cleanup_image
root@sonic:~# sonic-installer upgrade_docker swss test_v03 docker-orchagent-brcm_v03.gz --cleanup_image
New docker image will be installed, continue? [y/N]: y
Command: systemctl stop swss
Expand Down Expand Up @@ -123,7 +123,7 @@ docker-router-advertiser warm-reboot.0-dirty-20180709.225823 8e69dcfe794d



`systemctl restart swss` or ` sonic_installer upgrade_docker` won't affect data plane traffic and new provisioning works well.
`systemctl restart swss` or ` sonic-installer upgrade_docker` won't affect data plane traffic and new provisioning works well.

```
127.0.0.1:6379> keys WAR*
Expand Down
2 changes: 1 addition & 1 deletion doc/warm-reboot/open_issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Mandatory parameters: docker name, tag for new docker image, docker image pa

Ex.
```
sonic_installer upgrade_docker --cleanup_image swss swss_test_02 ./docker-orchagent-brcm_test_02.gz
sonic-installer upgrade_docker --cleanup_image swss swss_test_02 ./docker-orchagent-brcm_test_02.gz
```

More options are to be provided like whether to enforce stringent state check and validation.
Expand Down
4 changes: 2 additions & 2 deletions doc/ztp/SONiC-config-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ If a startup-config was not created as part of factory default, config-setup s

### 2.2.2 Config Migration

The user can use the *sonic_installer* utility to install a new version of SONiC firmware. As part of this procedure, sonic_installer takes a backup of all files in directory */etc/sonic* and copies them as */host/old_config*. Later when switch boots into the newly installed image, a file */tmp/pending_config_migration* is created by rc.local service and config-setup service makes note of it. The backed up files in /host/old_config are then restored to /etc/sonic directory and the restored startup-config file is loaded to Config DB.
The user can use the *sonic-installer* utility to install a new version of SONiC firmware. As part of this procedure, sonic-installer takes a backup of all files in directory */etc/sonic* and copies them as */host/old_config*. Later when switch boots into the newly installed image, a file */tmp/pending_config_migration* is created by rc.local service and config-setup service makes note of it. The backed up files in /host/old_config are then restored to /etc/sonic directory and the restored startup-config file is loaded to Config DB.



Expand Down Expand Up @@ -276,7 +276,7 @@ This command is executed as part of system bootup by the config-setup service. U

1. Install SONiC firmware image on an empty disk using ONIE or similar bare metal provisioning tool. Verify that a factory default configuration is created.
2. Delete startup-config and reboot the switch. Verify that a factory default configuration is created.
3. Install a new SONiC firmware image using "sonic_installer install" command and reboot the switch to boot into newly installed image. Verify that the startup-config file used in the old SONiC firmware is restored to be used by the new image.
3. Install a new SONiC firmware image using "sonic-installer install" command and reboot the switch to boot into newly installed image. Verify that the startup-config file used in the old SONiC firmware is restored to be used by the new image.
4. When ZTP is enabled, verify that the ZTP configuration is loaded when SONiC switch boots without startup-config. Factory default config does not get created in this case.
5. Verify that updategraph service takes over config creation role if it is enabled and SONiC switch boots without startup-config.
6. Verify that the user specified config-setup-factory hooks are executed when switch boots without a startup-config.
Expand Down
18 changes: 9 additions & 9 deletions doc/ztp/ztp.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ When configdb-json plugin is executed, the DHCP address assigned during ZTP disc

#### firmware

The *firmware* plugin is used for image management on a switch. It can be used to install, remove and boot selection of images. sonic_installer utility is used by this plugin to perform the supported functions.
The *firmware* plugin is used for image management on a switch. It can be used to install, remove and boot selection of images. sonic-installer utility is used by this plugin to perform the supported functions.

Example to install a new image and boot into it.

Expand Down Expand Up @@ -777,7 +777,7 @@ ZTP and updategraph can co-exist in the same SONiC image. However, for updategra

When a new SONiC image is installed, contents of */etc/sonic* directory are migrated to the newly installed directory. ZTP JSON and ZTP configuration files are also available to the new image as they are stored in */host/ztp* directory. If the image upgrade happened as part of a ZTP session in progress, after booting the new image, ZTP resumes from the point where it left of prior to image switchover. ZTP service waits for configuration migration to complete before taking any action. If after configuration migration, if */etc/sonic/config_db.json* file is not found, ZTP service creates a ZTP configuration that enables all in-band interfaces and performs DHCP discovery on them to obtain connectivity and resume processing the ZTP JSON file. This establishes connectivity to external hosts for provisioning to be completed.

There can also be a scenario where on a switch a ZTP is in completed (SUCCESS/FAILED) state. A new SONiC image is installed using *sonic_installer* upgrade tool and the user reboots the switch to boot into new image. In this scenario, contents of */host/ztp* and thus ZTP JSON, ZTP configuration file are accessible to the newly installed image. Since ZTP is in completed state, it will not run again. Only if */etc/sonic/config_db.json* file does not exist, ZTP service creates a ZTP configuration and starts the ZTP procedure afresh. It is up to the user to install configuration migration hooks to migrate changes to new image. More information is available in the [SONiC Configuration Setup Service](https://github.com/rajendra-dendukuri/SONiC/blob/config_setup/doc/ztp/SONiC-config-setup.md) design document.
There can also be a scenario where on a switch a ZTP is in completed (SUCCESS/FAILED) state. A new SONiC image is installed using *sonic-installer* upgrade tool and the user reboots the switch to boot into new image. In this scenario, contents of */host/ztp* and thus ZTP JSON, ZTP configuration file are accessible to the newly installed image. Since ZTP is in completed state, it will not run again. Only if */etc/sonic/config_db.json* file does not exist, ZTP service creates a ZTP configuration and starts the ZTP procedure afresh. It is up to the user to install configuration migration hooks to migrate changes to new image. More information is available in the [SONiC Configuration Setup Service](https://github.com/rajendra-dendukuri/SONiC/blob/config_setup/doc/ztp/SONiC-config-setup.md) design document.



Expand Down Expand Up @@ -1687,7 +1687,7 @@ python3-coverage html --omit="*_pytest*,*test_*,*pkg_resources*,*dist-packages/p
**Expected Result:**

- SONiC image is download and installed
- Use 'sonic_installer list' command to view if the new image has been installed
- Use 'sonic-installer list' command to view if the new image has been installed

**Additional Tests:**

Expand All @@ -1702,10 +1702,10 @@ python3-coverage html --omit="*_pytest*,*test_*,*pkg_resources*,*dist-packages/p
- Configuration section is marked as failed and ZTP is marked as failed
- set_default: true
- After downloading and installing the firmware image, the image is set as the image switch is going to boot on next reboot and every reboot after that unless modified
- Verify using 'sonic_installer list' command
- Verify using 'sonic-installer list' command
- set_next_boot: true
- After downloading and installing the firmware image, the image is set as the image switch is going to boot on next reboot. This is only for next reboot.
- Verify using 'sonic_installer list' command
- Verify using 'sonic-installer list' command
- pre-check script is used
- The pre-check script is downloaded and executed. If the program exit code is 0, download and install of firmware is performed. If the exit code is non-zero, download/install of firmware image is not performed
- Configuration section result is marked as SUCCESS.
Expand All @@ -1726,7 +1726,7 @@ python3-coverage html --omit="*_pytest*,*test_*,*pkg_resources*,*dist-packages/p
**Expected Result:**

- SONiC image with specified version is removed
- Use 'sonic_installer list' command to view if the new image version has been removed
- Use 'sonic-installer list' command to view if the new image version has been removed

**Additional Tests:**

Expand Down Expand Up @@ -2039,7 +2039,7 @@ python3-coverage html --omit="*_pytest*,*test_*,*pkg_resources*,*dist-packages/p

**Expected Results:**

- When sonic_installer installs the new firmware on the switch, it creates a backup copy of existing configuration files on the switch intended to be migrated when it boots into new image on reboot
- When sonic-installer installs the new firmware on the switch, it creates a backup copy of existing configuration files on the switch intended to be migrated when it boots into new image on reboot
- ZTP JSON file is also backed up along with these files
- Switch boots into new image and ZTP resumes provisioning from the configuration task after firmware installation.
- ZTP runs to completion
Expand All @@ -2061,12 +2061,12 @@ python3-coverage html --omit="*_pytest*,*test_*,*pkg_resources*,*dist-packages/p
**Test Steps:**

- Initiate a ZTP session and run to completion
- Install a new firmware image using 'sonic_installer' command line utility and set the switch to boot into this newly installed image on reboot
- Install a new firmware image using 'sonic-installer' command line utility and set the switch to boot into this newly installed image on reboot
- Reboot the switch

**Expected Results:**

- When sonic_installer installs the new firmware on the switch, it creates a backup copy of existing configuration files on the switch intended to be migrated when it boots into new image on reboot
- When sonic-installer installs the new firmware on the switch, it creates a backup copy of existing configuration files on the switch intended to be migrated when it boots into new image on reboot
- ZTP JSON file is also backed up along with these files and migrated to new image.
- Switch boots into new image and restarts ZTP using the ZTP JSON file that has been migrated.
- It is expected that a valid /etc/sonic/config_db.json file is created prior to installing firmware image and this provides connectivity to external entities for provisioning to proceed
Expand Down

0 comments on commit aed482c

Please sign in to comment.