Revert "Prevent creation of subnet via RBAC during new network creation"
The policy rule to create subnets requires a target to make the policy check. This implementation does not provide a target, so is not a proper place to use the workflow policy checks. To do this, a more involved approach needs to be used that supplies a target. However, this will be challenging because the target is the network_id that has yet to be created.
This reverts commit 3befade141
.
Change-Id: I6af1cbd559034bd5635dfb4360b525714225677d
This commit is contained in:
parent
3befade141
commit
31d6e2d4dc
|
@ -200,7 +200,6 @@ class CreateSubnetInfoAction(workflows.Action):
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
name = _("Subnet")
|
name = _("Subnet")
|
||||||
policy_rules = (('network', 'create_subnet'),)
|
|
||||||
help_text = _('Creates a subnet associated with the network.'
|
help_text = _('Creates a subnet associated with the network.'
|
||||||
' You need to enter a valid "Network Address"'
|
' You need to enter a valid "Network Address"'
|
||||||
' and "Gateway IP". If you did not enter the'
|
' and "Gateway IP". If you did not enter the'
|
||||||
|
@ -363,7 +362,6 @@ class CreateSubnetDetailAction(workflows.Action):
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
name = _("Subnet Details")
|
name = _("Subnet Details")
|
||||||
policy_rules = (('network', 'create_subnet'),)
|
|
||||||
help_text = _('Specify additional attributes for the subnet.')
|
help_text = _('Specify additional attributes for the subnet.')
|
||||||
|
|
||||||
def __init__(self, request, context, *args, **kwargs):
|
def __init__(self, request, context, *args, **kwargs):
|
||||||
|
@ -588,7 +586,7 @@ class CreateNetwork(workflows.Workflow):
|
||||||
if not network:
|
if not network:
|
||||||
return False
|
return False
|
||||||
# If we do not need to create a subnet, return here.
|
# If we do not need to create a subnet, return here.
|
||||||
if not data.get('with_subnet'):
|
if not data['with_subnet']:
|
||||||
return True
|
return True
|
||||||
subnet = self._create_subnet(request, data, network, no_redirect=True)
|
subnet = self._create_subnet(request, data, network, no_redirect=True)
|
||||||
if subnet:
|
if subnet:
|
||||||
|
|
|
@ -38,6 +38,7 @@ class NetworksTable(tables.TableRegion):
|
||||||
|
|
||||||
class NetworksPage(basepage.BaseNavigationPage):
|
class NetworksPage(basepage.BaseNavigationPage):
|
||||||
DEFAULT_ADMIN_STATE = 'True'
|
DEFAULT_ADMIN_STATE = 'True'
|
||||||
|
DEFAULT_CREATE_SUBNET = True
|
||||||
DEFAULT_IP_VERSION = '4'
|
DEFAULT_IP_VERSION = '4'
|
||||||
DEFAULT_DISABLE_GATEWAY = False
|
DEFAULT_DISABLE_GATEWAY = False
|
||||||
DEFAULT_ENABLE_DHCP = True
|
DEFAULT_ENABLE_DHCP = True
|
||||||
|
@ -58,8 +59,9 @@ class NetworksPage(basepage.BaseNavigationPage):
|
||||||
def networks_table(self):
|
def networks_table(self):
|
||||||
return NetworksTable(self.driver, self.conf)
|
return NetworksTable(self.driver, self.conf)
|
||||||
|
|
||||||
def create_network(self, network_name, subnet_name=None,
|
def create_network(self, network_name, subnet_name,
|
||||||
admin_state=DEFAULT_ADMIN_STATE,
|
admin_state=DEFAULT_ADMIN_STATE,
|
||||||
|
create_subnet=DEFAULT_CREATE_SUBNET,
|
||||||
network_address=None, ip_version=DEFAULT_IP_VERSION,
|
network_address=None, ip_version=DEFAULT_IP_VERSION,
|
||||||
gateway_ip=None,
|
gateway_ip=None,
|
||||||
disable_gateway=DEFAULT_DISABLE_GATEWAY,
|
disable_gateway=DEFAULT_DISABLE_GATEWAY,
|
||||||
|
@ -68,7 +70,7 @@ class NetworksPage(basepage.BaseNavigationPage):
|
||||||
create_network_form = self.networks_table.create_network()
|
create_network_form = self.networks_table.create_network()
|
||||||
create_network_form.net_name.text = network_name
|
create_network_form.net_name.text = network_name
|
||||||
create_network_form.admin_state.value = admin_state
|
create_network_form.admin_state.value = admin_state
|
||||||
if subnet_name is None:
|
if not create_subnet:
|
||||||
create_network_form.with_subnet.unmark()
|
create_network_form.with_subnet.unmark()
|
||||||
else:
|
else:
|
||||||
create_network_form.switch_to(self.SUBNET_TAB_INDEX)
|
create_network_form.switch_to(self.SUBNET_TAB_INDEX)
|
||||||
|
|
|
@ -19,7 +19,7 @@ from openstack_dashboard.test.integration_tests.regions import messages
|
||||||
@decorators.services_required("neutron")
|
@decorators.services_required("neutron")
|
||||||
class TestNetworks(helpers.TestCase):
|
class TestNetworks(helpers.TestCase):
|
||||||
NETWORK_NAME = helpers.gen_random_resource_name("network")
|
NETWORK_NAME = helpers.gen_random_resource_name("network")
|
||||||
SUBNET_NAME = None
|
SUBNET_NAME = helpers.gen_random_resource_name("subnet")
|
||||||
|
|
||||||
def test_private_network_create(self):
|
def test_private_network_create(self):
|
||||||
"""tests the network creation and deletion functionalities:
|
"""tests the network creation and deletion functionalities:
|
||||||
|
@ -45,7 +45,3 @@ class TestNetworks(helpers.TestCase):
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
networks_page.find_message_and_dismiss(messages.ERROR))
|
networks_page.find_message_and_dismiss(messages.ERROR))
|
||||||
self.assertFalse(networks_page.is_network_present(self.NETWORK_NAME))
|
self.assertFalse(networks_page.is_network_present(self.NETWORK_NAME))
|
||||||
|
|
||||||
|
|
||||||
class TestAdminNetworks(helpers.AdminTestCase, TestNetworks):
|
|
||||||
SUBNET_NAME = helpers.gen_random_resource_name("subnet")
|
|
||||||
|
|
Loading…
Reference in New Issue