Add HApowerFailure test

This requires at least one patch to ONOS for the `onos-power` script to
support non-default cell usernames and another patch to the onos warden
to allow multiple node failures.

Also included:
- logging changes to help debug multithreadded sections of the test.
- Some input validation in functions that don't directly call the cli
- Remove some verbose logging
- Distribute some onos commands amongst the active nodes
- Refactor out clearing the ONOS cli pexpect buffer before sending a
  command into it's own function

Change-Id: If1b868b399878209ab0394956f3b3918c0176909
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 43352c5..0b34df4 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -520,3 +520,37 @@
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
             main.cleanAndExit()
+
+    def setEnv( self, variable, value=None ):
+        """
+        Sets the environment variable to the given value for the current shell session.
+        If value is None, will unset the variable.
+
+        Required Arguments:
+        variable - The name of the environment variable to set.
+
+        Optional Arguments:
+        value - The value to set the variable to. ( Defaults to None, which unsets the variable )
+
+        Returns True if no errors are detected else returns False
+        """
+        try:
+            if value:
+                cmd = "export {}={}".format( variable, value )
+            else:
+                cmd = "unset {}".format( variable )
+            self.handle.sendline( cmd )
+            self.handle.expect( self.prompt )
+            main.log.debug( self.handle.before )
+            return True
+        except AssertionError:
+            main.log.error( self.name + ": Could not execute command: " + output )
+            return False
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": TIMEOUT exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            return False
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanAndExit()