Add test floating IP test case with HA router
Change-Id: If06016168d24ca3344d8806716260b6da0451f75
This commit is contained in:
parent
30d604ffdb
commit
83a0fb2f42
|
@ -27,6 +27,7 @@ CirrosServerStackFixture = _cirros.CirrosServerStackFixture
|
|||
NetworkStackFixture = _neutron.NetworkStackFixture
|
||||
NetworkWithNetMtuWriteStackFixture = (
|
||||
_neutron.NetworkWithNetMtuWriteStackFixture)
|
||||
NetworkWithL3HAStackFixture = _neutron.NetworkWithL3HAStackFixture
|
||||
SecurityGroupsFixture = _neutron.SecurityGroupsFixture
|
||||
|
||||
ServerStackFixture = _nova.ServerStackFixture
|
||||
|
|
|
@ -63,7 +63,8 @@ class NetworkStackFixture(heat.HeatStackFixture):
|
|||
return None
|
||||
|
||||
@property
|
||||
def value_specs(self):
|
||||
def network_value_specs(self):
|
||||
"""Extra network creation parameters"""
|
||||
return {}
|
||||
|
||||
@property
|
||||
|
@ -71,6 +72,15 @@ class NetworkStackFixture(heat.HeatStackFixture):
|
|||
"""Floating IP network where the Neutron floating IPs are created"""
|
||||
return CONF.tobiko.neutron.floating_network
|
||||
|
||||
ha = False
|
||||
|
||||
@property
|
||||
def gateway_value_specs(self):
|
||||
value_specs = {}
|
||||
if self.has_l3_ha:
|
||||
value_specs.update(ha=(self.ha or False))
|
||||
return value_specs
|
||||
|
||||
@property
|
||||
def has_gateway(self):
|
||||
"""Whenever to setup gateway router"""
|
||||
|
@ -81,6 +91,11 @@ class NetworkStackFixture(heat.HeatStackFixture):
|
|||
"""Whenever can obtain network MTU value"""
|
||||
return neutron.has_networking_extensions('net-mtu')
|
||||
|
||||
@property
|
||||
def has_l3_ha(self):
|
||||
"""Whenever can obtain gateway router HA value"""
|
||||
return neutron.has_networking_extensions('l3-ha')
|
||||
|
||||
@property
|
||||
def network_details(self):
|
||||
return neutron.show_network(self.network_id)
|
||||
|
@ -136,12 +151,17 @@ class NetworkWithNetMtuWriteStackFixture(NetworkStackFixture):
|
|||
return CONF.tobiko.neutron.custom_mtu_size
|
||||
|
||||
@property
|
||||
def value_specs(self):
|
||||
value_specs = super(
|
||||
NetworkWithNetMtuWriteStackFixture, self).value_specs
|
||||
def network_value_specs(self):
|
||||
value_specs = super(NetworkWithNetMtuWriteStackFixture,
|
||||
self).network_value_specs
|
||||
return dict(value_specs, mtu=self.custom_mtu_size)
|
||||
|
||||
|
||||
@neutron.skip_if_missing_networking_extensions('l3-ha')
|
||||
class NetworkWithL3HAStackFixture(NetworkStackFixture):
|
||||
ha = True
|
||||
|
||||
|
||||
@neutron.skip_if_missing_networking_extensions('security-group')
|
||||
class SecurityGroupsFixture(heat.HeatStackFixture):
|
||||
"""Heat stack with some security groups
|
||||
|
|
|
@ -12,7 +12,7 @@ parameters:
|
|||
type: boolean
|
||||
default: false
|
||||
|
||||
value_specs:
|
||||
network_value_specs:
|
||||
description: Extra network creation parameters
|
||||
type: json
|
||||
default: {}
|
||||
|
@ -79,8 +79,18 @@ parameters:
|
|||
constraints:
|
||||
- custom_constraint: neutron.network
|
||||
|
||||
gateway_value_specs:
|
||||
description: Extra gateway router creation parameters
|
||||
type: json
|
||||
default: {}
|
||||
|
||||
has_net_mtu:
|
||||
description: whenever net mtu extension is available
|
||||
description: whenever net-mtu extension is available
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
has_l3_ha:
|
||||
description: whenever l3-ha extension is available
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
|
@ -108,6 +118,11 @@ conditions:
|
|||
has_net_mtu:
|
||||
get_param: has_net_mtu
|
||||
|
||||
has_l3_ha:
|
||||
and:
|
||||
- get_param: has_l3_ha
|
||||
- get_param: has_gateway
|
||||
|
||||
|
||||
resources:
|
||||
|
||||
|
@ -115,7 +130,7 @@ resources:
|
|||
type: OS::Neutron::Net
|
||||
properties:
|
||||
port_security_enabled: {get_param: port_security_enabled}
|
||||
value_specs: {get_param: value_specs}
|
||||
value_specs: {get_param: network_value_specs}
|
||||
|
||||
ipv4_subnet:
|
||||
type: OS::Neutron::Subnet
|
||||
|
@ -143,6 +158,7 @@ resources:
|
|||
properties:
|
||||
external_gateway_info:
|
||||
network: {get_param: gateway_network}
|
||||
value_specs: {get_param: gateway_value_specs}
|
||||
|
||||
ipv4_gateway_interface:
|
||||
type: OS::Neutron::RouterInterface
|
||||
|
|
|
@ -90,7 +90,7 @@ class FloatingIPTest(base.TobikoTest):
|
|||
"""Actual port security group"""
|
||||
return set(self.stack.outputs.security_groups)
|
||||
|
||||
# --- test net-mtu and net-mtu-writable extensions -----------------------
|
||||
# --- test net-mtu and net-mtu-writable extensions ------------------------
|
||||
|
||||
@neutron.skip_if_missing_networking_extensions('net-mtu')
|
||||
def test_ping_with_net_mtu(self):
|
||||
|
@ -113,6 +113,15 @@ class FloatingIPTest(base.TobikoTest):
|
|||
"""Actual MTU value for internal network"""
|
||||
return self.stack.network_stack.outputs.mtu
|
||||
|
||||
# --- test l3_ha extension ------------------------------------------------
|
||||
|
||||
@neutron.skip_if_missing_networking_extensions('l3-ha')
|
||||
def test_l3_ha(self):
|
||||
"""Test 'mtu' network attribute"""
|
||||
gateway = self.stack.network_stack.gateway_details
|
||||
self.assertEqual(self.stack.network_stack.ha,
|
||||
gateway['ha'])
|
||||
|
||||
|
||||
# --- Test with port security enabled -----------------------------------------
|
||||
|
||||
|
@ -222,3 +231,24 @@ class FloatingIpWithMtuWritableTest(FloatingIPTest):
|
|||
def expected_net_mtu(self):
|
||||
"""Expected MTU value for internal network"""
|
||||
return self.stack.network_stack.custom_mtu_size
|
||||
|
||||
|
||||
# --- Test la-h3 extension --------------------------------------------
|
||||
|
||||
@neutron.skip_if_missing_networking_extensions('l3-ha')
|
||||
class FloatingIPWithL3HAFixture(stacks.CirrosServerStackFixture):
|
||||
"""Heat stack for testing floating IP with a custom MTU network value"""
|
||||
|
||||
#: Heat stack for creating internal network with custom MTU value
|
||||
network_stack = tobiko.required_setup_fixture(
|
||||
stacks.NetworkWithL3HAStackFixture)
|
||||
|
||||
|
||||
@neutron.skip_if_missing_networking_extensions('l3-ha')
|
||||
@neutron.skip_if_missing_networking_agents(binary='neutron-l3-agent',
|
||||
count=2)
|
||||
class NetworkWithL3HATest(FloatingIPTest):
|
||||
"""Tests connectivity via floating IP with a custom MTU value"""
|
||||
|
||||
#: Resources stack with floating IP and Nova server
|
||||
stack = tobiko.required_setup_fixture(FloatingIPWithL3HAFixture)
|
||||
|
|
Loading…
Reference in New Issue