summaryrefslogtreecommitdiff
path: root/test-cli/test/helpers
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-09-15 16:29:14 +0200
committerHector Fernandez <hector@iatec.biz>2020-09-15 16:29:14 +0200
commit6550286c1f6ce5b1dbfc718b5566af3012ab538a (patch)
tree117467d2f4d5bd593d4bb29793e8935bf9547189 /test-cli/test/helpers
parent8765219910c95d0712ac0b2c27d33fd7a21fe3b8 (diff)
downloadboard-6550286c1f6ce5b1dbfc718b5566af3012ab538a.zip
board-6550286c1f6ce5b1dbfc718b5566af3012ab538a.tar.gz
board-6550286c1f6ce5b1dbfc718b5566af3012ab538a.tar.bz2
IGEP0048: PLC test: Variable IP of the connected PLC. Use discover before changing MAC address.
Diffstat (limited to 'test-cli/test/helpers')
-rw-r--r--test-cli/test/helpers/plc.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/test-cli/test/helpers/plc.py b/test-cli/test/helpers/plc.py
index c9ef774..069058d 100644
--- a/test-cli/test/helpers/plc.py
+++ b/test-cli/test/helpers/plc.py
@@ -6,6 +6,7 @@ from sh import Command
from test.helpers.gpio import gpio
import time
+
class dcpPLC(object):
__nReset = None
__Phy = None
@@ -40,7 +41,6 @@ class dcpPLC(object):
self.__nRest = gpio('69', 'out', '1')
self.__nRest = gpio('75', 'out', '1')
-
def SaveFirmware(self, firmare):
self.setSaveFirmwareMode()
try:
@@ -50,26 +50,33 @@ class dcpPLC(object):
return False, "plc flash firmware failed {} ".format(Error.exit_code)
return True, ''
- def set_plc (self, var, value, password):
+ def set_plc(self, var, value, password):
try:
res = self.__myConfigTool("-o", "SET", "-p", "{}={}".format(var, value), "-w", "{}".format(password))
print(res)
except ErrorReturnCode as Error:
- return False, "set var failed {} {}".format(var,Error.exit_code)
+ return False, "set var failed {} {}".format(var, Error.exit_code)
return True, ''
- def set_plc2 (self, var1, value1, var2, value2, password):
+ def set_plc2(self, var1, value1, var2, value2, password):
try:
- res = self.__myConfigTool("-o", "SET", "-p", "{}={}".format(var1, value1), "-p", "{}={}".format(var2, value2), "-w", "{}".format(password))
+ res = self.__myConfigTool("-o", "SET", "-p", "{}={}".format(var1, value1), "-p",
+ "{}={}".format(var2, value2), "-w", "{}".format(password))
print(res)
except ErrorReturnCode as Error:
return False, "set var failed {}".format(Error.exit_code)
return True, ''
-
- def get_plc (self, var, value, password):
+ def get_plc(self, var, value, password):
try:
self.__myConfigTool("-o", "GET", "-p", "{}".format(var), '{}'.format(value), "-w", "{}".format(password))
except ErrorReturnCode as Error:
- return False, "set var failed {} {}".format(var,Error.exit_code)
+ return False, "set var failed {} {}".format(var, Error.exit_code)
return True, ''
+
+ def discover(self):
+ try:
+ self.__myConfigTool("-o", "DISCOVER")
+ except ErrorReturnCode:
+ return False
+ return True