[cert] THCI: enhance firmware validation (#2797)
diff --git a/tools/harness-thci/OpenThread.py b/tools/harness-thci/OpenThread.py
index 0f4e153..c4a7697 100644
--- a/tools/harness-thci/OpenThread.py
+++ b/tools/harness-thci/OpenThread.py
@@ -53,6 +53,10 @@
LOWEST_POSSIBLE_PARTATION_ID = 0x1
LINK_QUALITY_CHANGE_TIME = 100
+ # Used for reference firmware version control for Test Harness.
+ # This variable will be updated to match the OpenThread reference firmware officially released.
+ firmwarePrefix = "OPENTHREAD/201806"
+
#def __init__(self, SerialPort=COMPortName, EUI=MAC_Address):
def __init__(self, **kwargs):
"""initialize the serial port and default network parameters
@@ -647,9 +651,17 @@
"""initialize the serial port with baudrate, timeout parameters"""
print '%s call intialize' % self.port
try:
+ self.deviceConnected = False
+
# init serial port
self._connect()
- self.deviceConnected = True
+
+ if self.firmwarePrefix in self.UIStatusMsg:
+ self.deviceConnected = True
+ else:
+ self.UIStatusMsg = "Firmware Not Matching Expecting " + self.firmwarePrefix + " Now is " + self.UIStatusMsg
+ ModuleHelper.WriteIntoDebugLogger("Err: OpenThread device Firmware not matching..")
+
except Exception, e:
ModuleHelper.WriteIntoDebugLogger("intialize() Error: " + str(e))
self.deviceConnected = False