Blog Viewer

Scripting How-To: Automate configuring Juniper factory default devices with PyEZ

By Erdem posted 02-22-2016 06:53

  

This applies to Python 2.6 or 2.7.

 

Overview


Configure Juniper devices that have factory default settings using PyEZ.

 

Description

Juniper devices that are running with factory default settings can only be configured through the serial console port. You can use the netconify Python script to connect to the serial console port and load a configuration file for the device.

 

Installing and Using netconify

 

To install  and use netconify on your system:

 

  1. Install pip on your system if it is not already present, to simplify the installation and upgrade of Python packages.
  2. Install netconify.
    host# pip install junos-netconify
  3. Create a junos configuration file on your system.
  4. Run the netconify utility with your configuration file.

Note: Use the netconify --help command to display full usage guidelines.

 

Example

This example telnets to port 23 on the srx1 Juniper device console port, loads a configuration file called srx1.conf, and commits this new configuration to the device.

 

[host@py-junos-netconify bin]$ ./netconify --telnet=srx1,23 -f srx1.conf
TTY:login:connecting to TTY:srx1:23 ...
TTY:login:logging in ...
TTY:login:starting NETCONF
conf:loading into device ...
conf:commit ... please be patient
conf:commit completed.
TTY:logout:logging out ...

 

 Related Links

 

 


#Python
#pyez
#How-To

Permalink