delete invalid test file and cyborg api service

delete testcase file and remove move api service for the non venus
project

Change-Id: I023ace7b6ae7992847fefc0f0a1418e79adca6b4
This commit is contained in:
wangzhiguang 2023-03-20 16:22:28 +08:00
parent b4cf79f2b1
commit e8103d8645
4 changed files with 0 additions and 181 deletions

View File

@ -1,8 +0,0 @@
NORMAL_DEVICE_PROFILE_DATA1 = [{
"name": "fpga-num-1-dp1",
"groups": [
{
"resources:FPGA": "1",
"trait:CUSTOM_FAKE_DEVICE": "required"
}]
}]

View File

@ -27,47 +27,12 @@ LOG = logging.getLogger(__name__)
class VenusRestClient(rest_client.RestClient):
"""Client class for accessing the venus API."""
DP_URL = '/device_profiles'
def _response_helper(self, resp, body=None):
if body:
body = json.loads(body)
return rest_client.ResponseBody(resp, body)
def create_device_profile(self, body):
body = json.dump_as_bytes(body)
resp, body = self.post(self.DP_URL, body=body)
return self._response_helper(resp, body)
def delete_device_profile(self, name):
url = self.DP_URL + "/" + name
resp, body = self.delete(url)
return self._response_helper(resp, body)
def list_device_profile(self):
resp, body = self.get(self.DP_URL)
return self._response_helper(resp, body)
def delete_multiple_device_profile_by_names(self, *device_profile_names):
names = ','.join(device_profile_names)
url = self.DP_URL + "?value=" + names
resp, body = self.delete(url)
return self._response_helper(resp, body)
def list_devices(self):
resp, body = self.get("/devices")
return self._response_helper(resp, body)
def get_device_profile(self, device_profile_uuid):
url = self.DP_URL + "/" + device_profile_uuid
resp, body = self.get(url)
return self._response_helper(resp, body)
def delete_device_profile_by_uuid(self, device_profile_uuid):
url = self.DP_URL + "/" + device_profile_uuid
resp, body = self.delete(url)
return self._response_helper(resp, body)
def get_auth_provider(credentials, scope='project'):
default_params = {

View File

@ -1,29 +0,0 @@
# Copyright 2020 Inspur, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from venus_tempest_plugin.tests.api import base
class TestDevice(base.BaseAPITest):
credentials = ['admin']
def test_list_device(self):
response = self.os_admin.venus_client.list_devices()
self.assertEqual('devices', list(response.keys())[0])
@classmethod
def resource_cleanup(cls):
super(TestDevice, cls).resource_cleanup()

View File

@ -1,109 +0,0 @@
# Copyright 2019 Intel, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from venus_tempest_plugin.services import venus_data
from venus_tempest_plugin.tests.api import base
class TestDeviceProfileController(base.BaseAPITest):
credentials = ['admin']
def test_create_device_profile(self):
dp = venus_data.NORMAL_DEVICE_PROFILE_DATA1
response = self.os_admin.venus_client.create_device_profile(dp)
self.assertEqual(dp[0]['name'], response['name'])
self.addCleanup(self.os_admin.venus_client.delete_device_profile,
dp[0]['name'])
def test_delete_multiple_device_profile(self):
dp_one = [{
"name": "afaas_example_1",
"groups": [
{"resources:FPGA": "1",
"trait:CUSTOM_FPGA_1": "required",
"trait:CUSTOM_FUNCTION_ID_3AFB": "required",
}
]
}]
dp_two = [{
"name": "afaas_example_2",
"groups": [
{"resources:FPGA": "1",
"trait:CUSTOM_FPGA_1": "required",
"trait:CUSTOM_FUNCTION_ID_3AFB": "required",
}
]
}]
self.os_admin.venus_client.create_device_profile(dp_one)
self.os_admin.venus_client.create_device_profile(dp_two)
self.os_admin.venus_client.delete_multiple_device_profile_by_names(
dp_one[0]['name'], dp_two[0]['name'])
def test_get_and_delete_device_profile(self):
dp = [{
"name": "afaas_example_2",
"groups": [
{"resources:FPGA": "1",
"trait:CUSTOM_FPGA_1": "required",
"trait:CUSTOM_FUNCTION_ID_3AFB": "required",
}
]
}]
response = self.os_admin.venus_client.create_device_profile(dp)
device_profile_uuid = response['uuid']
self.assertEqual(dp[0]['name'], response['name'])
self.assertEqual(dp[0]['groups'], response['groups'])
response = self.os_admin.venus_client.list_device_profile()
device_profile_list = response['device_profiles']
device_profile_uuid_list = [it['uuid'] for it in device_profile_list]
self.assertIn(device_profile_uuid, device_profile_uuid_list)
response = self.os_admin.venus_client.get_device_profile(
device_profile_uuid)
self.assertEqual(dp[0]['name'], response['name'])
self.assertEqual(
device_profile_uuid,
response['uuid'])
self.os_admin.venus_client.delete_device_profile_by_uuid(
device_profile_uuid)
response = self.os_admin.venus_client.list_device_profile()
device_profile_list = response['device_profiles']
device_profile_uuid_list = [it['uuid'] for it in device_profile_list]
self.assertNotIn(device_profile_uuid, device_profile_uuid_list)
def test_delete_single_device_profile_by_name(self):
dp = [{
"name": "afaas_example_1",
"groups": [
{"resources:FPGA": "1",
"trait:CUSTOM_FPGA_1": "required",
"trait:CUSTOM_FUNCTION_ID_3AFB": "required",
}
]
}]
self.os_admin.venus_client.create_device_profile(dp)
self.os_admin.venus_client.delete_device_profile(dp[0]['name'])
list_resp = self.os_admin.venus_client.list_device_profile()
device_profile_list = list_resp['device_profiles']
device_profile_name_list = [it['name'] for it in device_profile_list]
self.assertNotIn(dp[0]['name'], device_profile_name_list)
@classmethod
def resource_cleanup(cls):
super(TestDeviceProfileController, cls).resource_cleanup()