Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Use Junos PyEZ to Restore a Junos Device to the Factory-Default State

Use Junos PyEZ to restore a device running Junos OS or a device running Junos OS Evolved to its factory-default configuration settings.

The Junos PyEZ jnpr.junos.utils.sw.SW utility enables you to reset a Junos device to its factory-default state. The zeroize() method can reset:

  • All Routing Engines in a dual Routing Engine setup

  • The connected Routing Engine on a device running Junos OS

  • Routing Engines with VM host support

  • The connected member switch in a Virtual Chassis or Virtual Chassis Fabric (VCF)

    Note: We recommend that you remove and disconnect each member from the Virtual Chassis or VCF, and then zeroize each isolated switch individually.

When you execute the zeroize() method, Junos PyEZ executes the <request-system-zeroize> RPC on the target host. This operation removes all configuration information on the target Routing Engines and resets all key values on the device. The operation unlinks all user-created data files, including customized configuration and log files, from their directories. The device then reboots and reverts to the factory-default configuration. After you restore a device to the factory-default state, you must log in through the console as root in order to access the device.

For more information about the corresponding operational commands, see:

The following Junos PyEZ application uses the zeroize() method to reset all Routing Engines on the specified host.

How to Specify the Target Routing Engines

By default, the zeroize() method executes the operation on both Routing Engines in a dual Routing Engine setup. On devices running Junos OS, you can also perform the operation on just the connected Routing Engine. Junos OS Evolved and VM hosts, however, always zeroize both Routing Engines, and you cannot alter this behavior.

To specify the target Routing Engine on a device running Junos OS, include the all_re parameter. Table 1 summarizes the all_re values.

Table 1: Parameter to Specify the Target Routing Engines

Affected Routing Engines

all_re Parameter

All Routing Engines (default)

Omit or set to True

Only the connected Routing Engine (Junos OS only)

Set to False

For example, to zeroize all Routing Engines, omit the all_re argument or explicitly set all_re=True.

On devices running Junos OS, to zeroize only the Routing Engine to which the application is connected, include the all_re=False argument.

How to Zeroize a VM Host

On devices that have Routing Engines with VM host support, Junos OS runs as a virtual machine (VM) over a Linux-based host (VM host). The Junos PyEZ zeroize() method supports the vmhost argument, which enables you to zeroize a VM host. When you include vmhost=True, the system executes the <request-vmhost-zeroize> RPC, which corresponds to the request vmhost zeroize operational mode command.

The following example resets all Routing Engines on the VM Host to their factory-default state.

Change History Table

Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.

Release
Description
2.8.0
Starting in Junos PyEZ Release 2.8.0, the zeroize() method supports the vmhost argument. Include vmhost=True to reset Routing Engines with VM Host support to their factory-default state.