Merge "Set lower addr to avoid IP out of range"
This commit is contained in:
commit
367288e99a
|
@ -99,7 +99,15 @@ class PortForwardingTestCase(PortForwardingTestCaseBase):
|
||||||
self._set_router_gw(self.router['id'], self.ext_net['id'])
|
self._set_router_gw(self.router['id'], self.ext_net['id'])
|
||||||
self._add_router_interface(self.router['id'], self.subnet['id'])
|
self._add_router_interface(self.router['id'], self.subnet['id'])
|
||||||
self.fip = self._create_floatingip(self.ext_net['id'])
|
self.fip = self._create_floatingip(self.ext_net['id'])
|
||||||
self.port = self._create_port(self.fmt, self.net['id']).json['port']
|
# We choose an IP address in the middle of the subnet so
|
||||||
|
# tests that update the IP in the port,
|
||||||
|
# like test_concurrent_create_port_forwarding_update_port(),
|
||||||
|
# don't accidentally choose an invalid IP address in
|
||||||
|
# the subnet, like the broadcast address.
|
||||||
|
self.port = self._create_port(
|
||||||
|
self.fmt, self.net['id'],
|
||||||
|
fixed_ips=[{'subnet_id': self.subnet['id'],
|
||||||
|
'ip_address': '10.0.0.100'}]).json['port']
|
||||||
self.port_forwarding = {
|
self.port_forwarding = {
|
||||||
apidef.RESOURCE_NAME:
|
apidef.RESOURCE_NAME:
|
||||||
{apidef.EXTERNAL_PORT: 2225,
|
{apidef.EXTERNAL_PORT: 2225,
|
||||||
|
@ -441,6 +449,9 @@ class PortForwardingTestCase(PortForwardingTestCaseBase):
|
||||||
funcs, args_list)
|
funcs, args_list)
|
||||||
|
|
||||||
def test_concurrent_create_port_forwarding_update_port(self):
|
def test_concurrent_create_port_forwarding_update_port(self):
|
||||||
|
# The initial IP address of the port is in the middle of the
|
||||||
|
# subnet range, so adding 2 to it should also produce a
|
||||||
|
# valid IP address.
|
||||||
new_ip = str(
|
new_ip = str(
|
||||||
netaddr.IPAddress(self.port['fixed_ips'][0]['ip_address']) + 2)
|
netaddr.IPAddress(self.port['fixed_ips'][0]['ip_address']) + 2)
|
||||||
funcs = [self.pf_plugin.create_floatingip_port_forwarding,
|
funcs = [self.pf_plugin.create_floatingip_port_forwarding,
|
||||||
|
|
Loading…
Reference in New Issue