Meego Wiki
Views

Quality/QA-tools/OTS/UserDocumentation/Installation

From MeeGo wiki
< Quality | QA-tools | OTS | UserDocumentation(Difference between revisions)
Jump to: navigation, search
(prerequisites)
(OTS server installation)
 
(44 intermediate revisions not shown)
Line 1: Line 1:
-
== Installation Instructions for OTS 0.1 ==
+
= OTS 0.8.x installation Ubuntu =
-
These instructions have been tested with Ubuntu 10.04.
+
If using 0.1.x version, see [[Quality/QA-tools/OTS/UserDocumentation/Migration_0.1_0.8| migration from 0.1.x to 0.8.x]] document.
-
=== Server ===
+
== Used hardware ==
-
==== prerequisites ====
+
:1 x Server (Ubuntu 10.10)
 +
:1 x Client (Ubuntu 10.10)
 +
::1 x HAT controller
 +
:: 1 x Power cable
 +
:: 1 x Power supply
 +
:: 2 x USB A-B cable
 +
:: 1 x USB A-microB cable
 +
:: 1 x N900
-
* An smtp server is needed for OTS to be able to send result emails.
+
== Network Setup ==
-
** You can use the smtp server provided by your ISP or organization
+
-
** Or you can setup your own. for example [http://my.opera.com/Contrid/blog/show.dml/4786849 postfix]
+
-
==== Basic Setup ====
+
Using static IP addresses on all OTS machines is strongly recommended. It is possible to setup the system also with dynamic IP addresses but it might cause problems every now and then because IP's and hostnames change.
-
* Download and install RabbitMQ server from http://www.rabbitmq.com/server.html
+
'''Note''' All OTS machines need to be able to access other OTS machines based on their hostname.
-
* Install dependencies from ubuntu repository:
+
How to check that DNS names are correct:
-
sudo apt-get update
+
-
sudo apt-get install python-setuptools python-amqplib python-django
+
-
* Install rest of the dependencies with easy_install:
+
1. Check OTS server's hostname
-
  sudo easy_install minixsv
+
hostname
 +
2. Ping the OTS server's hostname from the OTS worker
 +
  ping <hostname>
-
* Get source code from http://gitorious.com/qa-tools/ots/ (tag 0.1.0)
+
If ping fails, add manually OTS server's hostname to OTS workers '''/etc/hosts''' file
 +
<IP> <hostname>
-
* Install ots.common:
+
== Preparation ==
-
cd ots/ots.common/
+
-
sudo python setup.py install
+
-
* Install ots.server:
+
There are two ways of getting OTS binary packages: from '''the source code'''
-
cd ots/ots.server/
+
or from the '''MeeGo Tools:Testing repository'''. From the repository you can get
-
sudo python setup.py install
+
the stable version and from the source code the development version. If you wish to install OTS from source follow instructions howto [[Quality/QA-tools/OTS/UserDocumentation/Installation#Building_packages_from_source|build packages from the source]].
-
* Download and install test definition schema files from http://gitorious.com/qa-tools/test-definition
+
=== Set up Tools:Testing repository ===
-
* Create a directory for testrun logs and make sure the user running ots.server has write permissions to it:
+
By setting up the repository it allows you to install OTS and other MeeGo QA tools via apt-get command. Follow the [[Quality/QA-tools/How_to_set_up_repositories|instructions]].
-
sudo mkdir /var/log/ots
+
-
* At this point it should be possible to trigger testruns from python shell if you have a worker already set up and configured to use this server. Here's an example ipython session:
+
== OTS server installation ==
-
<pre>
+
-
In [1]: from ots.server.xmlrpc.public import request_sync
+
-
In [4]: program = "example_sw_product"
+
* Install OTS server components
 +
sudo apt-get install python-ots-common python-ots-results python-ots-server
-
In [5]: request = "5"
+
* Configure OTS server settings
 +
sudo nano /etc/ots/server.conf
-
In [6]: notify_list = ['tvainio@localhost']
+
Recommended to change following:
 +
'example_sw_product', example to 'meego_product'
 +
'devicegroup', example to 'meego_n900'
-
In [7]: options = dict()
+
* Install OTS server plug-ins
 +
[[Quality/QA-tools/OTS/Plugins/HTTP_logger|Logger plug-in]] (recommended)
 +
[[Quality/QA-tools/OTS/Plugins/Email|Email plug-in]] (recommended)
-
In [8]: options['image'] = "http://somewhere/some_image.bin"
+
See more plug-ins from [[Quality/QA-tools/OTS/Plugins|OTS Plug-ins]]
-
In [9]: options['email'] = "off"
+
* If logger plug-in is installed
 +
Change permissions to logging directory
 +
sudo chown www-data:www-data /var/log/ots
-
In [13]: options["device"] = "devicegroup:default"            # Make this match the worker
+
Now the OTS server can be used via apache (django_xmlrpc).
-
In [14]: request_sync(program, request, notify_list, options)
+
* If logger plug-in is not installed
-
Out[14]: 'FAIL'
+
Change user permissions to logging directory
-
</pre>
+
sudo chown <user>:<group> /var/log/ots
-
The result will be PASS/FAIL/ERROR. ERROR means that something went wrong in server side and testrun was not even started. FAIL means failed testrun and PASS means that everything went fine and all tests passed. Testrun logs with more information about the possible errors are available in /var/log/ots/
+
* Now you can start OTS server
-
 
+
-
==== Configuring the Server ====
+
-
 
+
-
The previous example was not very useful. To get OTS server running as a real server you have two options. A simple xmlrpc server or a more advanced django based server. First thing you need to do is setup a custom config file.
+
-
 
+
-
===== Custom Config File =====
+
-
 
+
-
Ots server tries to import a configuration module ots_extensions.ots_config. If it does not succeed it uses the default from ots.server.testrun_host.default_ots_config. You can set up your own ots_config by following these instructions:
+
-
 
+
-
* Create a directory for your extensions:
+
-
mkdir my_ots_extensions
+
-
 
+
-
* Add it to your python path
+
-
export PYTHONPATH=/full/path/to/my_ots_extensions/:$PYTHONPATH
+
-
 
+
-
* Create custom ots_extensions python package:
+
-
mkdir my_ots_extensions/ots_extensions
+
-
touch my_ots_extensions/ots_extensions/__init__.py
+
-
 
+
-
* Copy the default config file from ots/ots.server/ots/server/testrun_host/default_ots_config.py to my_ots_extensions/ots_extensions/ots_config.py
+
-
 
+
-
* Modify the file to suit your needs. Check at least the following settings:
+
-
** Email settings (The smtp server OTS uses to send testrun results)
+
-
** xmlrpc server config (if you are setting the simple xmlrpc server setup. More info below.)
+
-
** The default options for your sw product:
+
-
You can define default values for all options here. The example_sw_product contains and example how to define options. You cannot use an sw_product if it does not contain the default options in ots_config. Here's a small example. I'm developing a Meego based coffeemaker and creating custom software images for it. To automate the testing I create an sw_product called "my_meego_variant":
+
-
'''TODO: Document all options'''
+
-
<pre>
+
-
#
+
-
# Defaults for my_meego_variant                           
+
-
#                                                                                                                                 
+
-
 
+
-
# Lets start with the global_defaults
+
-
default_options["my_meego_variant"] = global_defaults.copy()
+
-
 
+
-
# The images work only on meego coffeemakers so the default devicegroup will be "meego_coffeemaker"
+
-
default_options["my_meego_variant"]['device'] = {'devicegroup':'meego_coffeemaker'}
+
-
 
+
-
# Coffeemaker needs to be fast so we define a 3 minutes global timeout for the test execution.
+
-
default_options["my_meego_variant"]['timeout'] = 3
+
-
</pre>
+
-
 
+
-
===== Extension Points =====
+
-
 
+
-
OTS uses plugins to do various things during the testrun. You can write your own plugins to add more functionality by implementing a module ots_extensions.extension_points. An example file can be found from ots/ots.server/ots/server/testrun_host/example_extension_points.py
+
-
 
+
-
===== Simple XMLRPC Server =====
+
-
 
+
-
* After you have implemented your custom config file and defined suitable xmlrpc_host and xmlrpc_port values you can start the simple xmlrpc server:
+
  ots_server
  ots_server
-
* After that you can start testruns on your ots_server by calling the request_sync() method over xmlrpc just like we did locally in the example above. There's also a command line tool called ots_trigger in ots.tools package. It can be installed by:
+
== OTS worker installation ==
-
cd ots/ots.tools/
+
* Install dependencies
-
  sudo python setup.py install
+
  sudo apt-get install python-amqplib testrunner-lite
 +
* Install OTS worker packages
 +
sudo apt-get install python-ots-common python-ots-worker
 +
* Configure OTS worker settings
 +
sudo nano /etc/ots/worker.conf
-
* A testrun can be triggered from command line with ots_trigger:
+
Change 'devicegroup', example meego_n900
-
ots_trigger -s your_xmlrpc_host:your_xmlrpc_port -b 333 -i url_to_dummyimage -p my_meego_variant -e your_email_address
+
Change 'host' to server's address
-
The result should be FAIL and if your email server settings are correct you should also receive an email.
+
* Start OTS worker
 +
sudo ots_worker
-
* If we look into the new testrun log file in /var/log/ots/ we should find something like this:
+
== OTS tools ==
-
<pre>
+
Tools are used for triggering test runs from the command line.
-
2010-09-24 15:48:21,188  conductorengine ERROR    Device group 'meego_coffeemaker' does not exist
+
-
Traceback (most recent call last):
+
-
  File "/usr/local/lib/python2.6/dist-packages/ots.server-0.1dev-py2.6.egg/ots/server/conductorengine/conductorengine.py", line 150, in execute
+
-
    self._taskrunner.run()
+
-
  File "/usr/local/lib/python2.6/dist-packages/ots.server-0.1dev-py2.6.egg/ots/server/distributor/taskrunner.py", line 417, in run
+
-
    (self._routing_key))
+
-
OtsQueueDoesNotExistError: No queue for meego_coffeemaker
+
-
</pre>
+
-
* Next step is to set up an OTS worker into the devicegroup meego_coffeemaker. Instructions can be found below.
+
* Install OTS tools
 +
sudo apt-get install python-ots-tools
-
===== Django Based Server =====
+
* Trigger a test run
 +
ots_trigger -s localhost/xmlrpc -b test_build -i http://url_to_image -p example_sw_product -e test@man.com
-
With Django and Apache it's possible to set up a more advanced ots server.
+
== How to install N900 automation tools to OTS worker ==
-
There's for example a global logger application available in ots.server.logger. By setting up the logger it is possible to get log messages for a specific testrun from all parts of the system (ots server, ots conductor and testrunner-lite). The logs are stored into DB and can be accessed with a web UI. It's also easy to implement a result db and web views for the test results.
+
* Remove network-manager, because it breaks the USB connection. See more information from autotest-guide.
-
'''TODO: Add instructions'''
+
* Install dependencies
 +
sudo apt-get install meego-ai-flasher eat-host-ubuntu
 +
* Get N900 flasher from the Nokia's tablets-dev portal
 +
http://tablets-dev.nokia.com/maemo-dev-env-downloads.php?f=maemo_flasher-3.5_2.5.2.2_i386.deb
 +
sudo dpkg -i maemo_flasher-3.5_2.5.2.2_i386.deb
-
=== Worker ===
+
* Start HAT driver
 +
sudo hat_drv &
-
* Install dependencies:
+
* Test manually that everything is OK, this is executed in the worker
-
  sudo apt-get update
+
  sudo conductor -u <image url>
-
sudo apt-get install python-setuptools python-amqplib
+
-
* Get source code from http://gitorious.com/qa-tools/ots/ (tag 0.1.0)
+
* Start OTS worker
 +
sudo ots_worker
-
* Install ots.common:
+
== Building packages from source ==
-
cd ots/ots.common/
+
-
sudo python setup.py install
+
-
* Install ots.worker:
+
If you which to build your own packages and install OTS from them here are the instructions. But it is recommended to install OTS using the repository.
-
cd ots/ots.worker/
+
-
sudo python setup.py install
+
-
* Configure the worker by editing devicegroup and server address in /etc/ots.ini:
+
* Install git core
-
<pre>
+
sudo apt-get install git-core
-
[Worker]
+
-
###########################################
+
* Get sources
-
# REPLACE `fix_me` WITH YOUR DEVICEGROUP
+
git clone git://gitorious.org/meego-quality-assurance/ots.git
-
###########################################
+
-
queue = meego_coffeemaker                #
+
* Get building tools
-
routing_key = meego_coffeemaker          # Change these 3 lines to the devicegroup this worker belongs to
+
  sudo apt-get install dpkg-dev debhelper python-setuptools
-
services_exchange = meego_coffeemaker    #
+
-
 
+
-
###############################
+
-
# ADVANCED CONFIGURATION
+
-
###############################
+
-
 
+
-
host = your_server_address                # Change this to your ots server address
+
-
vhost = /
+
-
port = 5672
+
-
username = guest
+
-
password = guest
+
-
consumer_tag = worker
+
-
log_file = /var/log/ots.log
+
-
</pre>
+
-
 
+
-
 
+
-
* Start the worker:
+
-
 
+
-
  sudo ots_worker
+
-
* If everything went ok, you should see something like this:
+
* Build packages
-
<pre>
+
cd ots
-
010-09-24 11:00:41,373 - amqplib - DEBUG - Open OK! known_hosts [starshollow:5672]
+
dpkg-buildpackage -rfakeroot
-
2010-09-24 11:00:41,374 - amqplib - DEBUG - using channel_id: 1
+
-
2010-09-24 11:00:41,374 - amqplib - DEBUG - Channel open
+
-
2010-09-24 11:00:41,375 - ots.worker.worker - DEBUG - Starting the server. {vhost:'/', queue:'meego_coffeemaker', routing_key:'meego_coffeemaker'}
+
-
2010-09-24 11:00:41,377 - ots.worker.task_broker - DEBUG - Starting main loop...
+
-
</pre>
+
-
* There's also an init script available in ots.worker/debian/python-ots-worker.ots-worker.init to make running the worker easier
+
* Install dependencies
 +
sudo apt-get install python-django python-amqplib python-configobj rabbitmq-server test-definition
-
* After that the worker should be ready for receiving tasks. To make sure the actual test execution works please see the instructions for ots.worker.conductor: [[Quality/QA-tools/OTS/UserDocumentation/Conductor| Conductor]]
+
* Now you can install the packages
 +
sudo dpkg -i <package>

Latest revision as of 10:26, 2 August 2011

Contents

OTS 0.8.x installation Ubuntu

If using 0.1.x version, see migration from 0.1.x to 0.8.x document.

Used hardware

1 x Server (Ubuntu 10.10)
1 x Client (Ubuntu 10.10)
1 x HAT controller
1 x Power cable
1 x Power supply
2 x USB A-B cable
1 x USB A-microB cable
1 x N900

Network Setup

Using static IP addresses on all OTS machines is strongly recommended. It is possible to setup the system also with dynamic IP addresses but it might cause problems every now and then because IP's and hostnames change.

Note All OTS machines need to be able to access other OTS machines based on their hostname.

How to check that DNS names are correct:

1. Check OTS server's hostname

hostname

2. Ping the OTS server's hostname from the OTS worker

ping <hostname>

If ping fails, add manually OTS server's hostname to OTS workers /etc/hosts file

<IP> <hostname>

Preparation

There are two ways of getting OTS binary packages: from the source code or from the MeeGo Tools:Testing repository. From the repository you can get the stable version and from the source code the development version. If you wish to install OTS from source follow instructions howto build packages from the source.

Set up Tools:Testing repository

By setting up the repository it allows you to install OTS and other MeeGo QA tools via apt-get command. Follow the instructions.

OTS server installation

  • Install OTS server components
sudo apt-get install python-ots-common python-ots-results python-ots-server
  • Configure OTS server settings
sudo nano /etc/ots/server.conf

Recommended to change following:

'example_sw_product', example to 'meego_product'
'devicegroup', example to 'meego_n900'
  • Install OTS server plug-ins
Logger plug-in (recommended)
Email plug-in (recommended)

See more plug-ins from OTS Plug-ins

  • If logger plug-in is installed
Change permissions to logging directory
sudo chown www-data:www-data /var/log/ots

Now the OTS server can be used via apache (django_xmlrpc).

  • If logger plug-in is not installed
Change user permissions to logging directory
sudo chown <user>:<group> /var/log/ots
  • Now you can start OTS server
ots_server

OTS worker installation

  • Install dependencies
sudo apt-get install python-amqplib testrunner-lite
  • Install OTS worker packages
sudo apt-get install python-ots-common python-ots-worker
  • Configure OTS worker settings
sudo nano /etc/ots/worker.conf

Change 'devicegroup', example meego_n900

Change 'host' to server's address

  • Start OTS worker
sudo ots_worker

OTS tools

Tools are used for triggering test runs from the command line.

  • Install OTS tools
sudo apt-get install python-ots-tools
  • Trigger a test run
ots_trigger -s localhost/xmlrpc -b test_build -i http://url_to_image -p example_sw_product -e test@man.com

How to install N900 automation tools to OTS worker

  • Remove network-manager, because it breaks the USB connection. See more information from autotest-guide.
  • Install dependencies
sudo apt-get install meego-ai-flasher eat-host-ubuntu
  • Get N900 flasher from the Nokia's tablets-dev portal
http://tablets-dev.nokia.com/maemo-dev-env-downloads.php?f=maemo_flasher-3.5_2.5.2.2_i386.deb
sudo dpkg -i maemo_flasher-3.5_2.5.2.2_i386.deb
  • Start HAT driver
sudo hat_drv &
  • Test manually that everything is OK, this is executed in the worker
sudo conductor -u <image url>
  • Start OTS worker
sudo ots_worker

Building packages from source

If you which to build your own packages and install OTS from them here are the instructions. But it is recommended to install OTS using the repository.

  • Install git core
sudo apt-get install git-core
  • Get sources
git clone git://gitorious.org/meego-quality-assurance/ots.git
  • Get building tools
sudo apt-get install dpkg-dev debhelper python-setuptools
  • Build packages
cd ots
dpkg-buildpackage -rfakeroot
  • Install dependencies
sudo apt-get install python-django python-amqplib python-configobj rabbitmq-server test-definition
  • Now you can install the packages
sudo dpkg -i <package>
Personal tools