Commit Graph

28 Commits

Author SHA1 Message Date
Hang Yang c7ea66bc3e Support RBAC security groups in dashboard
Get the RBAC shared security groups in the dashboard by making
an additional Neutron API call to filter by the shared field. Currently,
the dashboard only shows SGs owned by the tenant.

Depends-On: https://review.opendev.org/c/openstack/neutron/+/811242
Closes-Bug: #1907843
Change-Id: Ifa1acb3f0f6a33d0b4dc3761674e561a8d24c5c2
2021-10-18 15:27:35 -05:00
Zuul 1a4d4d2c31 Merge "security_groups panel: Add neutron policy enforcement" 2021-02-18 05:49:18 +00:00
YuehuiLei 87f498bee5 Drop the usage of unicode prefix from unicode strings
All strings are considered as unicode strings in python 3,
so we no longer need "u" prefix (u'...').

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I796d2fcdca066475bbf29d25cbf2aa67b2b2178b
2021-02-12 13:05:27 -06:00
Andrew Bogott 9ad5542486 security_groups panel: Add neutron policy enforcement
Bug: 1915308
Change-Id: Id6b802faba3f5260ce084b8f8bafedc6324d780d
2021-02-11 19:14:26 -06:00
Akihiro Motoki e5d09edc20 Use python3-style super()
In python3, super() does not always require a class and self reference.
In other words, super() is enough for most cases.
This is much simpler and it is time to switch it to the newer style.

pylint provides a check for this.
Let's enable 'super-with-arguments' check.

NOTE: _prepare_mappings() method of FormRegion in
openstack_dashboard/test/integration_tests/regions/forms.py is refactored.
super() (without explicit class and self referece) does not work when
a subclass method calls a same method in a parent class multiple times.
It looks better to prepare a separate method to provide a common logic.

Change-Id: Id9512a14be9f20dbd5ebd63d446570c7b7c825ff
2020-10-15 14:37:20 +09:00
Ivan Kolodyazhny 14e779bbac Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I2de669d8e89b8daeb7ee5405ffab35af6307c40b
2020-03-26 19:45:37 +02:00
Ivan Kolodyazhny d870b40583 Remove six usage from openstack_dashboard package
We don't support Python 2 anymore so we don't need this
compatibility library.

six.reraise usages are left as is until it'll be moved to some
base lib like oslo.utils to not re-implenent this method in
Horizon.

This patch also removes Python2-specific base test case methods
assertItemsEqual and assertNotRegexpMatches in flavor of new
Python 3 analogues.

Change-Id: I26a59176be9e9f213128e4945a58b9459334b626
2020-01-15 12:47:48 +02:00
Ivan Kolodyazhny e976461d85 Remove six usage from horizon package
We don't support Python 2 anymore so we don't need this
compatibility library.

six.reraise usages are left as is until it'll be moved to some
base lib like oslo.utils to not re-implenent this method in
Horizon.

This patch also removes Python2-specific base test case methods
assertItemsEqual and assertNotRegexpMatches in flavor of new
Python 3 analogues.

Change-Id: I0b567382edf4d68674a7b8d0b02333fb57293958
2020-01-15 12:36:11 +02:00
Michal Arbet 33fe0fef33 Fix failing tests under python3.8
In python3.8 cgi.escape function was removed as it is
noted here : https://docs.python.org/3/whatsnew/3.8.html

This patch is fixing security_groups tests and replacing
escape func from cgi to escape func from django.utils.html.

Change-Id: I5e47001dad730b64d4914e72df7d93ee15a1db12
Closes-Bug: #1854019
2019-11-26 12:15:40 +01:00
Stephen Finucane f654c893ec django22: django.test.client.encode_multipart no longer accepts None
As seen here [1]. With this change, all test are passing with Django
2.2.

[1] https://github.com/django/django/commit/6fe9c45b725

Change-Id: Idef0bd9dff4b27d22cfb756fc248c5c6bd24e097
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2019-09-11 07:25:03 +09:00
pengyuesheng e13b74e4a2 Disable add rules button when quotas are exceeded in security rule panel
Change-Id: I662e5ca2bc4e36377cf9044d1f2759bbf6cbb555
Closes-Bug: #1825314
2019-06-03 13:50:33 +08:00
Sam Wright 90aa4b2b7e SG creation user taken straight to edit rules
When the user creates a security group they are taken straight to
manage security group and can select and make changes to rules.

Change-Id: I2b3422e7816fabf59aca87a76f19cba96f01bddc
closes-bug: #1292084
2019-01-07 09:59:39 +00:00
Samuel12321 6f37943af9 A description can now be added to a security rule
This patch fixes Bug #1742332 (Security Rule Description neither
editable nor shown). I have added the option for a description
to be added to a security rule which will show the description
on the related table.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Ie723deb412977ae460c1e897f5d71fc8dbb7a853
Closes-Bug: #1742332
2018-04-10 00:48:30 +09:00
Akihiro Motoki d62d6e39e1 Convert project tests into mock: fip/sg/key_pairs/topology
Partially-Implements: blueprint mock-framework-in-unit-tests
Change-Id: I13b3f15736b9a26863d18f732fd26ea35ac00f00
2018-03-20 08:33:05 +09:00
Akihiro Motoki a72963bdbd Drop Django <= 1.10 support
After Django 2.0 support, we no longer supports Django 1.10 or older
(Actually Django 1.10 seems to work though).
The current django.VERSION branches are all related to Django 1.10
or older, so we can drop all conditions.

py35dj20 job is now voting.

blueprint django2-support
Change-Id: Iefc0ab1c62c82f2842ec7761a9b981da9351cbd2
2018-03-03 07:33:23 +09:00
Akihiro Motoki e477eafa45 django2: Replace django.core.urlresolves with django.urls
(In Django 2.0) The django.core.urlresolvers module is removed
in favor of its new location, django.urls.
It was depreacted in Django 1.10:
https://docs.djangoproject.com/en/2.0/releases/1.10/#id3

blueprint django2-support
Change-Id: I46ab5c325491274b8eaffbf848e5d80f83c2fd26
2018-02-17 01:36:48 +09:00
Akihiro Motoki 1340904d47 quota: Use network quota field names consistently
Previously neutron quota names and nova-network quota names are
mixly used and this makes the readability terrible.
We no longer supports nova-network, so it looks simple to use
neutron quota names consistently.

Neutron quota names use singular form and it is different
from nova and cinder (which adopt plural form as quota names).
Although it might be confusing, the mixed usage is much worse.
Some wrapper layer may address singular vs plural form issue,
but it can be solved later. Let's use neutron quota names
directly now to simplify the code.

blueprint make-quotas-great-again
Change-Id: Ie31414ada34cbdbd046063b512d3cef0a6e68acf
2017-12-13 20:27:02 +09:00
Akihiro Motoki e6b78f92f2 Use flake8-import-order plugin
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
This flake8 plugin is already used in tempest.
It enforces loose checking so it sounds good to use.

Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.

Change-Id: I8ccd05eb70350a2441cc2a4d1eafc09ee690b83b
2017-07-03 08:02:23 +00:00
Mykhailo Dovgal ca0f293cb6 Fix tenant_quota_usages function calls caching
This patch changes type of 'targets' input parameter in
tenant_quota_usages function from list -> tuple. It provides
possibility for @memoized decorator to cache function calls.

Change-Id: I3c32c3b65ae91e8487fda6148f259fe1931d7c9f
Closes-Bug: #1700578
2017-06-26 17:36:07 +03:00
Akihiro Motoki 359467b401 Retrieve quota and usage only for resources really required
tenant_quota_usage() is used to retrieve quota and usage
to determine if a resource can be created.
However, tenant_quota_usage retrieves quota and usage for
all resources and it can be a performance problem.

This commit allows to load quota and usage only for resources
which are actually required.

Closes-Bug: #1675504
Change-Id: Iab7322a337a451a1a040cc2f4b55cc319b1ffc4c
2017-06-14 08:53:32 +00:00
Akihiro Motoki b9d0243c33 Fix H405 (multi line docstring) warnings (openstack_dashboard)
H405: multi line docstring summary not separated with an empty line

Closes-Bug: #1696996

Change-Id: Id895695663b19522d9cdc22f8b012e49680d708b
2017-06-09 16:05:31 +00:00
Akihiro Motoki 9067ae8b0f Move SG and FIP API wrapper to api.neutron
We no longer need to have SG and FIP API wrapper in api.network
as we only supports a single network back-end.

Completes blueprint drop-nova-network

Change-Id: I4e59d897508b497a3cd2ae2fda93b30b786610dc
2017-06-04 17:51:25 +00:00
Akihiro Motoki acd3f2a240 Drop novalclient security group and floating IP dependency
novaclient 8.0.0 dropped python bindings for security group and
floating IP. This commit drops security group and floating IP logics
from the nova API wrapper.

The following changes are made accordingly.

* Update unit tests to consume neutron test data
* Drop API unit tests for nova security group and floating IP

Partially implement blueprint drop-nova-network
Change-Id: I946c508d7a82162fc8434213e006513867b79350
2017-04-28 08:38:28 +00:00
Akihiro Motoki f23c84189c Drop Nova SG and FIP related unit tests from dashboard code
Previously security group and floating IP tests covered
both nova and neutron APIs. This commit drops Nova security
group and floating IP unit tests. All these unit tests now
consumes neutron API wrapper and neutron test data.

Partially implement blueprint drop-nova-network

Change-Id: I1e3ad42cbeb90c00be29784869108d3d0db83162
2017-04-28 08:35:39 +00:00
Akihiro Motoki 07f964c42e Drop Nova security group dependency from dashboard
This commit drops Nova security group dependency from
the dashboard implementation.

security group support in the nova API wrapper will be dropped
in a separate patch.

Also removes api.network.security_group_backend()
as it is no longer needed.

Partially implement blueprint drop-nova-network

Change-Id: I224010eb59068a7cc4f97c2453d499adde7644b4
2017-04-28 08:28:41 +00:00
Yves-Gwenael Bourhis 87337ff255 Allow any port or protocol in security group rules
Neutron allows setting port or protocol wildcard by not specifying any value
for them.

Example, these are allowed by neutron:

    neutron security-group-rule-create --direction egress <sgid>
    neutron security-group-rule-create --direction egress --protocol tcp <sgid>

Specifying '-1' for IP protocol means a wildcard IP protocol.
validate_ip_protocol is updated accordingly.

'All ports' choice is added to 'Open Port' field.

Change-Id: I4a7262eda89e3206c743fee14c78aa6b49308ce6
Closes-Bug: 1669467
2017-03-29 04:53:02 +00:00
Akihiro Motoki baa4ca8dce hacking: noqa cleanup in openstack_dashboard
attribute-level imports are not checked by hacking module now.
most noqa is used to disable warnings on attribute-level imports.
This commit drops noqa for this purpose.

After this, there are only 3 noqa under openstack_dashboard/ :)

Change-Id: I4a449802f5dbd6e44e4b8b5c378a555d47d9a99f
2017-03-17 19:38:47 +00:00
Rob Cresswell e2698063e2 Move Security Groups into its own panel
This patch moves the Security Groups tab from the Access and Security
panel into its own panel under the Network panel group. As this is the
last tab in Access and Security, that panel is also removed by this
patch.

Change-Id: Id29c7ce635d46383742aec140def265d4b249aa5
Implements: blueprint reorganise-access-and-security
2017-02-02 13:19:21 +11:00