usage(void)
{
printf("%s: OpenFlow controller\n"
- "usage: %s [OPTIONS] VCONN\n"
- "where VCONN is one of the following:\n"
- " ptcp:[PORT] listen to TCP PORT (default: %d)\n",
- program_name, program_name, OFP_TCP_PORT);
-#ifdef HAVE_NETLINK
- printf(" nl:DP_IDX via netlink to local datapath DP_IDX\n");
-#endif
-#ifdef HAVE_OPENSSL
- printf(" pssl:[PORT] listen for SSL on PORT (default: %d)\n"
- "\nPKI configuration (required to use SSL):\n"
- " -p, --private-key=FILE file with private key\n"
- " -c, --certificate=FILE file with certificate for private key\n"
- " -C, --ca-cert=FILE file with peer CA certificate\n",
- OFP_SSL_PORT);
-#endif
+ "usage: %s [OPTIONS] METHOD\n"
+ "where METHOD is any OpenFlow connection method.\n",
+ program_name, program_name);
+ vconn_usage(true, true);
printf("\nOther options:\n"
" -H, --hub act as hub instead of learning switch\n"
" -n, --noflow pass traffic, but don't add flows\n"
int connect_status;
};
+void vconn_usage(bool active, bool passive);
int vconn_open(const char *name, struct vconn **);
void vconn_close(struct vconn *);
bool vconn_is_passive(const struct vconn *);
#endif
}
+/* Prints information on active (if 'active') and passive (if 'passive')
+ * connection methods supported by the vconn. */
+void
+vconn_usage(bool active, bool passive)
+{
+ /* Really this should be implemented via callbacks into the vconn
+ * providers, but that seems too heavy-weight to bother with at the
+ * moment. */
+
+ printf("\n");
+ if (active) {
+ printf("Active OpenFlow connection methods:\n");
+#ifdef HAVE_NETLINK
+ printf(" nl:DP_IDX "
+ "local datapath DP_IDX\n");
+#endif
+ printf(" tcp:HOST[:PORT] "
+ "PORT (default: %d) on remote TCP HOST\n", OFP_TCP_PORT);
+#ifdef HAVE_OPENSSL
+ printf(" ssl:HOST[:PORT] "
+ "SSL PORT (default: %d) on remote HOST\n", OFP_SSL_PORT);
+#endif
+ }
+
+ if (passive) {
+ printf("Passive OpenFlow connection methods:\n");
+ printf(" ptcp:[PORT] "
+ "listen to TCP PORT (default: %d)\n",
+ OFP_TCP_PORT);
+#ifdef HAVE_OPENSSL
+ printf(" pssl:[PORT] "
+ "listen for SSL on PORT (default: %d)\n",
+ OFP_SSL_PORT);
+#endif
+ }
+
+#ifdef HAVE_OPENSSL
+ printf("PKI configuration (required to use SSL):\n"
+ " -p, --private-key=FILE file with private key\n"
+ " -c, --certificate=FILE file with certificate for private key\n"
+ " -C, --ca-cert=FILE file with peer CA certificate\n");
+#endif
+}
+
/* Attempts to connect to an OpenFlow device. 'name' is a connection name in
* the form "TYPE:ARGS", where TYPE is the vconn class's name and ARGS are
* vconn class-specific.
static void
usage(void)
{
- printf("%s: Secure Channel\n"
+ printf("%s: Secure Channel, a relay for OpenFlow messages.\n"
"usage: %s [OPTIONS] LOCAL REMOTE\n"
- "\nRelays OpenFlow message between LOCAL and REMOTE datapaths.\n"
- "LOCAL and REMOTE must each be one of the following:\n"
- " tcp:HOST[:PORT] PORT (default: %d) on remote TCP HOST\n",
- program_name, program_name, OFP_TCP_PORT);
-#ifdef HAVE_NETLINK
- printf(" nl:DP_IDX local datapath DP_IDX\n");
-#endif
-#ifdef HAVE_OPENSSL
- printf(" ssl:HOST[:PORT] SSL PORT (default: %d) on remote HOST\n"
- "\nPKI configuration (required to use SSL):\n"
- " -p, --private-key=FILE file with private key\n"
- " -c, --certificate=FILE file with certificate for private key\n"
- " -C, --ca-cert=FILE file with peer CA certificate\n",
- OFP_SSL_PORT);
-#endif
+ "where LOCAL and REMOTE are active OpenFlow connection methods.\n",
+ program_name, program_name);
+ vconn_usage(true, true);
printf("\nNetworking options:\n"
- " -l, --listen=VCONN allow management connections on VCONN:\n"
- " ptcp:[PORT] TCP PORT (default: %d)\n",
- OFP_TCP_PORT);
-#ifdef HAVE_OPENSSL
- printf(" pssl:[PORT] SSL PORT (default: %d)\n",
- OFP_SSL_PORT);
-#endif
- printf("\nOther options:\n"
+ " -l, --listen=METHOD allow management connections on METHOD\n"
+ " (a passive OpenFlow connection method)\n"
+ "\nOther options:\n"
" -v, --verbose set maximum verbosity level\n"
" -h, --help display this help message\n"
" -V, --version display version information\n");
{
printf("%s: userspace OpenFlow switch\n"
"usage: %s [OPTIONS] CONTROLLER\n"
- "CONTROLLER must be one of the following:\n"
- " tcp:HOST[:PORT] PORT (default: %d) on remote TCP HOST\n",
- program_name, program_name, OFP_TCP_PORT);
-#ifdef HAVE_OPENSSL
- printf(" ssl:HOST[:PORT] SSL PORT (default: %d) on remote HOST\n"
- "\nPKI configuration (required to use SSL):\n"
- " -p, --private-key=FILE file with private key\n"
- " -c, --certificate=FILE file with certificate for private key\n"
- " -C, --ca-cert=FILE file with peer CA certificate\n",
- OFP_SSL_PORT);
-#endif
- printf("Options:\n"
+ "where CONTROLLER is an active OpenFlow connection method.\n",
+ program_name, program_name);
+ vconn_usage(true, false);
+ printf("\nOptions:\n"
" -i, --interfaces=NETDEV[,NETDEV]...\n"
" add specified initial switch ports\n"
" -d, --datapath-id=ID Use ID as the OpenFlow switch ID\n"
" delif nl:DP_ID IFACE delete IFACE as a port on DP_ID\n"
" benchmark-nl nl:DP_ID N SIZE send N packets of SIZE bytes\n"
#endif
- "\nCommands that also apply to remote switches:\n"
- " show VCONN show information about VCONN\n"
- " monitor VCONN print packets received on VCONN\n"
- " dump-tables VCONN print table stats for VCONN\n"
- " dump-flows VCONN T_ID print all flow entries in table T_ID of VCONN\n"
- " dump-flows VCONN T_ID FLOW print matching FLOWs in table T_ID of VCONN\n"
- " add-flows VCONN FILE add flows from FILE to VCONN\n"
- "where each VCONN is one of the following:\n"
- " tcp:HOST[:PORT] PORT (default: %d) on remote TCP HOST\n",
- program_name, program_name, OFP_TCP_PORT);
-#ifdef HAVE_NETLINK
- printf(" nl:DP_IDX via netlink to local datapath DP_IDX\n");
-#endif
-#ifdef HAVE_OPENSSL
- printf(" ssl:HOST[:PORT] SSL PORT (default: %d) on remote HOST\n"
- "\nPKI configuration (required to use SSL):\n"
- " -p, --private-key=FILE file with private key\n"
- " -c, --certificate=FILE file with certificate for private key\n"
- " -C, --ca-cert=FILE file with peer CA certificate\n",
- OFP_SSL_PORT);
-#endif
+ "\nCommands that apply to local datapaths and remote switches:\n"
+ " show METHOD show information about METHOD\n"
+ " monitor METHOD print packets received on METHOD\n"
+ " dump-tables METHOD print table stats for METHOD\n"
+ " dump-flows METHOD T_ID print all flow entries in table T_ID of METHOD\n"
+ " dump-flows METHOD T_ID FLOW print matching FLOWs in table T_ID of METHOD\n"
+ " add-flows METHOD FILE add flows from FILE to METHOD\n"
+ "where each METHOD is an active OpenFlow connection method.\n",
+ program_name, program_name);
+ vconn_usage(true, false);
printf("\nOptions:\n"
" -v, --verbose set maximum verbosity level\n"
" -h, --help display this help message\n"