From: Ethan Jackson Date: Fri, 10 Aug 2012 23:14:45 +0000 (-0700) Subject: cfm: Expose remote CFM opstate in the database. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c0333b6baf58cb382d78b53305bfb06149793e2;p=openvswitch cfm: Expose remote CFM opstate in the database. A controller may want to know the remote CFM opstate of a given CFM enabled interface. This patch makes this data available in the database. Signed-off-by: Ethan Jackson --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 5851dcd5..cf34e92d 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1315,6 +1315,14 @@ get_cfm_fault(const struct ofport *ofport_) return ofport->cfm ? cfm_get_fault(ofport->cfm) : -1; } +static int +get_cfm_opup(const struct ofport *ofport_) +{ + struct ofport_dpif *ofport = ofport_dpif_cast(ofport_); + + return ofport->cfm ? cfm_get_opup(ofport->cfm) : -1; +} + static int get_cfm_remote_mpids(const struct ofport *ofport_, const uint64_t **rmps, size_t *n_rmps) @@ -7173,6 +7181,7 @@ const struct ofproto_class ofproto_dpif_class = { set_sflow, set_cfm, get_cfm_fault, + get_cfm_opup, get_cfm_remote_mpids, get_cfm_health, set_stp, diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index f0d57ee0..15dc3472 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -1015,6 +1015,15 @@ struct ofproto_class { * not support CFM. */ int (*get_cfm_fault)(const struct ofport *ofport); + /* Check the operational status reported by the remote CFM endpoint of + * 'ofp_port' Returns 1 if operationally up, 0 if operationally down, and + * -1 if CFM is not enabled on 'ofp_port' or does not support operational + * status. + * + * This function may be a null pointer if the ofproto implementation does + * not support CFM. */ + int (*get_cfm_opup)(const struct ofport *ofport); + /* Gets the MPIDs of the remote maintenance points broadcasting to * 'ofport'. Populates 'rmps' with a provider owned array of MPIDs, and * 'n_rmps' with the number of MPIDs in 'rmps'. Returns a number less than diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 8c10f19a..5c9ab9d3 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2594,7 +2594,7 @@ ofproto_get_netflow_ids(const struct ofproto *ofproto, /* Checks the fault status of CFM for 'ofp_port' within 'ofproto'. Returns a * bitmask of 'cfm_fault_reason's to indicate a CFM fault (generally * indicating a connectivity problem). Returns zero if CFM is not faulted, - * and -1 if CFM is not enabled on 'port'. */ + * and -1 if CFM is not enabled on 'ofp_port'. */ int ofproto_port_get_cfm_fault(const struct ofproto *ofproto, uint16_t ofp_port) { @@ -2604,6 +2604,19 @@ ofproto_port_get_cfm_fault(const struct ofproto *ofproto, uint16_t ofp_port) : -1); } +/* Checks the operational status reported by the remote CFM endpoint of + * 'ofp_port' Returns 1 if operationally up, 0 if operationally down, and -1 + * if CFM is not enabled on 'ofp_port' or does not support operational status. + */ +int +ofproto_port_get_cfm_opup(const struct ofproto *ofproto, uint16_t ofp_port) +{ + struct ofport *ofport = ofproto_get_port(ofproto, ofp_port); + return (ofport && ofproto->ofproto_class->get_cfm_opup + ? ofproto->ofproto_class->get_cfm_opup(ofport) + : -1); +} + /* Gets the MPIDs of the remote maintenance points broadcasting to 'ofp_port' * within 'ofproto'. Populates 'rmps' with an array of MPIDs owned by * 'ofproto', and 'n_rmps' with the number of MPIDs in 'rmps'. Returns a diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index 0919d813..32a00f23 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -349,6 +349,7 @@ void ofproto_get_all_flows(struct ofproto *p, struct ds *); void ofproto_get_netflow_ids(const struct ofproto *, uint8_t *engine_type, uint8_t *engine_id); int ofproto_port_get_cfm_fault(const struct ofproto *, uint16_t ofp_port); +int ofproto_port_get_cfm_opup(const struct ofproto *, uint16_t ofp_port); int ofproto_port_get_cfm_remote_mpids(const struct ofproto *, uint16_t ofp_port, const uint64_t **rmps, size_t *n_rmps); diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 2c1142b2..9bafa66f 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1696,7 +1696,7 @@ static void iface_refresh_cfm_stats(struct iface *iface) { const struct ovsrec_interface *cfg = iface->cfg; - int fault, error; + int fault, opup, error; const uint64_t *rmps; size_t n_rmps; int health; @@ -1727,6 +1727,14 @@ iface_refresh_cfm_stats(struct iface *iface) ovsrec_interface_set_cfm_fault_status(cfg, NULL, 0); } + opup = ofproto_port_get_cfm_opup(iface->port->bridge->ofproto, + iface->ofp_port); + if (opup >= 0) { + ovsrec_interface_set_cfm_remote_opstate(cfg, opup ? "up" : "down"); + } else { + ovsrec_interface_set_cfm_remote_opstate(cfg, NULL); + } + error = ofproto_port_get_cfm_remote_mpids(iface->port->bridge->ofproto, iface->ofp_port, &rmps, &n_rmps); if (error >= 0) { diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema index 9712003a..bbfb01f2 100644 --- a/vswitchd/vswitch.ovsschema +++ b/vswitchd/vswitch.ovsschema @@ -1,6 +1,6 @@ {"name": "Open_vSwitch", - "version": "6.9.3", - "cksum": "2110020336 16754", + "version": "6.10.0", + "cksum": "3699312094 16958", "tables": { "Open_vSwitch": { "columns": { @@ -199,6 +199,11 @@ "type": { "key": "string", "min": 0, "max": "unlimited"}, "ephemeral": true}, + "cfm_remote_opstate": { + "type": {"key": {"type": "string", + "enum": ["set", ["up", "down"]]}, + "min": 0, "max": 1}, + "ephemeral": true}, "cfm_health": { "type": {"key": {"type": "integer", "minInteger": 0, diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 13d24b69..7b30ce8b 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1764,6 +1764,13 @@ frame having an invalid interval. + +

When in extended mode, indicates the operational state of the + remote endpoint as either up or down. See + . +

+
+

Indicates the health of the interface as a percentage of CCM frames