Commit Graph

543 Commits

Author SHA1 Message Date
Salvatore Orlando 819c74ef30 Replace occurrences of registry.notify
This change replaces remaining occurences of the notify method with
calls to the publish method.
As NSX admin utilities heavily rely on callbacks, this change also
ensures that all callbacks are now accepting event payloads rather
thank kwargs.

Change-Id: I0450fff486898d6ab74086b7952dc27134cb77e2
2021-10-18 03:24:34 -07:00
Kobi Samoray fb6fc96afc NSXV status for out of sync LBs
When a LB exists in Octavia DB, but missing in NSX, its status is never
updated.
The following addresses this condition by collecting the LBs from
Octavia and validating them periodically.

Change-Id: I3c42a934a47532968c65aaeade8210364167f35a
2021-08-25 12:25:35 +00:00
Kobi Samoray 1316d7e43a NSXV: ensure default SG
Ensure default security group during port and SG creation

Change-Id: Ie0a46e08f603eb3647952ed7d2dbd76cc436601f
2021-07-13 11:39:37 +03:00
Salvatore Orlando a9a8bfa13b NSX-V: Fail only if DHCP enabled when updating external subnet
The current logic is forbidding all sort of updates on subnets
associated with external networks.

Change-Id: I89f3ef821534f26b820790b48ba385889498ff46
2021-06-16 01:13:44 -07:00
Kobi Samoray fe0264d35a NSXV: handle missing SG mapping
When creating rules, the plugin fetches the SG mapping from Neutron DB.
If this mapping is missing, the plugin should issue a proper error and
fail.

Change-Id: Icd00116dc6e81949513db18f16eced8a2b125c7d
2021-04-28 08:59:17 +00:00
Zuul 1d6fbdf15b Merge "NSXV: protect against stale LB bindings" 2021-04-19 14:22:53 +00:00
Kobi Samoray 25b959bae3 NSXV: Elevate context for router firewall update
Edge firewall might contain FW rules which are originated from various
sources, e.g FWaaS rules, subnet rules, LB rules etc.

When a non-admin user applies a change to the FW config by changing any
of the above, the new FW config should still include resources which
aren't visible to the user. Therefore the context should be elevated.

Change-Id: I8cd3310976708b0bbf1442de7f38ebc06dc8506a
2021-03-30 13:25:02 +03:00
Kobi Samoray 5c68ca7bb2 NSXV: protect against stale LB bindings
When a stale load balancer binding remains in the Neutron DB while the
load balancer was deleted, it causes FWaaS failures.

To protect agains, we take the following measures:
- Use try-catch to ignore the LB edge firewall rule while performing
FWaaS transactions.
- Delete the LB binding while deleting the router, while routers are
used as LB platform.

Change-Id: I3ab60093e3ac8ce6ff1d3557622745484d43b759
2021-03-15 17:15:13 +02:00
asarfaty e499e6c1a9 NSX|V: Fix error message for add router interface
Change-Id: Id7db7e6d6d5ace173d7ebd06000c9692217e0d8c
2021-03-11 04:11:15 +00:00
asarfaty 3dcaa632e5 NSX|V: Fix portgroup provider network validation
In case the physical network is not assigned, the db query
should be skipped or else it fails and raise.

Change-Id: Ief5af76f47e6b037e5fdda707f7fa75f73b0653f
2021-03-02 11:36:57 +02:00
asarfaty 09d2de0e75 NSX|V3+P: Do not set default Qos policy on external networks
Change-Id: I9cee1ac13f70268055eaa2598061a6e80b9c94cc
2021-01-21 10:27:04 +02:00
asarfaty 132f006574 Update code to match recent neutron changes
NSX|V3: fix call to _confirm_router_interface_not_in_use
Commit Iea58177cce30d7ce6ba7b36ce5f8375c0985179e changed the api

NSX|V: Fix _make_port_dict api
Commit Ic08e4049f6156c0700ca3c7aee251b6eb0eb97da added bulk argument
to this api.

Change-Id: I6bbe34cfedf731f0711fee45800d9f78247bc6ba
2021-01-17 12:09:47 +02:00
asarfaty ead7695f47 NSX|V: Fix SG rule validation
Change-Id: I55aef54ff98b650f2dfc2e0de47a1ddec29ef2bd
2020-12-17 10:37:53 +02:00
asarfaty fca41da83f NSX|V: Add remote_address_group_id to SG rules if missing
Neutron added a new rule field that should be initialized if missing

Change-Id: I23fc3afe9625715edfdbf4e7b74f64bd42e7770b
2020-12-10 08:11:17 +02:00
asarfaty 5da150fcd2 Integrate with neutron DB engine facade migration
integrate with neutron patch Id3f09b78c8d0a8daa7ec4fa6f5bf79f7d5ab8f8b
And also skip new tests added in I99681736d05eefd82bdba72b3866eab9468ef5dd

Change-Id: I8b119bc69cc87185ea77646e70135c5984200038
2020-11-30 10:29:46 +02:00
asarfaty 26f855f9c9 Remove some pylint exclusions (part 2)
Change-Id: I2047f083af01dd0452f61d9fb807098e0514ff36
2020-10-01 10:25:06 +02:00
asarfaty b6bd7e49d1 Remove some pylint exclusions
Change-Id: I6909c10471039f1e68224679ceeb2867ab5a3a47
2020-09-30 10:32:46 +02:00
asarfaty 50afa71853 Fix broken Victoria branch
1.Upgrade pylint to 2.4.4, add exclusions to the tests, and
  fix some lint errors in the code

2. Fix user creation with GRANT in MySQL 8.0(Ubuntu Focal)
In Ubuntu Bionic (18.04) mysql 5.7 version used to create
the user implicitly when using using the GRANT.
Ubuntu Focal (20.04) has mysql 8.0 and with mysql 8.0 there
is no implicit user creation with GRANT. We need to
create the user first before using GRANT command.
See also commit I97b0dcbb88c6ef7c22e3c55970211bed792bbd0d

3. Remove fwaas from the zuul.yaml
4. Remove DB migration test which is failing ue to FWaaS migration
with py38
5. Fix cover tests python version in .tox
6. fix requirememnts

Change-Id: I22654a5d5ccaad3185ae3365a90afba1ce870695
2020-09-21 15:31:18 +02:00
asarfaty 06fee9c0d2 Stop using plugin _get_subnet
Subnets are now only consumed via OVO, see commit I57a4508f42820db7876a9a8a63bb4d46e7b7ac28

Change-Id: Ibdbfcc8561861157564ad1cfcc9d73b6c4f5cfb6
2020-07-27 05:58:47 +00:00
Zuul cd16e6bf8c Merge "NSX|V: Add allow icmp6 multicast rules in edge firewall" 2020-07-23 06:32:51 +00:00
asarfaty 00f43c2b63 Remove six package usage
Since py2 is no longer supported, built in methods can replace the
six package usage, as been done in the neutron project

Change-Id: I922963fbbcc0ab263e1f6e56907b73b007015a75
2020-07-19 17:19:31 +02:00
asarfaty 2defc5e7ac NSX|V: Add allow icmp6 multicast rules in edge firewall
Vsphere7 started to block this traffic so adding those rules to be
backwards compatible.
In addition, add admin utility to fix existing edge firewalls:
nsxadmin -r routers -o nsx-update-fw

Change-Id: Ia5c2832e377a1a17ef279191ee91b6fec8f65443
2020-07-11 04:14:37 +00:00
asarfaty 4effe88ac6 NSX|V: Fix init connectivity validation
1. Make the validation optional (If False - only log the warnings)
2. Validate each resource against all clusters and fail only if not
   connected to any

Change-Id: I9abd091fc42d4dbe22e1b806df4d9131ab054726
2020-06-22 11:46:05 +02:00
Kobi Samoray 22e494f2b5 NSXV: allow DHCP reply on DHCP edges
Work around DHCP edge's behavior where firewall is blocking DHCP unicast
replies.

Change-Id: I2ed3de8d665166fed3bc42da56d2a180b070ca0d
2020-05-21 18:47:54 +03:00
asarfaty af0861ce2e NSX|V: Fix security groups rules creation
When updating a section, exising icmp echo request/reply rules cannot have
icmp code field.

Change-Id: I31141eb7a05ff508acb3cea12d7bdd7d8695d9e1
2020-03-22 12:45:29 +02:00
asarfaty 33c79c1a9b NSX|V: Partial support for distributed routers with FWaaS-V2
FWaaS V2 cannot be supported for distributed routers since the
FW rules are on the PLR, but only the TLR has the subnets interfaces.
This patch adds a partial support, assuming all interface ports
have the same policy & rules (as it was in FWaaSv1) by ignoring the vnic-id.
This way customers with distributed routers can migrate to FWaaS v2.

Change-Id: Ieaaf4149d5daa07341effdc480ae453a67d5b6bb
2019-12-22 06:23:42 +00:00
asarfaty b9dcadc148 Add logging in get_ports for all plugins
This will help debug performance issues

Change-Id: I60cfc8261c7b5f78a907d54822ce9fe126f2fc0d
2019-12-16 06:46:22 +00:00
Kobi Samoray 6966160da6 NSXv: evaluate NAT rules correctly
Change-Id: Ic558a08cd629e3b2b02190bb5fff9d4b5ad05396
2019-12-10 16:36:36 +02:00
asarfaty 511404073c NSX|V: Fix error handling for distributed router interface
1. No need to rollback the interface creation in teh distributed router
driver. It is rolled back on the plugin level. the Double rollback causes
a new error to be raised.
2. In the plugin level - do not alert on the rollback faliure.
It may be legit
2. In the plugin level raise a proper error to neutron, instead of the
internal one.

Change-Id: I129f595d6cd17cd0af62fc9e2855451b97e73ff0
2019-11-13 11:21:49 +02:00
Kobi Samoray 1c0f51d54f NSXV: fix router static routes for non-admin users
Non-admin users could not set static routes as neutron didn't fetch the
port info for the external network.

Change-Id: Ib266b6348d450b6b73064aeaf0b79a443c46a1ee
2019-11-07 15:24:14 +02:00
Adit Sarfaty 2696f331e6 NSX|V: Validate SG rule remote-ip-prefix is not 0.0.0.0/x
This is not supported by the backend and should be replaced with 'Any'

Change-Id: I96081d7e88863f9bc1d091cc3a5f7be0b9dde4e0
2019-10-23 10:54:33 +00:00
Kobi Samoray 4be41bb4b4 NSXv: Cleanup redundant FW rules from VDR
Change-Id: Ida99b5793e9537b581e562fa329d0dc880fc3621
2019-08-28 17:55:38 +03:00
Kobi Samoray f11709dba5 NSXv: VDR interface operation performance
Change-Id: Ie36c6cbb8fc0a8055a8a3d84e8940b1c62fcba9e
2019-08-28 17:49:53 +03:00
Adit Sarfaty 6e97b112c8 NSX|V: Add configuration validation
For each availability zone, check that all the resources in the configuration
and connected on teh NSX

Change-Id: I60551294c4f2d1d9d43032ac64468e5915e1f09d
2019-08-22 08:46:44 +03:00
Boden R eedbcdd03b use payloads for ROUTER_GATEWAY events
This patch switches the code over to the payload style of callbacks [1]
for PORT ROUTER_GATEWAY events for those that are not using them yet.
The unit tests are also updated where needed to account for the
payload style callbacks and publish() method. Finally the patch
normalizes the passing of gateway IPs which are currently referred to
as 'gw_ips' and 'gateway_ips' depending on the event; now all events use
'gateway_ips'.

[1] https://docs.openstack.org/neutron-lib/latest/contributor/callbacks.html

Change-Id: Ibc255de79443e908cc3615a8e1cb108757f80011
2019-08-07 04:37:02 +00:00
Zuul 023efd13ab Merge "update for python3 train jobs" 2019-07-21 07:53:16 +00:00
Michal Kelner Mishali 1829355094 NSX|V: Add condition for port update when using dup ip_address
Adding verification for port_update, when using same ip_address
for different ports in the same network.

Change-Id: I0bba347e165147d42d71e1247feb76006fa4fdd1
Signed-off-by: Michal Kelner Mishali <mkelnermishal@vmware.com>
2019-07-11 14:14:40 +03:00
Boden R c3bf87fd05 update for python3 train jobs
Change-Id: Ic104e1a67e69a2e06fb47db23896a14cacf9ca24
2019-07-10 12:07:07 -06:00
Michal Kelner Mishali 8f852c60f3 NSX|V: Bug fixing for allowed address_pairs
Remove spoofguard mappings along with spoofguard on backend
when network is set without port security.

Change-Id: I03eac35ae0dfae1c716c54d972a2441c1d98f50a
Signed-off-by: Michal Kelner Mishali <mkelnermishal@vmware.com>
2019-07-03 10:45:14 +03:00
Salvatore Orlando 8280be510a [NSX-v] Improve handling of port security transition
- When network port security is set to True, ensure the same IP
  is not used for multiple ports
- Extend checks for netork port security to all ports, not only
  ports with a nova compute device_id
- When creating or updating a port, perform checks if port security
  is enabled for the network or the flag for allowing multiple
  addresses is unset.

Change-Id: I5d81257b55730d4544537bb269030ec7f1a277c1
2019-07-01 08:50:48 -07:00
Salvatore Orlando efa5e53404 [NSX-V] Allow VIP-like address if allow_multiple_address_pairs=True
When this flag is enabled, spoofguard restrictions do not apply,
therefore the same IP address can be used in allowed address pairs
for multiple ports on the same logical switch.

Change-Id: Idb5175451b2aa0bec631511c68c7b404e782d8d7
2019-06-13 22:29:02 -07:00
Zuul add65cebfa Merge "Move import out of octavia driver's way" 2019-06-03 14:48:49 +00:00
Kobi Samoray 398a04cdc6 Move import out of octavia driver's way
Octavia driver fails due to misplaced import
Also remove wrong #noqa from plugins

Change-Id: Icf03d089a383d253b9f2e9a62d71577dd9341f48
2019-06-03 10:25:54 +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
Adit Sarfaty 7ccd2f2e84 NSX|V: prevent the deletion of Lb interface ports
Make sure the user cannot delete those internal lb ports

Change-Id: If2be64b69c43f5ef6814abb3caffdfe554f7a3a1
2019-05-26 16:38:51 +03:00
Michal Kelner Mishali c567af4497 NSX: Restrict enable-dhcp on update external subnet
Adding restriction for enabling dhcp on updating external subnet

Change-Id: I4ae085eaac5461c637edb43888e615cf7bc97ccb
Signed-off-by: Michal Kelner Mishali <mkelnermishal@vmware.com>
2019-05-19 14:43:20 +03:00
Adit Sarfaty d753ec6945 Remove neutron-lbaas support & dependencies
Commit Ia4f4b335295c0e6add79fe0db5dd31b4327fdb54 removed all the
neutron-lbaas code from the master (Train) branch

Change-Id: I9035f6238773aad0591436c856550b7a5e01e687
2019-05-19 11:16:45 +03:00
Adit Sarfaty 46f921496d NSX|V: check edge existence before updating router admin state
Change-Id: I0b27155f47d33367634bf5e9d3c612e5e522faa1
2019-05-13 11:22:51 +00:00
Kobi Samoray fe9e9245bb NSXv: Subnet NAT rule configuration
While configuration flag
bind_floatingip_to_all_interfaces = True

the subnet NAT rule should not apply only to external interface, as it
also serves traffic between instances on the same router.
So if instances A and B are connected via the same router, and instance
A is accessing instance B's FIP, traffic should reach instance B with
the router's NAT IP - unless there's a FIP to instance A as well.

Change-Id: Ib312289bed86f8539f593da4a01f800b65f72ac5
2019-05-08 19:26:07 +03:00
Rodolfo Alonso Hernandez 33212a66eb Implement providernet._raise_if_updates_provider_attributes internally
Function [1] is a private function in Neutron and should not be imported
in other projects. Also this function is removed in [2], while
implementing the related bug.

Related-Bug: #1806052

[1] https://github.com/openstack/neutron/blob/stable/stein/neutron/extensions/providernet.py#L24
[2] https://review.openstack.org/#/c/633165/

Change-Id: Ic6260fbe944062c8db7c888b77c3725b2f44c68c
2019-04-03 11:16:03 +01:00