Implement stress option framework.
[openvswitch] / utilities / ovs-ofctl.c
index 3a0056ad188066efd3da73f9d9f154c0b54776c5..82e135abd1d6d629bf535addd191fed67a8a867e 100644 (file)
 
 VLOG_DEFINE_THIS_MODULE(ofctl);
 
-
-#define MOD_PORT_CMD_UP      "up"
-#define MOD_PORT_CMD_DOWN    "down"
-#define MOD_PORT_CMD_FLOOD   "flood"
-#define MOD_PORT_CMD_NOFLOOD "noflood"
-
 /* Use strict matching for flow mod commands? */
 static bool strict;
 
@@ -217,7 +211,7 @@ open_vconn__(const char *name, const char *default_suffix,
     struct stat s;
     char *bridge_path, *datapath_name, *datapath_type;
 
-    bridge_path = xasprintf("%s/%s.%s", ovs_rundir, name, default_suffix);
+    bridge_path = xasprintf("%s/%s.%s", ovs_rundir(), name, default_suffix);
     dp_parse_name(name, &datapath_name, &datapath_type);
 
     if (strstr(name, ":")) {
@@ -239,7 +233,7 @@ open_vconn__(const char *name, const char *default_suffix,
         }
 
         socket_name = xasprintf("%s/%s.%s",
-                                ovs_rundir, dpif_name, default_suffix);
+                                ovs_rundir(), dpif_name, default_suffix);
         if (stat(socket_name, &s)) {
             ovs_fatal(errno, "cannot connect to %s: stat failed on %s",
                       name, socket_name);
@@ -443,7 +437,7 @@ do_dump_flows(int argc, char *argv[])
 
     req = alloc_stats_request(sizeof *req, OFPST_FLOW, &request);
     parse_ofp_str(&pf, NULL, argc > 2 ? argv[2] : "");
-    cls_rule_to_match(&pf.rule, NXFF_OPENFLOW10, &req->match);
+    ofputil_cls_rule_to_match(&pf.rule, NXFF_OPENFLOW10, &req->match);
     memset(&req->pad, 0, sizeof req->pad);
     req->out_port = htons(pf.out_port);
 
@@ -459,7 +453,7 @@ do_dump_aggregate(int argc, char *argv[])
 
     req = alloc_stats_request(sizeof *req, OFPST_AGGREGATE, &request);
     parse_ofp_str(&pf, NULL, argc > 2 ? argv[2] : "");
-    cls_rule_to_match(&pf.rule, NXFF_OPENFLOW10, &req->match);
+    ofputil_cls_rule_to_match(&pf.rule, NXFF_OPENFLOW10, &req->match);
     memset(&req->pad, 0, sizeof req->pad);
     req->out_port = htons(pf.out_port);
 
@@ -690,19 +684,14 @@ do_mod_port(int argc OVS_UNUSED, char *argv[])
     opm->mask = htonl(0);
     opm->advertise = htonl(0);
 
-    printf("modifying port: %s\n", osf->ports[port_idx].name);
-
-    if (!strncasecmp(argv[3], MOD_PORT_CMD_UP, sizeof MOD_PORT_CMD_UP)) {
+    if (!strcasecmp(argv[3], "up")) {
         opm->mask |= htonl(OFPPC_PORT_DOWN);
-    } else if (!strncasecmp(argv[3], MOD_PORT_CMD_DOWN,
-                sizeof MOD_PORT_CMD_DOWN)) {
+    } else if (!strcasecmp(argv[3], "down")) {
         opm->mask |= htonl(OFPPC_PORT_DOWN);
         opm->config |= htonl(OFPPC_PORT_DOWN);
-    } else if (!strncasecmp(argv[3], MOD_PORT_CMD_FLOOD,
-                sizeof MOD_PORT_CMD_FLOOD)) {
+    } else if (!strcasecmp(argv[3], "flood")) {
         opm->mask |= htonl(OFPPC_NO_FLOOD);
-    } else if (!strncasecmp(argv[3], MOD_PORT_CMD_NOFLOOD,
-                sizeof MOD_PORT_CMD_NOFLOOD)) {
+    } else if (!strcasecmp(argv[3], "noflood")) {
         opm->mask |= htonl(OFPPC_NO_FLOOD);
         opm->config |= htonl(OFPPC_NO_FLOOD);
     } else {