def check_vlan_ids_intersection(self):
        if self.cluster.network_config.configuration_template is not None:
            # TODO(akasatkin) checking of network templates to be considered
            return

        tagged_nets = dict((n["id"], n["vlan_start"]) for n in filter(
            lambda n: (n["vlan_start"] is not None), self.networks))

        # nothing to check
        if len(tagged_nets) < 2:
            return

        nodes_networks = \
            objects.Cluster.get_networks_to_interfaces_mapping_on_all_nodes(
                self.cluster)

        # first, group by hostname
        for node_name, data in groupby(nodes_networks, lambda x: x[0]):
            # then group by interface name for particular node
            for if_name, nic_nets in groupby(data, lambda x: x[1]):
                net_ids = [net_id
                           for _, _, net_id in nic_nets
                           if net_id in tagged_nets]
                if len(net_ids) < 2:
                    # no more than 1 tagged network is on the interface
                    continue
                vlan_ids = [tagged_nets[n] for n in net_ids]
                if len(set(vlan_ids)) < len(vlan_ids):
                    # some VLAN IDs are not unique for this interface
                    seen_vlan_ids = set()
                    duplicate_net_ids = set()
                    for idx in range(len(vlan_ids)):
                        if vlan_ids[idx] in seen_vlan_ids:
                            duplicate_net_ids.add(net_ids[idx])
                        seen_vlan_ids.add(vlan_ids[idx])
                    net_names = [net['name'] for net in self.networks
                                 if net['id'] in duplicate_net_ids]

                    err_msg = u"Node {0}, interface {1}: {2} networks use " \
                        u"the same VLAN tags. Different VLAN tags should be " \
                        u"assigned to the networks on the same interface.".\
                        format(node_name, if_name, ", ".join(net_names))
                    raise errors.NetworkCheckError(err_msg)
Networks VLAN IDs should not intersect for any node's interface.
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/extensions/network_manager/checker.py/NetworkCheck.check_vlan_ids_intersection