Commit Graph

71 Commits

Author SHA1 Message Date
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
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
Siebe Claes 43034cbb23 Fixes IPv6 static route addition
This change fixes the form validation error while adding
IPv6 static routes to a router through the OpenStack Dashboard.
Unit tests to cover this action have also been added.

Change-Id: Ied0fd27dbbc33a98617c049977539c5b3c71cdfe
Closes-Bug: #1523341
2019-05-02 23:07:20 +02:00
Akihiro Motoki 58019a7411 Disable mox usage by default in test helper
- Add use_mox = True to tests which still depend on mox
- Remove use_mox = False from all tests converted into mock
- Update the warning messages
- Replace 'S'-release with 'Stein'

Part of blueprint mock-framework-in-unit-tests
Change-Id: I208185e97b2de346304a09643a9cb3f1425a7683
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
2018-04-20 03:34:51 +00:00
Akihiro Motoki f545272f12 Fix pep8 errors
Recent pep8 upgrade and corresponding pycodestyle update break
horizon pep8 job due to the new rules.

This commit fixes the following new errors:
- E226 missing whitespace around arithmetic operator
- E241 multiple spaces after ','
- E731 do not assign a lambda expression, use a def

The following errors are added to the ignore list
as there are many errors:
- E402 module level import not at top of file
- W503 line break before binary operator

Change-Id: I3478b0684175d2604bbcc1d89cbfca298b97f1e1
2018-04-11 00:34:21 +09:00
Akihiro Motoki 002eb5f68e Switch project/admin routers tests to mock
Partially-Implements: blueprint mock-framework-in-unit-tests
Change-Id: I6aa7da58f640d65156f3592d93ba034c4fca3056
2018-03-15 02:46:08 +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
wei.ying 0cb96af3a2 Admin State is always UP whatever whether router Admin State is checked or not
On the project creation router page, if we don't check "Enable Admin
State" option, when the router is created, "Admin State" is displayed
as UP. This inconsistency is because the judgment condition of [1]
doesn't hold which causes the "admin_state_up" parameter not to be
passed by the call creation router interface. In this case, the
back-end defaults to "admin_state_up" to be UP.

Since the router "Enable Admin State" option has an initial value of
True, there is no need to check for [1].

[1] https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/routers/forms.py#L121

Change-Id: I6b95ffa680eab5c29d2bca6c91fc7f028f7f519a
Closes-Bug:#1748777
2018-02-13 10:53:24 +08: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
Trygve Vea edcd22244f Add a checkbox to disable SNAT on routers
When creating a router, or when setting a gateway on a router - a checkbox
is displayed, which can be unchecked to disable SNAT.

Change-Id: I8bc040018645fe2bde534b7d48e14c17984cc9c4
Closes-bug: #1673076
2017-10-23 16:10:48 +00:00
Zuul b488cbb2d9 Merge "Router lists display availability zone information" 2017-10-20 23:51:56 +00:00
Trygve Vea b9664a1bf1 Routers can be created with availability zone
When 'availability_zone'-extension is enabled, we present the user with
a drop-down menu containing a list of available availability zones.
This sets the 'availability_zone_hints' parameter on router creation.

Change-Id: I96293202ddd855823e89c4c7ba0b1f6a6423aab2
Partial-bug: #1716638
2017-10-19 11:53:39 +02:00
Trygve Vea 59021766b8 Router lists display availability zone information
When 'availability_zone'-extension is enabled, we present the user with
a column showing the availability zones for which the router is
scheduled in.

Change-Id: I87f6bfcee1f129a77e6bf9efa973a79bfa2afe14
Partial-bug: #1716638
2017-10-19 07:14:32 +02:00
Adit Sarfaty 245da1d812 Do not call list_l3_agent_hosting_router if not supported
For the admin router view, list_l3_agent_hosting_router is called.
If this extension is not supported, it returns "resource not found"
and an error popup.
This api should not be called in case the extension is not supported.

Closes-bug: #1708081
Change-Id: I38f7386689d95dde3fc76bbf4d6b5e781b515878
2017-08-03 08:16:54 +03: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 c8cd03189a Use BooleanField for admin_state_up form
admin_state_up is a boolean value but the network and port edit forms
expected a string version of True/False. As a result, True/False string
was shown as the default value in these forms. The field is implemented
as ChoiceField, but there is no special reason not to use BooleanField
for a boolean field and admin_state(_up) fields are the only exceptions
in horizon. This commit replaces all admin_state(_up) fields to
use BooleanField.

As far as I checked, this pattern is used only in the networking
related panels and this patch clean them up.

Change-Id: I9286f6c29d67fec7a88b74661bc8eca945fd9061
Closes-Bug: #1672213
2017-04-14 19:40:48 +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 560f23a1c9 Add default common template to python table views
Many of the Python table views are using identical (or nearly identical)
table templates. This patch adds a common template and makes it the
default for a DataTableView, which allows us to remove many similar
templates and redundant lines of code.

Change-Id: I1e4e15e695ee1f21f4d44f141a854e30f1e567a1
Closes-Bug: 1653986
2017-01-05 08:59:35 +00:00
Jenkins 35fdc05540 Merge "Fix compatibility issues with Django 1.10" 2016-09-20 19:44:01 +00:00
Rob Cresswell 3488ab3d40 Fix compatibility issues with Django 1.10
Required modifying our URL pattern decorator to
be compatible with the slightly different callback
attribute mechanism in 1.10

Modified breadcrumb structures to always be 2-tuples
as tuple unpacking is now strictly enforced in 1.10

Also made the following things changed in Django 1.10.
- fixed the now-deprecated TEMPLATE_DEBUG.
- Caught up with Request context change
- SimpleTestCase.urls is removed in 1.10.
  ROOT_URLCONF needs to be used instead.

Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>
Co-Authored-By: Akihiro Motoki <motoki@da.jp.nec.com>
Change-Id: I59cbd8bff117813258539ed0724fe89a9f5b77ee
Implements: blueprint dj110
2016-09-20 12:29:16 +01:00
shizhihui 312731ab4c Replace 'assertTrue(a in b)' with 'assertIn(a, b)'
Supplement the patch:https://review.openstack.org/#/c/364652/

Change-Id: I6890d7f5aff751ddfad86fc954146cc5ac102ac8
2016-09-13 13:13:00 +08:00
Jenkins 618145a82d Merge "Server-side filtering routers" 2016-08-19 19:12:26 +00:00
Aditya Vaja 2807aa6bdc Remove router rules extension
Router rules is a horizon extension provided by Big Switch Networks.
As part of the horizon-vendor-split work, we drop the extension from
upstream horizon.
It is now available as a separate plugin at
https://github.com/bigswitch/horizon-bsn

Change-Id: I439f6f87057547f9bc0fbb7089d37b4e9603b1c1
Partially-implements: blueprint horizon-vendor-split
2016-08-15 15:04:23 -07:00
jlopezgu 02594a758f Server-side filtering routers
Implements server-side filtering for routers:
  - Admin->System->Routers
  - Project->Network->Routers

Implements blueprint: server-side-filtering

Depends-On: Idaee431ed15de81e5ea049948b55d1526e2024ac
Change-Id: Ic93ce6d2a73f33e639a9a3fa0f8846a7d1cbbe9a
2016-08-09 13:58:51 -05:00
eric 0ee88956cc Add router L3 agent info to info page
This change tries to lookup the L3 agent location for a router
to assist admins in locating where a router resides.

Change-Id: I62bedcc587791df3a101b9d81a03ba2540dfa033
Implements: blueprint admin-neutron-l3-agents
2016-05-31 12:31:30 +00:00
David Lyle 037d1c0927 removing httplib2 test dependency
Once upon a time, the python-*client libraries were primarily built to
use httplib2. They have subsequently shift to using requests and thus
urllib3. The horizon test helpers code was maintaining a reference to
httplib2 as it intercepted errant library calls that were not mocked.

httplib2 is not actively maintained and OpenStack is moving to remove it
as a dependency. See
http://lists.openstack.org/pipermail/openstack-dev/2016-March/089225.html
for more details.

This patch removed the httplib2 dependency. Upon removing the
dependency it exposed a missed update from httplib2 to urllib3. A
function that was intended to catch unmocked calls was only listening
for httplib2 connections. This patch updates that failsafe to work with
urllib3. Upon doing so, it pointed out many, many missing mocks and in
turn, many broken tests that appeared to work because of API call
failures. This patch adds the missing mocks and fixes the broken tests.

The new failsafe prints the stack trace when an outside connection is
attempted. Additionally, to fix the fact that a missed mock used to
allow tests to potentially pass, as documented by bug 1517704, a test
failure is now forced on tests where a missing mock is detected.

Closes-Bug: #1517704
Implements blueprint: remove-httplib2-dep
Change-Id: Iaabdf03966c14c82e0c58a3b1ab1a6755c05adcb
2016-05-02 13:19:08 -06:00
Elena S b12047454f Add test_router integration test
Create both test for router create/delete and router Page Object. Also
decapitalize routers table name so it could be referenced in
integration tests like any other table.

Change-Id: Ic4fdfa82584dd3cad1e906d5fc5526c4a758675f
2016-02-15 09:48:18 +00:00
Victor Stinner 7b55a2f71b Port last unit tests to Python 3
With this change, all Horizon unit tests pass on Python 3.4.

Changes:

* vpn/tests.py, firewalls/tests.py: Replace reverse_lazy() with
  reverse() to get a regular Python string. The lazy object caused
  failures on Python 3.
* routers/tests.py: Decode HTTP body to get Unicode on Python 3. It
  works also on Python 2.
* neutron.py: replace a/b with a//b to get an integer on Python 3.
* network_tests.py: remove useless copy.deepcopy() which caused a
  recursion error on Python 3.
* metadata_defs/tests.py: expect a different JSON error message on
  Python 3.
* tox.ini: remove openstack_dashboard whitelist, all unit tests now
  pass on Python 3 ;-)

Partial-Implements: blueprint porting-python3
Change-Id: I7b4f036fc86b66c92cccafe6938a906045f03186
2016-02-10 18:22:52 +01:00
Javeme db8e206bee remove the default arguments "[]"
remove the default arguments "[]" when the function is defined.
ref: http://docs.python-guide.org/en/latest/writing/gotchas/

Closes-Bug: #1525903
Change-Id: I241f22fe10e535bb50f7ce27fac09d6448fd2bb2
2015-12-14 20:30:42 +08:00
Steve McLellan d76a61346e Make unit testing less reliant on HTML fragments
Some tests check for equality with quite large HTML fragments, when
the test is only interested in certain specific things (and not style
changes etc). This patch alters some of those tests (specifically ones
that were tripping up a dependent patch, but can be expanded) to check
the context data of the response, since the actual rendering is tested
by horizon's tests.

It also adds tests to check context data in 'normal' circumstances so
that no test coverage should be lost by this.

Change-Id: I09be82058edc923521ffb4c022515845a18b158d
Closes-Bug: #1517084
2015-11-30 10:24:38 -06:00
Rob Cresswell f38ddf2032 Add breadcrumb to more details pages
This patch adds basic Breadcrumb nav to the detail pages for Data
Processing, Databases, Metadata Definitions and Routers.

Change-Id: I114e93799b957db39cbe0d4e49d3e6869bc9d92d
Partial-Bug: 1413823
2015-11-09 20:55:12 +00:00
Mike Hagedorn 5ba219acbf Neutron Quota Settings Flag Disables Neutron GUI
if OPENSTACK_NEUTRON_NETWORK["enable_quotas"] = False buttons will not appear
and exceptions are thrown.   This is because a dict is searched for a key
("available") which wont be there if its disabled.  This generates a
KeyError at runtime.

As currently written enable_quatas -> False essentially disables Neutron usage.
This is not a desirable outcome.

This patch shows Neutron related buttons and ignores the quota settings,
which seems more in line with the notion of disabling quotas.

Closes-Bug:#1482354
Change-Id: I9485ddeece74d87317c2587498f5f79d4ffdb66e
2015-09-24 20:50:50 +00:00
Frode Nordahl 749aecda4c Fix usage of netaddr '.broadcast'
netaddr 0.7.16 changed the behavior of IPNetworks with /31 and /32
prefixes to make their 'broadcast' attribute return None. This patch
replaces the use of the attribute with a -1 index lookup to get the
last address instead.

Revert Ida700555c133e27da2c76357986adfc8193fe89b and re-enables the
test_routerrule_detail test.

Change-Id: I0887b0112f97b537e4c1467c47ab78b1f94f238b
Closes-Bug: 1490403
Closes-Bug: 1490423
2015-09-02 07:54:38 +02:00
Frode Nordahl e2d7d32112 Skip test_routerrule_detail blocking the gate
Change-Id: Ida700555c133e27da2c76357986adfc8193fe89b
Related-Bug: 1490403
2015-08-31 11:43:11 +00:00
Victor Stinner 4057ff2569 py3: Replace unicode with six.text_type
Initial patch generated by:

    sixer.py unicode horizon openstack_dashboard/ tools/

Partial-Implements: blueprint porting-python3
Change-Id: I8bdec74fbe32a6ff0e65f2f0810a0c698a3b9637
2015-08-27 01:26:02 +02:00
Victor Stinner 674a45ffe0 Replace mox with mox3
mox doesn't work on Python 3, whereas mox3 works on Python 2 and Python
3. Cinder, Nova and many other projects already replaced mox with mox3.
mox3 is now maintained by OpenStack.

Partial-Implements: blueprint porting-python3
Change-Id: I10e6a9754ebd58a2640d73ec8966527c3aa1fe9a
2015-07-13 15:02:10 +02:00
tinytmy ca596187a8 filter the subnets which already in the router
When we already add the subnet to router,
if we click 'Add Interface' again, we can see
the subnet also can select, but if we real to
add the subnet, it report a error. We can hidden
the subnet if it already add to the router.

Closes-bug:#1417892

Change-Id: I485608d267b9b235c1e83a990e330dd1ca98f17e
2015-06-01 00:33:01 +00:00
CHARDON Gerome 440bd19040 Add Extra Routes to Router Tabs View
Add support to neutron extra routes to routers views.

Change-Id: Id5b5c7494d903fff0fdb5cba9297dbed5cf3d62e
Closes-Bug: #1396616
2015-03-31 11:09:05 +02:00
Rob 14b2e700e8 Fixes inconsistent Router Details page
This patch addresses the stylistic inconsistencies in the Router details
pages, by changing it into a tabbed detail page

- Fixed bug on the Interfaces table causing the Name field to be empty
- Overview page has also been restyled to more clearly show information
  and link to relevant network
- Increased inheritance where possible, to reduce duplicate code
- Deleted unused files/functions. These can always be added as required
  later, but there is no need for unnecessary code bloat

Co-Authored-By: Sam Betts <sam@code-smash.net>

Change-Id: Ifbdfbf46127e9445395207c547c2b81ea9459dac
Closes-Bug: 1378895
2015-03-23 10:30:07 +00:00
Masco Kaliyamoorthy 55f85114ce improved the create router form
In create router form some optional
parameters and help text is missing.

This patch is adding the admin state
and external network parameters and
help text.

Change-Id: I36295a70f25f7e09a89d78aff07643e89c52ba2f
Closes-Bug: #1421128
2015-02-20 23:37:47 +05:30
lin-hua-cheng 0cde6aa055 Move to hacking 0.10
Release notes:
http://git.openstack.org/cgit/openstack-dev/hacking/tag/?id=0.10.0

Per the release notes, H307, H803 and H904 has been removed.

Fix code issues with H238 and W292.

Change-Id: I747ebb64db5825bc70f1ae19c1c1f5ca2089c06d
2015-02-04 20:27:07 -08:00
Radomir Dopieralski d7ad91e8a8 Replace the glyphicons with font awesome icons
There are still some scss mixins that use the old (from bootstrap 2)
image icons. Replacing them will have to be done in a separate patch.

I also link to the css file, instead of scss, because django-pyscss has
some problems finding the right file. This is reported and will have to
be fixed upstream to unbundle bootstrap.

Change-Id: I67e94a9283bcceef8fc89343f3f5b2d7e0d4449f
Partial-implement: blueprint font-icons-replace
2014-12-01 14:36:38 -07:00
CHARDON Gerome e4db9b0609 Delete duplicated code from router tests
Reorganize duplicate code in a mixin for factorization purpose.

Change-Id: Ie5212a487a4e82c3b5e8808e04044ec38383e115
2014-11-20 10:32:13 +01:00
Miguel Grinberg b37fa64bdd Automatically remove interfaces on router delete
This change removes all attached interfaces from a router when it
is deleted from the project dashboard. This was only being done when
the router was deleted from the admin dashboard.

Change-Id: Ic0b639bfad7451bb5acbf486c39e349c938723db
Closes-Bug: 1384400
2014-11-18 22:25:03 +00:00
Akihiro Motoki 03c562736b Disable router HA attribute due to Neutron bug
Change-Id: Iccd0e2dfb545a95cb1b9a809187103bb3a5a76a7
Closes-Bug: #1378525
2014-10-17 21:50:42 +09:00
Akihiro Motoki 2a9349bd67 Fix E128 errors in openstack_dashboard/dashboards/project/
E128 continuation line under-indented for visual indent

Partial-Bug: #1375929
Change-Id: I6bc8db7dab6fc2c3aad7fa54b6e07643b595f230
2014-10-16 16:53:52 +09:00