I have a structure sw_list formatted as given below
{'ports': [{'hw_addr': 'ee:b1:ab:b1:0e:a0', 'name': 's1-eth1', 'port_no': '00000001', 'dpid': '0000000000000201'},
{'hw_addr': 'f6:83:4d:e4:41:7d', 'name': 's1-eth2', 'port_no': '00000002', 'dpid': '0000000000000201'}
], 'dpid': '0000000000000201'}
for index,switch in enumerate(sw_list):
dpid_str = dpid_to_str(switch.dp.id)
The above loop will print dpid_str which is '0000000000000201' ath the end of the structure. Now I want to access the contents of ports structure such as
Port 0: hw_addr,name,port_no etc
How do I do that?
sw_listis not actually alistbut rather adict? Also, what is the dangling)at the end supposed to close?