Remove routers_client from manager._create_subnet
This is to: 1. remove routers_client from manager._create_subnet because routers_client is not used for creating subnet. 2. rename _create_subnet to create_subnet for it is used by several testcases. Change-Id: I102c3b01abe0ae752196d27893d43e64acfb57a6
This commit is contained in:
parent
10973fb725
commit
5b0a52fa5d
|
@ -706,17 +706,14 @@ class NetworkScenarioTest(ScenarioTest):
|
|||
network['id'])
|
||||
return network
|
||||
|
||||
def _create_subnet(self, network, subnets_client=None,
|
||||
routers_client=None, namestart='subnet-smoke',
|
||||
**kwargs):
|
||||
def create_subnet(self, network, subnets_client=None,
|
||||
namestart='subnet-smoke', **kwargs):
|
||||
"""Create a subnet for the given network
|
||||
|
||||
within the cidr block configured for tenant networks.
|
||||
"""
|
||||
if not subnets_client:
|
||||
subnets_client = self.subnets_client
|
||||
if not routers_client:
|
||||
routers_client = self.routers_client
|
||||
|
||||
def cidr_in_use(cidr, tenant_id):
|
||||
"""Check cidr existence
|
||||
|
@ -1146,12 +1143,11 @@ class NetworkScenarioTest(ScenarioTest):
|
|||
router = self._get_router(client=routers_client,
|
||||
tenant_id=tenant_id)
|
||||
subnet_kwargs = dict(network=network,
|
||||
subnets_client=subnets_client,
|
||||
routers_client=routers_client)
|
||||
subnets_client=subnets_client)
|
||||
# use explicit check because empty list is a valid option
|
||||
if dns_nameservers is not None:
|
||||
subnet_kwargs['dns_nameservers'] = dns_nameservers
|
||||
subnet = self._create_subnet(**subnet_kwargs)
|
||||
subnet = self.create_subnet(**subnet_kwargs)
|
||||
if not routers_client:
|
||||
routers_client = self.routers_client
|
||||
router_id = router['id']
|
||||
|
|
|
@ -231,10 +231,10 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
|
|||
def _create_new_network(self, create_gateway=False):
|
||||
self.new_net = self._create_network()
|
||||
if create_gateway:
|
||||
self.new_subnet = self._create_subnet(
|
||||
self.new_subnet = self.create_subnet(
|
||||
network=self.new_net)
|
||||
else:
|
||||
self.new_subnet = self._create_subnet(
|
||||
self.new_subnet = self.create_subnet(
|
||||
network=self.new_net,
|
||||
gateway_ip=None)
|
||||
|
||||
|
|
|
@ -78,9 +78,9 @@ class TestGettingAddress(manager.NetworkScenarioTest):
|
|||
if dualnet:
|
||||
network_v6 = self._create_network()
|
||||
|
||||
sub4 = self._create_subnet(network=network,
|
||||
namestart='sub4',
|
||||
ip_version=4)
|
||||
sub4 = self.create_subnet(network=network,
|
||||
namestart='sub4',
|
||||
ip_version=4)
|
||||
|
||||
router = self._get_router()
|
||||
self.routers_client.add_router_interface(router['id'],
|
||||
|
@ -93,11 +93,11 @@ class TestGettingAddress(manager.NetworkScenarioTest):
|
|||
self.subnets_v6 = []
|
||||
for _ in range(n_subnets6):
|
||||
net6 = network_v6 if dualnet else network
|
||||
sub6 = self._create_subnet(network=net6,
|
||||
namestart='sub6',
|
||||
ip_version=6,
|
||||
ipv6_ra_mode=address6_mode,
|
||||
ipv6_address_mode=address6_mode)
|
||||
sub6 = self.create_subnet(network=net6,
|
||||
namestart='sub6',
|
||||
ip_version=6,
|
||||
ipv6_ra_mode=address6_mode,
|
||||
ipv6_address_mode=address6_mode)
|
||||
|
||||
self.routers_client.add_router_interface(router['id'],
|
||||
subnet_id=sub6['id'])
|
||||
|
|
Loading…
Reference in New Issue