FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


hardware:cisco:index.html



Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hardware:cisco:index.html [2018/02/05 01:25]
kurihara [Ref. Remote Shell Commands]
hardware:cisco:index.html [2018/02/22 23:30] (current)
kurihara
Line 1: Line 1:
 [[:index.html#Hardware|Top#Hardware]] [[:index.html#Hardware|Top#Hardware]]
-====== Cisco (cisco.py)=====+====== Cisco Configuration with Fabric (cisco.py)=====
  
 $FHHOME/fabfile/cisco.py $FHHOME/fabfile/cisco.py
Line 6: Line 6:
 {{INLINETOC}} {{INLINETOC}}
 \\ \\
- +I use Fabric for simple tasks and repetitive tasks. 
-===== Operation =====+\\ 
 +===== Fabric Operation =====
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
Line 14: Line 15:
 </sxh> </sxh>
  
-==== Ref. Remote Shell Commands ====+\\ 
 +==== How to Check to Use Fabric in Cisco ====
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-echo xx.xx.xx.xx | fab auth.ciscopro --set shell=False --no-pty -- xxxxxx+ssh user01@xx.xx.xx.xx show version
 </sxh> </sxh>
 +
 +
 +/*
 +==== Fabric Remote Shell Commands ====
 +<sxh bash toolbar:false gutter:false>
 +$ fab -H $HOST auth.ciscopro --set shell=False --no-pty -- show interfaces status
 +</sxh>
 +*/
 +
  
 \\ \\
Line 29: Line 40:
 from fabric.contrib import files from fabric.contrib import files
  
 +env.eagerly_disconnect = False
 FHHOME=os.environ["FHHOME"] FHHOME=os.environ["FHHOME"]
 +
  
 #================================================================================ #================================================================================
Line 45: Line 58:
  
 #------------------------------------------------------------------ #------------------------------------------------------------------
-#cisco.termleng0 +#cisco.term_leng0 
 #------------------------------------------------------------------ #------------------------------------------------------------------
 @task @task
Line 55: Line 68:
  
 #------------------------------------------------------------------ #------------------------------------------------------------------
-#cisco.showrun+#cisco.sh_run
 #------------------------------------------------------------------ #------------------------------------------------------------------
 @task @task
-def showrun():+def sh_run():
     """show runnning-config"""     """show runnning-config"""
-    with hide('status', 'running''stdout'): +    run("show running-config"shell=False) 
-        running_config = run("show running-config", shell=False) + 
-    return running_config+ 
 +#------------------------------------------------------------------ 
 +#cisco.sh_int_status 
 +#------------------------------------------------------------------ 
 +@task 
 +def sh_int_status(): 
 +    """show interfaces status""" 
 +    run("show interfaces status", shell=False)
  
 </sxh> </sxh>


hardware/cisco/index.html.1517761517.txt.gz · Last modified: 2018/02/05 01:25 by kurihara