summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* netdev: Set the default number of queues at removal from the databaseIlya Maximets2016-12-091-0/+7
| | | | | | | | | | | | | | | | | | | | | Expected behavior for attribute removal from the database is resetting it to default value. Currently this doesn't work for n_rxq/n_txq options of pmd netdevs (last requested value used): # ovs-vsctl set interface dpdk0 options:n_rxq=4 # ovs-vsctl remove interface dpdk0 options n_rxq # ovs-appctl dpif/show | grep dpdk0 <...> dpdk0 1/1: (dpdk: configured_rx_queues=4, <...> \ requested_rx_queues=4, <...>) Fix that by using NR_QUEUE or 1 as a default value for 'smap_get_int'. Fixes: a14b8947fd13 ("dpif-netdev: Allow different numbers of rx queues for different ports.") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Tested-by: Ian Stokes <ian.stokes@intel.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
* ofproto-dpif-ipfix: Fix assertion failure for bad configuration.Ben Pfaff2016-12-091-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The assertions in dpif_ipfix_set_options() made some bad assumptions about flow exporters. The code that added and removed exporters would add a flow exporter even if it had an invalid configuration ("broken"), but the assertions checked that broken flow exporters were not added. Thus, the when a flow exporter was broken, ovs-vswitchd would crash due to an assertion failure. Here is an example vsctl command that, run in the sandbox, would crash ovs-vswitchd: ovs-vsctl \ -- add-br br0 \ -- --id=@br0 get bridge br0 \ -- --id=@ipfix create ipfix target='["xyzzy"]' \ -- create flow_sample_collector_set id=1 bridge=@br0 ipfix=@ipfix The minimal fix would be to remove the assertions, but this would leave broken flow exporters in place. This commit goes a little farther and actually removes broken flow exporters. This fix pulls code out of an "if" statement to a higher level, so it is a smaller fix when viewed igoring space changes. This bug dates back to the introduction of IPFIX in 2013. VMware-BZ: #1779123 CC: Romain Lenglet <romain.lenglet@berabera.info> Fixes: 29089a540cfa ("Implement IPFIX export") Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ovs-vswitchd: Avoid segfault for "netdev" datapath.nickcooper-zhangtonghao2016-12-091-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the datapath, whose type is "netdev", processes packets in userspce action, it may cause a segmentation fault. In the dp_execute_userspace_action(), we pass the "wc" argument to dp_netdev_upcall() using NULL. In the dp_netdev_upcall() call tree, the "wc" will be used. For example, dp_netdev_upcall() uses the &wc->masks for debugging, and flow_wildcards_init_for_packet() uses the "wc" if we disable megaflow, which is described in more detail below. Segmentation fault in flow_wildcards_init_for_packet: #0 0x0000000000468fe8 flow_wildcards_init_for_packet lib/flow.c:1275 #1 0x0000000000436c0b upcall_cb ofproto/ofproto-dpif-upcall.c:1231 #2 0x000000000045bd96 dp_netdev_upcall lib/dpif-netdev.c:3857 #3 0x0000000000461bf3 dp_execute_userspace_action lib/dpif-netdev.c:4388 #4 dp_execute_cb lib/dpif-netdev.c:4521 #5 0x0000000000486ae2 odp_execute_actions lib/odp-execute.c:538 #6 0x00000000004607f9 dp_netdev_execute_actions lib/dpif-netdev.c:4627 #7 packet_batch_per_flow_execute lib/dpif-netdev.c:3927 #8 dp_netdev_input__ lib/dpif-netdev.c:4229 #9 0x0000000000460ba8 dp_netdev_input lib/dpif-netdev.c:4238 #10 dp_netdev_process_rxq_port lib/dpif-netdev.c:2873 #11 0x000000000046126e dpif_netdev_run lib/dpif-netdev.c:3000 #12 0x000000000042baf5 type_run ofproto/ofproto-dpif.c:504 #13 0x00000000004192bf ofproto_type_run ofproto/ofproto.c:1687 #14 0x0000000000409965 bridge_run__ vswitchd/bridge.c:2875 #15 0x000000000040f145 bridge_run vswitchd/bridge.c:2938 #16 0x00000000004062e5 main vswitchd/ovs-vswitchd.c:111 Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
* tests: Add tracing to "ovn -- 2 HVs, 4 lports/HV, localnet ports" test.Ben Pfaff2016-12-061-36/+60
| | | | | | | Adding ovn-trace calls makes failures easier to understand and diagnose. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* tests: Fix order confusion in "ovn -- 2 HVs, 4 lports/HV, localnet ports".Ben Pfaff2016-12-061-2/+2
| | | | | | | | | The order of src and dst was swapped both in assignment and reference, which meant that the result worked OK but was really confusing to try to extend or modify. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* tests/bundle: Use active_backup algorithm for up/down test.Ilya Maximets2016-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HRW algorithm uses hash function which is dependent from the build environment. This leads to constant fails of the testsuite with CFLAGS='-march=native' if CPU supports hashing instructions: [-------------------------------------------------------------------] ./bundle.at:233: ovs-appctl ofproto/trace br0 \ 'in_port=LOCAL,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06' stdout: Bridge: br0 Flow: in_port=LOCAL,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,\ dl_dst=50:54:00:00:00:06,dl_type=0x0000 Rule: table=0 cookie=0 OpenFlow actions=bundle(eth_src,50,hrw,ofport,slaves:1,2) Final flow: unchanged Megaflow: recirc_id=0,in_port=LOCAL,dl_src=50:54:00:00:00:05, \ dl_type=0x0000 Datapath actions: 2 ./bundle.at:234: tail -1 stdout --- - +++ /testsuite.dir/at-groups/85/stdout @@ -1,2 +1,2 @@ -Datapath actions: 1 +Datapath actions: 2 [-------------------------------------------------------------------] Using of 'active_backup' algorithm will help to avoid such issues. CC: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Fixes: 63460a30c53e ("tests/bundle: test bundle action with ports up and down") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tunnel: set udp dst-port in tunnel metadataPravin B Shelar2016-12-052-5/+5
| | | | | | | | | | | VxLan device expect valid tp-dst in tunnel metadata. Following patch sets consistent tp-dst with respect to the egress tunnel port. Reported-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com> Tested-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com> Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofproto: Honor OFPFF_RESET_COUNTS flag in flow modify message.Jarno Rajahalme2016-12-051-0/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While a flow modify must keep the original flow's flags, it must reset counts if (and only if) the reset_counts flag is present in the flow mod message. Behavior prior to this patch is broken in a few ways: - OpenFlow 1.0 and 1.1 mod-flows did reset the counts, if the flow had reset_counts flag set. Only add-flow should reset counts. - With OpenFlow 1.2 and later, if the old flow had the reset_counts flag set, the counts would be reset by mod-flows, even if the flow-mod message does not have the reset_counts flag set. - With OpenFlow 1.2 and later, mod-flows with a reset_count did not reset the counts, if the old flow did not have the reset_counts flag set. Even though the prevailing interpretation seems to be that the reset_counts flag in the flow-mod message should be stored as part of the flow state (and reported back in flow dumps with OpenFlow >= 1.3), we should always just look at the reset_counts flag in the current flow-mod and ignore the reset_counts flag stored in the flow when processing a flow mod. For OpenFlow 1.0 and 1.1 we already implicitly add the reset_counts flag for add-flow messages (only) to maintain the expected behavior. This patch adds a comprehensive test case to prevent future regressions. Suggested-by: Tony van der Peet <tony.vanderpeet@alliedtelesis.co.nz> Fixes: 748eb2f5b1 ("ofproto-dpif: Always forward 'used' from the old_rule.") Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* mpls: Fix MPLS restoration after patch port and group bucket.Jarno Rajahalme2016-12-021-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes problems with MPLS handling related to patch ports and group buckets. If a group bucket or a peer bridge across a patch port pushes MPLS headers to a non-MPLS packet and outputs, the flow translation after returning from the group bucket or patch port would undo the packet transformations so that the processing could continue with the packet as it was before entering the patch port. There were two problems with this: 1. As part of the first MPLS push on a non-MPLS packet, the flow translation would first clear the L3/4 headers of the 'flow' to mark those fields invalid. Later, when committing 'flow' changes to datapath actions before output, the necessary datapath MPLS actions are created and the corresponding changes updated to the 'base flow'. This was done using the same flow_push_mpls() function that clears the L2/3 headers, so also the 'base flow' L2/3 headers were cleared. Then, when translation returns from a patch port or group bucket, the original 'flow' is restored, now showing no sign of the MPLS labels. Since the 'base flow' now has the MPLS labels, following translations know to issue MPLS POP actions before any output actions. However, as part of checking for changes to IP headers we test that the IP protocol type was not changed. But now the 'base flow's 'nw_proto' field is zero and an assert fail crashes OVS. This is solved by not clearing the L3/4 fields of the 'base flow'. This allows the processing after the patch port to continue with L3/4 fields as if no MPLS was done, after first issuing the necessary MPLS POP actions. 2. IP header updates were done before the MPLS POP actions were issued. This caused incorrect packet output after, e.g., group action or patch port. For example, with actions: group 1234: all bucket=push_mpls,output:LOCAL ip actions=group:1234,dec_ttl,output:LOCAL,output:LOCAL the dec_ttl would only be executed before the last output to LOCAL, since at the time of committing IP changes after the group action the packet was still an MPLS packet. This is solved by checking the dl_type of both 'flow' and 'base flow' and issuing MPLS actions if they can transform the packet from an MPLS packet to a non-MPLS packet. For an IP packet the change in ttl can then be correctly committed before the last two output actions. Two test cases are added to prevent future regressions. Reported-by: Thomas Morin <thomas.morin@orange.com> Suggested-by: Takashi YAMAMOTO <yamamoto@ovn.org> Fixes: 8bfd0fdac ("Enhance userspace support for MPLS, for up to 3 labels.") Fixes: 1b035ef20 ("mpls: Allow l3 and l4 actions to prior to a push_mpls action") Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: YAMAMOTO Takashi <yamamoto@ovn.org>
* ovs-numa: Allow leading 0x on pmd-cpu-mask.billyom2016-12-021-3/+3
| | | | | | | | | | | | | | | pmd-cpu-mask is interpreted as a hex bit mask. So it should be written with a leading 0x to indicate this. But if this is done, while the value is interpreted correctly and the PMDs pinned as expected, a confusing warning message is also issued. This patch allows but does not require a leading 0x or 0X to be used without a warning. Existing functionality is not affected. Relevant DPDK docs also updated. Signed-off-by: Billy O'Mahony <billy.o.mahony@intel.com> Tested-by: Kevin Traynor <ktraynor@redhat.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
* ovsdb: Allow online compacting on Windows.Alin Serdean2016-11-301-1/+5
| | | | | | | | | | | | | | | | | | This patch allows online compacting to be done under Windows. To achieve the above we need to close all file handles before trying to rename the file, switch from rename to MoveFileEx (because rename/MoveFile fails if the destination exists), reopen the right type of log after the rename. If we could not reopen the compacted database or the original database after the close simply abort and rely on the service manager. This can be changed in the future. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Co-authored-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
* ofp-actions: Add "ingress" and "egress" options to "sample" action.Ben Pfaff2016-11-303-0/+9
| | | | | | | | | | | | | | | | | | | | Before Open vSwitch 2.5.90, IPFIX reports from Open vSwitch didn't include whether the packet was ingressing or egressing the switch. Starting in OVS 2.5.90, this information was available but only accurate if the action included a port number that indicated a tunnel. Conflating these two does not always make sense (not every packet involves a tunnel!), so this patch makes it possible for the sample action to simply say whether it's for ingress or egress. This is difficult to test, since the "tests" directory of OVS does not have a proper IPFIX listener. This passes those tests, plus a couple that just verify that the actions are properly parsed and formatted. Benli did test it end-to-end in a VMware use case. Requested-by: Benli Ye <daniely@vmware.com> Tested-by: Benli Ye <daniely@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Simon Horman <simon.horman@netronome.com>
* ovn-northd: Force SNAT for multiple gateway routers.Gurucharan Shetty2016-11-291-0/+386
| | | | | | | | | | | | | | | | | | | | | When multiple gateway routers exist, a packet can enter any gateway router. Once the packet reaches its destination, its reverse direction should be via the same gateway router. This is achieved by doing a SNAT of the packet in the inward direction (towards logical space) with a IP address of the gateway router such that packet travels back to the same gateway router. To do the above, we introduce two new options in the logical router. options:dnat_force_snat_ip=$IP will force SNAT any packet to $IP if it has been previously DNATted. options:lb_force_snat_ip=$IP will force SNAT any packet to $IP if it has been previously load-balanced. Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Mickey Spiegel <mickeys.dev@gmail.com>
* ovn: Test arp requests received from vtep ports.Darrell Ball2016-11-281-0/+30
| | | | | | | | | Add a test that verifies that arp requests received from vtep ports are not responded to by logical switch arp responders. Signed-off-by: Darrell Ball <dlu998@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tests: add test for the output of ovs/route/lookupThadeu Lima de Souza Cascardo2016-11-251-1/+30
| | | | | Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* ovn-nbctl: Add NAT commands.nickcooper-zhangtonghao2016-11-211-0/+114
| | | | | | | | This patch provides the command line to create NAT rules on logical router. Signed-off-by: nickcooper-zhangtonghao <nickcooper-zhangtonghao@opencloud.tech> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* dpif-netdev: Honor rxq affinity during pmd threads creation.Ilya Maximets2016-11-151-0/+56
| | | | | | | | | | | Currently, If user will set up 'pmd-rxq-affinity' to cores on different numa node, they may not be polled, because pmd threads will not be created there even if this cores are in 'pmd-cpu-mask'. Fix that by creating threads on all numa nodes rxqs assigned to. Fixes: 3eb67853c481 ("dpif-netdev: Introduce pmd-rxq-affinity.") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
* ovs-router: Fix selection of source IP address when a gateway ip is introducedAriel Waizel2016-11-153-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | When adding a VXLAN tunnel that connects to a VTEP residing in a different IP network, the tunnel source ip needs to be selected by best fit (longest matching netmask), based on the destination VTEP ip, and the specific route's gateway ip. A bug in ovs-router.c made the source ip to be decided only based on the destination ip. Thus, if all source ips available to OVS and the destination ip are in different ip networks - no source ip is selected, and an error is returned. This error occurred when using OVS-DPDK and configuring a VXLAN tunnel, where source ip and destination ip are in different networks, and a gateway ip was in place for the specific route. The fix tries to match a source ip based on the gateway ip, if no matching source ip was found based on the destination ip. This way, the gateway becomes the first hop only if the tunnel crosses between ip networks. Signed-off-by: Ariel Waizel <ariel.waizel@hpe.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Acked-by: Pravin B Shelar <pshelar@ovn.org>
* logical-fields: Add ct.dnat and ct.snat symbols.Gurucharan Shetty2016-11-151-1/+3
| | | | | | | | Upcoming commits use it. Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto: Return the OFPC_BUNDLES bit in switch features reply.Jarno Rajahalme2016-11-142-1/+25
| | | | | | | | | Add definitions for the OpenFlow 1.4.1/1.5 specific capabilities bits OFPC14_BUNDLES and OFPC14_FLOW_MONITORING. Return the bundles capability bit in switch features reply. Reported-by: Andrej Leitner <andrej.leitner@pantheon.tech> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif-xlate: Fix duplicate multicast packetsO'Reilly, Darragh2016-11-143-1/+70
| | | | | | | | | | When iterating the list of mrouters, skip any that are not on the same vlan as the multicast packet to be forwarded. This bug was causing duplicate packets when more than one mrouter was behind a trunk port. Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2016-November/042938.html Signed-off-by: Darragh O'Reilly <darragh.oreilly@hpe.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* Add support for specifying SSL connection parameters to ovsdbEthan Rahn2016-11-102-4/+69
| | | | | Signed-off-by: Ethan Rahn <erahn@arista.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovn: Add a case of policy based routing.Gurucharan Shetty2016-11-032-19/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OVN currently supports multiple gateway routers (residing on different chassis) connected to the same logical topology. When external traffic enters the logical topology, they can enter from any gateway routers and reach its eventual destination. This is achieved with proper static routes configured on the gateway routers. But when traffic is initiated in the logical space by a logical port, we do not have a good way to distribute that traffic across multiple gateway routers. This commit introduces one particular way to do it. Based on the source IP address or source IP network of the packet, we can now jump to a specific gateway router. This is very useful for a specific use case of Kubernetes. When traffic is initiated inside a container heading to outside world, we want to be able to send such traffic outside the gateway router residing in the same host as that of the container. Since each host gets a specific subnet, we can use source IP address based policy routing to decide on the gateway router. Rationale for using the same routing table for both source and destination IP address based routing: Some hardware network vendors support policy routing in a different table on arbitrary "match". And when a packet enters, if there is a match in policy based routing table, the default routing table is not consulted at all. In case of OVN, we mainly want policy based routing for north-south traffic. We want east-west traffic to flow as-is. Creating a separate table for policy based routing complicates the configuration quite a bit. For e.g., if we have a source IP network based rule added, to decide a particular gateway router as a next hop, we should add rules at a higher priority for all the connected routes to make sure that east-west traffic is not effected in the policy based routing table itself. Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovn-controller: Container can have connection to a hosting VM.Gurucharan Shetty2016-11-021-0/+193
| | | | | | | | | | | A Container running inside a VM can have a connection to the hosting VM (parent port) in the logical topology (for e.g via a router). So we should be able to loop-back into the same VM, even if the final packet delivered does not have any tags in it. Reported-by: Dustin Spinhirne <dspinhirne@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* tests: windows ovsdb online compactAlin Serdean2016-11-011-7/+11
| | | | | | | Skip symlinks checks on Windows. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tests: Test offline compacting on Windows.Alin Serdean2016-11-011-12/+28
| | | | | | | | | | | | | This patch adds the offline compacting (ovsdb-tool compact) to be run on Windows. Windows does not implement --run so this drops its use. Other tests do check that --run works on Linux so this shouldn't be an issue. Also on Windows we do not check for symlinks, so skip the tests for it. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovn-southbound: Implement read-only connection support.Lance Richardson2016-11-011-0/+94
| | | | | | | | | | | | | | | | | | | Add a connection table to the southbound db schema, similar to the Open_vSwitch "Manager" table. Add tests for pssl: and ptcp: read-only connection types. Add support to ovn-sbctl for listing the SB Connection table. Potential future work: - Test cases for other connection types (punix, ssl, tcp, unix). - SSL configuration table for southbound db. - Connection table for NB schema. - Add a way to specify a read-only connection as an ovsdb-server command-line option. Signed-off-by: Lance Richardson <lrichard@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb-server: Implement read-only remote connection type.Lance Richardson2016-11-011-0/+67
| | | | | | | | | | | Adds a new "read_only" column for remote connections. Operations that would alter the state of the database are not permitted on connections for which the "read_only" column is set to "true". Signed-off-by: Lance Richardson <lrichard@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* doc: Convert WHY-OVS to rSTStephen Finucane2016-10-262-2/+2
| | | | | Signed-off-by: Stephen Finucane <stephen@that.guru> Signed-off-by: Russell Bryant <russell@ovn.org>
* ovn-test: Fix 'test-ovn composition' crashAndy Zhou2016-10-202-2/+6
| | | | | | | Without this fix, the added test will core dump. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idl: Check internal graph in OVSDB tests.Ben Pfaff2016-10-191-0/+7
| | | | | | | | | Some upcoming tests will add extra trickiness to the IDL internal graph. This worries me, because the IDL doesn't have any checks for its graph consistency. This commit adds some. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idlc: Eliminate <prefix>_init() function from generated code.Ben Pfaff2016-10-191-4/+0
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovn-controller.at: Stop hardcoding a list of iface typesYAMAMOTO Takashi2016-10-191-7/+1
| | | | | | | | | | The list of supported iface types hardcoded in the test is wrong on NetBSD. (or any userland-only ports I guess) Instead of adding another case for NetBSD following WIN32, just get the list from ovsdb. Signed-off-by: YAMAMOTO Takashi <yamamoto@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovn.at: Avoid using "printf -v"YAMAMOTO Takashi2016-10-191-2/+2
| | | | | | | It seems like a non-portable bash extension. Signed-off-by: YAMAMOTO Takashi <yamamoto@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* Fix parent_pid on NetBSDYAMAMOTO Takashi2016-10-191-4/+5
| | | | | | | | | | | | Fix recently introduced parent_pid macro on NetBSD 7.0. On NetBSD, procfs status file looks like the following. n7% cat /proc/$$/status zsh 18509 12970 18509 18509 5,8 ctty,sldr 1476344459,639266 0,15575 0,15575 pause 1000 100,100,0 n7% Signed-off-by: YAMAMOTO Takashi <yamamoto@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* system-traffic: 802.1ad: Add datapath ping tests for CVLANs.Eric Garver2016-10-181-0/+62
| | | | | Signed-off-by: Eric Garver <e@erig.me> Signed-off-by: Joe Stringer <joe@ovn.org>
* system-common-macros: Add macros to add 802.1ad ports.Eric Garver2016-10-181-1/+24
| | | | | | | Add macros ADD_SVLAN() and ADD_CVLAN(). Signed-off-by: Eric Garver <e@erig.me> Signed-off-by: Joe Stringer <joe@ovn.org>
* system-userspace-macros: allow passing sed args to OVS_TRAFFIC_VSWITCHD_STOP()Eric Garver2016-10-181-1/+1
| | | | | | | | | Passing sed arguments to OVS_TRAFFIC_VSWITCHD_STOP() was being ignored for check-system-userspace. This is useful to selective ignore log messages. Signed-off-by: Eric Garver <e@erig.me> Signed-off-by: Joe Stringer <joe@ovn.org>
* Python-IDL: getattr after mutate fixAmitabha Biswas2016-10-142-7/+48
| | | | | | | | | | | This commit returns the updated column value when getattr is done after a mutate operation is performed (but before the commit). Signed-off-by: Amitabha Biswas <azbiswas@gmail.com> Reported-by: Richard Theis <rtheis@us.ibm.com> Reported-at: http://openvswitch.org/pipermail/dev/2016-September/080120.html Fixes: a59912a0ee8e ("python: Add support for partial map and set updates") Signed-off-by: Russell Bryant <russell@ovn.org>
* dpif-netdev: Fix crash in dpif_netdev_execute().Daniele Di Proietto2016-10-121-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dp_netdev_get_pmd() is allowed to return NULL (even if we call it with NON_PMD_CORE_ID) for different reasons: * Since we use RCU to protect pmd threads, it is possible that ovs_refcount_try_ref_rcu() has failed. * During reconfiguration we destroy every thread. This commit makes sure that we always handle the case when dp_netdev_get_pmd() returns NULL without crashing (the change in dpif_netdev_run() doesn't fix anything, because everything is happening in the main thread, but it's better to honor the interface in case we change our threading model). This actually fixes a pretty serious crash that happens if dpif_netdev_execute() is called from a non pmd thread while reconfiguration is happening. It can be triggered by enabling bfd (because it's handled by the monitor thread, which is a non pmd thread) on an interface and changing something that requires datapath reconfiguration (n_rxq, pmd-cpu-mask, mtu). A testcase that reproduces the race condition is included. This is a possible backtrace of the segfault: #0 0x000000000060c7f1 in dp_execute_cb (aux_=0x7f1dd2d2a320, packets_=0x7f1dd2d2a370, a=0x7f1dd2d2a658, may_steal=false) at ../lib/dpif-netdev.c:4357 #1 0x00000000006448b2 in odp_execute_actions (dp=0x7f1dd2d2a320, batch=0x7f1dd2d2a370, steal=false, actions=0x7f1dd2d2a658, actions_len=8, dp_execute_action=0x60c7a5 <dp_execute_cb>) at ../lib/odp-execute.c:538 #2 0x000000000060d00c in dp_netdev_execute_actions (pmd=0x0, packets=0x7f1dd2d2a370, may_steal=false, flow=0x7f1dd2d2ae70, actions=0x7f1dd2d2a658, actions_len=8, now=44965873) at ../lib/dpif-netdev.c:4577 #3 0x000000000060834a in dpif_netdev_execute (dpif=0x2b67b70, execute=0x7f1dd2d2a578) at ../lib/dpif-netdev.c:2624 #4 0x0000000000608441 in dpif_netdev_operate (dpif=0x2b67b70, ops=0x7f1dd2d2a5c8, n_ops=1) at ../lib/dpif-netdev.c:2654 #5 0x0000000000610a30 in dpif_operate (dpif=0x2b67b70, ops=0x7f1dd2d2a5c8, n_ops=1) at ../lib/dpif.c:1268 #6 0x000000000061098c in dpif_execute (dpif=0x2b67b70, execute=0x7f1dd2d2aa50) at ../lib/dpif.c:1233 #7 0x00000000005b9008 in ofproto_dpif_execute_actions__ (ofproto=0x2b69360, version=18446744073709551614, flow=0x7f1dd2d2ae70, rule=0x0, ofpacts=0x7f1dd2d2b100, ofpacts_len=16, indentation=0, depth=0, resubmits=0, packet=0x7f1dd2d2b5c0) at ../ofproto/ofproto-dpif.c:3806 #8 0x00000000005b907a in ofproto_dpif_execute_actions (ofproto=0x2b69360, version=18446744073709551614, flow=0x7f1dd2d2ae70, rule=0x0, ofpacts=0x7f1dd2d2b100, ofpacts_len=16, packet=0x7f1dd2d2b5c0) at ../ofproto/ofproto-dpif.c:3823 #9 0x00000000005dea9b in xlate_send_packet (ofport=0x2b98380, oam=false, packet=0x7f1dd2d2b5c0) at ../ofproto/ofproto-dpif-xlate.c:5792 #10 0x00000000005bab12 in ofproto_dpif_send_packet (ofport=0x2b98380, oam=false, packet=0x7f1dd2d2b5c0) at ../ofproto/ofproto-dpif.c:4628 #11 0x00000000005c3fc8 in monitor_mport_run (mport=0x2b8cd00, packet=0x7f1dd2d2b5c0) at ../ofproto/ofproto-dpif-monitor.c:287 #12 0x00000000005c3d9b in monitor_run () at ../ofproto/ofproto-dpif-monitor.c:227 #13 0x00000000005c3cab in monitor_main (args=0x0) at ../ofproto/ofproto-dpif-monitor.c:189 #14 0x00000000006a183a in ovsthread_wrapper (aux_=0x2b8afd0) at ../lib/ovs-thread.c:342 #15 0x00007f1dd75eb444 in start_thread (arg=0x7f1dd2d2c700) at pthread_create.c:333 #16 0x00007f1dd6e1d20d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109 Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org>
* tests: Get rid of overly specific --pidfile and --unixctl options.Ben Pfaff2016-10-1215-340/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | At an early point in OVS development, OVS was built with fixed default directories for pidfiles and sockets. This meant that it was necessary to use lots of --pidfile and --unixctl options in the testsuite, to point the daemons to where they should put these files (since the testsuite cannot and generally should not touch the real system /var/run). Later on, the environment variables OVS_RUNDIR, OVS_LOGDIR, etc. were introduced to override these defaults, and even later the testsuite was changed to always set these variables correctly in every test. Thus, these days it isn't usually necessary to specify a filename on --pidfile or to specify --unixctl at all. However, many of the tests are built by cut-and-paste, so they tended to keep appearing anyhow. This commit drops most of them, making the testsuite easier to read and understand. This commit also sweeps away some other historical detritus. In particular, in early days of the testsuite there was no way to automatically kill daemons when a test failed (or otherwise ended). This meant that some tests were littered with calls to "kill `cat pidfile`" on almost every line (or m4 macros that expanded to the same thing) so that if a test failed partway through the testsuite would not hang waiting for a daemon to die that was never going to die without manual intervention. However, a long time ago we introduced the "on_exit" mechanism that obsoletes this. This commit eliminates a lot of the old litter of kill invocations, which also makes those tests easier to read. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* tests: Fix double-rebuild of testsuite for "check-valgrind" and similar.Ben Pfaff2016-10-121-10/+8
| | | | | | | | | | | | When I ran "make check-valgrind -j10" and the testsuite needed to be rebuilt, two copies of it were rebuilt in parallel and sometimes they raced with each other. I don't have the full story on exactly why this happened, but this commit, which eliminates redundant dependencies from check-* targets, fixes the problem for me. The dependencies are redundant because these targets depend on "all", which also depends on them. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* expr: Better simplify some special cases of expressions.Ben Pfaff2016-10-111-0/+12
| | | | | | | | | It's pretty unlikely that a human would write expressions like these, but they can come up in machine-generated expressions and it seems best to simplify them in an efficient way. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* expr: Improve test so that it would have found the bugs I just fixed.Ben Pfaff2016-10-112-17/+21
| | | | | | | | | | | The test didn't check for x == 0/0 or x != 0/0 cases, and thus they were buggy. Also, add "expression" as a keyword for tests that only had "expressions" (plural). Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* expr: Fix abort when simplifying "x != 0/0".Ben Pfaff2016-10-111-0/+2
| | | | | | | | | The test added by this commit is very specific to the particular problem, whereas a more general test would be better. A later commit adds the general test. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* expr: Simplify "x == 0/0" into 1.Ben Pfaff2016-10-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | An expression like "x == 0/0" does not test any actual bits in field x, so it resolves to true, but expr_simplify() was not smart enough to see this. This goes beyond an optimization, to become a bug fix, because expr_normalize() will assert-fail for expressions that become trivial when this simplification is omitted. For example: $ echo 'eth.dst == 0/0 && eth.dst == 0/0' | tests/ovstest test-ovn normalize-expr test-ovn: ../include/openvswitch/list.h:245: assertion !ovs_list_is_empty(list) failed in ovs_list_front() Aborted (core dumped) This commit fixes this and related problems. The test added by this commit is very specific to the particular problem, whereas a more general test would be better. A later commit adds the general test. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovn: Fix "trace" test to wait for synchronization of southbound ports.Ben Pfaff2016-10-071-0/+3
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovn: Remove weird or unneeded keywords from tests.Ben Pfaff2016-10-071-22/+2
| | | | | | | | | | | | | | | | | | | | | AT_KEYWORDS are mostly there to make it easier to find the tests you're looking for. One might, for example, mark tests as "positive" or "negative" so you can select the tests you want to run on that basis. They're also useful for cases where Autotest just isn't good at splitting words: for example, Autotest includes punctuation so that a test name that has a word followed by a comma or colon won't be selected using a keyword that lacks the comma or the colon. But a lot of OVN tests had keywords that just didn't seem helpful in one of these ways. For example, it's hard to guess why running together words into a longer word would help someone select a test, and it's not helpful at all to repeat one of the words in the test name, since those words are keywords by default anyway. Therefore, this commit removes the keywords that don't seem helpful. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Gurucharan Shetty <guru@ovn.org>
* ovn: Fix some races in ovn-controller-vtep tests.Ben Pfaff2016-10-071-6/+10
| | | | | | | | | | | This fixes a few races for port bindings appearing and being bound to a chassis. The ones changed to use "ovn-sbctl wait-until" were previously only waiting until a Port_Binding record appeared (created by ovn-northd), but not until the Port_Binding record's 'chassis' column was set (by ovn-controller). Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Gurucharan Shetty <guru@ovn.org>
* ovn: Wait for ovn-northd to catch up in "ovn-sbctl" test.Ben Pfaff2016-10-071-4/+6
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Gurucharan Shetty <guru@ovn.org>