X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=tests%2Fintegration-ocloud%2Ftest_clientdriver_stx_sa.py;h=b2bd8c877fd6bb80bebf18bbe10d4aec70491385;hb=23021f6c24ad8722495fc42f98a18cc650906bca;hp=4e450705ec35f12d9328d757b9ed7c5d3c07160c;hpb=965d6c3640ec7e735f0c17985c583952962fbbba;p=pti%2Fo2.git diff --git a/tests/integration-ocloud/test_clientdriver_stx_sa.py b/tests/integration-ocloud/test_clientdriver_stx_sa.py index 4e45070..b2bd8c8 100644 --- a/tests/integration-ocloud/test_clientdriver_stx_sa.py +++ b/tests/integration-ocloud/test_clientdriver_stx_sa.py @@ -12,17 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys +# import sys +# import logging import pytest -from o2ims.adapter import ocloud_repository as repository -from o2ims.domain import ocloud -from o2ims import config -import uuid + +from o2common.config import config from o2ims.adapter.clients.ocloud_sa_client import StxSaClientImp from cgtsclient.client import get_client -import logging - @pytest.fixture def real_stx_aio_client(): @@ -34,7 +31,7 @@ def real_stx_aio_client(): def test_get_instanceinfo(real_stx_aio_client): - logger = logging.getLogger(__name__) + # logger = logging.getLogger(__name__) stxclientimp = StxSaClientImp(real_stx_aio_client) assert stxclientimp is not None systeminfo = stxclientimp.getInstanceInfo() @@ -63,6 +60,7 @@ def test_get_pserver(real_stx_aio_client): assert host1 != host2 assert host1.id == host2.id + def test_get_k8s_list(real_stx_aio_client): stxSaClientImp = StxSaClientImp(real_stx_aio_client) assert stxSaClientImp is not None @@ -75,15 +73,75 @@ def test_get_k8s_list(real_stx_aio_client): assert k8s1.name == k8s2.name assert k8s1.id == k8s2.id + def test_get_cpu_list(real_stx_aio_client): stxSaClientImp = StxSaClientImp(real_stx_aio_client) assert stxSaClientImp is not None hostlist = stxSaClientImp.getPserverList() assert len(hostlist) > 0 - cpulist = stxSaClientImp.getCpuList(hostlist[0].id) + cpulist = stxSaClientImp.getCpuList(hostid=hostlist[0].id) assert len(cpulist) > 0 cpu1 = cpulist[0] cpu2 = stxSaClientImp.getCpu(cpu1.id) assert cpu1 != cpu2 assert cpu1.id == cpu2.id + + +def test_get_mem_list(real_stx_aio_client): + stxSaClientImp = StxSaClientImp(real_stx_aio_client) + assert stxSaClientImp is not None + hostlist = stxSaClientImp.getPserverList() + assert len(hostlist) > 0 + + memlist = stxSaClientImp.getMemList(hostid=hostlist[0].id) + assert len(memlist) > 0 + mem1 = memlist[0] + mem2 = stxSaClientImp.getMem(mem1.id) + assert mem1 != mem2 + assert mem1.id == mem2.id + + +def test_get_eth_list(real_stx_aio_client): + stxSaClientImp = StxSaClientImp(real_stx_aio_client) + assert stxSaClientImp is not None + hostlist = stxSaClientImp.getPserverList() + assert len(hostlist) > 0 + + ethlist = stxSaClientImp.getEthernetList(hostid=hostlist[0].id) + assert len(ethlist) > 0 + eth1 = ethlist[0] + eth2 = stxSaClientImp.getEthernet(eth1.id) + assert eth1 != eth2 + assert eth1.id == eth2.id + + +def test_get_if_list(real_stx_aio_client): + stxSaClientImp = StxSaClientImp(real_stx_aio_client) + assert stxSaClientImp is not None + hostlist = stxSaClientImp.getPserverList() + assert len(hostlist) > 0 + + iflist = stxSaClientImp.getIfList(hostid=hostlist[0].id) + assert len(iflist) > 0 + if1 = iflist[0] + if2 = stxSaClientImp.getIf(if1.id) + assert if1 != if2 + assert if1.id == if2.id + + +def test_get_if_port_list(real_stx_aio_client): + stxSaClientImp = StxSaClientImp(real_stx_aio_client) + assert stxSaClientImp is not None + hostlist = stxSaClientImp.getPserverList() + assert len(hostlist) > 0 + + iflist = stxSaClientImp.getIfList(hostid=hostlist[0].id) + assert len(iflist) > 0 + + portlist = stxSaClientImp.getPortList(interfaceid=iflist[0].id) + assert len(portlist) > 0 + port1 = portlist[0] + port2 = stxSaClientImp.getPort(port1.id) + assert port1 != port2 + assert port1.id == port2.id