-/* Copyright (c) 2011, 2012 Nicira, Inc.
+/* Copyright (c) 2011, 2012, 2013 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#define MAX_SLAVES 8 /* Maximum supported by this test framework. */
struct slave {
- uint16_t slave_id;
+ ofp_port_t slave_id;
bool enabled;
size_t flow_count;
};
static struct slave *
-slave_lookup(struct slave_group *sg, uint16_t slave_id)
+slave_lookup(struct slave_group *sg, ofp_port_t slave_id)
{
size_t i;
}
static bool
-slave_enabled_cb(uint16_t slave_id, void *aux)
+slave_enabled_cb(ofp_port_t slave_id, void *aux)
{
struct slave *slave;
struct ofpact_bundle *bundle;
struct ofpbuf ofpacts;
struct ofpact *action;
+ char *error;
ofpbuf_init(&ofpacts, 0);
- bundle_parse_load(actions, &ofpacts);
+ error = bundle_parse_load(actions, &ofpacts);
+ if (error) {
+ ovs_fatal(0, "%s", error);
+ }
+
action = ofpacts.data;
bundle = ofpact_get_BUNDLE(xmemdup(action, action->len));
ofpbuf_uninit(&ofpacts);
/* Generate 'slaves' array. */
sg.n_slaves = 0;
for (i = 0; i < bundle->n_slaves; i++) {
- uint16_t slave_id = bundle->slaves[i];
+ ofp_port_t slave_id = bundle->slaves[i];
if (slave_lookup(&sg, slave_id)) {
ovs_fatal(0, "Redundant slaves are not supported. ");
random_bytes(&flows[i], sizeof flows[i]);
memset(flows[i].zeros, 0, sizeof flows[i].zeros);
flows[i].mpls_depth = 0;
- flows[i].regs[0] = OFPP_NONE;
+ flows[i].regs[0] = ofp_to_u16(OFPP_NONE);
}
/* Cycles through each possible liveness permutation for the given
changed = 0;
for (j = 0; j < N_FLOWS; j++) {
struct flow *flow = &flows[j];
- uint16_t old_slave_id, ofp_port;
+ ofp_port_t old_slave_id, ofp_port;
struct flow_wildcards wc;
- old_slave_id = flow->regs[0];
+ old_slave_id = u16_to_ofp(flow->regs[0]);
ofp_port = bundle_execute(bundle, flow, &wc, slave_enabled_cb,
&sg);
- flow->regs[0] = ofp_port;
+ flow->regs[0] = ofp_to_u16(ofp_port);
if (ofp_port != OFPP_NONE) {
slave_lookup(&sg, ofp_port)->flow_count++;