Commit Graph

23 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
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
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
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 74df97f57c pylint: Fix unnecessary-comprehension warning
'unnecessary-comprehension' warning is emitted when
unnecessary use of a comprehension is found.

classes attribute in Action can be a tuple,
so we need list() to ensure it is a list before adding 'disabled'.
I think it is time to introduce a method in Action class or somewhere
but it should be handled separately.

Change-Id: I16a98d56b6d0bd0af234b00735c6ed576620df7e
2020-09-27 12:44:16 +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
Marek 161b4ae5d4 Fixes a series of bugs related to Floating IPs.
- Fixes KeyErrors when accessing 'floatingip' values in usages, which
  broken Floating IP allocation.
- The quota display in the bottom right of the Allocation dialog are
  only displayed if 'enabled_quotas' is True
- Adds security group rule tallying for the usages overview page, which
  fixes a KeyError crash for installations where Horizon 'enable_quotas'
  is set to true, but the 'quota_details' extension is not installed on
  in Neutron
- Adds a policy check to show and hide The plus/add button in
  Instances->Associate Floating IP to match the Allocate IP To Project
  button in Floating IPs
- Fixed the page title not being set for the non-modal version of the
  modal allocation dialog/form
- Added an 'allowed' functionality for network usage overview charts to
  allow for them to be dynamically disabled
- Added tests and mocks for the above
- Added tests for non-legacy quota tallying for networks
- Added test for disabled network quotas in overview

Change-Id: I47f73ff94664d315a2400feb8ce8a25f4e6beced
closes-bug: #1838522
2019-12-17 13:30:25 +09:00
Corey Bryant 6f4742457f Switch from django string_concat to format_lazy
string_concat was removed in django 2.1 when it reached the end
of it's deprecation cycle. It was removed because the same behavior
can be achieved with format_lazy.

For more details see:
https://docs.djangoproject.com/en/2.2/releases/2.1/

Change-Id: I5e1c9bdfa1d0e049e0516198abbdb76be1667216
Closes-Bug: #1836671
Partial-Bug: #1789046
2019-07-19 16:50:16 -04: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
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
Zuul 98d0714939 Merge "quota: Use network quota field names consistently" 2017-12-26 21:40:34 +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 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
Eddie Ramirez d6f1d117b4 Add server-side filtering Floating IPs
References for field selection:
https://developer.openstack.org/api-ref/networking/v2/index.html?expanded=list-floating-ips-detail
https://github.com/openstack/python-neutronclient/blob/master/neutronclient/neutron/v2_0/floatingip.py

Co-authored-by: Eddie Ramirez <eddie.ramirez@intel.com>
Co-authored-by: David Lyle <dklyle0@gmail.com>

Implements blueprint: server-side-filtering

Change-Id: I614f0b1d9cf685aed3e3663d512a4ccd92455093
2017-09-14 23:30:57 +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 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 8b6d3422e8 Drop Nova floating IP dependency from dashboard
This commit drops Nova floating IP dependency from
the dashboard implementation.

* Use neutron policy for floating IP operations.
* SimpleAssociateIP is supported only by Nova API,
  so the action was removed in this patch.

Floating IP support in the nova API wrapper will be dropped
in a separate patch.

Partially implement blueprint drop-nova-network

Change-Id: I1610fb9aa2212b3f34814fdb9894b715a5211d9c
2017-04-28 08:28:41 +00:00
Jenkins 24a4905f5e Merge "Update Horizon to use latest nova policy rules for validation" 2017-04-05 20:34:46 +00:00
Gábor Antal 34a3aa0ba8 Handle log message interpolation by the logger
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages
Change-Id: I51f50935f1eeffe4960562d6309dfdf05814e595
Closes-Bug: #1596829
2017-03-31 20:59:16 +09: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
Yaguang Tang c61ae4f083 Update Horizon to use latest nova policy rules for validation
As Nova's API is unified to os_compute_api, the API policies are also
updated to use this format, Horizon needs to use Nova  policy enforce
rules in the codebase. This patch also update nova_policy.json using
oslo-config-generator for Nova policy file.

Co-Authored-By: Rob Cresswell <robert.cresswell@outlook.com>
Implements: blueprint update-nova-enforce-policies

Change-Id: Id7d01a39930c88592301a5035f0befe5293a78fa
2017-03-13 13:43:02 +00:00
Rob Cresswell 99849ad88f Move Floating IPs from Access & Security to panel
This patch makes the Floating IPs tab in Access & Security its own panel
under Project > Network

Change-Id: Ibb83ae5a0448d2824c10f867e620cec8219b7b72
Implements: blueprint reorganise-access-and-security
2017-02-01 18:57:44 +00:00