Commit Graph

288 Commits

Author SHA1 Message Date
Zuul 34a0e88dce Merge "Bandit: Remove bandit B324 from skip list" 2024-04-23 15:51:38 +00:00
elajkat d782a868d7 Bandit: Remove bandit B324 from skip list
Remove B324 (prohibit list calls: md5, sha1 for python>=3.9)
from bandit skip list, for this replace sha1 with blake2b.

Change-Id: Iafe571ad0de0408414ed321f4b9e9588916a873d
2024-04-10 11:56:46 +02:00
LIU Yulong bac1b1f721 More precise flow table cleaning
OVS-agent wants to clean flows table by table during restart,
but actually it does not. If one table has same cookie with
other tables, all related flows will be clean at once.

This patch adds the table_id param to the related call
to limit the flow clean on one table at once.

Closes-Bug: #2060587
Change-Id: I266eb0f5115af718b91f930d759581616310999d
2024-04-09 14:10:55 +08:00
Zuul 7d2bb8c86f Merge "Not process security group for none active ports" 2024-02-09 19:46:07 +00:00
Brian Haley 3e2ae14c07 Fix implicit-str-concat warnings
Noticed two test files had these warnings, fixed them.
No functional change.

TrivialFix

Change-Id: I495aaef050da2bd10912d87451b8177a6a929563
2024-01-12 15:44:05 -05:00
LIU Yulong 70eb4006c6 Not process security group for none active ports
We recently met an issue during VM live migration:
1. nova starts live migration
2. plug ports on new host
3. neutron-ovs-agent starts to process the port,
   but the port is in 'added' and 'updated' set
   at the same time.
4. because nova still not activate the destination
   port binding, so there is no local vlan for
   this port.
Then, ovs-agent met errors:
Error while processing VIF ports: OVSFWTagNotFound:
Cannot get tag for port tap092f38ed-a7 from its other_config: {}

This fix is to remove ports of the
"binding_no_activated_devices" for ``setup_port_filters``.

Closes-Bug: #2048979
Change-Id: I0f1e6bf202ef08f75246d6e99b3774d0b6fc9e2b
2024-01-11 15:23:24 +08:00
Lucas Alvares Gomes 114ca0f1be Fix IGMP inconsistency across drivers
Prior to this patch, ML2/OVS and ML2/OVN had inconsistent IGMP
configurations. Neutron only exposed one configuration option for IGMP:
igmp_snooping_enabled.

Other features such as IGMP flood, IGMP flood reports and IGMP flood
unregistered were hardcoded differently on each driver (see LP#2044272
for a more details).

These hardcoded values has led to many changes over the years tweaking
them to work on different scenarios but they were never final because
the fix for one case would break the other.

This patch introduces 3 new configuration options for these other IGMP
features that can be enabled or disabled on both backends. Operators
can now fine tune their deployments in the way that will work for them.

As a consequence of the hardcoded values for each driver we had to break
some defaults and, in the case of ML2/OVS, if operators want to keep
things as they were before this patch they will need to enable the new
mcast_flood and mcast_flood_unregistered configuration options.

That said, the for ML2/OVS there was also an inconsistency with the help
string of igmp_snooping_enabled configuration option as it mentioned
that enabling snooping would disable flooding to unregistered ports but
that was not true anymore after the fix [0].

[0] https://bugs.launchpad.net/neutron/+bug/1884723

Closes-Bug: #2044272
Change-Id: Ic4dde46aa0ea2b03362329c87341c83b24d32176
Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
2023-12-15 09:05:19 +00:00
Brian Haley 3233407d77 Fix "use a generator" warnings
Fix code to silence consider-using-generator and
use-a-generator warnings. Functionality unchanged.

TrivialFix

Change-Id: Ia22805f026955cdb88d0ee07686af5a3b9dfdd28
2023-12-02 11:29:18 -05:00
Bence Romsics 6c513217c2 ovs-agent: React to DB down just like to server down
When neutron-server is down, ovs-agent waits for it to become available
during agent startup. When neutron-server is up, but it cannot reach the
DB, it can do nothing pretty much the same way. However ovs-agent
reacted differently to this failure. With this patch it reacts the same
way and delays its startup until neutron-server is up together with its
DB.

Change-Id: Ia55e82540aedc236e9b016bb58047d0b437eeb99
Closes-Bug: #2025341
2023-07-25 12:10:14 +02:00
Zuul de1a3a84b6 Merge "port-hint-ovs-tx-steering: agent side" 2023-05-22 12:23:16 +00:00
LIU Yulong 7573fca58c Notify neutron-server ovs is restarted
If openvswitch is restarted, try to notify neutron-server
that to refresh tunnel flows for every ports.

Closes-Bug: #2004041
Change-Id: Iba0ae947e3595674e63b998826daae2582bb7668
2023-05-11 05:38:16 +00:00
Bence Romsics 6b55589ae0 port-hint-ovs-tx-steering: agent side
In ovs-agent extract `other_config` from port `hints` and set/clear
ovs `other_config` accordingly.

Change-Id: I1106bc03061fd62e9baadadbe2bb4aaa8c3a6b1d
Partial-Bug: #1990842
Related-Change (spec): https://review.opendev.org/c/openstack/neutron-specs/+/862133
2023-05-09 11:49:17 +02:00
Sahid Orentino Ferdjaoui cf96bd8bdf ovs: fix regression when vlan mapping is not already registered
Bug introduced by Ic3c147136549b17aea0fe78e930a41a5b33ab9d8, when a
VLAN mapping is not registered during a call to
update_network_segement, the function should return None.

Closes-Bug: #2009215
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Change-Id: I91f8e8bd18d9956216e5715c658dfb408a2cbf07
2023-03-07 08:37:54 +00:00
Arnaud Morin f22aa5dfdd Discard port with ofport -1 in _get_ofport_moves
When libvirt (nova) detach a port on OVS bridge, two events are sent:
* one event with 2 actions "old" and "new": a change on ofport (from a
  regular value to -1)
* a second event with action "delete"

If, for some reason, the second event is delayed, the rpc_loop iteration
will consider this port as "updated" instead of "deleted".
But, because ofport == -1, the port update will be discarded, and
finally removed from port_info["current"].

As a result, on next iteration, the deletion wont be performed.

Most of the time, we endup with some leftovers (like openflow rules,
etc.)

The purpose of this patch is very simple, when looping over ports in
_get_ofport_moves, we will discards the ports that have ofport == -1, so
the port will not be considered as updated and next iteration will be
able to delete it correctly.

Closes-Bug: #1992109

Change-Id: Ib4a7183867e1b21810b6915a475a234278bf884c
Signed-off-by: Arnaud Morin <arnaud.morin@ovhcloud.com>
2022-12-05 10:34:26 +01:00
Felix Huettner 9ff46546cb Cleanup fanout queues on ovs agent stop
Previously when a neutron-openvswitch-agent was stopped it left
behind the following fanout queues in rabbitmq:
neutron-vo-Network-1.0_fanout_someuuid
neutron-vo-Port-1.1_fanout_someuuid
neutron-vo-SecurityGroup-1.0_fanout_someuuid
neutron-vo-SecurityGroupRule-1.0_fanout_someuuid
neutron-vo-SubPort-1.0_fanout_someuuid
neutron-vo-Subnet-1.0_fanout_someuuid
neutron-vo-Trunk-1.1_fanout_someuuid

In this change we ensure that all but the SubPort and Trunk fanout
queues are correctly removed from rabbitmq by cleanly stopping the
RemoteResourceCache when the agent stops.

Partial-Bug: #1586731
Change-Id: I672f9414a1a8ed91e259e9379ca707a70f6b4467
2022-09-09 09:03:45 +02:00
Sahid Orentino Ferdjaoui 7a1e253851 ovs: use a local vlan per network/segmentation
This is using changes introduced before to support for a network more
than one vlan.

Partial-Bug: #1956435
Partial-Bug: #1764738
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Change-Id: Ifd61e379c3cef3589803c96a276da9827051f660
2022-09-01 14:48:54 +02:00
Sahid Orentino Ferdjaoui 6ec0bc70a7 ovs: make vlanmanager to handle more vlan mapping per network
This change is updating the vlanmanager data structure to handle for a
given network more than one vlan mapping. This is a prerequisite work
needed to progress on accepting several segments per network per
host.

The work done here is trying to avoid changing logic in the
current implementation. Unit test should not have value updated,
but probably signatures changed.

Partial-Bug: #1956435
Partial-Bug: #1764738
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Change-Id: Ic3c147136549b17aea0fe78e930a41a5b33ab9d8
2022-09-01 14:48:08 +02:00
elajkat 119b82f1b1 Test: mock out _check_netfilter_for_bridges in unit tests
_check_netfilter_for_bridges do some calls which are not for unit tests.
Specifically the call for sysctl -N net.bridge seems to be broken with
a recent kernel upgrade on bionic (see the irc log for this discussion
in [1]).
Add OS_TEST_TIMEOUT:180 to tox testenv, this can help to debug such
issues.
During the rootwrap to privsep change some of these mocks were added,
(see [2]) so backporting (before Wallaby mostly) can be done with
caution.

[1]: https://meetings.opendev.org/irclogs/%23openstack-infra/%23openstack-infra.2022-07-20.log.html#t2022-07-20T12:59:32
[2]: https://review.opendev.org/c/openstack/neutron/+/764015/12/neutron/tests/unit/agent/linux/openvswitch_firewall/test_iptables.py

Change-Id: Ic366d67770cc6e19a4412eaf2f1ab53780e98ee8
Closes-Bug: #1982206
2022-07-22 07:54:12 +02:00
Sahid Orentino Ferdjaoui 1bfbc33ce0 ovs: handle segmentation ids per network ports
This is changing the datastructure that maintains the relationship
between ports and networks to also handle the segmenation ids related.

This will be necessary in future to support multiple segments per
networks on a same physical provider network.

Partial-Bug: #1956435
Partial-Bug: #1764738
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Change-Id: Iaf40ddc20692a3a51a8d5f5acfc2094b2d5c00c4
2022-06-30 19:41:33 +02:00
Slawek Kaplonski a22d6d6a95 Use ovs constants from neutron-lib
Ovs constants were moved from neutron to neutron_lib some time ago.
This patch switches to use them from neutron-lib already.

That decision was agreed during the Neutron team meeting. See [1] for
details.

[1] https://meetings.opendev.org/meetings/networking/2021/networking.2021-11-09-14.00.log.html#l-83

Requires: https://review.opendev.org/c/openstack/neutron-lib/+/834908

Change-Id: I2fd1954bec6a52856195190441d77ac8b7d97055
2022-06-17 10:36:44 +05:30
LIU Yulong c4adec924a Remove useless function _add_port_tag_info
This reverts commit: b83fedbd78.

Since port is set to dead by default after the commits of:
7aae31c9f9
0ddca28454

And we add the local vlan tag to the port right after it is
bound to aviod trunk port flood issue:
c63ebef2d5

So that _add_port_tag_info function is not necessary anymore,
and we will save a large OVSDB read action which is dumping
the entire table of Port, for hosts with a huge number of
ports this is time-comsuming. So removed it.

Related-Bug: #1968896
Related-Bug: #1952567
Change-Id: Iefd765d497c7e2d4bb093052478185125b907025
2022-04-20 09:24:48 +08:00
LIU Yulong 8dfb24a933 Remove block flow when port UP
Port admin state down will add 4095 tag to it while
it is adding a drop flow for this ofport.

When port is back UP again, remove the drop flow.

Closes-bug: #1968896
Change-Id: Ie8f67def69ae0e5d425d0e6fc43e35373a96bd88
2022-04-20 09:24:45 +08:00
LIU Yulong c63ebef2d5 Add tag to port more earlier
During some ml2 ovs agent port processing performance test, we noticed
that some ports are missing tag before it really done processing. While
ovs treats those ports without tag as trunk port, so some packets will
be flooded to it. In large scale cloud, if too many port added to the
bridge, the ovs-vswitchd will consume a huge amount of CPU cores if
ports are not bound in a short time.

So, in the port_bound function of ovs-agent, we set the port tag to
it after a local_vlan id is allocated. Because after that, setup
security groups (setup_port_filters) and bind devices in DB
(update_device_list) are really time-consuming.

And also fix a potential bug, port is processed as created first,
but no tag in ovsdb, so openflow security group will not be processed
successfully [1]. It must be done in a update event during next loop,
after port bound and ovsdb set the required value.

This patch can also fix some upstream test failures of waiting too
long time to ping some cases.

[1] https://github.com/openstack/neutron/blob/master/neutron/agent/linux/openvswitch_firewall/firewall.py#L112

Closes-Bug: #1952567
Change-Id: I3533f0d416d32f8d0888ad58f975960d89a985d9
2022-04-06 09:28:20 +08:00
Slawek Kaplonski e7edcec260 Ensure that re_added ports are DOWN before set back to UP
During e.g. rebuild of the server by Nova, ports plugged to such server
are quickly removed and added again into br-int. In such case, ports are
in the "re_added" ports set in the neutron-ovs-agent.
But it seems that in some cases it may happen that such port isn't
switched to be DOWN first and then, when neutron-ovs-agent treats port
as added/updated and reports to the server that port is UP, there is no
notification to nova-compute send (because port's status was UP and new
status is still UP in the Neutron DB).
As Nova waits for the notification from Neutron in such case server
could ends up in the ERROR state.

To avoid such issue, all ports which are treated as "re_added" by the
neutron-ovs-agent are now first switched to be DOWN on the server side.
That way, when those ports are treated as added/updated in the same
rpc_loop iteration, switching their status to UP will for sure trigger
notification to nova.

Closes-Bug: #1963899
Change-Id: I0df376a80140ead7ff1fbf7f5ffef08a999dbe0b
2022-03-24 16:54:26 +01:00
jpic d033c9f933 Fix OVS OVSNeutronAgent.reclaim_local_vlan()
Closes-Bug: #1957931

Change-Id: I5b716399cb8344b8a89b97378fcb4796654e6152
2022-01-18 16:00:04 +01:00
shanyunfan33 0e6257606a remove unicode from code
remove unicode from code

Change-Id: Ide37b3c1f8a2e2dcdcac0a2b0631cb197eca5baf
2021-12-24 10:02:03 +08:00
yatinkarel a4ffd1a2f9 Set report_interval to 0 for ovs agent unit tests
Unit tests are taking longer than usual since [1] and
causing timeouts in unit tests jobs intermittently. Set
report_interval(as this is now used to set RPC timeout)
to 0 so report_state responds immediately.

[1] https://review.opendev.org/q/I8a95e80ca74edc8f8f394cefc749c4065a8e0575

Related-Bug: #1948676
Change-Id: I653c907a4323e19d5bc381cd3716d42c45a75e15
2021-11-25 13:32:23 +05:30
Przemyslaw Szczerbik 1ea26616b4 ovs-agent: Report pkt processing info in heartbeat
OVS agent configuration is extended to support new configuration
options:
  - 'resource_provider_packet_processing_without_direction'
  - 'resource_provider_packet_processing_with_direction'
  - 'resource_provider_packet_processing_inventory_defaults'

OVS agent RPC hearthbeat now reports this information to neutron
server in 'configuration' field .

Example config:

ml2_conf.ini:
[ovs]
resource_provider_packet_processing_with_direction = :1000:1000

Partial-Bug: #1922237
See-Also: https://review.opendev.org/785236
Change-Id: Ief554bc445dfd93ea6995bb42b4d010674c7a091
2021-09-29 12:27:45 +02:00
Zuul c90043f853 Merge "Add agent extension 'dhcp' for ovs agent" 2021-06-26 12:12:45 +00:00
LIU Yulong 56e8498a4d Add agent extension 'dhcp' for ovs agent
Add a new ovs agent extension to support distributed DHCP for
VMs in compute nodes directly. For large scale deployment, this
can be used to reduce the number of neutron agents. Large scale
cloud can benefit from it.

From the perspective of virtual machine, this will reduce the
probability of DHCP request failure. The VMs will get a higher
level availability for DHCP R/R, no single point of failure
permanently. If one host goes down, VMs in other hosts will not
be influnced by it.

For the perspective of network performance, after using this
extension, the DHCP broadcasting packages will be limited
to the host locally.

Partially-Implements: bp/distributed-dhcp-for-ml2-ovs
Closes-Bug: #1900934
Change-Id: Id8a4c501daad7c2185e6d69441182666ef987e61
2021-06-24 08:38:38 +08:00
Anton Kurbatov edc3852c83 Fix phys network lost after reconfigure
This patch moves phys_brs and 'self' associated attributes from
setup_physical_bridges to __init__. Otherwise, bridges from bridge_mapping
could be lost, e.g. when setup_physical_bridges is called with only
reconfigured bridges from _do_reconfigure_physical_bridges.

Closes-Bug: #1929438
Signed-off-by: Anton Kurbatov <Anton.Kurbatov@acronis.com>
Change-Id: Ieadb801e48898e8b654153ad37be80dd9c865413
2021-05-27 13:32:37 +00:00
Li YaJie 2bb52d49be Call install_ingress_direct_goto_flows() when ovs restarts
When ovs restarts and needs to regenerate flows, some flows will be
missing in br-int, as follows:
 * table=60,priority=4,in_port="int-br-floating" actions=resubmit(,61)
 * table=60,priority=4,in_port="patch-tun" actions=resubmit(,61)
 * table=61,priority=0 actions=resubmit(,62)
Call install_ingress_direct_goto_flows() again in the
_handle_ovs_restart() to ensure generate these flows.

Change-Id: I240a78879db757592df138a53b2c22d7f5a9ae13
Closes-Bug: #1920700
2021-03-22 17:24:11 +08:00
LIU Yulong d2073d6556 Remove flows for ARP reply MAC change
When router interface is removing, delete the related ARP reply
MAC change flow.

This is a follow-up of:
https://review.opendev.org/c/openstack/neutron/+/773597

Closes-Bug: #1913646
Related-Bug: #1859638
Change-Id: Ieb8886f68a80ac213fa08013ea73099d29597395
2021-02-04 17:04:43 +08:00
LIU Yulong 7be2dc976a Change ARP reply MAC to router interface
In some scenario, dvr router interface will try to ARP some device
which is not hosted in the same host. When the ARP request send
out, the ethernet source MAC will be changed to dvr_host_mac. Then
thoses devices will reply ARP with the dvr_host_mac in ethernet dest
MAC. So finally the dvr router interface will drop this, and the ARP
get failed.

This patch adds one flow for this, it will match the dest MAC, ARP
op-code=2 and arp_tha address, then change the dest MAC to the right
router interface's MAC address.

Closes-Bug: #1913646
Related-Bug: #1859638
Change-Id: Ibc7f01450a3da026ca5c4fb667dada912cf472e3
2021-02-03 13:06:34 +08:00
Zuul c7bc883061 Merge "[OVS] Fix live-migration connection disruption" 2021-01-18 13:39:24 +00:00
Zuul 56bea066f4 Merge "Do not report ovs agent state if ovs is dead" 2021-01-17 10:31:26 +00:00
Rodolfo Alonso Hernandez f8a22c7d4a [OVS] Fix live-migration connection disruption
The goal of this patch is to avoid the connection disruption during
the live-migration using OVS. Since [1], when a port is migrated,
both the source and the destination hosts are added to the profile
binding information. Initially, the source host binding is activated
and the destination is deactivated.

When the port is created in the destination host (created by Nova),
the port was not configured because the binding was not activated.
The binding (that means, all the OpenFlow rules) was done when Nova
sent the port activation. That happend when the VM was already
running in the destination host. If the OVS agent was loaded, the
port was bound seconds later to the port activation.

Instead, this patch enables the OpenFlow rule creation in the
destination host when the port is created.

Another problem are the "neutron-vif-plugged" events sent by Neutron
to Nova to inform about the port binding. Nova is expecting one single
event informing about the destination port binding. At this moment,
Nova considers the port is bound and ready to transmit data.

Several triggers were firing expectedly this event:
- When the port binding was updated, the port is set to down and then
  up again, forcing this event.
- When the port binding was updated, first the binding is deleted and
  then updated with the new information. That triggers in the source
  host to set the port down and the up again, sending the event.

This patch removes those events, sending the "neutron-vif-plugged"
event only when the port is bound to the destination host (and as
commented before, this is happening now regardless of the binding
activation status).

This feature depends on [2]. If this Nova patch is not in place, Nova
will never plug the port in the destination host and Neutron won't be
able to send the vif-plugged event to Nova to finish the
live-migration process.

Because from Neutron cannot query Nova to know if this patch is in
place, a new temporary configuration option has been created to enable
this feature. The default value will be "False"; that means Neutron
will behave as before.

[1]https://bugs.launchpad.net/neutron/+bug/1580880
[2]https://review.opendev.org/c/openstack/nova/+/767368

Closes-Bug: #1901707

Change-Id: Iee323943ac66e566e5a5e92de1861832e86fc7fc
2021-01-13 11:13:41 +00:00
shenjiatong 5d8f3fd614 Do not report ovs agent state if ovs is dead
Do not report ovs agent state when ovs is dead,
and let neutron-server mark service as down. So
cluster admin could determine there is a problem
of the given ovs agent

Change-Id: Ib4b06c7877a7343f4204d4f4f5863931717ff507
Closes-Bug: #1910946
2021-01-13 16:17:14 +08:00
Zuul 4d33a64931 Merge "Fix multicast traffic with IGMP snooping enabled" 2021-01-04 15:35:25 +00:00
Zuul 5895f39eec Merge "Fix removal of dvr-src mac flows when non-gateway port on router is deleted" 2020-12-17 01:16:10 +00:00
Zuul 5c54553224 Merge "SimpleInterfaceMonitor filter events by bridge name" 2020-12-16 13:13:52 +00:00
Hemanth Nakkina 329ea19f8b Fix removal of dvr-src mac flows when non-gateway port on router is deleted
Removal of non-gateway port on DVR router deletes all the DVR to
SRC mac flows for the instances of same subnet on that compute node.
The instances are not reachable from any other network.

This patch checks if the DVR router port is gateway for the subnet
or not. And deletes the DVR-SRC mac flows only if it is gateway port.
The DVR-SRC mac flows are deleted if the gateway is not set for the subnet.

Change-Id: Iadc1671c862f8c01e5761e92b82a04849d4bb411
Closes-Bug: #1892405
2020-12-16 11:09:22 +05:30
Slawek Kaplonski b4070c9752 Fix multicast traffic with IGMP snooping enabled
In the ML2/OVS when igmp_snooping is enabled but there is no
external querier multicast traffic will stop working after few minutes
as packets will not be flooded to tunnel/external bridges.

So this patch sets "mcast-snooping-disable-flood-unregistered" option
of the br-int to False (default value) even when igmp_snooping is
enabled in the neutron-ovs-agent's config file.

Additionally it configures "mcast-snooping-flood-reports" and
"mcast-snooping-flood" on patch ports in br-int to True.

That way we can provide best effort snooping: multicast isolation where
IGMP queriers are available and flood everywhere else?

Closes-Bug: #1884723
Change-Id: Iefa0044dba9e92592295a79448e5d57d9e14a40b
2020-12-15 23:39:08 +01:00
Xiaoyu Min fc1fe016aa Neutron ovs agent: set mtu of smartnic port
The smartnic port's MTU should be set according to the network's MTU
which the port belongs to.

Closes-Bug: #1899864
Change-Id: Ibcc29c998065da521b35e5845727794a68782db0
Signed-off-by: Xiaoyu Min <jackmin@nvidia.com>
2020-11-26 09:55:13 +00:00
Rodolfo Alonso Hernandez dcf7acf2c6 SimpleInterfaceMonitor filter events by bridge name
Add a filter in SimpleInterfaceMonitor. If provided, the Interface
events received will be filtered by port. For each Interface event
received, the bridge name will be retrieved and compared with the
list of bridge names given.

If no names are provided, the monitor won't filter any event
(current behavior).

This filter is meant to be used in Fullstack test only. This filtering
add an extra overload (two OVS DB queries per event) that should not
be needed in a production environment.

Closes-Bug: #1885547

Change-Id: Ie1fc8cf7d29c71eb358e593726b446787d8022c2
2020-11-11 08:59:31 +00:00
Slawek Kaplonski d60febb2d3 Remove deprecated use_veth_interconnection option
Using veth to interconnect openvswitch bridges was deprecated
in Victoria cycle. Now it's time to remove it from the code.

In neutron-ovs-agent code, there is still kept piece of code which
migrates from the veth to the patch ports for bridges interconnection.
We will be able to remove that piece of code in X release.

Change-Id: I94545c3c3d9be46ac2062691f69663e5e59cd648
Closes-Bug: #1587296
2020-10-28 12:57:15 +01:00
Sean Mooney 7fd2725cb1 Do not skip ports with ofport unset or invalid
This change removes the "_check_ofport" function and its use form
the ovs_lib.py file.

By skipping ports without a unique ofport in the "get_vifs_by_ids"
and "get_vifs_by_id" functions, the OVS agent incorrectly treated
newly added port with an ofport of -1 as removed ports in the
"treat_devices_added_or_updated" function.

Co-Authored-By: Rodolfo Alonso Hernandez <ralonsoh@redhat.com>

Change-Id: I79158baafbb99bee99a1d687039313eb454d3a9b
Partial-Bug: #1734320
Partial-Bug: #1815989
2020-08-24 12:54:08 +00:00
Darragh O'Reilly c1a77ef8b7 Ensure drop flows on br-int at agent startup for DVR too
Commit 90212b12 changed the OVS agent so adding vital drop flows on
br-int (table 0 priority 2) for packets from physical bridges was
deferred until DVR initialization later on. But if br-int has no flows
from a previous run (eg after host reboot), then these packets will hit
the NORMAL flow in table 60. And if there is more than one physical
bridge, then the physical interfaces from the different bridges are now
essentially connected at layer 2 and a network loop is possible in the
time before the flows are added by DVR. Also the DVR code won't add them
until after RPC calls to the server, so a loop is more likely if the
server is not available.

This patch restores adding these flows to when the physical bridges are
first configured. Also updated a comment that was no longer correct and
updated the unit test.

Change-Id: I42c33fefaae6a7bee134779c840f35632823472e
Closes-Bug: #1887148
Related-Bug: #1869808
2020-07-14 09:26:48 +00:00
Yang JianFeng cd721a7dcb Make DVR router support FLAT network for ovs-agent
Currently codes only support assocate tunnel network and vlan network
to DVR router. This patch add codes that make the flat network assocate
to DVR router and make it work fine.

The patch also remove two unused constant entries: 'FLAT_VLAN_ID' and
'LOCAL_VLAN_ID'

Change-Id: I7d792ce288d96548298f169748565266a130bd86
Closes-Bug: #1876092
2020-06-08 12:13:22 +00:00
Zuul 50846501f7 Merge "Mock command execution in "test_hybrid_plug_flag_based_on_firewall" UT" 2020-05-28 00:51:40 +00:00