def get_interfaces_dict(module):
 command = 'show interface status'
 try:
  body = execute_show_command(command, module)[0]
 except IndexError:
  body = {}
 interfaces = {'ethernet': [], 'svi': [], 'loopback': [], 'management': [], 'portchannel': [], 'nve': [], 'unknown': []}
 interface_list = body.get('TABLE_interface')['ROW_interface']
 for index in interface_list:
  intf = index['interface']
  intf_type = get_interface_type(intf)
  interfaces[intf_type].append(intf)
 return interfaces

def get_interfaces_dict ( module ) : command = 'show interface status' try : body = execute_show_command ( command , module ) [ 0 ] except IndexError : body = { } interfaces = { 'ethernet' : [ ] , 'svi' : [ ] , 'loopback' : [ ] , 'management' : [ ] , 'portchannel' : [ ] , 'nve' : [ ] , 'unknown' : [ ] } interface_list = body . get ( 'TABLE_interface' ) [ 'ROW_interface' ] for index in interface_list : intf = index [ 'interface' ] intf_type = get_interface_type ( intf ) interfaces [ intf_type ] . append ( intf ) return interfaces
gets all active interfaces on a given switch returns: dictionary with interface type as the keys .