Browse Source

Merge "[fullstack] find ip based on allocation_pool"

changes/68/694568/1
Zuul 3 weeks ago
parent
commit
058dd639a9
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      neutron/tests/fullstack/base.py

+ 7
- 1
neutron/tests/fullstack/base.py View File

@@ -133,7 +133,13 @@ class BaseFullStackTestCase(testlib_api.MySQLTestCaseMixin,
[netaddr.IPAddress(ip['ip_address'])
for port in ports for ip in port['fixed_ips']])
used_ips.add(netaddr.IPAddress(subnet['gateway_ip']))
valid_ips = netaddr.IPSet(netaddr.IPNetwork(subnet['cidr']))
# Note(lajoskatona): Suppose that we have 1 allocation pool for the
# subnet, that should be quite good assumption for testing.
valid_ip_pool = subnet['allocation_pools'][0]
valid_ips = netaddr.IPSet(netaddr.IPRange(
valid_ip_pool['start'],
valid_ip_pool['end'])
)
valid_ips = valid_ips.difference(used_ips)
if valid_ips.size < num:
self.fail("Cannot find enough free IP addresses.")

Loading…
Cancel
Save