Make sure that NeutronScenario implementation supports ipv4 and ipv6
Change-Id: I1da94316a462a7c1a18affe20d0708af8032e32f
This commit is contained in:
parent
726f343832
commit
6e915b3486
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
import random
|
||||
|
||||
from rally.common import cfg
|
||||
@ -34,7 +35,6 @@ LOG = logging.getLogger(__name__)
|
||||
class NeutronScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Neutron scenarios with basic atomic actions."""
|
||||
|
||||
SUBNET_IP_VERSION = 4
|
||||
# TODO(rkiran): modify in case LBaaS-v2 requires
|
||||
LB_METHOD = "ROUND_ROBIN"
|
||||
LB_PROTOCOL = "HTTP"
|
||||
@ -147,7 +147,8 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
|
||||
subnet_create_args["network_id"] = network_id
|
||||
subnet_create_args["name"] = self.generate_random_name()
|
||||
subnet_create_args.setdefault("ip_version", self.SUBNET_IP_VERSION)
|
||||
subnet_create_args["ip_version"] = netaddr.IPNetwork(
|
||||
subnet_create_args["cidr"]).version
|
||||
|
||||
return self.clients("neutron").create_subnet(
|
||||
{"subnet": subnet_create_args})
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
import netaddr
|
||||
|
||||
from rally import exceptions
|
||||
from rally_openstack.scenarios.neutron import utils
|
||||
@ -160,7 +161,7 @@ class NeutronScenarioTestCase(test.ScenarioTestCase):
|
||||
"subnet": {
|
||||
"network_id": network_id,
|
||||
"cidr": start_cidr,
|
||||
"ip_version": self.scenario.SUBNET_IP_VERSION,
|
||||
"ip_version": netaddr.IPNetwork(start_cidr).version,
|
||||
"name": self.scenario.generate_random_name.return_value
|
||||
}
|
||||
}
|
||||
@ -176,8 +177,9 @@ class NeutronScenarioTestCase(test.ScenarioTestCase):
|
||||
self.clients("neutron").create_subnet.reset_mock()
|
||||
|
||||
# Custom options
|
||||
extras = {"cidr": "192.168.16.0/24", "allocation_pools": []}
|
||||
mock_network_wrapper.generate_cidr.return_value = "192.168.16.0/24"
|
||||
extras = {"cidr": "2001::/64", "allocation_pools": []}
|
||||
extras["ip_version"] = netaddr.IPNetwork(extras["cidr"]).version
|
||||
mock_network_wrapper.generate_cidr.return_value = "2001::/64"
|
||||
subnet_data.update(extras)
|
||||
expected_subnet_data["subnet"].update(extras)
|
||||
self.scenario._create_subnet(network, subnet_data)
|
||||
@ -448,10 +450,6 @@ class NeutronScenarioTestCase(test.ScenarioTestCase):
|
||||
self._test_atomic_action_timer(self.scenario.atomic_actions(),
|
||||
"neutron.remove_gateway_router")
|
||||
|
||||
def test_SUBNET_IP_VERSION(self):
|
||||
"""Curent NeutronScenario implementation supports only IPv4."""
|
||||
self.assertEqual(4, utils.NeutronScenario.SUBNET_IP_VERSION)
|
||||
|
||||
def test_create_port(self):
|
||||
net_id = "network-id"
|
||||
net = {"network": {"id": net_id}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user