Commit Graph

37 Commits (1c2e10f8595d2286bd9bec513bc5a346a84a6f7c)

Author SHA1 Message Date
Zuul 86139658ef Merge "Stop OVS agent before starting it again" 4 years ago
Rodolfo Alonso Hernandez b77c79e5e8 Stop OVS agent before starting it again
In TestOVSAgent, there are two tests where the OVS agent is
configured and started twice per test. Before the second call,
the agent should be stopped first.

Change-Id: I30c2bd4ce3715cde60bc0cd3736bd9c75edc1df3
Closes-Bug: #1830895
4 years ago
Ihar Hrachyshka 4aeec20001 Drop of_interface option
Default value for "of_interface" config option was switched
to "native" in Pike release.
In the same release this option was deprecated to removal.
Now it's time to remove it and force use of "native" driver to
manage openflows.

Change-Id: Ic900209868acfbe3bbb56fabbbf5c4472857e412
Co-Authored-By: Ihar Hrachyshka <ihrachys@redhat.com>
Co-Authored-By: Slawek Kaplonski <skaplons@redhat.com>
4 years ago
Boden R f92a726c4d use callback payloads for AGENT OVS_RESTARTED events
This patch switches the code over to the payload style of callbacks [1]
for AGENT OVS_RESTARTED events. In addition it updates the unit tests to
also use payloads for OVS_RESTARTED based events as needed.

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

Change-Id: I7b774735fb875a808b048a17da1e0487e5bbcb44
4 years ago
Brian Haley c3b83a9ca6 Fix all pep8 E265 errors
Fixed all pep8 E265 errors and changed tox.ini to no longer
ignore them.  Also removed an N536 comment missed from a
previous change.

Change-Id: Ie6db8406c3b884c95b2a54a7598ea83476b8dba1
5 years ago
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
6 years ago
Boden R 0e2b667bf1 use neutron-lib callbacks
The callback modules have been available in neutron-lib since commit [1]
and are ready for consumption.

As the callback registry is implemented with a singleton manager
instance, sync complications can arise ensuring all consumers switch to
lib's implementation at the same time. Therefore this consumption has
been broken down:
1) Shim neutron's callbacks using lib's callback system and remove
existing neutron internals related to callbacks (devref, UTs, etc.).
2) Switch all neutron's callback imports over to neutron-lib's.
3) Have all sub-projects using callbacks move their imports over to use
neutron-lib's callbacks implementation.
4) Remove the callback shims in neutron-lib once sub-projects are moved
over to lib's callbacks.
5) Follow-on patches moving our existing uses of callbacks to the new
event payload model provided by neutron-lib.callback.events

This patch implements #2 from above, moving all neutron's callback
imports to use neutron-lib's callbacks.

There are also a few places in the UT code that still patch callbacks,
we can address those in step #4 which may need [2].

NeutronLibImpact

[1] fea8bb64ba7ff52632c2bd3e3298eaedf623ee4f
[2] I9966c90e3f90552b41ed84a68b19f3e540426432

Change-Id: I8dae56f0f5c009bdf3e8ebfa1b360756216ab886
6 years ago
Thomas Morin ea2cab0e15 openvswitch agent: add OVS_RESTARTED event
This new event is aimed at informing that OVS has restarted, and in particular
to let L2 extensions know that they may need to setup their flows again.

Change-Id: I9aebe7ccc3e2f565b4339d42842d89b911131b1f
Closes-Bug: 1646526
Partial-Bug: 1657689
6 years ago
Jakub Libosvar 42cc227798 Change default exception in wait_until_true
By default, wait_until_true uses default exception from eventlet which
is eventlet.TimeoutError. This class is not subclass of Exception but
BaseException. In case wait_until_true times out in any test, the whole
test executor worker is stopped leaving scheduled tests not executed.
This patch replaces eventlet.TimeoutError with new WaitTimeout
exception, that inherits from Exception and thus won't break execution
of other test cases in case it's raised.

Related-Bug: 1625221
Change-Id: I44c0c22f427f61d84963e6e59393b90fbaa8f058
6 years ago
Kevin Benton d46756a27b Add sanity pings to restart tests to ensure connection
This adds sanity pings to the functional agent restart tests
to make sure there is actual connectivity between the two namespaces
before starting the restart exercise. This helps distinguish
whether a failure is because of a setup issue or because of
the restart process.

Change-Id: Id64ce49597b7e62e065f840a1372a930ce558e38
Partial-Bug: #1621789
7 years ago
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
7 years ago
Jakub Libosvar c13d722f39 ovsdb: Don't let block() wait indefinitely
Poller.block() calls select() on defined file descriptors. This patch
adds timeout to select() so it doesn't get stuck in case no fd is ready.

Also timeout was added when reading transaction results from queue.

Closes-Bug: 1567668
Change-Id: I7dbddd01409430ce93d8c23f04f02c46fb2a68c4
7 years ago
Frode Nordahl 773394a188 OVS: Add support for IPv6 addresses as tunnel endpoints
Remove IPv4 restriction for local_ip configuration statement.

Check for IP version mismatch of local_ip and remote_ip before creating
tunnel.

Create hash of remote IPv6 address for OVS interface/port name with least
posibility for collissions.

Fix existing tests that fail because of the added check for IP version
and subsequently valid IP addresses in _setup_tunnel_port.

DocImpact

Change-Id: I9ec137ef8c688b678a0c61f07e9a01382acbeb13
Closes-Bug: #1525895
7 years ago
Jakub Libosvar 7d5b1f8ddd Skip l2_ovs_agent functional tests
Let's skip the flaky tests until we find the root cause. The debugging
will happen with another patch that unblocks these tests so we still
have reproducer.

Change-Id: Icad4c1fb7a7ef9d6f5c34f48deb46ae286cb536b
Related-Bug: 1567668
7 years ago
Clayton O'Neill a549f30fad Don't disconnect br-int from phys br if connected
When starting up, we don't want to delete the patch port between br-int
and the physical bridges. In liberty the br-int bridge was changed to
not tear down flows on startup, and  change
I9801b76829021c9a0e6358982e1136637634a521 will change the physical
bridges to not tear down flows also.

Without this patch the patch port is torn down and not reinstalled until
after the initial flows are set back up.

Partial-Bug: #1514056
Change-Id: I05bf5105a6f3acf6a313ce6799648a095cf8ec96
7 years ago
Hynek Mlnarik cacde308ee Cleanup stale OVS flows for physical bridges
Perform deletion of the stale flows in physical bridges consistently with
br-int and br-tun, respecting drop_flows_on_start configuration option.
Added tests for auxiliary bridge and functional tests for the physical
bridge using VLAN/flat external network. Fixes part of the bug 1514056;
together with [1] and [2], the bug should be considered fixed.

The commit also fixes inconsistency between netmask of allocated IP
addresses assigned in _create_test_port_dict and ip_len in _plug_ports
of base.py.

[1] https://review.openstack.org/#/c/297211/
[2] https://review.openstack.org/#/c/297818/

Co-Authored-By: Jian Wen <wenjianhn@gmail.com>
Partial-Bug: 1514056
Change-Id: I9801b76829021c9a0e6358982e1136637634a521
7 years ago
Clayton O'Neill 8dce6a5c87 Don't delete br-int to br-tun patch on startup
When starting up, we don't want to delete the patch port between br-int
and br-tun unless we're also dropping the flows..  In liberty both of
these bridges were switched to not dump flows on startup and to put the
bridges in secure mode so that default flood flows are not installed
when the bridge is created.

Without this patch the patch port is torn down and not reinstalled until
br-tun is setup again.

Partial-Bug: #1514056
Change-Id: Ia518a99a2de5d1bda467fde57892c43970f88bcd
7 years ago
Ramu Ramamurthy 5289d94949 Remove stale ofport drop-rule upon port-delete
When a port is deleted, that port is set to a dead-vlan, and
an ofport drop-flow is added in port_dead().

The ofport drop-flow gets removed only in some cases
in _bind_devices() - depending on the timing of the
concurrent port-deletion. In other cases, the drop-flow
never gets removed, and such garbage drop-flow rules
accumulate forever until the ovs-agent restarts.

The fix is to use the function update_stale_ofport_rules which
solves this problem of tracking stale ofport flows
in deleted ports, but currently only applies only to
prevent_arp_spoofing.

Change-Id: I0d1dbe3918cc7d7b3d0cdc49d7b6ff85f9b02a17
Closes-Bug: #1493414
7 years ago
Jenkins 9b830dde9b Merge "Fix module's import order" 7 years ago
Bhagyashri Shewale 88e899f7a0 Fix module's import order
Made corrections in import order for built-in, third party and
project specific modules as per OpenStack import standards [1].

[1] http://docs.openstack.org/developer/hacking/#import-order-template

Change-Id: I899deefd6ee4732d6c0afd17a5afbe42b0fa37ba
7 years ago
rossella 584faf47e2 Don't sync all devices when some fail
With the new RPC calls get_devices_details_and_failed_devices
and update_device_list the agent gets a list of devices
for which some operation failed. The agent can now make use
of this information and instead of syncing all the devices
can sync only those which failed.
With the current change if a device keeps failing, the agent
will try to sync it forever. In a following patch I will limit
the number of retrials.

Partially-Implements: blueprint restructure-l2-agent
Change-Id: I295dc79031a0547f8687c5835c7ba7bbc43df36d
7 years ago
Terry Wilson 71fa182000 Make sure datapath_type is updated on bridges changed
When changing datapath_type in the config, physical and tunnel bridges
do not have their datapath_type updated. Calling create() on already
created bridges should be safe as it passes '--may-exist' when adding
the bridge, which will do nothing if the bridge already exists, but
the second part of the transaction will still update things like
datapath_type.

It should be noted that ancillary bridges (like br-ex) are not
modified by this patch as datapath_type was never applied to them to
begin with.

Incidentally, the native and vsctl versions behaved slightly
differently when handling datapath_type: vsctl builds the multi-cmd
transaction with add-br ... -- set ..., so that the second cmd would
actually complete. The native just bailed if may_exist and the bridge
existed. This is fixed as part of this patch.

Change-Id: Ib8bc817c7bc724d80193d0ca7af480a7ea103f77
Closes-Bug: 1532273
7 years ago
rossella ccdf211b4c Revert "Revert "OVS agent reacts to events instead of polling""
The original change had to be reverted because it caused
tests failing in the gate. The failures were due to the
fact that when a port was not ready, an exception was
thrown to trigger a full resync of the agent. This
behavior was meant to be temporary and was fixed in a
dependent patch that was not merged though. This revert
moves the handling of not ready ports in this patch.
It also refactors the unit tests a bit.

This reverts commit e7270d9505.

Change-Id: I6574cef3c95525ace6a98cf968ee159190681394
8 years ago
Armando Migliaccio e7270d9505 Revert "OVS agent reacts to events instead of polling"
This might be associated to manifestation of bug #1514935

This reverts commit 1992d52d63.

Closes-Bug: #1514935
Change-Id: If01cc87b6735e1bc039f99c4c6121e7c5ce547d0
8 years ago
rossella 1992d52d63 OVS agent reacts to events instead of polling
OVSDB monitor generates the events that the OVS agent
needs to process (device added or updated). Instead of
polling the agent processes the queue of events.

Change-Id: I168a3cc3aa96a809153a30635ad7bda29e8ee47c
Partially-Implements: blueprint restructure-l2-agent
8 years ago
Paul Ward 0a300a2277 Better tolerate deleted OVS ports in OVS agent
This change will not force a resync in the case where a virtual machine is
deleted, and therefore its OVS port deleted, in between the time an RPC
call was made to get the devices and where we make the call to correlate
those devices to vif ports.

Change-Id: Ie55eb69ad7ee177f0cf8ee8fc7fc585fbd0d4a22
Closes-Bug: #1499488
8 years ago
Haim Daniel b7b6f3fe82 ovs_neutron_agent: display loaded extensions
Currently neutron agent-show command does not provide the visibility for the
loaded extensions. This commit fixes that.

DocImpact

Change-Id: Iab101682df4676ad3ca2531356a1de8f2a2d4f14
Closes-Bug: #1497969
8 years ago
Ihar Hrachyshka ed3c317ed9 Fixed functional test that validates graceful ovs agent restart
The async_ping function returns a callable that returns True when all ping
futures are done. Since those futures are running for 10 secs, there was no
chance that the result of the callable was True.

The test was bailing out without calling bridge reset even a single time,
effectively leaving the feature untested in gate.

Another thing to note is that for some reason the patch fixed oslo rootwrap
errors in the test when executed locally. Since I still don't understand how
it's possible that it fixes the issue for me, I mark the bug as related only,
and will track logstash after it's merged to see whether it applies unknown
magic to gate jobs too.

Change-Id: Iaa977abddf1a0c6af7e964f1a5cd545ffb79585a
Related-Bug: #1490051
8 years ago
Jenkins 15c5371b4d Merge "OVS agent add functional tests of OVS status" 8 years ago
rossella c5d182da58 OVS agent add functional tests of OVS status
Add a functional tests to verify that the agent
behaves correctly when OVS restarted.

Partially-Implements: blueprint restructure-l2-agent
Change-Id: Ifeb0f2f6a06baead93df2c016ea26bfea990734d
8 years ago
gong yong sheng 275936261c Remove duplicated codes in two test cases
Change-Id: Icc36af93a6d648ba46388be270f9c7b6082d0ef1
8 years ago
Sean Mooney 63b0336282 Add config option to specify ovs datapath.
This change introduces a new datapath_type parameter
to allow specification of the ovs datapath to be used.
This change introduces new functional and unit tests.

DocImpact
Change-Id: I929d8d15fc6cfdb799c53ef0f3722f4ed5c1096d
Partial-Bug: #1469871
8 years ago
Eugene Nikanorov 73673beacd Graceful ovs-agent restart
When agent is restarted it drops all existing flows. This
breaks all networking until the flows are re-created.

This change adds an ability to drop only old flows.
Agent_uuid_stamp is added for agents. This agent_uuid_stamp is set as
cookie for flows and then flows with stale cookies are deleted during
cleanup.

Co-Authored-By: Ann Kamyshnikova<akamyshnikova@mirantis.com>

Closes-bug: #1383674

DocImpact

Change-Id: I95070d8218859d4fff1d572c1792cdf6019dd7ea
8 years ago
Miguel Angel Ajo a034115e61 OVS agent QoS extension functional test for bandwidth limit rules
This functional test spawns the OVS agent, with bandwidth limit rules in
a policy attached to ports. Then it asserts that the low level OVS
bandwidth limits are set for each port.

To make this possible we refactor and extract the base OVS agent test
framework into neutron.tests.functional.agent.l2.base.

Partially-Implements: blueprint ml2-qos
Change-Id: Ie5424a257b9ca07afa72a39ae6f1551d6ad351e7
8 years ago
rossella ced2e63cb8 L2 agent RPC add new RPC calls
This patch introduces two new RPC calls:
* update_device_list
* get_devices_details_list_and_failed_devices

update_device_up and update_device_down are the RPC calls
used by the L2 agent to notify the plugin that
a device is up or down. These calls accept only one device.
update_device_list accepts a list of devices that will
be put up or down and returns a list of devices for which
the operation failed.

get_devices_details_list_and_failed_devices is a new RPC
call that returns a list of devices details and a list of
devices for which it was not possible to retrieve the
details.

Thanks to these new calls, the agent will be able to update
the status of several devices using one RPC call
and to retry the operation only for the devices that failed
instead of performing a full resync.
This will be implemented in another patch.

This patch introduces the new calls only for the OVS agent.
A following patch will take care of the other L2 agents.

DocImpact
Partially-Implements: blueprint restructure-l2-agent

Change-Id: Idb4e81f4399cf66025ec7edfcb78801c15e493af
8 years ago
Kevin Benton f1771131a8 Change the half of the bridge name used for ports
The code to generate the names of the patch ports
was based on a chunk of the bridge name starting from
the beginning. With the long suffix, this ended up
excluding all of the random characters in the name.
(e.g. br-int374623235 would create an interface br-in-patch-tun).

This meant that if two tests using patch interfaces ran together,
they would have a name collision and one would fail.

This patch updates the patch port name generation to use the
randomized back portion of the name.

Change-Id: I172e0b2c0b53e8c7151bd92f0915773ea62c0c6a
Closes-Bug: #1470637
8 years ago
Rossella Sblendido 21ff82d9d3 Adds base in-tree functional testing of the ovs_neutron_agent
Base setup and utility methods for functional testing of the
OVS L2 agent.

Partially-Implements: blueprint restructure-l2-agent
Co-Authored-By: Rossella Sblendido <rsblendido@suse.com>

Change-Id: I5b3149b2b8502b9b9a36d3e20d909872cc17f8e8
8 years ago