Commit Graph

11 Commits

Author SHA1 Message Date
Brian Haley 7594bb0627 Remove the 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.

This patch moves all references to "import mock" to
"from unittest import mock". It also cleans up some new line
inconsistency.

Fixed an inconsistency in the OVSBridge.deferred() definition
as it needs to also have an *args argument.

Fixed an issue where an l3-agent test was mocking
functools.partial, causing a python3.8 failure.

Unit tests only, removing from tests/base.py affects
functional tests which need additional work.

Change-Id: I40e8a8410840c3774c72ae1a8054574445d66ece
2020-04-28 18:05:37 -04: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
Swaminathan Vasudevan acd04d668b DVR: Clean stale snat-ns by checking its existence when agent restarts
At present there is no clear way to distinguish when the snat_namespace
object is initialized and when the actual namespace is created.
There is no way to check if the namespace already existed. The
code was only checking at the snat_namespace object instead of its
existence.

This patch addresses the issue by adding in an exists method to the
namespace object to identify the existence of the namespace in the
given agent.

This would allow us to check for the existence of the namespace,
and also allow us to identify the stale snat namespace and
delete the namespace when the gateway is cleared as the agent restarts.

This also applies for conditions when the router is manually moved
from one agent to another agent while the agent is dead. When the
agent wakes up it would clean up the stale snat namespace.
Change-Id: Icb00297208813436c2a9e9a003275462293ad643
Closes-Bug: #1557909
2016-08-04 10:39:15 -07:00
Cedric Brandily 23b907bc6e Remove deprecated use_namespaces option
The use_namespaces option has been defined as a workaround to kernels
not properly supporting namespaces. This limitation is behind us, it's
time to remove use_namespaces after its deprecation in Kilo in order to
simplify code and remove a poorly tested case (use_namespaces=False).

This change prepares for removal pullup_route method[1] which was only
used when use_namespaces=False.

[1] neutron.agent.linux.ip_lib

DocImpact
UpgradeImpact
Closes-Bug: #1508188
Related-Bug: #1435382
Depends-On: I303038eec560a6d99421140c2822aed8b518470b
Depends-On: I4feb2a15c7e1e4bfdbed2531b18b8e7d798ab3cc
Change-Id: I2fbf65df1250d9f9f1656b3964ee3b6de1ef1118
2015-11-18 19:17:29 +01:00
Cedric Brandily 2429dd917f Document self.assertEqual(expected, observed) pattern
Tests should use the following pattern to help reviewers:

  self.assertEqual(expected, observed)

This change documents it in effective_neutron.rst and corrects some test
modules[1] including nonobvious ones[2] as an example.

[1] neutron.tests.unit.agent.l3.test_.*
[2] neutron.tests.unit.agent.l3.test_router_processing_queue

Change-Id: I6d6363541e3fef6f66e808aab00507825205b209
2015-10-06 01:03:53 +02:00
Oleg Bondarev b220d10125 Do not delete fip namespace during l3 dvr agent resync
This was introduced by commit 46608806aa
which didn't take into account that fip namespace name is composed
from external network id rather than router id.
The fix is to ensure fip namespaces for the known routers are kept
by namespace manager on agent resync.

Closes-Bug: #1482521
Change-Id: I0ffd0a3f6d83f7356638827a1cfe4dabef24b891
2015-08-07 20:10:25 +03:00
Oleg Bondarev 46608806aa DVR: cleanup stale floating ip namespaces
During l3 agent periodic resync NamespaceManager takes care
of cleaning up stale router namespaces. This is true
for qrouter- and snat- namespaces. However stale fip-
namespaces also need to be cleaned up.
The patch adds fip-ns handling to the NamespaceManager.

Closes-Bug: #1470909
Change-Id: Ib6a8ae2ff66c0e1dd0978838c3f274748898f73e
2015-07-03 18:29:07 +03:00
Jenkins 6becf1a4b7 Merge "l3 agent: do router cleanup for unknown routers" 2015-07-02 20:06:09 +00:00
Oleg Bondarev 9efa1fdeed l3 agent: do router cleanup for unknown routers
The patch adds cleanup on router delete for routers which
are unknown to agent. This should cover the case when router is
deleted during resync on agent init.

Functional tests were updated and now handle 3 cases for l3 sync:
 - no routers were deleted during agent downtime,
 - some routers were deleted during agent downtime
 - some routers were deleted during agent resync

Closes-Bug: #1464238
Change-Id: Id98111849fa88d6807f757864187b059c491aaac
2015-06-22 16:13:35 +03:00
ChangBo Guo(gcb) c3d65a0ed9 Switch to oslo_utils.uuidutils
Get rid of oslo-incubator uuidutils

Closes-Bug: #1467020
Depends-On: I2df519965883b05d5d58cdc4785c850b0685dc2c
Depends-On: I9f8e98ad9517864a9ffdacf01c0a9a5aab554edb
Depends-On: Ied0faac809a5b72b1cd466c8babc9ca5418692c3
Change-Id: Iebe491b981b4b7c02785412fadd27678bb5e47de
2015-06-22 11:06:18 +00:00
Miguel Lavalle be77b688b9 Add tests for the l3 agent namespaces manager
The following tests are added for the l3 agent namespaces manager:

1) Unit tests
2) Funtional test
3) A test case within the l3 funtional test for periodic_sync_routers_task

Change-Id: Ia26f1ccdc0a6619aa231c8799acc80377f4144f8
Partially-Implements: bp restructure-l3-agent
2015-03-28 17:13:37 -05:00