Fix automatic subnet CIDR generation
This helps generating subnet masks by checking for
subnet masks already used from the same test class.
This also avoids having to check if a subnet with
conflicting subnet CIDR already exists treating
subnet error creation by looking in a local set
of already reserved CIDRs.
It fixes a problem that makes create_subnet
try to reuse the same CIDRs more than once
producing test failures.
It also allows methods to blank list some CIDRs
to avoid create_subnet from using it an therefore
avoid interferences.
Change-Id: I73e08a6832777d972990c3e68c582ef61568ad4e
diff --git a/neutron_tempest_plugin/scenario/test_trunk.py b/neutron_tempest_plugin/scenario/test_trunk.py
index 44f5ba7..77a2844 100644
--- a/neutron_tempest_plugin/scenario/test_trunk.py
+++ b/neutron_tempest_plugin/scenario/test_trunk.py
@@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import netaddr
from oslo_log import log as logging
from tempest.common import utils as tutils
from tempest.common import waiters
@@ -38,10 +37,6 @@
'dhclient $IFACE.%(tag)d"')
-def get_next_subnet(cidr):
- return netaddr.IPNetwork(cidr).next()
-
-
class TrunkTest(base.BaseTempestTestCase):
credentials = ['primary']
force_tenant_isolation = False
@@ -233,9 +228,7 @@
vlan_tag = 10
vlan_network = self.create_network()
- new_subnet_cidr = get_next_subnet(
- config.safe_get_config_value('network', 'project_network_cidr'))
- self.create_subnet(vlan_network, gateway=None, cidr=new_subnet_cidr)
+ self.create_subnet(vlan_network)
servers = [
self._create_server_with_port_and_subport(vlan_network, vlan_tag)