

def test_hosting_device_assign_to_cfg_agent_with_admin_state_down(self):
    self._setup_cfg_agents()
    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_device:
            hd = hosting_device['hosting_device']
            self.assertIsNone(hd['cfg_agent_id'])
            id_cfg_agent_disabled = self._agent_dict[L3_CFG_HOST_A]['id']
            self._update('agents', id_cfg_agent_disabled, {
                'agent': {
                    'admin_state_up': False,
                },
            })
            self._assign_hosting_device_to_cfg_agent(id_cfg_agent_disabled, hd['id'], exc.HTTPNotFound.code)
            hd_after = self._show('hosting_devices', hd['id'])['hosting_device']
            self.assertIsNone(hd_after['cfg_agent_id'])

dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/cisco/device_manager/test_hosting_device_cfg_agent_scheduler.py HostingDeviceConfigAgentSchedulerTestCase.test_hosting_device_assign_to_cfg_agent_with_admin_state_down/original