

def test_list_hosting_devices_by_cfg_agent(self):
    self._setup_cfg_agents(True, True)
    with self.hosting_device_template(host_category=self.host_category) as hosting_device_template:
        hdt = hosting_device_template['hosting_device_template']
        with self.hosting_device(template_id=hdt['id']) as hosting_device1, self.hosting_device(template_id=hdt['id']) as hosting_device2, self.hosting_device(template_id=hdt['id']) as hosting_device3:
            hd1 = hosting_device1['hosting_device']
            hd2 = hosting_device2['hosting_device']
            hd3 = hosting_device3['hosting_device']
            cfg_agent1_id = self._agent_dict[L3_CFG_HOST_A]['id']
            self._assign_hosting_device_to_cfg_agent(cfg_agent1_id, hd1['id'])
            self._assign_hosting_device_to_cfg_agent(cfg_agent1_id, hd2['id'])
            cfg_agent2_id = self._agent_dict[L3_CFG_HOST_B]['id']
            self._assign_hosting_device_to_cfg_agent(cfg_agent2_id, hd3['id'])
            hd_list1 = self._list_hosting_devices_handled_by_cfg_agent(cfg_agent1_id)
            self.assertEqual(2, len(hd_list1['hosting_devices']))
            hd1_set = {hd1['id'], hd2['id']}
            for hd in hd_list1['hosting_devices']:
                hosting_device_template.assertTrue((hd['id'] in hd1_set))
            hd_list2 = self._list_hosting_devices_handled_by_cfg_agent(cfg_agent2_id)
            self.assertEqual(1, len(hd_list2['hosting_devices']))
            self.assertEqual(hd3['id'], hd_list2['hosting_devices'][0]['id'])

dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/cisco/device_manager/test_hosting_device_cfg_agent_scheduler.py HostingDeviceConfigAgentSchedulerTestCase.test_list_hosting_devices_by_cfg_agent/VarMisuse@216/417 `self`->`hosting_device_template`