Hmm.. Played with this a bit, couldn't find what I wanted in the NCM tables, so I switched to NPM tables instead. This probably means to get complete reports you would need NPM to manage all interfaces that you're interested in. If you are ok with a single line per vlan, this report will work (ie: if a switchport has 5 vlans on it, it will have 5 lines in this report). Note no JOIN's in this report!!
SELECT NPIM.NodeVlan.Node.Caption, NPIM.Interface.IfName, VlanId
FROM Orion.NodePortInterfaceMap NPIM
WHERE NOT (NPIM.Interface.IfName = '') AND NOT (NPIM.NodeVlan.Node.Caption = '')
ORDER BY NPIM.NodeID, IfIndex, VlanId
This report you could easily modify to get all the ports on a given VLAN by changing the sort order.
To get this to look "neater" though (ie: all VLANS on a single line), you will have to go to full SQL I think. I know of no ways to aggregate multiple lines of a sub-query into a single column in SWQL. Here it is in SQL though...
SELECT DISTINCT ND.Caption, I.IfName,
STUFF((SELECT ',' + CAST (VlanID AS VarChar)
FROM NodePortInterfaceMap NPIM2
WHERE (NPIM2.NodeID = NPIM.NodeID) AND (NPIM2.PortID = NPIM.PortID)
FOR XML PATH('')), 1, 1, '') AS VLANS
FROM NodePortInterfaceMap NPIM
JOIN NodesData ND ON (NPIM.NodeID = ND.NodeID)
JOIN Interfaces I ON ((NPIM.NodeID = I.NodeID) AND (NPIM.IfIndex = I.InterfaceIndex))
WHERE NOT (I.IfName = '') AND NOT (ND.Caption = '')
ORDER BY ND.Caption, IfName
I can't think of a way to get this report to do all the ports on a VLAN and look good...
Let me know what you think?