summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtestsuites/rubbos/rubbos.conf0
-rwxr-xr-xtestsuites/rubbos/run_rubbos.py64
2 files changed, 62 insertions, 2 deletions
diff --git a/testsuites/rubbos/rubbos.conf b/testsuites/rubbos/rubbos.conf
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/testsuites/rubbos/rubbos.conf
diff --git a/testsuites/rubbos/run_rubbos.py b/testsuites/rubbos/run_rubbos.py
index 0a4acd94..32221f72 100755
--- a/testsuites/rubbos/run_rubbos.py
+++ b/testsuites/rubbos/run_rubbos.py
@@ -186,15 +186,75 @@ def rubbos_create_instances(template_file, rubbos_parameters=None, stack_name="b
print "After %d seconds, the stack's status is [%s]" %(timeInProgress, stack_status)
return True if stack_status == "CREATE_COMPLETE" else False
+def get_instances(nova_client):
+ try:
+ instances = nova_client.servers.list(search_opts={'all_tenants': 1})
+ return instances
+ except Exception, e:
+ print "Error [get_instances(nova_client)]:", e
+ return None
+
def rubbos_run():
- pass
+ print "========== run rubbos ==========="
+
+ nova = _get_nova_client()
+
+ instances = get_instances(nova)
+ control_servers = []
+ client_servers = []
+ web_servers = []
+ cjdbc_controller = []
+ database_servers = []
+ for instance in instances:
+ name = getattr(instance, 'name')
+ private_ip = [ x['addr'] for x in getattr(instance, 'addresses').itervalues().next() if x['OS-EXT-IPS:type'] == 'fixed']
+ public_ip = [ x['addr'] for x in getattr(instance, 'addresses').itervalues().next() if x['OS-EXT-IPS:type'] == 'floating']
+
+ if name.find("control") > 0:
+ control_servers.append(''.join(str(name)+':'+public_ip[0]+':'+private_ip[0]))
+ if name.find("client") > 0:
+ client_servers.append(''.join(str(name)+':'+private_ip[0]))
+ if name.find("tomcat") > 0:
+ web_servers.append(''.join(str(name)+':'+private_ip[0]))
+ if name.find("cjdbc") > 0:
+ cjdbc_controller.append(''.join(str(name)+':'+private_ip[0]))
+ if name.find("mysql") > 0:
+ database_servers.append(''.join(str(name)+':'+private_ip[0]))
+
+ f = open('rubbos.conf', 'w')
+ f.write('[Controller]\n\n')
+ f.write('controller=')
+ for i in control_servers:
+ f.write(i+',')
+ f.write('\n\n')
+ f.write('[Hosts]\n\n')
+ f.write('client_servers=')
+ for i in client_servers:
+ f.write(i + ',')
+ f.write('\n')
+ f.write('web_servers=')
+ for i in web_servers:
+ f.write(i+',')
+ f.write('\n')
+ f.write('cjdbc_controller=')
+ for i in cjdbc_controller:
+ f.write(i+',')
+ f.write('\n')
+ f.write('database_servers=')
+ for i in database_servers:
+ f.write(i + ',')
+ f.close()
+ f = open('rubbos.conf','r')
+ line = f.readlines()
+ f.close()
+ for i in line:
+ print(i)
def main():
global Heat_template
global Bottlenecks_repo_dir
global image_url
Bottlenecks_repo_dir = "/home/opnfv/bottlenecks" # same in Dockerfile, docker directory
- #Bottlenecks_repo_dir = "/root/wyg/bottlenecks" # Test dir in local env
image_url = 'http://artifacts.opnfv.org/bottlenecks/rubbos/bottlenecks-trusty-server.img'