Commit Graph

33 Commits

Author SHA1 Message Date
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
asarfaty 5670aa6f7e Remove leftover debug lines
TrivialFix

Change-Id: I6a4554102d353dd805a0f645e86bf305bffe37c1
2020-04-13 09:20:54 +02:00
asarfaty 98b2832e4d Add coverage tests
As a first step add coverage test as non-voting with a low threshold,
and exclude older plugins.
Also removing some unused code, and relocating tests-only code, and adding
some unit tests to improve coverage.

Change-Id: Ib7af0b5de49e1a0ee2927b01f2a5f71acf633fb5
2020-04-13 06:13:32 +02:00
asarfaty 9ed80d6ebc NSX|V3: remove checks for features long supported
Remove check about backend supportability for features that were not
supported only on too-old backend versions

Change-Id: I6d0068c9298e947a8bff564950614e776c696898
2020-03-09 07:14:08 +02:00
Adit Sarfaty 18a69716c1 NSX|V3+P: Remove illegal characters from user-id in NSX headers
Change-Id: I1f5345c0592c9b2a7ceaac5bb5c13ef05f1d3bef
2019-07-07 10:03:28 +03:00
Adit Sarfaty edac5ce48c NSX|V3 adminUtils: detect and clean orphaned section rules
nsxadmin -r orphaned-firewall-sections -o nsx-list/clean will now
also detect/delete orphaned rules inside nsx sections that belong to
neutron security groups.

Change-Id: I7f733676e29f6a2b1177b4155e5b36aee3670438
2019-04-11 14:09:59 +03:00
Adit Sarfaty bc98cd6ef9 NSX|P: Add configuration parameters for realization timeouts
Change-Id: I2de7e9b6139ecb3d189b69a620195d619f549c34
2019-04-01 07:53:05 +00:00
Anna Khmelnitsky d1bf1f324e NSX|P: Consume nsxlib folderization patch
Change-Id: I24e2099b8c13c61218ca3c7582961a8620cfca28
2019-01-06 07:48:27 +00:00
Anna Khmelnitsky f40c196bbf NSX|P: Initial dhcp support
Policy does not support dhcp for infra segments yet, so support is
done on manager via passthough API. Same appliance is assumed.

Not covered here (will come as follow up):
- subnet update
- nsx cleanup

Change-Id: I9a64524edd80b1830c5b3dba2c63c087fe46a169
Depends-on: I47a1ec1994808f9ed8ebb00bbcc2bbe0a497a146
2018-12-31 13:37:31 -08:00
Adit Sarfaty 0fc5c7a5a3 NSX|P: Policy plugin use passthrough api
Adding a configuration flag (True by default) to allow the
passthrough api usage.
Using this plag for the nsxpolicy initialization and for calling
the specific apis.

Change-Id: Ie574d56af6258726f774d623e5cce25aa5f20ead
2018-12-19 08:36:28 +00:00
Adit Sarfaty 57776776d4 Policy plugin: Add devstack/admin-utils for client auth
Adding devstack support for policy plugin with certificate and the certificate
admin utilis which are needed for the devstack support.

Change-Id: I5c9d23c7f0a83cbf4cb71fed4da488bafa230be4
2018-12-09 13:15:55 +02:00
Adit Sarfaty 4edec4ab9b NSX|P: Use nsx_p certificate configuration
When initializing the NSX policy connection, the nsx_p configuration
should be used for the certificate parameters.

Change-Id: I2a103930d2a378b267a3cc7320cdd2f37a59a1bb
2018-10-02 12:28:44 +03:00
Adit Sarfaty 3be8af0c37 NSX-Policy: Skeleton for the new NSX Policy plugin
Change-Id: Ia3195293270ceb3af1f14fa280de43019ca44b7f
2018-09-12 08:52:41 +03:00
Adit Sarfaty c0f3149c40 NSX|v3 Admin utils refactor + additions
- Refactor nsx-v3 admin utilities by moving some of the code to a different
file which will later be consumed by the housekeeper code as well
- Adding orphaned firewall sections list/clean utilities
- Adding a capability to detect problems in logical port address bindings
- Update the documentation

Change-Id: If6aba167c2dd1234d1bb10a8a115fcdfe13cf2f0
2018-06-28 08:35:54 +00:00
wangqi d03f616be0 Replace os.makedirs to avoid process race
Use oslo_utils.fileutils.ensure_tree(path, mode=_DEFAULT_MODE)
to replace os.makedir.

Change-Id: I610ade282567e6ce976741779a6e0d23d4fadc92
2018-05-31 11:05:26 +00:00
Adit Sarfaty 561276f33d NSX|V3 indentation & typo fixing in client certificate
Change-Id: Ia624c545d0ec93349128bf36387d26d13dc9305f
2017-09-27 09:28:23 +03:00
Anna Khmelnitsky c0a3501a6e NSXv3: Rewrite client certificate provider
The provider was designed under assumption of thread per session.
However, different sessions can simultaneously occupy same thread.
To prevent filename collisions, each request will create its own
provider object with random filename.
Since this creates significant overhead, this is hopefully a short
term solution. For long term, we'll seek a way to pass certificate
data in memory to the ssl library (requires changes in python libs)

In addition, remove certificate generation/removal printout to avoid
spamming thde debug log.

Change-Id: Ib11b8ae38d663c53107e02e6febb676c6e9572a0
2017-09-05 10:45:37 -07:00
Anna Khmelnitsky 5f3153e47f NSXv3: Move away from locking in cert provider
Since client certificate provider may be used both before and after
fork, refcount state is not necessarily zero at fork time (same
problem with refork). This commit replaces refcount-based model with
simple file-per-thread approach. Each thread will create and delete
its own client certificate file.

Change-Id: Idd14295b527c068f4b798ea96f8a53f61f9a18db
2017-07-13 08:55:22 -07:00
Anna Khmelnitsky a7826cb08d NSXv3: Add lock around filename in cert provider
filename function is not supposed to be called outside with block,
but better be safe then sorry

Change-Id: Icad41bd2f8b3520cb521fb8d43b86d6130eb9442
2017-07-04 13:16:06 -07:00
Anna Khmelnitsky d84016c8ff NSXv3: Race condition fix for cert provider
Refcount initialization needs to be under lock

Change-Id: I27ee0161bfe2357c1c7acfb34ac58af30541cf8d
2017-06-17 05:17:21 +00:00
Anna Khmelnitsky d97bd534b6 NSXv3: More locking for certificate provider
Under stress connections are failing due to race condition. Fix this
by locking the entire certificate file creation/deletion block.

Change-Id: I8be1c9570e0b73660e997193eddb46705c71c6b6
2017-05-30 06:09:57 +00:00
Anna Khmelnitsky 2910521b1d NSXv3: Solve race condition in DB cert provider
Certificate provider is dumping certificate to file system and
deleting it immediately after use. In order to prevent file
collisions between neutron processes, pid was used, which was
problematic since the pid was assigned before neutron fork.
This commit switches to use random file name, generated at later
stage.
In addition, it adds locks to bullet-proof collisions within
same process.

Change-Id: Iee6c179a4412b150345e5fffc095b88d86758b51
2017-05-24 20:54:22 -07:00
Gary Kotton 6228a06399 Drop log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: I9d37ae28a3fecbe910e60dc7f22e229a7b65940c
2017-03-26 05:09:02 -07:00
Adit Sarfaty 84be0ea6a5 NSX-V3| network availability zones support
Adding availability zones for nsx-v3 for native dhcp parameters

configuration:

[nsx_v3]
availability_zones = zone1,zone2,zone3

[az:zone1]
metadata_proxy = a87d92f3-0106-47dc-a494-de68345fecc8 <profile-name-or-uuid, mandatory>
dhcp_profile = 8a4fb2ca-60aa-4291-aab8-d0d6b7790292 profile-name-or-uuid <mandatory>
native_metadata_route = 179.254.169.254/31 <optional>
dns_domain = aaa.com <optional>
nameservers = 1.1.1.1, 2.2.2.2 <optional>

Change-Id: I006d922908d5a061480f43eeb92d373fcb4db616
2017-03-14 19:28:31 +02:00
Anna Khmelnitsky dc78683291 NSXv3: Add certificate expiration alert
A warning will be printed in log if cert expires in less than
30 days.
In addition, fix refcount in cert provider and unit test.

Change-Id: I8899e84c37d56602736b8fb0c1994ad04a5d5b14
2017-03-10 18:41:10 +00: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
Anna Khmelnitsky 6a38e51c9a NSX-T: Rewrite client certificate unit tests
Rewrite the tests to validate client cert providers instead of
plugin initialization

Change-Id: I714db7a285129dbecc0cd9dfd7806ce12df4bf70
2017-03-02 21:39:55 -08:00
Anna Khmelnitsky a93abf957d NSX|V3: Use client cert provider in nsxlib config
With certificate provider, client cert data will be loaded
from DB for each new NSX connection and then immediately deleted.
For client cert storage=none, the behavior does not change.

Also adding 2 temporary fixing to allow the broken unittests to pass:
1. Disable some certificate tests
2. IPAM driver fix:
Commit I22b8f1f537f905f4b82ce9e50d6fcc5bf2210f9f broke our ipam code
since it assumes an ipan subnet has a subnet_manager object.
This patch adds a dummy one just to avoid crashing

Change-Id: I459650eb69fd870cd4c65fb5a337821de15e14b3
2017-03-02 11:53:05 +02:00
Anna Khmelnitsky 6e1a21881e NSXV3: Initial client certificate auth support
Client certificate authentication is disabled by default.
To enable client auth, define the following in nsx.ini:
nsx_use_client_auth = True
nsx_client_cert_storage = nsx-db
nsx_client_cert_file = <file to store certificate and private key>

To enable client auth in devstack, define the following in local.conf:
NSX_USE_CLIENT_CERT_AUTH=True

This commit covers only DB type of cert storage. Barbican storage
and imported cert will be added later. Also planned for near future:

    reload cert from DB if NSX connection failes due to bad cert
    show warning when cert nears expiration
    delete cert file from file system on neutron exit

Change-Id: Ic70a949b740d9149d71187b02640d3071a3e0159
2017-02-02 09:39:18 +00:00
Adit Sarfaty 437e782ea5 Integration with nsxlib
Change-Id: Ief8af0d5cad8223fb52313d26d75c1f10b13c3cf
2016-11-03 05:56:36 +00:00
Zhenmei 074edfefa5 NSX|v3 replace dhcp profile and metadata proxy uuids with names
Support configuration of name or uuid (instead of only uuid) for
2 nsx_v3 parameters: dhcp_profile, metadata_proxy.

Assert on init if the uuid or name was no found on the backend,
or if the name is not unique.

Change-Id: Ife6263b7cf1759a2fc309205552eb79138d512a1
2016-10-10 20:59:49 -04: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 40e5810d1d nsxlib refactor - remove cfg usage
Accessing the nsx configuration should be done only outside of the nsxlib
or nsxlib tests

Change-Id: I8dc1079c11212e4d5691c07e88338f49cfa89430
2016-09-30 20:20:42 +03:00