rubbos installation guide
[bottlenecks.git] / vstf / vstf / agent / unittest / env / test_vm_manager.py
1 """
2 Created on 2015-9-24
3
4 @author: y00228926
5 """
6 import unittest
7
8 from vstf.agent.unittest.env import model
9 from vstf.agent.env.basic.vm9pfs import VMConfigBy9pfs
10 from vstf.agent.env.basic.vm_manager import VMControlOperation
11
12
13 class TestVM9pfs(model.Test):
14     def setUp(self):
15         super(TestVM9pfs, self).setUp()
16         self.vm_config = {
17             'vm_name': 'vm1',
18             'vm_cpu': 5,
19             'image_path': "/mnt/sdb/ubuntu_salt_master.img",
20             'child_dir': '/mnt/sdb/',
21             'image_type': 'qcow2',
22             'ctrl_br': 'br0',
23             'ctrl_mac': '56:6f:44:a5:3f:a4',
24             "taps": [
25                 {
26                     "tap_name": "tap_in",
27                     "br_type": "bridge",
28                     "br_name": "br0",
29                     "tap_mac": "56:6f:44:a5:3f:a2",
30                 },
31                 {
32                     "tap_name": "tap_out",
33                     "br_type": "bridge",
34                     "br_name": "br0",
35                     "tap_mac": "56:6f:44:a5:3f:a3",
36                 }
37             ],
38             'init_config': {
39                 "amqp_passwd": "guest",
40                 "amqp_user": "guest",
41                 "amqp_server": "192.168.188.10",
42                 "amqp_port": 5672,
43                 'ctrl_ip_setting': '192.168.188.200/23',
44                 'tap_pktloop_config': 'dpdk',
45                 'ctrl_gw': '192.168.188.1'
46             }
47         }
48         self.mgr = VMControlOperation()
49         self.mgr.clean_all_vms()
50
51     def tearDown(self):
52         self.mgr.clean_all_vms()
53         super(TestVM9pfs, self).tearDown()
54
55     def test_create_vm_bridge(self):
56         self.mgr.create_vm(self.vm_config)
57         self.mgr.wait_vm(self.vm_config["vm_name"])
58         self.mgr.init_config_vm(self.vm_config["vm_name"])
59
60     def _replace_opts(self, cfg, br_type):
61         for tap_cfg in cfg["taps"]:
62             tap_cfg["br_type"] = br_type
63
64
65 if __name__ == "__main__":
66     import logging
67     logging.basicConfig(level=logging.INFO)
68     LOG = logging.getLogger(__name__)
69     unittest.main()