Merge "Fix manual vip allocation tests" into stable/mitaka
This commit is contained in:
commit
ae4eca113f
@ -2826,19 +2826,3 @@ class FuelWebClient(object):
|
|||||||
logger.exception("Failed to run task {!r}".format(task_name))
|
logger.exception("Failed to run task {!r}".format(task_name))
|
||||||
if force_exc:
|
if force_exc:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@logwrap
|
|
||||||
def get_vip_info(self, cluster_id, vip_name='public'):
|
|
||||||
vip_data = self.client.get_vip_info_by_name(cluster_id, vip_name)
|
|
||||||
assert_true(vip_data, "Vip with name {} wasn't found".format(vip_name))
|
|
||||||
logger.debug("vip data is {}".format(vip_data[0]))
|
|
||||||
return vip_data[0]
|
|
||||||
|
|
||||||
@logwrap
|
|
||||||
def update_vip_ip(self, cluster_id, ip, vip_name='public'):
|
|
||||||
vip_data = self.get_vip_info(cluster_id, vip_name=vip_name)
|
|
||||||
vip_data['ip_addr'] = ip
|
|
||||||
vip_data['is_user_defined'] = True
|
|
||||||
vip_id = vip_data['id']
|
|
||||||
logger.debug("data to send {}".format(vip_data))
|
|
||||||
self.client.update_vip_ip(cluster_id, vip_id, vip_data)
|
|
||||||
|
@ -638,33 +638,9 @@ class NailgunClient(object):
|
|||||||
|
|
||||||
@logwrap
|
@logwrap
|
||||||
@json_parse
|
@json_parse
|
||||||
def get_vip_info(self, cluster_id):
|
def update_vip_ip(self, cluster_id, data):
|
||||||
"""Get all available vips.
|
return self.client.post("/api/clusters/{0}/network_configuration/ips/"
|
||||||
|
"vips".format(cluster_id), data)
|
||||||
:param cluster_id: Id of cluster.
|
|
||||||
:return: a decoded JSON response.
|
|
||||||
"""
|
|
||||||
return self.client.get("/api/clusters/{}/network_configuration/"
|
|
||||||
"ips/vips".format(cluster_id))
|
|
||||||
|
|
||||||
@logwrap
|
|
||||||
def get_vip_info_by_name(self, cluster_id, name):
|
|
||||||
"""Get vip data by its name.
|
|
||||||
|
|
||||||
:param cluster_id: Id of cluster.
|
|
||||||
:param name: Name of vip.
|
|
||||||
:return: vip info with specified name.
|
|
||||||
"""
|
|
||||||
vips_data = self.get_vip_info(cluster_id)
|
|
||||||
logger.debug("available vips are {}".format(vips_data))
|
|
||||||
vip_data = [vip for vip in vips_data if vip['vip_name'] == name]
|
|
||||||
return vip_data
|
|
||||||
|
|
||||||
@logwrap
|
|
||||||
@json_parse
|
|
||||||
def update_vip_ip(self, cluster_id, vip_id, data):
|
|
||||||
return self.client.put("/api/clusters/{0}/network_configuration/ips/"
|
|
||||||
"{1}/vips".format(cluster_id, vip_id), data)
|
|
||||||
|
|
||||||
@logwrap
|
@logwrap
|
||||||
@json_parse
|
@json_parse
|
||||||
|
@ -28,7 +28,7 @@ class ChangeVipManually(TestBasic):
|
|||||||
Contains tests on manual vip allocation
|
Contains tests on manual vip allocation
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@test(depends_on=[SetupEnvironment.prepare_slaves_9],
|
@test(depends_on=[SetupEnvironment.prepare_slaves_3],
|
||||||
groups=["change_public_vip"])
|
groups=["change_public_vip"])
|
||||||
@log_snapshot_after_test
|
@log_snapshot_after_test
|
||||||
def change_public_vip(self):
|
def change_public_vip(self):
|
||||||
@ -36,9 +36,9 @@ class ChangeVipManually(TestBasic):
|
|||||||
|
|
||||||
Scenario:
|
Scenario:
|
||||||
1. Create cluster
|
1. Create cluster
|
||||||
2. Add 3 node with controller role
|
2. Add 1 node with controller role
|
||||||
3. Add 2 node with compute role and 1 cinder node
|
3. Add 1 node with compute role and 1 cinder node
|
||||||
4. Change public vip value to the next ip address
|
4. Change public vip value to ip address from public range
|
||||||
5. Verify networks
|
5. Verify networks
|
||||||
6. Deploy the cluster
|
6. Deploy the cluster
|
||||||
7. Check that cluster public vip is the same we set manually
|
7. Check that cluster public vip is the same we set manually
|
||||||
@ -49,7 +49,7 @@ class ChangeVipManually(TestBasic):
|
|||||||
Snapshot change_public_vip
|
Snapshot change_public_vip
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.env.revert_snapshot("ready_with_9_slaves")
|
self.env.revert_snapshot("ready_with_3_slaves")
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'tenant': 'manualvip',
|
'tenant': 'manualvip',
|
||||||
@ -67,19 +67,24 @@ class ChangeVipManually(TestBasic):
|
|||||||
cluster_id,
|
cluster_id,
|
||||||
{
|
{
|
||||||
'slave-01': ['controller'],
|
'slave-01': ['controller'],
|
||||||
'slave-02': ['controller'],
|
'slave-02': ['compute'],
|
||||||
'slave-03': ['controller'],
|
'slave-03': ['cinder'],
|
||||||
'slave-04': ['compute'],
|
|
||||||
'slave-05': ['compute'],
|
|
||||||
'slave-06': ['cinder'],
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.show_step(4)
|
self.show_step(4)
|
||||||
ip = netaddr.IPAddress(
|
ip_to_set = str(
|
||||||
self.fuel_web.get_vip_info(cluster_id)['ip_addr'])
|
self.env.d_env.get_network(name='public').ip.subnet()[0][5])
|
||||||
ip_to_set = str(ip + 1)
|
logger.debug("public vip is going to be set to {}".format(ip_to_set))
|
||||||
logger.debug('ip to be set is {}'.format(ip_to_set))
|
public_vip_data = {'network': 2,
|
||||||
self.fuel_web.update_vip_ip(cluster_id, ip_to_set)
|
'vip_name': 'public',
|
||||||
|
'vip_namespace': 'haproxy',
|
||||||
|
'ip_addr': ip_to_set}
|
||||||
|
|
||||||
|
# TODO(ddmitriev): remove this 'disable' after moving to fuel-devops3.0
|
||||||
|
# pylint: disable=no-member
|
||||||
|
self.fuel_web.client.update_vip_ip(cluster_id, public_vip_data)
|
||||||
|
# pylint: enable=no-member
|
||||||
|
|
||||||
self.show_step(5)
|
self.show_step(5)
|
||||||
self.fuel_web.verify_network(cluster_id)
|
self.fuel_web.verify_network(cluster_id)
|
||||||
self.show_step(6)
|
self.show_step(6)
|
||||||
@ -96,7 +101,7 @@ class ChangeVipManually(TestBasic):
|
|||||||
|
|
||||||
self.env.make_snapshot("change_public_vip")
|
self.env.make_snapshot("change_public_vip")
|
||||||
|
|
||||||
@test(depends_on=[SetupEnvironment.prepare_slaves_9],
|
@test(depends_on=[SetupEnvironment.prepare_slaves_3],
|
||||||
groups=["change_public_vip_outside_range"])
|
groups=["change_public_vip_outside_range"])
|
||||||
@log_snapshot_after_test
|
@log_snapshot_after_test
|
||||||
def change_public_vip_outside_range(self):
|
def change_public_vip_outside_range(self):
|
||||||
@ -105,8 +110,8 @@ class ChangeVipManually(TestBasic):
|
|||||||
|
|
||||||
Scenario:
|
Scenario:
|
||||||
1. Create cluster
|
1. Create cluster
|
||||||
2. Add 3 node with controller role
|
2. Add 1 node with controller+ceph role
|
||||||
3. Add 2 node with compute role and 3 ceph nodes
|
3. Add 1 node with compute+ceph role and 1 ceph node
|
||||||
4. Reduce floating ip upper bound on
|
4. Reduce floating ip upper bound on
|
||||||
10 addresses
|
10 addresses
|
||||||
5. Change public vip to first not used public address
|
5. Change public vip to first not used public address
|
||||||
@ -119,7 +124,7 @@ class ChangeVipManually(TestBasic):
|
|||||||
Snapshot change_public_vip_outside_range
|
Snapshot change_public_vip_outside_range
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.env.revert_snapshot("ready_with_9_slaves")
|
self.env.revert_snapshot("ready_with_3_slaves")
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'tenant': 'outsiderangevip',
|
'tenant': 'outsiderangevip',
|
||||||
@ -141,14 +146,9 @@ class ChangeVipManually(TestBasic):
|
|||||||
self.fuel_web.update_nodes(
|
self.fuel_web.update_nodes(
|
||||||
cluster_id,
|
cluster_id,
|
||||||
{
|
{
|
||||||
'slave-01': ['controller'],
|
'slave-01': ['controller', 'ceph-osd'],
|
||||||
'slave-02': ['controller'],
|
'slave-02': ['compute', 'ceph-osd'],
|
||||||
'slave-03': ['controller'],
|
'slave-03': ['ceph-osd']
|
||||||
'slave-04': ['compute'],
|
|
||||||
'slave-05': ['compute'],
|
|
||||||
'slave-06': ['ceph-osd'],
|
|
||||||
'slave-07': ['ceph-osd'],
|
|
||||||
'slave-08': ['ceph-osd'],
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.show_step(4)
|
self.show_step(4)
|
||||||
@ -166,7 +166,16 @@ class ChangeVipManually(TestBasic):
|
|||||||
self.show_step(5)
|
self.show_step(5)
|
||||||
ip_to_set = str(floating_upper_range + 1)
|
ip_to_set = str(floating_upper_range + 1)
|
||||||
logger.debug('ip to be set is {}'.format(ip_to_set))
|
logger.debug('ip to be set is {}'.format(ip_to_set))
|
||||||
self.fuel_web.update_vip_ip(cluster_id, ip_to_set)
|
public_vip_data = {'network': 2,
|
||||||
|
'vip_name': 'public',
|
||||||
|
'vip_namespace': 'haproxy',
|
||||||
|
'ip_addr': ip_to_set}
|
||||||
|
|
||||||
|
# TODO(ddmitriev): remove this 'disable' after moving to fuel-devops3.0
|
||||||
|
# pylint: disable=no-member
|
||||||
|
self.fuel_web.client.update_vip_ip(cluster_id, public_vip_data)
|
||||||
|
# pylint: enable=no-member
|
||||||
|
|
||||||
self.show_step(6)
|
self.show_step(6)
|
||||||
self.fuel_web.verify_network(cluster_id)
|
self.fuel_web.verify_network(cluster_id)
|
||||||
self.show_step(7)
|
self.show_step(7)
|
||||||
|
Loading…
Reference in New Issue
Block a user