X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Ftest-unixctl.py;h=ab03479bea2412d3a2df47418753c7d895df95e7;hb=0ef165ecb57943e17a8ee8270df68ffb8d032e29;hp=cb9fed226d373b202dc1507e8bb790e0b794105a;hpb=0a68ffd2347e96447c5b4751c9e5ac65d5100a56;p=sliver-openvswitch.git diff --git a/tests/test-unixctl.py b/tests/test-unixctl.py index cb9fed226..ab03479be 100644 --- a/tests/test-unixctl.py +++ b/tests/test-unixctl.py @@ -1,4 +1,4 @@ -# Copyright (c) 2012 Nicira Networks. +# Copyright (c) 2012 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ import sys import ovs.daemon import ovs.unixctl +import ovs.unixctl.server vlog = ovs.vlog.Vlog("test-unixctl") exiting = False @@ -39,6 +40,15 @@ def unixctl_echo_error(conn, argv, aux): conn.reply_error(str(argv)) +def unixctl_log(conn, argv, unused_aux): + vlog.info(str(argv[0])) + conn.reply(None) + + +def unixctl_block(conn, unused_argv, unused_aux): + pass + + def main(): parser = argparse.ArgumentParser( description="Open vSwitch unixctl test program for Python") @@ -51,7 +61,7 @@ def main(): ovs.vlog.handle_args(args) ovs.daemon.daemonize_start() - error, server = ovs.unixctl.UnixctlServer.create(args.unixctl) + error, server = ovs.unixctl.server.UnixctlServer.create(args.unixctl) if error: ovs.util.ovs_fatal(error, "could not create unixctl server at %s" % args.unixctl, vlog) @@ -59,8 +69,10 @@ def main(): ovs.unixctl.command_register("exit", "", 0, 0, unixctl_exit, "aux_exit") ovs.unixctl.command_register("echo", "[arg ...]", 1, 2, unixctl_echo, "aux_echo") + ovs.unixctl.command_register("log", "[arg ...]", 1, 2, unixctl_log, None) ovs.unixctl.command_register("echo_error", "[arg ...]", 1, 2, unixctl_echo_error, "aux_echo_error") + ovs.unixctl.command_register("block", "", 0, 0, unixctl_block, None) ovs.daemon.daemonize_complete() vlog.info("Entering run loop.")