Quali



| |

|Witbe SA |

|Les Collines de l’Arche, Immeuble Madeleine |

|92057 Paris La Défense cedex |

|Tel : +33 (0)1 47 67 77 77 |

|Fax : +33 (0)1 47 67 77 99 |

| |

USER GUIDE

|Written in Paris, on 10/06/11 |

|By Witbe Expertise |

|Tel : +33 (0)1 47 67 77 01 |

|Fax : +33 (0)1 47 67 77 99 |

|support@ |

|Helped by : |

|Document identity : Witbe_GuideUtilisation_Webservices-v1.1_FR |

| |

| |

|A l’attention de : |

Table of contents

1. managerProd and managerAdmin 4

1.1 Base type 4

1.2 Return type of each function 4

1.3 Available functions for the users 4

1.4 Example in python 5

2. ProbeState2 8

2.1 Architecture 8

2.2 Example of use 9

2.3 Create a plugin 10

2.3.1 Study of a method of report 10

2.3.2 Study of an associated verification method 11

3. Configuration 13

Annexes 15

managerProd and managerAdmin

There are two managers, production and administration is in charge of running the scenarios and the second spots Administration (launch of the watchdog, cleaning of the robot...)

← The address of the webservice of production manager:



← The address of the webservice manager Administration:



1 Base type

This Webservice uses 1 base type: string

The description of this type of base can be accessed from this page



2 Return type of each function

Each function of the WebService returns an element of type string.

If the chain is empty, then the call to this function has failed.

3 Available functions for the users

Below is the list of the methods used by the webservices to pilot the manager:

|Method |Input |Output |Description |

|runTask |Object ID (int) |None |Run the task |

|runTaskWithUuid |Object ID (int), execution ID |None |Run the task with an execution ID |

| |(String) | | |

|stopTask |Object ID (int) |None |Stop a running task |

|getAllTask |None |String |Returns all the tasks the manager should |

| | | |execute |

|getRunningTask |None |String |Lists all the running tasks |

|getListToken |None |String |Lists all the available result files |

|getResultToken |Object ID (int), execution ID |String |Result file of the task |

| |(String) | | |

|getTaskScript |Object ID (int) |String |Returns the scenario |

|getTaskPeriod |Object ID (int) |Period (int) |Returns the frequency of the task |

|getTaskMaxRuntime |Object ID (int) |maxRuntime (int) |Returns the max run time (timeout) of the task |

|refreshTask |None |None |Refreshes the task list |

|exportXML |None |String |Returns all the information in XML format |

4 Example in python

|>>>import SOAPpy |

|>>>srv = SOAPpy.SOAPProxy('') |

| |

|>>>listAllTask = srv.getAllTask() |

|>>>print listAllTask |

|All Tasks: |

|---------- |

|Next Execution : 20071008110500 - ObsId : 1 - Alias : fullhttpjs - Filename : C:\\Program Files\\witbe\\task\\fullhttpjs.tsk |

| |

|>>>srv.runTask(1) |

|'Task in progress...' |

|>>>srv.getListToken() |

|'1-------' |

|>>>print srv.getResultToken(1) |

| |

|DATE=20071008110338 |

|SITE_ID=0 |

|RMA_ID=0 |

|MEASURE_ID=31 |

| |

| |

| |

|DATE=20071008110338 |

|ID=1 |

|FREQ=5 |

|BIGGEST_TIME_0=152 |

|BIGGEST_URL_0= |

|BIGGEST_FBTIME_0=177 |

|BIGGEST_SIZE_0=8866 |

|BIGGEST_TIME_1=75 |

|BIGGEST_URL_1= |

|BIGGEST_FBTIME_1=0 |

|BIGGEST_SIZE_1=1920 |

|HTTP_REQUEST=87 |

|RETURN=0 |

|HTTP_DNS=16 |

|HTTP_CONNECT=71 |

|HTTP_RC=200 |

|HTTP_GET=75 |

|REC_SIZE=10786 |

|HTTP_FULLTIME=254 |

|HTTP_FULL=254 |

|TIME=329 |

| |

| |

|>>> print srv.exportXML() |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

| |

|fullhttpjs |

|31 |

|1 |

|300000 |

|45000 |

|virtual |

|None |

| |

| |

|c1abe742b8561b7686693302669e192b |

|c:\python22\pythonw.exe "C:\Program Files\witbe\plugins\plugin31.py" "C:\Program Files\witbe\task\fullhttpjs.tsk" "C:\Program |

|Files\witbe\download\result\plugin31.fullhttpjs.20071008143015" |

|20071008143500 |

|20071008143000 |

|10001 |

| |

| |

| |

| |

|fullhttpjs |

|31 |

|1 |

|300000 |

|45000 |

|virtual |

|None |

| |

| |

|c1abe742b8561b7686693302669e192b |

|c:\python22\pythonw.exe "C:\Program Files\witbe\plugins\plugin31.py" "C:\Program Files\witbe\task\fullhttpjs.tsk" "C:\Program |

|Files\witbe\download\result\plugin31.fullhttpjs.20071008143015" |

|20071008143500 |

|20071008143000 |

|0 |

| |

| |

| |

| |

| |

| |

ProbeState2

The probe embeds a number of webservices (self-diagnosis, managerProd, managerAdmin...). They work through the ' Toolserver'.

The webservice described below is based on the same principle.

1 Architecture

The service is used to provide information on the current state of the probe. This questioning can return two different forms of response. Either a check returning a Boolean, or a report returning detailed information.

The service is in fact only a switch, loading the plugins and calling their methods. For example, the following plugins are already written.

← Plugin_generic_NT: gives general information (disk space, connection to the CMS, memory…)

← Plugin_valid_IE: gives information about the necessary components of the BHO plugin (which inherits from Plugin_generic_NT and possesses all its methods).

|Method |Description |

|importPlugins() |Loads all the plugins of the lib directory |

|listLibPath() |Lists all the plugin files |

|getComputerName() |Returns the computer name |

|getOS() |Returns the OS of the robot |

|getDate() |Returns the date configured on the robot |

|getSiteId() |Returns the site ID |

|getRmaId() |Returns the robot ID |

|IsProductionProbe?() |Returns 1 if the robot is in production, 0 if not |

|IsVideoProbe?() |Returns 1 if the robot is a video robot, 0 if not |

|getPluginsLoaded() |Returns the list of the loaded plugins |

|getAllMethods() |Returns the methods of all the loaded plugins |

|getMethodsOfPlugin(plugin_name) |Return the methods of the plugin (by name) |

|runCheck(self, plugin_name, checkname): |Runs a ‘check’ on the plugin |

|getReport(self, plugin_name, reportname): |Runs a ‘report’ on the plugin |

|execute(self, plugin_name, plugin_method, *args): |Runs the method of a plugin |

2 Example of use

We want to know if the 192.168.0.263 machine is in a functional State. We therefore question the webservice embedded on the probe (using the python shell).

|>> import SOAPpy |

| |

|>>> # creation of the client |

|. . . srv = SOAPpy.SOAPProxy('') |

|>>> |

|>>> # application for loading from plugins |

|. . . srv.importPlugins() |

|>>> |

|>>> # list loaded plugins |

|. . . srv.getPluginsLoaded() |

|'Plugin_generic_NT Plugin_valid_IE' |

|>>> |

|>>> # list of methods of the plugin |

|. . . srv.getMethodsOfPlugin('Plugin_generic_NT') |

|['checkConnectCMS', 'checkDiskSpace', 'checkFreeMemory', 'checkLastMeasure', 'checkPackages', 'checkWitbeini', 'getAttributes', 'getFileVersion',|

|'getServiceStatus', 'reportDiskSpace', 'reportFW', 'reportFreeMemory', 'reportLastMeasure', 'reportNetInterfaces', 'reportOpenPorts', |

|'reportPackages', 'reportRouting', 'reportWitbeini'] |

|>>> |

|>>> # check request |

|. . . srv.runCheck('Plugin_generic_NT', 'checkConnectCMS') |

|'220 cms-02.PAR. ESMTP Sendmail NoVersion/NoVersion; Mon, 8 Oct 2007 |

|10:13:24 GMT\n' |

|>>> # for all checks for the plugin: srv.runCheck ('Plugin_generic_NT', 'all') |

|>>> # report request |

|. . . srv.getReport('Plugin_generic_NT', 'reportRouting') |

|'agedestinationnetmasknexthopmetric|

|404750.0.0.00.0.0.081.88.98.1104047581.88.98.0255.255.255.081.88.98.181040475|

|81.88.98.18255.255.255.255127.0.0.1104047581.255.255.255255.255.255.25581.88.98.181040475127.0.0.0255.0.0.0127.0.0.1140475224.0.0.0240.0.0.081.88.98.181040475255.255.255.255255.255.255.25581.88.98.18140475255.255.255.255255.255.255.25581.88.98.181' |

|>>> |

|>>> # all reports of the plugin: srv.getReport ('Plugin_generic_NT', 'all') |

3 Create a plugin

The so-called plugins are python files of which the name is starting by ‘plugin_’. They all respect the same type of definition:

|class Plugin(toolsplugin.BasePlugin): |

|_name = 'Plugin_lemien' |

| |

|def _isUsefull(self): |

|''' |

| |

|returns a boolean indicating if the plugin is useful for this robot |

| |

|''' |

This class will define methods reports and audits. Audits are methods that return a Boolean result wrapped in XML. These methods are based on methods of report to return their result. Indeed, a method of report collects detailed data on the robot and returns comprehensive results. The test method will therefore be based on it for the collection of the results and use only the part that is necessary.

1 Study of a method of report

We will study the 'checkFreeMemory' of the Plugin_generic_NT method. This method checks the value of the memory available on the robot by comparing it to a set threshold value previously. The collection of information should be done by a method of report. It's 'reportFreeMemory'. Reporting methods all have the same type of signature

← The name of the method starts by ‘report’.

← It takes ‘forcheck’ as an optional argument which indicates if it should return the collected data as a python object or an XML chain.

← It includes a part of data collection and a part of result sending.

The expected XML is of this form (example)

| |

|>> import SOAPpy |

|>>> srv = SOAPpy.SOAPProxy("") |

|>>> srv.getPlugins() |

|['id', 'global', 'httpd', 'toolserver', 'crontab', 'actions'] |

|>>> srv.getValues("id") |

|['id', 'param__rma_id', 'param__rma_site_id', 'param__rma_name', 'param__http_addr'] |

|>>> srv.getValue("id", "rma_id") |

|0 |

|>>> srv.set("id", "param", "rma_id", 1) |

|>>> srv.getValue("id", "rma_id") |

|1 |

|>>> srv.saveConf() |

|>>> print srv.updateSystem("id") |

|Restarting service monitord... [ OK ] |

|Restarting service managerAdmin... [ OK ] |

|>>> |

Annexes

TEMPLATEWSMANAGERWINDOWS.PY

|#!/usr/bin/python |

| |

|import os |

|import time |

|import SOAPpy |

|import uuid |

| |

|user = "witbe" |

|password = "witbe77" |

|ip = "192.168.0.219" |

| |

|obsid = 88475 |

|uuid = str(uuid.uuid1()) |

| |

|# Connect to WS |

|print "Connecting to %s ..." % ip, |

|s = SOAPpy.SOAPProxy("" % (user, password, ip)) |

|print "OK" |

| |

|# Run task |

|print "Launch task %s with uuid %s" % (obsid, uuid) |

|if s.runTaskWithUuid(obsid, uuid) != "": |

|# Get result with uuid |

|while True: |

|r = s.getResultToken(uuid) |

|if r != "": |

|break |

|time.sleep(1) |

|else: |

|print "Unable to launch %s" % obsid |

| |

| |

|date = "" |

|for line in r.split('\n'): |

|if line.startswith('DATE'): |

|date = line.split("=")[1].strip() |

|break |

| |

|filename = "rma-%s-%s-%s.wrs" % (date, obsid, uuid) |

|f = open(filename, "w+") |

|f.write(r) |

|f.close() |

| |

|print "Write result into %s" % filename |

-----------------------

Control of the video robot by WebServices

User guide

06/07/11

Witbe

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download

To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

Literature Lottery

Related searches