Came across this while searching for a posting in the Hub. Below is a quick script that sounds like what you wanted.
Starting with 15.6.2 or 15.7.1, you could use the following script:
#!/usr/bin/env python
import exsh
import json
FORMAT = '{prt:<8.8} {vlanType}:{tagged}'
print FORMAT.format(prt='Port', vlanType='untagged',tagged='tagged')
portRslt = exsh.clicmd('debug cfgmgr show next vlan.show_ports_info format portList=* port=None', True)
portDict = json.loads(portRslt)
for row in portDict['data']:
port = row['port']
vlanRslt = json.loads(exsh.clicmd('debug cfgmgr show next vlan.show_ports_info_detail_vlans formatted port={0} vlanIfInstance=None'.format(port), True))
taggedVlan = []
untaggedVlan = []
for vlanRow in vlanRslt['data']:
vid = vlanRow.get('vlanId',None)
if vlanRow['tagStatus'] == '1':
if vid:
taggedVlan.append(vid)
else:
if vid:
untaggedVlan.append(vid)
if len(untaggedVlan) == 0 and len(taggedVlan) == 0:
print FORMAT.format(prt=port, vlanType='none', tagged='')
if len(untaggedVlan):
print FORMAT.format(prt=port, vlanType='untagged', tagged=', '.join(untaggedVlan))
port=''
if len(taggedVlan):
print FORMAT.format(prt=port, vlanType='tagged', tagged=', '.join(taggedVlan))
The output looks like:
X460G2-24t-10G4.35 # run script portvlan.py
Port untagged:tagged
1 untagged:1
tagged:10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
2 untagged:1
tagged:10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
3 untagged:1
tagged:10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
4 untagged:1
tagged:10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
5 untagged:1
tagged:10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
6 untagged:1
7 untagged:1
8 untagged:1
9 untagged:1
10 untagged:1
11 untagged:1
12 untagged:1
13 untagged:1
14 untagged:1
15 untagged:1
16 untagged:1
17 untagged:1
18 untagged:1
19 untagged:1
20 untagged:1
21 untagged:1
22 untagged:1
23 untagged:1
24 untagged:1
25 untagged:1
26 untagged:1
27 untagged:1
28 untagged:1
29 untagged:1
30 untagged:1
31 untagged:1
32 untagged:1
33 untagged:1
34 untagged:1