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
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
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
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
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
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
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
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
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
Assign local variable "interface_name" before being referred in
"TestL3Agent._router_fip_qos_after_admin_state_down_up"
Change-Id: I5135f5c7c02b25728d2d8843889b9e8aef1265cd
Closes-Bug: #1860209
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
This patch makes L3 agent to update its ports' MTU when it's changed on
core plugin side.
Related-Bug: #1671634
Change-Id: I4444da6358e8b8420a3a365e1107b02f5bb1161d
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
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
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
Since the refactor is complete, let's clean these up and
use neutron-lib constants instead.
Trivialfix
Change-Id: Ic69d59d53ee78a4c6eb0104583755c4145fb8e46
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
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
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