Support active connect, overwrite log

Added options:
  --switch-ip   If set, actively connect to this switch on controller-port
  --log-append  Append to existing log

The default log file generation behavior has changed.  By default, now
over-write the existing log.  To have the old append behavior, use the
--log-append option.

Active switch connections have been tested, but not exhaustively.  It
shold still be considered experimental.  The old behavior (listen for
switch connections) should be unchanged.
diff --git a/oft b/oft
index 9e92a99..562a670 100755
--- a/oft
+++ b/oft
@@ -153,11 +153,13 @@
     "param"              : None,
     "platform"           : "local",
     "platform_args"      : None,
-    "controller_host"    : "0.0.0.0",
+    "switch_ip"          : None,  # If not none, actively connect to switch
+    "controller_host"    : "0.0.0.0",  # For passive bind
     "controller_port"    : 6633,
     "relax"              : False,
     "test_spec"          : "all",
     "log_file"           : "oft.log",
+    "log_append"         : False,
     "list"               : False,
     "list_test_names"    : False, 
     "debug"              : _debug_default,
@@ -225,6 +227,8 @@
     parser.add_option("-P", "--platform", help=plat_help)
     parser.add_option("-H", "--host", dest="controller_host",
                       help="The IP/name of the test controller host")
+    parser.add_option("-S", "--switch-ip", dest="switch_ip",
+                      help="If set, actively connect to this switch by IP")
     parser.add_option("-p", "--port", dest="controller_port",
                       type="int", help="Port number of the test controller")
     test_list_help = """Indicate tests to run.  Valid entries are "all" (the
@@ -236,6 +240,8 @@
     parser.add_option("-T", "--test-spec", "--test-list", help=test_list_help)
     parser.add_option("--log-file", 
                       help="Name of log file, empty string to log to console")
+    parser.add_option("--log-append", action="store_true",
+                      help="Do not delete log file if specified")
     parser.add_option("--debug",
                       help="Debug lvl: debug, info, warning, error, critical")
     parser.add_option("--port-count", type="int",
@@ -312,7 +318,9 @@
     """
     _format = "%(asctime)s  %(name)-10s: %(levelname)-8s: %(message)s"
     _datefmt = "%H:%M:%S"
+    _mode = config["log_append"] and "a" or "w"
     logging.basicConfig(filename=config["log_file"],
+                        filemode=_mode,
                         level=config["dbg_level"],
                         format=_format, datefmt=_datefmt)