

def test_assign_vip_in_correct_node_group(self):
    cluster = self.env.create(release_kwargs={
        'version': 'test-8.0',
    }, cluster_kwargs={
        'api': False,
    })
    self.env.create_node(cluster_id=cluster.id, pending_roles=['controller'])
    self.env.create_node(cluster_id=cluster.id, pending_roles=['compute'])
    group_id = self.env.create_node_group(cluster_id=cluster.id).json_body['id']
    cluster.nodes[1].group_id = group_id
    management_net = self.db.query(models.NetworkGroup).filter_by(group_id=group_id, name=consts.NETWORKS.management).first()
    management_net.ip_ranges = [models.IPAddrRange(first='10.42.0.2', last='10.42.0.10')]
    nrm = {
        'id': 'mymgmt/vip',
        'default_mapping': consts.NETWORKS.management,
        'properties': {
            'subnet': True,
            'gateway': False,
            'vip': [{
                'name': 'my-vip',
                'node_roles': ['compute'],
            }],
        },
    }
    cluster.release.network_roles_metadata.append(nrm)
    self.db.flush()
    self.env.neutron_networks_put(cluster.id, {
        
    })
    nm = objects.Cluster.get_network_manager(cluster)
    nm.assign_vips_for_net_groups(cluster)
    resp = self.env.neutron_networks_get(cluster.id)
    self.assertEqual(200, resp.status_code)
    ipaddr = resp.json_body['vips']['my-vip']['ipaddr']
    self.assertEqual('10.42.0.2', ipaddr)

dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/integration/test_network_configuration.py TestNeutronNetworkConfigurationHandler.test_assign_vip_in_correct_node_group/original