Commit Graph

65 Commits

Author SHA1 Message Date
Brian Haley 542c2ff463 Update hacking version
Update hacking to a more recent version, along with
flake8-import-order.

Remove N347 (import mock library) check as that is the
default with later hacking versions.

Update the builtins override of '_' to be the neutron.i18n
version due to the code triggering a false positive. This
is done in a couple of other projects as well.

Fix a number of new warnings it found.

Added some ignore directives for new whitespace issues
found in the test tree, can fix later.

TrivialFix

Change-Id: I5923255af86cf1fa11ab8e3b03bb9efac7dd7b58
2024-02-08 10:34:10 -05:00
Slawek Kaplonski c1a0ceb86c [Fullstack] Remove unnecessary tests
This patch removes some of the fullstack test cases which aren't really
needed because they are either testing some use cases covered already by
scenario tests or some other common tests.

Removed tests:

* TestOvsConnectivitySameNetwork.test_connectivity - basic connectivity
  test covered by many other test cases,
* TestDhcpAgentNoHA.test_dhcp_assignment - basic test checking if
  network was assigned to the DHCP agent - it's tested by many other
  tests,
* TestLegacyL3Agent.test_namespace_exists - test which only checks that
  qrouter namespace was created by the L3 agent, not needed really,
* TestLegacyL3Agent.test_east_west_traffic - covered already by many
  scenario test cases,
* TestLegacyL3Agent.test_north_south_traffic - covered already by many
  scenario test cases,
* TestBwLimitQoS.test_bw_limit_qos_policy_rule_lifecycle - covered
  already by neutron-tempest-plugin scenario test,
* TestQoSWithL2Population - trivial test which isn't needed really,
* SecurityGroupRulesTest.test_security_group_rule_quota - already
  covered by the neutron-tempest-plugin admin api test cases,
* TestSubnet.test_create_subnet_ipv4 - already tested in many scenario
  test cases,
* TestSubnet.test_create_subnet_ipv6_slaac - already tested in tempest
  scenario test case,
* TestTrunkPlugin.test_trunk_lifecycle - already covered by the scenario
  test from the neutron-tempest-plugin

Additionally this patch removes monkeypatching of the init_handler
method from the neutron-ovs-agent. It was needed only due to the trunk
ports test and is not needed anymore.

Change-Id: Ifa438d30599ad7e627c85c772ffae9ae9226f7ea
2023-12-05 11:31:42 +01:00
yatinkarel 42ae944870 Switch fullstack/functional fips jobs to 9-stream
Master no longer support py3.6, so let's switch
these jobs to CentOS 9-stream which includes py3.9.

Also dbcounter[1] is not installable on CentOS 8-stream
and hence these jobs are currently broken.

Other fips jobs already switched with[2].

[1] https://review.opendev.org/c/openstack/devstack/+/839820
[2] https://review.opendev.org/c/openstack/neutron/+/833173

Closes-Bug: #1976323
Change-Id: Ie4e807b1490d59390316ec20b499b7676acfe410
2023-07-03 07:46:19 +00:00
Fernando Royo 92efd8e45b Dont raise RouterInterfaceNotFound on overlap check router ports
A corner case of the fix done in [1] could happend if, as a race
scenario, parallel requests evaluate other ports that could be deleted
during the process if they had already determined a overlapping, in that
case a RouterInterfaceNotFound exception was raised and the request
finished with that exception and a 404 status code.

This patch removes the exception due to a port not found, because if the
port is not found, the related subnet should not participate in the
overlap evaluation, so it makes no sense to break the process for a port
that no longer exists. It also improves the previous validation to
perform the overlapping check, being performed only when we have
at least more than one subnet, as the overlapping check with only one
subnet did not make sense.

Closes-Bug: #1998226

[1] https://review.opendev.org/c/openstack/neutron/+/859143

Change-Id: If4afe6f525c46f9cf7f02d8aae27dfc56144fd62
2022-12-02 17:37:40 +00:00
Fernando Royo 1abb77d7a6 Check subnet overlapping after add router interface
When simultaneous attempts are made to add an interface
to the same router including overlapping networks in cidrs,
both attempts are successful. There is a check to avoid this
overlap but is performed when creating the network interface
and it is done over the ports already attached to the router,
so at this moment the check is not able to detect the
overlapping. Furthermore, the create_port operation over the
ML2 plugin  must be executed in isolated transactions, so
trying to control the execution context or adding additional
steps to the transaction is not feasible.

This patch checks once the RouterPort is created on the
neutron database if there is more than one overlapping port,
triggering in that case the exception that will remove the
the culprit of overlapping.

Closes-Bug: #1987666
Change-Id: I7cec8b53e72e7abf34012906e6adfecf079525af
2022-10-21 15:53:13 +02:00
Zuul 218a1e9f61 Merge "Revert "[Fullstack] Mark TestHAL3Agent fip_qos test as unstable"" 2021-11-09 16:06:08 +00:00
Slawek Kaplonski bbdba95f40 Revert "[Fullstack] Mark TestHAL3Agent fip_qos test as unstable"
This reverts commit ec89cd23d1.

Reason for revert: as https://review.opendev.org/c/openstack/neutron/+/813128
is merged we don't use DHCP agent in those L3 agent tests at all so
those tests should be stable now.

Change-Id: I6ded877b2b40929a4f4151a68a0de82ddfca0b71
Related-Bug: #1946186
2021-10-25 12:10:58 +00:00
Zuul 12ca5e9a40 Merge "Revert "Use 2 dhcp agents in TestLegacyL3Agent"" 2021-10-16 03:12:26 +00:00
Zuul b78771bbd5 Merge "[Fullstack] Don't use dhcp in L3 agent tests" 2021-10-15 15:21:54 +00:00
Slawek Kaplonski b57fdf7038 Revert "Use 2 dhcp agents in TestLegacyL3Agent"
This reverts commit 07337f9e99.

Now we don't use dhcp in the L3 agent tests at all so this isn't
needed anymore.

Related-Bug: #1930401
Related-Bug: #1946186
Change-Id: If3a48251770c3e669ac5a9d6a44085d295809240
2021-10-08 10:27:49 +00:00
Slawek Kaplonski 416b7fe2f7 [Fullstack] Don't use dhcp in L3 agent tests
It's not really needed and it is causing failures due to bug [1].
We can revert that patch and use dhcp again when [1] will be fixed
on the privsep's side.

[1] https://review.opendev.org/c/openstack/neutron/+/794994

Closes-Bug: #1946186
Change-Id: I7f888fa0737a1e52cee758afee6b790ca6a80a32
2021-10-08 12:27:20 +02:00
Slawek Kaplonski ec89cd23d1 [Fullstack] Mark TestHAL3Agent fip_qos test as unstable
Mark TestHAL3Agent.test_router_fip_qos_after_admin_state_down_up
from the fullstack tests as unstable. It is hitting us a lot
in the gate recently so lets unblock the gate and buy some time
to investigate what is the root cause of that issue.

Related-Bug: #1946186
Change-Id: I8f250fdb8c0c25378fc3c164b74d78a6f420f5f5
2021-10-07 21:47:49 +02:00
Oleg Bondarev 07337f9e99 Use 2 dhcp agents in TestLegacyL3Agent
This is a workaround for privsep hanging issue described in bug 1930401.
Proper fix is developed in
https://review.opendev.org/c/openstack/neutron/+/794994
- this fix will revert current change to reproduce and verify
privsep issue is fixed.

Related-Bug: #1930401
Change-Id: I143cd55612118f243c0e502fb77a611d1ee48761
2021-06-08 15:15:08 +03:00
Brian Haley 055036ba2b Improve terminology in the Neutron tree
There is no real reason we should be using some of the
terms we do, they're outdated, and we're behind other
open-source projects in this respect. Let's switch to
using more inclusive terms in all possible places.

Change-Id: I99913107e803384b34cbd5ca588451b1cf64d594
2020-08-19 16:47:53 -04:00
Rodolfo Alonso Hernandez 37521cee8d Assign local variable before being referred
Assign local variable "interface_name" before being referred in
"TestL3Agent._router_fip_qos_after_admin_state_down_up"

Change-Id: I5135f5c7c02b25728d2d8843889b9e8aef1265cd
Closes-Bug: #1860209
2020-01-22 08:25:10 +00:00
Brian Haley 040b550a86 Use admin context when updating router gateway
When a router gateway is updated and the subnet changes,
we need to use the admin context in order for the operation
to succeed.  Since the target network has already been
verified to be external, this is OK. The other operations
in this area such as create and delete already do the
same thing.

Added a fullstack test that moves a gateway between subnets
and verifies it's reachable afterwards.

Change-Id: Iead87ba6182d633f0f808032166e02e767fcffae
Closes-bug: #1812118
2019-10-07 14:47:19 -04:00
LIU Yulong 78629e0d37 Remove L3 IP QoS cache when router is down
When router admin-state is down or removed, fip-qos and gateway-ip-qos
extension should delete the router IPs' QoS rate limit cache. Then if
the router is up again the router floating IPs QoS can be reconfigured.
This patch achives these:
1. make sure floating IP or gateway IP QoS cache removed.
2. floating IP QoS can be re-configured to snat device when router
   doing admin_state down/up.

Closes-Bug: #1826695
Change-Id: I24fcecd9686ad17fa50093bb8bccab0d6c711298
2019-08-16 23:36:27 +08:00
Slawek Kaplonski 8d8ce04ed6 Mark fullstack test_ha_router_restart_agents_no_packet_lost as unstable
Even after we merged [1] which should fix this failing test,
it is still failing quite often and we don't have root cause yet.

Lets (again) mark it as unstable for now to make our gate more
stable for now.

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

Change-Id: I8ab51afc154a4359d9667112d4563faa82f02fcd
Related-Bug: #1798475
2019-07-03 16:04:25 +02:00
LIU Yulong f5b2c7eed8 Assert HA router has one active hosting agent
Check HA router binding state before restart the agent
for test case:
test_ha_router_restart_agents_no_packet_lost

And move the ping check more nearly to the restart action.

This reverts commit bc073849b6.

Change-Id: Ia2eba8d19fcc4d744b7b93623c0f1faf0457bd91
2019-06-23 19:42:37 +08:00
Slawek Kaplonski bc073849b6 Mark fullstack test_ha_router_restart_agents_no_packet_lost as unstable
This test is still failing quite often and we don't have root cause
yet.
Lets mark it as unstable for now to make our gate more stable for now.

Change-Id: Id7d14b0b399ce7efc32c1524ca0f38d0a2f85410
Related-Bug: #1798475
2019-05-22 09:52:26 +02:00
ZhongShengping 161e6b80f0 Replace git.openstack.org URLs with opendev.org URLs
Thorough replacement of git.openstack.org URLs with their opendev.org
counterparts.

Change-Id: Ifc446e00d7f69cb23411b3a50c8d880c719f1e73
2019-04-23 10:00:45 +08:00
Rodolfo Alonso Hernandez 434b29a2cb Check the namespace is ready in test_mtu_update tests
Change-Id: Ifdeac05b485a079e2288b413829bce0e39aef6fd
Closes-Bug: #1820865
2019-03-27 17:59:15 +00:00
Sławek Kapłoński b09b44608b Remove deprecated 'external_network_bridge' option
This option is deprecated and marked to be deleted in Ocata. So
as we are now in Stein development cycle I think that it's good time
to remove it.

Change-Id: I07474713206c218710544ad98c08caaa37dbf53a
2019-03-09 22:07:38 +00:00
Slawek Kaplonski 8f656306f2 Revert "Restart all L3 agents in test that check no packet loss in HA routers"
Unfortunately it still sometimes fails because restart was still happened in
very short pause between agents.
I will need to figure out some other possible solution for that issue.

This reverts commit bdd3540554.

Change-Id: Iaf9d1be3255e941c5fe227943535ab7c6905253c
2019-03-03 13:31:18 +00:00
Slawek Kaplonski bdd3540554 Restart all L3 agents in test that check no packet loss in HA routers
In fullstack test
test_l3_agent.test_ha_router_restart_agents_no_packet_lost
restarts of L3 agents where done in 2 steps:
1. restart of all standby agents,
2. restart of all active agents.

It was done like that because of bug [1] and [2].
Now when those bugs are fixed, lets change this test to
some "more probable" scenario. So agents will be restarted
without checking which one is master and which is standby.
However agents will be restarted one by one instead of doing
restarts in (almost) exactly same time.

Restarting all agents in same time caused still some issue
on my local testing environment but I suspect that it might be
some problem related to the nature of fullstack tests and to the
fact that 2 different "nodes" are in fact simulated by namespaces only.

[1] https://bugs.launchpad.net/neutron/+bug/1776459
[2] https://bugs.launchpad.net/neutron/+bug/1798475

Change-Id: I731211b56a57d44636e741009721522f67c12368
2019-03-01 14:36:07 +01:00
Hongbin Lu ae4b331725 fullstack: retry on updating port's IP address
If the update_port call failed with error IpAddressAlreadyAllocatedClient,
retry a few more times in order to find IP addresses that are available.

Change-Id: I7c5d51b01fa56083b1a689fa629a9a34c8b77012
Closes-Bug: #1808595
2018-12-21 16:36:18 +00:00
LIU Yulong 8c17df7138 Notify router_update after directly gateway IP change
If directly change router gateway port IP address, the gateway IP
does not changed in router related namespace in l3 agent side. This
patch adds a method to catch a 'PORT' IP change event, and notify
the L3 agent.

Closes-Bug: #1795222
Change-Id: If276a7613c156f8c826967c9c8cbd6f2a8d32674
2018-11-12 16:13:20 -05:00
Zuul 9798d2bf81 Merge "Add fullstack test to restart agent with active l3-ha router" 2018-08-28 02:42:26 +00:00
Zuul c563530af5 Merge "[Fullstack] Remove central_external_bridge" 2018-07-17 05:01:13 +00:00
Brian Haley 88a0ebbe7f Add fullstack test to restart agent with active l3-ha router
Re-start of the l3 agent hosting the active l3-ha router
shouldn't cause data plane interruption, assuming there
is no failover.  Create a test explicitly for that.

Change-Id: I5963c21e2b382a09c40b81e2446350696e16d265
Related-Bug: #1776459
2018-07-09 14:21:05 -04:00
Slawek Kaplonski fd126a37c0 [Fullstack] Remove central_external_bridge
It is not necessary to use 2 "central" bridges, one for "data" and
one for "external" network simulation.
Also using 2 bridge will cause problems when "external_network_bridge"
option will be removed from L3 agent and it will use integration bridge
as it should be done.

Change-Id: I68ee51cbc148b2bfce0cba8de7cf9fe08df54c96
2018-06-29 15:05:19 +02:00
Slawek Kaplonski c57a5d9d8a [Fullstack] HA L3 agent restart only standby agents
In fullstack test which is testing if there is no packet lost
during restart of agents there were restarted always all agents
which hosted router.
In case when as first was restarted 'master' agent it might
lead to the case when after restart 'master' node was switched
to second L3 agent and that caused lost of few packets and
failed test.
This test should only check if restart of standby agents will
not cause any packet lost so this patch do it in this way.

Change-Id: I6293169d7d7f35e3a9726071e63003ac569dd01e
Closes-Bug: #1776459
2018-06-28 08:51:16 +00:00
Slawek Kaplonski 0b3a64480b [Fullstack] Ensure connectivity to ext gw before agents restart
In TestHAL3Agent.test_ha_router_restart_agents_no_packet_lost
fullstack test we should first ensure that connection from external_vm
to router's external gateway is possible. If it's fine, we
can restart L3 agents and test if connectivity will not be broken.

Change-Id: I1f153c553cd2dfa846ce80c166e2a35acd9169a3
Related-Bug: #1776459
2018-06-21 07:43:37 +00:00
Slawek Kaplonski ba1e1eb4dd Mark test_ha_router_restart_agents_no_packet_lost as unstable
Fullstack test
test_l3_agent.TestHAL3Agent.test_ha_router_restart_agents_no_packet_lost
is marked as unstable now becuase it is failing quite often recently.
We need to figure out what is the reason of this issue but
to not block gates with many failures, let's mark it as unstable
for now.

Change-Id: I21e590a24390345dfe451b035fd973928445e987
Related-Bug: #1776459
2018-06-14 14:31:28 +02:00
Slawek Kaplonski 3e9e2a5b4b Disable IPv6 forwarding by default on HA routers
In case of HA routers IPv6 forwarding is not disabled by default and
then enabled only on master node.
Before this patch it was done in opposite way, so forwarding was
enabled by default and then disabled on backup nodes.
When forwarding was enabled/disabled for qg- port, MLDv2 packets are
sent and that might lead to temportary packets loss as packets to
FIP were sent to this backup node instead of master one.

Related-Bug: #1771841

Change-Id: Ia6b772e91c1f94612ca29d7082eca999372e60d6
2018-05-31 20:19:21 +00:00
Sławek Kapłoński 85b46cd51e Monitor phys_bridges to reconfigured it if created again
In case when external bridge configured in OVS agent's bridge_mappings
will be destroyed and created again (for example by running ifup-ovs
script on Centos) bridge wasn't configured by OVS agent.
That might cause broken connectivity for OpenStack's dataplane if
dataplane network also uses same bridge.

This patch adds additional ovsdb-monitor to monitor if any
of physical bridges configured in bridge_mappings was created.
If so, agent will reconfigure it to restore proper openflow rules
on it.

Change-Id: I9c0dc587e70327e03be5a64522d0c679665f79bd
Closes-Bug: #1768990
2018-05-07 22:53:20 +02:00
Brian Haley 4f627b4e8d Change ip_lib network namespace code to use pyroute2
Change network namespace add/delete/list code to use
pyroute2 library instead of calling /sbin/ip.

Also changed all in-tree callers to use the new calls.

Closes-bug: #1717582
Related-bug: #1492714

Change-Id: Id802e77543177fbb95ff15c2c7361172e8824633
2017-10-04 21:09:28 +00:00
Ihar Hrachyshka f998e8d965 test_ha_router: wait until two agents are scheduled
We need to give some time to neutron-server to schedule the router to
both agents. This reflects what other fullstack test cases do.

Change-Id: I3bce907262635c76b5444fab480f7157172e77a2
Closes-Bug: #1667055
2017-09-01 20:37:04 +00:00
Ihar Hrachyshka cc69828ff0 Apply network MTU changes to l3 ports
This patch makes L3 agent to update its ports' MTU when it's changed on
core plugin side.

Related-Bug: #1671634
Change-Id: I4444da6358e8b8420a3a365e1107b02f5bb1161d
2017-08-11 11:10:10 -04:00
Akihiro Motoki f64110f652 Use flake8-import-order plugin
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
It enforces loose checking so it sounds good to use it.
This flake8 plugin is already used in tempest.

Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.

Setup for unit tests of hacking rules is tweaked to disable
flake8-import-order checks. This extension assumes an actual file exists
and causes hacking rule unit tests.

Change-Id: Ib51bd97dc4394ef2b46d4dbb7fb36a9aa9f8fe3d
2017-07-05 03:15:27 +00:00
Kevin Benton 2448df8651 Fullstack: enable DHCP agent
With the merge of I8111469ad4b0d88580bff7a77492ad95af8e9377,
ports will not transition to the ACTIVE status on a subnet
that has DHCP enabled that does not clear the DHCP provisioning
block. So if we don't deploy a DHCP agent for these tests,
the ports will not transition to ACTIVE.

This fixes the fullstack tests by adding DHCP agents
to clear the provisioning block.

Co-Authored-By: Jakub Libosvar <libosvar@redhat.com>
Closes-bug: #1677729
Change-Id: I66c5e4ead23f0e6bd4b9e867c8cf419f67f6d78c
2017-04-21 09:26:46 +00:00
John Schwarz 977d254cc6 Throttle SIGHUPs to keepalived
Multiple SIGHUPs in quick succession might cause the master keepalived
to forfeit its mastership (which will cause keepalived to remove IPs of
its external devices, severing connectivity). This can happen when, for
example, associating or disassociating multiple floatingips.

The patch makes the agent throttle SIGHUP sent to keepalived: the very first
SIGHUP is always sent; as for subsequent signals, they are delayed till
agent threshold is reached. (It's 3 seconds by default.)

As an example, when three consequent router updates trigger keepalived
respawn then:
* the very first signal is sent as usual;
* the second signal is deferred and sent in up to 3 seconds since the
  first signal;
* the third signal is ignored, though the change that triggered it will
  be correctly applied by the second signal handler when it is triggered
  after threshold delay.

If the last time a spawn request occurred is older than current-time
minus threshold then there is no delay.

Co-Authored-By: Jakub Libosvar <libosvar@redhat.com>
Co-Authored-By: Cedric Brandily <zzelle@gmail.com>
Co-Authored-By: Ihar Hrachyshka <ihrachys@redhat.com>

Closes-Bug: 1647432
Change-Id: I2955e0de835458a2eea4dd088addf33b656f8670
2017-03-28 03:37:09 +00:00
Brian Haley 3fec181772 Clean-up L3 constant TODOs
Since the refactor is complete, let's clean these up and
use neutron-lib constants instead.

Trivialfix

Change-Id: Ic69d59d53ee78a4c6eb0104583755c4145fb8e46
2016-12-14 11:54:12 -05:00
sridhargaddam 989aba6a2b fullstack: test for IPv6 north-south traffic
This patch validates north south IPv6 traffic through legacy router.

Partial-Bug: #1583028
Change-Id: I12cccdb01960e89ddfc795b587d617da37c9fee6
2016-08-22 06:43:27 +00:00
Jenkins fc02d5b7ea Merge "Restore MySQL and Postgresql functional testing" 2016-06-30 15:11:09 +00:00
Mike Bayer 546ba377db Restore MySQL and Postgresql functional testing
The oslo.db opportunistic test fixtures were not being
used effectively and the MySQL / PG databases were not
being used.  This patch restores working patterns against
oslo.db.  Additionally, the migration level tests have also
been updated to make use of oslo.db provisioning functionality
and unused methods have been removed.

The current approach makes use of oslo.db provisioning constructs
directly, as well as some semi-private attribute access within
oslo.db enginefacade, in order to work around some issues
that have arisen in oslo.db's test_base.
A new release of oslo.db will provide
public API points to resolve pending issues, and to
allow neutron's use cases here which will
also be of general applicability to openstack projects.

Closes-bug: #1594898

Change-Id: Ie27cf174fa24c2f479af47335d9ae139fb7d159a
2016-06-29 13:20:17 -04:00
Jakub Libosvar a626172706 Move wait_until_true to neutron.common.utils
We need to be able to re-use wait_until_true in tempest scenario tests.
There is tempest bug https://bugs.launchpad.net/tempest/+bug/1592345
that prevents us to do so.

Also wait_until_true is not linux specific so it makes more sense to
have it in common package.

Change-Id: Ib8b0e51dbd9edaa58391774d428a737836dfdf77
2016-06-27 11:40:11 +00:00
sridhargaddam 45d363241d fullstack: test for IPv6 east-west traffic
This patch validates east west IPv6 traffic through legacy router.

Partial-Bug: #1583028
Change-Id: Id18065340d49dfd389d88cc625f5a80be8da9a50
2016-05-27 17:17:04 +00:00
venkata anil b73f849f89 fullstack: test for snat and floatingip
Fullstack test to test snat and floatingip through legacy router.
This test creates external network and boots a vm with external
network's gateway and connected to central-external-br.
Tenant vm is booted on internal network.
Tenant Router is connected to internal and external networks.

To test SNAT, it pings external vm from tenant vm.
To test floatingip, a new floatingip is assigned to tenant vm
and tests pinging to tenant vm's floatingip from external vm.

Partial-Bug: #1583028
Change-Id: I1f30c240419ec93a26368ed1623bb2ede595e3d1
2016-05-20 13:25:59 +00:00
venkata anil 936fe6c9af fullstack: test for east west traffic
Fullstack test to test east west traffic through
legacy router.

Partial-Bug: #1583028
Change-Id: I3bfdd6cfafd5d4d1aa6a310efc9c8a8cb817ac46
2016-05-19 22:02:08 +00:00