3 Copyright (c) 2021 Project CHIP Authors
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
23 from helper.CHIPTestBase import CHIPVirtualHome
25 logger = logging.getLogger('CHIPInteractionModelTest')
26 logger.setLevel(logging.INFO)
28 sh = logging.StreamHandler()
31 '%(asctime)s [%(name)s] %(levelname)s %(message)s'))
36 'type': 'CHIP-IM-Initiator',
37 'base_image': 'chip_im_initiator',
38 'capability': ['Thread', 'Interactive'],
42 'type': 'CHIP-IM-Responder',
43 'base_image': 'chip_im_responder',
44 'capability': ['Thread', 'Interactive'],
51 CIRQUE_URL = "http://localhost:5000"
54 class TestInteractionModel(CHIPVirtualHome):
55 def __init__(self, device_config):
56 super().__init__(CIRQUE_URL, device_config)
60 self.initialize_home()
61 self.connect_to_thread_network()
63 def test_routine(self):
64 self.run_data_model_test()
66 def run_data_model_test(self):
67 resp_ips = [device['description']['ipv4_addr'] for device in self.non_ap_devices
68 if device['type'] == 'CHIP-IM-Responder']
69 req_ids = [device['id'] for device in self.non_ap_devices
70 if device['type'] == 'CHIP-IM-Initiator']
72 req_device_id = req_ids[0]
74 command = "chip-im-initiator {}"
77 ret = self.execute_device_cmd(
78 req_device_id, command.format(ip))
80 ret['return_code'], '0', "{} failure: {}".format("IM", ret['output']))
83 if __name__ == "__main__":
84 sys.exit(TestInteractionModel(DEVICE_CONFIG).run_test())