]> git.proxmox.com Git - ovs.git/blobdiff - tests/test-flows.c
dpif-netdev: Incremental addition/deletion of PMD threads.
[ovs.git] / tests / test-flows.c
index 5f5dc43f8692bf5a14b4c84686757b5099a2e709..d7fa798df17df2826b155dc6ad0782cb012552f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2017 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 #include <config.h>
+#undef NDEBUG
 #include "flow.h"
+#include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include "classifier.h"
 #include "openflow/openflow.h"
-#include "timeval.h"
-#include "ofpbuf.h"
-#include "ofp-print.h"
-#include "ofp-util.h"
+#include "openvswitch/ofp-print.h"
+#include "openvswitch/ofp-util.h"
+#include "openvswitch/ofpbuf.h"
+#include "openvswitch/vlog.h"
+#include "ovstest.h"
+#include "dp-packet.h"
 #include "pcap-file.h"
+#include "timeval.h"
 #include "util.h"
-#include "vlog.h"
-#include "ovstest.h"
-
-#undef NDEBUG
-#include <assert.h>
 
 static void
 test_flows_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
@@ -58,7 +58,7 @@ test_flows_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
     }
 
     while (fread(&expected_match, sizeof expected_match, 1, flows)) {
-        struct ofpbuf *packet;
+        struct dp_packet *packet;
         struct ofp10_match extracted_match;
         struct match match;
         struct flow flow;
@@ -71,21 +71,21 @@ test_flows_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
             ovs_fatal(retval, "error reading pcap file");
         }
 
-        flow_extract(packet, NULL, &flow);
+        flow_extract(packet, &flow);
         flow.in_port.ofp_port = u16_to_ofp(1);
 
         match_wc_init(&match, &flow);
         ofputil_match_to_ofp10_match(&match, &extracted_match);
 
         if (memcmp(&expected_match, &extracted_match, sizeof expected_match)) {
-            char *exp_s = ofp10_match_to_string(&expected_match, 2);
-            char *got_s = ofp10_match_to_string(&extracted_match, 2);
+            char *exp_s = ofp10_match_to_string(&expected_match, NULL, 2);
+            char *got_s = ofp10_match_to_string(&extracted_match, NULL, 2);
             errors++;
             printf("mismatch on packet #%d (1-based).\n", n);
             printf("Packet:\n");
-            ofp_print_packet(stdout, ofpbuf_data(packet), ofpbuf_size(packet));
-            ovs_hex_dump(stdout, ofpbuf_data(packet), ofpbuf_size(packet), 0, true);
-            match_print(&match);
+            ofp_print_packet(stdout, dp_packet_data(packet), dp_packet_size(packet), htonl(PT_ETH));
+            ovs_hex_dump(stdout, dp_packet_data(packet), dp_packet_size(packet), 0, true);
+            match_print(&match, NULL);
             printf("Expected flow:\n%s\n", exp_s);
             printf("Actually extracted flow:\n%s\n", got_s);
             ovs_hex_dump(stdout, &expected_match, sizeof expected_match, 0, false);
@@ -95,7 +95,7 @@ test_flows_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
             free(got_s);
         }
 
-        ofpbuf_delete(packet);
+        dp_packet_delete(packet);
     }
     printf("checked %d packets, %d errors\n", n, errors);
     exit(errors != 0);