summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-03-28 19:20:59 +0800
committerYun Huang <yun.huang@windriver.com>2018-03-28 19:20:59 +0800
commit64b74b43ed6a82b88dbe6efc04f2cac9477288a1 (patch)
tree51b3485d0d932475a89e7e9009c8c4267dad81f7
parentff22bc4df611031244eee04560a2b7f9272c6cfe (diff)
ocata test_register_hpa_numa_successfully
Change-Id: I0e19f41161481a328e3f16454249a068e43fc7d2 Issue-ID: MULTICLOUD-206 Signed-off-by: Yun Huang <yun.huang@windriver.com>
-rw-r--r--ocata/ocata/registration/tests/test_registration.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/ocata/ocata/registration/tests/test_registration.py b/ocata/ocata/registration/tests/test_registration.py
index fa920cd4..8dd28382 100644
--- a/ocata/ocata/registration/tests/test_registration.py
+++ b/ocata/ocata/registration/tests/test_registration.py
@@ -182,6 +182,20 @@ MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS3_RESPONSE = {
}
}
+# HPA UT4: numa_nodes
+MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS4_RESPONSE = {
+ "extra_specs": {
+ "aggregate_instance_extra_specs:storage": "local_image",
+ "capabilities:cpu_info:model": "Haswell",
+ "hw:numa_nodes": "2",
+ "hw:numa_cpus.0": "0,1",
+ "hw:numa_cpus.1": "2,3,4,5",
+ "hw:numa_mem.0": "2048",
+ "hw:numa_mem.1": "2048"
+ }
+}
+
+
MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS_RESPONSE = {
"extra_specs": {
"aggregate_instance_extra_specs:storage": "local_image",
@@ -353,3 +367,33 @@ class TestRegistration(test_base.TestRequest):
self.assertEquals(status.HTTP_202_ACCEPTED,
response.status_code)
+ @mock.patch.object(VimDriverUtils, 'get_session')
+ @mock.patch.object(VimDriverUtils, 'get_vim_info')
+ def test_register_hpa_numa_successfully(
+ self, mock_get_vim_info, mock_get_session):
+ restcall.req_to_aai = mock.Mock()
+ restcall.req_to_aai.return_value = (0, {}, status.HTTP_200_OK)
+ mock_get_vim_info.return_value = mock_info.MOCK_VIM_INFO
+ mock_get_session.return_value = test_base.get_mock_session(
+ ["get"], {
+ "side_effect": [
+ self._get_mock_response(MOCK_GET_TENANT_RESPONSE),
+ self._get_mock_response(MOCK_GET_HPA_FLAVOR_LIST1_RESPONSE),
+ self._get_mock_response(MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS4_RESPONSE),
+ self._get_mock_response(MOCK_GET_IMAGE_RESPONSE),
+ self._get_mock_response(),
+ self._get_mock_response(MOCK_GET_AZ_RESPONSE),
+ self._get_mock_response(MOCK_HYPERVISOR_RESPONSE),
+ self._get_mock_response(MOCK_GET_SNAPSHOT_RESPONSE),
+ self._get_mock_response(MOCK_GET_HYPERVISOR_RESPONSE)
+ ]
+ })
+
+ response = self.client.post((
+ "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/"
+ "registry"), TEST_REGISTER_ENDPOINT_REQUEST,
+ HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
+
+ self.assertEquals(status.HTTP_202_ACCEPTED,
+ response.status_code)
+