Commit Graph

34 Commits

Author SHA1 Message Date
asarfaty 5d2837c83a Removing dependency on the "mock" package
Now that we are python3 only, we should move to using the built
in version of mock that supports all of our testing needs and
remove the dependency on the "mock" package.

Also see commit: Ifcaf1c21bea0ec3c35278e49cecc90a101a82113

Change-Id: I58da980351fe14357c210c02eb167a6c0af9d09e
2020-05-10 17:21:14 +02:00
asarfaty b970d8cc58 NSX|V3+P: cleanup common code
1. Move common code to a dedicated file
2. Stop using deprecated nsxlib apis
3. Remove irrelevant admin utilities

Change-Id: If6308ff47dcd8f51e17cf1e4d367a664681ad2de
2020-04-17 08:31:31 +00:00
Boden R 5362c65416 update bandit, hacking and flake8 requirements
This patch bumps the hacking, bandit and flake8 requirements to match
suit with similar work (ex [1]). It also updates the code to fix a few
new pep8 errors as well as adds a local tox target for
requirements-check-dev.

[1] https://review.opendev.org/#/c/658245/

Change-Id: I6caeb52dc1a5842338ec989a742ae5989608e0da
2019-05-31 08:42:37 -06:00
Boden R 3b5c08f12f use get_updatable_fields from neutron-lib
The get_updatable_fields function is now in neutron-lib. This patch
uses it rather than neutron's version of the function.

Change-Id: I155711e8b5fbd00833d8b59abf963a37dfb82b34
2018-12-18 10:58:00 +00:00
Boden R b3a6859eb1 stop patching RbacNeutronDbObjectMixin
No need to patch neutron.objects.rbac_db.RbacNeutronDbObjectMixin
directly as the QoSPolicy OVO can be patched instead to remove the
dependency on neutron for the said. This patch does just that.

Change-Id: I530694c2fbb6d8394394bb6c889484b086ef7e04
2018-11-19 14:47:32 -07:00
Boden R b19c04aa94 use lib's object registry for neutron objects
This patch switches some of the direct reference that use
neutron.object.* modules over to use neutron-libs object registry
mechanism. The remaining reference to neutron objects will be addressed
after some additional work is done in neutron/neutron-lib to prep them.

Change-Id: Ie54b3d89d7029ab58498fd212736ed50977ccfc1
2018-11-04 09:56:10 +00:00
Boden R ee46527c9c use common rpc and exceptions from neutron-lib
The neutron.common.rpc and exceptions were rehomed into neutron-lib and
are currently shimmed in neutron [1]

This patch consumes those modules from neutron-lib by using lib's
modules rather than neutrons.

[1] https://review.openstack.org/#/c/586525/

Change-Id: I18a697f1f2d8ddbd203f4435b4aab92a8b045a44
2018-09-27 06:42:45 +00:00
Adit Sarfaty 5a52317eac NSX|V3: Fail on unsupported QoS rules
The NSX plugin does not support minimum BW rules.
This patch fails validation to prevent the creation of such rules.

Change-Id: I293dd5b6c659855bb939912370d72cdfd228a338
2018-08-26 12:07:54 +03:00
sunqingliang6 946c16c4d1 modify grammatical errors
Change-Id: I6021f3ec0d7c06ed5fc63b175ea0995bb25013b4
2018-06-19 19:15:45 +08:00
Boden R 2f73bec358 load neutron objects using neutron-lib
To access neutron objects we're moving to a dynamic plugin approach as
shown in the depends on and related patches.

This patch removes the imports of neutron.objects and uses neutron-lib
to load them instead. The remaining base object import will be addressed
later.

Depends-On: https://review.openstack.org/#/c/570060/
Change-Id: If1b140d95c039833ed4c144fb5f22328345dcd19
2018-05-25 09:43:05 -06:00
Adit Sarfaty 3c5d0d4ff6 NSX|V3: Support QoS ingress rules
Commit Ia13568879c2b6f80fb190ccafe7e19ca05b0c6a8 added the ingress direction
BW rules.
This patch adds this support for the nSX-V3 QoS driver.

Depends-on: I34ae54b7c4b5810694e4ea05265421c8e4c903d8
Change-Id: I886896c4f9cc6b6456d72c3bec05ee76e18fea3b
2017-06-26 09:13:47 +03:00
Adit Sarfaty 25f67e66ae NSX|V3: Use QoS precommit callback to validate rules
Commit I44dd7e049eab054363063021f07ade81ef2d1a90 introduced the qos driver
precommit callbacks.
The NSX-V3 uses this callback to validate the BW rule limit and raise an exception
if the values are not supported by the backend.

Change-Id: Ie47c147cb5bb5ece01d8c272544994eacd295c52
2017-06-18 15:40:36 +03:00
Adit Sarfaty 2e4a3b6113 Fix NSX|v3 qos unit tests
Commit If5ff2b00fa828f93aa089e275ddbd1ff542b79d4 broke our unittests.
This patch fixes one of the tests that was previously changed to
avoid failing.

Change-Id: I3acc65cdeeb04db24f94c578dd0c8542637dddab
2017-05-30 08:37:01 +03:00
Gary Kotton 9613a519b9 QOS: fix unit test breakage
Commit 9d69822e4391edcfb659538f18069a61037d3f12 broke the plugin

Change-Id: I461902861334f275ea0e4184855171fb9b7dc341
2017-05-29 21:20:08 +00:00
Gary Kotton 01d33ffa65 Integration with new neutron code
1. Use new enginefacade + l3_db breakage
Use reader and writer for db operations.
Partially-Implements blueprint: enginefacade-switch

2. Fix the callback pass for _prevent_l3_port_delete_callback
which was changed in commit Ia8ac4f510c003667cac95f76dea0e9ae55159878

3. QoS driver integration
Commit I5f747635be3fd66b70326d9f94c85a6736286bd2 removes the qos
notification driver.
Fixing the nsx-v and nsx-v3 to work only with the regular driver

4. _get_extra_routes_dict_by_router_id was removed by
Ia815d6c597730bd5cb49455e7409ca747a4cc22c

5. Floating IP association without subnet gateway IP
not supported by our plugins.
Added in commit If212c36d918ed57400a53f4b5fa1925b3d1fa6fd

Co-Authored-by: Adit Sarfaty <asarfaty@vmware.com>
Change-Id: I277ec5c38c5895337011019f71d586b254bfafde
2017-04-18 18:56:05 +03:00
Adit Sarfaty 4aac83661a NSX-V3| fix unittests mock
NSX-lib changed some resources locations

Change-Id: I0a2d8466f177de4eb2be594a075ea9b2a7eb50fe
2017-03-29 12:59:07 +03:00
Gary Kotton da7c01fb18 Use neutron-lib's context module
This also addresses issues with commit 1f5ee0e8942e4b77a89a00ee0249de5d5014e2bc

Change-Id: I47809344fd2c2f21acba05354c3649342560148b
2017-03-07 07:16:57 -08:00
Adit Sarfaty 02f630b616 NSX-V3| Qos without RPC notifications
The QoS implementation will stop using the RPC notifications in Pike.
See commit I2f166a43f0b980ad22617f8a3f7b4cc7f4786c48
This patch still supports it for backwards compatibility,
as well as a new driver to replace the RPC notifications.

Change-Id: I1f863bf91f712d4b12db753b13cc6b842b6918a4
2017-02-16 12:40:54 +02:00
Adit Sarfaty fafafdc67e NSX-V3| Validate Qos burst size before rule creation
Change-Id: Ie2685d19a7f7a7e43ab80f9761e9c9240b5d49e1
2017-01-16 14:24:58 +02:00
Adit Sarfaty 53cd7b39cd Fix QoS tests to use project ID
Commit ab90bcab41655b2e210aea0e7581eb00b94ce5e5 broke the qos
unit tests.
This patch fix the tests.
But until the nsxlib fix If4782a11b74d72bcfda520fc1bd8eaddf464f5ec
will be in the used version, we have to skip the v3 update test.

Change-Id: I0efda11a887c8aea7d0c574226bc7bf9c1224a2c
2017-01-16 08:12:57 +02:00
Adit Sarfaty 437e782ea5 Integration with nsxlib
Change-Id: Ief8af0d5cad8223fb52313d26d75c1f10b13c3cf
2016-11-03 05:56:36 +00:00
Adit Sarfaty 875105af5a NSX|v+v3: QoS BW translations should be rounded
When translating kbps->Mbps, or multiplying BW values by the
qos_peak_bw_multiplier, the result should be round in order to make
it more reasonable.

Change-Id: I69e9a6b6ea8bf5400308552f63713db5192209d9
2016-10-30 11:31:56 +02:00
Adit Sarfaty 34f3ee275e nsxlib refactor: config + neutron deps
1. new config class was added to allow all the classes to use the same object
2. removing dependencies of the neutron project in nsxlib code & tests

Change-Id: I15ace2ab60c1e4307d7076426c48ecc7a242e792
2016-09-30 21:00:52 +03:00
Adit Sarfaty 701de5c48f nsxlib refactor - add hierarchy to the nsxlib apis
Separating the nsxlib apis into sub classed like
firewall, nsgroup, logical router, in order to make the api simpler

Change-Id: If67fae83515bd9e72aba116a78bb6afce1fe1ab9
2016-09-30 20:44:32 +03:00
Adit Sarfaty a7b5bfafcc nsxlib refactor continue
- separate nsxlib/v3 constants and utils from the common ones
- separate the nsxlib/v3 tests
- update the nsxlib tests to cover create_firewall_rules
- remove all of the DB calls from the nsxlib/v3
- merge security & dfw_api classes

To be done in future patches:
- Avoid using the nsx configuration values directly
- Improve nsxlib interface (as Aaron suggested in If2fe1e014b78703ff0a9cdff1e4e8d45f3a4a16d)

Change-Id: I43257f557ce1e98b4f64b8157d723cc84ea58c2b
2016-09-29 15:59:13 +03:00
Gary Kotton eb8d2c313a Fix broken unit tests
Commit 10ada71486db33c6cb69f35811d0ca3dc547eff0 broke the plugin
Commit 3aa89f4d818ab6705c56287b58a268e9fd5113c8 also broke the MH

Change-Id: Ib684536f6f61237ead8dbb46e40c722bb997d009
2016-09-15 00:44:33 -07:00
Aaron Rosen 86118f6692 nxv3: mass refactor of nsxlib
This patch refactors the current codebase to be more modular
and testable. The main changes are:

  - pull out all of the profile setup logic from the __init__
    method to it's own method _init_nsx_profiles method to make
    testing the code easier.

  - refactors the nsxlib.v3 code to break out all neutron related
    exceptions and cleans up the interface so we can make nsxlib.v3
    it's own standalone library eventually.

To improve:

  - Currently we have nsxlib.v3.dfw_api and nsxlib.v3.firewall,
    we should refactor this code and merge them into one file.

  - refactor nsxlib to section of each api component to it's own
    subclass. For example, nsxlib().port.create() rather than
    nsxlib().create_port(). I think this would be most useful
    for the security group/firewall integration as there are many
    methods there that are needed to interface with nsx as the security
    group feature is requires the most orchestration with nsx.
    Breaking them into a sub class will make things more easy to understand.

Change-Id: If2fe1e014b78703ff0a9cdff1e4e8d45f3a4a16d
2016-08-19 12:28:20 +00:00
Adit Sarfaty 2576e7dddd NSX|V+V3: Fix QoS peak bandwidth calculation
The NSX backend supports configuration of Peak Bandwidth, but if it is the same
as the average bandwidth, bursts are not allowed.
To fix this, we added a new configuration multiplier that will be used to
calculate the peak bw out of the neutron max bw.

Change-Id: I38ca66dfccdf09aca2ea31015174f0615cf83656
2016-07-20 17:19:03 +00:00
Adit Sarfaty 0daccfebf0 QoS unit tests - fix deprecation warning
The QoS unit tests through warnings about illegal UUID
This patch fixed it.

Change-Id: Ie496125d2385d6282bc67e5b9f69a983b38d0856
2016-07-14 11:09:58 +03:00
Aaron Rosen c7ac488a5f python3: make unit tests pass
now all tests pass with tox -epy34

Depends-On: I5894485e55c04a8ca69825128798227714550c9d

Change-Id: I719a6cddcbe7f2b7a15bcd35375075affc2513b8
2016-07-07 14:42:35 -07:00
Gary Kotton 5de373c544 Upstream broke Qos unit tests
Commit 5decc850f126d74b89ec79593afcc68b9e8988e6 broke the plugin

Change-Id: Ie3e431eabf46839696053a8c9e9cc334b24baa72
2016-06-01 05:51:59 -07:00
Adit Sarfaty 16200ab377 NSX|V3 QoS DSCP marking support
Adding support for the QoS DSCP marking rules for ports & networks,
and updating the backend QoS switching profile

Change-Id: I852ad20965c78c2d6011d350ca4f226f462d03fd
2016-05-15 09:15:02 +03:00
Adit Sarfaty 1b331422a0 NSX|V3 QoS: handle illegal max bandwidth
The backed does not allow max bandwidth < 1M.
Since the switch update is done from a notification callback,
we cannot fail the user action.
Instead, we log a warning, and use the minimal possible value.

Change-Id: Ic5aa7f933d7faf959bafd7f3f589fe29d6ded06d
2016-05-10 11:27:10 +00:00
Adit Sarfaty 6fbf7ff64c NSX|V3 add qos support for ports
Add support for the qos service in NSX|V3, including:
- Attach/Detach qos policy to a new or updated port
- Allow qos configuration on ports with internal networks only
- Update the switch profile with the BW limitations and tags
  through the qos notification driver
- Add a new mapping db table to link the policy id and the
  nsx-v3 switch profile id

For this to work, the following configuration should appear under the 'qos' section in the neutron.conf:
notification_drivers = vmware_nsxv3_message_queue

Change-Id: I4016de756cebe0032e61d3c2a5250527e44b49e4
2016-04-20 09:11:41 +03:00