Commit Graph

203 Commits

Author SHA1 Message Date
Pedro Martins 1db1764749 Add NAT rules to the floating IP workflow
The floating IP workflow is now able to manage NAT
rules (portforwarding) if the floating IP is not
associated with any NICs (ports).

This patch is the one of a series of patches
to implement floating ip port forwarding with
port ranges.

The specification is defined in:
https://github.com/openstack/neutron-specs/blob/master/specs/wallaby/port-forwarding-port-ranges.rst

Implements: blueprint https://blueprints.launchpad.net/neutron/+spec/floatingips-portforwarding-ranges
Change-Id: Id715da6591124de45f41cc367bf39a6bfe190c9a
2023-03-01 10:38:16 -03:00
Zuul 5de967fe2a Merge "Small cleanup of FIP code in api/neutron.py" 2022-07-06 19:09:21 +00:00
Zuul dd9e4c82b5 Merge "Address RemovedInDjango40Warning (2)" 2022-03-03 10:14:04 +00:00
Akihiro Motoki d26c50ea86 Small cleanup of FIP code in api/neutron.py
- FloatingIpManager.get_target_by_instance was dropped in [1],
  but it remains in a docstring.
- "label" argument of FloatingIpTarget.__init__ can be None [2]
  and it is an expected behavior in the initial design.
  From the maintenance perspective, it would clarifies the meaning
  if it is marked as optional.

[1] commit cd9a14d293
[2] a05b326e42/openstack_dashboard/api/neutron.py (L740)

Change-Id: I813041a60d211164cdc3fa17e2b0e768d1ffd080
2022-02-25 16:21:07 +09:00
Zuul 3bc1458e60 Merge "Add Rules operation to Network QoS Policy" 2022-02-21 20:20:37 +00:00
zitptan aa83752f20 Add Rules operation to Network QoS Policy
Added create, edit, and delete rules operation to the
network qos policy.
Rules: Minimum-Bandwidth, DSCP-Marking, and
Bandwidth-Limit, Minimum-Packet-Rate

Partially-Implements: https://blueprints.launchpad.net/horizon/+spec/create-network-qos-policy

Change-Id: I49058036f1d78ef022d966f6b375cdc984755813
2022-02-17 13:40:39 +01:00
Rodrigo Barbieri 196de449b6 Implement pagination in admin/proj network tab
Added pagination support to the networks page under
Project and Admin Dashboard.

To accomplish so, the method network_list_for_tenant
in api/neutron.py that is used for listing networks under
the Project Dashboard was refactored to merge the different
requests for shared, non-shared and external networks while
tracking the pagination for each of those requests, so for
instance when all the shared networks are listed and paginated
then the non-shared networks are queried and so on.

For the Admin dashboard all network types are retrieved under
a single request so it is a simpler pagination logic.

Partial-Bug: #1746184
Change-Id: I96a2d6cabed47c89bdc02ec922d7f9451e5ec025
2022-02-16 18:15:48 -03:00
Akihiro Motoki cd7c1b5110 Address RemovedInDjango40Warning (2)
django.utils.translation.ugettext(), ugettext_lazy(), ugettext_noop(),
ungettext(), and ungettext_lazy() are deprecated in favor of the
functions that they’re aliases for: django.utils.translation.gettext(),
gettext_lazy(), gettext_noop(), ngettext(), and ngettext_lazy().

https://docs.djangoproject.com/en/4.0/releases/3.0/#id3

Change-Id: I77878f84e9d10cf6a136dada81eabf4e18676250
2022-02-04 16:22:07 +09:00
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
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
Zuul 491de164b6 Merge "Fix create/update_port with python3" 2020-11-25 15:58:23 +00:00
Akihiro Motoki f3927ffb3d Fix create/update_port with python3
unescape_port_kwargs() in api/neutron.py changes a key of dict
during the iteration and it is not allowed in python3.

Change-Id: Ifc1b9a0191aacd32e8c8ecc082b6313f04003f63
Closes-Bug: #1900851
2020-11-18 20:10:46 +09: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
Akihiro Motoki 692778f8cf pylint: Address no-else-return warning
This pylint check 'no-else-return' might be debatable.
but as far as I checked it works in most cases.

Change-Id: Ie8574d4a529454c6e050fa62a7a17ea097d00240
2020-09-27 12:44:16 +09:00
Hervé Beraud 17d8ab6103 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: Ic03754dcaaa4f1c0018294aa52bb05d956aa5d10
2020-06-03 10:45:18 +02:00
Pierre Riteau 70f6f4299d Fix typo in comments
Change-Id: I7510ce7a56c1952ff98580fb9a46f56c3d71477c
2020-03-18 09:56:00 +00: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
Akihiro Motoki ec970fd6e8 Handle partial dict setting
In Train cycle, we moved the definition of default values
to openstack_dashboard/defaults.py. The current code accesses
a dict member using []. It requires operators to define a dict
setting with a full member.

This commit allows to use dict-type settings with partial members.

A new function is introduced to retrieve a dict-type setting
considering default values defined in
{openstack_dashboard,horizon,openstack_auth}/defaults.py

Change-Id: I7ff0ad4bca698aef9c0eba370b0570200a14367a
Closes-Bug: #1843104
2019-09-26 14:31:17 +09:00
Stephen Finucane 4ece14b28a Handle move of ABCs to collections.abc
Resolves the following warning:

  DeprecationWarning: Using or importing the ABCs from 'collections'
  instead of from 'collections.abc' is deprecated, and in 3.8 it will
  stop working

Change-Id: Ib2214e7560cda1ef510c08859d5ee0726eb66b7b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2019-09-10 19:21:20 +09:00
Akihiro Motoki cdb191ec83 Fix listing security groups when no rules
When listing security groups in the dashboard and
one or more security groups had no rules it failed
because python throws a KeyError.

This commit changes the neutron API wrapper in horizon
to ensure ensure rule information in SG always exists.

Closes-Bug: #1840465
Co-Authored-By: Tobias Urdin <tobias.urdin@binero.se>
Change-Id: I6e05a7dc6b6655514ee2bff6bd327da86f13900a
2019-08-19 16:38:57 +09:00
Zuul 820dee7b7b Merge "Do not try to access sets by index" 2019-06-12 06:31:25 +00:00
Pavlo Shchelokovskyy 36515b38b2 Do not try to access sets by index
code in neutron api in some circumstances tries to access
a set or a frozenset by index, which does not work.
In particular it may manifest as

Unable to connect to Neutron: 'frozenset' object has
no attribute '__getitem__'

error in the horizon.log when opening an empty instances list page.

Convert to list instead, and skip conversion for `collections.Sequence`
objects only that support all the methods used for this object
further in this method.

Closes-bug: #1825961
Change-Id: I141a28d96f71c06a1ebe44d7067ccf4609e22db6
2019-06-05 14:25:10 +03:00
Zuul acc36f4958 Merge "Define default settings explicitly (openstack_dashboard 1/5)" 2019-05-29 17:38:13 +00:00
ZhongShengping a569f0faf3 Replace git.openstack.org URLs with opendev.org URLs
Thorough replacement of git.openstack.org URLs with their opendev.org
counterparts.

Change-Id: I7f5506455ed52e4670b8e428548e931db13b13db
2019-04-24 12:25:40 +08:00
Akihiro Motoki 9c19b07a26 Define default settings explicitly (openstack_dashboard 1/5)
Currently horizon defines default values of settings in the logic
using getattr(settings, <setting name>, <default value>) and
it is not easy to handle the default values of available settings.

This commit starts the effort to define default settings explicitly.
This is a preparation for ini-based-configurations.

It covers settings in openstack_dashboard/api.

Part of blueprint ini-based-configuration
Change-Id: Id4c3287f0a572fd14ea93b54bcab8fabda39e583
2019-04-24 02:32:47 +09:00
Akihiro Motoki 59beb951a3 pylint: Fix consider-using-(dict|set)-comprehension
Change-Id: I81c694c17106c179a53326a12e78cfa899872970
2019-01-13 00:59:05 +09:00
Zuul ea51592827 Merge "python3: Fix handling of other protocol in SG rule" 2019-01-11 16:26:08 +00:00
Zuul 188fd6dc19 Merge "Add RBAC policies feature to horizon dashboard" 2019-01-04 16:27:14 +00:00
shutingm d65ebe2054 Add RBAC policies feature to horizon dashboard
Add RBAC Policies panel to support Role-Based Access Control
functionality.

Implements: blueprint rbac-policies
Change-Id: I883ad629d735dadf49e8bf9c50475050fdfcf797
2019-01-02 17:05:07 +08:00
Akihiro Motoki ccb21ca7a9 python3: Fix handling of other protocol in SG rule
In python3 we cannot compare None with an integer,
while this works in python2.

Change-Id: I1321ea68f08241db377a58ed6a22306c63aba204
Closes-Bug: #1789402
2018-12-23 00:40:46 +09:00
Zuul 318e1f3cd5 Merge "Instance: show network info even if name is empty" 2018-12-14 19:13:34 +00:00
Akihiro Motoki 65f14e5d79 Instance: show network info even if name is empty
Previously, when a network name is an empty string,
network information of server interfaces will be empty,
so we cannot distinguish server interfaces.

Also network name in the instance detail page is capitalized
but there is no need to capitalize it and such information like
network name should be displayed as-is. This is not directly
related to the bug fixed by this commit, but it is simple enough
and related to network name, so I believe it is okay.

Change-Id: I2f2ad9b6bf50a2b53e79e4929d877111f875bd5b
Closes-Bug: #1805812
2018-12-14 17:51:52 +00:00
Akihiro Motoki fe6e395a62 Show ports without IP in instance table and detail
Previously instance ports without IP address were not shown
because api.neutron.servers_update_addresses() ignored ports
without IP address.

This commit changes servers_update_addresses() to include
a special symbol (None) representing "No IP address"
in "addresses" attribute in "server" object.

"(No IP address)" will be shown for ports without IP addresses now.

Closes-Bug: #1804016
Change-Id: I46699731ab515667b8cdf97ef68bdb8cbfe0b563
2018-11-29 23:34:23 +09:00
Akihiro Motoki cebe212d00 Bump hacking to 1.1.0
Fix the following new errors:
* E305 expected 2 blank lines after class or function definition, found 1
* E126 continuation line over-indented for hanging indent

max_line_length is set to 80 as the default value in pycodestyle is 79
but horizon uses 80 as max_line_length.

Ignore W504 and F405 by configurations.
Reasons of disabling them are explained as comments in tox.ini.

Change-Id: Iee8bcd60c30883fc8c74f08cf20af853cbb5e271
2018-11-10 16:44:25 +09:00
Zuul ed14fce844 Merge "Do not raise invalid message when port does not exist" 2018-10-23 11:24:14 +00:00
Gary Kotton 4ae8850dec Do not raise invalid message when port does not exist
The exception handling for port, floating IP's or networks
is too broad. Add specific error handling and in a case when
the resource is not found do not raise a invalid message.

Change-Id: I98ee2ff816c03980645752eebb4e39d3ecd2e158
Closes-bug: #1796565
2018-10-07 07:05:14 -07:00
Radomir Dopieralski 3acb28270a Replace @memoized_with_* with @memoized
Since @memoized now uses weakref to delete old cache entries, and no
longer keeps the object passed as parameters alive indefinitely, we
no longer need to treat the Request objects specially. In fact, if
we stop doing it, it should improve memory use, because now all
request-specific caches will be removed as soon as the request
object dies.

I also removed the memoized_with_argconv function, and replaced it
with an explicit function for converting teh parameters in the one
place where it was used.

Change-Id: I710b96a170e429c6ffdf22ad3e552ee6e1c6b7e3
2018-09-25 11:44:06 +02:00
pengyuesheng 797859beb7 Floating ip filter has no effect
the API of tenant_floating_ip_list add '**search_opts',

Change-Id: Ie4f47f768909a2af7a916d2ad6ce43b3e157b432
Closes-Bug: #1763280
2018-08-23 09:58:16 +08:00
Beth Elwell 5910b6b90d Fix issue where qos delete action returns error message
Code was incorrectly removed from the final patchset where the delete
action was implemented for the qos panel. This results in an error
occurring when users try to delete a policy. This patch removed this
error and restores normal and expected functionality.

Change-Id: I7f4c221fd48e5fd5c268f5150ae6f3ed2bf1bacd
Closes-bug: #1785809
2018-08-14 14:25:28 +01:00
Jens Harbott 9e703aec2f Add DNS parameters to Floating IP panels
This adds support for the "DNS Domain" and "DNS Name" options to the
panels for listing and allocation Floating IPs.

These options are available as a Neutron extension, so we need to
make them conditional based on the availability of that extension.

Change-Id: Ife8e19aac44dccbdf11a6a6d4bb50cd3b7ed8d8e
2018-07-22 20:24:36 +09:00
Ian Y. Choi a3cc0625a6 [trivial] Fixes a typo
auto_alloocated_network -> auto_allocated_network

TrivialFix

Change-Id: I6b2158f80826a23611bd6ae15285a8acedeb0925
2018-05-19 17:22:42 -07:00
Akihiro Motoki d16ed45e06 Support "Get me a network" in launch instance
"Get-me-a-network" feature is supported in Nova API 2.37 or later.
To support this in horizon, a dummy "auto_allocated_network" is shown
in the launch instance form. I believe this approach fits the current
way of the launch instance form. The dummy network is a special network ID
and if specified the nova API wrapper converts 'nics' parameter properly.

In addition, a dummy "auto_allocated_network" is now shown in the network
table. This is because Neutron creates an actual auto allocated network
once a server is created specifying nics=="auto".
I believe this fake behavior brings consistency in the network table
to some extent, while this is just a compromise.

Note that this patch does not cover the network topology integration.
"auto_allocated_network" is not shown until the actual auto allocated
network is created. The network topology integration requires more work.
For example, the link for the fake auto allocated network should be
disabled in the flat view. The pop-up for the fake auto allocated network
should be disabled in the graph view.

Change-Id: I062fc1b7ed75dc771ddc7f13c8324ed4ffab6808
Closes-Bug: #1690433
2018-05-07 20:49:29 +09: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 b068d91c60 Cache neutron extension list across requests
Also improves the warning message of UnhashableWarning
and test_neutron UnhashableWarning.

Closes-Bug: #1747204
Change-Id: I876e3219dac570e8f7b10c5c126df74ca73f5197
2018-02-10 15:12:09 +09:00
Hanieh Rajabi af63c004ca fix english grammatical error
Change-Id: Ibe93b639b0589c8f59502067b22b65aa89737b16
2018-01-31 23:27:57 +00:00
Simon Collins 3929a8b7cd Security group quota error handling
When adding a new rule to a secruity group that would exceede the
quota, the error message displays a quota error, rather than rule
already exists error. It does this my first checking for an
"OverQuotaClient" error, then if that except doesn't trigger it
checks for any other conflict

Change-Id: I8eaa0f00b25c8c3b75fef2bf46979f1f248c6896
Closes-Bug: #1699724
2018-01-18 11:59:40 +13:00
Akihiro Motoki dc7d2582db quota: Use neutron default quota (read-only) API
Neutron provides an API to retrieve default quotas since newton.
Unfortunately there is no corresponding neutron API extension
is not defined, so there is no way to detect it via API.
The API exists since newton, so this commit just switches to
the default quota API.

Closes-Bug: #1337473
blueprint make-quotas-great-again
Change-Id: Ia826b67f4cec7d95335c62ef98c3040feaa06117
2018-01-14 04:53:30 +09:00
Zuul 135a279246 Merge "quota: Use neutron quota_details API to retrieve usage" 2017-12-26 21:20:18 +00:00
Trygve Vea d1225c606e Floating IP: Expose description field in form and tables
The networking API supports setting a description on floating IP addresses.
This patch adds a form input field to the allocation form, and a column to the
table that displays floating IP list.

Closes-Bug: #1738625
Change-Id: I3cec286d01f319402dd652f2f0fe7a59e7d1cfbb
2017-12-17 12:58:50 +00:00
Akihiro Motoki cd3f3e5127 quota: Use neutron quota_details API to retrieve usage
Previously neutron did not provide a way to retrieve resource usage
in a single API, so we need to call list APIs and count the number of
resources. Since Pike release, quota details API is provided and
it returns both quota and usage (used + reserved).

blueprint make-quotas-great-again
Change-Id: I63d0e81654c18f0f235631922d64d1109233fcfa
2017-12-13 20:27:02 +09:00