FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

hardware:junos:index.html



This is an old revision of the document!


Top#Hardware

Juniper Junos (junos.py)

$FHHOME/fabfile/junos.py


Operation

$ fab  -l |grep -F junos.
$ echo xx.xx.xx.xx | fab  auth.pro  junos.xxxx
$ fab  -H x.x.x.x auth.junospro  junos.cli junos.showsecuritynat

Ref. Remote Shell Commands

$ fab -H $HOST auth.junospro --set shell=False --no-pty -- "show configuration | display set | no-more"


junos.py

$FHHOME/fabfile/junos.py

import sys, os
from fabric.api import *
from fabric.contrib import files

env.eagerly_disconnect = False
FHHOME=os.environ["FHHOME"]

#================================================================================
# common
#================================================================================
#------------------------------------------------------------------
# junos.cli
#------------------------------------------------------------------
#@task
#def cli():
#    try:
#        run("cli", shell=False)
#    except Exception as e:
#        print e


#------------------------------------------------------------------
# junos. configure
#------------------------------------------------------------------
@task
def  configure():
    try:
        run(" configure", shell=False)
    except Exception as e:
        print e

#------------------------------------------------------------------
#junos.screen_length0
#------------------------------------------------------------------
@task
@runs_once
def screen_length0():
    """ set cli screen-length 0 """
    run("set cli screen-length 0", shell=False)


#------------------------------------------------------------------
#junos.show_configuration
#------------------------------------------------------------------
@task
def show_configuration():
    """show configuration | display set | no-more"""
    run("show configuration | display set | no-more", shell=False)


#------------------------------------------------------------------
#junos.show_policy
#------------------------------------------------------------------
@task
def show_policy():
    """show configuration | display set | no-more | match policy"""
    run("show configuration | display set | no-more | match policy", shell=False)


#------------------------------------------------------------------
#junos.show_security_nat
#------------------------------------------------------------------
@task
def show_security_nat():
    """show security nat | display set"""
    run("show security nat | display set", shell=False)







Top#Hardware



hardware/junos/index.html.1518539796.txt.gz ยท Last modified: 2018/02/14 01:36 by kurihara