Created
April 4, 2018 18:36
-
-
Save tyler-8/50554899bf76e664c37cec67c5cd4a1d to your computer and use it in GitHub Desktop.
Revisions
-
tyler-8 created this gist
Apr 4, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ def parsePortList(portlist): """ Returns indexes of ports where VLAN is present. """ port_status = [] present_ports = [] for values in portlist: for i, bit in enumerate('{:08b}'.format(values)): bit = int(bit) if bit: port_status.append(True) else: port_status.append(False) for index, state in enumerate(port_status): if state: present_ports.append(index+1) return present_ports