cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1286
Views
0
Helpful
3
Replies

How to receive 2 or more IP from interface ???

Oleg Gnedykh
Level 1
Level 1
!Buenas deas Amigos! I want to get from interface all IP addresses. For example I have vlan xx sh run int vlan xx interface VlanXX ip address 172.16.1.1 255.255.255.0 secondary ip address 10.10.10.1 255.255.255.0 secondary ip address 192.168.1.1 255.255.255.0 I have created EEM Applet event manager applet getip event none sync yes action 1.0 cli command "enable" action 2.0 cli command "sh run int vlan 11" action 2.2 regexp "ip address ([0-9\.]+)" "$_cli_result" _match _ipadd action 2.3 puts "$_ipadd" So I have got ONLY FIRST IP address 172.16.1.1 Dear ALL help me PUTS all addresses from the script . PLEASEeeeee
1 Accepted Solution

Accepted Solutions

You can iterate:

 

action 2.1 foreach line $_cli_result "\n"

action 2.2 regexp "ip address ([0-9\.]+)" "$_cli_result" match ipadd

action 2.3 if $_regexp_result eq 1

action 2.4 puts $ipadd

action 2.5 end

action 2.6 end

View solution in original post

3 Replies 3

Oleg Gnedykh
Level 1
Level 1

Sorry Its stupid Cisco BUG !

Buenas deas Amigos!

I want to get from interface all IP addresses.

For example I have vlan xx

   sh run int vlan xx

   interface VlanXX

   ip address 172.16.1.1 255.255.255.0 secondary

   ip address 10.10.10.1 255.255.255.0 secondary

   ip address 192.168.1.1 255.255.255.0

I have created EEM Applet

    event manager applet getip

      event none sync yes

      action 1.0 cli command "enable"

      action 2.0 cli command "sh run int vlan 11"

      action 2.2 regexp "ip address ([0-9\.]+)" "$_cli_result" _match _ipadd

      action 2.3 puts "$_ipadd"

So I have got ONLY FIRST IP address 172.16.1.1

Dear ALL help me PUTS all addresses from the script . PLEASEeeeee

 

You can iterate:

 

action 2.1 foreach line $_cli_result "\n"

action 2.2 regexp "ip address ([0-9\.]+)" "$_cli_result" match ipadd

action 2.3 if $_regexp_result eq 1

action 2.4 puts $ipadd

action 2.5 end

action 2.6 end

Thank you Joseph !!!

The key "\n" is wonderful  :-)

I attempted to use "foreach" but without "\n"

Review Cisco Networking for a $25 gift card