# Path: wiremaps/collector/datastore.py
# class LocalVlan(Vlan):
#     implements(ILocalVlan)


from wiremaps.collector.datastore import LocalVlan

    def __init__(self, equipment, proxy, normPort=None):
        self.proxy = proxy
        self.equipment = equipment
        self.normPort = normPort

    def gotVlan(self, results, dic):
        """Callback handling reception of VLAN

        @param results: vlan names or ports
        @param dic: where to store the results
        """
        for oid in results:
            vid = int(oid.split(".")[-1])
            dic[vid] = results[oid]

    def completeEquipment(self):
        """Complete C{self.equipment} with collected data"""
        for vid in self.vlanNames:
            if vid in self.vlanPorts:
                for i in range(0, len(self.vlanPorts[vid])):
                    if ord(self.vlanPorts[vid][i]) == 0:
                        continue
                    for j in range(0, 8):
                        if ord(self.vlanPorts[vid][i]) & (1 << j):
                            port = 8-j + 8*i
                            if self.normPort is not None:
                                port = self.normPort(port)
                            if port is not None:
                                self.equipment.ports[port].vlan.append(

# Path: wiremaps/collector/datastore.py
# class LocalVlan(Vlan):
#     implements(ILocalVlan)


# Path: wiremaps/collector/helpers/vlan.py
from wiremaps.collector.datastore import LocalVlan


    def __init__(self, equipment, proxy, normPort=None):
        self.proxy = proxy
        self.equipment = equipment
        self.normPort = normPort

    def gotVlan(self, results, dic):
        """Callback handling reception of VLAN

        @param results: vlan names or ports
        @param dic: where to store the results
        """
        for oid in results:
            vid = int(oid.split(".")[-1])
            dic[vid] = results[oid]

    def completeEquipment(self):
        """Complete C{self.equipment} with collected data"""
        for vid in self.vlanNames:
            if vid in self.vlanPorts:
                for i in range(0, len(self.vlanPorts[vid])):
                    if ord(self.vlanPorts[vid][i]) == 0:
                        continue
                    for j in range(0, 8):
                        if ord(self.vlanPorts[vid][i]) & (1 << j):
                            port = 8-j + 8*i
                            if self.normPort is not None:
                                port = self.normPort(port)
                            if port is not None:
                                self.equipment.ports[port].vlan.append(

                                    LocalVlan(vid, self.vlanNames[vid] or "VLAN %d" % vid))