From 80459245f3285b6eac61f3b78506e07cb91652b7 Mon Sep 17 00:00:00 2001 From: Song GUO Date: Wed, 1 Sep 2021 07:02:12 +0800 Subject: [PATCH] [cirque] Enable TestResolve (#9321) --- src/controller/python/test/test_scripts/base.py | 11 +++++++++-- .../python/test/test_scripts/mobile-device-test.py | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/controller/python/test/test_scripts/base.py b/src/controller/python/test/test_scripts/base.py index 5afa974834dceb..397f9c9789834b 100644 --- a/src/controller/python/test/test_scripts/base.py +++ b/src/controller/python/test/test_scripts/base.py @@ -135,13 +135,20 @@ def TestOnOffCluster(self, nodeid: int, endpoint: int, group: int): return False return True - def TestResolve(self, fabricid, nodeid): + def TestResolve(self, nodeid): + fabricid = self.devCtrl.GetCompressedFabricId() self.logger.info( - "Resolve {} with fabric id: {}".format(nodeid, fabricid)) + "Resolve: node id = {:08x} (compressed) fabric id = {:08x}".format(nodeid, fabricid)) try: self.devCtrl.ResolveNode(fabricid=fabricid, nodeid=nodeid) + addr = self.devCtrl.GetAddressAndPort(nodeid) + if not addr: + return False + self.logger.info(f"Resolved address: {addr[0]}:{addr[1]}") + return True except Exception as ex: self.logger.exception("Failed to resolve. {}".format(ex)) + return False def TestReadBasicAttribiutes(self, nodeid: int, endpoint: int, group: int): basic_cluster_attrs = { diff --git a/src/controller/python/test/test_scripts/mobile-device-test.py b/src/controller/python/test/test_scripts/mobile-device-test.py index 8f34e37e7ef532..dfcaeeafcda8b7 100755 --- a/src/controller/python/test/test_scripts/mobile-device-test.py +++ b/src/controller/python/test/test_scripts/mobile-device-test.py @@ -111,6 +111,15 @@ def main(): logger.info("Testing closing sessions") FailIfNot(test.TestCloseSession(nodeid=1), "Failed to close sessions") + logger.info("Testing resolve") + FailIfNot(test.TestResolve(nodeid=1), + "Failed to resolve nodeid") + + logger.info("Testing on off cluster over resolved connection") + FailIfNot(test.TestOnOffCluster(nodeid=1, + endpoint=LIGHTING_ENDPOINT_ID, + group=GROUP_ID), "Failed to test on off cluster") + logger.info("Testing non-controller APIs") FailIfNot(test.TestNonControllerAPIs(), "Non controller API test failed")