Juniper/py-junos-netconify

Name: py-junos-netconify

Owner: Juniper Networks

Description: Junos console/bootstrap automation Python module

Created: 2014-01-09 01:30:32.0

Updated: 2018-03-14 22:39:40.0

Pushed: 2017-04-21 15:18:20.0

Homepage: null

Size: 194

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

The repo is under active development. If you take a clone, you are getting the latest, and perhaps not entirely stable code.

ABOUT

Junos console/bootstrap New-Out-Of-Box (NOOB) configuration automation.

There are times when you MUST console into a Junos device to perform the NOOB configuration. Generally this configuration is the bare minimum in takes to:

The general use-case:

Primarily this library is used as a Console driver for the Junos Ansible Modules.

The netconify utility can be used perform configuration by logging into the serial console and pushing a configuration file to the device.

USAGE
e: netconify [-h] [--version] [-f JUNOS_CONF_FILE] [--merge] [--qfx-node]
             [--qfx-switch] [--zeroize] [--shutdown {poweroff,reboot}]
             [--facts] [--srx_cluster REQUEST_SRX_CLUSTER]
             [--srx_cluster_disable] [-S [SAVEDIR]] [--no-save] [-p PORT]
             [-b BAUD] [-t TELNET] [ -s SSH] [--timeout TIMEOUT] [-u USER]
             [-P PASSWD] [-k] [-a ATTEMPTS]
             [name]

tional arguments:
me                  name of Junos device

onal arguments:
, --help            show this help message and exit
version             show program's version number and exit
verbose VERBOSE     increase verbose levevel: 0 = default, 1 = login
                    debug, 2 = rpc reply debug

CE options:
 JUNOS_CONF_FILE, --file JUNOS_CONF_FILE
                    Junos configuration file
merge               load-merge conf file, default is overwrite
qfx-node            Set QFX device into "node" mode
qfx-switch          Set QFX device into "switch" mode
zeroize             ZEROIZE the device
shutdown {poweroff,reboot}
                    SHUTDOWN or REBOOT the device
facts               Gather facts and save them into SAVEDIR
srx_cluster REQUEST_SRX_CLUSTER
                    cluster_id,node ... Invoke cluster on SRX device and
                    reboot
srx_cluster_disable
                    Disable cluster mode on SRX device and reboot

CTORY options:
 [SAVEDIR], --savedir [SAVEDIR]
                    Files are saved into this directory, $CWD by default
no-save             Do not save facts and inventory files

OLE options:
 PORT, --port PORT  serial port device
 BAUD, --baud BAUD  serial port baud rate
 SSH, --ssh SSH     ssh server, <host>,<port>,<user>,<password>
 TELNET, --telnet TELNET
                    terminal server, <host>,<port>
timeout TIMEOUT     TTY connection timeout (s)

N options:
 USER, --user USER  login user name, defaults to "root"
 PASSWD, --passwd PASSWD
                    login user password, *empty* for NOOB
                    prompt for user password
 ATTEMPTS, --attempts ATTEMPTS
                    login attempts before giving up
EXAMPLE

Junos NOOB devices can netconified:

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

The above example is connecting to the host via telnet on port 23 and loading the configuration file specified.

SSH:
0r@r2600r-mbp15 [~]netconify --facts --ssh=console-server,19876,c-user,pass123 -u user --passwd "pass123"
login:connecting to TTY:console-server:19876:c-user:pass123 ...
login:logging to device ...
login: OK ... starting NETCONF
s:retrieving device facts...
s:saving: ./cfwj-lab1-0011a-facts.json
ntory:saving: ./cfwj-lab1-0011a-inventory.xml
logout:logging out ...

The above example is connecting to the host via ssh on port 19876 and gather device facts. Additonal options such as serial connectivity and device specific functions are identified in Usage. If ssh username and password for console are omited, -u/–passwd will be used instead for both console server authetication and device authetication –ssh=console-server,19876,, -u user –passwd “pass123”

INSTALLATION

Installation requires Python 2.6 or 2.7 and associate pip tool

pip install junos-netconify

Installing from Git is also supported (OS must have git installed).

To install the latest MASTER code
pip install git+https://github.com/Juniper/py-junos-netconify.git
-or-
To install a specific version, branch, tag, etc.
pip install git+https://github.com/Juniper/py-junos-netconify.git@<branch,tag,commit>
UPGRADE

Upgrading has the same requirements as installation and has the same format with the addition of -UPGRADE

pip install -U junos-netconify
DEPENDENCIES

This has been tested with Python 2.6 and 2.7. The required modules are defined in setup.py.

LICENSE

Apache 2.0

CONTRIBUTORS

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.