cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1812
Views
0
Helpful
1
Replies

How to get 'show flogi database' output of Fabric Interconnect from Python ucsmsdk

Guru Prasad
Level 1
Level 1
Hi All,

I have been using Python sdk of UCS, ucsmsdk for managing fi operations.

But i could not find the appropriate one for the 'show flogi database' output.

Looked at all mometa classes. But could not find it. 

Please let me know if the same is available under any name.

Thanks

1 Reply 1

Sergiu.Daniluk
VIP Alumni
VIP Alumni

Hi @Guru Prasad 

ucsmsdk only access the managed objects, the ones configurable through UCS Manager GUI, so you cannot get "show flogi database" or "show mac address-table". However you can alternatively you can use use netmiko:

from netmiko import ConnectHandler

fi = {
'device_type': 'cisco_nxos',
'ip': 'ip',
'username': 'u',
'password': 'p'
}
connect = ConnectHandler(**fi)
connect.send_command('connect nxos a', expect_string=r"#")
output = connect.send_command('show mac address')
print(output)
output = connect.send_command('show npv flogi')
print(output)
  

You will need to parse the output, but is a beginning. :-) because the output is having a static structure, you can try using TextFSM for parsing. https://codingnetworker.com/2015/08/parse-cli-outputs-textfsm/ 

Hope it helps,

Sergiu