

def _create_hosting_device(self, fmt, template_id, management_port_id, admin_state_up, expected_res_status=None, **kwargs):
    data = {
        'hosting_device': self._get_test_hosting_device_attr(template_id=template_id, management_port_id=management_port_id, admin_state_up=admin_state_up, **kwargs),
    }
    hd_req = self.new_create_request('hosting_devices', data, fmt)
    if (kwargs.get('set_context') and ('tenant_id' in kwargs)):
        hd_req.environ['neutron.context'] = n_context.Context('', kwargs['tenant_id'])
    hd_res = hd_req.get_response(self.ext_api)
    if expected_res_status:
        self.assertEqual(expected_res_status, hd_res.status_int)
    return hd_res

dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/cisco/device_manager/test_db_device_manager.py DeviceManagerTestCaseMixin._create_hosting_device/original