From 9d9d588e5bdf813c30e2f0904fa33bd34b4a4943 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 11:15:33 +0800 Subject: Add test_get_hpa_hugepage_large Add test_get_hpa_hugepage_large Change-Id: I0a7c7015d9cacb0b71a13b1aa6df5d4bc6455d60 Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_aai_client.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vio/vio/tests/test_aai_client.py b/vio/vio/tests/test_aai_client.py index ea333d1..6be9958 100644 --- a/vio/vio/tests/test_aai_client.py +++ b/vio/vio/tests/test_aai_client.py @@ -296,3 +296,12 @@ class TestAAIClient(unittest.TestCase): } ret = self.view._get_cputopology_capabilities(extra) self.assertEqual(len(ret["hpa-feature-attributes"]), 3) + + @mock.patch.object(restcall, "call_req") + def test_get_hpa_hugepage_large(self, mock_call): + extra = { + "hw:mem_page_size": "large" + } + ret = self.view._get_hugepages_capabilities(extra) + self.assertIn( + "2", ret["hpa-feature-attributes"][0]["hpa-attribute-value"]) -- cgit 1.2.3-korg From 44d09edbc140b202c34bcba850f190b0e3c379c4 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 11:16:23 +0800 Subject: Add test_get_hpa_hugepage_small Add test_get_hpa_hugepage_small Change-Id: I9404f755eee53b614a61e5d31ce87ca54ace9f59 Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_aai_client.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vio/vio/tests/test_aai_client.py b/vio/vio/tests/test_aai_client.py index 6be9958..abf7618 100644 --- a/vio/vio/tests/test_aai_client.py +++ b/vio/vio/tests/test_aai_client.py @@ -305,3 +305,12 @@ class TestAAIClient(unittest.TestCase): ret = self.view._get_hugepages_capabilities(extra) self.assertIn( "2", ret["hpa-feature-attributes"][0]["hpa-attribute-value"]) + + @mock.patch.object(restcall, "call_req") + def test_get_hpa_hugepage_small(self, mock_call): + extra = { + "hw:mem_page_size": "small" + } + ret = self.view._get_hugepages_capabilities(extra) + self.assertIn( + "4", ret["hpa-feature-attributes"][0]["hpa-attribute-value"]) -- cgit 1.2.3-korg From c958a4ab2fb579e44766f67d4a7cef9e4596cf3c Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 11:17:42 +0800 Subject: Add test_get_hpa_hugepage_int Add test_get_hpa_hugepage_int Change-Id: Iba00a75d0fb91bf80065919e4f18c4c28f8f83d5 Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_aai_client.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vio/vio/tests/test_aai_client.py b/vio/vio/tests/test_aai_client.py index abf7618..7837e2d 100644 --- a/vio/vio/tests/test_aai_client.py +++ b/vio/vio/tests/test_aai_client.py @@ -314,3 +314,12 @@ class TestAAIClient(unittest.TestCase): ret = self.view._get_hugepages_capabilities(extra) self.assertIn( "4", ret["hpa-feature-attributes"][0]["hpa-attribute-value"]) + + @mock.patch.object(restcall, "call_req") + def test_get_hpa_hugepage_int(self, mock_call): + extra = { + "hw:mem_page_size": 8, + } + ret = self.view._get_hugepages_capabilities(extra) + self.assertIn( + "8", ret["hpa-feature-attributes"][0]["hpa-attribute-value"]) -- cgit 1.2.3-korg From 157d04a2c21145ff0b167d1e86847eb43e2432e4 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 11:19:08 +0800 Subject: Add test_get_hpa_hugepage_any Add test_get_hpa_hugepage_any Change-Id: I91e92f1a4e855912bb144c0316187a6c7dae71c7 Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_aai_client.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vio/vio/tests/test_aai_client.py b/vio/vio/tests/test_aai_client.py index 7837e2d..364caca 100644 --- a/vio/vio/tests/test_aai_client.py +++ b/vio/vio/tests/test_aai_client.py @@ -323,3 +323,11 @@ class TestAAIClient(unittest.TestCase): ret = self.view._get_hugepages_capabilities(extra) self.assertIn( "8", ret["hpa-feature-attributes"][0]["hpa-attribute-value"]) + + @mock.patch.object(restcall, "call_req") + def test_get_hpa_hugepage_any(self, mock_call): + extra = { + "hw:mem_page_size": "any", + } + ret = self.view._get_hugepages_capabilities(extra) + self.assertEqual(0, len(ret["hpa-feature-attributes"])) -- cgit 1.2.3-korg From 4a295b7b7c57b8657c657adf6e2658e9a8fd08e3 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 11:23:18 +0800 Subject: Add test_get_hpa_numa Add test_get_hpa_numa Change-Id: I4dfee677b36599de305fa291f1c5fb1826ec2d36 Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_aai_client.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vio/vio/tests/test_aai_client.py b/vio/vio/tests/test_aai_client.py index 364caca..b6caca4 100644 --- a/vio/vio/tests/test_aai_client.py +++ b/vio/vio/tests/test_aai_client.py @@ -331,3 +331,13 @@ class TestAAIClient(unittest.TestCase): } ret = self.view._get_hugepages_capabilities(extra) self.assertEqual(0, len(ret["hpa-feature-attributes"])) + + @mock.patch.object(restcall, "call_req") + def test_get_hpa_numa(self, mock_call): + extra = { + "hw:numa_nodes": 1, + "hw:numa_cpus.0": 1, + "hw:numa_mem.0": 1024, + } + ret = self.view._get_numa_capabilities(extra) + self.assertEqual(3, len(ret["hpa-feature-attributes"])) -- cgit 1.2.3-korg From bd679bf0f00b3b8842fe03d348e1b00694039a3d Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 11:24:44 +0800 Subject: Add test_get_hpa_storage Add test_get_hpa_storage Change-Id: I2dad04eefa549cd1c3b62141a915ffe6658317ab Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_aai_client.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vio/vio/tests/test_aai_client.py b/vio/vio/tests/test_aai_client.py index b6caca4..c32f10d 100644 --- a/vio/vio/tests/test_aai_client.py +++ b/vio/vio/tests/test_aai_client.py @@ -341,3 +341,11 @@ class TestAAIClient(unittest.TestCase): } ret = self.view._get_numa_capabilities(extra) self.assertEqual(3, len(ret["hpa-feature-attributes"])) + + @mock.patch.object(restcall, "call_req") + def test_get_hpa_storage(self, mock_call): + extra = { + "disk": 10, + } + ret = self.view._get_storage_capabilities(extra) + self.assertEqual(3, len(ret["hpa-feature-attributes"])) -- cgit 1.2.3-korg From 0978a4023edea25dc89e0557e3044c2e72b7fe4e Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 11:27:13 +0800 Subject: Add test_get_hpa_instru Add test_get_hpa_instru Change-Id: Ie13dbadfdb02d352a91eec8b944eee6f4376758b Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_aai_client.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vio/vio/tests/test_aai_client.py b/vio/vio/tests/test_aai_client.py index c32f10d..1381a3f 100644 --- a/vio/vio/tests/test_aai_client.py +++ b/vio/vio/tests/test_aai_client.py @@ -349,3 +349,11 @@ class TestAAIClient(unittest.TestCase): } ret = self.view._get_storage_capabilities(extra) self.assertEqual(3, len(ret["hpa-feature-attributes"])) + + @mock.patch.object(restcall, "call_req") + def test_get_hpa_instru(self, mock_call): + extra = { + "hw:capabilities:cpu_info:features": "avx", + } + ret = self.view._get_instruction_set_capabilities(extra) + self.assertEqual(1, len(ret["hpa-feature-attributes"])) -- cgit 1.2.3-korg From 09e41a54625caa2f713798e869e5e1e5a31c0d58 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 11:34:03 +0800 Subject: Add test_get_hpa_pci Add test_get_hpa_pci Change-Id: Ie732988d47d2a024e0a8d4195ca25a6bae94a1de Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_aai_client.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vio/vio/tests/test_aai_client.py b/vio/vio/tests/test_aai_client.py index 1381a3f..17a0047 100644 --- a/vio/vio/tests/test_aai_client.py +++ b/vio/vio/tests/test_aai_client.py @@ -357,3 +357,11 @@ class TestAAIClient(unittest.TestCase): } ret = self.view._get_instruction_set_capabilities(extra) self.assertEqual(1, len(ret["hpa-feature-attributes"])) + + @mock.patch.object(restcall, "call_req") + def test_get_hpa_pci(self, mock_call): + extra = { + "pci_passthrough:alias": "gpu-nvidia-x86-0011-0022:1", + } + ret = self.view._get_pci_passthrough_capabilities(extra) + self.assertEqual(3, len(ret["hpa-feature-attributes"])) -- cgit 1.2.3-korg