summaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
authorzhongjun <zhong.jun@zte.com.cn>2017-09-21 09:40:12 +0800
committerzhongjun <zhong.jun@zte.com.cn>2017-09-21 17:07:05 +0800
commitfc12fe83562430bc406877583111ed725d08edc8 (patch)
tree22b90d93b501c9f4d73214b453105d4584bde683 /deploy
parent2045ccff6a31ce649cfabc0ba896e9d0d708e3e0 (diff)
Add some unittest files such as test_nova.py
1.Add test_glance.py, test_neutron.py and test_nova.py unittest files, and modify the neutron.py to adapt the unittest. 2.Add some unittest functions in test_post_execute.py, test_deploy.py, test_keystoneauth.py. 3.rename test_prepare_execure.py to test_prepare_execute.py. Change-Id: Ie0640d133e27c558648416a6a5cf044a00ffa67f Signed-off-by: zhongjun <zhong.jun@zte.com.cn>
Diffstat (limited to 'deploy')
-rw-r--r--deploy/post/execute.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/deploy/post/execute.py b/deploy/post/execute.py
index 75abaacb..fe4185b8 100644
--- a/deploy/post/execute.py
+++ b/deploy/post/execute.py
@@ -59,20 +59,20 @@ def _config_external_subnet(ext_id, network_conf):
}
-def _create_external_network(network_file):
+def _create_external_network(network_file, openrc=None):
network_conf = NetworkConfig(network_file=network_file)
ext_name = network_conf.ext_network_name
physnet = network_conf.ext_mapping if hasattr(network_conf, 'ext_mapping') else 'physnet1'
- neutronclient = neutron.Neutron()
+ neutronclient = neutron.Neutron(openrc=openrc)
ext_id = neutronclient.create_network(ext_name,
_config_external_network(ext_name, physnet))
if ext_id:
neutronclient.create_subnet(_config_external_subnet(ext_id, network_conf))
-def _create_flavor_m1_micro():
+def _create_flavor_m1_micro(openrc=None):
name = 'm1.micro'
- novaclient = nova.Nova()
+ novaclient = nova.Nova(openrc=openrc)
if not novaclient.get_flavor_by_name(name):
try:
return novaclient.create_flavor(name, ram=64, vcpus=1, disk=0)
@@ -118,8 +118,8 @@ def _prepare_cirros():
return img
-def _create_image_TestVM():
- glanceclient = glance.Glance()
+def _create_image_TestVM(openrc=None):
+ glanceclient = glance.Glance(openrc=openrc)
image = 'TestVM'
if not glanceclient.get_by_name(image):
try:
@@ -162,8 +162,8 @@ def _config_ssh_security_group_rule(security_group_id):
return body
-def _create_security_group_rules():
- neutronclient = neutron.Neutron()
+def _create_security_group_rules(openrc=None):
+ neutronclient = neutron.Neutron(openrc=openrc)
try:
security_group_name = 'default'
security_group = neutronclient.get_security_group_by_name(security_group_name)