Can we use Attributes between cisco statements?
See original GitHub issueHi Ktbyers,
Am trying something out here and doesnt seem to work. Maybe am doing something wrong or its simply not possible. What am trying to do is when a user select a vlan from the “vlans” list. That vlan name will be put in the cisco statements:
con = net_connect.send_command_expect(‘show interfaces status | count’, vlan, ‘* connected’)
vlan Will be the vlan selected by the user from the list.
`from netmiko import ConnectHandler
from getpass import getpass
from netmiko.ssh_exception import NetMikoTimeoutException
from netmiko.ssh_exception import NetMikoAuthenticationException
from netmiko.ssh_exception import SSHException
vlans = ['CHEESE', 'HAM', 'COOKIE', 'CANDY', 'WATER', 'COLA']
print(vlans)
number = input('Select VLAN [0-6]: ')
if number =='0':
vlan = print(vlans[0])
elif vlan =='1':
vlan = print(vlans[1])
elif vlan =='2':
vlan = print(vlans[2])
elif vlan =='3':
vlan = print(vlans[3])
elif vlan =='4':
vlan = print(vlans[4])
elif vlan =='5':
vlan = print(vlans[5])
else:
print('That option is not available!')
def vlan_stats():
con = net_connect.send_command_expect('show interfaces status | count', vlan, '* connected')
notcon = net_connect.send_command_expect('show interfaces status | count', vlan, '* notconnect')
ports = net_connect.send_command_expect('show interfaces status | count ', vlan)
print('CON / NOTCON / SIZE:', con.strip(',Number of lines which match regexp = '),
notcon.strip(',Number of lines which match regexp = '),
ports.strip(',Number of lines which match regexp = '))`
Hope to hear from you!
Best regards Arpanet86
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
RADIUS Attributes Configuration Guide - Cisco
A dictionary file provides a list of attributes that are dependent on which attributes your NAS supports. However, you can add your own...
Read more >Managing Resources [Cisco Identity Services Engine]
Cisco ISE allows you to create, edit, and delete user-defined dictionaries and dictionary attributes that you can use in policy conditions.
Read more >Configuring Authorization Policies [Cisco Identity Services ...
Profiles consist of attributes chosen from a set of resources, which are stored in a dictionary and these are returned when the compound...
Read more >Cisco IOS XR Routing Configuration Guide for the Cisco CRS ...
A routing policy instructs the router to inspect routes, filter them, and potentially modify their attributes as they are accepted from a peer, ......
Read more >Understanding BGP MED Attribute - Cisco
When a BGP speaker learns a route from a peer, the route's MED is passed to ... For easy convention, IP addresses in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
a comma is not used for concatenating strings. you are now doing this:
replace it with:
Yeah got that figured out. I really like the F string method.
Thanks for the help guys! Am closing this ticket.