@classmethod
    def validate_network_group(cls, ng_data, ng_db, cluster,
                               admin_ranges=None):
        cidr = ng_data.get('cidr', ng_db.cidr)
        ip_ranges = ng_data.get(
            'ip_ranges',
            [(r.first, r.last) for r in ng_db.ip_ranges])

        release = ng_data.get('release', ng_db.get('release'))
        if release != ng_db.get('release'):
            raise errors.InvalidData('Network release could not be changed.')

        # values are always taken either from request or from DB
        meta = ng_data.get('meta', {})
        notation = meta.get('notation', ng_db.meta.get('notation'))
        use_gateway = meta.get('use_gateway',
                               ng_db.meta.get('use_gateway', False))
        gateway = ng_data.get('gateway', ng_db.get('gateway'))

        if use_gateway and not gateway:
            raise errors.InvalidData(
                "Flag 'use_gateway' cannot be provided without gateway")

        # Depending on notation required parameters must be either in
        # the request or DB
        if not ip_ranges and notation == consts.NETWORK_NOTATION.ip_ranges:
            raise errors.InvalidData(
                "No IP ranges were specified for network "
                "{0}".format(ng_db.id))

        if notation in (consts.NETWORK_NOTATION.cidr,
                        consts.NETWORK_NOTATION.ip_ranges):
            if not cidr and not ng_db.cidr:
                raise errors.InvalidData(
                    "No CIDR was specified for network "
                    "{0}".format(ng_db.id))
        nm = objects.Cluster.get_network_manager(cluster)
        ranges = cls._get_network_ip_ranges(ng_data, ng_db, notation,
                                            gateway is not None)
        is_admin_network = ng_db.name == consts.NETWORKS.fuelweb_admin
        if is_admin_network:
            if admin_ranges is not None:
                admin_ranges[ng_db.id] = ranges
        if (is_admin_network or cluster.status != consts.CLUSTER_STATUSES.new)\
           and cls._check_ips_out_of_ip_ranges(ng_db, nm, ranges):
            raise errors.InvalidData(
                "New IP ranges for network '{0}'({1}) do not cover "
                "already allocated IPs.".format(
                    ng_data['name'], ng_data['id']))

        return ng_data
The first argument is assumed to be the ``key`` for routing.
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/extensions/network_manager/validators/network.py/NetworkConfigurationValidator.validate_network_group--crossover with--dataset/ETHPy150Open disqus/nydus/nydus/db/routers/keyvalue.py/PartitionRouter._route