2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-01 14:55:18 +00:00

Use primary/secondary, not master/slave, as names for OpenFlow roles.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
This commit is contained in:
Ben Pfaff
2020-06-17 14:55:45 -07:00
parent bbe2e39287
commit 807152a4dd
17 changed files with 308 additions and 296 deletions

View File

@@ -70,79 +70,79 @@ that the message is suppressed.
.. table:: ``OFPT_PACKET_IN`` / ``NXT_PACKET_IN``
=========================================== ======= =====
master/
message and reason code other slave
=========================================== ======= =====
``OFPR_NO_MATCH`` yes ---
``OFPR_ACTION`` yes ---
``OFPR_INVALID_TTL`` --- ---
``OFPR_ACTION_SET`` (OF1.4+) yes ---
``OFPR_GROUP`` (OF1.4+) yes ---
``OFPR_PACKET_OUT`` (OF1.4+) yes ---
=========================================== ======= =====
=========================================== ======== =========
primary/
message and reason code other secondary
=========================================== ======== =========
``OFPR_NO_MATCH`` yes ---
``OFPR_ACTION`` yes ---
``OFPR_INVALID_TTL`` --- ---
``OFPR_ACTION_SET`` (OF1.4+) yes ---
``OFPR_GROUP`` (OF1.4+) yes ---
``OFPR_PACKET_OUT`` (OF1.4+) yes ---
=========================================== ======== =========
.. table:: ``OFPT_FLOW_REMOVED`` / ``NXT_FLOW_REMOVED``
=========================================== ======= =====
master/
message and reason code other slave
=========================================== ======= =====
``OFPRR_IDLE_TIMEOUT`` yes ---
``OFPRR_HARD_TIMEOUT`` yes ---
``OFPRR_DELETE`` yes ---
``OFPRR_GROUP_DELETE`` (OF1.3+) yes ---
``OFPRR_METER_DELETE`` (OF1.4+) yes ---
``OFPRR_EVICTION`` (OF1.4+) yes ---
=========================================== ======= =====
=========================================== ======== =========
primary/
message and reason code other secondary
=========================================== ======== =========
``OFPRR_IDLE_TIMEOUT`` yes ---
``OFPRR_HARD_TIMEOUT`` yes ---
``OFPRR_DELETE`` yes ---
``OFPRR_GROUP_DELETE`` (OF1.3+) yes ---
``OFPRR_METER_DELETE`` (OF1.4+) yes ---
``OFPRR_EVICTION`` (OF1.4+) yes ---
=========================================== ======== =========
.. table:: ``OFPT_PORT_STATUS``
=========================================== ======= =====
master/
message and reason code other slave
=========================================== ======= =====
``OFPPR_ADD`` yes yes
``OFPPR_DELETE`` yes yes
``OFPPR_MODIFY`` yes yes
=========================================== ======= =====
=========================================== ======== =========
primary/
message and reason code other secondary
=========================================== ======== =========
``OFPPR_ADD`` yes ---
``OFPPR_DELETE`` yes ---
``OFPPR_MODIFY`` yes ---
=========================================== ======== =========
.. table:: ``OFPT_ROLE_REQUEST`` / ``OFPT_ROLE_REPLY`` (OF1.4+)
=========================================== ======= =====
master/
message and reason code other slave
=========================================== ======= =====
``OFPCRR_MASTER_REQUEST`` --- ---
``OFPCRR_CONFIG`` --- ---
``OFPCRR_EXPERIMENTER`` --- ---
=========================================== ======= =====
=========================================== ======== =========
primary/
message and reason code other secondary
=========================================== ======== =========
``OFPCRR_PROMOTE_REQUEST`` --- ---
``OFPCRR_CONFIG`` --- ---
``OFPCRR_EXPERIMENTER`` --- ---
=========================================== ======== =========
.. table:: ``OFPT_TABLE_STATUS`` (OF1.4+)
=========================================== ======= =====
master/
message and reason code other slave
=========================================== ======= =====
``OFPTR_VACANCY_DOWN`` --- ---
``OFPTR_VACANCY_UP`` --- ---
=========================================== ======= =====
=========================================== ======== =========
primary/
message and reason code other secondary
=========================================== ======== =========
``OFPTR_VACANCY_DOWN`` --- ---
``OFPTR_VACANCY_UP`` --- ---
=========================================== ======== =========
.. table:: ``OFPT_REQUESTFORWARD`` (OF1.4+)
=========================================== ======= =====
master/
message and reason code other slave
=========================================== ======= =====
``OFPRFR_GROUP_MOD`` --- ---
``OFPRFR_METER_MOD`` --- ---
=========================================== ======= =====
=========================================== ======== =========
primary/
message and reason code other secondary
=========================================== ======== =========
``OFPRFR_GROUP_MOD`` --- ---
``OFPRFR_METER_MOD`` --- ---
=========================================== ======== =========
The ``NXT_SET_ASYNC_CONFIG`` message directly sets all of the values in this
table for the current connection. The ``OFPC_INVALID_TTL_TO_CONTROLLER`` bit
in the ``OFPT_SET_CONFIG`` message controls the setting for
``OFPR_INVALID_TTL`` for the "master" role.
``OFPR_INVALID_TTL`` for the "primary" role.
``OFPAT_ENQUEUE``
-----------------

3
NEWS
View File

@@ -52,6 +52,9 @@ v2.14.0 - 17 Aug 2020
- Tunnels: TC Flower offload
* Tunnel Local endpoint address masked match are supported.
* Tunnel Romte endpoint address masked match are supported.
- Terminology:
* The terms "master" and "slave" have been replaced by "primary" and
"secondary", respectively, for OpenFlow connection roles.
v2.13.0 - 14 Feb 2020

View File

@@ -296,16 +296,16 @@ enum nx_packet_in2_prop_type {
*
* The other possible roles are a related pair:
*
* - Master (NX_ROLE_MASTER) is equivalent to Other, except that there may
* be at most one Master controller at a time: when a controller
* configures itself as Master, any existing Master is demoted to the
* Slave role.
* - Primary (NX_ROLE_PRIMARY) is equivalent to Other, except that there may
* be at most one Primary controller at a time: when a controller
* configures itself as Primary, any existing Primary is demoted to the
* Secondary role.
*
* - Slave (NX_ROLE_SLAVE) allows the controller read-only access to
* - Secondary (NX_ROLE_SECONDARY) allows the controller read-only access to
* OpenFlow features. In particular attempts to modify the flow table
* will be rejected with an OFPBRC_EPERM error.
*
* Slave controllers do not receive OFPT_PACKET_IN or OFPT_FLOW_REMOVED
* Secondary controllers do not receive OFPT_PACKET_IN or OFPT_FLOW_REMOVED
* messages, but they do receive OFPT_PORT_STATUS messages.
*/
struct nx_role_request {
@@ -315,23 +315,23 @@ OFP_ASSERT(sizeof(struct nx_role_request) == 4);
enum nx_role {
NX_ROLE_OTHER, /* Default role, full access. */
NX_ROLE_MASTER, /* Full access, at most one. */
NX_ROLE_SLAVE /* Read-only access. */
NX_ROLE_PRIMARY, /* Full access, at most one. */
NX_ROLE_SECONDARY /* Read-only access. */
};
/* NXT_SET_ASYNC_CONFIG.
*
* Sent by a controller, this message configures the asynchronous messages that
* the controller wants to receive. Element 0 in each array specifies messages
* of interest when the controller has an "other" or "master" role; element 1,
* when the controller has a "slave" role.
* of interest when the controller has an "other" or "primary" role; element 1,
* when the controller has a "secondary" role.
*
* Each array element is a bitmask in which a 0-bit disables receiving a
* particular message and a 1-bit enables receiving it. Each bit controls the
* message whose 'reason' corresponds to the bit index. For example, the bit
* with value 1<<2 == 4 in port_status_mask[1] determines whether the
* controller will receive OFPT_PORT_STATUS messages with reason OFPPR_MODIFY
* (value 2) when the controller has a "slave" role.
* (value 2) when the controller has a "secondary" role.
*
* As a side effect, for service controllers, this message changes the
* miss_send_len from default of zero to OFP_DEFAULT_MISS_SEND_LEN (128).

View File

@@ -176,7 +176,7 @@ enum ofp12_group_capabilities {
struct ofp12_role_request {
ovs_be32 role; /* One of OFPCR12_ROLE_*. */
uint8_t pad[4]; /* Align to 64 bits. */
ovs_be64 generation_id; /* Master Election Generation Id */
ovs_be64 generation_id; /* Primary Election Generation Id */
};
OFP_ASSERT(sizeof(struct ofp12_role_request) == 16);
@@ -184,8 +184,8 @@ OFP_ASSERT(sizeof(struct ofp12_role_request) == 16);
enum ofp12_controller_role {
OFPCR12_ROLE_NOCHANGE, /* Don't change current role. */
OFPCR12_ROLE_EQUAL, /* Default role, full access. */
OFPCR12_ROLE_MASTER, /* Full access, at most one master. */
OFPCR12_ROLE_SLAVE, /* Read-only access. */
OFPCR12_ROLE_PRIMARY, /* Full access, at most one primary. */
OFPCR12_ROLE_SECONDARY, /* Read-only access. */
};
/* Packet received on port (datapath -> controller). */

View File

@@ -274,7 +274,7 @@ struct ofp14_role_status {
ovs_be32 role; /* One of OFPCR_ROLE_*. */
uint8_t reason; /* One of OFPCRR_*. */
uint8_t pad[3]; /* Align to 64 bits. */
ovs_be64 generation_id; /* Master Election Generation Id */
ovs_be64 generation_id; /* Primary Election Generation Id */
/* Followed by a list of struct ofp14_role_prop_header */
};
@@ -282,9 +282,9 @@ OFP_ASSERT(sizeof(struct ofp14_role_status) == 16);
/* What changed about the controller role */
enum ofp14_controller_role_reason {
OFPCRR_MASTER_REQUEST = 0, /* Another controller asked to be master. */
OFPCRR_CONFIG = 1, /* Configuration changed on the switch. */
OFPCRR_EXPERIMENTER = 2, /* Experimenter data changed. */
OFPCRR_PRIMARY_REQUEST = 0, /* Another controller asked to be primary. */
OFPCRR_CONFIG = 1, /* Configuration changed on the switch. */
OFPCRR_EXPERIMENTER = 2, /* Experimenter data changed. */
OFPCRR_N_REASONS /* Denotes number of reasons. */
};

View File

@@ -69,10 +69,10 @@ enum ofputil_async_msg_type {
const char *ofputil_async_msg_type_to_string(enum ofputil_async_msg_type);
struct ofputil_async_cfg {
uint32_t master[OAM_N_TYPES];
uint32_t slave[OAM_N_TYPES];
uint32_t primary[OAM_N_TYPES];
uint32_t secondary[OAM_N_TYPES];
};
#define OFPUTIL_ASYNC_CFG_INIT (struct ofputil_async_cfg) { .master[0] = 0 }
#define OFPUTIL_ASYNC_CFG_INIT (struct ofputil_async_cfg) { .primary[0] = 0 }
enum ofperr ofputil_decode_set_async_config(const struct ofp_header *,
bool loose,

View File

@@ -115,10 +115,10 @@ enum ofperr {
* OFPBIC_BAD_EXP_TYPE. */
/* Expected: 0x0,1,5 in OF1.0 means both OFPBRC_EPERM and
* OFPBRC_IS_SLAVE. */
* OFPBRC_IS_SECONDARY. */
/* Expected: 0x0,1,5 in OF1.1 means both OFPBRC_EPERM and
* OFPBRC_IS_SLAVE. */
* OFPBRC_IS_SECONDARY. */
/* ## ------------------ ## */
/* ## OFPET_HELLO_FAILED ## */
@@ -168,8 +168,9 @@ enum ofperr {
* code defined the specification. ] */
OFPERR_OFPBRC_BAD_TABLE_ID,
/* OF1.0-1.1(1,5), OF1.2+(1,10). Denied because controller is slave. */
OFPERR_OFPBRC_IS_SLAVE,
/* OF1.0-1.1(1,5), OF1.2+(1,10). Denied because controller has secondary
* role. (Secondary controllers have only read-only access.) */
OFPERR_OFPBRC_IS_SECONDARY,
/* NX1.0-1.1(1,514), OF1.2+(1,11). Invalid or missing port. [ A
* non-standard error (1,514), formerly OFPERR_NXBRC_BAD_IN_PORT is used

View File

@@ -48,8 +48,8 @@ ofputil_decode_role_message(const struct ofp_header *oh,
if (orr->role != htonl(OFPCR12_ROLE_NOCHANGE) &&
orr->role != htonl(OFPCR12_ROLE_EQUAL) &&
orr->role != htonl(OFPCR12_ROLE_MASTER) &&
orr->role != htonl(OFPCR12_ROLE_SLAVE)) {
orr->role != htonl(OFPCR12_ROLE_PRIMARY) &&
orr->role != htonl(OFPCR12_ROLE_SECONDARY)) {
return OFPERR_OFPRRFC_BAD_ROLE;
}
@@ -68,12 +68,12 @@ ofputil_decode_role_message(const struct ofp_header *oh,
const struct nx_role_request *nrr = b.msg;
BUILD_ASSERT(NX_ROLE_OTHER + 1 == OFPCR12_ROLE_EQUAL);
BUILD_ASSERT(NX_ROLE_MASTER + 1 == OFPCR12_ROLE_MASTER);
BUILD_ASSERT(NX_ROLE_SLAVE + 1 == OFPCR12_ROLE_SLAVE);
BUILD_ASSERT(NX_ROLE_PRIMARY + 1 == OFPCR12_ROLE_PRIMARY);
BUILD_ASSERT(NX_ROLE_SECONDARY + 1 == OFPCR12_ROLE_SECONDARY);
if (nrr->role != htonl(NX_ROLE_OTHER) &&
nrr->role != htonl(NX_ROLE_MASTER) &&
nrr->role != htonl(NX_ROLE_SLAVE)) {
nrr->role != htonl(NX_ROLE_PRIMARY) &&
nrr->role != htonl(NX_ROLE_SECONDARY)) {
return OFPERR_OFPRRFC_BAD_ROLE;
}
@@ -100,11 +100,11 @@ format_role_generic(struct ds *string, enum ofp12_controller_role role,
case OFPCR12_ROLE_EQUAL:
ds_put_cstr(string, "equal"); /* OF 1.2 wording */
break;
case OFPCR12_ROLE_MASTER:
ds_put_cstr(string, "master");
case OFPCR12_ROLE_PRIMARY:
ds_put_cstr(string, "primary");
break;
case OFPCR12_ROLE_SLAVE:
ds_put_cstr(string, "slave");
case OFPCR12_ROLE_SECONDARY:
ds_put_cstr(string, "secondary");
break;
default:
OVS_NOT_REACHED();
@@ -148,8 +148,8 @@ ofputil_encode_role_reply(const struct ofp_header *request,
struct nx_role_request *nrr;
BUILD_ASSERT(NX_ROLE_OTHER == OFPCR12_ROLE_EQUAL - 1);
BUILD_ASSERT(NX_ROLE_MASTER == OFPCR12_ROLE_MASTER - 1);
BUILD_ASSERT(NX_ROLE_SLAVE == OFPCR12_ROLE_SLAVE - 1);
BUILD_ASSERT(NX_ROLE_PRIMARY == OFPCR12_ROLE_PRIMARY - 1);
BUILD_ASSERT(NX_ROLE_SECONDARY == OFPCR12_ROLE_SECONDARY - 1);
buf = ofpraw_alloc_reply(OFPRAW_NXT_ROLE_REPLY, request, 0);
nrr = ofpbuf_put_zeros(buf, sizeof *nrr);
@@ -197,8 +197,8 @@ ofputil_decode_role_status(const struct ofp_header *oh,
const struct ofp14_role_status *r = b.msg;
if (r->role != htonl(OFPCR12_ROLE_NOCHANGE) &&
r->role != htonl(OFPCR12_ROLE_EQUAL) &&
r->role != htonl(OFPCR12_ROLE_MASTER) &&
r->role != htonl(OFPCR12_ROLE_SLAVE)) {
r->role != htonl(OFPCR12_ROLE_PRIMARY) &&
r->role != htonl(OFPCR12_ROLE_SECONDARY)) {
return OFPERR_OFPRRFC_BAD_ROLE;
}
@@ -218,8 +218,8 @@ ofputil_format_role_status(struct ds *string,
ds_put_cstr(string, " reason=");
switch (rs->reason) {
case OFPCRR_MASTER_REQUEST:
ds_put_cstr(string, "master_request");
case OFPCRR_PRIMARY_REQUEST:
ds_put_cstr(string, "primary_request");
break;
case OFPCRR_CONFIG:
ds_put_cstr(string, "configuration_changed");
@@ -254,13 +254,13 @@ ofputil_async_msg_type_to_string(enum ofputil_async_msg_type type)
struct ofp14_async_prop {
uint64_t prop_type;
enum ofputil_async_msg_type oam;
bool master;
bool primary;
uint32_t allowed10, allowed14;
};
#define AP_PAIR(SLAVE_PROP_TYPE, OAM, A10, A14) \
{ SLAVE_PROP_TYPE, OAM, false, A10, (A14) ? (A14) : (A10) }, \
{ (SLAVE_PROP_TYPE + 1), OAM, true, A10, (A14) ? (A14) : (A10) }
#define AP_PAIR(SECONDARY_PROP_TYPE, OAM, A10, A14) \
{ SECONDARY_PROP_TYPE, OAM, false, A10, (A14) ? (A14) : (A10) }, \
{ (SECONDARY_PROP_TYPE + 1), OAM, true, A10, (A14) ? (A14) : (A10) }
static const struct ofp14_async_prop async_props[] = {
AP_PAIR( 0, OAM_PACKET_IN, OFPR10_BITS, OFPR14_BITS),
@@ -288,10 +288,10 @@ get_ofp14_async_config_prop_by_prop_type(uint64_t prop_type)
static const struct ofp14_async_prop *
get_ofp14_async_config_prop_by_oam(enum ofputil_async_msg_type oam,
bool master)
bool primary)
{
FOR_EACH_ASYNC_PROP (ap) {
if (ap->oam == oam && ap->master == master) {
if (ap->oam == oam && ap->primary == primary) {
return ap;
}
}
@@ -310,7 +310,9 @@ encode_async_mask(const struct ofputil_async_cfg *src,
const struct ofp14_async_prop *ap,
enum ofp_version version)
{
uint32_t mask = ap->master ? src->master[ap->oam] : src->slave[ap->oam];
uint32_t mask = (ap->primary
? src->primary[ap->oam]
: src->secondary[ap->oam]);
return htonl(mask & ofp14_async_prop_allowed(ap, version));
}
@@ -342,7 +344,7 @@ decode_async_mask(ovs_be32 src,
}
}
uint32_t *array = ap->master ? dst->master : dst->slave;
uint32_t *array = ap->primary ? dst->primary : dst->secondary;
array[ap->oam] = mask;
return 0;
}
@@ -362,20 +364,20 @@ parse_async_tlv(const struct ofpbuf *property,
}
if (ofpprop_is_experimenter(ap->prop_type)) {
/* For experimenter properties, whether a property is for the master or
* slave role is indicated by both 'type' and 'exp_type' in struct
/* For experimenter properties, whether a property is for the primary or
* secondary role is indicated by both 'type' and 'exp_type' in struct
* ofp_prop_experimenter. Check that these are consistent. */
const struct ofp_prop_experimenter *ope = property->data;
bool should_be_master = ope->type == htons(0xffff);
if (should_be_master != ap->master) {
bool should_be_primary = ope->type == htons(0xffff);
if (should_be_primary != ap->primary) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
VLOG_WARN_RL(&rl, "async property type %#"PRIx16" "
"indicates %s role but exp_type %"PRIu32" indicates "
"%s role",
ntohs(ope->type),
should_be_master ? "master" : "slave",
should_be_primary ? "primary" : "secondary",
ntohl(ope->exp_type),
ap->master ? "master" : "slave");
ap->primary ? "primary" : "secondary");
return OFPERR_OFPBPC_BAD_EXP_TYPE;
}
}
@@ -390,9 +392,9 @@ decode_legacy_async_masks(const ovs_be32 masks[2],
struct ofputil_async_cfg *dst)
{
for (int i = 0; i < 2; i++) {
bool master = i == 0;
bool primary = i == 0;
const struct ofp14_async_prop *ap
= get_ofp14_async_config_prop_by_oam(oam, master);
= get_ofp14_async_config_prop_by_oam(oam, primary);
decode_async_mask(masks[i], ap, version, true, dst);
}
}
@@ -479,9 +481,9 @@ encode_legacy_async_masks(const struct ofputil_async_cfg *ac,
ovs_be32 masks[2])
{
for (int i = 0; i < 2; i++) {
bool master = i == 0;
bool primary = i == 0;
const struct ofp14_async_prop *ap
= get_ofp14_async_config_prop_by_oam(oam, master);
= get_ofp14_async_config_prop_by_oam(oam, primary);
masks[i] = encode_async_mask(ac, ap, version);
}
}
@@ -507,11 +509,11 @@ ofputil_put_async_config__(const struct ofputil_async_cfg *ac,
encode_async_mask(ac, ap, version));
/* For experimenter properties, we need to use type 0xfffe for
* master and 0xffff for slaves. */
* primary and 0xffff for secondaries. */
if (ofpprop_is_experimenter(ap->prop_type)) {
struct ofp_prop_experimenter *ope
= ofpbuf_at_assert(buf, ofs, sizeof *ope);
ope->type = ap->master ? htons(0xffff) : htons(0xfffe);
ope->type = ap->primary ? htons(0xffff) : htons(0xfffe);
}
}
}
@@ -592,8 +594,8 @@ ofp_role_reason_to_string(enum ofp14_controller_role_reason reason,
char *reasonbuf, size_t bufsize)
{
switch (reason) {
case OFPCRR_MASTER_REQUEST:
return "master_request";
case OFPCRR_PRIMARY_REQUEST:
return "primary_request";
case OFPCRR_CONFIG:
return "configuration_changed";
@@ -664,12 +666,12 @@ ofputil_format_set_async_config(struct ds *string,
const struct ofputil_async_cfg *ac)
{
for (int i = 0; i < 2; i++) {
ds_put_format(string, "\n %s:\n", i == 0 ? "master" : "slave");
ds_put_format(string, "\n %s:\n", i == 0 ? "primary" : "secondary");
for (uint32_t type = 0; type < OAM_N_TYPES; type++) {
ds_put_format(string, "%16s:",
ofputil_async_msg_type_to_string(type));
uint32_t role = i == 0 ? ac->master[type] : ac->slave[type];
uint32_t role = i == 0 ? ac->primary[type] : ac->secondary[type];
for (int j = 0; j < 32; j++) {
if (role & (1u << j)) {
char reasonbuf[INT_STRLEN(int) + 1];
@@ -705,17 +707,17 @@ ofputil_async_cfg_default(enum ofp_version version)
}
struct ofputil_async_cfg oac = {
.master[OAM_PACKET_IN] = pin,
.master[OAM_PORT_STATUS] = OFPPR_BITS,
.slave[OAM_PORT_STATUS] = OFPPR_BITS
.primary[OAM_PACKET_IN] = pin,
.primary[OAM_PORT_STATUS] = OFPPR_BITS,
.secondary[OAM_PORT_STATUS] = OFPPR_BITS
};
if (version >= OFP14_VERSION) {
oac.master[OAM_FLOW_REMOVED] = OFPRR14_BITS;
oac.primary[OAM_FLOW_REMOVED] = OFPRR14_BITS;
} else if (version == OFP13_VERSION) {
oac.master[OAM_FLOW_REMOVED] = OFPRR13_BITS;
oac.primary[OAM_FLOW_REMOVED] = OFPRR13_BITS;
} else {
oac.master[OAM_FLOW_REMOVED] = OFPRR10_BITS;
oac.primary[OAM_FLOW_REMOVED] = OFPRR10_BITS;
}
return oac;

View File

@@ -212,9 +212,9 @@ struct connmgr {
* traversals from other threads can be made safe by holding the
* ofproto_mutex.*/
struct ovs_list conns; /* All ofconns. */
uint64_t master_election_id; /* monotonically increasing sequence number
* for master election */
bool master_election_id_defined;
uint64_t primary_election_id; /* monotonically increasing sequence number
* for primary election */
bool primary_election_id_defined;
/* OpenFlow connection establishment. */
struct hmap services; /* Contains "struct ofservice"s. */
@@ -253,8 +253,8 @@ connmgr_create(struct ofproto *ofproto,
mgr->local_port_name = xstrdup(local_port_name);
ovs_list_init(&mgr->conns);
mgr->master_election_id = 0;
mgr->master_election_id_defined = false;
mgr->primary_election_id = 0;
mgr->primary_election_id_defined = false;
hmap_init(&mgr->services);
mgr->snoops = NULL;
@@ -773,11 +773,11 @@ snoop_preference(const struct ofservice *ofservice)
}
switch (ofconn->role) {
case OFPCR12_ROLE_MASTER:
case OFPCR12_ROLE_PRIMARY:
return 3;
case OFPCR12_ROLE_EQUAL:
return 2;
case OFPCR12_ROLE_SLAVE:
case OFPCR12_ROLE_SECONDARY:
return 1;
case OFPCR12_ROLE_NOCHANGE:
default:
@@ -818,33 +818,33 @@ ofconn_get_type(const struct ofconn *ofconn)
return ofconn->type;
}
/* If a master election id is defined, stores it into '*idp' and returns
/* If a primary election id is defined, stores it into '*idp' and returns
* true. Otherwise, stores UINT64_MAX into '*idp' and returns false. */
bool
ofconn_get_master_election_id(const struct ofconn *ofconn, uint64_t *idp)
ofconn_get_primary_election_id(const struct ofconn *ofconn, uint64_t *idp)
{
*idp = (ofconn->connmgr->master_election_id_defined
? ofconn->connmgr->master_election_id
*idp = (ofconn->connmgr->primary_election_id_defined
? ofconn->connmgr->primary_election_id
: UINT64_MAX);
return ofconn->connmgr->master_election_id_defined;
return ofconn->connmgr->primary_election_id_defined;
}
/* Sets the master election id.
/* Sets the primary election id.
*
* Returns true if successful, false if the id is stale
*/
bool
ofconn_set_master_election_id(struct ofconn *ofconn, uint64_t id)
ofconn_set_primary_election_id(struct ofconn *ofconn, uint64_t id)
{
if (ofconn->connmgr->master_election_id_defined
if (ofconn->connmgr->primary_election_id_defined
&&
/* Unsigned difference interpreted as a two's complement signed
* value */
(int64_t)(id - ofconn->connmgr->master_election_id) < 0) {
(int64_t)(id - ofconn->connmgr->primary_election_id) < 0) {
return false;
}
ofconn->connmgr->master_election_id = id;
ofconn->connmgr->master_election_id_defined = true;
ofconn->connmgr->primary_election_id = id;
ofconn->connmgr->primary_election_id_defined = true;
return true;
}
@@ -864,7 +864,7 @@ ofconn_send_role_status(struct ofconn *ofconn, uint32_t role, uint8_t reason)
struct ofputil_role_status status;
status.reason = reason;
status.role = role;
ofconn_get_master_election_id(ofconn, &status.generation_id);
ofconn_get_primary_election_id(ofconn, &status.generation_id);
struct ofpbuf *buf
= ofputil_encode_role_status(&status, ofconn_get_protocol(ofconn));
@@ -873,19 +873,19 @@ ofconn_send_role_status(struct ofconn *ofconn, uint32_t role, uint8_t reason)
}
}
/* Changes 'ofconn''s role to 'role'. If 'role' is OFPCR12_ROLE_MASTER then
* any existing master is demoted to a slave. */
/* Changes 'ofconn''s role to 'role'. If 'role' is OFPCR12_ROLE_PRIMARY then
* any existing primary is demoted to a secondary. */
void
ofconn_set_role(struct ofconn *ofconn, enum ofp12_controller_role role)
{
if (role != ofconn->role && role == OFPCR12_ROLE_MASTER) {
if (role != ofconn->role && role == OFPCR12_ROLE_PRIMARY) {
struct ofconn *other;
LIST_FOR_EACH (other, connmgr_node, &ofconn->connmgr->conns) {
if (other->role == OFPCR12_ROLE_MASTER) {
other->role = OFPCR12_ROLE_SLAVE;
ofconn_send_role_status(other, OFPCR12_ROLE_SLAVE,
OFPCRR_MASTER_REQUEST);
if (other->role == OFPCR12_ROLE_PRIMARY) {
other->role = OFPCR12_ROLE_SECONDARY;
ofconn_send_role_status(other, OFPCR12_ROLE_SECONDARY,
OFPCRR_PRIMARY_REQUEST);
}
}
}
@@ -898,9 +898,9 @@ ofconn_set_invalid_ttl_to_controller(struct ofconn *ofconn, bool enable)
struct ofputil_async_cfg ac = ofconn_get_async_config(ofconn);
uint32_t bit = 1u << OFPR_INVALID_TTL;
if (enable) {
ac.master[OAM_PACKET_IN] |= bit;
ac.primary[OAM_PACKET_IN] |= bit;
} else {
ac.master[OAM_PACKET_IN] &= ~bit;
ac.primary[OAM_PACKET_IN] &= ~bit;
}
ofconn_set_async_config(ofconn, &ac);
}
@@ -910,7 +910,7 @@ ofconn_get_invalid_ttl_to_controller(struct ofconn *ofconn)
{
struct ofputil_async_cfg ac = ofconn_get_async_config(ofconn);
uint32_t bit = 1u << OFPR_INVALID_TTL;
return (ac.master[OAM_PACKET_IN] & bit) != 0;
return (ac.primary[OAM_PACKET_IN] & bit) != 0;
}
/* Returns the currently configured protocol for 'ofconn', one of OFPUTIL_P_*.
@@ -1002,11 +1002,11 @@ ofconn_set_async_config(struct ofconn *ofconn,
if (ofputil_protocol_to_ofp_version(ofconn_get_protocol(ofconn))
< OFP14_VERSION) {
if (ofconn->async_cfg->master[OAM_PACKET_IN] & (1u << OFPR_ACTION)) {
ofconn->async_cfg->master[OAM_PACKET_IN] |= OFPR14_ACTION_BITS;
if (ofconn->async_cfg->primary[OAM_PACKET_IN] & (1u << OFPR_ACTION)) {
ofconn->async_cfg->primary[OAM_PACKET_IN] |= OFPR14_ACTION_BITS;
}
if (ofconn->async_cfg->slave[OAM_PACKET_IN] & (1u << OFPR_ACTION)) {
ofconn->async_cfg->slave[OAM_PACKET_IN] |= OFPR14_ACTION_BITS;
if (ofconn->async_cfg->secondary[OAM_PACKET_IN] & (1u << OFPR_ACTION)) {
ofconn->async_cfg->secondary[OAM_PACKET_IN] |= OFPR14_ACTION_BITS;
}
}
}
@@ -1441,9 +1441,9 @@ ofconn_receives_async_msg(const struct ofconn *ofconn,
}
struct ofputil_async_cfg ac = ofconn_get_async_config(ofconn);
uint32_t *masks = (ofconn->role == OFPCR12_ROLE_SLAVE
? ac.slave
: ac.master);
uint32_t *masks = (ofconn->role == OFPCR12_ROLE_SECONDARY
? ac.secondary
: ac.primary);
return (masks[type] & (1u << reason)) != 0;
}

View File

@@ -84,8 +84,8 @@ void connmgr_get_snoops(const struct connmgr *, struct sset *snoops);
/* Individual connections to OpenFlow controllers. */
enum ofconn_type ofconn_get_type(const struct ofconn *);
bool ofconn_get_master_election_id(const struct ofconn *, uint64_t *idp);
bool ofconn_set_master_election_id(struct ofconn *, uint64_t);
bool ofconn_get_primary_election_id(const struct ofconn *, uint64_t *idp);
bool ofconn_set_primary_election_id(struct ofconn *, uint64_t);
enum ofp12_controller_role ofconn_get_role(const struct ofconn *);
void ofconn_set_role(struct ofconn *, enum ofp12_controller_role);

View File

@@ -3471,7 +3471,7 @@ handle_set_config(struct ofconn *ofconn, const struct ofp_header *oh)
}
if (ofconn_get_type(ofconn) != OFCONN_PRIMARY
|| ofconn_get_role(ofconn) != OFPCR12_ROLE_SLAVE) {
|| ofconn_get_role(ofconn) != OFPCR12_ROLE_SECONDARY) {
enum ofputil_frag_handling cur = ofproto->frag_handling;
enum ofputil_frag_handling next = config.frag;
@@ -3496,16 +3496,16 @@ handle_set_config(struct ofconn *ofconn, const struct ofp_header *oh)
return 0;
}
/* Checks whether 'ofconn' is a slave controller. If so, returns an OpenFlow
* error message code for the caller to propagate upward. Otherwise, returns
* 0.
/* Checks whether 'ofconn' is a secondary controller. If so, returns an
* OpenFlow error message code for the caller to propagate upward. Otherwise,
* returns 0.
*
* The log message mentions 'msg_type'. */
static enum ofperr
reject_slave_controller(struct ofconn *ofconn)
reject_secondary_controller(struct ofconn *ofconn)
{
if (ofconn_get_role(ofconn) == OFPCR12_ROLE_SLAVE) {
return OFPERR_OFPBRC_IS_SLAVE;
if (ofconn_get_role(ofconn) == OFPCR12_ROLE_SECONDARY) {
return OFPERR_OFPBRC_IS_SECONDARY;
} else {
return 0;
}
@@ -3686,7 +3686,7 @@ handle_packet_out(struct ofconn *ofconn, const struct ofp_header *oh)
COVERAGE_INC(ofproto_packet_out);
error = reject_slave_controller(ofconn);
error = reject_secondary_controller(ofconn);
if (error) {
return error;
}
@@ -3808,7 +3808,7 @@ handle_port_mod(struct ofconn *ofconn, const struct ofp_header *oh)
struct ofport *port;
enum ofperr error;
error = reject_slave_controller(ofconn);
error = reject_secondary_controller(ofconn);
if (error) {
return error;
}
@@ -6174,7 +6174,7 @@ handle_flow_mod(struct ofconn *ofconn, const struct ofp_header *oh)
struct ofpbuf ofpacts;
enum ofperr error;
error = reject_slave_controller(ofconn);
error = reject_secondary_controller(ofconn);
if (error) {
return error;
}
@@ -6237,7 +6237,7 @@ handle_role_request(struct ofconn *ofconn, const struct ofp_header *oh)
if (request.role != OFPCR12_ROLE_NOCHANGE) {
if (request.role != OFPCR12_ROLE_EQUAL
&& request.have_generation_id
&& !ofconn_set_master_election_id(ofconn, request.generation_id)) {
&& !ofconn_set_primary_election_id(ofconn, request.generation_id)) {
return OFPERR_OFPRRFC_STALE;
}
@@ -6245,7 +6245,7 @@ handle_role_request(struct ofconn *ofconn, const struct ofp_header *oh)
}
reply.role = ofconn_get_role(ofconn);
reply.have_generation_id = ofconn_get_master_election_id(
reply.have_generation_id = ofconn_get_primary_election_id(
ofconn, &reply.generation_id);
buf = ofputil_encode_role_reply(oh, &reply);
ofconn_send_reply(ofconn, buf);
@@ -6865,7 +6865,7 @@ handle_meter_mod(struct ofconn *ofconn, const struct ofp_header *oh)
uint32_t meter_id;
enum ofperr error;
error = reject_slave_controller(ofconn);
error = reject_secondary_controller(ofconn);
if (error) {
return error;
}
@@ -7801,7 +7801,7 @@ handle_group_mod(struct ofconn *ofconn, const struct ofp_header *oh)
struct ofproto_group_mod ogm;
enum ofperr error;
error = reject_slave_controller(ofconn);
error = reject_secondary_controller(ofconn);
if (error) {
return error;
}
@@ -7922,7 +7922,7 @@ handle_table_mod(struct ofconn *ofconn, const struct ofp_header *oh)
struct ofputil_table_mod tm;
enum ofperr error;
error = reject_slave_controller(ofconn);
error = reject_secondary_controller(ofconn);
if (error) {
return error;
}
@@ -8295,7 +8295,7 @@ handle_bundle_control(struct ofconn *ofconn, const struct ofp_header *oh)
struct ofpbuf *buf;
enum ofperr error;
error = reject_slave_controller(ofconn);
error = reject_secondary_controller(ofconn);
if (error) {
return error;
}
@@ -8349,7 +8349,7 @@ handle_bundle_add(struct ofconn *ofconn, const struct ofp_header *oh)
struct ofputil_bundle_add_msg badd;
enum ofptype type;
error = reject_slave_controller(ofconn);
error = reject_secondary_controller(ofconn);
if (error) {
return error;
}
@@ -8427,7 +8427,7 @@ handle_tlv_table_mod(struct ofconn *ofconn, const struct ofp_header *oh)
struct ofputil_tlv_table_mod ttm;
enum ofperr error;
error = reject_slave_controller(ofconn);
error = reject_secondary_controller(ofconn);
if (error) {
return error;
}

View File

@@ -2816,7 +2816,8 @@ AT_CLEANUP
AT_SETUP([OFPT_SET_ASYNC - OF1.3])
AT_KEYWORDS([ofp-print])
dnl This message has bit 12 set for the PACKET_IN messages (master and slave).
dnl This message has bit 12 set for the PACKET_IN messages (primary and
dnl secondary).
dnl Those aren't supported bits so they get silently ignored on decoding.
dnl That seems reasonable because OF1.3 doesn't define any error codes for
dnl OFPT_SET_ASYNC.
@@ -2825,7 +2826,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
00 00 00 03 00 00 00 07 00 00 00 00 00 00 00 03 \
"], [0], [dnl
OFPT_SET_ASYNC (OF1.3) (xid=0x0):
master:
primary:
PACKET_IN: no_match invalid_ttl
PORT_STATUS: add delete
FLOW_REMOVED: (off)
@@ -2833,7 +2834,7 @@ OFPT_SET_ASYNC (OF1.3) (xid=0x0):
TABLE_STATUS: (off)
REQUESTFORWARD: (off)
slave:
secondary:
PACKET_IN: no_match action invalid_ttl
PORT_STATUS: add delete modify
FLOW_REMOVED: idle hard
@@ -2849,7 +2850,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
03 18 00 18 00 00 00 02 00 00 00 02 00 00 00 00 \
00 00 00 00 00 00 00 03 \
"], [0], [dnl
OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=master generation_id=3
OFPT_ROLE_REQUEST (OF1.2) (xid=0x2): role=primary generation_id=3
])
AT_CLEANUP
@@ -2869,7 +2870,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
01 04 00 14 00 00 00 02 00 00 23 20 00 00 00 0a \
00 00 00 01 \
"], [0], [dnl
NXT_ROLE_REQUEST (xid=0x2): role=master
NXT_ROLE_REQUEST (xid=0x2): role=primary
])
AT_CLEANUP
@@ -2879,7 +2880,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
03 19 00 18 00 00 00 02 00 00 00 03 00 00 00 00 \
12 34 56 78 ab cd ef 90 \
"], [0], [dnl
OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=slave generation_id=1311768467750121360
OFPT_ROLE_REPLY (OF1.2) (xid=0x2): role=secondary generation_id=1311768467750121360
])
AT_CLEANUP
@@ -2889,67 +2890,67 @@ AT_CHECK([ovs-ofctl ofp-print "\
01 04 00 14 00 00 00 02 00 00 23 20 00 00 00 0b \
00 00 00 02 \
"], [0], [dnl
NXT_ROLE_REPLY (xid=0x2): role=slave
NXT_ROLE_REPLY (xid=0x2): role=secondary
])
AT_CLEANUP
AT_SETUP([OFP_ROLE_STATUS - master, experimenter - OF1.3])
AT_SETUP([OFP_ROLE_STATUS - primary, experimenter - OF1.3])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
04 04 00 20 00 00 00 0a 4f 4e 46 00 00 00 07 77 \
00 00 00 02 02 00 00 00 ff ff ff ff ff ff ff ff \
"], [0], [dnl
ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=master reason=experimenter_data_changed
ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=primary reason=experimenter_data_changed
])
AT_CLEANUP
AT_SETUP([OFP_ROLE_STATUS - master, config - OF1.3])
AT_SETUP([OFP_ROLE_STATUS - primary, config - OF1.3])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
04 04 00 20 00 00 00 0a 4f 4e 46 00 00 00 07 77 \
00 00 00 02 01 00 00 00 ff ff ff ff ff ff ff ff \
"], [0], [dnl
ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=master reason=configuration_changed
ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=primary reason=configuration_changed
])
AT_CLEANUP
AT_SETUP([OFP_ROLE_STATUS - master, config,generation - OF1.3])
AT_SETUP([OFP_ROLE_STATUS - primary, config,generation - OF1.3])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
04 04 00 20 00 00 00 0a 4f 4e 46 00 00 00 07 77 \
00 00 00 02 01 00 00 00 00 00 00 00 00 00 00 10 \
"], [0], [dnl
ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=master generation_id=16 reason=configuration_changed
ONFT_ROLE_STATUS (OF1.3) (xid=0xa): role=primary generation_id=16 reason=configuration_changed
])
AT_CLEANUP
AT_SETUP([OFP_ROLE_STATUS - master, experimenter - OF1.4])
AT_SETUP([OFP_ROLE_STATUS - primary, experimenter - OF1.4])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
05 1e 00 18 00 00 00 0a \
00 00 00 02 02 00 00 00 ff ff ff ff ff ff ff ff \
"], [0], [dnl
OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=master reason=experimenter_data_changed
OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=primary reason=experimenter_data_changed
])
AT_CLEANUP
AT_SETUP([OFP_ROLE_STATUS - master, config - OF1.4])
AT_SETUP([OFP_ROLE_STATUS - primary, config - OF1.4])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
05 1e 00 18 00 00 00 0a \
00 00 00 02 01 00 00 00 ff ff ff ff ff ff ff ff \
"], [0], [dnl
OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=master reason=configuration_changed
OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=primary reason=configuration_changed
])
AT_CLEANUP
AT_SETUP([OFP_ROLE_STATUS - master, config,generation - OF1.4])
AT_SETUP([OFP_ROLE_STATUS - primary, config,generation - OF1.4])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
05 1e 00 18 00 00 00 0a \
00 00 00 02 01 00 00 00 00 00 00 00 00 00 00 10 \
"], [0], [dnl
OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=master generation_id=16 reason=configuration_changed
OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=primary generation_id=16 reason=configuration_changed
])
AT_CLEANUP
@@ -3156,7 +3157,7 @@ AT_CLEANUP
AT_SETUP([NXT_SET_ASYNC_CONFIG])
AT_KEYWORDS([ofp-print])
dnl This message has bit 12 set for the PACKET_IN messages (master and slave).
dnl This message has bit 12 set for the PACKET_IN messages (primary and secondary).
dnl Those aren't supported bits so they get silently ignored on decoding.
AT_CHECK([ovs-ofctl ofp-print "\
01 04 00 28 00 00 00 00 00 00 23 20 00 00 00 13 \
@@ -3164,7 +3165,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
00 00 00 00 00 00 00 03 \
"], [0], [dnl
NXT_SET_ASYNC_CONFIG (xid=0x0):
master:
primary:
PACKET_IN: no_match invalid_ttl
PORT_STATUS: add delete
FLOW_REMOVED: (off)
@@ -3172,7 +3173,7 @@ NXT_SET_ASYNC_CONFIG (xid=0x0):
TABLE_STATUS: (off)
REQUESTFORWARD: (off)
slave:
secondary:
PACKET_IN: no_match action invalid_ttl
PORT_STATUS: add delete modify
FLOW_REMOVED: idle hard
@@ -3191,7 +3192,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
00 05 00 08 00 00 00 05 \
"], [0], [dnl
OFPT_SET_ASYNC (OF1.4) (xid=0x2):
master:
primary:
PACKET_IN: action
PORT_STATUS: add modify
FLOW_REMOVED: idle delete
@@ -3199,7 +3200,7 @@ OFPT_SET_ASYNC (OF1.4) (xid=0x2):
TABLE_STATUS: (off)
REQUESTFORWARD: (off)
slave:
secondary:
PACKET_IN: no_match invalid_ttl
PORT_STATUS: delete
FLOW_REMOVED: delete group_delete meter_delete

View File

@@ -3401,13 +3401,13 @@ AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=outp
dnl Singleton controller action.
AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
# Become slave (OF 1.3), which should disable everything except port status.
# Become secondary (OF 1.3), which should disable everything except port status.
ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
# Ensure that ovs-vswitchd gets a chance to reply before sending another command.
ovs-appctl time/warp 500 100
# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for secondary only.
ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
ovs-appctl time/warp 500 100
@@ -3419,11 +3419,11 @@ OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
AT_CHECK([ovs-appctl revalidator/purge], [0])
AT_CHECK([cat ofctl_monitor.log], [0], [dnl
send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=secondary generation_id=1
OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=secondary generation_id=1
dnl
send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
master:
primary:
PACKET_IN: (off)
PORT_STATUS: (off)
FLOW_REMOVED: (off)
@@ -3431,7 +3431,7 @@ send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
TABLE_STATUS: (off)
REQUESTFORWARD: (off)
slave:
secondary:
PACKET_IN: no_match
PORT_STATUS: (off)
FLOW_REMOVED: (off)

View File

@@ -3157,7 +3157,7 @@ check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
ovs-appctl -t ovs-ofctl ofctl/send 0109000c0123456700040080
check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
# Become slave, which should disable everything except port status.
# Become secondary, which should disable everything except port status.
ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000002
check_async 4 OFPPR_ADD OFPPR_DELETE
@@ -3172,7 +3172,7 @@ check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
# Restore controller ID 0.
ovs-appctl -t ovs-ofctl ofctl/send 010400180000000300002320000000140000000000000000
# Become master.
# Become primary.
ovs-appctl -t ovs-ofctl ofctl/send 0104001400000002000023200000000a00000001
check_async 7 OFPR_ACTION OFPPR_ADD
@@ -3264,7 +3264,7 @@ check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700040080
check_async 3 OFPR_ACTION OFPR_INVALID_TTL OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
# Become slave (OF 1.2), which should disable everything except port status.
# Become secondary (OF 1.2), which should disable everything except port status.
ovs-appctl -t ovs-ofctl ofctl/send 031800180000000200000003000000000000000000000001
check_async 4 OFPPR_ADD OFPPR_DELETE
@@ -3279,7 +3279,7 @@ check_async 6 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
# Restore controller ID 0.
ovs-appctl -t ovs-ofctl ofctl/send 030400180000000300002320000000140000000000000000
# Become master (OF 1.2).
# Become primary (OF 1.2).
ovs-appctl -t ovs-ofctl ofctl/send 031800180000000400000002000000000000000000000002
check_async 7 OFPR_ACTION OFPPR_ADD
@@ -3383,7 +3383,7 @@ check_async 1
ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
# Become slave (OF 1.3), which should disable everything except port status.
# Become secondary (OF 1.3), which should disable everything except port status.
ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
check_async 3 OFPPR_ADD OFPPR_DELETE
@@ -3398,7 +3398,7 @@ check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
# Restore controller ID 0.
ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
# Become master (OF 1.3).
# Become primary (OF 1.3).
ovs-appctl -t ovs-ofctl ofctl/send 041800180000000400000002000000000000000000000002
check_async 6 OFPR_ACTION OFPPR_ADD
@@ -3615,7 +3615,7 @@ check_async 1
ovs_appctl -t ovs-ofctl ofctl/send 0509000c0123456700000080
check_async 2 OFPR_PACKET_OUT OFPR_ACTION_SET OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
# Become slave (OF 1.4), which should disable everything except port status.
# Become secondary (OF 1.4), which should disable everything except port status.
ovs_appctl -t ovs-ofctl ofctl/send 051800180000000200000003000000000000000000000001
check_async 3 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
@@ -3630,7 +3630,7 @@ check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
# Restore controller ID 0.
ovs_appctl -t ovs-ofctl ofctl/send 050400180000000300002320000000140000000000000000
# Become master (OF 1.4).
# Become primary (OF 1.4).
ovs_appctl -t ovs-ofctl ofctl/send 051800180000000400000002000000000000000000000002
check_async 6 OFPR_PACKET_OUT OFPPR_ADD OFPPR_MODIFY OFPRR_DELETE
@@ -3740,27 +3740,27 @@ for i in 1 2; do
echo >>expout$i "OFPT_ROLE_REPLY (OF1.2): role=equal"
done
# controller 1: Become slave (generation_id is initially undefined, so
# controller 1: Become secondary (generation_id is initially undefined, so
# 2^63+2 should not be stale)
ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000300000003000000008000000000000002
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=slave generation_id=9223372036854775810"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=slave generation_id=9223372036854775810"
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=secondary generation_id=9223372036854775810"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=secondary generation_id=9223372036854775810"
# controller 2: Become master.
# controller 2: Become primary.
ovs-appctl -t `pwd`/c2 ofctl/send 031800180000000300000002000000008000000000000003
echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=9223372036854775811"
echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=9223372036854775811"
echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=9223372036854775811"
echo >>expout2 "OFPT_ROLE_REPLY (OF1.2): role=primary generation_id=9223372036854775811"
# controller 1: Try to become the master using a stale generation ID
# controller 1: Try to become the primary using a stale generation ID
ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000400000002000000000000000000000003
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=3"
echo >>expout1 "OFPT_ERROR (OF1.2): OFPRRFC_STALE"
echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=3"
echo >>expout1 "OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=3"
# controller 1: Become master using a valid generation ID
# controller 1: Become primary using a valid generation ID
ovs-appctl -t `pwd`/c1 ofctl/send 031800180000000500000002000000000000000000000001
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=master generation_id=1"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=master generation_id=1"
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.2): role=primary generation_id=1"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.2): role=primary generation_id=1"
for i in 1 2; do
ovs-appctl -t `pwd`/c$i ofctl/barrier
@@ -3779,8 +3779,8 @@ AT_CLEANUP
dnl This test checks that the role request/response messaging works,
dnl that generation_id is handled properly, and that role status update
dnl messages are sent when a controller's role gets changed from master
dnl to slave.
dnl messages are sent when a controller's role gets changed from primary
dnl to secondary.
AT_SETUP([ofproto - controller role (OpenFlow 1.4)])
OVS_VSWITCHD_START
on_exit 'kill `cat c1.pid c2.pid`'
@@ -3805,28 +3805,28 @@ for i in 1 2; do
echo >>expout$i "OFPT_ROLE_REPLY (OF1.4): role=equal"
done
# controller 1: Become slave (generation_id is initially undefined, so
# controller 1: Become secondary (generation_id is initially undefined, so
# 2^63+2 should not be stale)
ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000300000003000000008000000000000002
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=slave generation_id=9223372036854775810"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=slave generation_id=9223372036854775810"
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=secondary generation_id=9223372036854775810"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=secondary generation_id=9223372036854775810"
# controller 2: Become master.
# controller 2: Become primary.
ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=9223372036854775811"
echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=9223372036854775811"
echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=9223372036854775811"
echo >>expout2 "OFPT_ROLE_REPLY (OF1.4): role=primary generation_id=9223372036854775811"
# controller 1: Try to become the master using a stale generation ID
# controller 1: Try to become the primary using a stale generation ID
ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000400000002000000000000000000000003
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=3"
echo >>expout1 "OFPT_ERROR (OF1.4): OFPRRFC_STALE"
echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=3"
echo >>expout1 "OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=3"
# controller 1: Become master using a valid generation ID
# controller 1: Become primary using a valid generation ID
ovs-appctl -t `pwd`/c1 ofctl/send 051800180000000500000002000000000000000000000001
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=master generation_id=1"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=master generation_id=1"
echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=slave generation_id=1 reason=master_request"
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.4): role=primary generation_id=1"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.4): role=primary generation_id=1"
echo >>expout2 "OFPT_ROLE_STATUS (OF1.4): role=secondary generation_id=1 reason=primary_request"
for i in 1 2; do
ovs-appctl -t `pwd`/c$i ofctl/barrier
@@ -3845,8 +3845,8 @@ AT_CLEANUP
dnl This test checks that the role request/response messaging works,
dnl that generation_id is handled properly, and that role status update
dnl messages are sent when a controller's role gets changed from master
dnl to slave.
dnl messages are sent when a controller's role gets changed from primary
dnl to secondary.
AT_SETUP([ofproto - controller role (OpenFlow 1.3)])
OVS_VSWITCHD_START
on_exit 'kill `cat c1.pid c2.pid`'
@@ -3871,28 +3871,28 @@ for i in 1 2; do
echo >>expout$i "OFPT_ROLE_REPLY (OF1.3): role=equal"
done
# controller 1: Become slave (generation_id is initially undefined, so
# controller 1: Become secondary (generation_id is initially undefined, so
# 2^63+2 should not be stale)
ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=slave generation_id=9223372036854775810"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=slave generation_id=9223372036854775810"
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=secondary generation_id=9223372036854775810"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=secondary generation_id=9223372036854775810"
# controller 2: Become master.
# controller 2: Become primary.
ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=9223372036854775811"
echo >>expout2 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=9223372036854775811"
echo >>experr2 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=9223372036854775811"
echo >>expout2 "OFPT_ROLE_REPLY (OF1.3): role=primary generation_id=9223372036854775811"
# controller 1: Try to become the master using a stale generation ID
# controller 1: Try to become the primary using a stale generation ID
ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000400000002000000000000000000000003
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3"
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=3"
echo >>expout1 "OFPT_ERROR (OF1.3): OFPRRFC_STALE"
echo >>expout1 "OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=3"
echo >>expout1 "OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=3"
# controller 1: Become master using a valid generation ID
# controller 1: Become primary using a valid generation ID
ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000500000002000000000000000000000001
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=master generation_id=1"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=master generation_id=1"
echo >>expout2 "ONFT_ROLE_STATUS (OF1.3): role=slave generation_id=1 reason=master_request"
echo >>experr1 "send: OFPT_ROLE_REQUEST (OF1.3): role=primary generation_id=1"
echo >>expout1 "OFPT_ROLE_REPLY (OF1.3): role=primary generation_id=1"
echo >>expout2 "ONFT_ROLE_STATUS (OF1.3): role=secondary generation_id=1 reason=primary_request"
for i in 1 2; do
ovs-appctl -t `pwd`/c$i ofctl/barrier
@@ -3978,13 +3978,13 @@ s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
done
}
# controller 1: Become slave
# controller 1: Become secondary
ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
# controller 2: Become master
# controller 2: Become primary
ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
# controller 1: Become slave
# controller 1: Become secondary
ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
# controller 1: Enabled requestforward using set Asynchronous message
@@ -4074,16 +4074,16 @@ s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
done
}
# controller 1: Become slave
# NXT_ROLE_REQUEST (xid=0x3): role=slave
# controller 1: Become secondary
# NXT_ROLE_REQUEST (xid=0x3): role=secondary
ovs-appctl -t `pwd`/c1 ofctl/send 0104001400000003000023200000000a00000002
# controller 2: Become master
# NXT_ROLE_REQUEST (xid=0x3): role=master
# controller 2: Become primary
# NXT_ROLE_REQUEST (xid=0x3): role=primary
ovs-appctl -t `pwd`/c2 ofctl/send 0104001400000003000023200000000a00000001
# controller 1: Become slave
# NXT_ROLE_REQUEST (xid=0x3): role=slave
# controller 1: Become secondary
# NXT_ROLE_REQUEST (xid=0x3): role=secondary
ovs-appctl -t `pwd`/c3 ofctl/send 0104001400000003000023200000000a00000002
# controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2
@@ -4172,16 +4172,16 @@ s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
done
}
# controller 1: Become slave
# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=slave
# controller 1: Become secondary
# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=secondary
ovs-appctl -t `pwd`/c1 ofctl/send 041800180000000300000003000000008000000000000002
# controller 2: Become master
# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=master
# controller 2: Become primary
# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=primary
ovs-appctl -t `pwd`/c2 ofctl/send 041800180000000300000002000000008000000000000003
# controller 1: Become slave
# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=slave
# controller 1: Become secondary
# OFPT_ROLE_REQUEST (OF1.3) (xid=0x3): role=secondary
ovs-appctl -t `pwd`/c3 ofctl/send 041800180000000300000003000000008000000000000004
# controller 1: Enabled requestforward using OFPRAW_NXT_SET_ASYNC_CONFIG2 (necessary for OF1.3)
@@ -4951,7 +4951,7 @@ EOF
AT_CHECK([ofctl_strip < monitor.log], [], [dnl
send: OFPT_GET_ASYNC_REQUEST (OF1.3):
OFPT_GET_ASYNC_REPLY (OF1.3):
master:
primary:
PACKET_IN: no_match action
PORT_STATUS: add delete modify
FLOW_REMOVED: idle hard delete group_delete
@@ -4959,7 +4959,7 @@ OFPT_GET_ASYNC_REPLY (OF1.3):
TABLE_STATUS: (off)
REQUESTFORWARD: (off)
slave:
secondary:
PACKET_IN: (off)
PORT_STATUS: add delete modify
FLOW_REMOVED: (off)

View File

@@ -562,12 +562,12 @@ between a switch and its controller.
.IP
When a switch has more than one controller configured, only the
traffic to and from a single controller is output. If none of the
controllers is configured as a master or a slave (using a Nicira
controllers is configured as a primary or a secondary (using a Nicira
extension to OpenFlow 1.0 or 1.1, or a standard request in OpenFlow
1.2 or later), then a controller is chosen arbitrarily among
them. If there is a master controller, it is chosen; otherwise, if
there are any controllers that are not masters or slaves, one is
chosen arbitrarily; otherwise, a slave controller is chosen
them. If there is a primary controller, it is chosen; otherwise, if
there are any controllers that are not primaries or secondaries, one is
chosen arbitrarily; otherwise, a secondary controller is chosen
arbitrarily. This choice is made once at connection time and does not
change as controllers reconfigure their roles.
.IP

View File

@@ -3017,10 +3017,10 @@ ofp12_controller_role_to_str(enum ofp12_controller_role role)
switch (role) {
case OFPCR12_ROLE_EQUAL:
return "other";
case OFPCR12_ROLE_MASTER:
return "master";
case OFPCR12_ROLE_SLAVE:
return "slave";
case OFPCR12_ROLE_PRIMARY:
return "primary";
case OFPCR12_ROLE_SECONDARY:
return "secondary";
case OFPCR12_ROLE_NOCHANGE:
default:
return NULL;

View File

@@ -5264,16 +5264,21 @@ ovs-vsctl add-port br0 p0 -- set Interface p0 type=patch options:peer=p1 \
<dt><code>other</code></dt>
<dd>Allows the controller access to all OpenFlow features.</dd>
<dt><code>master</code></dt>
<dd>Equivalent to <code>other</code>, except that there may be at
most one master controller at a time. When a controller configures
itself as <code>master</code>, any existing master is demoted to
the <code>slave</code> role.</dd>
<dd>
Equivalent to <code>other</code>, except that there may be at
most one such controller at a time. If a given controller
promotes itself to this role, <code>ovs-vswitchd</code>
demotes any existing controller with the role to <code>slave</code>.
</dd>
<dt><code>slave</code></dt>
<dd>Allows the controller read-only access to OpenFlow features.
Attempts to modify the flow table will be rejected with an
error. Slave controllers do not receive OFPT_PACKET_IN or
OFPT_FLOW_REMOVED messages, but they do receive OFPT_PORT_STATUS
messages.</dd>
<dd>
Allows the controller read-only access to OpenFlow features.
Attempts to modify the flow table will be rejected with an
error. Such controllers do not receive OFPT_PACKET_IN or
OFPT_FLOW_REMOVED messages, but they do receive OFPT_PORT_STATUS
messages.
</dd>
</dl>
</column>