
Cisco IOS XR Training Page 35
© 2012 Jeffrey Fry FryGuy.Net
Now, let’s see what happens when we do a show int for that alias
RP/0/7/CPU0:R1#sh int r2connection
RP/0/7/CPU0:R1#sh int gig0/3/0/2
Mon Apr 16 15:24:00.745 UTC
GigabitEthernet0/3/0/2 is up, line protocol is up
<--- SNIP -
0 output buffer failures, 0 output buffers swapped out
5 carrier transitions
Pretty neat, but it gets better – we can actually configure that alias as
well!
RP/0/7/CPU0:R1#conf t
Mon Apr 16 15:24:06.626 UTC
RP/0/7/CPU0:R1(config)#int r2connection
RP/0/7/CPU0:R1(config)#int gig0/3/0/2
RP/0/7/CPU0:R1(config-if)#exit
RP/0/7/CPU0:R1(config)#exit
RP/0/7/CPU0:R1#
Now, there is another trick with IOS XR, and that is variables!
So, what can we do with Variables and Aliases? Well, if there is a command
that you use quite often – say show interface, why not change it to an alias
with a variable.
For this example, we will create sint (show interface) and use variable
(var1).
But first, let us look at what happens when you add a question mark (?) to
the end of the command in configuration mode:
RP/0/RSP0/CPU0:c21.lab(config)#alias sint ?
LINE Alias body with optional parameters e.g,(name) show $name
As you can see, it even tells you that you can use variables, might not be
obvious, that that is what (name) is.
So, let us create our alias:
RP/0/RSP0/CPU0:c21.lab(config)#alias sint (var1) show interface $var1
RP/0/RSP0/CPU0:c21.lab(config)#commit
RP/0/RSP0/CPU0:c21.lab(config)#
Now we can test it on Interface Bundle-Eth 100:
RP/0/RSP0/CPU0:c21.lab#sint(Bundle-Eth100)
RP/0/RSP0/CPU0:c21.lab#show interface Bundle-Eth100
Bundle-Ether100 is up, line protocol is up
Interface state transitions: 3
Hardware is Aggregated Ethernet interface(s), address is 6c9c.ed2d.0bab
Internet address is 157.238.206.3/31
MTU 1514 bytes, BW 20000000 Kbit (Max: 20000000 Kbit)
Commenti su questo manuale