Deprecate murano-tests

Change-Id: If22cd0a0a785994979da3cbc481cd047e8b09428
This commit is contained in:
Ruslan Kamaldinov 2014-05-29 18:21:05 +04:00
parent f506784b48
commit ac70ffc9c1
161 changed files with 6 additions and 20064 deletions

View File

@ -1,26 +0,0 @@
HA Testing Scripts
============
The scripts for OpenStack Murano HA testing.
How To Test
============
To run HA tests need to perform the following steps:
1. Copy agent.py on all controller nodes (with services, which we want to control)
2. Copy controller.py and controller.conf on your personal host (to manage services on controller modes)
3. Change controller.conf - need to fix IP addresses of controller nodes and parameters file1 and file2
4. Execute agent.py on all controller-nodes (with services, like Murano Conductor service):
sudo python agent.py
5. Execute controller.py on your personal host and start to testing. For example, you can start to deploy environment. In this case Murano Conductor service on the first node will start to deploy VMs and these testing scripts will detect node with Active Murano Controller service - and will stop it for several secconds. In case of properly HA the same service on the other nodes should start and continue to deploy environment.
Mirantis Inc (C) 2013.

View File

@ -1,51 +0,0 @@
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import shlex
import subprocess
import filecmp
import xmlrpclib
import time
from SimpleXMLRPCServer import SimpleXMLRPCServer
"""
This is simple XML-RPC server which can:
1. Execute any shell commands by the request
2. Compare two files
This server should be run on OpenStack controller nodes
to control services on these nodes.
"""
def run_bash_command(cmd, timeout=0):
args = shlex.split(cmd)
p = subprocess.Popen(args, shell=False, stdout=subprocess.PIPE)
for line in p.stdout:
print line
time.sleep(timeout)
return p.stdout
def check_diff_files(file1, file2):
return not filecmp.cmp(file1, file2)
server = SimpleXMLRPCServer(("0.0.0.0", 7007),allow_none=True)
print "Listening on port 7007..."
server.register_function(run_bash_command, "run_bash_command")
server.register_function(check_diff_files, "check_diff_files")
server.serve_forever()

View File

@ -1,21 +0,0 @@
[HA_Testing]
nodes = n1 n2
port = 7007
mode = compare_files
file1 = /var/log/murano-conductor.log
file2 = /var/log/murano-conductor.log.diff
activate_cmd = service murano-conductor start
deactivate_cmd = service murano-conductor stop
minimum_count_of_active_nodes = 1
[n1]
host = 172.18.79.81
[n2]
host = 172.18.79.82

View File

@ -1,156 +0,0 @@
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import xmlrpclib
import ConfigParser
import time
from bottle import route, run
class ControllerNode():
def __init__(self, status='on', host='', port='7007', file1='', file2='',
activate_cmd='', deactivate_cmd='', agent=None):
self.status = status
self.host = host
self.port = port
self.file1 = file1
self.file2 = file2
self.activate_cmd = activate_cmd
self.deactivate_cmd = deactivate_cmd
self.agent = agent
self.checks_timeout = -1
def check_files(self, access):
self.checks_timeout -= 1
if self.checks_timeout == 0:
self.activate()
return 1
if self.agent.check_diff_files(self.file1, self.file2) and access:
self.deactivate()
return -1
return 0
def activate(self, timeout=5):
print 'Start to activate node ' + self.host
self.agent.run_bash_command(self.activate_cmd)
if self.file1 and self.file2:
init_cmd = 'cp %s %s' % (self.file1, self.file2)
time.sleep(timeout)
self.agent.run_bash_command(init_cmd)
def deactivate(self, timeout=5):
print 'Start to diactivate node ' + self.host
time.sleep(timeout)
self.agent.run_bash_command(self.deactivate_cmd)
self.checks_timeout = 10
class Controller():
nodes = []
def __init__(self, config_file='controller.conf'):
self.config = ConfigParser.ConfigParser()
self.config.read(config_file)
self.agents_list = self.get_from_cfg('HA_Testing', 'nodes').split(' ')
self.port = self.get_from_cfg('HA_Testing', 'port', '7007')
self.activate_cmd = self.get_from_cfg('HA_Testing', 'activate_cmd')
self.deactivate_cmd = self.get_from_cfg('HA_Testing', 'deactivate_cmd')
self.mode = self.get_from_cfg('HA_Testing', 'mode', 'compare_files')
self.file1 = self.get_from_cfg('HA_Testing', 'file1')
self.file2 = self.get_from_cfg('HA_Testing', 'file2')
parameter = 'minimum_count_of_active_nodes'
self.min_active_nodes = self.get_from_cfg('HA_Testing',
parameter, 1)
for agent in self.agents_list:
host = self.get_from_cfg(agent, 'host')
port = self.get_from_cfg(agent, 'port', self.port)
file1 = self.get_from_cfg(agent, 'file1', self.file1)
file2 = self.get_from_cfg(agent, 'file2', self.file2)
activate_cmd = self.get_from_cfg(agent, 'activate_cmd',
self.activate_cmd)
deactivate_cmd = self.get_from_cfg(agent, 'deactivate_cmd',
self.deactivate_cmd)
new_agent = xmlrpclib.ServerProxy("http://%s:%s"
% (host, port), allow_none=True)
new_node = ControllerNode('on', host, port, file1, file2,
activate_cmd, diactivate_cmd, new_agent)
new_node.activate()
" If all OK, add this node to the list "
self.nodes.append(new_node)
self.active_nodes = len(self.nodes)
print 'Minimal count of active nodes: ' + str(self.min_active_nodes)
print 'Active nodes: ' + str(self.active_nodes)
def get_from_cfg(self, p1, p2, default=''):
try:
result = self.config.get(p1, p2)
return result
except:
return default
def execute(self):
if 'compare_files' in self.mode:
self.monitor_file_changes()
def monitor_file_changes(self):
while self.active_nodes != self.min_active_nodes:
for node in self.nodes:
access = int(self.active_nodes) > int(self.min_active_nodes)
self.active_nodes += node.check_files(access)
ctrl = Controller()
ctrl.execute()
@route('/HA/nodes', method='GET')
def get_nodes():
result = []
for node in ctrl.nodes:
result.append({'name': node.host, 'status': node.status})
return result
@route('/HA/activate/<activate_nodes>', method='PUT')
def activate(activate_nodes=[]):
for node in ctrl.nodes:
if node.name in activate_nodes:
node.activate()
ctrl.active_nodes += 1
return ctrl.active_nodes
@route('/HA/deactivate/<deactivate_nodes>', method='PUT')
def activate(deactivate_nodes=[]):
for node in ctrl.nodes:
if node.name in deactivate_nodes:
if int(self.active_nodes) > int(self.min_active_nodes):
node.deactivate()
ctrl.active_nodes -= 1
return ctrl.active_nodes
run(host='0.0.0.0', port=7007, debug=False)

View File

@ -1,28 +0,0 @@
Script for JIRA and launchpad bug descriptions sync
============
This script allows to sync bug titles, descriptions, statuses and priorities between two different systems: JIRA and launchpad.
Please, see more detailed information about the JIRA and launchpad by the following links:
- https://www.atlassian.com/software/jira
- https://launchpad.net/
How To Sync
============
To run sync script need to perform the following steps:
1. Fix sync.cfg file - fill information about JIRA credentials for the project in JIRA.
2. Execute sync.py and wait for a few seconds:
python sync.py
3. Script will open browser with launchpad configuration page, need to confirm access and close browser. After that need to wait for the full sync of JIRA and launchpad.
Mirantis Inc (C) 2013.

View File

@ -1,8 +0,0 @@
[JIRA]
URL = https://mirantis.jira.com/
user = user
password = password
project_key = MRN
[project]
name = murano

View File

@ -1,383 +0,0 @@
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import re
import sys
import httplib2
import ConfigParser
from dateutil import parser
from jira.client import JIRA
from launchpadlib.launchpad import Launchpad
httplib2.debuglevel = 0
def update_status_of_jira_issue(jira, issue, new_status):
new_status_id = None
for status in jira.transitions(issue):
if get_str(status['name']) == new_status:
new_status_id = status['id']
if not new_status_id:
raise RuntimeError('No jira_status_id exists for status {0}'.format(
new_status))
jira.transition_issue(issue, new_status_id,
comment="Automatically updated by script.")
def get_str(parameter):
if not parameter:
parameter = ''
return str(parameter.encode('ascii', 'ignore'))
def get_date(parameter):
date = parser.parse(parameter)
return date
def get_status(parameter):
parameter = get_str(parameter)
if parameter in ['In Testing', 'To Test']:
return {'jira': parameter, 'launchpad': 'Fix Committed', 'code': 0}
elif parameter == 'Fix Committed':
return {'jira': 'To Test', 'launchpad': 'Fix Committed', 'code': 0}
elif parameter == 'Resolved':
return {'jira': 'Resolved', 'launchpad': 'Fix Released', 'code': 3}
elif parameter == 'Fix Released':
return {'jira': 'Closed', 'launchpad': 'Fix Released', 'code': 3}
elif parameter in ['Reopened', 'To Do']:
return {'jira': parameter, 'launchpad': 'New', 'code': 1}
elif parameter == 'Rejected':
return {'jira': parameter, 'launchpad': 'Invalid', 'code': 2}
elif parameter == 'Closed':
return {'jira': parameter, 'launchpad': 'Fix Released', 'code': 3}
elif parameter in ['New', 'Incomplete', 'Opinion', 'Confirmed', 'Triaged']:
return {'jira': 'ToDo', 'launchpad': parameter, 'code': 1}
elif parameter in ['Invalid', "Won't Fix"]:
return {'jira': 'Rejected', 'launchpad': parameter, 'code': 2}
else:
return {'jira': parameter, 'launchpad': parameter, 'code': 4}
def get_priority(parameter):
parameter = get_str(parameter)
if parameter in ['Blocker', 'Critical']:
return {'jira': parameter, 'launchpad': 'Critical', 'code': 0}
elif parameter in ['High', 'Medium']:
return {'jira': 'Major', 'launchpad': parameter, 'code': 1}
elif parameter == 'Major':
return {'jira': 'Major', 'launchpad': 'Medium', 'code': 1}
elif parameter in ['Nice to have', 'Some day']:
return {'jira': parameter, 'launchpad': 'Low', 'code': 2}
elif 'Low' in parameter:
return {'jira': 'Nice to have', 'launchpad': 'Low', 'code': 2}
else:
return {'jira': parameter, 'launchpad': parameter, 'code': 3}
def get_jira_bugs(url, user, password, project,
issues_count=1000000,
issues_fields='key,summary,description,issuetype,priority,'
'status,updated,comment,fixVersions',
search_string_template='project={0} and issuetype=Bug'):
jira = JIRA(basic_auth=(user, password), options={'server': url})
search_string = search_string_template.format(project)
issues = jira.search_issues(search_string, fields=issues_fields,
maxResults=issues_count)
bugs = []
for issue in issues:
bug = {'key': get_str(issue.key),
'title': get_str(issue.fields.summary),
'description': get_str(issue.fields.description),
'priority': get_priority(issue.fields.priority.name),
'status': get_status(issue.fields.status.name),
'updated': get_date(issue.fields.updated),
'comments': issue.fields.comment.comments,
'fix_version': ''}
if issue.fields.fixVersions:
version = get_str(issue.fields.fixVersions[0].name)
bug.update({'fix_version': version})
summary = bug['title']
if 'Launchpad Bug' in summary:
summary = summary[24:]
bug.update({'priority_code': bug['priority']['code'],
'status_code': bug['status']['code'],
'summary': summary})
bugs.append(bug)
print 'Found {0} bugs in JIRA'.format(len(bugs))
return bugs
def get_launchpad_bugs(project):
project = project.lower()
launchpad = Launchpad.login_with(project, 'production')
project = launchpad.projects[project]
launchpad_bugs = project.searchTasks(status=["New", "Fix Committed",
"Invalid", "Won't Fix",
"Confirmed", "Triaged",
"In Progress", "Incomplete",
"Fix Released"])
bugs = []
for launchpad_bug in launchpad_bugs:
bug_link = get_str(launchpad_bug.self_link)
key = re.search(r"[0-9]+$", bug_link).group()
parameters = launchpad_bug.bug
bug = {'key': get_str(key),
'title': get_str(parameters.title),
'summary': get_str(parameters.title),
'description': get_str(parameters.description),
'priority': get_priority(launchpad_bug.importance),
'status': get_status(launchpad_bug.status),
'updated': parameters.date_last_updated,
#'comments': parameters.messages.entries[1:],
#'attachments': parameters.attachments.entries,
'fix_version': ''}
#if parameters.linked_branches.entries:
# version = get_str(parameters.linked_branches.entries[0])
# bug.update({'fix_version': version})
bug.update({'priority_code': bug['priority']['code'],
'status_code': bug['status']['code']})
bugs.append(bug)
# It works very slow, print the dot per bug, for fun
print ".",
sys.stdout.flush()
print '\nFound {0} bugs on launchpad'.format(len(bugs))
return bugs
def update_jira_bug(jira, issue, title, description, priority, status):
print "Updating JIRA bug ", title
print "Description & Title & Priority updating..."
try:
issue.update(summary=title, description=description,
priority={'name': priority})
print "... updated: OK"
except Exception as ex:
print "... updated: FAIL (not possible)"
print type(ex), ex
print "Status updating..."
try:
update_status_of_jira_issue(jira, get_str(issue.key), status)
print "... updated: OK"
except Exception as ex:
print "... updated: FAIL (not possible)"
print type(ex), ex
def update_lp_bug(bug, title, description, priority, status):
print "Updating launchpad bug ", title
# attachments
#print launchpad.bugs[Lbug['key']].lp_operations
print "Description & Title updating..."
try:
bug.title = title
bug.description = description
bug.lp_save()
print "... updated: OK"
except Exception as ex:
print "... updated: FAIL (not possible)"
print type(ex), ex
print "Status & Priority updating..."
try:
bug_task = bug.bug_tasks[0]
bug_task.status = status
bug_task.importance = priority
bug_task.lp_save()
print "... updated: OK"
except Exception as ex:
print "... updated: FAIL (not possible)"
print type(ex), ex
def create_jira_bug(jira, project_key, title, description):
new_issue = None
fields = {'project': {'key': project_key}, 'summary': title,
'description': description, 'issuetype': {'name': 'Bug'}}
print "Creating the new bug desciption in JIRA... ", title
try:
new_issue = jira.create_issue(fields=fields)
print "The new bug description was successfully created in JIRA"
except Exception as ex:
print "Can not create new bug in JIRA"
print type(ex), ex
return new_issue
def create_lp_bug(launchpad, project, title, description):
new_bug = None
print "Creating the bug desciption on launchpad... ", title
try:
new_bug = launchpad.bugs.createBug(target=project.self_link,
title=title,
description=description)
print "The bug description was successfully created on launchpad"
except Exception as ex:
print "Can not create new bug on launchpad"
print type(ex), ex
return new_bug
def sync_jira_with_launchpad(url, user, password, project, project_key):
template = 'Launchpad Bug #{0}: '
jira_bugs = get_jira_bugs(url, user, password, project_key)
launchpad_bugs = get_launchpad_bugs(project)
jira = JIRA(basic_auth=(user, password), options={'server': url})
launchpad = Launchpad.login_with(project, 'production')
# Sync already created tasks
for Jbug in jira_bugs:
for Lbug in launchpad_bugs:
if (Lbug['title'] in Jbug['title'] or
Lbug['key'] in Jbug['title']):
for parameter in ['description', 'summary', 'status_code',
'priority_code']:
if Jbug[parameter] != Lbug[parameter]:
if Jbug['updated'] < Lbug['updated']:
new_title = ''
if not Lbug['key'] in Jbug['title']:
new_title = template.format(Lbug['key'])
new_title += Lbug['title']
update_jira_bug(jira, jira.issue(Jbug['key']),
new_title, Lbug['description'],
Lbug['priority']['jira'],
Lbug['status']['jira'])
else:
new_title = Jbug['title']
if 'Launchpad Bug' in new_title:
new_title = str(new_title[24:])
update_lp_bug(launchpad.bugs[Lbug['key']],
new_title, Jbug['description'],
Jbug['priority']['launchpad'],
Jbug['status']['launchpad'])
break
break
# Move new bugs from launchpad to JIRA
for Lbug in launchpad_bugs:
if Lbug['status_code'] == 3:
continue
sync = False
duplicated = False
for Lbug2 in launchpad_bugs:
if Lbug2['title'] == Lbug['title'] and Lbug2['key'] != Lbug['key']:
duplicated = True
for Jbug in jira_bugs:
if (Lbug['title'] in Jbug['title'] or
Lbug['key'] in Jbug['title'] or
'Launchpad Bug' in Jbug['title']):
sync = True
if not sync and not duplicated:
new_title = ''
if not Lbug['key'] in Jbug['title']:
new_title = template.format(Lbug['key'])
new_title += Lbug['title']
new_issue = create_jira_bug(jira, project_key, new_title,
Lbug['description'])
if new_issue:
update_jira_bug(jira, jira.issue(new_issue.key),
new_title, Lbug['description'],
Lbug['priority']['jira'],
Lbug['status']['jira'])
# Move new bugs from JIRA to launchpad
for Jbug in jira_bugs:
if Jbug['status_code'] == 3:
continue
sync = False
duplicated = False
for Jbug2 in jira_bugs:
if Jbug2['title'] == Jbug['title'] and Jbug2['key'] != Jbug['key']:
duplicated = True
for Lbug in launchpad_bugs:
if (Lbug['title'] in Jbug['title'] or
Lbug['key'] in Jbug['title'] or
'Launchpad Bug' in Jbug['title']):
sync = True
if not sync and not duplicated:
lp_project = launchpad.projects[project]
new_bug = create_lp_bug(launchpad, lp_project, Jbug['title'],
Jbug['description'])
if new_bug:
update_lp_bug(new_bug,
Jbug['title'], Jbug['description'],
Jbug['priority']['launchpad'],
Jbug['status']['launchpad'])
for Jbug in jira_bugs:
if Jbug['status_code'] == 3:
continue
for Lbug in launchpad_bugs:
if Lbug['title'] in Jbug['title']:
if Lbug['key'] in Jbug['title'] and \
'Launchpad Bug' in Jbug['title']:
continue
new_title = template.format(Lbug['key']) + Lbug['title']
update_jira_bug(jira, jira.issue(Jbug['key']),
new_title, Jbug['description'],
Jbug['priority']['jira'],
Jbug['status']['jira'])
config = ConfigParser.RawConfigParser()
config.read('sync.cfg')
sync_jira_with_launchpad(url=config.get('JIRA', 'URL'),
user=config.get('JIRA', 'user'),
password=config.get('JIRA', 'password'),
project=config.get('project', 'name'),
project_key=config.get('JIRA', 'project_key'))

View File

@ -1,74 +1,8 @@
Murano
======
Murano Project introduces an application catalog, which allows application
developers and cloud administrators to publish various cloud-ready
applications in a browsable categorised catalog, which may be used by the
cloud users (including the inexperienced ones) to pick-up the needed
applications and services and composes the reliable environments out of them
in a “push-the-button” manner.
DEPRECATED: murano-tests
========================
murano-tests
------------
murano-tests repository contains functional and performance tests for Murano
project. Functional tests are based on behave framework, performance tests
are based on FunkLoad framework. Please, refer to `How to Run`_ section for
details about how to run tests.
**Warning** - this repository is deprecated.
All the tests have been moved to corresponding repositories:
stackforge/murano
stackforge/murano-dashboard
Project Resources
-----------------
* `Murano at Launchpad <http://launchpad.net/murano>`__
* `Wiki <https://wiki.openstack.org/wiki/Murano>`__
* `Code Review <https://review.openstack.org/>`__
* `Sources <https://wiki.openstack.org/wiki/Murano/SourceCode>`__
* `Developers Guide <http://murano-docs.github.io/latest/developers-guide/content/ch02.html>`__
How To Participate
------------------
If you would like to ask some questions or make proposals, feel free to reach
us on #murano IRC channel at FreeNode. Typically somebody from our team will
be online at IRC from 6:00 to 20:00 UTC. You can also contact Murano community
directly by openstack-dev@lists.openstack.org adding [Murano] to a subject.
Were holding public weekly meetings on Tuesdays at 17:00 UTC
on #openstack-meeting-alt IRC channel at FreeNode.
If you want to contribute either to docs or to code, simply send us change
request via `gerrit <https://review.openstack.org/>`__.
You can `file bugs <https://bugs.launchpad.net/murano/+filebug>`__ and
`register blueprints <https://blueprints.launchpad.net/murano/+addspec>`__ on
Launchpad.
How to Run
==========
Tests For Web UI
----------------
The web UI tests allow to perform complex integration testing with REST API
service, REST API client, orchestrator component and Murano
dashboard component. The simplest way to execute webUI tests is to run tox.
Functional Tests For REST API service
-------------------------------------
To run all functional tests for REST API service need to run behave
with the following command::
# cd murano-tests/rest_api_tests/functional <br>
# behave rest_api_service.feature <br>
Note: need to set the correct configuration for REST API service. Please,
check config.ini file for more detailed information.
Performance Tests For REST API service
--------------------------------------
To run all performance tests for REAT API service need to run func
load banch with the following command::
# cd murano-tests/rest_api_tests/load_and_performance <br>
# fl-run-bench test_rest.py TestSuite.mix_for_load_testing <br>
# fl-build-report --html --output-directory=html result-bench.xml <br>
After that we can find the html report in the same folder.
Note: need to set the correct configuration for REST API service.
Please, check config.ini file for more detailed information.

View File

@ -1,6 +0,0 @@
Robotframework-Boffin
==========================
This library extends available keywords of Robotframework and robotframework-selenium2library.
And provides keywords for REST requests testing.

View File

@ -1,54 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from ConfigParser import ConfigParser
from os import getcwd
from os.path import join
from robot.libraries.BuiltIn import BuiltIn
_settingsFileName = 'settings.ini'
class _SettingsReader(object):
""" 'settings.ini' driver. """
@staticmethod
def read():
"""
Loads default variables from the 'resources/settings.ini' file.
Arguments:
- None.
Return:
- None.
"""
try:
p = BuiltIn().get_variable_value('${resources_path}')
if p is not None:
_settingsFullFileName = join(p, _settingsFileName)
else:
_settingsFullFileName = join(getcwd(), 'resources',
_settingsFileName)
conf = ConfigParser()
conf.read(_settingsFullFileName)
for setting in conf.options('default'):
BuiltIn().set_global_variable('${%s}' % setting,
conf.get('default', setting))
except:
pass

View File

@ -1,54 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from os.path import join, dirname
from Selenium2Library import Selenium2Library
from _Settings import _SettingsReader
from keywords import *
execfile(join(dirname(__file__), 'version.py'))
__version__ = VERSION
_SettingsReader.read()
class WebUIlib(Selenium2Library, _WebUIlib):
"""
This class supports WebUi related testing using the Robot Framework.
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LIBRARY_VERSION = VERSION
class Rest(_Rest):
"""
This class supports Rest related testing using the Robot Framework.
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LIBRARY_VERSION = VERSION
class DB(Pydblibrary):
"""
This library supports database-related testing using the Robot Framework.
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LIBRARY_VERSION = VERSION

View File

@ -1,238 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import json
import requests
from robot.api import logger
class _Rest(object):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
headers = None
body = None
url = None
def clear_headers(self):
"""
Clears headers for REST API requests.
*Arguments:*
- None.
*Return:*
- None.
*Examples*:
| Clear Headers |
"""
self.headers = []
def set_headers(self, headers_dict):
"""
Configures headers for REST API requests.
*Arguments:*
- headers_dict: string with json dict.
*Return:*
- None.
*Examples*:
| Set Headers | {'Content-Type': 'application/json' |
"""
try:
self.headers = json.loads(headers_dict)
except:
raise AssertionError('Incorrect headers: %s' % headers_dict)
def update_headers(self, name, value):
"""
Modifies headers for REST API requests.
*Arguments:*
- name: header name.
- value: header value.
*Return:*
- None.
*Examples*:
| Update Headers | X-Auth-Token | 8808880808080808 |
"""
self.headers[name] = value
def set_body(self, body_dict):
"""
This function allows to configure body for REST API requests.
*Arguments:*
- body_dict: string with json dict.
*Return:*
- None.
*Examples*:
| Set Headers | {'Content-Type': 'application/json' |
"""
self.body = body_dict
def get_headers(self):
"""
Gets headers for REST API requests.
*Arguments:*
- None.
*Return:*
- Headers dict.
*Examples*:
| ${headers} | Get Headers |
"""
return self.headers
def GET_request(self, url):
"""
Sends GET request.
*Arguments:*
- url: destination url.
*Return:*
- None.
Examples:
| GET request | http://10.10.10.1:8082/environments |
"""
self.response = requests.request('GET', url=url, headers=self.headers)
def POST_request(self, url):
"""
Sends POST request.
*Arguments:*
- url: destination url.
*Return:*
- None.
*Examples*:
| POST request | http://10.10.10.1:8082/environments |
"""
debug_data = 'POST Request to URL: %s \n' \
'with Headers: %s \n' \
'and Body: %s' % (url, self.headers, self.body)
logger.debug(debug_data)
self.response = requests.request('POST', url,
headers=self.headers,
data=self.body)
logger.debug('Response: %s' % self.response.text)
def POST_request_without_body(self, url):
"""
Sends POST request without body.
*Arguments:*
- url: destination url.
*Return:*
- None.
*Examples*:
| POST request | http://10.10.10.1:8082/environments |
"""
debug_data = 'POST Request to URL: %s \n' \
'with Headers: %s \n' % (url, self.headers)
logger.debug(debug_data)
self.response = requests.request('POST', url,
headers=self.headers)
logger.debug('Response: %s' % self.response.text)
def DELETE_request(self, url):
"""
Sends DELETE request.
*Arguments:*
- url: destination url.
*Return:*
- None.
*Examples*:
| DELETE request | http://10.10.10.1:8082/environments |
"""
self.response = requests.request('DELETE', url=url,
headers=self.headers)
def PUT_request(self, url):
"""
Sends PUT request.
*Arguments:*
- url: destination url.
*Return:*
- None.
*Examples*:
| PUT request | http://10.10.10.1:8082/env |
"""
debug_data = 'POST Request to URL: %s \n' \
'with Headers: %s \n' \
'and Body: %s' % (url, self.headers, self.body)
logger.debug(debug_data)
self.response = requests.request('PUT', url,
headers=self.headers,
data=self.body)
logger.debug('Response: %s' % self.response.text)
def get_response_code(self):
"""
Gets response code.
*Arguments:*
- None.
*Return:*
- response code.
*Examples*:
| ${code} | Get Response Code |
"""
return self.response.status_code
def get_response_body(self):
"""
Gets response body.
*Arguments:*
- None.
*Return:*
- response body.
*Examples*:
| ${body} | Get Response Body |
"""
logger.debug('Response: %s' % self.response.text)
if self.response.text is None:
self.response.text = {}
return json.loads(self.response.text)

View File

@ -1,328 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from ConfigParser import ConfigParser
from os import getcwd
from os.path import join
from bs4 import BeautifulSoup
from robot.libraries.BuiltIn import BuiltIn
class _ArtificialIntelligence:
"""
This class allows to find input and select controls \
without manual input of identificators.
We can find input fields by labels near those fields. \
Boffin heart.
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
def __init__(self, page_source):
"""
Class constructor.
*Arguments:*
- page_source: web page source code.
*Return:*
- None.
"""
self.page_source = page_source
def _get_xpath_of_element(self, element):
"""
This function allows to get xpath of soup elements.
*Arguments:*
- element: selector name.
*Return:*
- element xpath.
"""
number = 1
try:
number += len(element.find_previous_siblings(element.name))
except:
pass
xpath = element.name
if number > 1:
xpath += '[' + str(number) + ']'
for parent in element.findParents():
if parent.name != '[document]':
k = 0
for tag in parent.find_previous_siblings():
if tag.name == parent.name:
k += 1
if k == 0:
xpath = parent.name + '/' + xpath
else:
xpath = parent.name + '[' + str(k + 1) + ']/' + xpath
return xpath
def extra_search(self, soup, value, tag=None):
"""
This function allows to get element by its parameters.
*Arguments:*
- soup: soup structure.
- value: element name.
*Return:*
- label_element.
"""
label_element = None
if label_element is None:
label_element = soup.find(tag, text=str(value))
if label_element is None:
label_element = soup.find(tag, attrs={'value': value})
if label_element is None:
label_element = soup.find(tag, attrs={'title': value})
if label_element is None:
try:
for element in soup.find_all(tag):
if str(value) in element.text:
label_element = element
except:
pass
return label_element
def find_element(self, label, element_type='input', method='next',
result='xpath'):
"""
Looks for specified element on the page.
*Arguments:*
- label: selector name.
- element_type: element tag name. It could be any tag or \
several tags (then they are listed as 'select/input/a').
- method: element search method. If 'next' is set, then \
function is looking for the next input field after the \
specified element.
Otherwise it returns the specified element itself.
*Return:*
- element xpath.
*Examples:*
| ${xpath} | Find element | E-mail | input | next |
| ${xpath} | Find element | Cancel | a/div | this |
"""
html = str(self.page_source.encode("utf-8", "replace"))
" load html to soup structure for parsing "
soup = BeautifulSoup(html)
" search element after the label"
try:
element_types = element_type.split('/')
element = None
label_element = self.extra_search(soup, label)
for element_type in element_types:
if method == 'next':
element = label_element.parent.find_next(element_type)
elif method == 'previous':
element = label_element.parent.find_previous(element_type)
elif method == 'associated':
for t in ['a', 'button', 'input', 'select']:
elements = label_element.parent.find_all_next(t)
for e in elements:
if element_type in e.text:
element = e
if element:
break
elements = label_element.parent.find_all_previous(t)
for e in elements:
if element_type in e.text:
element = e
if element:
break
else:
element = self.extra_search(soup, label, element_type)
if element:
break
" return xpath of element "
if result == 'xpath':
return self._get_xpath_of_element(element)
else:
return element
except:
return None
class _Utils(object):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
def get_element_from_repo(self, element_name):
"""
Returns element type, identificator and frame from \
the 'resources/objrepo/%screen_name%.ini' file by element name.
*Arguments:*
- elementName: screen name and selector name divided by dot.
*Return:*
- <list> [elType, elIdentificator, elFrame].
*Example:*
| @{element} | Get Element From Repo | Home . Banner Page 2 Button |
"""
try:
p = BuiltIn().get_variable_value('${resources_path}')
if p is not None:
_objRepoPath = join(p, 'objrepo')
else:
_objRepoPath = join(getcwd(), 'resources', 'objrepo')
element_name = element_name.lower().replace(' ', '')
print "Element Name: " + element_name
inputElement = element_name.split('.')
if len(inputElement) == 1:
fileName = 'common.ini'
name = element_name
else:
fileName = '%s.ini' % inputElement[0]
name = inputElement[1]
fullFileName = join(_objRepoPath, fileName)
print "fullFileName " + fullFileName
conf = ConfigParser()
conf.read(fullFileName)
print "A: " + conf.get(str(name), 'type')
print "A: " + conf.get(name, 'type')
if not conf.has_section(name):
print name
return ['', None, '']
element_type = conf.get(name, 'type')
element_identificator = ''
element_parent_name = conf.get(name, 'parent')
if element_parent_name:
element_identificator = \
self.get_element_from_repo(element_parent_name)[1] + \
element_identificator
element_identificator += conf.get(name, 'identificator')
element_frame = conf.get(name, 'frame')
return [element_type, element_identificator, element_frame]
except:
return ['', None, '']
def get_web_element_frame(self, elementName):
"""
Returns element frame by its name in the
'resources/objrepo/%screen_name%.ini' file.
*Arguments:*
- elementName: screen name and selector name divided by dot.
*Return:*
- elFrame.
*Example:*
| ${elFrame} | GetElementFrame | Blog . Post Text field |
"""
type, id, frame = self.get_element_from_repo(elementName)
return frame
def get_web_element_selector(self, name, page_source=None,
element_type='input', method='next',
result='xpath'):
"""
Returns element selector by its name in the \
'resources/ObjRepo.ini' file.
*Arguments:*
- name: selector name.
- page_source: web page source code.
- element_type: element tag name. It could be any tag or several \
tags (then they are listed as 'select/input/a').
- method: element search method. If 'next' is set, then function
is looking for the next input field after the specified element.
Otherwise it returns the specified element itself.
*Return:*
- elIdentificator.
*Examples:*
| ${selector} | Get element selector | User Name | ${source_code} \
| input | next |
| ${selector} | Get element selector | Submit Button | ${source_code} \
| a | this |
"""
type, id, frame = self.get_element_from_repo(name)
if not id and page_source:
boffin = _ArtificialIntelligence(page_source)
id = boffin.find_element(name, element_type, method, result)
if result != 'xpath':
return id
if id:
type = 'xpath'
identificator = None
if id:
identificator = '%s%s' % \
('' if not type else '%s=' % str(type), str(id))
return identificator
def get_table_row_xpath(self, page_source, name):
"""
This method allows to parse tables on web pages \
and determine the table row by element from table.
*Arguments:*
- page_source: web page source code.
- name: identificator of row element.
*Return:*
- xpath of table row.
*Example:*
| ${elXpath} | Get Table Row Xpath | Entity 123 |
"""
_type = 'td/a/label/input/select'
element = self.get_web_element_selector(name, page_source,
_type, method='this',
result='element')
tag = element.name
while tag != 'tr' and tag:
try:
tag = element.parent.name
element = element.parent
except:
tag = None
pass
e = _ArtificialIntelligence(page_source)
return e._get_xpath_of_element(element)

View File

@ -1,668 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc
#
# Licensed under the Apache License, Version 2 0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www apache org/licenses/LICENSE-2 0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License
from time import sleep
from robot.libraries.BuiltIn import BuiltIn
from _Utils import _Utils
# Decorator for framed elements.
def _framed(framed_element_name):
def real_framed(function):
def wrapper(self, *args):
co_varnames = function.func_code.co_varnames
upper_varnames = [varnames.upper() for varnames in co_varnames]
index = upper_varnames.index(framed_element_name.upper())
element_frame = \
self.get_web_element_frame(args[index - 1])
if element_frame:
self.set_current_frame(element_frame)
res = function(self, *args)
if element_frame:
self.unselect_frame()
return res
return wrapper
return real_framed
class _WebUIlib(_Utils):
def navigate_to(self, path, dont_wait=None):
"""
Navigates to the page by given links sequence.
*Arguments:*
- path: sequence of links separated by '>'.
- dont_wait: optional parameter. Should be set to skip waiting \
for page loaded.
*Return:*
- None.
*Examples:*
| Navigate to | Careers>Account Executive |
"""
links = path.split('>')
for link in links:
self.click_link(link)
self.wait_for_page_loaded(dont_wait)
@_framed('over_element_name')
def click_on_submenu(self, over_element_name, name, dont_wait=None):
"""
Puts mouse over menu element and then clicks on submenu element by \
given selector names and waits for page loaded if needed.
*Arguments:*
- over_element_name: menu selector title taken from object \
repository.
- name: submenu selector title taken from object repository.
- dont_wait: optional parameter. Should be set to skip waiting \
for page loaded.
*Return:*
- None.
*Examples:*
| Click on submenu | Settings | Profile |
"""
self.put_mouse_over(over_element_name)
sleep(1)
self.click_on(name)
self.wait_for_page_loaded(dont_wait)
def click_on_link(self, link, dont_wait=None):
"""
Clicks the link by given localor and waits for page loaded if needed.
*Arguments:*
- link: this attribute can contain one of following: id, name, \
href or link text.
- dont_wait: optional parameter. Should be set to skip waiting \
for page loaded.
*Return:*
- None.
*Examples:*
| Click on link | Move to Trash |
| Click on link | Delete | don't wait |
"""
self.wait_for_element_found(link, 'a', 'this')
self.click_link(link)
self.wait_for_page_loaded(dont_wait)
def wait_for_page_loaded(self, dont_wait=None, page_load_timeout=60):
"""
Waits for 'complete' page state during predefined page load timeout.
Does not wait for page loading if wait argument is set to any value \
except the ${empty}.
*Arguments:*
- dont_wait: optional parameter. Should be set to skip waiting \
for page loaded.
- page_load_timeout: optional parameter. Timeout for page loading.
*Return:*
- None.
*Examples:*
| Wait for page loaded |
| Wait for page loaded | don't wait |
"""
ajax_wait_timeout = \
BuiltIn().get_variable_value('${ajax_wait_timeout}')
if ajax_wait_timeout:
self.wait_for_condition('return window.jQuery.active == 0',
ajax_wait_timeout,
'Ajax request was not loaded in '
'%s second(s)' % ajax_wait_timeout)
if not dont_wait:
self.wait_for_condition('return document.readyState == "complete"',
page_load_timeout,
'Page was not loaded in '
'%s second(s)' % page_load_timeout)
def title_should_contain(self, text):
"""
Verifies that current page title contains given text.
*Arguments:*
- text: text which should be in the title set in test case.
*Return:*
- None.
*Examples:*
| Title should contain | Account Executive |
"""
title = self.get_title()
BuiltIn().should_contain(title, text)
@_framed('name')
def click_on(self, name, dont_wait=None):
"""
Clicks the element by given selector name and waits for page loaded \
if needed.
*Arguments:*
- name: selector title taken from object repository.
- dont_wait: optional parameter. Should be set to skip waiting \
for page loaded.
*Return:*
- None.
*Examples:*
| Click on | Dashboard . Users button |
"""
selector = self.wait_for_element_found(name, 'button/input/a', 'this')
self.click_element(selector)
self.wait_for_page_loaded(dont_wait)
def set_current_frame(self, name):
"""
Sets frame identified by given selector name as current frame.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Set current frame | Post Editor Frame |
"""
selector = self.get_web_element_selector(name)
self.select_frame(selector)
def element_text_should_contain(self, name, text):
"""
Verifies that element with given selector type contains the given text.
*Arguments:*
- name: selector title taken from object repository.
- text: text to be found set in test.
*Return:*
- None.
*Examples:*
| Element Text Should Contain | Dashboard . Message text | \
Post Updated |
"""
selector = self.get_web_element_selector(name)
self.element_should_contain(selector, text)
def element_text_should_be_equal_to(self, name, text):
"""
Verifies that element with given selector type equals to the \
given text.
*Arguments:*
- name: selector title taken from object repository.
- text: text to be found set in test.
*Return:*
- None.
*Examples:*
| Element Text Should Be Equal To | Dashboard . Message text | \
User deleted |
"""
selector = self.get_web_element_selector(name)
self.element_text_should_be(selector, text)
def element_text_should_not_contain(self, name, text):
"""
Verifies that element with given selector type not contain the \
given text.
*Arguments:*
- name: selector title taken from object repository.
- text: text to be found set in test.
*Return:*
- None.
*Examples:*
| Element Text Should Not Contain | Dashboard . Message text \
| Post Updated. |
"""
selector = self.get_web_element_selector(name)
self.element_should_not_contain(selector, text)
def element_text_should_not_be_equal_to(self, name, text):
"""
Verifies that element text with given selector type not qual to the \
given text.
*Arguments:*
- name: selector title taken from object repository.
- text: text to be found set in test.
*Return:*
- None.
*Examples:*
| Element Text Should Not Be Equal To | Dashboard . Message text \
| Post Updated. |
"""
selector = self.get_web_element_selector(name)
self.element_text_should_not_be(selector, text)
def element_should_not_contain(self, selector, text):
"""
Verifies element identified by given selector does not contain \
given text.
*Arguments:*
- selector: element identificator in the object repository.
- text: text to be checked.
*Return:*
- None.
*Examples:*
| Element Should Not Contain | xpath=//div[@id='moderated']/p \
| rude message |
"""
obj_text = self.get_text(selector)
BuiltIn().should_not_contain(obj_text, text)
def element_text_should_not_be(self, selector, text):
"""
Verifies element identified by given selector does not equal to the \
given text.
*Arguments:*
- selector: element identificator in the object repository.
- text: text to be checked.
*Return:*
- None.
*Examples:*
| Element Should Not Be | xpath=//div[@id='moderated']/p \
| rude message |
"""
obj_text = self.get_text(selector)
BuiltIn._should_not_be_equal(obj_text, text)
def page_should_have_number_of_elements(self, count, name):
"""
Verifies that current page contains given number of elements with \
given selector type.
*Arguments:*
- count: number of element to be found.
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Page should have number of elements | 4 | Banner Buttons |
"""
element = self.get_element_from_repo(name)
self.xpath_should_match_x_times(element[1], count)
def page_should_have_element(self, name):
"""
Verifies that current page contains given element.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Page should have element | Contact Us button |
"""
selector = self.get_web_element_selector(name)
self.page_should_contain_element(selector)
def page_should_not_have_element(self, name):
"""
Verifies that current page does not contain given element.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Page should not have element | Contact Us button |
"""
selector = self.get_web_element_selector(name)
self.page_should_not_contain_element(selector)
def put_mouse_over(self, name):
"""
Simulates hovering mouse over the element specified by selector name.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Put mouse over | Dashboard . Posts button |
"""
selector = self.get_web_element_selector(name)
self.mouse_over(selector)
@_framed('field_name')
def fill_field(self, field_name, text):
"""
Gets element by its field name and fills it with given text.
Note: If field name will be 'password' then \
${text} won't be logged.
*Arguments:*
- field_name: selector title taken from object repository.
- text: text to be entered into field.
*Return:*
- None.
*Examples:*
| Fill field | Dashboard . New Post Title field | Test blog-post |
"""
selector = self.wait_for_element_found(field_name, 'input/textarea',
'next')
if 'PASSWORD' in field_name.upper():
self.input_password(selector, text)
else:
self.input_text(selector, '')
self.input_text(selector, text)
def wait_for_element_found(self, element_name, element_type, method):
"""
Makes 10 retries to get element by its name with defined retry \
interval (1 second).
*Arguments:*
- element_name: selector title taken from object repository;
- element_type: element tag, could take several tags at once \
(e.g. select/input/a);
- method: a method of how to search for the element.
*Return:*
- selector: element identificator from object repository.
*Examples:*
| ${selector} | Wait for element found | Dashboard Menu Title field \
| input | next |
"""
for attempt in range(10):
try:
page_source_code = self.get_source()
selector = self.get_web_element_selector(element_name,
page_source_code,
element_type,
method)
except:
pass
if selector:
break
sleep(1)
if not selector:
BuiltIn().run_keyword('Capture Page Screenshot')
raise AssertionError('Web element "%s" was not found in object '
'repository and on page.' % element_name)
return selector
@_framed('name')
def select_item_from_list(self, name, item_name):
"""
Selects specified item from given list.
*Arguments:*
- name: selector title taken from object repository.
- item_name: list box item.
*Return:*
- None.
*Examples:*
| Select item from list | Dashboard . User Action dropdown | Delete |
"""
selector = self.wait_for_element_found(name, 'select', 'next')
self.select_from_list(selector, item_name)
@_framed('name')
def set_checkbox_on(self, name):
"""
Set checkbox with given title on.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Set checkbox on | Dashboard . Delete Posts Role checkbox |
"""
selector = self.wait_for_element_found(name, 'select', 'previous')
self.select_checkbox(selector)
@_framed('name')
def set_checkbox_off(self, name):
"""
Set checkbox with given title off.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Set checkbox off | Dashboard . Delete Posts Role checkbox |
"""
selector = self.wait_for_element_found(name, 'select', 'previous')
self.unselect_checkbox(selector)
@_framed('from_name')
def drag_and_drop_to(self, from_name, to_name):
"""
Drags and drops from one given element to other.
*Arguments:*
- from_name: selector title taken from object repository to get \
content from;
- to_name: selector title taken from object repository to put \
content to.
*Return:*
- None.
*Examples:*
| Drag And Drop To | Photo gallery | User avatar |
"""
from_selector = self.wait_for_element_found(from_name,
'button/input/a/img/div',
'this')
to_selector = self.wait_for_element_found(to_name,
'button/input/a/img/div',
'this')
self.drag_and_drop_to(from_selector, to_selector)
def find_associated_element(self, first_element, desired_element):
"""
This method allows to find element, which located near other element \
and returns xpath of this element.
Sometimes we have many identical elements on page and we can find \
correct element based on nearest unique elements.
*Arguments:*
- First_Element: base element, near this element we want to find \
other element.
- Desired_Element: this is element which we want to find.
*Return:*
- xpath of Desired_Element or None
*Examples:*
| {element_xpath} | Find Associated Element | MyUniqueElement \
| DesiredElement |
"""
element = self.wait_for_element_found(first_element, desired_element,
'associated')
return element
@_framed('name')
def select_radio_by_selector(self, name, value):
"""
Sets selection of radio button group identified by selector name \
to value.
*Arguments:*
- name: selector title taken from object repository.
- value: value to be selected, is used for the value attribute or \
for the id attribute.
*Return:*
- None.
*Examples:*
| Select Radio By Selector | Dashboard . Questionnaire | Yes |
"""
selector = self.wait_for_element_found(name, 'input', 'previous')
self.select_radio_button(selector, value)
def get_table_row_with(self, element):
"""
This method allows to find table row with specific element. \
After this xpath of table row can be used like base for xpath of \
different elements in this table.
*Arguments:*
- element: the unique element from table.
*Return:*
- xpath of table row for this element
*Examples:*
| {table_xpath} | Get Table Row With | MyUniqueElement |
| Click Element \ \ | xpath={table_xpath}/td[4]/button |
"""
source_code = self.get_source()
result = self.get_table_row_xpath(source_code, element)
return result
@_framed('name')
def element_should_be_invisible(self, name):
"""
Verifies that element is invisible on the page.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Element Should Be Invisible | Dashboard . Post Publish button |
"""
selector = self.wait_for_element_found(name,
'button/input/a/img',
'this')
self.element_should_not_be_visible(selector)
@_framed('name')
def element_should_not_be_invisible(self, name):
"""
Verifies that element is visible on the page.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Element Should Not Be Invisible | Dashboard . Post Publish button |
"""
selector = self.wait_for_element_found(name,
'button/input/a/img',
'this')
self.element_should_be_visible(selector)
@_framed('name')
def get_element_text(self, name):
"""
Gets text of given element.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- text of element.
*Examples:*
| ${text} | Get Element Text | Main header |
"""
selector = self.wait_for_element_found(name,
'button/input/a/img',
'this')
text = self.get_text(selector)
return text
@_framed('name')
def get_attribute_of_element(self, name, attribute):
"""
Gets attribute of given element.
*Arguments:*
- name: selector title taken from object repository.
- attribute: attribute that would be taken.
*Return:*
- text of element attribute.
*Examples:*
| ${id_text} | Get Attribute Of Element | Main header | id |
"""
selector = self.wait_for_element_found(name,
'button/input/a/img',
'this')
attr_selector = '%s@%s' % (selector, attribute)
attr_text = self.get_element_attribute(attr_selector)
return attr_text

View File

@ -1,23 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from _WebUIlib import _WebUIlib
from _Rest import _Rest
from Pydblibrary import Pydblibrary
__all__ = [
'_WebUIlib',
'_Rest',
'Pydblibrary'
]

View File

@ -1 +0,0 @@
VERSION = '1.0rc3'

View File

@ -1,103 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Please, install python before run this script.
# Also, please, do not forget to install the following packages for tests:
# robotframework, robotframework-selenium2library, BeautifulSoup4
from subprocess import Popen
from argparse import ArgumentParser
from time import sleep
from os import listdir
from os.path import join, split
def wait_for_finished(threads):
"""
Wait until threads finish.
"""
for ind, t in enumerate(threads):
if t.poll() is not None:
threads.pop(ind)
sleep(1)
s = "This script allows to run Robot Framework tests concurrently."
parser = ArgumentParser(description=s)
parser.add_argument("-n", dest="processes_count",
default=1, type=int,
help="The number of parallel threads (1 by default).")
parser.add_argument('-s', dest='script_name',
default=None, type=str,
help='The name of file with tests or name pattern.')
parser.add_argument('-l', dest='scripts_list',
default=None, nargs='*',
help='Names of test files separated by spaces.')
parser.add_argument('--runfailed', dest='run_failed',
default=None, type=str)
parser.add_argument("-t", dest="tag", type=str)
parser.add_argument('--name', dest='name', type=str)
parser.add_argument('-r', dest='reports_dir',
default="reports", type=str)
parser.add_argument('--IP', dest='IP', type=str)
args = parser.parse_args()
i = 1
tags_list = []
parallel_script = args.script_name+'_parallel.txt'
o = open(parallel_script,'w')
for line in open(args.script_name):
if args.tag in line:
new_tag = args.tag + str(i)
line = line.replace(args.tag, new_tag)
if not new_tag in tags_list:
tags_list.append(new_tag)
i += 1
if i > args.processes_count:
i = 1
o.write(line)
o.close()
cmd = 'pybot -C off -K off -d %s/%s'
# Start all threads with tests.
if args.script_name:
cmd += ' -i %s --name ' + args.name + ' --variable IP:' + args.IP + ' '
if args.run_failed:
cmd += '--runfailed ' + args.run_failed + ' '
cmd += parallel_script + ' >/dev/null 2>&1'
# Start all threads with tests and ignore empty threads.
threads = []
for i, tag in enumerate(tags_list):
values = (args.reports_dir, i, tag)
print cmd % values
threads.append(Popen(cmd % values, shell=True))
sleep(5)
while len(threads) == args.processes_count:
wait_for_finished(threads)
# Wait for all threads finish.
while len(threads) > 0:
wait_for_finished(threads)
sleep(1)

View File

@ -1,51 +0,0 @@
package { ['xvfb',
'x11-xkb-utils',
'xfonts-100dpi',
'xfonts-75dpi',
'xfonts-scalable',
'xfonts-cyrillic',
'xserver-xorg-core']:
ensure => latest,
}
exec {'Create new virtual desktop1':
require => [ Package['xvfb'],
Package['x11-xkb-utils'],
Package['xfonts-100dpi'],
Package['xfonts-75dpi'],
Package['xfonts-scalable'],
Package['xfonts-cyrillic'],
Package['xserver-xorg-core'] ],
command => 'Xvfb -fp /usr/share/fonts/X11/misc/ :20
-screen 0 1024x768x16 2>&1; echo "ok"',
user => 'root',
provider => shell,
path => '/usr/bin',
}
exec {'Create new virtual desktop2':
require => [ Package['xvfb'],
Package['x11-xkb-utils'],
Package['xfonts-100dpi'],
Package['xfonts-75dpi'],
Package['xfonts-scalable'],
Package['xfonts-cyrillic'],
Package['xserver-xorg-core'] ],
command => 'Xvfb -fp /usr/share/fonts/X11/misc/ :21
-screen 1 1024x768x16 2>&1; echo "ok"',
user => 'root',
provider => shell,
path => '/usr/bin',
}
exec {'Create new virtual desktop3':
require => [ Package['xvfb'],
Package['x11-xkb-utils'],
Package['xfonts-100dpi'],
Package['xfonts-75dpi'],
Package['xfonts-scalable'],
Package['xfonts-cyrillic'],
Package['xserver-xorg-core'] ],
command => 'Xvfb -fp /usr/share/fonts/X11/misc/ :22
-screen 2 1024x768x16 2>&1; echo "ok"',
user => 'root',
provider => shell,
path => '/usr/bin',
}

View File

@ -1,128 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Please, install python before run this script.
# Also, please, do not forget to install the following packages for tests:
# robotframework, robotframework-selenium2library, BeautifulSoup4
from subprocess import Popen
from argparse import ArgumentParser
from time import sleep
from os import listdir
from os.path import join, split
from xvfbwrapper import Xvfb
def wait_for_finished(threads):
"""
Wait until threads finish.
"""
for ind, t in enumerate(threads):
if t.poll() is not None:
threads.pop(ind)
sleep(1)
s = "This script allows to run Robot Framework tests concurrently."
parser = ArgumentParser(description=s)
parser.add_argument("-n", action="store", dest="processes_count",
default=1, type=int,
help="The number of parallel threads (1 by default).")
req_group = parser.add_mutually_exclusive_group(required=True)
req_group.add_argument('-s', action='store', dest='script_name',
default=None, type=str,
help='The name of file with tests or name pattern.')
req_group.add_argument('-l', action='store', dest='scripts_list',
default=None, nargs='*',
help='Names of test files separated by spaces.')
req_group.add_argument('-d', action='store', dest='tests_dir',
default=None, type=str,
help='The name of directory with tests to be executed.')
parser.add_argument("-t", action="store", dest="tags_list",
default=None, nargs='*',
help="Test tags separated by spaces. Should be specified "
"with SCRIPT_NAME argument.")
parser.add_argument('-R', action='store', dest='resources_dir',
default=None, type=str,
help='The resources directory path (e.g. '
'samples/mirantis.com/resources/).')
parser.add_argument('-r', action='store', dest='reports_dir',
default="reports", type=str,
help='The directory name with reports '
'("reports" directory by default).')
args = parser.parse_args()
clear_displays = Popen('sudo pkill Xvfb; rm -rf /tmp/.X*-lock', shell=True)
while clear_displays.poll() is None:
sleep(1)
# Generate the command for executing tests.
cmd = 'sudo su thread%s -c "export DISPLAY=:%s; pybot -C off -K off -d %s/%s'
if args.resources_dir:
cmd += " -v resources_path:" + args.resources_dir + " "
# Start all threads with tests.
if args.tags_list and args.script_name:
cmd += ' -i %s ' + args.script_name + '" 2>/dev/null'
# Start all threads with tests and ignore empty threads.
threads = []
for i, tag in enumerate(args.tags_list):
xvfb = Xvfb()
xvfb.start()
values = (i, xvfb.vdisplay_num, args.reports_dir, i, tag)
threads.append(Popen(cmd % values, shell=True))
while len(threads) == args.processes_count:
wait_for_finished(threads)
sleep(1)
else:
if args.tests_dir:
files = listdir(args.tests_dir)
files = filter(lambda x: x.endswith('.txt'), files)
txt_scripts = [join(args.tests_dir, s) for s in files]
elif args.scripts_list:
txt_scripts = args.scripts_list
elif args.script_name:
txt_scripts = [args.script_name]
cmd += "%s" # script name
threads = []
for i, s in enumerate(txt_scripts):
# values for string formatting:
_, f = split(s)
f_name = f.split('.')[0]
values = ("2%s" % i, f_name, f_name, f_name, s)
# add thread
print "Execute command:\n", cmd % values
threads.append(Popen(cmd % values, shell=True))
while len(threads) == args.processes_count:
wait_for_finished(threads)
sleep(1)
# Wait for all threads finish.
while len(threads) > 0:
wait_for_finished(threads)
clear_displays = Popen('sudo pkill Xvfb; rm -rf /tmp/.X*-lock', shell=True)
while clear_displays.poll() is None:
sleep(1)

View File

@ -1,8 +0,0 @@
[DEFAULT]
type=identifier
frame=
parent=
[newenvironmentname]
type=id
identificator=id_name

View File

@ -1,653 +0,0 @@
*** Settings ***
Suite Setup Open Browser http://172.18.79.83/horizon
Suite Teardown Close All Browsers
Library String
Library Boffin.WebUIlib 20 10
*** Variables ***
${resources_path} /home/user/murano-tests/WebUI/Resources/
*** Test Cases ***
Check Environments Tab
[Tags] thread1 work
Log in WebUI by admin/swordfish
Page should contain element "Environments"
Log out
Create environment
[Tags] thread1 work
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env" for field Environment Name
User click on Create
Page should contain element "env"
Log out
Edit environment
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env1" for field Environment Name
User click on Create
User click on "More" for element "env1"
User click on "Edit Environment" for element "env1"
User set value "edited_env" for field New Environment Name
User click on Save
Page should contain element "edited_env"
Log out
Delete Environment
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env2" for field Environment Name
User click on Create
User click on "More" for element "env2"
User click on "Delete Environment" for element "env2"
User confirms deletion
Page should not contain element "env2"
Log out
Create AD Service
[Tags] work
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env_with_one_ad" for field Environment Name
User click on Create
User click on env_with_one_ad
User click on Create Service
User select "Active Directory" from dropdown list "Service Type"
User click on Next
User set value "ad.nastya" for field Domain Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "P@ssw0rd" for field Recovery password
User set value "P@ssw0rd" for field Confirm password AD
User set value "ad" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "ad.nastya"
Log out
Create IIS service
[Tags] thread1 work
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env_with_one_iis" for field Environment Name
User click on Create
User click on env_with_one_iis
User click on Create Service
User select "Internet Information Service" from dropdown list "Service Type"
User click on Next
User set value "iis-service" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "iis" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "iis-service"
Log out
Create ASP.Net App
[Tags] work
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env_with_one_asp" for field Environment Name
User click on Create
User click on env_with_one_asp
User click on Create Service
User select "ASP.NET Application" from dropdown list "Service Type"
User click on Next
User set value "asp-service" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "git://github.com/Mirantis/murano-mvc-demo.git" for field Git repository
User set value "asp" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "asp-service"
Log out
Create IIS Farm
[Tags] work
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env_with_iis_farm" for field Environment Name
User click on Create
User click on env_with_iis_farm
User click on Create Service
User select "Internet Information Service Web Farm" from dropdown list "Service Type"
User click on Next
User set value "iis_farm" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "iisfarm#" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "iis_farm"
Log out
Create ASP.NET Farm
[Tags] work
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env_with_asp_farm" for field Environment Name
User click on Create
User click on env_with_asp_farm
User click on Create Service
User select "ASP.NET Application Web Farm" from dropdown list "Service Type"
User click on Next
User set value "asp-farm" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "git://github.com/Mirantis/murano-mvc-demo.git" for field Git repository
User set value "aspfarm#" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "asp-farm"
Log out
Create MS SQL Server
[Tags] work
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env_with_one_mssql" for field Environment Name
User click on Create
User click on env_with_one_mssql
User click on Create Service
User select "MS SQL Server" from dropdown list "Service Type"
User click on Next
User set value "ms_sql" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "P@ssw0rd" for field SA password
User set value "P@ssw0rd" for field Confirm password SQL
User set value "sql" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "ms_sql"
Log out
Create MS SQL Cluster
[Tags] work
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env_with_sqlcluster" for field Environment Name
User click on Create
User click on env_with_sqlcluster
User click on Create Service
User create Active Directory ad.mssql
Page should contain element "ad.mssql"
User click on Create Service
User select "MS SQL Cluster Server" from dropdown list "Service Type"
User click on Next
User set value "sql_cluster" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User select "ad.mssql" from dropdown list "Active Directory Domain"
User set value "P@ssw0rd" for field SA password
User set value "P@ssw0rd" for field Confirm password cluster
User set value "sqlcluster#" for field Hostname template
User click on Next
User set value "10.200.0.88" for field Cluster Static IP
User set value "cluster" for field Cluster Name
User set value "AG_name" for field Availability Group Name
User set value "AG_listener_name" for field Availability Group Listener Name
User set value "10.200.0.89" for field Availability Group Listener IP
User set value "user" for field SQL User Name
User set value "P@ssw0rd" for field SQL User Password
User set value "P@ssw0rd" for field Confirm Password
User click on Next
User set value "testbase" for field Database list
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Sleep 3s
Page should contain element "sql_cluster"
Log out
Delete AD service
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "delete_ad" for field Environment Name
User click on Create
User click on delete_ad
User click on Create Service
User select "Active Directory" from dropdown list "Service Type"
User click on Next
User set value "ad.nastya" for field Domain Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "P@ssw0rd" for field Recovery password
User set value "P@ssw0rd" for field Confirm password AD
User set value "ad" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
User click on Delete Service
User confirms deletion
Page should not contain element "ad.nastya"
Log out
Delete IIS service
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "delete_iis" for field Environment Name
User click on Create
User click on delete_iis
User click on Create Service
User select "Internet Information Service" from dropdown list "Service Type"
User click on Next
User set value "iis_service" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "iis" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
User click on Delete Service
User confirms deletion
Page should not contain element "iis_service"
Log out
Delete ASP.NET service
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "delete_asp" for field Environment Name
User click on Create
User click on delete_asp
User click on Create Service
User select "ASP.NET Application" from dropdown list "Service Type"
User click on Next
User set value "asp-service" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "git://github.com/Mirantis/murano-mvc-demo.git" for field Git repository
User set value "asp" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
User click on Delete Service
User confirms deletion
Page should not contain element "asp-service"
Log out
Delete IIS Farm service
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "delete_iis_farm" for field Environment Name
User click on Create
User click on delete_iis_farm
User click on Create Service
User select "Internet Information Service Web Farm" from dropdown list "Service Type"
User click on Next
User set value "iis_farm" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "iisfarm#" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
User click on iis_farm
User confirms deletion
Page should not contain element "iis_farm"
Log out
Delete ASP.NET Farm service
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "delete_asp_farm" for field Environment Name
User click on Create
User click on delete_asp_farm
User click on Create Service
User select "ASP.NET Application Web Farm" from dropdown list "Service Type"
User click on Next
User set value "asp-farm" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "git://github.com/Mirantis/murano-mvc-demo.git" for field Git repository
User set value "aspfarm#" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
User click on Delete Service
User confirms deletion
Page should not contain element "asp-farm"
Log out
Delete MS SQL server
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "delete_mssql" for field Environment Name
User click on Create
User click on delete_mssql
User click on Create Service
User select "MS SQL Server" from dropdown list "Service Type"
User click on Next
User set value "ms_sql" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "P@ssw0rd" for field SA password
User set value "P@ssw0rd" for field Confirm password SQL
User set value "sql" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
User click on Delete Service
User confirms deletion
Page should not contain element "ms_sql"
Log out
Check opportunity to choose availability zone
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env_av_zone" for field Environment Name
User click on Create
User click on env_av_zone
User click on Create Service
User select "Internet Information Service" from dropdown list "Service Type"
User click on Next
User set value "iis-service" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "iis" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User select "nova" from dropdown list "Availability zone"
Log out
Check opportunity to choose Instance Flavor
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env_inst_flavor" for field Environment Name
User click on Create
User click on env_inst_flavor
User click on Create Service
User select "Internet Information Service" from dropdown list "Service Type"
User click on Next
User set value "iis-service" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "iis" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User select "m1.small" from dropdown list "Instance flavor"
User select "m1.large" from dropdown list "Instance flavor"
User select "m1.medium" from dropdown list "Instance flavor"
Log out
Check opportunity to choose Instance Image
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "env_inst_image" for field Environment Name
User click on Create
User click on env_inst_image
User click on Create Service
User select "Internet Information Service" from dropdown list "Service Type"
User click on Next
User set value "iis-service" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "iis" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User select "Windows Server 2012 x64 core Standard edition" from dropdown list "Instance image"
User select "Windows Server 2008 R2 x64 Standard edition" from dropdown list "Instance image"
Log out
Deploy environment with AD Service
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "deploy_one_ad" for field Environment Name
User click on Create
User click on deploy_one_ad
User click on Create Service
User select "Active Directory" from dropdown list "Service Type"
User click on Next
User set value "ad.nastya" for field Domain Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "P@ssw0rd" for field Recovery password
User set value "P@ssw0rd" for field Confirm password AD
User set value "ad" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "ad.nastya"
User click on Deploy This Environment
Check the status of environment "deploy_one_ad" (should be "Ready")
Log out
Deploy environment with IIS Service
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "deploy_iis" for field Environment Name
User click on Create
User click on deploy_iis
User click on Create Service
User select "Internet Information Service" from dropdown list "Service Type"
User click on Next
User set value "iis-service" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "iis" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "iis-service"
User click on Deploy This Environment
Check the status of environment "deploy_iis" (should be "Ready")
Log out
Deploy environment with ASP.NET Service
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "deploy_asp" for field Environment Name
User click on Create
User click on deploy_asp
User click on Create Service
User select "ASP.NET Application" from dropdown list "Service Type"
User click on Next
User set value "asp-service" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "git://github.com/Mirantis/murano-mvc-demo.git" for field Git repository
User set value "asp" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "asp-service"
User click on Deploy This Environment
Check the status of environment "deploy_asp" (should be "Ready")
Log out
Deploy environment with IIS Farm
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "deploy_iis_farm" for field Environment Name
User click on Create
User click on deploy_iis_farm
User click on Create Service
User select "Internet Information Service Web Farm" from dropdown list "Service Type"
User click on Next
User set value "iis_farm" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "iisfarm#" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "iis_farm"
User click on Deploy This Environment
Check the status of environment "deploy_iis_farm" (should be "Ready")
Log out
Deploy environment with ASP.NET Farm
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "deploy_asp_farm" for field Environment Name
User click on Create
User click on deploy_asp_farm
User click on Create Service
User select "ASP.NET Application Web Farm" from dropdown list "Service Type"
User click on Next
User set value "asp-farm" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "git://github.com/Mirantis/murano-mvc-demo.git" for field Git repository
User set value "aspfarm#" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "asp-farm"
User click on Deploy This Environment
Check the status of environment "deploy_asp_farm" (should be "Ready")
Log out
Deploy environment with MS SQL server
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "deploy_mssql" for field Environment Name
User click on Create
User click on deploy_mssql
User click on Create Service
User select "MS SQL Server" from dropdown list "Service Type"
User click on Next
User set value "ms_sql" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "P@ssw0rd" for field SA password
User set value "P@ssw0rd" for field Confirm password SQL
User set value "sql" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "ms_sql"
User click on Deploy This Environment
Check the status of environment "deploy_mssql" (should be "Ready")
Log out
test
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "test" for field Environment Name
User click on Create
Page should contain element "test"
Check status test
Deploy AD with 2 instances
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "deploy_ad_2_inst" for field Environment Name
User click on Create
User click on deploy_ad_2_inst
User click on Create Service
User select "Active Directory" from dropdown list "Service Type"
User click on Next
User set value "ad.nastya.two" for field Domain Name
User set value "2" for field Instance Count
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "P@ssw0rd" for field Recovery password
User set value "P@ssw0rd" for field Confirm password AD
User set value "adtwo#" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "ad.nastya.two"
User click on Deploy This Environment
Check the status of environment "deploy_ad_2_inst" (should be "Ready")
Log out
Deploy MSSQL with 2 instances
Log in WebUI by admin/swordfish
User click on Create Environment
User set value "deploy_mssql" for field Environment Name
User click on Create
User click on deploy_mssql
User click on Create Service
User select "MS SQL Server" from dropdown list "Service Type"
User click on Next
User set value "ms_sql" for field Service Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "P@ssw0rd" for field SA password
User set value "P@ssw0rd" for field Confirm password SQL
User set value "sql" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create
Page should contain element "ms_sql"
User click on Deploy This Environment
Check the status of environment "deploy_mssql" (should be "Ready")
Log out
*** Keywords ***
Log in WebUI by ${user}/${password}
Fill Field User Name ${user}
Fill Field Password ${password}
Click on Sign In
Navigate to Project>Environments
User set value "${value}" for field ${field}
Fill Field ${field} ${value}
Select type of the service
[Arguments] ${type}
Select Item From List Service Type ${type}
Click Button Next
Log out
Click on Sign Out
Page Should Contain Button Sign In
Check the status of environment "${env_name}" (should be "Ready")
Wait Until Keyword Succeeds 20 minute 5s Check status ${env_name}
Check status
[Arguments] ${env_name}
Navigate to Project>Environments
${row} Find Associated Element ${env_name} Ready to configure
User click on
[Arguments] ${arg}
Sleep 2s
Click on ${arg}
Sleep 2s
Page should contain element "${element}"
Sleep 3s
Page Should Contain ${element}
Page should not contain element "${element}"
Page Should Not Contain ${element}
User click on "${button}" for element "${env}"
${element} Find Associated Element ${env} ${button}
Click Element ${element}
User select "${item}" from dropdown list "${menu}"
Select Item From List ${menu} ${item}
User confirms deletion
${element}= Find Associated Element Cancel Delete Environment
Click Link Delete Environment
Sleep 3s
User create Active Directory
[Arguments] ${name}
User select "Active Directory" from dropdown list "Service Type"
User click on Next
User set value "${name}" for field Domain Name
User set value "P@ssw0rd" for field Administrator password
User set value "P@ssw0rd" for field Confirm password
User set value "P@ssw0rd" for field Recovery password
User set value "P@ssw0rd" for field Confirm password AD
User set value "adforsql" for field Hostname template
User click on Next
User select "Windows Server 2012 x64 Standard edition" from dropdown list "Instance image"
User click on Create

View File

@ -1,491 +0,0 @@
*** Settings ***
Library Collections
Resource libs/MuranoRest.txt
*** Variables ***
${ip} 172.18.124.201
${ip_keystone} 172.18.124.201
${user} muranorestapi
${password} swordfish
*** Test Cases ***
Begin of testing
[Tags] thread1
Get X-Auth-Token ${ip_keystone}
Get Headers
Clearing
[Tags] thread1
#Delete All Environments # закоментировано так, на всякий случай.....
${result} Get List Of Environments
#Should Be Empty ${result['environments']}
Get list of environments
[Tags] thread1
${result} Get List Of Environments
${list} Format List ${result['environments']}
Log List ${list}
Create environment
[Tags] thread1
Create Environment test-rest-api-env2
Create/edit/delete environment
[Tags] thread1
${result} Get List Of Environments
${len} Get Length ${result['environments']}
${list} Format List ${result['environments']}
Log List ${list}
Create Environment env_2_del
${result} Get List Of Environments
${len1} Get Length ${result['environments']}
${len1} = Evaluate ${len1} - 1
Should Be Equal As Integers ${len} ${len1}
${list} Format List ${result['environments']}
Log List ${list}
${env_id} Get Environment ID env_2_modify
Should Be Equal ${env_id} None
Update Environment env_2_del env_2_modify
${result} Get List Of Environments
${list} Format List ${result['environments']}
Log List ${list}
${env_id} Get Environment ID env_2_modify
Should Not Be Equal ${env_id} None
Delete Environment env_2_modify
${result} Get List Of Environments
${len2} Get Length ${result['environments']}
#Should Be Equal As Integers ${len} ${len2}
${list} Format List ${result['environments']}
Log List ${list}
Get Environment_ID of previosly created environment
[Tags] thread1
${result} Get Environment ID test-rest-api-env2
Should Not Be Empty ${result}
Create session to previosly created environment
[Tags] thread1
${result} Create session test-rest-api-env2
Set Global Variable ${session_id} ${result['id']}
#${session_id} Set Variable ${result['id']}
Should Not Be Empty ${result['id']}
Get session information_1
[Tags] thread1
Log ${session_id}
${result} Get session information test-rest-api-env2 ${session_id}
Delete session
[Tags] thread1
${result} Delete session test-rest-api-env2 ${session_id}
Get session information_2 and almost empty report
[Tags] thread1
${result} Create session test-rest-api-env2
Set Global Variable ${session_id} ${result['id']}
${result} Get session information test-rest-api-env2 ${session_id}
${result} Get session reports test-rest-api-env2 ${session_id}
Create AD service
[Tags] thread1
Create AD test-rest-api-env2 ad001
List AD services
[Tags] thread1
${result} Get List of AD test-rest-api-env2
${list} Format List ${result['activeDirectories']}
Log List ${list}
${len} Get Length ${result['activeDirectories']}
Should Be Equal as Integers 1 ${len}
Delete AD service
[Tags] thread1
Delete AD test-rest-api-env2 ad001
${result} Get List of AD test-rest-api-env2
${len} Get Length ${result['activeDirectories']}
Should Be Equal as Integers ${len} 0
Create IIS service
[Tags] thread1
Create IIS test-rest-api-env2 iis001
List IIS services
[Tags] thread1
${result} Get List of IIS test-rest-api-env2
${list} Format List ${result['webServers']}
Log List ${list}
${len} Get Length ${result['webServers']}
Should Be Equal as Integers 1 ${len}
Delete IIS service
[Tags] thread1
Delete IIS test-rest-api-env2 iis001
${result} Get List of IIS test-rest-api-env2
${len} Get Length ${result['webServers']}
Should Be Equal as Integers ${len} 0
Create ASP NET service
[Tags] thread1
Create ASP NET test-rest-api-env2 asp001
List ASP NET services
[Tags] thread1
${result} Get List of ASP NET test-rest-api-env2
${list} Format List ${result['aspNetApps']}
Log List ${list}
${len} Get Length ${result['aspNetApps']}
Should Be Equal as Integers 1 ${len}
Delete ASP NET service
[Tags] thread1
Delete ASP NET test-rest-api-env2 asp001
${result} Get List of ASP NET test-rest-api-env2
${len} Get Length ${result['aspNetApps']}
Should Be Equal as Integers ${len} 0
Create ASP NET Farm service
[Tags] thread1
Create ASP NET Farm test-rest-api-env2 aspFarm001
List ASP NET Farm services
[Tags] thread1
${result} Get List of ASP NET Farm test-rest-api-env2
${list} Format List ${result['aspNetAppFarms']}
Log List ${list}
${len} Get Length ${result['aspNetAppFarms']}
Should Be Equal as Integers 1 ${len}
Delete ASP NET Farm service
[Tags] thread1
Delete ASP NET Farm test-rest-api-env2 aspFarm001
${result} Get List of ASP NET Farm test-rest-api-env2
${len} Get Length ${result['aspNetAppFarms']}
Should Be Equal as Integers ${len} 0
Create IIS Farm service
[Tags] thread1
Create IIS Farm test-rest-api-env2 iisFarm001
List IIS Farm services
[Tags] thread1
${result} Get List of IIS Farm test-rest-api-env2
${list} Format List ${result['webServerFarms']}
Log List ${list}
${len} Get Length ${result['webServerFarms']}
Should Be Equal as Integers 1 ${len}
Delete IIS Farm service
[Tags] thread1
Delete IIS Farm test-rest-api-env2 iisFarm001
${result} Get List of IIS Farm test-rest-api-env2
${len} Get Length ${result['webServerFarms']}
Should Be Equal as Integers ${len} 0
Create some services
[Tags] thread1
Create AD test-rest-api-env2 ad001
Create AD test-rest-api-env2 ad002
Create AD test-rest-api-env2 ad005
Create ASP NET test-rest-api-env2 asp005
Create ASP NET test-rest-api-env2 asp005
Create IIS Farm test-rest-api-env2 iisFarm002
Create ASP NET test-rest-api-env2 asp006
Create ASP NET Farm test-rest-api-env2 aspFarm005
Create ASP NET Farm test-rest-api-env2 aspfarm005
Create IIS test-rest-api-env2 iis003
Create IIS Farm test-rest-api-env2 iisFarm003
Create IIS test-rest-api-env2 iis001
Create IIS test-rest-api-env2 iis_001
Create IIS test-rest-api-env2 iis001
Create IIS test-rest-api-env2 iis002
Create AD test-rest-api-env2 ad001
Create IIS Farm test-rest-api-env2 iisFarm002
Create IIS Farm test-rest-api-env2 iisFarm004
Create IIS Farm test-rest-api-env2 iisFarm005
Create IIS Farm test-rest-api-env2 iisFarm006
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
# Check number of ADs
${result} Get List of AD test-rest-api-env2
${list} Format List ${result['activeDirectories']}
Log List ${list}
${len} Get Length ${result['activeDirectories']}
Should Be Equal as Integers 4 ${len}
# Check number of IISs
${result} Get List of IIS test-rest-api-env2
${list} Format List ${result['webServers']}
Log List ${list}
${len} Get Length ${result['webServers']}
Should Be Equal as Integers 5 ${len}
# Check number of ASP NETs
${result} Get List of ASP NET test-rest-api-env2
${list} Format List ${result['aspNetApps']}
Log List ${list}
${len} Get Length ${result['aspNetApps']}
Should Be Equal as Integers 3 ${len}
# Check number of IIS Farms
${result} Get List of IIS Farm test-rest-api-env2
${list} Format List ${result['webServerFarms']}
Log List ${list}
${len} Get Length ${result['webServerFarms']}
Should Be Equal as Integers 6 ${len}
# Check number of ASP NET Farms
${result} Get List of ASP NET Farm test-rest-api-env2
${list} Format List ${result['aspNetAppFarms']}
Log List ${list}
${len} Get Length ${result['aspNetAppFarms']}
Should Be Equal as Integers 2 ${len}
Test of multisession
[Tags] thread1
# Store session
${session1_1} Set Variable ${session_id}
# Create additional sessions
${result} Create session test-rest-api-env2
${session1_2} Set Variable ${result['id']}
${result} Create session test-rest-api-env2
${session1_3} Set Variable ${result['id']}
# Stage 1: Begin of create some services ===================
Update Headers X-Configuration-Session ${session1_1}
Create AD test-rest-api-env2 ad001
Create AD test-rest-api-env2 ad002
Create ASP NET test-rest-api-env2 asp005
Create ASP NET test-rest-api-env2 asp005
Create IIS Farm test-rest-api-env2 iisFarm002
Create ASP NET test-rest-api-env2 asp006
Create ASP NET Farm test-rest-api-env2 aspFarm005
Create ASP NET Farm test-rest-api-env2 aspfarm005
Create IIS test-rest-api-env2 iis003
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
Update Headers X-Configuration-Session ${session1_2}
Create AD test-rest-api-env2 ad001
Create ASP NET test-rest-api-env2 asp005
Create ASP NET test-rest-api-env2 asp005
Create IIS Farm test-rest-api-env2 iisFarm002
Create ASP NET test-rest-api-env2 asp006
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
Update Headers X-Configuration-Session ${session1_3}
Create ASP NET test-rest-api-env2 asp005_3
Create ASP NET test-rest-api-env2 asp005_3
Create IIS Farm test-rest-api-env2 iisFarm002_3
Create ASP NET test-rest-api-env2 asp006_3
Create ASP NET Farm test-rest-api-env2 aspFarm005_3
Create ASP NET Farm test-rest-api-env2 aspfarm005_3
Create IIS test-rest-api-env2 iis003_3
Create IIS Farm test-rest-api-env2 iisFarm003_3
Create IIS test-rest-api-env2 iis001_3
Create IIS test-rest-api-env2 iis_001_3
Create IIS test-rest-api-env2 iis001_3
Create IIS test-rest-api-env2 iis002_3
Create IIS Farm test-rest-api-env2 iisFarm002_3
Create IIS Farm test-rest-api-env2 iisFarm004_3
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
# Stage 2: End of create some services ===================
Update Headers X-Configuration-Session ${session1_1}
Create IIS Farm test-rest-api-env2 iisFarm003
Create IIS test-rest-api-env2 iis001
Create IIS test-rest-api-env2 iis002
Create AD test-rest-api-env2 ad001
Create IIS Farm test-rest-api-env2 iisFarm002
Create IIS Farm test-rest-api-env2 iisFarm004
Create IIS Farm test-rest-api-env2 iisFarm005
Create IIS Farm test-rest-api-env2 iisFarm006
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
Update Headers X-Configuration-Session ${session1_2}
Create ASP NET Farm test-rest-api-env2 aspFarm005
Create ASP NET Farm test-rest-api-env2 aspfarm005
Create IIS test-rest-api-env2 iis003
Create IIS Farm test-rest-api-env2 iisFarm003
Create IIS test-rest-api-env2 iis001
Create IIS test-rest-api-env2 iis_001
Create IIS test-rest-api-env2 iis002
Create AD test-rest-api-env2 ad001
Create IIS Farm test-rest-api-env2 iisFarm002
Create IIS Farm test-rest-api-env2 iisFarm005
Create IIS Farm test-rest-api-env2 iisFarm006
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
Update Headers X-Configuration-Session ${session1_3}
Create AD test-rest-api-env2 ad001_3
Create IIS Farm test-rest-api-env2 iisFarm005_3
Create IIS Farm test-rest-api-env2 iisFarm006_3
# === View services in all sessions ===
Update Headers X-Configuration-Session ${session1_1}
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
Update Headers X-Configuration-Session ${session1_2}
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
Update Headers X-Configuration-Session ${session1_3}
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
# Need control of number created services
# Stage 3: delete some services ===================
Delete IIS test-rest-api-env2 iis_001_3
Delete IIS test-rest-api-env2 iis002_3
Delete IIS Farm test-rest-api-env2 iisFarm006_3
Delete ASP NET Farm test-rest-api-env2 aspfarm005_3
Delete AD test-rest-api-env2 ad001_3
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
Update Headers X-Configuration-Session ${session1_2}
Delete IIS test-rest-api-env2 iis_001
Delete IIS test-rest-api-env2 iis002
Delete AD test-rest-api-env2 ad001
Delete IIS Farm test-rest-api-env2 iisFarm006
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
Update Headers X-Configuration-Session ${session1_1}
Delete AD test-rest-api-env2 ad001
Delete AD test-rest-api-env2 ad002
#Delete ASP NET test-rest-api-env2 asp005
#Delete ASP NET test-rest-api-env2 asp005
#Delete IIS Farm test-rest-api-env2 iisFarm002
Delete ASP NET test-rest-api-env2 asp006
#Delete ASP NET Farm test-rest-api-env2 aspFarm005
Delete ASP NET Farm test-rest-api-env2 aspfarm005
Delete IIS test-rest-api-env2 iis003
#Delete IIS Farm test-rest-api-env2 iisFarm003
Delete IIS test-rest-api-env2 iis001
Delete IIS test-rest-api-env2 iis002
Delete AD test-rest-api-env2 ad001
#Delete IIS Farm test-rest-api-env2 iisFarm002
#Delete IIS Farm test-rest-api-env2 iisFarm004
#Delete IIS Farm test-rest-api-env2 iisFarm005
# Create IIS Farm test-rest-api-env2 iisFarm006 - must be only this
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
# View all services
${list} Get List of All Services test-rest-api-env2
Log List ${list}
Update Headers X-Configuration-Session ${session1_1}
Deploy one AD
Create environment 4kate-ad
${result} Create session 4kate-ad
Set Global Variable ${session_id} ${result['id']}
Create AD 4kate-ad AD_2_deploy
Deploy session 4kate-ad ${session_id}
${rep} Get session reports 4kate-ad ${session_id}
Wait Until Keyword Succeeds 20m 5s Check Environment 4kate-ad ready
Get Environment ID 4kate-ad
${rep2} Get session reports 4kate-ad ${session_id}
${rep3} Format session report ${rep2}
Log List ${rep3}
# Delete environment bigden-ad
Deploy one IIS
Create environment bigden-iis
${result} Create session bigden-iis
Set Global Variable ${session_id} ${result['id']}
Create IIS bigden-iis IIS_2_deploy
Deploy session bigden-iis ${session_id}
${rep} Get session reports bigden-iis ${session_id}
Wait Until Keyword Succeeds 20m 5s Check Environment bigden-iis ready
Get Environment ID bigden-iis
${rep2} Get session reports bigden-iis ${session_id}
${rep3} Format session report ${rep2}
Log List ${rep3}
Delete environment bigden-iis
Deploy one ASP.NET
Create environment bigden-asp
${result} Create session bigden-asp
Set Global Variable ${session_id} ${result['id']}
Create ASP NET bigden-asp ASP_2_deploy
Deploy session bigden-asp ${session_id}
${rep} Get session reports bigden-asp ${session_id}
Wait Until Keyword Succeeds 20m 5s Check Environment bigden-asp ready
Get Environment ID bigden-asp
${rep2} Get session reports bigden-asp ${session_id}
${rep3} Format session report ${rep2}
Log List ${rep3}
Delete environment bigden-asp
Deploy one ASP.NET Farm
Create environment bigden-asp-farm
${result} Create session bigden-asp-farm
Set Global Variable ${session_id} ${result['id']}
Create ASP NET Farm + ASP-Farm_2_deploy
Deploy session bigden-asp-farm ${session_id}
${rep} Get session reports bigden-asp-farm ${session_id}
Wait Until Keyword Succeeds 20m 5s Check Environment bigden-asp-farm ready
Get Environment ID bigden-asp-farm
${rep2} Get session reports bigden-asp-farm ${session_id}
${rep3} Format session report ${rep2}
Log List ${rep3}
Delete environment bigden-asp-farm
Deploy one IIS Farm
Create environment bigden-iis-farm
${result} Create session bigden-iis-farm
Set Global Variable ${session_id} ${result['id']}
Create IIS Farm bigden-iis-farm IIS-Farm_2_deploy
Deploy session bigden-iis-farm ${session_id}
${rep} Get session reports bigden-iis-farm ${session_id}
Wait Until Keyword Succeeds 20m 5s Check Environment bigden-iis-farm ready
Get Environment ID bigden-iis-farm
${rep2} Get session reports bigden-iis-farm ${session_id}
${rep3} Format session report ${rep2}
Log List ${rep3}
Delete environment bigden-iis-farm
Sequence deploy
Create environment bigden-all_service
${result} Create session bigden-all_service
Set Global Variable ${session_id} ${result['id']}
Create AD bigden-all_service AD_2_deploy
Create IIS bigden-all_service IIS_2_deploy
Create ASP NET bigden-all_service ASP.NET_2_deploy
Create ASP NET Farm bigden-all_service ASP.NET_Farm_2_deploy
Create IIS Farm bigden-all_service IIS_Farm_2_deploy
Deploy session bigden-all_service ${session_id}
${rep} Get session reports bigden-all_service ${session_id}
Wait Until Keyword Succeeds 60m 10s Check Environment bigden-all_service ready
Get Environment ID bigden-all_service
${rep2} Get session reports bigden-all_service ${session_id}
${rep3} Format session report ${rep2}
Log List ${rep3}
Delete environment bigden-all_service
Delete created environments
[Tags] thread1
Delete Environment test-rest-api-env2
Delete session after deploy
Create environment bigden-ad
${result} Create session bigden-ad
Set Global Variable ${session_id} ${result['id']}
Create IIS bigden-ad IIS_2_deploy
Deploy session bigden-ad ${session_id}
${rep} Get session reports bigden-ad ${session_id}
Wait Until Keyword Succeeds 60m 20s Check Environment bigden-ad ready
Get Environment ID bigden-ad
${rep2} Get session reports bigden-ad ${session_id}
${rep3} Format session report ${rep2}
Log List ${rep3}
Try to delete session bigden-ad ${session_id}
Delete environment bigden-ad
Try to delete session bigden-ad ${session_id}
*** Keywords ***
Compare reports
[Arguments] ${rep_2_compare} ${ASP_Farm_name}
${rep2} Get session reports test-rest-api-env2 ${session_id}
Should Not Be Equal ${rep} ${rep2}

View File

@ -1,707 +0,0 @@
*** Settings ***
Library Boffin.Rest
Library Collections
*** Keywords ***
Get List Of Environments
[Documentation] Gets list of all environments.
...
... *Arguments:*
... - None.
...
... *Return:*
... - response body with environments.
...
... *Examples:*
... | ${result} | Get List Of Environments |
... | *LOG* | ${result['environments']} |
GET request http://${ip}:8082/environments
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${result} get response body
[Return] ${result}
Create Environment
[Arguments] ${environment_name}
[Documentation] Sends POST request to create new environment.
...
... *Arguments:*
... - environment_name: environment name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Create Environment | env001 |
Set body {"name":"${environment_name}"}
POST request http://${ip}:8082/environments
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${result} get response body
[Return] ${result}
Get Environment ID
[Arguments] ${environment_name}
[Documentation] Gets environment id.
...
... *Arguments:*
... - environment_name: environment name.
...
... *Return:*
... - environment id.
...
... *Examples:*
... | ${id} | Get Environment ID | test |
${environment_id} Set Variable None
${data} Get List Of Environments
@{environments_list} Convert To List ${data['environments']}
: FOR ${x} IN @{environments_list}
\ ${environment_id} = Set Variable If "${x['name']}" == "${environment_name}" ${x['id']} ${environment_id}
[Return] ${environment_id}
Update Environment
[Arguments] ${environment_name} ${new_environment_name}
[Documentation] Sends PUT request to update environment.
...
... *Arguments:*
... - environment_name: environment name.
... - new_environment_name: new environment name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Update Environment | env001 | env001_modify |
Set body {"name":"${new_environment_name}"}
${env_id} Get Environment ID ${environment_name}
PUT request http://${ip}:8082/environments/${env_id}
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${result} get response body
[Return] ${result}
Delete Environment
[Arguments] ${environment_name}
[Documentation] Sends DELETE request to delete one environment.
...
... *Arguments:*
... - environment_name: environment name.
...
... *Return:*
... - None.
...
... *Examples:*
... | Delete Environment | test |
${env_id} Get Environment ID ${environment_name}
DELETE request http://${ip}:8082/environments/${env_id}
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
Delete All Environments
[Documentation] Sends DELETE request to delete all environments.
...
... *Arguments:*
... - None.
...
... *Return:*
... - None.
...
... *Examples:*
... | Delete All Environment |
Get X-Auth-Token ${ip}
${result} Get List Of Environments
@{list} Convert To List ${result['environments']}
: FOR ${environment} IN @{list}
\ Delete Environment ${environment['name']}
Get X-Auth-Token
[Arguments] ${ip} ${user}="admin" ${password}="swordfish"
[Documentation] Gets X-Auth-Token for requests headers.
...
... *Arguments:*
... - ip: ip.
... - user: user name.
... - password: user password.
...
... *Return:*
... - None.
...
... *Examples:*
... | Get X-Auth-Token | 10.10.10.1 |
Set Headers {"Content-Type":"application/json"}
${auth} Set Variable {"auth": {"tenantName": ${user}, "passwordCredentials": {"username": ${user}, "password": ${password}}}}
Set Body ${auth}
POST Request http://${ip}:5000/v2.0/tokens
${body} Get Response Body
Update Headers X-Auth-Token ${body['access']['token']['id']}
Format List
[Arguments] ${list_2_format}
[Documentation] Formats list in pretty view with name and id.
...
... *Arguments:*
... - list_2_format: list that will be formatted.
...
... *Return:*
... - None.
...
... *Examples:*
... | Format List | ${id['environments']} |
${nice_list} = Create List
@{list} Convert To List ${list_2_format}
: FOR ${x} IN @{list}
\ Append To List ${nice_list} ${x['name']}, id: ${x['id']}
Log List ${nice_list}
[Return] ${nice_list}
Get List of All Services
[Arguments] ${environment_name}
[Documentation] Sends GET requests to list all services
... in environment_name. Header must be filled correctly.
...
... *Arguments:*
... - environment_name: environment name.
...
... *Return:*
... - formatted list of services.
...
... *Examples:*
... | Get List of All Services | env001 |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/activeDirectories
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
${nice_list} = Create List
@{list} Convert To List ${resp['activeDirectories']}
: FOR ${x} IN @{list}
\ Append To List ${nice_list} AD: ${x['name']}, id: ${x['id']}
GET request http://${ip}:8082/environments/${env_id}/webServers
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
@{list} Convert To List ${resp['webServers']}
: FOR ${x} IN @{list}
\ Append To List ${nice_list} IIS: ${x['name']}, id: ${x['id']}
GET request http://${ip}:8082/environments/${env_id}/aspNetApps
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
@{list} Convert To List ${resp['aspNetApps']}
: FOR ${x} IN @{list}
\ Append To List ${nice_list} ASP NET: ${x['name']}, id: ${x['id']}
GET request http://${ip}:8082/environments/${env_id}/aspNetAppFarms
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
@{list} Convert To List ${resp['aspNetAppFarms']}
: FOR ${x} IN @{list}
\ Append To List ${nice_list} ASP NET Farm: ${x['name']}, id: ${x['id']}
GET request http://${ip}:8082/environments/${env_id}/webServerFarms
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
@{list} Convert To List ${resp['webServerFarms']}
: FOR ${x} IN @{list}
\ Append To List ${nice_list} IIS Farm: ${x['name']}, id: ${x['id']}
[Return] ${nice_list}
Check Environment
[Arguments] ${environment_name} ${status}
[Documentation] Checks environment for given status.
...
... *Arguments:*
... - environment_name: environment name.
... - status: environment status.
...
... *Return:*
... - None.
...
... *Examples:*
... | Check Environment | test01 | ready |
${r2} Get session reports ${environment_name} ${session_id}
${r3} Format session report ${r2}
Log List ${r3}
${env_id} Get Environment ID ${environment_name}
${environment_status} Set Variable None
${data} Get List Of Environments
@{environments_list} Convert To List ${data['environments']}
: FOR ${x} IN @{environments_list}
\ ${environment_status} = Set Variable If "${x['name']}" == "${environment_name}" ${x['status']} ${environment_status}
Log ${environment_status}
Should Be Equal ${status} ${environment_status}
Create Session
[Arguments] ${environment_name}
[Documentation] Sends POST request to create new session
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - status: environment status.
...
... *Return:*
... - response body.
...
... *Examples:*
... | ${result} | Create Session | env001 |
${env_id} Get Environment ID ${environment_name}
POST request without body http://${ip}:8082/environments/${env_id}/configure
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
${session_id} Set Variable ${resp['id']}
Log ${session_id}
Update Headers X-Configuration-Session ${session_id}
[Return] ${resp}
Delete session
[Arguments] ${environment_name} ${session_id}
[Documentation] Sends DELETE request to delete session
... with session_id in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - session_id: session id.
...
... *Return:*
... - None.
...
... *Examples:*
... | Delete Session | ${result['id']} |
${env_id} Get Environment ID ${environment_name}
DELETE request http://${ip}:8082/environments/${env_id}/sessions/${session_id}
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
Get session information
[Arguments] ${environment_name} ${session_id}
[Documentation] Sends GET request to get session information
... with session_id in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - session_id: session id.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Get Session Information | ${result['id']} |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/sessions/${session_id}
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
[Return] ${resp}
Get session reports
[Arguments] ${environment_name} ${session_id}
[Documentation] Sends GET request to get session reports
... with session_id in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - session_id: session id.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Get Session Reports | ${result['id']} |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/sessions/${session_id}/reports
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
[Return] ${resp}
Format session report
[Arguments] ${session_report}
[Documentation] Formats report to user-friendly view.
...
... *Arguments:*
... - session_report: session report.
...
... *Return:*
... - formatted session report.
...
... *Examples:*
... | ${rep} | Format session report | ${report} |
${nice_list} = Create List
@{list} Convert To List ${session_report['reports']}
: FOR ${x} IN @{list}
\ Append To List ${nice_list} time: ${x['created']}, text: ${x['text']}
Log List ${nice_list}
[Return] ${nice_list}
Deploy session
[Arguments] ${environment_name} ${session_id}
[Documentation] Sends POST request to deploy session
... with session_id in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - session_id: session id.
...
... *Return:*
... - None.
...
... *Examples:*
... | Deploy Session | ${result['id']} |
${env_id} Get Environment ID ${environment_name}
POST request without body http://${ip}:8082/environments/${env_id}/sessions/${session_id}/deploy
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
Try to delete session
[Arguments] ${environment_name} ${session_id}
[Documentation] Sends DELETE request to delete session
... with session_id in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - session_id: session id.
...
... *Return:*
... - None.
...
... *Examples:*
... | Delete Session | ${result['id']} |
${env_id} Get Environment ID ${environment_name}
DELETE request http://${ip}:8082/environments/${env_id}/sessions/${session_id}
Create AD
[Arguments] ${environment_name} ${AD_name}
[Documentation] Sends POST request to create new AD
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - AD_name: AD name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Create AD | env001 | ad001 |
${env_id} Get Environment ID ${environment_name}
${auth} Set Variable {"name": "${AD_name}", "adminPassword": "swordfish", "domain": "acme.dc", "units": [{"isMaster": true, "recoveryPassword": "swordfish", "location": "west-dc"}, {"isMaster": false, "recoveryPassword": "swordfish", "location": "west-dc"}]}
Set Body ${auth}
POST request http://${ip}:8082/environments/${env_id}/activeDirectories
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
[Return] ${resp}
Get List of AD
[Arguments] ${environment_name}
[Documentation] Sends GET request to list all AD's
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Get List of AD | env001 |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/activeDirectories
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
[Return] ${resp}
Delete AD
[Arguments] ${environment_name} ${AD_name}
[Documentation] Sends DELETE request to delete AD
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - AD_name: AD name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Delete AD | env001 | ad001 |
${env_id} Get Environment ID ${environment_name}
${ad_id} Set Variable None
${data} Get List of AD ${environment_name}
@{ad_list} Convert To List ${data['activeDirectories']}
: FOR ${x} IN @{ad_list}
\ ${ad_id} = Set Variable If "${x['name']}" == "${AD_name}" ${x['id']} ${ad_id}
DELETE request http://${ip}:8082/environments/${env_id}/activeDirectories/${ad_id}
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
Create IIS
[Arguments] ${environment_name} ${IIS_name}
[Documentation] Sends POST request to create new AD
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - IIS_name: IIS name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Create IIS | env001 | iis001 |
${env_id} Get Environment ID ${environment_name}
${auth} Set Variable {"name": "${IIS_name}", "adminPassword": "swordfish", "domain": "acme.dc", "units": [{}]}
Set Body ${auth}
POST request http://${ip}:8082/environments/${env_id}/webServers
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
[Return] ${resp}
Get List of IIS
[Arguments] ${environment_name}
[Documentation] Sends GET request to list all IIS's
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Get List of IIS | env001 |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/webServers
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
[Return] ${resp}
Delete IIS
[Arguments] ${environment_name} ${IIS_name}
[Documentation] Sends DELETE request to delete IIS
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - IIS_name: IIS name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Delete IIS | env001 | iis001 |
${env_id} Get Environment ID ${environment_name}
${iis_id} Set Variable None
${data} Get List of IIS ${environment_name}
@{iis_list} Convert To List ${data['webServers']}
: FOR ${x} IN @{iis_list}
\ ${iis_id} = Set Variable If "${x['name']}" == "${IIS_name}" ${x['id']} ${iis_id}
DELETE request http://${ip}:8082/environments/${env_id}/webServers/${iis_id}
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
Create ASP NET
[Arguments] ${environment_name} ${ASP_name}
[Documentation] Sends POST request to create new AD
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - ASP_name: ASP name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Create ASP NET | asp001 |
${env_id} Get Environment ID ${environment_name}
${auth} Set Variable {"name": "${ASP_name}", "credentials": {"username": "Administrator","password": "swordfish"}, "domain": "acme.dc", "adminPassword": "swordfish", "units":[{}], "repository": "git://github.com/Mirantis/murano-mvc-demo.git"}
Set Body ${auth}
POST request http://${ip}:8082/environments/${env_id}/aspNetApps
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response Body
[Return] ${resp}
Get List of ASP NET
[Arguments] ${environment_name}
[Documentation] Sends GET request to list all IIS's
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | List ASP NET |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/aspNetApps
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response Body
[Return] ${resp}
Delete ASP NET
[Arguments] ${environment_name} ${ASP_name}
[Documentation] Sends DELETE request to delete IIS
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - ASP_name: ASP name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Delete ASP NET | asp001 |
${env_id} Get Environment ID ${environment_name}
${asp_id} Set Variable None
${data} Get List of ASP NET ${environment_name}
@{asp_list} Convert To List ${data['aspNetApps']}
: FOR ${x} IN @{asp_list}
\ ${asp_id} = Set Variable If "${x['name']}" == "${ASP_name}" ${x['id']} ${asp_id}
DELETE request http://${ip}:8082/environments/${env_id}/aspNetApps/${asp_id}
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
Create IIS Farm
[Arguments] ${environment_name} ${IIS_Farm_name}
[Documentation] Sends POST request to create new AD
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - IIS_Farm_name: IIS farm name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Create IIS Farm | env001 | iisFarm001 |
${env_id} Get Environment ID ${environment_name}
${auth} Set Variable {"name": "${IIS_Farm_name}", "adminPassword": "swordfish", "domain": "acme.dc", "units": [{}], "loadBalancerPort": "80"}
Set Body ${auth}
POST request http://${ip}:8082/environments/${env_id}/webServerFarms
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
[Return] ${resp}
Get List of IIS Farm
[Arguments] ${environment_name}
[Documentation] Sends GET request to list all IIS's
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Get List of IIS Farm | env001 |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/webServerFarms
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response body
[Return] ${resp}
Delete IIS Farm
[Arguments] ${environment_name} ${IIS_Farm_name}
[Documentation] Sends DELETE request to delete IIS
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - IIS_Farm_name: IIS farm name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Delete IIS Farm | env001 | iis001 |
${env_id} Get Environment ID ${environment_name}
${iis_Farm_id} Set Variable None
${data} Get List of IIS Farm ${environment_name}
@{iis_Farm_list} Convert To List ${data['webServerFarms']}
: FOR ${x} IN @{iis_Farm_list}
\ ${iis_Farm_id} = Set Variable If "${x['name']}" == "${IIS_Farm_name}" ${x['id']} ${iis_Farm_id}
DELETE request http://${ip}:8082/environments/${env_id}/webServerFarms/${iis_Farm_id}
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
Create ASP NET Farm
[Arguments] ${environment_name} ${ASP_Farm_name}
[Documentation] Sends POST request to create new AD
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - ASP_Farm_name: ASP farm name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Create ASP NET Farm | asp001 |
${env_id} Get Environment ID ${environment_name}
${auth} Set Variable {"name": "${ASP_Farm_name}", "credentials": {"username": "Administrator","password": "swordfish"}, "domain": "acme.dc", "adminPassword": "swordfish", "units":[{}], "repository": "git://github.com/Mirantis/murano-mvc-demo.git", "loadBalancerPort": "80"}
Set Body ${auth}
POST request http://${ip}:8082/environments/${env_id}/aspNetAppFarms
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response Body
[Return] ${resp}
Get List of ASP NET Farm
[Arguments] ${environment_name}
[Documentation] Sends GET request to list all IIS's
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | List ASP NET Farm |
${env_id} Get Environment ID ${environment_name}
GET request http://${ip}:8082/environments/${env_id}/aspNetAppFarms
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}
${resp} Get Response Body
[Return] ${resp}
Delete ASP NET Farm
[Arguments] ${environment_name} ${ASP_Farm_name}
[Documentation] Sends DELETE request to delete IIS
... in environment_name.
...
... *Arguments:*
... - environment_name: environment name.
... - ASP_Farm_name: ASP farm name.
...
... *Return:*
... - response body.
...
... *Examples:*
... | Delete ASP NET Farm | asp001 |
${env_id} Get Environment ID ${environment_name}
${asp_Farm_id} Set Variable None
${data} Get List of ASP NET Farm ${environment_name}
@{asp_Farm_list} Convert To List ${data['aspNetAppFarms']}
: FOR ${x} IN @{asp_Farm_list}
\ ${asp_Farm_id} = Set Variable If "${x['name']}" == "${ASP_Farm_name}" ${x['id']} ${asp_Farm_id}
DELETE request http://${ip}:8082/environments/${env_id}/aspNetAppFarms/${asp_Farm_id}
${resp_code} Get Response Code
Should Be Equal As Integers 200 ${resp_code}

View File

@ -1,37 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from os.path import join, dirname
from setuptools import setup
execfile(join(dirname(__file__), 'src', 'Boffin', 'version.py'))
setup(
name='robotframework-boffin',
version=VERSION,
author='Mirantis, Inc.',
license='Apache License 2.0',
description='Extension for Robot Framework',
long_description=open('README.rst').read(),
package_dir={'': 'src'},
packages=['Boffin', 'Boffin.keywords'],
install_requires=['robotframework>=2.8.1',
'selenium>=2.33.0',
'robotframework-selenium2library>=1.2.0',
'robotframework-pydblibrary>=1.1',
'beautifulsoup4>=4.2.1',
'requests>=1.2.0'],
platforms='any',
zip_safe=False
)

View File

@ -1,54 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from ConfigParser import ConfigParser
from os import getcwd
from os.path import join
from robot.libraries.BuiltIn import BuiltIn
_settingsFileName = 'settings.ini'
class _SettingsReader(object):
""" 'settings.ini' driver. """
@staticmethod
def read():
"""
Loads default variables from the 'resources/settings.ini' file.
Arguments:
- None.
Return:
- None.
"""
try:
p = BuiltIn().get_variable_value('${resources_path}')
if p is not None:
_settingsFullFileName = join(p, _settingsFileName)
else:
_settingsFullFileName = join(getcwd(), 'resources',
_settingsFileName)
conf = ConfigParser()
conf.read(_settingsFullFileName)
for setting in conf.options('default'):
BuiltIn().set_global_variable('${%s}' % setting,
conf.get('default', setting))
except:
pass

View File

@ -1,54 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from os.path import join, dirname
from Selenium2Library import Selenium2Library
from _Settings import _SettingsReader
from keywords import *
execfile(join(dirname(__file__), 'version.py'))
__version__ = VERSION
_SettingsReader.read()
class WebUIlib(Selenium2Library, _WebUIlib):
"""
This class supports WebUi related testing using the Robot Framework.
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LIBRARY_VERSION = VERSION
class Rest(_Rest):
"""
This class supports Rest related testing using the Robot Framework.
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LIBRARY_VERSION = VERSION
class DB(Pydblibrary):
"""
This library supports database-related testing using the Robot Framework.
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LIBRARY_VERSION = VERSION

View File

@ -1,238 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import json
import requests
from robot.api import logger
class _Rest(object):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
headers = None
body = None
url = None
def clear_headers(self):
"""
Clears headers for REST API requests.
*Arguments:*
- None.
*Return:*
- None.
*Examples*:
| Clear Headers |
"""
self.headers = []
def set_headers(self, headers_dict):
"""
Configures headers for REST API requests.
*Arguments:*
- headers_dict: string with json dict.
*Return:*
- None.
*Examples*:
| Set Headers | {'Content-Type': 'application/json' |
"""
try:
self.headers = json.loads(headers_dict)
except:
raise AssertionError('Incorrect headers: %s' % headers_dict)
def update_headers(self, name, value):
"""
Modifies headers for REST API requests.
*Arguments:*
- name: header name.
- value: header value.
*Return:*
- None.
*Examples*:
| Update Headers | X-Auth-Token | 8808880808080808 |
"""
self.headers[name] = value
def set_body(self, body_dict):
"""
This function allows to configure body for REST API requests.
*Arguments:*
- body_dict: string with json dict.
*Return:*
- None.
*Examples*:
| Set Headers | {'Content-Type': 'application/json' |
"""
self.body = body_dict
def get_headers(self):
"""
Gets headers for REST API requests.
*Arguments:*
- None.
*Return:*
- Headers dict.
*Examples*:
| ${headers} | Get Headers |
"""
return self.headers
def GET_request(self, url):
"""
Sends GET request.
*Arguments:*
- url: destination url.
*Return:*
- None.
Examples:
| GET request | http://10.10.10.1:8082/environments |
"""
self.response = requests.request('GET', url=url, headers=self.headers)
def POST_request(self, url):
"""
Sends POST request.
*Arguments:*
- url: destination url.
*Return:*
- None.
*Examples*:
| POST request | http://10.10.10.1:8082/environments |
"""
debug_data = 'POST Request to URL: %s \n' \
'with Headers: %s \n' \
'and Body: %s' % (url, self.headers, self.body)
logger.debug(debug_data)
self.response = requests.request('POST', url,
headers=self.headers,
data=self.body)
logger.debug('Response: %s' % self.response.text)
def POST_request_without_body(self, url):
"""
Sends POST request without body.
*Arguments:*
- url: destination url.
*Return:*
- None.
*Examples*:
| POST request | http://10.10.10.1:8082/environments |
"""
debug_data = 'POST Request to URL: %s \n' \
'with Headers: %s \n' % (url, self.headers)
logger.debug(debug_data)
self.response = requests.request('POST', url,
headers=self.headers)
logger.debug('Response: %s' % self.response.text)
def DELETE_request(self, url):
"""
Sends DELETE request.
*Arguments:*
- url: destination url.
*Return:*
- None.
*Examples*:
| DELETE request | http://10.10.10.1:8082/environments |
"""
self.response = requests.request('DELETE', url=url,
headers=self.headers)
def PUT_request(self, url):
"""
Sends PUT request.
*Arguments:*
- url: destination url.
*Return:*
- None.
*Examples*:
| PUT request | http://10.10.10.1:8082/env |
"""
debug_data = 'POST Request to URL: %s \n' \
'with Headers: %s \n' \
'and Body: %s' % (url, self.headers, self.body)
logger.debug(debug_data)
self.response = requests.request('PUT', url,
headers=self.headers,
data=self.body)
logger.debug('Response: %s' % self.response.text)
def get_response_code(self):
"""
Gets response code.
*Arguments:*
- None.
*Return:*
- response code.
*Examples*:
| ${code} | Get Response Code |
"""
return self.response.status_code
def get_response_body(self):
"""
Gets response body.
*Arguments:*
- None.
*Return:*
- response body.
*Examples*:
| ${body} | Get Response Body |
"""
logger.debug('Response: %s' % self.response.text)
if self.response.text is None:
self.response.text = {}
return json.loads(self.response.text)

View File

@ -1,329 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from ConfigParser import ConfigParser
from os import getcwd
from os.path import join
from bs4 import BeautifulSoup
from robot.libraries.BuiltIn import BuiltIn
class _ArtificialIntelligence:
"""
This class allows to find input and select controls \
without manual input of identificators.
We can find input fields by labels near those fields. \
Boffin heart.
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
def __init__(self, page_source):
"""
Class constructor.
*Arguments:*
- page_source: web page source code.
*Return:*
- None.
"""
self.page_source = page_source
def _get_xpath_of_element(self, element):
"""
This function allows to get xpath of soup elements.
*Arguments:*
- element: selector name.
*Return:*
- element xpath.
"""
number = 1
try:
number += len(element.find_previous_siblings(element.name))
except:
pass
xpath = element.name
if number > 1:
xpath += '[' + str(number) + ']'
for parent in element.findParents():
if parent.name != '[document]':
k = 0
for tag in parent.find_previous_siblings():
if tag.name == parent.name:
k += 1
if k == 0:
xpath = parent.name + '/' + xpath
else:
xpath = parent.name + '[' + str(k + 1) + ']/' + xpath
return xpath
def extra_search(self, soup, value, tag=None):
"""
This function allows to get element by its parameters.
*Arguments:*
- soup: soup structure.
- value: element name.
*Return:*
- label_element.
"""
label_element = None
if label_element is None:
label_element = soup.find(tag, text=str(value))
if label_element is None:
label_element = soup.find(tag, attrs={'value': value})
if label_element is None:
label_element = soup.find(tag, attrs={'title': value})
if label_element is None:
try:
for element in soup.find_all(tag):
if str(value) in element.text:
label_element = element
except:
pass
return label_element
def find_element(self, label, element_type='input', method='next',
result='xpath'):
"""
Looks for specified element on the page.
*Arguments:*
- label: selector name.
- element_type: element tag name. It could be any tag or \
several tags (then they are listed as 'select/input/a').
- method: element search method. If 'next' is set, then \
function is looking for the next input field after the \
specified element.
Otherwise it returns the specified element itself.
*Return:*
- element xpath.
*Examples:*
| ${xpath} | Find element | E-mail | input | next |
| ${xpath} | Find element | Cancel | a/div | this |
"""
html = str(self.page_source.encode("utf-8", "replace"))
" load html to soup structure for parsing "
soup = BeautifulSoup(html)
" search element after the label"
try:
element_types = element_type.split('/')
element = None
label_element = self.extra_search(soup, label)
for element_type in element_types:
if method == 'next':
element = label_element.parent.find_next(element_type)
elif method == 'previous':
element = label_element.parent.find_previous(element_type)
elif method == 'associated':
for t in ['a', 'button', 'input', 'select', 'span']:
elements = label_element.parent.find_all_next(t)
for e in reversed(elements):
if element_type in e.text:
element = e
if element:
break
elements = label_element.parent.find_all_previous(t)
for e in elements:
if element_type in e.text:
element = e
if element:
break
else:
element = self.extra_search(soup, label, element_type)
if element:
break
" return xpath of element "
if result == 'xpath':
return self._get_xpath_of_element(element)
else:
return element
except:
return None
class _Utils(object):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
def get_element_from_repo(self, element_name):
"""
Returns element type, identificator and frame from \
the 'resources/objrepo/%screen_name%.ini' file by element name.
*Arguments:*
- elementName: screen name and selector name divided by dot.
*Return:*
- <list> [elType, elIdentificator, elFrame].
*Example:*
| @{element} | Get Element From Repo | Home . Banner Page 2 Button |
"""
try:
p = BuiltIn().get_variable_value('${resources_path}')
if p is not None:
_objRepoPath = join(p, 'objrepo')
else:
_objRepoPath = join(getcwd(), 'resources', 'objrepo')
element_name = element_name.lower().replace(' ', '')
print "Element Name: " + element_name
inputElement = element_name.split('.')
if len(inputElement) == 1:
fileName = 'common.ini'
name = element_name
else:
fileName = '%s.ini' % inputElement[0]
name = inputElement[1]
fullFileName = join(_objRepoPath, fileName)
print "fullFileName " + fullFileName
conf = ConfigParser()
conf.read(fullFileName)
print "A: " + conf.get(str(name), 'type')
print "A: " + conf.get(name, 'type')
if not conf.has_section(name):
print name
return ['', None, '']
element_type = conf.get(name, 'type')
element_identificator = ''
element_parent_name = conf.get(name, 'parent')
if element_parent_name:
element_identificator = \
self.get_element_from_repo(element_parent_name)[1] + \
element_identificator
element_identificator += conf.get(name, 'identificator')
element_frame = conf.get(name, 'frame')
return [element_type, element_identificator, element_frame]
except:
return ['', None, '']
def get_web_element_frame(self, elementName):
"""
Returns element frame by its name in the
'resources/objrepo/%screen_name%.ini' file.
*Arguments:*
- elementName: screen name and selector name divided by dot.
*Return:*
- elFrame.
*Example:*
| ${elFrame} | GetElementFrame | Blog . Post Text field |
"""
type, id, frame = self.get_element_from_repo(elementName)
return frame
def get_web_element_selector(self, name, page_source=None,
element_type='input', method='next',
result='xpath'):
"""
Returns element selector by its name in the \
'resources/ObjRepo.ini' file.
*Arguments:*
- name: selector name.
- page_source: web page source code.
- element_type: element tag name. It could be any tag or several \
tags (then they are listed as 'select/input/a').
- method: element search method. If 'next' is set, then function
is looking for the next input field after the specified element.
Otherwise it returns the specified element itself.
*Return:*
- elIdentificator.
*Examples:*
| ${selector} | Get element selector | User Name | ${source_code} \
| input | next |
| ${selector} | Get element selector | Submit Button | ${source_code} \
| a | this |
"""
type, id, frame = self.get_element_from_repo(name)
if not id and page_source:
boffin = _ArtificialIntelligence(page_source)
id = boffin.find_element(name, element_type, method, result)
if result != 'xpath':
return id
if id:
type = 'xpath'
identificator = None
if id:
identificator = '%s%s' % \
('' if not type else '%s=' % str(type), str(id))
return identificator
def get_table_row_xpath(self, page_source, name):
"""
This method allows to parse tables on web pages \
and determine the table row by element from table.
*Arguments:*
- page_source: web page source code.
- name: identificator of row element.
*Return:*
- xpath of table row.
*Example:*
| ${elXpath} | Get Table Row Xpath | Entity 123 |
"""
_type = 'td/a/label/input/select'
element = self.get_web_element_selector(name, page_source,
_type, method='this',
result='element')
tag = element.name
while tag != 'tr' and tag:
try:
tag = element.parent.name
element = element.parent
except:
tag = None
pass
e = _ArtificialIntelligence(page_source)
return e._get_xpath_of_element(element)

View File

@ -1,668 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc
#
# Licensed under the Apache License, Version 2 0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www apache org/licenses/LICENSE-2 0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License
from time import sleep
from robot.libraries.BuiltIn import BuiltIn
from _Utils import _Utils
# Decorator for framed elements.
def _framed(framed_element_name):
def real_framed(function):
def wrapper(self, *args):
co_varnames = function.func_code.co_varnames
upper_varnames = [varnames.upper() for varnames in co_varnames]
index = upper_varnames.index(framed_element_name.upper())
element_frame = \
self.get_web_element_frame(args[index - 1])
if element_frame:
self.set_current_frame(element_frame)
res = function(self, *args)
if element_frame:
self.unselect_frame()
return res
return wrapper
return real_framed
class _WebUIlib(_Utils):
def navigate_to(self, path, dont_wait=None):
"""
Navigates to the page by given links sequence.
*Arguments:*
- path: sequence of links separated by '>'.
- dont_wait: optional parameter. Should be set to skip waiting \
for page loaded.
*Return:*
- None.
*Examples:*
| Navigate to | Careers>Account Executive |
"""
links = path.split('>')
for link in links:
self.click_link(link)
self.wait_for_page_loaded(dont_wait)
@_framed('over_element_name')
def click_on_submenu(self, over_element_name, name, dont_wait=None):
"""
Puts mouse over menu element and then clicks on submenu element by \
given selector names and waits for page loaded if needed.
*Arguments:*
- over_element_name: menu selector title taken from object \
repository.
- name: submenu selector title taken from object repository.
- dont_wait: optional parameter. Should be set to skip waiting \
for page loaded.
*Return:*
- None.
*Examples:*
| Click on submenu | Settings | Profile |
"""
self.put_mouse_over(over_element_name)
sleep(1)
self.click_on(name)
self.wait_for_page_loaded(dont_wait)
def click_on_link(self, link, dont_wait=None):
"""
Clicks the link by given localor and waits for page loaded if needed.
*Arguments:*
- link: this attribute can contain one of following: id, name, \
href or link text.
- dont_wait: optional parameter. Should be set to skip waiting \
for page loaded.
*Return:*
- None.
*Examples:*
| Click on link | Move to Trash |
| Click on link | Delete | don't wait |
"""
self.wait_for_element_found(link, 'a', 'this')
self.click_link(link)
self.wait_for_page_loaded(dont_wait)
def wait_for_page_loaded(self, dont_wait=None, page_load_timeout=60):
"""
Waits for 'complete' page state during predefined page load timeout.
Does not wait for page loading if wait argument is set to any value \
except the ${empty}.
*Arguments:*
- dont_wait: optional parameter. Should be set to skip waiting \
for page loaded.
- page_load_timeout: optional parameter. Timeout for page loading.
*Return:*
- None.
*Examples:*
| Wait for page loaded |
| Wait for page loaded | don't wait |
"""
ajax_wait_timeout = \
BuiltIn().get_variable_value('${ajax_wait_timeout}')
if ajax_wait_timeout:
self.wait_for_condition('return window.jQuery.active == 0',
ajax_wait_timeout,
'Ajax request was not loaded in '
'%s second(s)' % ajax_wait_timeout)
if not dont_wait:
self.wait_for_condition('return document.readyState == "complete"',
page_load_timeout,
'Page was not loaded in '
'%s second(s)' % page_load_timeout)
def title_should_contain(self, text):
"""
Verifies that current page title contains given text.
*Arguments:*
- text: text which should be in the title set in test case.
*Return:*
- None.
*Examples:*
| Title should contain | Account Executive |
"""
title = self.get_title()
BuiltIn().should_contain(title, text)
@_framed('name')
def click_on(self, name, dont_wait=None):
"""
Clicks the element by given selector name and waits for page loaded \
if needed.
*Arguments:*
- name: selector title taken from object repository.
- dont_wait: optional parameter. Should be set to skip waiting \
for page loaded.
*Return:*
- None.
*Examples:*
| Click on | Dashboard . Users button |
"""
selector = self.wait_for_element_found(name, 'button/input/a', 'this')
self.click_element(selector)
self.wait_for_page_loaded(dont_wait)
def set_current_frame(self, name):
"""
Sets frame identified by given selector name as current frame.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Set current frame | Post Editor Frame |
"""
selector = self.get_web_element_selector(name)
self.select_frame(selector)
def element_text_should_contain(self, name, text):
"""
Verifies that element with given selector type contains the given text.
*Arguments:*
- name: selector title taken from object repository.
- text: text to be found set in test.
*Return:*
- None.
*Examples:*
| Element Text Should Contain | Dashboard . Message text | \
Post Updated |
"""
selector = self.get_web_element_selector(name)
self.element_should_contain(selector, text)
def element_text_should_be_equal_to(self, name, text):
"""
Verifies that element with given selector type equals to the \
given text.
*Arguments:*
- name: selector title taken from object repository.
- text: text to be found set in test.
*Return:*
- None.
*Examples:*
| Element Text Should Be Equal To | Dashboard . Message text | \
User deleted |
"""
selector = self.get_web_element_selector(name)
self.element_text_should_be(selector, text)
def element_text_should_not_contain(self, name, text):
"""
Verifies that element with given selector type not contain the \
given text.
*Arguments:*
- name: selector title taken from object repository.
- text: text to be found set in test.
*Return:*
- None.
*Examples:*
| Element Text Should Not Contain | Dashboard . Message text \
| Post Updated. |
"""
selector = self.get_web_element_selector(name)
self.element_should_not_contain(selector, text)
def element_text_should_not_be_equal_to(self, name, text):
"""
Verifies that element text with given selector type not qual to the \
given text.
*Arguments:*
- name: selector title taken from object repository.
- text: text to be found set in test.
*Return:*
- None.
*Examples:*
| Element Text Should Not Be Equal To | Dashboard . Message text \
| Post Updated. |
"""
selector = self.get_web_element_selector(name)
self.element_text_should_not_be(selector, text)
def element_should_not_contain(self, selector, text):
"""
Verifies element identified by given selector does not contain \
given text.
*Arguments:*
- selector: element identificator in the object repository.
- text: text to be checked.
*Return:*
- None.
*Examples:*
| Element Should Not Contain | xpath=//div[@id='moderated']/p \
| rude message |
"""
obj_text = self.get_text(selector)
BuiltIn().should_not_contain(obj_text, text)
def element_text_should_not_be(self, selector, text):
"""
Verifies element identified by given selector does not equal to the \
given text.
*Arguments:*
- selector: element identificator in the object repository.
- text: text to be checked.
*Return:*
- None.
*Examples:*
| Element Should Not Be | xpath=//div[@id='moderated']/p \
| rude message |
"""
obj_text = self.get_text(selector)
BuiltIn._should_not_be_equal(obj_text, text)
def page_should_have_number_of_elements(self, count, name):
"""
Verifies that current page contains given number of elements with \
given selector type.
*Arguments:*
- count: number of element to be found.
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Page should have number of elements | 4 | Banner Buttons |
"""
element = self.get_element_from_repo(name)
self.xpath_should_match_x_times(element[1], count)
def page_should_have_element(self, name):
"""
Verifies that current page contains given element.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Page should have element | Contact Us button |
"""
selector = self.get_web_element_selector(name)
self.page_should_contain_element(selector)
def page_should_not_have_element(self, name):
"""
Verifies that current page does not contain given element.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Page should not have element | Contact Us button |
"""
selector = self.get_web_element_selector(name)
self.page_should_not_contain_element(selector)
def put_mouse_over(self, name):
"""
Simulates hovering mouse over the element specified by selector name.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Put mouse over | Dashboard . Posts button |
"""
selector = self.get_web_element_selector(name)
self.mouse_over(selector)
@_framed('field_name')
def fill_field(self, field_name, text):
"""
Gets element by its field name and fills it with given text.
Note: If field name will be 'password' then \
${text} won't be logged.
*Arguments:*
- field_name: selector title taken from object repository.
- text: text to be entered into field.
*Return:*
- None.
*Examples:*
| Fill field | Dashboard . New Post Title field | Test blog-post |
"""
self.wait_for_page_loaded()
selector = self.wait_for_element_found(field_name, 'input/textarea',
'next')
if 'PASSWORD' in field_name.upper():
self.input_password(selector, text)
else:
self.input_text(selector, text)
def wait_for_element_found(self, element_name, element_type, method):
"""
Makes 10 retries to get element by its name with defined retry \
interval (1 second).
*Arguments:*
- element_name: selector title taken from object repository;
- element_type: element tag, could take several tags at once \
(e.g. select/input/a);
- method: a method of how to search for the element.
*Return:*
- selector: element identificator from object repository.
*Examples:*
| ${selector} | Wait for element found | Dashboard Menu Title field \
| input | next |
"""
for attempt in range(100):
try:
page_source_code = self.get_source()
selector = self.get_web_element_selector(element_name,
page_source_code,
element_type,
method)
except:
pass
if selector:
break
sleep(0.5)
if not selector:
BuiltIn().run_keyword('Capture Page Screenshot')
raise AssertionError('Web element "%s" was not found in object '
'repository and on page.' % element_name)
return selector
@_framed('name')
def select_item_from_list(self, name, item_name):
"""
Selects specified item from given list.
*Arguments:*
- name: selector title taken from object repository.
- item_name: list box item.
*Return:*
- None.
*Examples:*
| Select item from list | Dashboard . User Action dropdown | Delete |
"""
selector = self.wait_for_element_found(name, 'select', 'next')
self.select_from_list(selector, item_name)
@_framed('name')
def set_checkbox_on(self, name, method='this'):
"""
Set checkbox with given title on.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Set checkbox on | Dashboard . Delete Posts Role checkbox |
"""
selector = self.wait_for_element_found(name, 'select/input', method)
self.select_checkbox(selector)
@_framed('name')
def set_checkbox_off(self, name, method='this'):
"""
Set checkbox with given title off.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Set checkbox off | Dashboard . Delete Posts Role checkbox |
"""
selector = self.wait_for_element_found(name, 'select/input', method)
self.unselect_checkbox(selector)
@_framed('from_name')
def drag_and_drop_to(self, from_name, to_name):
"""
Drags and drops from one given element to other.
*Arguments:*
- from_name: selector title taken from object repository to get \
content from;
- to_name: selector title taken from object repository to put \
content to.
*Return:*
- None.
*Examples:*
| Drag And Drop To | Photo gallery | User avatar |
"""
from_selector = self.wait_for_element_found(from_name,
'button/input/a/img/div',
'this')
to_selector = self.wait_for_element_found(to_name,
'button/input/a/img/div',
'this')
self.drag_and_drop_to(from_selector, to_selector)
def find_associated_element(self, first_element, desired_element):
"""
This method allows to find element, which located near other element \
and returns xpath of this element.
Sometimes we have many identical elements on page and we can find \
correct element based on nearest unique elements.
*Arguments:*
- First_Element: base element, near this element we want to find \
other element.
- Desired_Element: this is element which we want to find.
*Return:*
- xpath of Desired_Element or None
*Examples:*
| {element_xpath} | Find Associated Element | MyUniqueElement \
| DesiredElement |
"""
element = self.wait_for_element_found(first_element, desired_element,
'associated')
return element
@_framed('name')
def select_radio_by_selector(self, name, value):
"""
Sets selection of radio button group identified by selector name \
to value.
*Arguments:*
- name: selector title taken from object repository.
- value: value to be selected, is used for the value attribute or \
for the id attribute.
*Return:*
- None.
*Examples:*
| Select Radio By Selector | Dashboard . Questionnaire | Yes |
"""
selector = self.wait_for_element_found(name, 'input', 'previous')
self.select_radio_button(selector, value)
def get_table_row_with(self, element):
"""
This method allows to find table row with specific element. \
After this xpath of table row can be used like base for xpath of \
different elements in this table.
*Arguments:*
- element: the unique element from table.
*Return:*
- xpath of table row for this element
*Examples:*
| {table_xpath} | Get Table Row With | MyUniqueElement |
| Click Element \ \ | xpath={table_xpath}/td[4]/button |
"""
source_code = self.get_source()
result = self.get_table_row_xpath(source_code, element)
return result
@_framed('name')
def element_should_be_invisible(self, name):
"""
Verifies that element is invisible on the page.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Element Should Be Invisible | Dashboard . Post Publish button |
"""
selector = self.wait_for_element_found(name,
'button/input/a/img',
'this')
self.element_should_not_be_visible(selector)
@_framed('name')
def element_should_not_be_invisible(self, name):
"""
Verifies that element is visible on the page.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- None.
*Examples:*
| Element Should Not Be Invisible | Dashboard . Post Publish button |
"""
selector = self.wait_for_element_found(name,
'button/input/a/img',
'this')
self.element_should_be_visible(selector)
@_framed('name')
def get_element_text(self, name):
"""
Gets text of given element.
*Arguments:*
- name: selector title taken from object repository.
*Return:*
- text of element.
*Examples:*
| ${text} | Get Element Text | Main header |
"""
selector = self.wait_for_element_found(name,
'button/input/a/img',
'this')
text = self.get_text(selector)
return text
@_framed('name')
def get_attribute_of_element(self, name, attribute):
"""
Gets attribute of given element.
*Arguments:*
- name: selector title taken from object repository.
- attribute: attribute that would be taken.
*Return:*
- text of element attribute.
*Examples:*
| ${id_text} | Get Attribute Of Element | Main header | id |
"""
selector = self.wait_for_element_found(name,
'button/input/a/img',
'this')
attr_selector = '%s@%s' % (selector, attribute)
attr_text = self.get_element_attribute(attr_selector)
return attr_text

View File

@ -1,23 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from _WebUIlib import _WebUIlib
from _Rest import _Rest
from Pydblibrary import Pydblibrary
__all__ = [
'_WebUIlib',
'_Rest',
'Pydblibrary'
]

View File

@ -1 +0,0 @@
VERSION = '1.0rc3'

View File

@ -1,15 +0,0 @@
Metadata-Version: 1.0
Name: robotframework-boffin
Version: 1.0rc3
Summary: Extension for Robot Framework
Home-page: UNKNOWN
Author: Mirantis, Inc.
Author-email: UNKNOWN
License: Apache License 2.0
Description: Robotframework-Boffin
==========================
This library extends available keywords of Robotframework and robotframework-selenium2library.
And provides keywords for REST requests testing.
Platform: any

View File

@ -1,15 +0,0 @@
README.rst
setup.py
src/Boffin/_Settings.py
src/Boffin/__init__.py
src/Boffin/version.py
src/Boffin/keywords/_Rest.py
src/Boffin/keywords/_Utils.py
src/Boffin/keywords/_WebUIlib.py
src/Boffin/keywords/__init__.py
src/robotframework_boffin.egg-info/PKG-INFO
src/robotframework_boffin.egg-info/SOURCES.txt
src/robotframework_boffin.egg-info/dependency_links.txt
src/robotframework_boffin.egg-info/not-zip-safe
src/robotframework_boffin.egg-info/requires.txt
src/robotframework_boffin.egg-info/top_level.txt

View File

@ -1,6 +0,0 @@
robotframework>=2.8.1
selenium>=2.33.0
robotframework-selenium2library>=1.2.0
robotframework-pydblibrary>=1.1
beautifulsoup4>=4.2.1
requests>=1.2.0

View File

@ -1,81 +0,0 @@
#!/usr/bin/expect -d
# The following directories should be created for this script:
# /opt/stack/devstack
# /opt/stack/keero
# the ssh key should be in directory /opt/stack/.ssh/
# the iso file with windows should be in directory /opt/stack/
set timeout 1200
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "password"
send -- "EVYiMCVZX9\n"
expect "*#*"
send -- "su - stack\n"
expect "*$*"
send -- "sudo killall python\n"
expect "*$*"
send -- "cd ~/devstack\n"
expect "*$*"
send -- "./unstack.sh\n"
expect "*$*"
send -- "./stack.sh\n"
expect "*/usr/bin/service: 123: exec: status: not found*"
send -- "y\n"
expect "*stack.sh completed*"
send -- "sudo rabbitmq-plugins enable rabbitmq_management\n"
expect "*$*"
send -- "sudo service rabbitmq-server restart\n"
expect "*$*"
send -- "sudo rabbitmqctl add_user keero keero\n"
expect "*$*"
send -- "sudo rabbitmqctl set_user_tags keero administrator\n"
expect "*$*"
send -- "source openrc admin admin\n"
expect "*$*"
send -- "cd ~\n"
expect "*$*"
send -- "nova keypair-add keero-linux-keys > heat_key.priv\n"
expect "*$*"
send -- "glance image-create --name 'ws-2012-full' --is-public true --container-format ovf --disk-format qcow2 < ws-2012-full.qcow2\n"
expect "*$*"
send -- "cd ~/keero\n"
expect "*$*"
send -- "git pull\n"
expect "/.ssh/id_rsa"
send -- "swordfish\n"
expect "*$*"
send -- "cp -Rf ~/keero/dashboard/windc /opt/stack/horizon/openstack_dashboard/dashboards/project\n"
expect "*$*"
send -- "cp -f ~/keero/dashboard/api/windc.py /opt/stack/horizon/openstack_dashboard/api/\n"
expect "*$*"
send -- "cd ~/keero/python-portasclient\n"
expect "*$*"
send -- "sudo python setup.py install\n"
expect "*$*"
send -- "cd ~/keero/portas\n"
expect "*$*"
send -- "./tools/with_venv.sh ./bin/portas-api --config-file=./etc/portas-api.conf & > ~/APIservice.log\n"
sleep 10
send -- "\n"
expect "*$*"
send -- "cd ~/keero/conductor\n"
expect "*$*"
send -- "./tools/with_venv.sh ./bin/app.py & > ~/conductor.log\n"
sleep 10
send -- "\n"
expect "*$*"
send -- "logout\n"
expect "*#*"

View File

@ -1,165 +0,0 @@
*** Settings ***
Suite Setup
Suite Teardown Close All Browsers
Test Setup Open Browser https://wiki.openstack.org/wiki/Murano remote_url=http://172.18.124.233:4444/wd/hub browser=firefox ff_profile_dir=ffprofile
Test Teardown Close All Browsers
Library String
Library Boffin.WebUIlib 0 20 # Boffin framework library
*** Variables ***
${resources_path} Resources/
*** Test Cases ***
Check that main page includes Documentation section
Page should contain element "Documentation"
Check that docs per releases are availiable
Page should contain element "documentation per release"
User click on "documentation per release"
Page should contain element "Release"
Release 0.1: Murano Manual
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.1" > "Murano Manual" (1 link)
Page Should Not Contain 404
Release 0.1: Murano Deployment Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.1" > "Murano Deployment Guide" (2 link)
Page Should Not Contain 404
Release 0.2: Developer Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.2" > "Developers Guide" (1 link)
Page Should Not Contain 404
Release 0.2: Administrator Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.2" > "Administrator Guide" (2 link)
Page Should Not Contain 404
Release 0.2: Installation Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.2" > "Installation Guide" (3 link)
Page Should Not Contain 404
Release 0.2.11: Getting Started Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.2.11" > "Getting Started Guide" (1 link)
Page Should Not Contain 404
Release 0.2.11: Installation Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.2.11" > "Installation Guide" (2 link)
Page Should Not Contain 404
Release 0.2.11: Developer Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.2.11" > "Developer Guide" (3 link)
Page Should Not Contain 404
Release 0.2.11: User Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.2.11" > "User Guide" (4 link)
Page Should Not Contain 404
Release 0.2.11: Administrator Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.2.11" > "Administrator Guide" (5 link)
Page Should Not Contain 404
Release 0.3: Getting Started Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.3" > "Getting Started Guide" (1 link)
Page Should Not Contain 404
Release 0.3: Installation Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.3" > "Installation Guide" (2 link)
Page Should Not Contain 404
Release 0.3: Developer Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.3" > "Developer Guide" (3 link)
Page Should Not Contain 404
Release 0.3: User Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.3" > "User Guide" (4 link)
Page Should Not Contain 404
Release 0.3: Administrator Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.3" > "Administrator Guide" (5 link)
Page Should Not Contain 404
Release 0.4: Getting Started Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.4" > "Getting Started Guide" (1 link)
Page Should Not Contain 404
Release 0.4: Installation Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.4" > "Installation Guide" (2 link)
Page Should Not Contain 404
Release 0.4: Developer Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.4" > "Developer Guide" (3 link)
Page Should Not Contain 404
Release 0.4: User Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.4" > "User Guide" (4 link)
Page Should Not Contain 404
Release 0.4: Administrator Guide
Page should contain element "documentation per release"
User click on "documentation per release"
Go to "Release v0.4" > "Administrator Guide" (5 link)
Page Should Not Contain 404
*** Keywords ***
User click on "${element}"
Wait For Page Loaded
Click on ${element}
Wait For Page Loaded
Page should contain element "${element}"
Wait For Page Loaded
Page Should Contain ${element}
Go to "${release}" > "${docs}" (${position} link)
${source} Get Source
${key_element} Get Web Element Selector Murano Manual ${source} a this
@{xpath_blocks}= Split String ${key_element} ]
${num} Get Substring @{xpath_blocks}[3] -1
${num1}= Evaluate ${num}-1
${num2}= Evaluate ${num}-2
${num3}= Evaluate ${num}-3
${num4}= Evaluate ${num}-4
${var} = Set Variable If '${release}' == 'Release v0.1' ${num}
... '${release}' == 'Release v0.2' ${num1}
... '${release}' == 'Release v0.2.11' ${num2}
... '${release}' == 'Release v0.3' ${num3}
... '${release}' == 'Release v0.4' ${num4}
Click Element xpath=.//*[@id='mw-content-text']/ul[${var}]/li[${position}]/a

View File

@ -1 +0,0 @@
user_pref("webdriver_enable_native_events", false);

View File

@ -1,104 +0,0 @@
from keystoneclient.v2_0 import client as ksclient
from neutronclient.neutron import client as netclient
from muranoclient.v1.client import Client as murano_client
from heatclient import client as heat_client
import novaclient.v1_1.client as nvclient
import time
import argparse
parser = argparse.ArgumentParser(description="Script for cleaning trash")
parser.add_argument("-openstack_user", dest='openstack_user', type=str,
help="Openstack username", default='sergey_demo_user')
parser.add_argument("-openstack_password", dest='openstack_password',
type=str, help="Openstack password",
default='111')
parser.add_argument("-openstack_tenant", dest='openstack_tenant', type=str,
help="Openstack tenant", default='ForTests')
parser.add_argument("-keystone_url", dest='keystone_url', type=str,
help="Keystone url", default='http://172.18.124.201:5000/v2.0/')
parser.add_argument("-murano_url", dest='murano_url', type=str,
help="Murano url", default='http://172.18.78.92:8082')
parser.add_argument("-neutron_url", dest='neutron_url', type=str,
help="Neutron url", default='http://172.18.124.202:9696/')
parser.add_argument("-heat_url", dest='heat_url', type=str,
help="Heat url",
default='http://172.18.124.203:8004'
'/v1/72239681556748a3b9b74b44d081b84b')
parser.add_argument("-create_new_router", dest='create_new_router', type=bool,
help="Create or not create router after script",
default=False)
args = parser.parse_args()
user = args.openstack_user
password = args.openstack_password
tenant = args.openstack_tenant
keystone_url = args.keystone_url
create_router = args.create_new_router
keystone_client = ksclient.Client(username=user, password=password,
tenant_name=tenant, auth_url=keystone_url)
nova = nvclient.Client(user, password, tenant, keystone_url,
service_type="compute")
token = keystone_client.auth_token
murano_url = args.murano_url
muranoclient = murano_client(endpoint=murano_url, token=token)
quantum_endpoint = args.neutron_url
neutron = netclient.Client('2.0', endpoint_url=quantum_endpoint, token=token)
heat_endpoint = args.heat_url
heat = heat_client.Client('1', endpoint=heat_endpoint, token=token)
for i in heat.stacks.list():
i.delete()
networks = neutron.list_networks()
for i in keystone_client.tenants.list():
if i.name == tenant:
cool = i.id
for i in muranoclient.environments.list():
muranoclient.environments.delete(i.id)
for i in networks['networks']:
if i['tenant_id'] == cool:
for j in i['subnets']:
routers = neutron.list_routers()
for m in routers['routers']:
if m['tenant_id'] == cool:
body = {"subnet_id": str(j)}
try:
neutron.remove_gateway_router(m['id'])
except:
print "All is bad"
try:
neutron.remove_interface_router(m['id'], body)
except:
print "all is bad:("
try:
neutron.delete_router(m['id'])
except:
print "All is bad"
try:
neutron.delete_network(i['id'])
except:
print "All is bad"
for i in nova.servers.list():
if i.tenant_id == cool:
try:
nova.servers.delete(i)
time.sleep(5)
except:
print "All is bad"
for i in nova.security_groups.list():
if i.tenant_id == cool and i.name !='default':
nova.security_groups.delete(i)
routers = neutron.list_routers()
for m in routers['routers']:
if m['tenant_id'] == cool:
create_router = False
if create_router:
for i in neutron.list_networks()['networks']:
if i['router:external']:
a = neutron.create_router({'router': {'name': 'ROUTER',
'external_gateway_info':
{'network_id': i['id'],
'enable_snat': True}}})

View File

@ -1,49 +0,0 @@
from pyrabbit.api import Client
import argparse
parser = argparse.ArgumentParser(description="Script for creating rabbitmq"
"users and vhost for jenkins's"
"jobs")
parser.add_argument("-rabbitmq_url", dest='rabbitmq_url', type=str,
help="URL of using RabbitMQ", default='localhost:55672')
parser.add_argument("-rabbitmq_username", dest='rabbitmq_username', type=str,
help="Username for RabbitMQ auth", default='guest')
parser.add_argument("-rabbitmq_password", dest='rabbitmq_password', type=str,
help="Password for RabbitMQ auth", default='guest')
parser.add_argument("-username", dest='username', type=str,
help="Username", default='test')
parser.add_argument("-password", dest='password', type=str,
help="Password", default='swordfish')
parser.add_argument("-vhostname", dest='vhostname', type=str,
help="Vhost name", default='test')
args = parser.parse_args()
rabbitmq_url = args.rabbitmq_url
rabbitmq_user = args.rabbitmq_username
rabbitmq_password = args.rabbitmq_password
user = args.username
password = args.password
vhost = args.vhostname
cl = Client(rabbitmq_url, rabbitmq_user, rabbitmq_password)
assert cl.is_alive()
for queue in cl.get_queues():
if queue['vhost'] == vhost:
cl.purge_queue(vhost, queue['name'])
cl.delete_queue(vhost, queue['name'])
for vhost_ in cl.get_all_vhosts():
if vhost_['name'] == vhost:
while True:
try:
cl.delete_vhost(vhost_['name'])
break
except Exception:
pass
for user_ in cl.get_users():
if user_['name'] == user:
cl.delete_user(user_['name'])
cl.create_vhost(vhost)
cl.create_user(user, password, tags='administrator')
cl.set_vhost_permissions(vhost, user, '.*', '.*', '.*')

View File

@ -1,39 +0,0 @@
# Copyright 2013 OpenStack Foundation
# Copyright 2013 Mirantis Inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import argparse
from keystoneclient.v2_0 import client as ksclient
from muranoclient.client import Client as mclient
parser = argparse.ArgumentParser()
parser.add_argument('--user', type=str)
parser.add_argument('--password', type=str)
parser.add_argument('--tenant', type=str)
parser.add_argument('--keystone_url', type=str,
default='http://localhost:5000/v2.0/')
parser.add_argument('--murano_url', type=str)
args = parser.parse_args()
keystone_client = ksclient.Client(username=args.user,
password=args.password,
tenant_name=args.tenant,
auth_url=args.keystone_url)
murano_client = mclient('1', endpoint=args.murano_url,
token=keystone_client.auth_token)
for env in murano_client.environments.list():
murano_client.environments.delete(env.id)

View File

@ -1,60 +0,0 @@
set timeout 30
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@murano"
send -- "sudo su\n"
expect "@murano"
send -- "sed -i \"s/#amqp_durable_queues=false/amqp_durable_queues=false/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#amqp_auto_delete=false/amqp_auto_delete=false/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_host=localhost/rabbit_host="
send -- [lindex $argv 2]
send -- "/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_port=5672/rabbit_port="
send -- [lindex $argv 3]
send -- "/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i 's/#\\(rabbit_hosts=.*\\)/\\1/' /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_use_ssl=false/rabbit_use_ssl="
send -- [lindex $argv 4]
send -- "/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_userid=guest/rabbit_userid="
send -- [lindex $argv 5]
send -- "/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_password=guest/rabbit_password=swordfish/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_virtual_host=\\//rabbit_virtual_host="
send -- [lindex $argv 5]
send -- "/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_retry_interval=1/rabbit_retry_interval=1/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_retry_backoff=2/rabbit_retry_backoff=2/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_max_retries=0/rabbit_max_retries=0/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_ha_queues=false/rabbit_ha_queues=false/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/auth_host = 127.0.0.1/auth_host = "
send -- [lindex $argv 2]
send -- "/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/connection = sqlite:\\/\\/\\/\\/etc\\/murano\\/murano-api.sqlite/connection = mysql:\\/\\/murano:swordfish@localhost:3306\\/murano/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "sed -i \"s/auth_url = http:\\/\\/localhost:5000\\/v2.0/auth_url = http:\\/\\/"
send -- [lindex $argv 2]
send -- ":5000\\/v2.0/\" /etc/murano/murano.conf\n"
expect "@murano"
send -- "murano-manage --config-file /etc/murano/murano.conf db-sync\n"
expect "@murano"
send -- "service murano-api restart\n"
expect "@murano"
send -- "service murano-engine restart\n"
expect "@murano"

View File

@ -1,12 +0,0 @@
set timeout 30
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@murano"
send -- "sudo su\n"
expect "@murano"
send -- "sed -i \"s/init_scripts_dir = \\/etc\\/murano\\/init-scripts/init_scripts_dir = \\/opt\\/git\\/murano-conductor\\/etc\\/init-scripts/\" /etc/murano-conductor/conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/agent_config_dir = \\/etc\\/murano\\/agent-config/agent_config_dir = \\/etc\\/murano-conductor\\/data\\/templates\\/agent-config/\" /etc/murano-conductor/conductor.conf\n"
expect "@murano"

View File

@ -1,72 +0,0 @@
set timeout 30
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@murano"
send -- "sudo su\n"
expect "@murano"
send -- "sed -i \"s/#amqp_durable_queues=false/amqp_durable_queues=false/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#amqp_auto_delete=false/amqp_auto_delete=false/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_host=localhost/rabbit_host="
send -- [lindex $argv 2]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_port=5672/rabbit_port="
send -- [lindex $argv 3]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_hosts=\$rabbit_host:\$rabbit_port/rabbit_hosts=\$rabbit_host:\$rabbit_port/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_use_ssl=false/rabbit_use_ssl="
send -- [lindex $argv 4]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_userid=guest/rabbit_userid="
send -- [lindex $argv 5]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_password=guest/rabbit_password=swordfish/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_virtual_host=\\//rabbit_virtual_host="
send -- [lindex $argv 5]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_retry_interval=1/rabbit_retry_interval=1/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_retry_backoff=2/rabbit_retry_backoff=2/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_max_retries=0/rabbit_max_retries=0/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/#rabbit_ha_queues=false/rabbit_ha_queues=false/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/auth_url = http:\\/\\/localhost:5000\\/v2.0/auth_url = http:\\/\\/"
send -- [lindex $argv 2]
send -- ":5000\\/v2.0/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/host = localhost/host = "
send -- [lindex $argv 2]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/port = 5672/port = "
send -- [lindex $argv 3]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/ssl = False/ssl = "
send -- [lindex $argv 4]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/login = guest/login = "
send -- [lindex $argv 5]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/password = guest/password = swordfish/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/virtual_host = \\//virtual_host = "
send -- [lindex $argv 5]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "service murano-conductor restart\n"
expect "@murano"

View File

@ -1,83 +0,0 @@
###
### Use:
### expect deploy_component.sh user 10.10.10.10 /refs/for/master/344332 murano-api
###
set timeout 1200
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@murano"
send -- "sudo su\n"
expect "@murano"
send -- "rm -rf /tmp/keystone-signing-muranoapi\n"
expect "@murano"
send -- "cd /opt/git/ ; rm -rf "
send -- [lindex $argv 3]
send -- "\n"
expect "@murano"
send -- "git clone https://github.com/stackforge/"
send -- [lindex $argv 3]
send -- "\n"
expect "@murano"
send -- "cd /opt/git/"
send -- [lindex $argv 3]
send -- "\n"
expect "@murano"
send -- "sh setup-centos.sh uninstall > 1.log\n"
expect "@murano"
send -- "sh setup.sh uninstall > 2.log\n"
expect "@murano"
send -- "git fetch https://review.openstack.org/stackforge/"
send -- [lindex $argv 3]
send -- " "
send -- [lindex $argv 2]
send -- " && git checkout FETCH_HEAD\n"
expect "@murano"
send -- "chown horizon:horizon /var/lib/openstack-dashboard/secret_key\n"
expect "@murano"
send -- "chmod 600 /var/lib/openstack-dashboard/secret_key\n"
expect "@murano"
send -- "chmod +x ./setup.sh ; ./setup.sh install > old.log\n"
expect "@murano"
send -- "chmod +x ./setupV2.sh ; ./setupV2.sh install > new.log\n"
expect "@murano"
send -- "sed -i \"s/\\\"BootFromVolume\\\": true,//\" /etc/murano-conductor/data/templates/cf/Linux.template\n"
expect "@murano"
send -- "sed -i \"s/\\\"BootFromVolume\\\": true,//\" /etc/murano-conductor/data/templates/cf/Windows.template\n"
expect "@murano"
send -- "service "
send -- [lindex $argv 3]
send -- " restart\n"
expect "@murano"
send -- "service openstack-"
send -- [lindex $argv 3]
send -- " restart\n"
expect "@murano"
send -- "cd /tmp/muranorepository-data/cache ; rm -rf *\n"
expect "@murano"
send -- "cd /tmp/muranorepository-cache ; rm -rf *\n"
expect "@murano"
send -- "cd /tmp/muranodashboard-cache ; rm -rf *\n"
expect "@murano"
send -- "cd /tmp/muranoconductor-cache ; rm -rf *\n"
expect "@murano"
send -- "service murano-repository restart\n"
send -- "service murano-conductor restart\n"
send -- "service apache2 restart\n"
send -- "exit\n"

View File

@ -1,94 +0,0 @@
###
### Use:
### expect deploy_component.sh user 10.10.10.10 /refs/for/master/344332 murano-api
###
set timeout 1200
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@murano"
send -- "sudo su\n"
expect "@murano"
send -- "rm -rf /tmp/keystone-signing-muranoapi\n"
expect "@murano"
send -- "rm -rf /tmp/keystone-signing-muranorepository\n"
expect "@murano"
send -- "cd /opt/git/ && rm -rf "
send -- [lindex $argv 3]
send -- "\n"
expect "@murano"
send -- "git clone https://github.com/stackforge/"
send -- [lindex $argv 3]
send -- "\n"
expect "@murano"
send -- "cd /opt/git/"
send -- [lindex $argv 3]
send -- "\n"
expect "@murano"
send -- "bash setup.sh uninstall > 2.log\n"
expect "@murano"
send -- "git fetch https://review.openstack.org/stackforge/"
send -- [lindex $argv 3]
send -- " "
send -- [lindex $argv 2]
send -- " && git checkout FETCH_HEAD\n"
expect "@murano"
send -- "chown horizon:horizon /var/lib/openstack-dashboard/secret_key\n"
expect "@murano"
send -- "chmod 600 /var/lib/openstack-dashboard/secret_key\n"
expect "@murano"
send -- "bash setup.sh install > old.log\n"
expect "@murano"
send -- "sed -i \"s/DEBUG = False/DEBUG = True/\" /etc/openstack-dashboard/local_settings.py\n"
expect -- "@murano"
send -- "sed -i \"s/OPENSTACK_HOST = \"127.0.0.1\"/OPENSTACK_HOST = \""
send -- [lindex $argv 4]
send -- "\" /etc/openstack-dashboard/local_settings.py\n"
expect -- "@murano"
send -- "service apache2 restart\n"
expect "@murano"
send -- "service openstack-"
send -- [lindex $argv 3]
send -- " restart\n"
expect "@murano"
send -- "service "
send -- [lindex $argv 3]
send -- " restart\n"
expect "@murano"
send -- "cd /var/cache/murano/muranorepository-data && rm -rf *\n"
expect "@murano"
send -- "cd /var/cache/murano-dashboard/ && rm -rf *\n"
expect "@murano"
send -- "cd /var/cache/murano/muranoconductor-data && rm -rf *\n"
expect "@murano"
send -- "service murano-api restart\n"
expect "@murano"
send -- "service murano-conductor restart\n"
expect "@murano"
send -- "service murano-repository restart\n"
expect "@murano"
send -- "service openstack-murano-api restart\n"
expect "@murano"
send -- "service openstack-murano-conductor restart\n"
expect "@murano"
send -- "service openstack-murano-repository restart\n"
expect "@murano"
send -- "service apache2 restart\n"
expect "@murano"
send -- "exit\n"

View File

@ -1,67 +0,0 @@
set timeout 200
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@mistral"
send -- "sudo su\n"
expect "@mistral"
send -- "git clone https://github.com/stackforge/mistral -b "
send -- [lindex $argv 3]
send -- "\n"
expect "@mistral"
send -- "cp mistral/etc/mistral.conf.example mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/auth_enable = True/auth_enable = False/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/rabbit_host = localhost/rabbit_host = "
send -- [lindex $argv 2]
send -- "/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/rabbit_port = 5672/rabbit_port = "
send -- [lindex $argv 4]
send -- "/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/rabbit_virtual_host = \\//rabbit_virtual_host = "
send -- [lindex $argv 5]
send -- "/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/rabbit_user = guest/rabbit_user = "
send -- [lindex $argv 5]
send -- "/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/rabbit_password = guest/rabbit_password = swordfish/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/auth_uri=http:\\/\\/localhost:5000\\/v3/auth_uri=http:\\/\\/"
send -- [lindex $argv 2]
send -- ":5000\\/v3/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/auth_host=localhost/auth_host="
send -- [lindex $argv 2]
send -- "/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/admin_user=admin/admin_user=AutotestUser/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/admin_password=password/admin_password=swordfish/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/admin_tenant_name=admin/admin_tenant_name=AutotestProject/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "cd mistral\n"
expect "@mistral"
send -- "screen -d -m bash -c 'tox -evenv -- python mistral/cmd/launch.py --server all --config-file etc/mistral.conf'\n"
sleep 120

View File

@ -1,74 +0,0 @@
set timeout 200
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@mistral"
send -- "sudo su\n"
expect "@mistral"
send -- "git clone https://github.com/stackforge/mistral -b "
send -- [lindex $argv 3]
send -- "\n"
expect "@mistral"
send -- "cd mistral\n"
expect "@mistral"
send -- "git fetch https://review.openstack.org/stackforge/mistral "
send -- [lindex $argv 6]
send -- " && git checkout FETCH_HEAD\n"
expect "@mistral"
send -- "cd ..\n"
expect "@mistral"
send -- "cp mistral/etc/mistral.conf.example mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/auth_enable = True/auth_enable = False/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/rabbit_host = localhost/rabbit_host = "
send -- [lindex $argv 2]
send -- "/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/rabbit_port = 5672/rabbit_port = "
send -- [lindex $argv 4]
send -- "/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/rabbit_virtual_host = \\//rabbit_virtual_host = "
send -- [lindex $argv 5]
send -- "/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/rabbit_user = guest/rabbit_user = "
send -- [lindex $argv 5]
send -- "/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/rabbit_password = guest/rabbit_password = swordfish/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/auth_uri=http:\\/\\/localhost:5000\\/v3/auth_uri=http:\\/\\/"
send -- [lindex $argv 2]
send -- ":5000\\/v3/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/auth_host=localhost/auth_host="
send -- [lindex $argv 2]
send -- "/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/admin_user=admin/admin_user=AutotestUser/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/admin_password=password/admin_password=swordfish/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "sed -i \"s/admin_tenant_name=admin/admin_tenant_name=AutotestProject/\" mistral/etc/mistral.conf\n"
expect "@mistral"
send -- "cd mistral\n"
expect "@mistral"
send -- "screen -d -m bash -c 'tox -evenv -- python mistral/cmd/launch.py --server all --config-file etc/mistral.conf'\n"
sleep 120

View File

@ -1,101 +0,0 @@
# Use:
# expect infra/deploy_vm.sh ubuntu 10.100.0.6 172.18.11.4 master 5672 True A002box
#
set timeout 30
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@murano"
send -- "sudo su\n"
expect "@murano"
send -- "sed -i \"s/LAB_HOST=''/LAB_HOST='"
send -- [lindex $argv 2]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/RABBITMQ_VHOST='A001box'/RABBITMQ_VHOST='"
send -- [lindex $argv 6]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/RABBITMQ_LOGIN='A001box'/RABBITMQ_LOGIN='"
send -- [lindex $argv 6]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/RABBITMQ_PORT=''/RABBITMQ_PORT='"
send -- [lindex $argv 4]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/BRANCH_NAME=''/BRANCH_NAME='"
send -- [lindex $argv 3]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "rm -rf /opt/git\n"
expect "@murano"
send -- "mkdir -p /opt/git\n"
expect "@murano"
send -- "cd /opt/git\n"
expect "@murano"
send -- "git clone https://github.com/stackforge/murano-deployment -b "
send -- [lindex $argv 3]
send -- "\n"
expect "@murano"
set timeout 600
send -- "cd murano-deployment/devbox-scripts/\n"
expect "@murano"
send -- "./murano-git-install.sh prerequisites\n"
expect "@murano"
send -- "pip install --upgrade pip==1.4.1\n"
expect "@murano"
send -- "./murano-git-install.sh install\n"
expect "@murano"
set timeout 30
send -- "sed -i \"s/connection = sqlite:\\/\\/\\/murano.sqlite/connection = mysql:\\/\\/murano:swordfish@localhost:3306\\/murano/\" /etc/murano/murano-api.conf\n"
expect "@murano"
send -- "sed -i \"s/ssl = False/ssl = "
send -- [lindex $argv 5]
send -- "/\" /etc/murano/murano-api.conf\n"
expect "@murano"
send -- "sed -i \"s/ssl = False/ssl = "
send -- [lindex $argv 5]
send -- "/\" /etc/murano/conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/\\\"BootFromVolume\\\": true,//\" /etc/murano-conductor/data/templates/cf/Linux.template\n"
expect "@murano"
send -- "sed -i \"s/\\\"BootFromVolume\\\": true,//\" /etc/murano-conductor/data/templates/cf/Windows.template\n"
expect "@murano"
send -- "sed -i \"s/murano_metadata_url = http:\\/\\/localhost:8084\\/v1/murano_metadata_url = http:\\/\\/"
send -- [lindex $argv 1]
send -- ":8084\\/v1/\" /etc/murano/conductor.conf\n"
expect "@murano"
send -- "echo \"LANGUAGE_CODE='en'\" >> /etc/openstack-dashboard/local_settings.py\n"
expect "@murano"
send -- "sed -i \"s/DEBUG = False/DEBUG = True/\" /etc/openstack-dashboard/local_settings.py\n"
expect -- "@murano"
send -- "service apache2 restart\n"
expect "@murano"
send -- "rm -rf /tmp/muranoconductor-cache/* /tmp/muranorepository-cache/*\n"
expect "@murano"
send -- "sed -i \"s/disable_rollback=False/disable_rollback=True/\" /usr/local/lib/python2.7/dist-packages/muranoconductor/commands/cloud_formation.py\n"
expect "@murano"
send -- "service murano-api restart\n"
expect "@murano"
send -- "service murano-conductor restart\n"
expect "@murano"
send -- "exit\n"

View File

@ -1,117 +0,0 @@
# Use:
# expect infra/deploy_vm.sh ubuntu 10.100.0.6 172.18.11.4 master 5672 True A002box
#
set timeout 30
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@murano"
send -- "sudo su\n"
expect "@murano"
send -- "sed -i \"s/LAB_HOST=''/LAB_HOST='"
send -- [lindex $argv 2]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/RABBITMQ_VHOST='A001box'/RABBITMQ_VHOST='"
send -- [lindex $argv 6]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/RABBITMQ_LOGIN='A001box'/RABBITMQ_LOGIN='"
send -- [lindex $argv 6]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/RABBITMQ_PORT=''/RABBITMQ_PORT='"
send -- [lindex $argv 4]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/BRANCH_NAME=''/BRANCH_NAME='"
send -- [lindex $argv 3]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "rm -rf /opt/git\n"
expect "@murano"
send -- "mkdir -p /opt/git\n"
expect "@murano"
send -- "cd /opt/git\n"
expect "@murano"
send -- "git clone https://github.com/stackforge/murano-deployment -b "
send -- [lindex $argv 3]
send -- "\n"
expect "@murano"
set timeout 600
send -- "cd murano-deployment/devbox-scripts/\n"
expect "@murano"
send -- "./murano-git-install.sh prerequisites\n"
expect "@murano"
send -- "pip install --upgrade pip==1.4.1\n"
expect "@murano"
send -- "./murano-git-install.sh install\n"
expect "@murano"
set timeout 30
send -- "sed -i \"s/connection = sqlite:\\/\\/\\/murano.sqlite/connection = mysql:\\/\\/murano:swordfish@localhost:3306\\/murano/\" /etc/murano/murano-api.conf\n"
expect "@murano"
send -- "sed -i \"s/ssl = False/ssl = "
send -- [lindex $argv 5]
send -- "/\" /etc/murano/murano-api.conf\n"
expect "@murano"
send -- "sed -i \"s/ssl = False/ssl = "
send -- [lindex $argv 5]
send -- "/\" /etc/murano/conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/ssl = False/ssl = "
send -- [lindex $argv 5]
send -- "/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/murano_metadata_url = http:\\/\\/localhost:8084\\/v1/murano_metadata_url = http:\\/\\/"
send -- [lindex $argv 1]
send -- ":8084\\/v1/\" /etc/murano/conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/murano_metadata_url = http:\\/\\/localhost:8084\\/v1/murano_metadata_url = http:\\/\\/"
send -- [lindex $argv 1]
send -- ":8084\\/v1/\" /etc/murano/murano-conductor.conf\n"
expect "@murano"
send -- "echo \"LANGUAGE_CODE='en'\" >> /etc/openstack-dashboard/local_settings.py\n"
expect "@murano"
send -- "sed -i \"s/DEBUG = False/DEBUG = True/\" /etc/openstack-dashboard/local_settings.py\n"
expect -- "@murano"
send -- "service apache2 restart\n"
expect "@murano"
send -- "rm -rf /var/cache/murano/muranoconductor-data/* /var/cache/murano/muranorepository-data/* /var/cache/murano-dashboard/*\n"
expect "@murano"
send -- "sed -i \"s/disable_rollback=False/disable_rollback=True/\" /usr/local/lib/python2.7/dist-packages/muranoconductor/commands/cloud_formation.py\n"
expect "@murano"
send -- "service murano-api restart\n"
expect "@murano"
send -- "service murano-conductor restart\n"
expect "@murano"
send -- "service murano-repository restart\n"
expect "@murano"
send -- "service openstack-murano-api restart\n"
expect "@murano"
send -- "service openstack-murano-conductor restart\n"
expect "@murano"
send -- "service openstack-murano-repository restart\n"
expect "@murano"
send -- "service apache2 restart\n"
expect "@murano"
send -- "exit\n"

View File

@ -1,97 +0,0 @@
# Use:
# expect infra/deploy_vm.sh ubuntu 10.100.0.6 172.18.11.4 master 5672 True A002box
#
set timeout 30
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@murano"
send -- "sudo su\n"
expect "@murano"
send -- "sed -i \"s/LAB_HOST=''/LAB_HOST='"
send -- [lindex $argv 2]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/RABBITMQ_VHOST='A001box'/RABBITMQ_VHOST='"
send -- [lindex $argv 6]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/RABBITMQ_LOGIN='A001box'/RABBITMQ_LOGIN='"
send -- [lindex $argv 6]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/RABBITMQ_PORT=''/RABBITMQ_PORT='"
send -- [lindex $argv 4]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "sed -i \"s/BRANCH_NAME=''/BRANCH_NAME='"
send -- [lindex $argv 3]
send -- "'/\" /etc/murano-deployment/lab-binding.rc\n"
expect "@murano"
send -- "rm -rf /opt/git\n"
expect "@murano"
send -- "mkdir -p /opt/git\n"
expect "@murano"
send -- "cd /opt/git\n"
expect "@murano"
send -- "git clone https://github.com/stackforge/murano-deployment -b "
send -- [lindex $argv 3]
send -- "\n"
expect "@murano"
set timeout 600
send -- "cd murano-deployment/devbox-scripts/\n"
expect "@murano"
send -- "./murano-git-install.sh prerequisites\n"
expect "@murano"
send -- "./murano-git-install.sh install\n"
expect "@murano"
set timeout 30
send -- "sed -i \"s/connection = sqlite:\\/\\/\\/murano.sqlite/connection = mysql:\\/\\/murano:swordfish@localhost:3306\\/murano/\" /etc/murano-api/murano-api.conf\n"
expect "@murano"
send -- "sed -i \"s/ssl = False/ssl = "
send -- [lindex $argv 5]
send -- "/\" /etc/murano-api/murano-api.conf\n"
expect "@murano"
send -- "sed -i \"s/ssl = False/ssl = "
send -- [lindex $argv 5]
send -- "/\" /etc/murano-conductor/conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/port = 5672/port = "
send -- [lindex $argv 4]
send -- "/\" /etc/murano-conductor/conductor.conf\n"
expect "@murano"
send -- "sed -i \"s/port = 5672/port = "
send -- [lindex $argv 4]
send -- "/\" /etc/murano-api/murano-api.conf\n"
expect "@murano"
send -- "sed -i \"s/\\\"BootFromVolume\\\": true,//\" /etc/murano-conductor/data/templates/cf/Linux.template\n"
expect "@murano"
send -- "sed -i \"s/\\\"BootFromVolume\\\": true,//\" /etc/murano-conductor/data/templates/cf/Windows.template\n"
expect "@murano"
send -- "service murano-api restart\n"
expect "@murano"
send -- "service murano-conductor restart\n"
expect "@murano"
send -- "echo \"LANGUAGE_CODE='en'\" >> /etc/openstack-dashboard/local_settings.py\n"
expect "@murano"
send -- "service apache2 restart\n"
expect "@murano"
send -- "exit\n"

View File

@ -1,112 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the 'License'); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import json
from flask import Flask, jsonify, request, abort, send_from_directory
from werkzeug import secure_filename
app = Flask(__name__)
hosts = {}
def save_config():
with open('server.conf', 'w') as config_file:
json.dump(hosts, config_file)
def read_config():
global hosts
with open('server.conf', 'r') as config_file:
hosts = json.load(config_file)
@app.route('/hosts', methods=['GET'])
def get_list_of_hosts():
return jsonify({'hosts': hosts})
@app.route('/hosts', methods=['POST'])
def add_host():
data = json.loads(request.data)
if not 'host_name' in data or not 'ip' in data:
abort(403)
hosts.update({data['host_name']: {'ip': data['ip'],
'files': []}})
save_config()
return jsonify({'hosts': hosts}), 201
@app.route('/hosts/<path:host_name>', methods=['GET'])
def get_host(host_name):
if not host_name in hosts:
abort(404)
return jsonify({'host': hosts[host_name]})
@app.route('/hosts/<path:host_name>', methods=['DELETE'])
def delete_host(host_name):
if not host_name in hosts:
abort(404)
del hosts[host_name]
save_config()
return 'OK', 200
@app.route('/hosts/<path:host_name>/files', methods=['POST'])
def add_file(host_name):
if not host_name in hosts:
abort(404)
for param, file_ in request.files:
if not file_name in hosts[host_name]['files']:
hosts[host_name]['files'].append(file_.filename)
directory = os.path.join('/var/monitor/files', host_name)
if not os.path.exists(directory):
os.makedirs(directory)
full_name = os.path.join(directory, secure_filename(file_.filename))
file_.save(full_name)
save_config()
return jsonify({'host': hosts[host_name]})
@app.route('/hosts/<path:host_name>/files/<path:file_name>',
methods=['GET'])
def get_file(host_name, file_name):
if not host_name in hosts:
return "Host does not exist", 404
if not file_name in hosts[host_name]['files']:
return "File does not exist", 404
path = os.path.join('/var/monitor/files', host_name)
return send_from_directory(path, file_name)
if __name__ == '__main__':
read_config()
app.run(debug=True, port=7007)

View File

@ -1,51 +0,0 @@
# Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the 'License'); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
msg = """
### Please use this script for the
### XML RobotFramework reports merging:
### python merge_robot_results.py output1.xml output2.xml
"""
### To install requirements:
### sudo pip install BeautifulSoup4 python-dateutil
import sys
from dateutil import parser
from bs4 import BeautifulSoup
import codecs
files = []
for i in range(len(sys.argv) - 1):
try:
f = codecs.open(sys.argv[i + 1], 'r', 'utf-8').read()
res = BeautifulSoup(f)
files.append(res)
except:
print "Incorrect XML file:", sys.argv[i + 1]
if files:
for test in files[0].robot.suite.find_all('test'):
for f in files[1:]:
for retest in f.robot.suite.find_all('test'):
if test['name'] == retest['name']:
test.replace_with(retest)
if files[0].robot.statistics:
files[0].robot.statistics.replace_with('')
result = open('result.xml', 'w')
result.write(files[0].prettify())
result.close()
else:
print msg

View File

@ -1,47 +0,0 @@
###
### Use:
### expect repository-mirroring.sh root 10.10.10.10 gerrit-user murano-api
###
### Manual way is the following:
### 1. git clone --mirror https://github.com/stackforge/murano-api.git
### 2. cd murano-api.git/
### 3. git fetch origin +refs/meta/*:refs/meta/*
### 4. git push --mirror ssh://tnurlygayanov@gerrit.mirantis.com:29418/murano/murano-api.git
###
### after that you should not perform Step #3 again.
set timeout 1200
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "password"
send -- [lindex $argv 2]
send -- "\n"
expect "*@reposync*"
send -- "sudo su\n"
expect "*#*"
send -- "git clone --mirror https://github.com/stackforge/"
send -- [lindex $argv 4]
send -- ".git\n"
expect "*#*"
send -- "cd "
send -- [lindex $argv 4]
send -- ".git\n"
expect "*#*"
send -- "git fetch\n"
expect "*#*"
send -- "git push --mirror ssh://"
send -- [lindex $argv 3]
send -- "@gerrit.mirantis.com:29418/openstack/"
send -- [lindex $argv 4]
send -- ".git\n"
expect "*#*"
send -- "exit\n"

View File

@ -1,9 +0,0 @@
import sys
from pysphere import VIServer
server = VIServer()
server.connect(sys.argv[1], sys.argv[2], sys.argv[3])
vm = server.get_vm_by_name(sys.argv[4])
vm.revert_to_snapshot()
print "VM prepared."

View File

@ -1,44 +0,0 @@
# Copyright 2013 OpenStack Foundation
# Copyright 2013 Mirantis Inc
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import time
import argparse
import novaclient.v1_1.client as nova_client
parser = argparse.ArgumentParser()
parser.add_argument('--user', type=str, default='admin')
parser.add_argument('--password', type=str, default='password')
parser.add_argument('--tenant', type=str, default='admin')
parser.add_argument('--keystone_url', type=str,
default='http://localhost:5000/v2.0/')
parser.add_argument('--instance_name', type=str)
parser.add_argument('--snapshot_name', type=str)
args = parser.parse_args()
nova = nova_client.Client(args.user, args.password, args.tenant,
args.keystone_url, service_type = 'compute')
image = nova.images.find(name=args.snapshot_name)
server = nova.servers.find(name=args.instance_name)
server.rebuild(image)
time.sleep(2) # Wait until the start of recovery
server = nova.servers.find(name=args.instance_name)
while server.status == 'REBUILD':
server = nova.servers.find(name=args.instance_name)
if server.status != 'ACTIVE':
server.start()

View File

@ -1,16 +0,0 @@
set timeout 30
send_user "\n\nStart to login to the test bed...\n\n"
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 1]
expect "@murano"
send -- "sudo su\n"
expect "@murano"
send -- "sed -i \"s/connection = mysql:\\/\\/murano:swordfish@localhost:3306\\/murano/connection = mysql:\\/\\/murano:swordfish@"
send -- [lindex $argv 2]
send -- ":3306\\/murano/\" /etc/murano-api/murano-api.conf\n"
expect "@murano"
send -- "service murano-api restart\n"
expect "@murano"
send -- "exit\n"

View File

@ -1,26 +0,0 @@
from v1.murano_client import murano_client as Client
import etc.config as cfg
import testtools
import testresources
class MuranoBase(testtools.TestCase, testtools.testcase.WithAttributes,
testresources.ResourcedTestCase):
@classmethod
def setUpClass(cls):
super(MuranoBase, cls).setUpClass()
cls.client = Client(user=cfg.murano.user, password=cfg.murano.password,
tenant=cfg.murano.tenant,
auth_url=cfg.murano.auth_url,
base_url=cfg.murano.murano_url)
cls.environments = []
def tearDown(self):
super(MuranoBase, self).tearDown()
for env in self.environments:
try:
self.client.delete_environment(env)
except Exception:
pass

View File

@ -1,6 +0,0 @@
[murano]
auth_url = http://127.0.0.1:5000/v2.0/
murano_url = http://127.0.0.1:8082
user = admin
password = admin
tenant = admin

View File

@ -1,38 +0,0 @@
import os
from oslo.config import cfg
murano_group = cfg.OptGroup(name='murano', title="murano")
MuranoGroup = [
cfg.StrOpt('auth_url',
default='http://127.0.0.1:5000/v2.0/',
help="keystone url"),
cfg.StrOpt('murano_url',
default='http://127.0.0.1:8082',
help="murano url"),
cfg.StrOpt('user',
default='admin',
help="keystone user"),
cfg.StrOpt('password',
default='pass',
help="password for keystone user"),
cfg.StrOpt('tenant',
default='admin',
help='keystone tenant')
]
def register_config(config, config_group, config_opts):
config.register_group(config_group)
config.register_opts(config_opts, config_group)
path = os.path.join("%s/etc/config.conf" % os.getcwd())
if os.path.exists(path):
cfg.CONF([], project='muranointegration', default_config_files=[path])
register_config(cfg.CONF, murano_group, MuranoGroup)
murano = cfg.CONF.murano

View File

@ -1,17 +0,0 @@
import sys
import os
sys.path.append(os.getcwd())
from base import MuranoBase
class MuranoEnvs(MuranoBase):
def test_create_and_delete_environment(self):
resp = self.client.create_environment('test')
self.environments.append(resp.json()['id'])
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.json()['name'], 'test')
env = self.client.get_list_environments().json()['environments'][0]['name']
self.assertEqual(env, 'test')
resp = self.client.delete_environment(resp.json()['id'])
self.assertEqual(resp.status_code, 200)

View File

@ -1,80 +0,0 @@
import requests
import json
from keystoneclient.v2_0 import client as ksclient
class Client(object):
def __init__(self, user, password, tenant, auth_url, base_url):
self.auth = ksclient.Client(username=user, password=password,
tenant_name=tenant, auth_url=auth_url)
self.headers = {'X-Auth-Token': self.auth.auth_token}
if base_url[-1] == '/':
self.url = base_url
else:
self.url = base_url + '/'
self.TYPE = 'json'
def get(self, path, headers=None, TYPE=None):
if headers is None:
headers = self.headers
if TYPE is None:
headers.update({'Content-Type': 'application/%s' % self.TYPE})
else:
headers.update({'Content-Type': TYPE})
url = self.url + path
resp = requests.get(url, headers=headers)
return resp
def delete(self, path, headers=None, TYPE=None):
if headers is None:
headers = self.headers
if TYPE is None:
headers.update({'Content-Type': 'application/%s' % self.TYPE})
else:
headers.update({'Content-Type': TYPE})
url = self.url + path
resp = requests.delete(url, headers=headers)
return resp
def post(self, path, body=None, files=None, headers=None, TYPE=None):
if headers is None:
headers = self.headers
if TYPE is None:
headers.update({'Content-Type': 'application/%s' % self.TYPE})
else:
headers.update({'Content-Type': TYPE})
url = self.url + path
resp = requests.post(url, data=body, files=files, headers=headers)
return resp
def put(self, path, body=None, files=None, headers=None, TYPE=None):
if headers is None:
headers = self.headers
if TYPE is None:
headers.update({'Content-Type': 'application/%s' % self.TYPE})
else:
headers.update({'Content-Type': TYPE})
url = self.url + path
resp = requests.put(url, data=body, files=files, headers=headers)
return resp
class murano_client(Client):
def __init__(self, user, password, tenant, auth_url, base_url):
super(murano_client, self).__init__(user, password, tenant, auth_url,
base_url)
def create_environment(self, name):
post_body = {'name': name}
post_body = json.dumps(post_body)
resp = self.post('environments', body=post_body, headers=self.headers)
return resp
def delete_environment(self, environment_id):
resp = self.delete('environments/%s' % environment_id,
headers=self.headers)
return resp
def get_list_environments(self):
resp = self.get('environments', headers=self.headers)
return resp

View File

@ -1,765 +0,0 @@
from keystoneclient.v2_0 import client as ksclient
from muranoclient.v1.client import Client as murano_client
from glanceclient import Client as gclient
import testtools
import testresources
import config as cfg
import json
import time
class MuranoBase(testtools.TestCase, testtools.testcase.WithAttributes,
testresources.ResourcedTestCase):
@classmethod
def setUpClass(cls):
super(MuranoBase, cls).setUpClass()
cls.auth = ksclient.Client(username=cfg.murano.user,
password=cfg.murano.password,
tenant_name=cfg.murano.tenant,
auth_url=cfg.murano.auth_url)
cls.murano = murano_client(endpoint=cfg.murano.murano_url,
token=cls.auth.auth_token)
def setUp(self):
super(MuranoBase, self).setUp()
self.environments_id = []
def tearDown(self):
super(MuranoBase, self).tearDown()
for environment_id in self.environments_id:
try:
self.murano.environments.delete(environment_id)
except Exception:
pass
def create_demo_service(self, environment_id, session_id,
image_name="demo"):
post_body = {"availabilityZone": "nova", "name": "demo",
"unitNamingPattern": "host",
"osImage": {"type": "cirros.demo", "name": image_name,
"title": "Demo"},
"units": [{}], "flavor": "m1.small",
"configuration": "standalone", "type": "demoService"}
return self.murano.services.post(environment_id,
path='/',
data=post_body,
session_id=session_id)
def create_linux_telnet(self, environment_id, session_id,
image_name="linux"):
post_body = {"availabilityZone": "nova", "name": "LinuxTelnet",
"deployTelnet": True, "unitNamingPattern": "telnet",
"keyPair": "murano-lb-key",
"osImage": {"type": "linux", "name": image_name,
"title": "Linux Image"},
"units": [{}],
"flavor": "m1.small", "type": "linuxTelnetService"}
return self.murano.services.post(environment_id,
path='/',
data=post_body,
session_id=session_id)
def create_linux_apache(self, environment_id, session_id,
image_name="linux"):
post_body = {"availabilityZone": "nova", "name": "LinuxApache",
"deployApachePHP": True, "unitNamingPattern": "apache",
"keyPair": "murano-lb-key",
"instanceCount": [{}],
"osImage": {"type": "linux", "name": image_name,
"title": "Linux Image"},
"units": [{}],
"flavor": "m1.small", "type": "linuxApacheService"}
return self.murano.services.post(environment_id,
path='/',
data=post_body,
session_id=session_id)
def create_windows_active_directory(self, environment_id, session_id,
image_name="windows"):
post_body = {"type": "activeDirectory", "name": "ad.local",
"adminPassword": "P@ssw0rd", "domain": "ad.local",
"availabilityZone": "nova",
"unitNamingPattern": "adinstance",
"flavor": "m1.medium", "osImage":
{"type": "ws-2012-std", "name": image_name,
"title": "Windows Server 2012 Standard"},
"configuration": "standalone",
"units": [{"isMaster": True,
"recoveryPassword": "P@ssw0rd",
"location": "west-dc"}]}
return self.murano.services.post(environment_id,
path='/',
data=post_body,
session_id=session_id)
def create_windows_iis(self, environment_id, session_id, domain_name="",
image_name="windows"):
post_body = {"type": "webServer", "domain": domain_name,
"availabilityZone": "nova", "name": "IisService",
"adminPassword": "P@ssw0rd",
"unitNamingPattern": "iisinstance",
"osImage": {"type": "ws-2012-std", "name": image_name,
"title": "Windows Server 2012 Standard"},
"units": [{}],
"credentials": {"username": "Administrator",
"password": "P@ssw0rd"},
"flavor": "m1.medium"}
return self.murano.services.post(environment_id,
path='/',
data=post_body,
session_id=session_id)
def create_windows_aspnet(self, environment_id, session_id,
domain_name="", image_name="windows"):
post_body = {"type": "aspNetApp", "domain": domain_name,
"availabilityZone": "nova",
"name": "someasp", "repository":
"git://github.com/Mirantis/murano-mvc-demo.git",
"adminPassword": "P@ssw0rd",
"unitNamingPattern": "aspnetinstance",
"osImage": {"type": "ws-2012-std", "name": image_name,
"title": "Windows Server 2012 Standard"},
"units": [{}],
"credentials": {"username": "Administrator",
"password": "P@ssw0rd"},
"flavor": "m1.medium"}
return self.murano.services.post(environment_id,
path='/',
data=post_body,
session_id=session_id)
def create_windows_iis_farm(self, environment_id, session_id,
domain_name="", image_name="windows"):
post_body = {"type": "webServerFarm", "domain": domain_name,
"availabilityZone": "nova", "name": "someIISFARM",
"adminPassword": "P@ssw0rd", "loadBalancerPort": 80,
"unitNamingPattern": "",
"osImage": {"type": "ws-2012-std", "name": image_name,
"title": "Windows Server 2012 Standard"},
"units": [{}, {}],
"credentials": {"username": "Administrator",
"password": "P@ssw0rd"},
"flavor": "m1.medium"}
return self.murano.services.post(environment_id,
path='/',
data=post_body,
session_id=session_id)
def create_windows_aspnet_farm(self, environment_id, session_id,
domain_name="", image_name="windows"):
post_body = {"type": "aspNetAppFarm", "domain": domain_name,
"availabilityZone": "nova", "name": "SomeApsFarm",
"repository":
"git://github.com/Mirantis/murano-mvc-demo.git",
"adminPassword": "P@ssw0rd", "loadBalancerPort": 80,
"unitNamingPattern": "",
"osImage": {"type": "ws-2012-std", "name": image_name,
"title": "Windows Server 2012 Standard"},
"units": [{}, {}],
"credentials": {"username": "Administrator",
"password": "P@ssw0rd"},
"flavor": "m1.medium"}
return self.murano.services.post(environment_id,
path='/',
data=post_body,
session_id=session_id)
def create_windows_sql(self, environment_id, session_id, domain_name="",
image_name="windows"):
post_body = {"type": "msSqlServer", "domain": domain_name,
"availabilityZone": "nova", "name": "SQLSERVER",
"adminPassword": "P@ssw0rd",
"unitNamingPattern": "sqlinstance",
"saPassword": "P@ssw0rd", "mixedModeAuth": True,
"osImage": {"type": "ws-2012-std", "name": image_name,
"title": "Windows Server 2012 Standard"},
"units": [{}],
"credentials": {"username": "Administrator",
"password": "P@ssw0rd"},
"flavor": "m1.medium"}
return self.murano.services.post(environment_id,
path='/',
data=post_body,
session_id=session_id)
def create_windows_sql_cluster(self, environment_id, session_id,
domain_name="", image_name="windows"):
post_body = {"domain": domain_name, "domainAdminPassword": "P@ssw0rd",
"externalAD": False,
"sqlServiceUserName": "Administrator",
"sqlServicePassword": "P@ssw0rd",
"osImage": {"type": "ws-2012-std", "name": image_name,
"title": "Windows Server 2012 Standard"},
"agListenerName": "SomeSQL_AGListner",
"flavor": "m1.medium",
"agGroupName": "SomeSQL_AG",
"domainAdminUserName": "Administrator",
"agListenerIP": "10.0.0.150",
"clusterIP": "10.0.0.155",
"type": "msSqlClusterServer", "availabilityZone": "nova",
"adminPassword": "P@ssw0rd",
"clusterName": "SomeSQL", "mixedModeAuth": True,
"unitNamingPattern": "",
"units": [{"isMaster": True, "name": "node1",
"isSync": True},
{"isMaster": False, "name": "node2",
"isSync": True}],
"name": "Sqlname", "saPassword": "P@ssw0rd",
"databases": ['NewDB']}
return self.murano.services.post(environment_id,
path='/',
data=post_body,
session_id=session_id)
class MuranoEnvironments(MuranoBase):
def test_create_and_delete_environment(self):
environment = self.murano.environments.create('testenv')
self.environments_id.append(environment.id)
self.assertIn(environment, self.murano.environments.list())
self.murano.environments.delete(environment.id)
self.assertNotIn(environment, self.murano.environments.list())
self.environments_id.pop(self.environments_id.index(environment.id))
def test_get_environments_list(self):
environments_list = self.murano.environments.list()
self.assertTrue(isinstance(environments_list, list))
def test_update_environment(self):
environment = self.murano.environments.create('testenv')
self.environments_id.append(environment.id)
new_environment = self.murano.environments.update(environment.id,
'testenvupdated')
self.assertEqual(new_environment.name, 'testenvupdated')
def test_get_environment(self):
environment = self.murano.environments.create('testenv')
self.environments_id.append(environment.id)
gotten_environment = self.murano.environments.get(environment.id)
self.assertEqual(environment, gotten_environment)
class MuranoSessions(MuranoBase):
def test_create_and_delete_session(self):
environment = self.murano.environments.create('testenv')
self.environments_id.append(environment.id)
session = self.murano.sessions.configure(environment.id)
self.assertEqual(session.environment_id, environment.id)
self.murano.sessions.delete(environment.id, session.id)
def test_get_session(self):
environment = self.murano.environments.create('testenv')
self.environments_id.append(environment.id)
session = self.murano.sessions.configure(environment.id)
gotten_session = self.murano.sessions.get(environment.id, session.id)
self.assertEqual(session, gotten_session)
class MuranoServices(MuranoBase):
def test_create_and_delete_demo_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
service = self.create_demo_service(environment.id, session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertIn((service.name, service.id), services)
self.murano.services.delete(environment.id,
'/' + service.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertNotIn((service.name, service.id), services)
def test_create_and_delete_linux_telnet_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
service = self.create_linux_telnet(environment.id, session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertIn((service.name, service.id), services)
self.murano.services.delete(environment.id,
'/' + service.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertNotIn((service.name, service.id), services)
def test_create_and_delete_linux_apache_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
service = self.create_linux_apache(environment.id, session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertIn((service.name, service.id), services)
self.murano.services.delete(environment.id,
'/' + service.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertNotIn((service.name, service.id), services)
def test_create_and_delete_windows_active_directory_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
service = self.create_windows_active_directory(environment.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertIn((service.name, service.id), services)
self.murano.services.delete(environment.id,
'/' + service.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertNotIn((service.name, service.id), services)
def test_create_and_delete_windows_iis_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
service = self.create_windows_iis(environment.id, session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertIn((service.name, service.id), services)
self.murano.services.delete(environment.id,
'/' + service.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertNotIn((service.name, service.id), services)
def test_create_and_delete_windows_aspnet_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
service = self.create_windows_aspnet(environment.id, session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertIn((service.name, service.id), services)
self.murano.services.delete(environment.id,
'/' + service.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertNotIn((service.name, service.id), services)
def test_create_and_delete_windows_iis_farm_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
service = self.create_windows_iis_farm(environment.id, session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertIn((service.name, service.id), services)
self.murano.services.delete(environment.id,
'/' + service.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertNotIn((service.name, service.id), services)
def test_create_and_delete_windows_aspnet_farm_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
service = self.create_windows_aspnet_farm(environment.id, session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertIn((service.name, service.id), services)
self.murano.services.delete(environment.id,
'/' + service.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertNotIn((service.name, service.id), services)
def test_create_and_delete_windows_sql_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
service = self.create_windows_sql(environment.id, session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertIn((service.name, service.id), services)
self.murano.services.delete(environment.id,
'/' + service.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertNotIn((service.name, service.id), services)
def test_create_and_delete_windows_sql_cluster_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
service = self.create_windows_sql_cluster(environment.id, session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertIn((service.name, service.id), services)
self.murano.services.delete(environment.id,
'/' + service.id,
session.id)
gotten_environment = self.murano.environments.get(environment.id,
session.id)
services = [(x['name'], x['id']) for x in gotten_environment.services]
self.assertNotIn((service.name, service.id), services)
class ImageException(Exception):
message = "Image doesn't exist"
def __init__(self, type):
self._error_string = self.message + '\nDetails: %s' \
' image is not found,' % str(type)
def __str__(self):
return self._error_string
class MuranoDeploy(MuranoBase):
@classmethod
def setUpClass(cls):
super(MuranoDeploy, cls).setUpClass()
if not cfg.murano.deploy:
raise cls.skipException("Murano deployment tests are disabled")
glance_endpoint = cls.auth.service_catalog.url_for(
service_type='image', endpoint_type='publicURL')
glance = gclient('1', endpoint=glance_endpoint,
token=cls.auth.auth_token)
image_list = []
for i in glance.images.list():
image_list.append(i)
cls.demo_image = cls.get_image_name('demo', image_list)
cls.linux_image = cls.get_image_name('linux', image_list)
cls.windows_image = cls.get_image_name('windows', image_list)
@classmethod
def get_image_name(cls, type_of_image, list_of_images):
for i in list_of_images:
if 'murano_image_info' in i.properties.keys():
if type_of_image in json.loads(
i.properties['murano_image_info'])['type']:
return i.name
raise ImageException(type_of_image)
def test_deploy_demo_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
self.create_demo_service(environment.id, session.id,
image_name=self.demo_image)
self.murano.sessions.deploy(environment.id, session.id)
time_start = time.time()
gotten_environment = self.murano.environments.get(environment.id)
while gotten_environment.status != 'ready':
if time.time() - time_start > 1000:
break
gotten_environment = self.murano.environments.get(environment.id)
deployments = self.murano.deployments.list(environment.id)
self.assertEqual(deployments[0].state, 'success')
def test_deploy_linux_telnet_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
self.create_linux_telnet(environment.id, session.id,
image_name=self.linux_image)
self.murano.sessions.deploy(environment.id, session.id)
time_start = time.time()
gotten_environment = self.murano.environments.get(environment.id)
while gotten_environment.status != 'ready':
if time.time() - time_start > 1800:
break
gotten_environment = self.murano.environments.get(environment.id)
deployments = self.murano.deployments.list(environment.id)
self.assertEqual(deployments[0].state, 'success')
def test_deploy_linux_apache_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
self.create_linux_apache(environment.id, session.id,
image_name=self.linux_image)
self.murano.sessions.deploy(environment.id, session.id)
time_start = time.time()
gotten_environment = self.murano.environments.get(environment.id)
while gotten_environment.status != 'ready':
if time.time() - time_start > 1800:
break
gotten_environment = self.murano.environments.get(environment.id)
deployments = self.murano.deployments.list(environment.id)
self.assertEqual(deployments[0].state, 'success')
def test_deploy_windows_ad_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
self.create_windows_active_directory(environment.id, session.id,
image_name=self.windows_image)
self.murano.sessions.deploy(environment.id, session.id)
time_start = time.time()
gotten_environment = self.murano.environments.get(environment.id)
while gotten_environment.status != 'ready':
if time.time() - time_start > 1800:
break
gotten_environment = self.murano.environments.get(environment.id)
deployments = self.murano.deployments.list(environment.id)
self.assertEqual(deployments[0].state, 'success')
def test_deploy_windows_iis_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
self.create_windows_iis(environment.id, session.id,
image_name=self.windows_image)
self.murano.sessions.deploy(environment.id, session.id)
time_start = time.time()
gotten_environment = self.murano.environments.get(environment.id)
while gotten_environment.status != 'ready':
if time.time() - time_start > 1800:
break
gotten_environment = self.murano.environments.get(environment.id)
deployments = self.murano.deployments.list(environment.id)
self.assertEqual(deployments[0].state, 'success')
def test_deploy_windows_aspnet_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
self.create_windows_aspnet(environment.id, session.id,
image_name=self.windows_image)
self.murano.sessions.deploy(environment.id, session.id)
time_start = time.time()
gotten_environment = self.murano.environments.get(environment.id)
while gotten_environment.status != 'ready':
if time.time() - time_start > 1800:
break
gotten_environment = self.murano.environments.get(environment.id)
deployments = self.murano.deployments.list(environment.id)
self.assertEqual(deployments[0].state, 'success')
def test_deploy_windows_iis_farm_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
self.create_windows_iis_farm(environment.id, session.id,
image_name=self.windows_image)
self.murano.sessions.deploy(environment.id, session.id)
time_start = time.time()
gotten_environment = self.murano.environments.get(environment.id)
while gotten_environment.status != 'ready':
if time.time() - time_start > 1800:
break
gotten_environment = self.murano.environments.get(environment.id)
deployments = self.murano.deployments.list(environment.id)
self.assertEqual(deployments[0].state, 'success')
def test_deploy_windows_aspnet_farm_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
self.create_windows_aspnet_farm(environment.id, session.id,
image_name=self.windows_image)
self.murano.sessions.deploy(environment.id, session.id)
time_start = time.time()
gotten_environment = self.murano.environments.get(environment.id)
while gotten_environment.status != 'ready':
if time.time() - time_start > 1800:
break
gotten_environment = self.murano.environments.get(environment.id)
deployments = self.murano.deployments.list(environment.id)
self.assertEqual(deployments[0].state, 'success')
def test_deploy_windows_sql_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
self.create_windows_sql(environment.id, session.id,
image_name=self.windows_image)
self.murano.sessions.deploy(environment.id, session.id)
time_start = time.time()
gotten_environment = self.murano.environments.get(environment.id)
while gotten_environment.status != 'ready':
if time.time() - time_start > 1800:
break
gotten_environment = self.murano.environments.get(environment.id)
deployments = self.murano.deployments.list(environment.id)
self.assertEqual(deployments[0].state, 'success')
def test_deploy_windows_sql_cluster_service(self):
environment = self.murano.environments.create('testenv')
session = self.murano.sessions.configure(environment.id)
self.environments_id.append(environment.id)
self.create_windows_active_directory(environment.id, session.id,
image_name=self.windows_image)
self.create_windows_sql_cluster(environment.id, session.id,
domain_name="ad.local",
image_name=self.windows_image)
self.murano.sessions.deploy(environment.id, session.id)
time_start = time.time()
gotten_environment = self.murano.environments.get(environment.id)
while gotten_environment.status != 'ready':
if time.time() - time_start > 3000:
break
gotten_environment = self.murano.environments.get(environment.id)
deployments = self.murano.deployments.list(environment.id)
self.assertEqual(deployments[0].state, 'success')

View File

@ -1,7 +0,0 @@
[murano]
auth_url = http://localhost:5000/v2.0/
murano_url = http://localhost:8082
user = admin
password = admin
tenant = admin
deploy = False

View File

@ -1,41 +0,0 @@
import os
from oslo.config import cfg
murano_group = cfg.OptGroup(name='murano', title="murano")
MuranoGroup = [
cfg.StrOpt('auth_url',
default='http://127.0.0.1:5000/v2.0/',
help="keystone url"),
cfg.StrOpt('murano_url',
default='http://127.0.0.1:8082',
help="murano url"),
cfg.StrOpt('user',
default='admin',
help="keystone user"),
cfg.StrOpt('password',
default='pass',
help="password for keystone user"),
cfg.StrOpt('tenant',
default='admin',
help='keystone tenant'),
cfg.BoolOpt('deploy',
default=False,
help='Run deploy tests or no')
]
def register_config(config, config_group, config_opts):
config.register_group(config_group)
config.register_opts(config_opts, config_group)
path = os.path.join("%s/config.conf" % os.getcwd())
if os.path.exists(path):
cfg.CONF([], project='muranointegration', default_config_files=[path])
register_config(cfg.CONF, murano_group, MuranoGroup)
murano = cfg.CONF.murano

View File

@ -1,11 +0,0 @@
oslo.config>=1.2.0
python-keystoneclient>=0.6.0
testresources>=0.2.4
testtools>=0.9.34
python-glanceclient>=0.9.0
simplejson>=2.0.9
jsonpatch>=1.1
jsonpath-rw>=1.2.0,<2.0
jsonrpclib
jsonschema>=2.0.0,<3.0.0
python-muranoclient

View File

@ -1,16 +0,0 @@
import requests
from keystoneclient.v2_0 import client
keystone = client.Client(username='admin', password='swordfish',
tenant_name='admin',
auth_url='http://172.18.124.203:5000/v2.0/')
headers = {'Content-Type': 'application/json',
'X-Auth-Token': str(keystone.auth_token)}
r = requests.get('http://localhost:8989/', headers=headers)
print r.text
r = requests.get('http://localhost:8989/v1/', headers=headers)
print r.text
r = requests.get('http://localhost:8989/v1/workbooks', headers=headers)
print r.text

View File

@ -1,379 +0,0 @@
<workflow>
<rule match="$.services[?(@.type == 'activeDirectory' and @.domain)].units[?(not @.isMaster)]"
desc="Slave units of AD services">
<set path="domain">
<select path="::domain"/>
</set>
<mute/>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory' and @.osImage.name)].units[?(@.state.hostname and not @.temp.instanceName)]"
desc="Units of AD services which have got hostname and image assigned, but instances not deployed yet">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<update-cf-stack template="Windows" error="exception">
<parameter name="mappings">
<map>
<mapping name="instanceName"><select path="state.hostname"/></mapping>
<mapping name="userData">
<prepare-user-data>
<parameter name="hostname"><select path="state.hostname"/></parameter>
<parameter name="unit"><select path="id"/></parameter>
<parameter name="service"><select path="::id"/></parameter>
</prepare-user-data>
</mapping>
<mapping name="instanceType"><select path="::flavor" default="m1.medium"/></mapping>
<mapping name="imageName"><select path="::osImage.name"/></mapping>
<mapping name="availabilityZone"><select path="::availabilityZone" default="nova"/></mapping>
</map>
</parameter>
<success>
<set path="temp.instanceName"><select path="name"/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Instance <select path="state.hostname"/> (<select path="name"/>) created</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to deploy instance <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="message" default="unknown Heat error"/> </parameter>
</report>
<stop/>
</failure>
</update-cf-stack>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory')].units[?(@.temp.instanceName and @.adminPassword and @.adminPassword != @.state.adminPassword)]"
desc="Units of AD services which have got instances deployed but the local admin passwords not set yet">
<send-command template="SetPassword" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="adminPassword">
<select path="adminPassword"/>
</mapping>
</map>
</parameter>
<success>
<set path="state.adminPassword">
<select path="adminPassword"/>
</set>
</success>
<failure>
<report entity="unit" level="warning">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to set admin password on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<mute/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory' and @.adminPassword and @.adminPassword != @.state.domainAdminPassword)].units[?(@.temp.instanceName and @.isMaster)]"
desc="Deployed master-units of AD services for which the domain admin password is not set yet">
<send-command template="SetPassword" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="adminPassword">
<select path="::adminPassword"/>
</mapping>
</map>
</parameter>
<success>
<set path="::state.domainAdminPassword">
<select path="::adminPassword"/>
</set>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to set domain administrator password on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory' and @.state.primaryDc is None)].units[?(@.temp.instanceName and @.isMaster)]"
desc="Deployed master-units of AD services on which the Primary DC has not been installed yet ">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating Primary Domain Controller on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<send-command template="CreatePrimaryDC" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="domain">
<select path="::domain"/>
</mapping>
<mapping name="recoveryPassword">
<select path="recoveryPassword"/>
</mapping>
</map>
</parameter>
<success>
<set path="::state.primaryDc"><select path="name"/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Primary Domain Controller created</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to create a Primary DC on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory' and @.state.primaryDc and not @.state.primaryDcIp)].units[?(@.temp.instanceName and @.isMaster)]"
desc="Master Units of AD services on which the Primary Domain Controller has been configured but DNS ip has not been asked for">
<send-command template="AskDnsIp" result="ip" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<success>
<set path="::state.primaryDcIp">
<select source="ip" path="0.Result.0"/>
</set>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable assign DNS IP on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type != 'activeDirectory')].units[?(@.state.domain and not @.domain)]"
desc="Any non-AD services of the environment which has been part of the domain but needs to leave it">
<send-command template="LeaveDomain" error="exception">
<parameter name="unit">
<select path="id" source="unit"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="domain">
<select path="state.domain"/>
</mapping>
</map>
</parameter>
<success>
<report entity="unit">
<parameter name="id"><select path="id" source="unit"/></parameter>
<parameter name="text">Unit <select path="state.hostname" source="unit"/> (<select path="name" source="unit"/>) has left domain <select path="state.domain"/></parameter>
</report>
<set path="state.domain"><null/></set>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unit <select path="state.hostname" source="unit"/> (<select path="name" source="unit"/>) was unable to leave the domain due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$..units[?(@.temp.instanceName and @.domain and @.domain != @.state.domain)]"
desc="Any deployed unit which need to enter the domain">
<set path="#unit">
<select/>
</set>
<set path="#service">
<select path="::"/>
</set>
<rule desc="Domain controller exists with the assigned DNS IP">
<parameter name="match">/$.services[?(@.type == 'activeDirectory' and @.domain == '<select path="domain"/>' and @.state.primaryDcIp)]</parameter>
<send-command template="JoinDomain" error="exception">
<parameter name="unit">
<select path="id" source="unit"/>
</parameter>
<parameter name="service">
<select path="id" source="service"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="domain">
<select path="domain"/>
</mapping>
<mapping name="domainPassword">
<select path="adminPassword"/>
</mapping>
<mapping name="dnsIp">
<select path="state.primaryDcIp"/>
</mapping>
<mapping name="domainUser">
<select path="adminAccountName" default="Administrator"/>
</mapping>
<mapping name="ouPath"></mapping>
</map>
</parameter>
<success>
<set path="state.domain" target="unit">
<select path="domain"/>
</set>
<set path="state.domainIp" target="unit">
<select path="state.primaryDcIp"/>
</set>
<report entity="unit">
<parameter name="id"><select path="id" source="unit"/></parameter>
<parameter name="text">Unit <select path="state.hostname" source="unit"/> (<select path="name" source="unit"/>) has joined domain <select path="domain"/></parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unit <select path="state.hostname" source="unit"/> (<select path="name" source="unit"/>) was unable to join the domain due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory')].units[?(@.state.domain and not @.isMaster and not @.state.installed)]"
desc="Slave units of AD services which has not got secondary DC installed yet">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating Secondary Domain Controller on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<send-command template="CreateSecondaryDC" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="recoveryPassword">
<select path="recoveryPassword"/>
</mapping>
<mapping name="domainPassword">
<select path="::adminPassword"/>
</mapping>
<mapping name="domain">
<select path="::domain"/>
</mapping>
</map>
</parameter>
<success>
<set path="state.installed"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Secondary Domain Controller created</parameter>
</report>
<report entity="service">
<parameter name="id"><select path="::id"/></parameter>
<parameter name="text">Domain <select path="::domain"/> created</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to create Secondary Domain Controller on unit <select path="state.hostname" /> (<select path="name" />) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<report entity="service" level="error">
<parameter name="id"><select path="::id"/></parameter>
<parameter name="text">Unable to create domain <select path="::domain"/></parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$..units[?(@.temp.instanceName and @.domain and @.domain != @.state.domain)]"
desc="New rule for service related with domain">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Starting testing</parameter>
</report>
<send-command template="TestDeploy" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<success>
<set path="state.testFinished"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Testing was finished</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Fault</parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory' and @.state.primaryDcIp)].units[?(@.temp.instanceName and @.isMaster and not @.state.testFinished)]"
desc="New rule for AD">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Starting testing</parameter>
</report>
<send-command template="TestDeploy" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<success>
<set path="state.testFinished"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Testing was finished</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Fault</parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
</workflow>

View File

@ -1,230 +0,0 @@
<workflow>
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm') and @.domain)].units[*]"
desc='Units of web services with domain'>
<set path="domain">
<select path="::domain"/>
</set>
<mute/>
</rule>
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm') and @.osImage.name)].units[?(@.state.hostname and not @.temp.instanceName)]"
desc="Units of web services having hostname and image names assigned but without instances">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<update-cf-stack template="Windows" error="exception">
<parameter name="mappings">
<map>
<mapping name="instanceName"><select path="state.hostname"/></mapping>
<mapping name="userData">
<prepare-user-data>
<parameter name="hostname"><select path="state.hostname"/></parameter>
<parameter name="unit"><select path="id"/></parameter>
<parameter name="service"><select path="::id"/></parameter>
</prepare-user-data>
</mapping>
<mapping name="instanceType"><select path="::flavor" default="m1.medium"/></mapping>
<mapping name="imageName"><select path="::osImage.name"/></mapping>
<mapping name="availabilityZone"><select path="::availabilityZone" default="nova"/></mapping>
</map>
</parameter>
<success>
<set path="temp.instanceName"><select path="name"/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Instance <select path="state.hostname"/> (<select path="name"/>) created</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to deploy instance <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="message" default="unknown Heat error"/> </parameter>
</report>
<stop/>
</failure>
</update-cf-stack>
</rule>
<rule match="$.services[?(@.type in ('webServerFarm', 'aspNetAppFarm'))].units[?(@.state.hostname and not @.temp.registeredWithLB)]"
desc="Units of web-farms services which have a hostname assigned but are not registered with LB">
<update-cf-stack template="LoadBalancer" result="outputs" error="exception">
<parameter name="mappings">
<map>
<mapping name="instanceName"><select path="state.hostname"/></mapping>
<mapping name="lbPort"><select path="::loadBalancerPort"/></mapping>
<mapping name="lbName"><select path="::name"/></mapping>
</map>
</parameter>
<success>
<set path="temp.registeredWithLB"><true/></set>
<set path="::uri">http://<select source="outputs" path="LoadBalancerIP"/>:<select path="::loadBalancerPort"/></set>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to create a Server Farm load balancer on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="message" default="unknown Heat error"/> </parameter>
</report>
<stop/>
</failure>
</update-cf-stack>
</rule>
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm') and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.temp.instanceName)]"
desc="Units of web services which have got an instance deployed but has not got a correct admin password ">
<send-command template="SetPassword" error='exception'>
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="adminPassword">
<select path="::adminPassword"/>
</mapping>
</map>
</parameter>
<success>
<set path="::state.adminPassword">
<select path="::adminPassword"/>
</set>
</success>
<failure>
<report entity="unit" level="warning">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to set admin password on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<mute/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm'))].units[?(@.temp.instanceName and not @.state.iisInstalled)]"
desc="Units of web services which have got an instance deployed but have not got an IIS installed">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating IIS Web Server on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<send-command template="InstallIIS" error='exception'>
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<success>
<set path="state.iisInstalled"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">IIS <select path="state.hostname"/> (<select path="name"/>) has started</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to install IIS on <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type in ('aspNetApp', 'aspNetAppFarm'))].units[?(@.state.iisInstalled and not @.state.webAppDeployed)]"
desc="Units of ASP.NET app services which have got IIS installed but not the WebApplication deployed">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Deploying WebApp <select path="::name"/> on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<send-command template="DeployWebApp" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="repository">
<select path="::repository"/>
</mapping>
</map>
</parameter>
<success>
<set path="state.webAppDeployed"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">WebApp <select path="::name"/> has been deployed on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to deploy WebApp on <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type in ('webServer', 'webServerFarm'))].units[?(@.temp.instanceName and @.state.iisInstalled and not @.state.testFinished)]"
desc="New rule for IIS services">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Starting testing</parameter>
</report>
<send-command template="TestDeploy" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<success>
<set path="state.testFinished"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Testing was finished</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Fault</parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type in ('aspNetApp', 'aspNetAppFarm'))].units[?(@.state.webAppDeployed and not @.state.testFinished)]"
desc="New rule for ASP services">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Starting testing</parameter>
</report>
<send-command template="TestDeploy" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<success>
<set path="state.testFinished"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Testing was finished</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Fault</parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
</workflow>

View File

@ -1,25 +0,0 @@
<workflow>
<rule match="$.services[*].units[?(@.state.hostname is None)]" desc="Units with no hostname">
<set path="state.hostname">
<generate-hostname>
<parameter name="pattern"><select path="::unitNamingPattern"/></parameter>
<parameter name="service_id"><select path="::id"/></parameter>
</generate-hostname>
</set>
</rule>
<rule match="$[?(not @.state.deleted)]" desc="Search through all the environments..">
<rule match="$.services[*].units[*]" desc="If any units exists" limit="1">
<mute/>
<empty>
<delete-cf-stack>
<success>
<set path="/state.deleted"><true/></set>
</success>
</delete-cf-stack>
</empty>
</rule>
</rule>
</workflow>

View File

@ -1,76 +0,0 @@
<workflow>
<rule match="$.services[?(@.type == 'demoService')].units[*]"
desc='Service for demo purpose'>
</rule>
<rule match="$.services[?(@.type == 'demoService')].units[?(@.state.hostname and not @.temp.instanceName)]"
desc="Units of demo service having hostname and image names assigned but without instances">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<update-cf-stack template="Demo" error="exception">
<parameter name="mappings">
<map>
<mapping name="instanceName"><select path="state.hostname"/></mapping>
<mapping name="userData">
<prepare-user-data template="Demo" initFile="demo_init.sh">
<parameter name="hostname"><select path="state.hostname"/></parameter>
<parameter name="unit"><select path="id"/></parameter>
<parameter name="service"><select path="::id"/></parameter>
</prepare-user-data>
</mapping>
<mapping name="instanceType"><select path="::flavor" default="m1.medium"/></mapping>
<mapping name="imageName"><select path="::osImage.name"/></mapping>
<mapping name="availabilityZone"><select path="::availabilityZone" default="nova"/></mapping>
</map>
</parameter>
<success>
<set path="temp.instanceName"><select path="name"/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Instance <select path="state.hostname"/> (<select path="name"/>) created!</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to deploy instance <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="message" default="unknown Heat error"/> </parameter>
</report>
<stop/>
</failure>
</update-cf-stack>
</rule>
<rule match="$.services[?(@.type == 'demoService')].units[?(@.temp.instanceName and not @.state.demoInstalled)]"
desc="Units of demo service which have got an instance deployed but have not got demo service installed">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating demo service on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<send-command template="Demo" error='exception'>
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<success>
<set path="state.demoInstalled"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Demo service <select path="state.hostname"/> (<select path="name"/>) has started</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to install demo service on <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
</workflow>

View File

@ -1,42 +0,0 @@
Function DeployTestingFunction {
$stream = [System.IO.StreamWriter] "C:/test_report.txt"
$stream.WriteLine(Test Report)
$host_name = [System.Net.Dns]::GetHostByName((hostname)).HostName
$stream.WriteLine(Host: $host_name)
$ip_address = [System.Net.Dns]::GetHostByName((hostname)).AddressList.IPAddressToString
$stream.WriteLine(IP Address: $ip_address)
$win_agent = Get-Process WindowsAgent | Select-Object name,fileversion,productversion,company
if ($win_agent) { $agent_status = running } else { $agent_status = error }
$stream.WriteLine(Murano Windows Agent Process Status: $agent_status)
if ($win_agent) { $agent_version = $win_agent.FileVersion
$stream.WriteLine(Murano Windows Agent Version: $agent_version) }
$stream.WriteLine(Firewall Opened Ports:)
$firewall_rules = Get-NetFirewallPortFilter | Select-Object Protocol, RemotePort, LocalPort
foreach ($rule in $firewall_rules) { $stream.WriteLine($rule) }
$stream.close()
}

View File

@ -1,96 +0,0 @@
<workflow>
<rule match="$.services[?(@.type != 'activeDirectory' and @.availabilityZone)].units[?(@.temp.instanceName and @.state.hostname and not @.domain)]"
desc="Units of Non-AD services with availability zone specified which are deployed and are not part of the domain">
<set path="#externalADmap">
<map>
<!-- ======================================================================= -->
<!-- Specify here parameters of domain controllers at each availability zone -->
<!-- ======================================================================= -->
<mapping name="nova">
<map>
<mapping name="domain">domain1</mapping>
<mapping name="domainUser">Administrator</mapping>
<mapping name="domainPassword">password1</mapping>
<mapping name="dnsIp">ip1</mapping>
<mapping name="ou"></mapping>
</map>
</mapping>
<mapping name="AnotherAvailabilityZone">
<map>
<mapping name="domain">domain2</mapping>
<mapping name="domainUser">Administrator</mapping>
<mapping name="domainPassword">password2</mapping>
<mapping name="dnsIp">ip2</mapping>
<mapping name="ou"></mapping>
</map>
</mapping>
<!-- ======================================================================= -->
</map>
</set>
<set path="#ad">
<select source="externalADmap">
<parameter name="path"><select path="::availabilityZone"/></parameter>
</select>
</set>
<rule>
<parameter name="match">$[?(@.state.domain != '<select path="domain" source="ad"/>')]</parameter>
<parameter name="desc">Units which are not part of the target domain but need to join</parameter>
<send-command template="JoinDomain" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="domain">
<select path="domain" source="ad"/>
</mapping>
<mapping name="domainUser">
<select path="domainUser" source="ad"/>
</mapping>
<mapping name="domainPassword">
<select path="domainPassword" source="ad"/>
</mapping>
<mapping name="dnsIp">
<select path="dnsIp" source="ad"/>
</mapping>
<mapping name="ouPath">
<select path="ou" source="ad"/>
</mapping>
</map>
</parameter>
<success>
<set path="state.domain">
<select path="domain" source="ad"/>
</set>
<set path="state.domainIp">
<select path="dnsIp" source="ad"/>
</set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unit <select path="state.hostname"/> (<select path="name"/>) has joined domain <select path="domain" source="ad"/></parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unit <select path="state.hostname"/> (<select path="name"/>) was unable to join the domain due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
</rule>
</workflow>

View File

@ -1,441 +0,0 @@
<workflow>
<rule match="$.services[?(@.type == 'msSqlClusterServer' and @.domain)].units[*]"
desc="Units of SQL Server Cluster services which are part of the domain">
<set path="domain">
<select path="::domain"/>
</set>
<mute/>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer' and @.osImage.name)].units[?(@.state.hostname and not @.temp.instanceName)]"
desc="Units of SQL Server Cluster services having hostname and image names assigned but without instances">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<update-cf-stack template="Windows" error="exception">
<parameter name="mappings">
<map>
<mapping name="instanceName"><select path="state.hostname"/></mapping>
<mapping name="userData">
<prepare-user-data>
<parameter name="hostname"><select path="state.hostname"/></parameter>
<parameter name="unit"><select path="id"/></parameter>
<parameter name="service"><select path="::id"/></parameter>
</prepare-user-data>
</mapping>
<mapping name="instanceType"><select path="::flavor" default="m1.medium"/></mapping>
<mapping name="imageName"><select path="::osImage.name"/></mapping>
<mapping name="availabilityZone"><select path="::availabilityZone" default="nova"/></mapping>
</map>
</parameter>
<success>
<set path="temp.instanceName"><select path="name"/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Instance <select path="state.hostname"/> (<select path="name"/>) created</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to deploy instance <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="message" default="unknown Heat error"/> </parameter>
</report>
<stop/>
</failure>
</update-cf-stack>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer' and @.domain and not @.domainAdminUserName and not @.domainAdminPassword)]"
desc="SQL Server Cluster service instance with domain configured but without admin account name/password">
<set path="#service">
<select/>
</set>
<rule desc="Domain controller exists with the assigned DNS IP">
<parameter name="match">/$.services[?(@.type == 'activeDirectory' and @.domain == '<select path="domain"/>')]</parameter>
<set path="domainAdminUserName" target="service"><select path="adminAccountName" default="Administrator"/></set>
<set path="domainAdminPassword" target="service"><select path="adminPassword"/></set>
</rule>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer' and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.temp.instanceName)]"
desc="Units of SQL Server Cluster services which have got an instance deployed but has not got a correct admin password">
<send-command template="SetPassword" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="adminPassword">
<select path="::adminPassword"/>
</mapping>
</map>
</parameter>
<success>
<set path="::state.adminPassword">
<select path="::adminPassword"/>
</set>
</success>
<failure>
<report entity="unit" level="warning">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to set admin password on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<mute/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer')].units[?(@.state.domain and not @.state.failoverClusterPrerequisitesInstalled)]"
desc="Units of SQL Server Cluster services that are already joined AD domain">
<send-command template="SqlServerCluster/FailoverClusterPrerequisites" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="domainAdminAccountName">
<select path="::domainAdminUserName"/>
</mapping>
<mapping name="domainAdminAccountPassword">
<select path="::domainAdminPassword"/>
</mapping>
<mapping name="domainName">
<select path="state.domain"/>
</mapping>
</map>
</parameter>
<success>
<set path="state.failoverClusterPrerequisitesInstalled"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Failover cluster prerequisites installed on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to install prerequisites on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer' and not @.state.failoverClusterCreated)].units[?(@.state.failoverClusterPrerequisitesInstalled)]" limit="1"
desc="First unit of SQL Server Cluster services that is already has failover cluster prerequisites installed">
<send-command template="SqlServerCluster/FailoverCluster" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="clusterName">
<select path="::clusterName"/>
</mapping>
<mapping name="clusterNodes">
<select-all path=":$[*].state.hostname"/>
</mapping>
<mapping name="domainName">
<select path="state.domain"/>
</mapping>
<mapping name="domainAdminAccountName">
<select path="::domainAdminUserName"/>
</mapping>
<mapping name="domainAdminAccountPassword">
<select path="::domainAdminPassword"/>
</mapping>
<mapping name="clusterIP">
<select path="::clusterIP"/>
</mapping>
<mapping name="shareServer">
<select path="state.domainIp"/>
</mapping>
</map>
</parameter>
<success>
<set path="::state.failoverClusterCreated"><true/></set>
<report entity="service">
<parameter name="id"><select path="::id"/></parameter>
<parameter name="text">Failover cluster created for SQL Server Cluster service (<select path="::name"/>)</parameter>
</report>
</success>
<failure>
<report entity="Service" level="error">
<parameter name="id"><select path="::id"/></parameter>
<parameter name="text">Unable to create failover cluster for SQL Server Service <select path="::name"/> due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer' and @.state.failoverClusterCreated and not @.state.agEnvironmentConfigured)].units[*]"
desc="First unit of SQL Server Cluster services that is already has failover cluster created">
<send-command template="SqlServerCluster/ConfigureEnvironmentForAOAG" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="primaryNode">
<select-single path=":$[?(@.isMaster)].state.hostname"/>
</mapping>
</map>
</parameter>
<success>
<set path="::state.agEnvironmentConfigured"><true/></set>
<report entity="service">
<parameter name="id"><select path="::id"/></parameter>
<parameter name="text">Environment for AlwaysOn Availability Group of SQL Server Cluster service (<select path="::name"/>) configured</parameter>
</report>
</success>
<failure>
<report entity="service" level="error">
<parameter name="id"><select path="::id"/></parameter>
<parameter name="text">Unable to configure the environment for AlwaysOn Availability Group of SQL Server Cluster service (<select path="::name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer' and @.state.agEnvironmentConfigured)].units[?(@.state.failoverClusterPrerequisitesInstalled and not @.state.sqlServerInstalled)]"
desc="All units of SQL Server Cluster services that is already has environment configured">
<send-command template="SqlServerCluster/InstallSqlServerForAOAG" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="sqlServiceAccountName">
<select path="::sqlServiceUserName"/>
</mapping>
<mapping name="sqlServiceAccountPassword">
<select path="::sqlServicePassword"/>
</mapping>
<mapping name="domainAdminAccountName">
<select path="::domainAdminUserName"/>
</mapping>
<mapping name="domainAdminAccountPassword">
<select path="::domainAdminPassword"/>
</mapping>
<mapping name="domainName">
<select path="state.domain"/>
</mapping>
</map>
</parameter>
<success>
<set path="state.sqlServerInstalled"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">SQL Server installed on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to install SQL Server on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer')].units[?(@.state.sqlServerInstalled and not @.state.alwaysOnInitialized)]"
desc="All units of SQL Server Cluster services that has SQL Server installed">
<send-command template="SqlServerCluster/InitializeAlwaysOn" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="domainAdminAccountName">
<select path="::domainAdminUserName"/>
</mapping>
<mapping name="domainAdminAccountPassword">
<select path="::domainAdminPassword"/>
</mapping>
<mapping name="nodeList">
<select-all path=":$[*].state.hostname"/>
</mapping>
<mapping name="primaryNode">
<select-single path=":$[?(@.isMaster)].state.hostname"/>
</mapping>
<mapping name="domainName">
<select path="state.domain"/>
</mapping>
</map>
</parameter>
<success>
<set path="state.alwaysOnInitialized"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">AlwaysOn AG initialized for <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to initialize AlwaysOn AG for <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer')].units[?(@.state.alwaysOnInitialized and not @.state.primaryReplicaInitialized)]"
desc="All units of SQL Server Cluster services that has AlwaysOn initialized">
<send-command template="SqlServerCluster/InitializeAOAGPrimaryReplica" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="domainAdminAccountName">
<select path="::domainAdminUserName"/>
</mapping>
<mapping name="domainAdminAccountPassword">
<select path="::domainAdminPassword"/>
</mapping>
<mapping name="groupName">
<select path="::agGroupName"/>
</mapping>
<mapping name="nodeList">
<select-all path=":$[*].state.hostname"/>
</mapping>
<mapping name="primaryNode">
<select-single path=":$[?(@.isMaster)].state.hostname"/>
</mapping>
<mapping name="domainName">
<select path="state.domain"/>
</mapping>
<mapping name="syncModeNodeList">
<select-all path=":$[?(@.isSync)].state.hostname"/>
</mapping>
<mapping name="listenerIP">
<select path="::agListenerIP"/>
</mapping>
<mapping name="listenerName">
<select path="::agListenerName"/>
</mapping>
<mapping name="databaseList">
<select path="::databases"/>
</mapping>
</map>
</parameter>
<success>
<set path="state.primaryReplicaInitialized"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Primary replica for SQL Server AG initialized for <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to initialize primary replica for SQL Server AG for <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer')].units[?(@.state.primaryReplicaInitialized and not @.state.secondaryReplicaInitialized)]"
desc="All units of SQL Server Cluster services that has primary replica initialized">
<send-command template="SqlServerCluster/InitializeAOAGSecondaryReplica" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="domainAdminAccountName">
<select path="::domainAdminUserName"/>
</mapping>
<mapping name="domainAdminAccountPassword">
<select path="::domainAdminPassword"/>
</mapping>
<mapping name="nodeList">
<select-all path=":$[*].state.hostname"/>
</mapping>
<mapping name="primaryNode">
<select-single path=":$[?(@.isMaster)].state.hostname"/>
</mapping>
<mapping name="domainName">
<select path="state.domain"/>
</mapping>
</map>
</parameter>
<success>
<set path="state.secondaryReplicaInitialized"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Secondary replica for SQL Server AG initialized for <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to initialize secondary replica for SQL Server AG for <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'msSqlClusterServer')].units[?(@.state.secondaryReplicaInitialized and not @.state.testFinished)]"
desc="New rule for SQL CLUSTER services">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Starting testing</parameter>
</report>
<send-command template="TestDeploy" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<success>
<set path="state.testFinished"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Testing was finished</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Fault</parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
</workflow>

View File

@ -1,151 +0,0 @@
<workflow>
<rule match="$.services[?(@.type == 'msSqlServer' and @.domain)].units[*]"
desc="Units of SQL Server services which are part of the domain">
<set path="domain">
<select path="::domain"/>
</set>
<mute/>
</rule>
<rule match="$.services[?(@.type == 'msSqlServer' and @.osImage.name)].units[?(@.state.hostname and not @.temp.instanceName)]"
desc="Units of SQL Server services having hostname and image names assigned but without instances">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<update-cf-stack template="Windows" error="exception">
<parameter name="mappings">
<map>
<mapping name="instanceName"><select path="state.hostname"/></mapping>
<mapping name="userData">
<prepare-user-data>
<parameter name="hostname"><select path="state.hostname"/></parameter>
<parameter name="unit"><select path="id"/></parameter>
<parameter name="service"><select path="::id"/></parameter>
</prepare-user-data>
</mapping>
<mapping name="instanceType"><select path="::flavor" default="m1.medium"/></mapping>
<mapping name="imageName"><select path="::osImage.name"/></mapping>
<mapping name="availabilityZone"><select path="::availabilityZone" default="nova"/></mapping>
</map>
</parameter>
<success>
<set path="temp.instanceName"><select path="name"/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Instance <select path="state.hostname"/> (<select path="name"/>) created</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to deploy instance <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="message" default="unknown Heat error"/> </parameter>
</report>
<stop/>
</failure>
</update-cf-stack>
</rule>
<rule match="$.services[?(@.type == 'msSqlServer' and @.adminPassword and @.adminPassword != @.state.adminPassword)].units[?(@.temp.instanceName)]"
desc="Units of SQL Server services which have got an instance deployed but has not got a correct admin password">
<send-command template="SetPassword" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="adminPassword">
<select path="::adminPassword"/>
</mapping>
</map>
</parameter>
<success>
<set path="::state.adminPassword">
<select path="::adminPassword"/>
</set>
</success>
<failure>
<report entity="unit" level="warning">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to set admin password on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<mute/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'msSqlServer')].units[?(@.temp.instanceName and not @.state.msSqlServerInstalled)]"
desc="Units of SQL Server services which have got an instance deployed but have not got an SQL Server installed">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating MS SQL Server on unit <select path="state.hostname"/> (<select path="name"/>)</parameter>
</report>
<send-command template="InstallMsSqlServer" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<parameter name="mappings">
<map>
<mapping name="saPassword">
<select path="::saPassword"/>
</mapping>
<mapping name="mixedModeAuth">
<select path="::mixedModeAuth"/>
</mapping>
</map>
</parameter>
<success>
<set path="state.msSqlServerInstalled"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">MS SQL Server <select path="state.hostname"/> (<select path="name"/>) has started</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Unable to install MS SQL Server on unit <select path="state.hostname"/> (<select path="name"/>) due to <select source="exception" path="0.messages.0" default="unknown Agent error"/> </parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
<rule match="$.services[?(@.type == 'msSqlServer')].units[?(@.temp.instanceName and @.state.msSqlServerInstalled and not @.state.testFinished)]"
desc="New rule for MS SQL Server services">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Starting testing</parameter>
</report>
<send-command template="TestDeploy" error="exception">
<parameter name="unit">
<select path="id"/>
</parameter>
<parameter name="service">
<select path="::id"/>
</parameter>
<success>
<set path="state.testFinished"><true/></set>
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Testing was finished</parameter>
</report>
</success>
<failure>
<report entity="unit" level="error">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Fault</parameter>
</report>
<stop/>
</failure>
</send-command>
</rule>
</workflow>

View File

@ -1,12 +0,0 @@
{
"Scripts": [
"DeployTesting.ps1"
],
"Commands": [
{
"Name": "DeployTestingFunction"
}
],
"RebootOnCompletion": 0
}

View File

@ -1,2 +0,0 @@
*.pyc
*~

View File

@ -1,575 +0,0 @@
import datetime
import os
import random
import sys
import ConfigParser
import json
import logging
import requests
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import selenium.webdriver.common.by as by
from selenium.webdriver.support.ui import WebDriverWait
import testtools
import time
from keystoneclient.v2_0 import client as ksclient
from muranoclient.client import Client as mclient
from glanceclient import Client as gclient
import config.config as cfg
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
log.addHandler(logging.StreamHandler())
if sys.version_info >= (2, 7):
class BaseDeps(testtools.TestCase):
pass
else:
# Define asserts for python26
import unittest2
class BaseDeps(testtools.TestCase,
unittest2.TestCase):
pass
class ImageException(Exception):
message = "Image doesn't exist"
def __init__(self, im_type):
self._error_string = (self.message + '\nDetails: {0} image is '
'not found,'.format(im_type))
def __str__(self):
return self._error_string
class UITestCase(BaseDeps):
@classmethod
def setUpClass(cls):
super(UITestCase, cls).setUpClass()
keystone_client = ksclient.Client(username=cfg.common.user,
password=cfg.common.password,
tenant_name=cfg.common.tenant,
auth_url=cfg.common.keystone_url)
cls.murano_client = mclient('1', endpoint=cfg.common.murano_url,
token=keystone_client.auth_token)
glance_endpoint = keystone_client.service_catalog.url_for(
service_type='image', endpoint_type='publicURL')
glance = gclient('1', endpoint=glance_endpoint,
token=keystone_client.auth_token)
cls.headers = {'X-Auth-Token': keystone_client.auth_token}
image_list = []
for i in glance.images.list():
image_list.append(i)
cls.demo_image = cls.get_image_name('demo', image_list)
cls.linux_image = cls.get_image_name('linux', image_list)
cls.windows_image = cls.get_image_name('windows', image_list)
cls.keypair = cfg.common.keypair_name
cls.asp_git_repository = cfg.common.asp_git_repository
cls.tomcat_repository = cfg.common.tomcat_repository
cls.elements = ConfigParser.RawConfigParser()
cls.elements.read('common.ini')
cls.logger = logging.getLogger(__name__)
cls.location = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
def upload_package(package_name, body, app):
files = {'%s' % package_name: open(
os.path.join(cls.location, app), 'rb')}
post_body = {'JsonString': json.dumps(body)}
request_url = '{endpoint}{url}'.format(
endpoint=cfg.common.murano_url,
url='/v1/catalog/packages')
return requests.post(request_url,
files=files,
data=post_body,
headers=cls.headers).json()['id']
cls.postgre_id = upload_package(
'PostgreSQL',
{"categories": ["Databases"], "tags": ["tag"]},
'murano-app-incubator/io.murano.apps.PostgreSql.zip')
cls.apache_id = upload_package(
'Apache',
{"categories": ["Application Servers"], "tags": ["tag"]},
'murano-app-incubator/io.murano.apps.apache.Apache.zip')
cls.tomcat_id = upload_package(
'Tomcat',
{"categories": ["Application Servers"], "tags": ["tag"]},
'murano-app-incubator/io.murano.apps.apache.Tomcat.zip')
cls.telnet_id = upload_package(
'Telnet',
{"categories": ["Web"], "tags": ["tag"]},
'murano-app-incubator/io.murano.apps.linux.Telnet.zip')
cls.ad_id = upload_package(
'Active Directory',
{"categories": ["Microsoft Services"], "tags": ["tag"]},
'murano-app-incubator/io.murano.windows.ActiveDirectory.zip')
def setUp(self):
super(UITestCase, self).setUp()
self.driver = webdriver.Firefox()
self.driver.get(cfg.common.horizon_url + '/')
self.driver.implicitly_wait(30)
self.log_in()
def tearDown(self):
super(UITestCase, self).tearDown()
self.addOnException(self.take_screenshot(self._testMethodName))
self.driver.quit()
for env in self.murano_client.environments.list():
self.murano_client.environments.delete(env.id)
@classmethod
def tearDownClass(cls):
super(UITestCase, cls).tearDownClass()
def delete_package(package_id):
request_url = '{endpoint}{url}'.format(
endpoint=cfg.common.murano_url,
url='/v1/catalog/packages/{0}'.format(package_id))
requests.delete(request_url, headers=cls.headers)
delete_package(cls.postgre_id)
delete_package(cls.apache_id)
delete_package(cls.tomcat_id)
delete_package(cls.telnet_id)
delete_package(cls.ad_id)
def take_screenshot(self, test_name):
screenshot_dir = './screenshots'
if not os.path.exists(screenshot_dir):
os.makedirs(screenshot_dir)
date = datetime.datetime.now().strftime('%H%M%S')
filename = '{0}/{1}-{2}.png'.format(screenshot_dir, test_name, date)
self.driver.get_screenshot_as_file(filename)
log.debug("\nScreenshot {0} was saved".format(filename))
@classmethod
def get_image_name(cls, type_of_image, list_of_images):
for i in list_of_images:
if 'murano_image_info' in i.properties.keys():
if type_of_image in json.loads(
i.properties['murano_image_info'])['type']:
return json.loads(i.properties[
'murano_image_info'])['title']
raise ImageException(type_of_image)
def log_in(self):
self.fill_field(by.By.ID, 'id_username', cfg.common.user)
self.fill_field(by.By.ID, 'id_password', cfg.common.password)
sign_in = self.elements.get('button', 'ButtonSubmit')
self.driver.find_element_by_xpath(sign_in).click()
self.driver.find_element_by_xpath(
self.elements.get('button', 'Murano')).click()
def fill_field(self, by_find, field, value):
self.driver.find_element(by=by_find, value=field).clear()
self.driver.find_element(by=by_find, value=field).send_keys(value)
def confirm_deletion(self):
confirm_deletion = self.elements.get('button', 'ConfirmDeletion')
self.driver.find_element_by_xpath(confirm_deletion).click()
def create_environment(self, env_name):
self.driver.find_element_by_id(
'murano__action_CreateEnvironment').click()
self.fill_field(by.By.ID, 'id_name', env_name)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
def delete_environment(self, env_name):
self.driver.find_element_by_link_text('Environments').click()
self.click_on_more(env_name)
self.select_action_for_environment(env_name, 'delete')
self.confirm_deletion()
def edit_environment(self, old_name, new_name):
self.click_on_more(old_name)
self.select_action_for_environment(old_name, 'edit')
self.fill_field(by.By.ID, 'id_name', new_name)
save = self.elements.get('button', 'InputSubmit')
self.driver.find_element_by_xpath(save).click()
def click_on_more(self, env_name):
element_id = self.get_element_id(env_name)
self.driver.find_element_by_xpath(
".//*[@id='murano__row__{0}']/td[4]/div/a[2]".
format(element_id)).click()
def select_action_for_environment(self, env_name, action):
element_id = self.get_element_id(env_name)
self.driver.find_element_by_id(
"murano__row_{0}__action_{1}".format(element_id, action)).click()
def go_to_submenu(self, link):
self.driver.find_element_by_link_text('{0}'.format(link)).click()
def navigate_to(self, menu):
self.driver.find_element_by_xpath(
self.elements.get('button', '{0}'.format(menu))).click()
def select_from_list(self, list_name, value):
self.driver.find_element_by_xpath(
"//select[@name='{0}']/option[text()='{1}']".
format(list_name, value)).click()
def check_element_on_page(self, method, value):
try:
self.driver.find_element(method, value)
except NoSuchElementException:
return False
return True
def env_to_components_list(self, env_name):
element_id = self.get_element_id(env_name)
self.driver.find_element_by_id(
"murano__row_{0}__action_show".format(element_id)).click()
def create_demo_service(self, app_name):
self.driver.find_element_by_xpath(
self.elements.get('apps', 'Demo')).click()
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.demo_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
def create_linux_telnet(self, app_name, app_id):
self.select_and_click_action_for_app('quick-add', app_id)
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.linux_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
def create_linux_apache(self, app_name, app_id):
self.select_and_click_action_for_app('quick-add', app_id)
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.linux_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
def create_ad_service(self, app_name):
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.fill_field(by.By.ID, 'id_0-adminPassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-adminPassword-clone', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-recoveryPassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-recoveryPassword-clone', 'P@ssw0rd')
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.windows_image)
next_button = self.elements.get('button', 'InputSubmit')
self.driver.find_element_by_xpath(next_button).click()
def create_iis_service(self, app_name):
self.driver.find_element_by_xpath(
self.elements.get('apps', 'IIS')).click()
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.fill_field(by.By.ID, 'id_0-adminPassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-adminPassword-clone', 'P@ssw0rd')
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.windows_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
def create_asp_service(self, app_name):
self.driver.find_element_by_xpath(
self.elements.get('apps', 'ASP')).click()
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.fill_field(by.By.ID, 'id_0-adminPassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-adminPassword-clone', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-repository', self.asp_git_repository)
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.windows_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
def create_iisfarm_service(self, app_name):
self.driver.find_element_by_xpath(
self.elements.get('apps', 'IISFarm')).click()
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.fill_field(by.By.ID, 'id_0-adminPassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-adminPassword-clone', 'P@ssw0rd')
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.windows_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
def create_aspfarm_service(self, app_name):
self.driver.find_element_by_xpath(
self.elements.get('apps', 'ASPFarm')).click()
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.fill_field(by.By.ID, 'id_0-adminPassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-adminPassword-clone', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-repository', self.asp_git_repository)
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.windows_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
def create_mssql_service(self, app_name):
self.driver.find_element_by_xpath(
self.elements.get('apps', 'MSSQL')).click()
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.fill_field(by.By.ID, 'id_0-adminPassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-adminPassword-clone', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-saPassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-saPassword-clone', 'P@ssw0rd')
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.windows_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
def create_sql_cluster_service(self, app_name, domain_name):
self.driver.find_element_by_xpath(
self.elements.get('apps', 'SQL_cluster')).click()
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.fill_field(by.By.ID, 'id_0-adminPassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-adminPassword-clone', 'P@ssw0rd')
self.select_from_list('id_0-domain', domain_name)
self.fill_field(by.By.ID, 'id_0-saPassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-saPassword-clone', 'P@ssw0rd')
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.fill_field(by.By.ID, 'id_1-clusterIp', '1.1.1.1')
self.fill_field(by.By.ID, 'id_1-clusterName', 'cluster')
self.fill_field(by.By.ID, 'id_1-agGroupName', 'ag-name')
self.fill_field(by.By.ID, 'id_1-agListenerName', 'listener_name')
self.fill_field(by.By.ID, 'id_1-agListenerIP', 'listener_name')
self.fill_field(by.By.ID, 'id_1-sqlServiceUserName', 'admin')
self.fill_field(by.By.ID, 'id_1-sqlServicePassword', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_1-sqlServicePassword-clone', 'P@ssw0rd')
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
cluster_ip = self.get_env_subnet()
self.fill_field(by.By.ID, 'id_1-clusterIp', cluster_ip)
listener_ip = self.get_env_subnet()
self.fill_field(by.By.ID, 'id_1-agListenerIP', listener_ip)
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.fill_field(by.By.ID, 'id_2-databases', 'testbase')
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('3-osImage', self.windows_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
def create_tomcat_service(self, app_name, database):
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.select_from_list('0-database', database)
self.fill_field(by.By.ID, 'id_0-repository', self.tomcat_repository)
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.linux_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
def create_postgreSQL_service(self, app_name):
self.fill_field(by.By.ID, 'id_0-name', app_name)
self.fill_field(by.By.ID, 'id_0-database', 'psql-base')
self.fill_field(by.By.ID, 'id_0-username', 'admin')
self.fill_field(by.By.ID, 'id_0-password', 'P@ssw0rd')
self.fill_field(by.By.ID, 'id_0-password-clone', 'P@ssw0rd')
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
self.select_from_list('1-osImage', self.linux_image)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
def get_element_id(self, el_name):
path = self.driver.find_element_by_xpath(
".//*[@data-display='{0}']".format(el_name)).get_attribute("id")
return path.split('__')[-1]
def delete_component(self, component_name):
component_id = self.get_element_id(component_name)
self.driver.find_element_by_id(
'services__row_{0}__action_delete'.format(component_id)).click()
self.driver.find_element_by_link_text('Delete Component').click()
def get_env_subnet(self):
help_text = self.driver.find_element_by_xpath(
"(.//span[@class = 'help-inline'])[1]").text
subnet = help_text.split('.')[-2]
num = random.randint(0, 255)
return '10.0.{0}.{1}'.format(subnet, num)
def check_that_error_message_is_correct(self, error_message, num):
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
time.sleep(3)
appeared_text = self.driver.find_element_by_xpath(
".//div[@class = 'control-group form-field clearfix error'][%d]"
% num).text
index = appeared_text.find(error_message)
if index != -1:
return True
else:
return False
def check_that_alert_message_is_appeared(self, error_message):
self.driver.find_element_by_xpath(
self.elements.get('button', 'ButtonSubmit')).click()
xpath = ".//*[@id='create_service_form']/div[2]/input[2]"
WebDriverWait(self.driver, 10).until(lambda s: s.find_element(
by.By.XPATH, xpath).is_displayed())
appeared_text = self.driver.find_element_by_xpath(
"(.//div[@class = 'alert alert-message alert-error'])").text
index = appeared_text.find(error_message)
if index != -1:
return True
else:
return False
def click_on_package_action(self, action):
self.driver.find_element_by_xpath(
".//*[@id='packages__action_{0}']".format(action)).click()
def select_action_for_package(self, package, action):
time.sleep(2)
package_id = self.get_element_id(package)
if action == 'more':
self.driver.find_element_by_xpath(
".//*[@id='packages__row__{0}']/td[6]/div/a[2]".
format(package_id)).click()
WebDriverWait(self.driver, 10).until(lambda s: s.find_element(
by.By.XPATH,
".//*[@id='packages__row_{0}__action_download_package']".
format(package_id)).is_displayed())
else:
self.driver.find_element_by_xpath(
".//*[@id='packages__row_{0}__action_{1}']".
format(package_id, action)).click()
def check_package_parameter(self, package, column, value):
package_id = self.get_element_id(package)
result = self.driver.find_element_by_xpath(
".//*[@id='packages__row__{0}']/td[{1}]".
format(package_id, column)).text
if result == value:
return True
else:
return False
def select_and_click_element(self, element):
self.driver.find_element_by_xpath(
".//*[@value = '{0}']".format(element)).click()
def choose_and_upload_files(self, name):
__location = os.path.realpath(os.path.join(os.getcwd(),
os.path.dirname(__file__)))
self.driver.find_element_by_xpath(".//*[@id='id_file']").click()
self.driver.find_element_by_id('id_file').send_keys(
os.path.join(__location, name))
def check_the_status_of_env(self, env_name, status):
env_id = self.get_element_id(env_name)
env_status = self.driver.find_element_by_xpath(
".//*[@id='murano__row__{0}']/td[3]".format(env_id))
k = 0
while env_status.text != status:
time.sleep(15)
k += 1
self.driver.refresh()
env_status = self.driver.find_element_by_xpath(
".//*[@id='murano__row__{0}']/td[3]".format(env_id))
if k > 160:
log.error('\nTimeout has expired')
break
def check_that_deploy_finished(self, env_name):
self.navigate_to('Environments')
self.click_on_more(env_name)
self.select_action_for_environment(env_name, 'show_deployments')
status = self.driver.find_element_by_xpath(
"/html/body/div/div[2]/div[3]/form/table/tbody/tr/td[3]").text
self.driver.find_element_by_link_text("Show Details").click()
self.driver.find_element_by_link_text("Logs").click()
self.take_screenshot(self._testMethodName)
self.navigate_to('Environments')
self.click_on_more(env_name)
self.select_action_for_environment(env_name, 'show_deployments')
self.assertEqual('Successful', status, 'Deploy finished with errors')
def select_and_click_action_for_app(self, action, app):
self.driver.find_element_by_xpath(
"//*[@href='/horizon/murano/catalog/{0}/{1}']"
.format(action, app)).click()
def modify_package(self, param, value):
self.fill_field(by.By.ID, 'id_{0}'.format(param), value)
self.driver.find_element_by_xpath(
self.elements.get('button', 'InputSubmit')).click()
self.driver.refresh()

View File

@ -1,10 +0,0 @@
[button]
ButtonSubmit=//button[@type='submit']
InputSubmit=//input[@type='submit']
ConfirmDeletion=.//*[@id='modal_wrapper']/div/div[3]/a[1]
More=/html/body/div/div[2]/div[3]/form/table/tbody/tr/td[4]/div/a[2]
Next=//*[@id="create_service_form"]/strong/strong/div/button
Murano=//*[@id="main_content"]/div[2]/div/dl/dt[3]/div
Application_Catalog=//*[@id="main_content"]/div[2]/div/dl/dd[3]/div[1]/h4/div
Manage=//*[@id="main_content"]/div[2]/div/dl/dd[3]/div[2]/h4/div
AddToEnv=.//*[@href='/horizon/murano/create_environment?next=/horizon/murano/catalog/index']

View File

@ -1,53 +0,0 @@
import os
from oslo.config import cfg
common_group = cfg.OptGroup(name='common', title="common configs")
CommonGroup = [
cfg.StrOpt('horizon_url',
default='http://127.0.0.1/horizon',
help="murano dashboard url"),
cfg.StrOpt('user',
default='admin',
help="keystone user"),
cfg.StrOpt('password',
default='pass',
help="password for keystone user"),
cfg.StrOpt('tenant',
default='admin',
help='keystone tenant'),
cfg.StrOpt('keystone_url',
default='http://172.18.124.203:5000/v2.0/',
help='keystone url'),
cfg.StrOpt('murano_url',
default='http://127.0.0.1:8082',
help='murano url'),
cfg.StrOpt('keypair_name',
default='default_key',
help='keypair for murano services'),
cfg.StrOpt('asp_git_repository',
default='git://github.com/',
help='git repository with asp application'),
cfg.StrOpt('tomcat_repository',
default='git://github.com/',
help='git repository with tomcat servlet'),
cfg.StrOpt('selenium_server',
default='http://127.0.0.1:4444/wd/hub',
help='url where selenium server is running')
]
def register_config(config, config_group, config_opts):
config.register_group(config_group)
config.register_opts(config_opts, config_group)
path = os.path.join("%s/config/config_file.conf"
% os.getcwd())
if os.path.exists(path):
cfg.CONF([], project='muranodashboard', default_config_files=[path])
register_config(cfg.CONF, common_group, CommonGroup)
common = cfg.CONF.common

View File

@ -1,10 +0,0 @@
[common]
horizon_url = http://127.0.0.1/horizon
murano_url = http://127.0.0.1:8082
user = WebTestUser
password = swordfish
tenant = WebTestProject
keystone_url = http://127.0.0.1:5000/v2.0/
keypair_name = default_keypair
asp_git_repository = git_repo_for_asp_app
tomcat_repository = git_repo_for_tomcat

View File

@ -1,261 +0,0 @@
import sys
import os
sys.path.append(os.getcwd())
import testtools
from base import UITestCase
import selenium.webdriver.common.by as by
class UIDeployTests(UITestCase):
def test_001_deploy_demo_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_demo')
self.env_to_service('deploy_demo')
self.create_demo_service('DemoService')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'DemoService'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_demo', 'Ready')
self.check_that_deploy_finished('deploy_demo')
def test_002_deploy_telnet_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_telnet')
self.env_to_service('deploy_telnet')
self.create_linux_telnet('linuxtelnet')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'linuxtelnet'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_telnet', 'Ready')
self.check_that_deploy_finished('deploy_telnet')
def test_003_deploy_apache_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_apache')
self.env_to_service('deploy_apache')
self.create_linux_apache('linuxapache')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'linuxapache'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_apache', 'Ready')
self.check_that_deploy_finished('deploy_apache')
def test_004_deploy_ad_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_ad')
self.env_to_service('deploy_ad')
self.create_ad_service('muranotest.domain')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'muranotest.domain'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_ad', 'Ready')
self.check_that_deploy_finished('deploy_ad')
def test_005_deploy_iis_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_iis')
self.env_to_service('deploy_iis')
self.create_iis_service('IISService')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'IISService'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_iis', 'Ready')
self.check_that_deploy_finished('deploy_iis')
def test_006_deploy_asp_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_asp')
self.env_to_service('deploy_asp')
self.create_asp_service('ASPService')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'ASPService'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_asp', 'Ready')
self.check_that_deploy_finished('deploy_asp')
@testtools.skip("There is no Neutron LB on lab")
def test_007_deploy_iis_farm_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_iisfarm')
self.env_to_service('deploy_iisfarm')
self.create_iisfarm_service('IISFarmService')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'IISFarmService'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_iisfarm', 'Ready')
self.check_that_deploy_finished('deploy_iisfarm')
@testtools.skip("There is no Neutron LB on lab")
def test_008_deploy_asp_farm_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_aspfarm')
self.env_to_service('deploy_aspfarm')
self.create_aspfarm_service('ASPFarmService')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'ASPFarmService'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_aspfarm', 'Ready')
self.check_that_deploy_finished('deploy_aspfarm')
def test_009_deploy_mssql_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_mssql')
self.env_to_service('deploy_mssql')
self.create_mssql_service('MSSQLService')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'MSSQLService'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_mssql', 'Ready')
self.check_that_deploy_finished('deploy_mssql')
@testtools.skip("https://bugs.launchpad.net/murano/+bug/1282097")
def test_010_deploy_sql_cluster_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_mssql_cluster')
self.env_to_service('deploy_mssql_cluster')
self.create_ad_service('activeDirectory.mssql')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'activeDirectory.mssql'))
self.driver.find_element_by_link_text('Create Service').click()
self.create_sql_cluster_service('SQLCluster', 'activeDirectory.mssql')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'SQLCluster'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_mssql_cluster', 'Ready')
self.check_that_deploy_finished('deploy_mssql_cluster')
def test_011_deploy_postgreSQL_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_postgreSQL')
self.env_to_service('deploy_postgreSQL')
self.create_postgreSQL_service('postgreSQL-serv')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'postgreSQL-serv'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_postgreSQL', 'Ready')
self.check_that_deploy_finished('deploy_postgreSQL')
def test_012_deploy_tomcat_service(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('deploy_tomcat')
self.env_to_service('deploy_tomcat')
self.create_postgreSQL_service('postgreSQL')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'postgreSQL'))
self.driver.find_element_by_link_text('Create Service').click()
self.create_tomcat_service('tomcat', 'postgreSQL')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'tomcat'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('deploy_tomcat', 'Ready')
self.check_that_deploy_finished('deploy_tomcat')
def test_013_add_service_in_deployed_env(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('add_service_in_deployed_env')
self.env_to_service('add_service_in_deployed_env')
self.create_linux_telnet('telnet')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'telnet'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('add_service_in_deployed_env', 'Ready')
self.check_that_deploy_finished('add_service_in_deployed_env')
self.navigate_to('Environments')
self.env_to_service('add_service_in_deployed_env')
self.create_iis_service('iis')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT, 'iis'))
def test_014_deploy_linux_windows_services(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('linux_windows_services')
self.env_to_service('linux_windows_services')
self.create_linux_telnet('telnet')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'telnet'))
self.create_iis_service('iis')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT, 'iis'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.navigate_to('Environments')
self.check_the_status_of_env('linux_windows_services', 'Ready')
self.check_that_deploy_finished('linux_windows_services')
def test_015_checking_type_and_last_operation(self):
self.log_in()
self.navigate_to('Environments')
self.create_environment('test')
self.env_to_service('test')
self.create_linux_telnet('telnet')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'telnet'))
self.driver.find_element_by_id('services__action_deploy_env').click()
self.assertTrue(self.check_service_parameter(
'services', 'telnet', '3', 'Linux Telnet'))
self.assertTrue(self.check_service_parameter(
'services', 'telnet', '4', 'Deploy in progress'))
self.assertFalse(self.check_service_parameter(
'services', 'telnet', '5', 'Service draft created'))
self.navigate_to('Environments')
self.check_the_status_of_env('test', 'Ready')
self.check_that_deploy_finished('test')

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +0,0 @@
*** Settings ***
Suite Setup
Library simple_REST.py
Resource keywords.txt
*** Test Cases ***
Create environment
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test"}
The response code should be 200
The response body should have key 'name' with value "test"
Get list of environments
[Setup] Set Default Headers
User send a GET request to '/environments'
The response code should be 200
The response body should have key 'environments' with not empty list
Update Environment
[Setup] Set Default Headers
${id} Get Environment ID by name test
User send a PUT request to '/environments/${id}' with body {"name": "new_name"}
The response code should be 200
The response body should have key 'name' with value "new_name"
Get environment parameters
[Setup] Set Default Headers
${id} Get Environment ID by name new_name
User send a GET request to '/environments/${id}'
The response body should have keys status created updated version
The response body should have keys id name services
Delete Environment
[Setup] Set Default Headers
${id} Get Environment ID by name new_name
User send a DELETE request to '/environments/${id}'
The response code should be 200
User send a GET request to '/environments/${id}'
The response code should be 404

View File

@ -1,100 +0,0 @@
*** Settings ***
Suite Setup
Library simple_REST.py
Resource keywords.txt
*** Test Cases ***
Create session for environment
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test001"}
The response code should be 200
${id} Get Environment ID by name test001
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
The response body should have key 'environment_id' with value "${id}"
Get session parameters
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test002"}
The response code should be 200
${id} Get Environment ID by name test002
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session} Get Response Body
User send a GET request to '/environments/${id}/sessions/${session['id']}'
The response code should be 200
The response body should have keys id environment_id created updated
The response body should have keys user_id version state
The response body should have key 'state' with value "open"
Create a few sessions for one environment
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test003"}
The response code should be 200
${id} Get Environment ID by name test003
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session1} Get Response Body
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session2} Get Response Body
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session3} Get Response Body
User send a GET request to '/environments/${id}/sessions/${session1['id']}'
The response code should be 200
User send a GET request to '/environments/${id}/sessions/${session2['id']}'
The response code should be 200
User send a GET request to '/environments/${id}/sessions/${session3['id']}'
The response code should be 200
Deploy empty session
[Tags] bug MRN-706
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test004-test"}
The response code should be 200
${id} Get Environment ID by name test004-test
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session} Get Response Body
User send a POST request to '/environments/${id}/sessions/${session['id']}/deploy' without body
The response code should be 200
Sleep 5
User send a GET request to '/environments/${id}/sessions/${session['id']}'
The response body should have key 'state' with value "open"
Delete session
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test005"}
The response code should be 200
${id} Get Environment ID by name test005
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session} Get Response Body
User send a DELETE request to '/environments/${id}/sessions/${session['id']}'
The response code should be 200
User send a GET request to '/environments/${id}/sessions/${session['id']}'
The response code should be 404
Delete only one session
[Setup] Set Default Headers
User send a POST request to '/environments' with body {"name": "test006"}
The response code should be 200
${id} Get Environment ID by name test006
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session1} Get Response Body
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session2} Get Response Body
User send a POST request to '/environments/${id}/configure' without body
The response code should be 200
${session3} Get Response Body
User send a DELETE request to '/environments/${id}/sessions/${session2['id']}'
The response code should be 200
User send a GET request to '/environments/${id}/sessions/${session2['id']}'
The response code should be 404
User send a GET request to '/environments/${id}/sessions/${session1['id']}'
The response code should be 200
User send a GET request to '/environments/${id}/sessions/${session3['id']}'
The response code should be 200

View File

@ -1,112 +0,0 @@
*** Settings ***
Library simple_REST.py
Library Collections
*** Variables ***
${ip} 172.18.79.83
${ip_keystone} 172.18.124.201
${user} admin
${project} admin
${password} swordfish
${template} jenkinss
${url} http://?
${method} GET
*** Keywords ***
User send a POST request to '${end_point}' with body ${body}
${request_body} Set Variable ${body}
Set Global Variable ${url} http://${ip}:8082${end_point}
Set Global Variable ${method} POST
Log "POST request on link ${url} with body ${request_body}"
Set Body ${request_body}
POST Request ${url}
User send a POST request to '${end_point}' without body
Set Global Variable ${url} http://${ip}:8082${end_point}
Set Global Variable ${method} POST
Log "POST request on link ${url} without body"
POST Request Without Body ${url}
User send a PUT request to '${end_point}' with body ${body}
${request_body} Set Variable ${body}
Set Global Variable ${url} http://${ip}:8082${end_point}
Set Global Variable ${method} PUT
Log "PUT request on link ${url} with body ${request_body}"
Set Body ${request_body}
PUT Request ${url}
User send a GET request to '${end_point}'
Set Global Variable ${url} http://${ip}:8082${end_point}
Set Global Variable ${method} GET
Log "GET request on link ${url}"
GET Request ${url}
User send a DELETE request to '${end_point}'
Set Global Variable ${url} http://${ip}:8082${end_point}
Set Global Variable ${method} DELETE
Log "DELETE request on link ${url}"
DELETE Request ${url}
Get Environment ID by name
[Arguments] ${name}
${id} Set Variable None
User send a GET request to '/environments'
The response code should be 200
${body} Get Response Body
@{environments} Convert To List ${body['environments']}
: FOR ${x} IN @{environments}
\ ${id} = Set Variable If "${x['name']}" == "${name}" ${x['id']}
[Return] ${id}
The response code should be ${status_code}
${response_body} Get Response Body
${response_code} Get Response Code
Run Keyword If ${status_code} != ${response_code} Fail "User has sent ${method} request with url ${url}. Response code: ${response_code}. Response body: ${response_body}"
The response body should be ${body}
${response_body} Get Response Body
Log "Response body: ${response_body}. Expected body: ${body}"
Should Be Equal ${body} ${response_body}
The response body should have keys
[Arguments] @{keys}
${body} Get Response Body
: FOR ${key} IN @{keys}
\ Log "Expect ${key} in body ${body}"
\ Log ${body['${key}']}
The response body should have key '${key}' with list ${value}
${body} Get Response Body
${array} Convert To List ${value}
Log "Expect ${key} == ${array} in body ${body}"
Should Be Equal ${body['${key}']} ${array}
The response body should have key '${key}' with not empty list
${body} Get Response Body
Log "Expect list ${key} in body ${body}"
${length} Get Length ${body['${key}']}
Should Not Be Equal As Integers ${length} 0
The response body should have key '${key}' with value "${value}"
${body} Get Response Body
Log "Expect ${key} == ${value} in body ${body}"
Should Be Equal ${body['${key}']} ${value}
The response body not should have key '${key}' with value "${value}"
${body} Get Response Body
Log "NoExpect ${key} == ${value} in body ${body}"
Should Be Not Equal ${body['${key}']} ${value}
The response body parameter '${para}' should have key '${key}' with value "${value}"
${body} Get Response Body
Log "Expect ${para}.${key} == ${value} in body ${body}"
Should Be Equal ${body['${para}']['${key}']} ${value}
Set Default Headers
Set Headers {"Content-Type": "application/json"}
${body} Set Variable {"auth": {"tenantName": "${project}", "passwordCredentials": {"username": "${user}", "password": "${password}"}}}
Set Body ${body}
POST Request http://${ip_keystone}:5000/v2.0/tokens
The response code should be 200
${body} Get Response Body
Update Headers X-Auth-Token ${body['access']['token']['id']}

View File

@ -1,170 +0,0 @@
import json
import requests
import logging
logging.basicConfig()
LOG = logging.getLogger(__name__)
class simple_REST:
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
__version__ = '0.1'
headers = None
body = None
url = None
def clear_headers(self):
"""
This function allows to clear headers for REST API requests
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
"""
self.headers = []
def set_headers(self, headers_dict):
"""
This function allows to configure headers for REST API requests
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
"""
try:
self.headers = json.loads(headers_dict)
except:
LOG.critical("Incorrect headers")
LOG.critical(self.headers)
def update_headers(self, key, value):
"""
This function allows to modify headers for REST API requests
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| *Update Headers* | X-Auth-Token | 8808880808080808 |
"""
self.headers[key] = value
def set_body(self, body_dict):
"""
This function allows to configure body for REST API requests
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| *Set Body* | {"name":"test"} |
| *POST request* | http://10.10.10.1:8082/environments |
"""
self.body = body_dict
def get_headers(self):
"""
This function returns headers for REST API requests
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| ${headers} | *Get Headers* |
| *LOG* | ${headers} |
"""
return self.headers
def GET_request(self, url):
"""
This function allows to send GET requests
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| *GET request* | http://10.10.10.1:8082/environments |
"""
self.response = requests.request('GET', url=url, headers=self.headers)
def POST_request(self, url):
"""
This function allows to send POST requests
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| *Set Body* | {"name":"test"} |
| *POST request* | http://10.10.10.1:8082/environments |
"""
self.response = requests.request('POST', url,
headers=self.headers,
data=str(self.body))
def POST_request_without_body(self, url):
"""
This function allows to send POST requests
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| *Set Body* | {"name":"test"} |
| *POST request* | http://10.10.10.1:8082/environments |
"""
self.response = requests.request('POST', url,
headers=self.headers)
def DELETE_request(self, url):
"""
This function allows to send DELETE requests
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| *DELETE request* | http://10.10.10.1:8082/environments |
"""
self.response = requests.request('DELETE', url=url,
headers=self.headers)
def PUT_request(self, url):
"""
This function allows to send PUT requests
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| *Set Body* | {"name":"test-changed"} |
| *PUT request* | http://10.10.10.1:8082/634876 |
"""
self.response = requests.request('PUT', url,
headers=self.headers,
data=str(self.body))
def get_response_code(self):
"""
This function allows to get response code
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| *DELETE request* | http://10.10.10.1:8082/environments |
| ${code} | *Get Response Code* |
"""
if self.response:
if self.response.status_code != 200:
LOG.debug(self.response.text)
return self.response.status_code
def get_response_body(self):
"""
This function allows to get response body
Examples:
| *Clear Headers* |
| *Set Headers* | Content-Type | application/json |
| *GET request* | http://10.10.10.1:8082/environments |
| ${body} | *Get Response Body* |
"""
try:
return_text = json.loads(self.response.text)
except:
return_text = self.response.text
return return_text

View File

@ -1,27 +0,0 @@
[main]
title = Test Report
description = Glazier API Performance Tests
url = http://172.18.78.92:8082/environments
meta_url = http://172.18.78.92:8084
[mix_for_load_testing]
description = The complex test with different random requests
[ftest]
log_to = console file
log_path = test.log
result_path = result.xml
sleep_time_min = 0
sleep_time_max = 0
[bench]
cycles = 5:10:25:50:75:100:125:150:175:200
duration = 200
startup_delay = 0.01
sleep_time = 0.01
cycle_time = 1
log_to =
log_path = bench.log
result_path = result-bench.xml
sleep_time_min = 0
sleep_time_max = 0.5

View File

@ -1,5 +0,0 @@
[keystone]
url = http://172.18.11.4:5000/v2.0/
user = admin
password = swordfish
tenant = admin

View File

@ -1 +0,0 @@
funkload>=1.16.1

View File

@ -1,103 +0,0 @@
import unittest
import json
import random
import logging
import ConfigParser
from funkload.utils import Data
from funkload.FunkLoadTestCase import FunkLoadTestCase
from keystoneclient.v2_0 import client as ksclient
logging.basicConfig()
LOG = logging.getLogger(' REST service tests')
config = ConfigParser.RawConfigParser()
config.read('config.ini')
user = config.get('keystone', 'user')
password = config.get('keystone', 'password')
tenant = config.get('keystone', 'tenant')
keystone_url = config.get('keystone', 'url')
keystone_client = ksclient.Client(username=user, password=password,
tenant_name=tenant, auth_url=keystone_url)
token = str(keystone_client.auth_token)
class TestMeta(FunkLoadTestCase):
def setUp(self):
self.clearHeaders()
self.url = self.conf_get('main', 'meta_url')
self.setHeader('X-Auth-Token', token)
def generate_num(self):
p=""
for i in xrange(10):
p += str(random.randint(0, 10))
return p
def test_get_ui_definitions(self):
url = self.url + "/" + "v1/client/ui"
resp = self.get(url, description="Get UI definitions")
assert resp.code == 200
def test_get_conductor_metadata(self):
url = self.url + "/" + "v1/client/conductor"
resp = self.get(url, description="Get conductor metadata")
assert resp.code == 200
def test_get_list_metadata_objects_workflows(self):
url = self.url + "/" + "v1/admin/workflows"
resp = self.get(url, description="Get list metadata objects(workflows)")
assert resp.code == 200
def test_get_list_metadata_objects_ui(self):
url = self.url + "/" + "v1/admin/ui"
resp = self.get(url, description="Get list metadata objects(ui)")
assert resp.code == 200
def test_get_list_metadata_objects_heat(self):
url = self.url + "/" + "v1/admin/heat"
resp = self.get(url, description="Get list metadata objects(heat)")
assert resp.code == 200
def test_get_list_metadata_objects_agent(self):
url = self.url + "/" + "v1/admin/agent"
resp = self.get(url, description="Get list metadata objects(agent)")
assert resp.code == 200
def test_get_list_metadata_objects_scripts(self):
url = self.url + "/" + "v1/admin/scripts"
resp = self.get(url, description="Get list metadata objects(scripts)")
assert resp.code == 200
def test_create_and_delete_dir(self):
typ = ['ui', 'workflows', 'agent', 'heat', 'scripts']
random.shuffle(typ)
url = self.url + "/v1/admin/" + typ[1] + "/" + "folder" +\
self.generate_num()
resp = self.put(url, description="Create folder")
response = self.delete(url, description="Delete folder")
assert resp.code == 200
assert response.code == 200
def mix_for_load_testing(self):
k = random.randint(0,100)
if k < 12:
return self.test_get_ui_definitions()
elif k < 24:
return self.test_get_conductor_metadata()
elif k < 36:
return self.test_get_list_metadata_objects_workflows()
elif k < 48:
return self.test_get_list_metadata_objects_ui()
elif k < 60:
return self.test_get_list_metadata_objects_heat()
elif k < 72:
return self.test_get_list_metadata_objects_agent()
elif k < 84:
return self.test_get_list_metadata_objects_scripts()
elif k < 100:
return self.test_create_and_delete_dir()
if __name__ == '__main__':
unittest.main()

Some files were not shown because too many files have changed in this diff Show More