Good afternoon!
I am very new with Python and Meraki API. I am using the Meraki module and I would like to take the output of say the current configuration of a switch port. Then take that data and make look a little easier on the eyes and only show fields that are being used. Here is what I currently
def menu_config_port():
clearconsole()
sw_sn = input ('\n' + 'Enter Switch Serial Number (xxxx-xxxx-xxxx): ')
port = input ('\n' + 'What port would you like to update? (1,2...48): ')
print ('\n' + 'Below is the current information for that port: ' + '\n')
API_KEY = <key>
dashboard = meraki.DashboardAPI(API_KEY, suppress_logging=True)
serial = (sw_sn)
port_id = (port)
response = dashboard.switch.getDeviceSwitchPort(serial, port_id)
print(response)
Response
{'portId': '1', 'name': '02-289 Phone', 'tags': [], 'enabled': True, 'poeEnabled': True, 'type': 'access', 'vlan': 442, 'voiceVlan': 90, 'allowedVlans': 'all', 'isolationEnabled': False, 'rstpEnabled': True, 'stpGuard': 'bpdu guard', 'linkNegotiation': 'Auto negotiate', 'portScheduleId': None, 'udld': 'Alert only', 'linkNegotiationCapabilities': ['Auto negotiate', '1 Gigabit full duplex (forced)', '100 Megabit (auto)', '100 Megabit half duplex (forced)', '100 Megabit full duplex (forced)', '10 Megabit (auto)', '10 Megabit half duplex (forced)', '10 Megabit full duplex (forced)'], 'accessPolicyType': 'Sticky MAC allow list', 'stickyMacAllowList': ['00:04:F2:7F:63:91'], 'stickyMacAllowListLimit': 1, 'daiTrusted': False, 'profile': {'enabled': False, 'id': '755478837491400755', 'iname': 'Human Resources_N_755478837491408550'}, 'module': {'model': None}, 'mirror': {'mode': 'Not mirroring traffic'}}
Don't need all this data just certain ones and would like to list form.
portId: 1
name: 02-289 Phone
etc.....
Any help would be greatly appriciated!
Thanks in Advance!