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

Automation script

sas2k3001
Level 1
Level 1

Hello,

 

Is it possible to run the script with the command? 

 

show int g0/0.(variable from VLAN list)

I need to take details of more than 4000 sub interfaces

?

 

Thanks

3 Replies 3

Jon Marshall
Hall of Fame
Hall of Fame

 

Not much detail to go on ie. what are you using to connect to the device etc. 

 

I use Python and Netmiko so if I was doing it I would probably just do a "sh run" on the device and then parse the output grabbing the information I needed from each interface but like I say you don't really give much detail. 

 

Jon

Hi @Jon Marshall 

 

I connecting with SSH to the device.

inderdeeps
Level 4
Level 4

@sas2k3001 : Check this out 

targets = []
for m1 in re.finditer("(GigabitEthernet\d.\d.\d+).*?buffers swapped out", cli_input, re.DOTALL):
        m2 = re.search("(?P<interface>GigabitEthernet\d.\d.\d+).*Last input never", m1.group(0), re.DOTALL)
        if m2:
            targets.append(m2.group("interface"))

print(targets)