Refactored SAMPstartTemplate initial commit

Change-Id: I399aa1077d47b1f73c33624c88ecd36419060eb4

Changed connect function in the driver

Change-Id: If222a66b4ef403a5bc7690ab60994709e4e8c123
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index c2c011a..cea3eab 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -24,6 +24,7 @@
 import pexpect
 import re
 import sys
+import os
 sys.path.append( "../" )
 from drivers.common.cli.emulatordriver import Emulator
 
@@ -51,6 +52,22 @@
             vars( self )[ key ] = connectargs[ key ]
 
         self.name = self.options[ 'name' ]
+
+        try:
+            if os.getenv( str( self.ip_address ) ) != None:
+                self.ip_address = os.getenv( str( self.ip_address ) )
+            else:
+                main.log.info( self.name +
+                               ": Trying to connect to " +
+                               self.ip_address )
+
+        except KeyError:
+            main.log.info( "Invalid host name," +
+                           " connecting to local host instead" )
+            self.ip_address = 'localhost'
+        except Exception as inst:
+            main.log.error( "Uncaught exception: " + str( inst ) )
+
         self.handle = super(
             RemoteMininetDriver,
             self ).connect(