2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

cfm: Make argument to ovs-appctl "cfm/show" command optional.

If an argument isn't passed to "cfm/show", it will print information
about all interfaces with CFM enabled.
This commit is contained in:
Justin Pettit 2011-09-26 15:40:53 -07:00
parent 7ff2009a95
commit ae75dae345
3 changed files with 46 additions and 28 deletions

4
NEWS
View File

@ -5,7 +5,9 @@ Post-v1.2.0
NXM fields.
- Added an OpenFlow extension for flexible learning.
- ovs-appctl:
- New "version" command to determine version of running daemon
- New "version" command to determine version of running daemon.
- If no argument is provided for "cfm/show", displays detailed
information about all interfaces with CFM enabled.
- ovs-vswitchd:
- The software switch now supports 255 OpenFlow tables, instead
of just one. By default, only table 0 is consulted, but the

View File

@ -220,7 +220,8 @@ lookup_remote_mp(const struct cfm *cfm, uint64_t mpid)
void
cfm_init(void)
{
unixctl_command_register("cfm/show", "interface", cfm_unixctl_show, NULL);
unixctl_command_register("cfm/show", "[interface]", cfm_unixctl_show,
NULL);
}
/* Allocates a 'cfm' object called 'name'. 'cfm' should be initialized by
@ -516,37 +517,50 @@ cfm_find(const char *name)
return NULL;
}
static void
cfm_print_details(struct ds *ds, const struct cfm *cfm)
{
struct remote_mp *rmp;
ds_put_format(ds, "---- %s ----\n", cfm->name);
ds_put_format(ds, "MPID %"PRIu64":%s%s\n", cfm->mpid,
cfm->fault ? " fault" : "",
cfm->unexpected_recv ? " unexpected_recv" : "");
ds_put_format(ds, "\tinterval: %dms\n", cfm->ccm_interval_ms);
ds_put_format(ds, "\tnext CCM tx: %lldms\n",
timer_msecs_until_expired(&cfm->tx_timer));
ds_put_format(ds, "\tnext fault check: %lldms\n",
timer_msecs_until_expired(&cfm->fault_timer));
ds_put_cstr(ds, "\n");
HMAP_FOR_EACH (rmp, node, &cfm->remote_mps) {
ds_put_format(ds, "Remote MPID %"PRIu64":%s\n",
rmp->mpid,
rmp->rdi ? " rdi" : "");
ds_put_format(ds, "\trecv since check: %s",
rmp->recv ? "true" : "false");
}
}
static void
cfm_unixctl_show(struct unixctl_conn *conn,
const char *args, void *aux OVS_UNUSED)
{
struct ds ds = DS_EMPTY_INITIALIZER;
const struct cfm *cfm;
struct remote_mp *rmp;
cfm = cfm_find(args);
if (!cfm) {
unixctl_command_reply(conn, 501, "no such CFM object");
return;
}
ds_put_format(&ds, "MPID %"PRIu64":%s%s\n", cfm->mpid,
cfm->fault ? " fault" : "",
cfm->unexpected_recv ? " unexpected_recv" : "");
ds_put_format(&ds, "\tinterval: %dms\n", cfm->ccm_interval_ms);
ds_put_format(&ds, "\tnext CCM tx: %lldms\n",
timer_msecs_until_expired(&cfm->tx_timer));
ds_put_format(&ds, "\tnext fault check: %lldms\n",
timer_msecs_until_expired(&cfm->fault_timer));
ds_put_cstr(&ds, "\n");
HMAP_FOR_EACH (rmp, node, &cfm->remote_mps) {
ds_put_format(&ds, "Remote MPID %"PRIu64":%s\n",
rmp->mpid,
rmp->rdi ? " rdi" : "");
ds_put_format(&ds, "\trecv since check: %s",
rmp->recv ? "true" : "false");
if (strlen(args)) {
cfm = cfm_find(args);
if (!cfm) {
unixctl_command_reply(conn, 501, "no such CFM object");
return;
}
cfm_print_details(&ds, cfm);
} else {
HMAP_FOR_EACH (cfm, hmap_node, &all_cfms) {
cfm_print_details(&ds, cfm);
}
}
unixctl_command_reply(conn, 200, ds_cstr(&ds));

View File

@ -111,9 +111,11 @@ Causes \fBovs\-vswitchd\fR to gracefully terminate.
.IP "\fBqos/show\fR \fIinterface\fR"
Queries the kernel for Quality of Service configuration and statistics
associated with the given \fIinterface\fR.
.IP "\fBcfm/show\fR \fIinterface\fR"
.IP "\fBcfm/show\fR [\fIinterface\fR]"
Displays detailed information about Connectivity Fault Management
configured on \fIinterface\fR.
configured on \fIinterface\fR. If \fIinterface\fR is not specified,
then displays detailed information about all interfaces with CFM
enabled.
.SS "BRIDGE COMMANDS"
These commands manage bridges.
.IP "\fBfdb/show\fR \fIbridge\fR"