/*
- * Copyright (c) 2011 Nicira Networks.
+ * Copyright (c) 2011 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 "flow.h"
#include "odp-util.h"
#include "ofpbuf.h"
+#include "vlog.h"
int
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;
/* 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;
}