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.showconfiguration
#------------------------------------------------------------------
@task
def showconfiguration():
    """show configuration | display set | no-more"""
    run("show configuration | display set | no-more", shell=False)


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


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







Top#Hardware



hardware/junos/index.html.1518369224.txt.gz ยท Last modified: 2018/02/12 02:13 by kurihara