[c-nsp] What is the lowest latency switch?

Lincoln Dale ltd at cisco.com
Sun Mar 20 21:20:18 EDT 2011


On 20/03/2011, at 12:32 AM, Ziv Leyes wrote:

> I would love to see a fully functional shell cli on network devices that would allow us to gather information more effectively  using grep,awk,sed,etc...

speaking for NX-OS, you have all of awk/sed/grep/tr/wc/sort/uniq/diff already available and we've been pretty responsive in adding new types on request...

	ltd-n7010-1# show int eth1/1 | ?
	  cut      Print selected parts of lines.
	  diff     Show difference between current and previous invocation (creates
	           temp files: remove them with 'diff-clean' command and dont use it 
	           on commands with big outputs, like 'show tech'!) 
	  egrep    Egrep - print lines matching a pattern
	  grep     Grep - print lines matching a pattern
	  head     Display first lines
	  human    Output in human format
	  last     Display last lines
	  less     Filter for paging
	  no-more  Turn-off pagination for command output
	  section  Show lines that include the pattern as well as the subsequent lines
	           that are more indented than matching line 
	  sed      Stream Editor
	  sort     Stream Sorter
	  tr       Translate, squeeze, and/or delete characters
	  uniq     Discard all but one of successive identical lines
	  vsh      The shell that understands cli command
	  wc       Count words, lines, characters
	  xml      Output in xml format (according to .xsd definitions)
	  begin    Begin with the line that matches
	  count    Count number of lines
	  end      End with the line that matches
	  exclude  Exclude lines that match
	  include  Include lines that match

to give you an idea of the sorts of things possible, take this crazyness:
	ltd-n7010-1# show vpc brief | xml | grep vpc-ifindex | sed 's/<[^>]*>//g' | sed 's/^/conf t ; interface /' | sed 's/$/ ; no shut/'
		conf t ; interface          Po1 ; no shut
		conf t ; interface          Po2 ; no shut
	.. which can be used to script via EEM and/or TCL as an action to do those commands by adding a " | vsh" on the end

you can also take output from anything and redirect it off-box if you so wish to do so, e.g.:

	ltd-n7010-1# show int eth1/1 > ?
	  bootflash:  Destination filesystem path
	  ftp:        Destination filesystem path
	  scp:        Destination filesystem path
	  sftp:       Destination filesystem path
	  slot0:      Destination filesystem path
	  tftp:       Destination filesystem path
	  volatile:   Destination filesystem path

you can configure preshared ssh keys and execute commands from an external host via ssh, e.g.:

	lincoln-dales-macbook:~ lincolndale$ ssh ltd at ltd-n7010-1 "show int eth2/15"
	Ethernet2/15 is up
	  Hardware: 10000 Ethernet, address: 001b.54c1.4c66 (bia 001b.54c1.4c66)
	  MTU 1500 bytes, BW 10000000 Kbit, DLY 10 usec
	...

.. and taking it a step further, you can issue multiple commands from off-box if you so wish, e.g.:

	lincoln-dales-macbook:~ lincolndale$ ssh ltd at ltd-n7010-1 "conf t ; int eth2/15 ; shut ; show int eth2/15 | xml"
	<?xml version="1.0" encoding="ISO-8859-1"?>
	<nf:rpc-reply xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns="http://www.cisco.com/nxos:1.0:if_manager">
	 <nf:data>
	  <show>
	   <interface>
	       <TABLE_interface>
	        <ROW_interface>
	         <interface>Ethernet2/15</interface>
	         <state>down</state>
	         <state_rsn_desc>Administratively down</state_rsn_desc>
		[...]

there is also a scp-server in there if you wish to automate doing things using that.

in NX-OS we have done a lot of things to assist 'operators' based on clue and feedback.


cheers,

lincoln.





More information about the cisco-nsp mailing list