[ovs-dev] [tests+nxm-ofctl 08/42] ovs-openflowd: Add ability to run without connecting to controller.
Justin Pettit
jpettit at nicira.com
Thu Nov 25 01:32:23 UTC 2010
Looks good.
--Justin
On Nov 23, 2010, at 2:43 PM, Ben Pfaff wrote:
> This is useful for testing, for which we may want to simply use tools like
> ovs-ofctl without maintaining an active connection to a remote controller.
> ---
> utilities/ovs-openflowd.8.in | 5 +++++
> utilities/ovs-openflowd.c | 10 ++++++++--
> 2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/utilities/ovs-openflowd.8.in b/utilities/ovs-openflowd.8.in
> index 6084d46..7be7027 100644
> --- a/utilities/ovs-openflowd.8.in
> +++ b/utilities/ovs-openflowd.8.in
> @@ -30,6 +30,11 @@ OpenFlow controller or controllers. Each takes one of the following
> forms:
> .
> .so lib/vconn-active.man
> +.IP "\fBnone\fR"
> +Run without actively maintaining a connection to a remote OpenFlow
> +controller. (See the \fB\-\-listen\fR option, under \fBNetworking
> +Options\fR below, for another way to make OpenFlow connections to the
> +switch.)
> .
> .PP
> When multiple controllers are configured, \fBovs\-openflowd\fR
> diff --git a/utilities/ovs-openflowd.c b/utilities/ovs-openflowd.c
> index de959df..da84b25 100644
> --- a/utilities/ovs-openflowd.c
> +++ b/utilities/ovs-openflowd.c
> @@ -57,6 +57,7 @@ struct ofsettings {
> struct ofproto_controller *controllers;
> size_t n_controllers;
> enum ofproto_fail_mode fail_mode;
> + bool run_forever; /* Continue running even with no controller? */
>
> /* Datapath. */
> uint64_t datapath_id; /* Datapath ID. */
> @@ -155,7 +156,7 @@ main(int argc, char *argv[])
>
> daemonize_complete();
>
> - while (ofproto_is_alive(ofproto)) {
> + while (s.run_forever || ofproto_is_alive(ofproto)) {
> error = ofproto_run(ofproto);
> if (error) {
> ovs_fatal(error, "unrecoverable datapath error");
> @@ -459,12 +460,17 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
> dp_parse_name(argv[0], &s->dp_name, &s->dp_type);
>
> /* Figure out controller names. */
> + s->run_forever = false;
> if (!controllers.n) {
> svec_add_nocopy(&controllers, xasprintf("punix:%s/%s.mgmt",
> ovs_rundir(), s->dp_name));
> }
> for (i = 1; i < argc; i++) {
> - svec_add(&controllers, argv[i]);
> + if (!strcmp(argv[i], "none")) {
> + s->run_forever = true;
> + } else {
> + svec_add(&controllers, argv[i]);
> + }
> }
> if (argc < 2) {
> svec_add(&controllers, "discover");
> --
> 1.7.1
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
More information about the dev
mailing list