summaryrefslogtreecommitdiffstats
path: root/testsuites/vstf/vstf_scripts/vstf/controller/unittest
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/vstf/vstf_scripts/vstf/controller/unittest')
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/controller/unittest/__init__.py8
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/controller/unittest/configuration.py21
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/controller/unittest/model.py31
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_cfg_intent_parse.py37
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_collect.py55
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_driver_function.py35
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_env_build.py60
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_perf.py130
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_ssh.py34
9 files changed, 0 insertions, 411 deletions
diff --git a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/__init__.py b/testsuites/vstf/vstf_scripts/vstf/controller/unittest/__init__.py
deleted file mode 100644
index 83b8d15d..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/__init__.py
+++ /dev/null
@@ -1,8 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
diff --git a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/configuration.py b/testsuites/vstf/vstf_scripts/vstf/controller/unittest/configuration.py
deleted file mode 100644
index 5131e8d4..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/configuration.py
+++ /dev/null
@@ -1,21 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-
-rabbit_mq_server = '192.168.188.10'
-
-tester_host = '192.168.188.14'
-
-target_host = '192.168.188.16'
-
-source_repo = {
- "passwd": "root",
- "ip": "192.168.188.10",
- "user": "root"
-}
diff --git a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/model.py b/testsuites/vstf/vstf_scripts/vstf/controller/unittest/model.py
deleted file mode 100644
index b6e37ff5..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/model.py
+++ /dev/null
@@ -1,31 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import unittest
-
-from vstf.rpc_frame_work import rpc_producer
-from vstf.controller.unittest import configuration
-
-
-class Test(unittest.TestCase):
-
- def setUp(self):
- self.controller = configuration.rabbit_mq_server
- self.tester_host = configuration.tester_host
- self.target_host = configuration.target_host
- self.source_repo = configuration.source_repo
- self.conn = rpc_producer.Server(self.controller)
-
- def tearDown(self):
- self.conn.close()
-
-
-if __name__ == "__main__":
- #import sys;sys.argv = ['', 'Test.testName']
- unittest.main()
diff --git a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_cfg_intent_parse.py b/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_cfg_intent_parse.py
deleted file mode 100644
index a0cf2a33..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_cfg_intent_parse.py
+++ /dev/null
@@ -1,37 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import os
-import unittest
-
-from vstf.controller.unittest import model
-from vstf.controller.env_build.cfg_intent_parse import IntentParser
-
-
-class Test(model.Test):
-
- def setUp(self):
- super(Test, self).setUp()
- self.dir = os.path.dirname(__file__)
-
- def tearDown(self):
- super(Test, self).tearDown()
-
- def test_parse_cfg_file(self):
- for m in ['Ti', 'Tu', 'Tn', 'Tnv']:
- filepath = os.path.join(self.dir, 'configuration/env/%s.json' % m)
- parser = IntentParser(filepath)
- parser.parse_cfg_file()
-
-
-if __name__ == "__main__":
- import logging
-
- logging.basicConfig(level=logging.INFO)
- unittest.main()
diff --git a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_collect.py b/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_collect.py
deleted file mode 100644
index e8e9dd8c..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_collect.py
+++ /dev/null
@@ -1,55 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import unittest
-import json
-
-from vstf.controller.env_build import env_collect
-from vstf.controller.unittest import model
-
-
-class TestCollect(model.Test):
-
- def setUp(self):
- super(TestCollect, self).setUp()
- self.obj = env_collect.EnvCollectApi(self.conn)
-
- def test_collect_host_info(self):
- ret_str = json.dumps(
- self.obj.collect_host_info(
- self.tester_host), indent=4)
- for key in ("CPU INFO", "MEMORY INFO", "HW_INFO", "OS INFO"):
- self.assertTrue(
- key in ret_str,
- "collect_host_info failed, ret_str = %s" %
- ret_str)
-
- def test_list_nic_devices(self):
- ret_str = json.dumps(
- self.obj.list_nic_devices(
- self.tester_host), indent=4)
- for key in ("device", "mac", "bdf", "desc"):
- self.assertTrue(
- key in ret_str,
- "list_nic_devices failed, ret_str = %s" %
- ret_str)
- print ret_str
-
- def test_get_device_detail(self):
- identity = "01:00.0"
- ret = self.obj.get_device_detail(self.tester_host, "01:00.0")
- for key in ("device", "mac", "bdf", "desc"):
- self.assertTrue(key in ret)
- self.assertTrue(ret['bdf'] == identity)
-
-
-if __name__ == "__main__":
- import logging
- logging.basicConfig(level=logging.INFO)
- unittest.main()
diff --git a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_driver_function.py b/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_driver_function.py
deleted file mode 100644
index a8b1b018..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_driver_function.py
+++ /dev/null
@@ -1,35 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import unittest
-import json
-
-from vstf.controller.functiontest.driver.drivertest import config_setup
-from vstf.controller.unittest import model
-
-
-class TestDriverFunction(model.Test):
-
- def setUp(self):
- logging.info("start driver function test unit test.")
-
- def test_config_setup(self):
- config, _ = config_setup()
- for key in ("test_scene", "bond_flag", "switch_module"):
- self.assertTrue(
- key in config.keys(),
- "config_setup function failure.")
-
- def teardown(self):
- logging.info("stop driver function test unit test.")
-
-if __name__ == "__main__":
- import logging
- logging.basicConfig(level=logging.INFO)
- unittest.main()
diff --git a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_env_build.py b/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_env_build.py
deleted file mode 100644
index 5f9d047f..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_env_build.py
+++ /dev/null
@@ -1,60 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import unittest
-import os
-
-from vstf.controller.unittest import model
-from vstf.controller.env_build import env_build
-
-
-class TestEnvBuilder(model.Test):
-
- def setUp(self):
- super(TestEnvBuilder, self).setUp()
- self.dir = os.path.dirname(__file__)
-
- @unittest.skip('for now')
- def test_build_tn(self):
- filepath = os.path.join(self.dir, '../../../etc/vstf/env/Tn.json')
- self.mgr = env_build.EnvBuildApi(self.conn, filepath)
- ret = self.mgr.build()
- self.assertTrue(ret, "build_tn failed,ret = %s" % ret)
-
- @unittest.skip('for now')
- def test_build_tn1v(self):
- filepath = os.path.join(self.dir, '../../../etc/vstf/env/Tnv.json')
- self.mgr = env_build.EnvBuildApi(self.conn, filepath)
- ret = self.mgr.build()
- self.assertTrue(ret, "build_tn1v failed,ret = %s" % ret)
-
- @unittest.skip('for now')
- def test_build_ti(self):
- filepath = os.path.join(self.dir, '../../../etc/vstf/env/Ti.json')
- self.mgr = env_build.EnvBuildApi(self.conn, filepath)
- ret = self.mgr.build()
- self.assertTrue(ret, "build_ti failed,ret = %s" % ret)
-
- @unittest.skip('for now')
- def test_build_tu(self):
- filepath = os.path.join(self.dir, '../../../etc/vstf/env/Tu.json')
- self.mgr = env_build.EnvBuildApi(self.conn, filepath)
- ret = self.mgr.build()
- self.assertTrue(ret, "build_tu failed,ret = %s" % ret)
-
- def test_build_tu_bridge(self):
- filepath = os.path.join(self.dir, '../../../etc/vstf/env/Tu_br.json')
- self.mgr = env_build.EnvBuildApi(self.conn, filepath)
- ret = self.mgr.build()
- self.assertTrue(ret, "build_tu failed,ret = %s" % ret)
-
-if __name__ == "__main__":
- import logging
- logging.basicConfig(level=logging.INFO)
- unittest.main()
diff --git a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_perf.py b/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_perf.py
deleted file mode 100644
index 4e2a2ea9..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_perf.py
+++ /dev/null
@@ -1,130 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-
-import unittest
-import os
-import logging
-
-from vstf.controller.unittest import model
-from vstf.controller.settings.flows_settings import FlowsSettings
-from vstf.controller.settings.tool_settings import ToolSettings
-from vstf.controller.settings.perf_settings import PerfSettings
-from vstf.controller.sw_perf.perf_provider import PerfProvider
-from vstf.controller.sw_perf.flow_producer import FlowsProducer
-from vstf.controller.settings.tester_settings import TesterSettings
-from vstf.controller.env_build.env_build import EnvBuildApi as Builder
-from vstf.common.log import setup_logging
-import vstf.controller.sw_perf.performance as pf
-
-LOG = logging.getLogger(__name__)
-
-
-class TestPerf(model.Test):
-
- def setUp(self):
- LOG.info("start performance unit test.")
- super(TestPerf, self).setUp()
- self.dir = os.path.dirname(__file__)
- self.perf_path = os.path.join(self.dir, '../../../etc/vstf/perf')
- self.base_path = os.path.join(self.dir, '../../../etc/vstf/env')
-
- def teardown(self):
- LOG.info("stop performance unit test.")
-
- @unittest.skip('for now')
- def test_batch_perf(self):
-
- LOG.info(self.perf_path)
- LOG.info(self.base_path)
- perf_settings = PerfSettings(path=self.perf_path)
- flows_settings = FlowsSettings(path=self.perf_path)
- tool_settings = ToolSettings(path=self.base_path)
- tester_settings = TesterSettings(path=self.base_path)
- flow_producer = FlowsProducer(self.conn, flows_settings)
- provider = PerfProvider(
- flows_settings.settings,
- tool_settings.settings,
- tester_settings.settings)
- perf = pf.Performance(self.conn, provider)
- tests = perf_settings.settings
- for scenario, cases in tests.items():
- if not cases:
- continue
-
- config_file = os.path.join(self.base_path, scenario + '.json')
-
- LOG.info(config_file)
-
- env = Builder(self.conn, config_file)
- env.build()
-
- for case in cases:
- casetag = case['case']
- tool = case['tool']
- protocol = case['protocol']
- profile = case['profile']
- ttype = case['type']
- sizes = case['sizes']
-
- flow_producer.create(scenario, casetag)
- result = perf.run(tool, protocol, ttype, sizes)
- self.assertEqual(True, isinstance(result, dict))
- LOG.info(result)
-
- @unittest.skip('for now')
- def test_perf_settings(self):
- perf_settings = PerfSettings()
- self.assertEqual(True, perf_settings.input())
-
- def test_tool_settings(self):
- tool_settings = ToolSettings()
- value = {
- "time": 20,
- "threads": 1
- }
- tool_settings.set_pktgen(value)
- tool_settings.set_netperf(value)
- tool_settings.set_iperf(value)
- tool_settings.set_qperf(value)
- LOG.info(tool_settings.settings)
-
- def test_flow_settings(self):
- tests = {
- "Tn": ["Tn-1", "Tn-2", "Tn-3", "Tn-4"],
- "Tnv": ["Tnv-1", "Tnv-2", "Tnv-3", "Tnv-4"],
- "Ti": ["Ti-1", "Ti-2", "Ti-3", "Ti-4", "Ti-5", "Ti-6"],
- "Tu": ["Tu-1", "Tu-2", "Tu-3", "Tu-4", "Tu-5", "Tu-6"]
- }
- flows_settings = FlowsSettings(path=self.perf_path)
- flow_producer = FlowsProducer(self.conn, flows_settings)
-
- for scenario, cases in tests.items():
- if not cases:
- continue
-
- config_file = os.path.join(self.base_path, scenario + '.json')
-
- LOG.info(config_file)
-
- env = Builder(self.conn, config_file)
- env.build()
-
- for case in cases:
- LOG.info(case)
- flow_producer.create(scenario, case)
- LOG.info(flows_settings.settings)
-
-
-if __name__ == "__main__":
- setup_logging(
- level=logging.INFO,
- log_file="/var/log/vstf/vstf-unit-test.log",
- clevel=logging.INFO)
- unittest.main()
diff --git a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_ssh.py b/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_ssh.py
deleted file mode 100644
index c9aadb04..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/controller/unittest/test_ssh.py
+++ /dev/null
@@ -1,34 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import unittest
-
-from vstf.common import ssh
-from vstf.controller.unittest import model
-
-
-class Test(model.Test):
-
- def setUp(self):
- super(Test, self).setUp()
- self.host = self.source_repo["ip"]
- self.user = self.source_repo["user"]
- self.passwd = self.source_repo["passwd"]
-
- def tearDown(self):
- super(Test, self).tearDown()
-
- def test_run_cmd(self):
- ssh.run_cmd(self.host, self.user, self.passwd, 'ls')
-
-
-if __name__ == "__main__":
- import logging
- logging.basicConfig(level=logging.INFO)
- unittest.main()