X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-odp.c;h=9ae897c5047bb32dd3e4dbe319bd39782bbdc488;hb=c4f2731da69eaba5f4bb95583225a5399875f6fc;hp=9db27bf531020a24cf80c2221e87bf045bb610e3;hpb=3bffc610fa3ae08fa837f6bd0bf7a2deebdd0970;p=openvswitch diff --git a/tests/test-odp.c b/tests/test-odp.c index 9db27bf5..9ae897c5 100644 --- a/tests/test-odp.c +++ b/tests/test-odp.c @@ -22,6 +22,7 @@ #include "flow.h" #include "odp-util.h" #include "ofpbuf.h" +#include "vlog.h" int main(void) @@ -29,7 +30,9 @@ main(void) struct ds in; ds_init(&in); + vlog_set_levels_from_string("odp_util:console:dbg"); while (!ds_get_line(&in, stdin)) { + enum odp_key_fitness fitness; struct ofpbuf odp_key; struct flow flow; struct ds out; @@ -50,17 +53,29 @@ main(void) continue; } - /* Convert string to ODP key. */ + /* Convert string to OVS DP key. */ ofpbuf_init(&odp_key, 0); - error = odp_flow_key_from_string(ds_cstr(&in), &odp_key); + error = odp_flow_key_from_string(ds_cstr(&in), NULL, &odp_key); if (error) { printf("odp_flow_key_from_string: error\n"); goto next; } /* Convert odp_key to flow. */ - error = odp_flow_key_to_flow(odp_key.data, odp_key.size, &flow); - if (error) { + fitness = odp_flow_key_to_flow(odp_key.data, odp_key.size, &flow); + switch (fitness) { + case ODP_FIT_PERFECT: + break; + + case ODP_FIT_TOO_LITTLE: + printf("ODP_FIT_TOO_LITTLE: "); + break; + + case ODP_FIT_TOO_MUCH: + printf("ODP_FIT_TOO_MUCH: "); + break; + + case ODP_FIT_ERROR: printf("odp_flow_key_to_flow: error\n"); goto next; }