summaryrefslogtreecommitdiffstats
path: root/testapi/docs/developer/devguide
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/docs/developer/devguide')
-rw-r--r--testapi/docs/developer/devguide/images/CAS-sequence.jpgbin0 -> 11785 bytes
-rw-r--r--testapi/docs/developer/devguide/testapi-client-import.rst65
-rw-r--r--testapi/docs/developer/devguide/testapi-client.rst426
-rw-r--r--testapi/docs/developer/devguide/web-portal.rst114
4 files changed, 601 insertions, 4 deletions
diff --git a/testapi/docs/developer/devguide/images/CAS-sequence.jpg b/testapi/docs/developer/devguide/images/CAS-sequence.jpg
new file mode 100644
index 0000000..a624871
--- /dev/null
+++ b/testapi/docs/developer/devguide/images/CAS-sequence.jpg
Binary files differ
diff --git a/testapi/docs/developer/devguide/testapi-client-import.rst b/testapi/docs/developer/devguide/testapi-client-import.rst
new file mode 100644
index 0000000..69cb6ad
--- /dev/null
+++ b/testapi/docs/developer/devguide/testapi-client-import.rst
@@ -0,0 +1,65 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. (c) 2017 ZTE Corp.
+
+=====================
+TestAPI client import
+=====================
+
+**Python module to communicate with the TestAPI Server**
+
+This project aims to provide a python module which can
+communicate with the TestAPI Server. The user can use this client
+to fetch/post/modify the resources on the TestAPI Server.
+
+Usage
+-----
+
+Pod
+^^^
+
+GET
+"""
+
+User will get the json Pod objects with the get request.
+
+.. code-block:: shell
+
+ from testapiclient.client import pods
+
+ pod_client = pods.PodsClient()
+ pod_client.get()
+
+User can use search parameters to get pods
+
+.. code-block:: shell
+
+ from testapiclient.client import pods
+
+ pod_client = pods.PodsClient()
+ pod_client.get(name='pod1')
+
+GET ONE
+"""""""
+
+User will get the json Pod objects with the get request.
+
+.. code-block:: shell
+
+ from testapiclient.client import pods
+
+ pod_client = pods.PodsClient()
+ pod_client.get_one('name')
+
+CREATE
+""""""
+User has to authenticate before running the function.
+
+.. code-block:: shell
+
+ from testapiclient.client import pods
+
+ pod_client = pods.PodsClient(user='test', password='pass')
+ pod_client.create({'name': 'test-api', 'mode':'metal',
+ 'role':'community_ci', 'details':''}
+
diff --git a/testapi/docs/developer/devguide/testapi-client.rst b/testapi/docs/developer/devguide/testapi-client.rst
index ab4c8e8..ea08ad9 100644
--- a/testapi/docs/developer/devguide/testapi-client.rst
+++ b/testapi/docs/developer/devguide/testapi-client.rst
@@ -6,5 +6,427 @@
TestAPI client
==============
-.. toctree::
- :maxdepth: 2
+TestAPIClient is a command-line client for TestAPI that
+brings the command set for pod, project, testcase, results,
+deploy result and scenario together in a single shell with a uniform command
+structure.
+
+
+Installation
+------------
+
+User can install this client from the source.
+
+.. code-block:: shell
+
+ python install testapi/testapi-client/setup.py install
+
+After the installation, user has to set the environment variables
+
+.. code-block:: shell
+
+ source testapi/testapi-client/etc/client.creds
+
+
+Authentication Process
+----------------------
+
+User needs to provide the username and the password with the testapi
+command.
+
+.. code-block:: shell
+
+ $ testapi -u [username] -p [password]
+ (testapi) pod create
+
+
+or
+
+.. code-block:: shell
+
+ testapi pode create -u [username] -p [password] [pod-schema]
+
+First one, user can continue the progress after the authentication.
+cli will create a new session to handle the request.
+
+In second one, cli won't create a session. one time command.
+
+Token is also used for the authorization purpose. User has to obtain the
+valid token from the TestAPI comminity and set it in the following file
+: **testapi/testapi-client/etc/client.creds**
+
+.. code-block:: shell
+
+ source testapi/testapi-client/etc/client.creds
+
+
+Command Structure
+-----------------
+
+TestAPIClient follows a common command Structure.
+
+.. code-block:: shell
+
+ testapi [resource-name] [function] [-u] [username] [-p] [password] [command-arguments]
+
+.. NOTE::
+ resource-name : include first order parent name and resource name.
+
+ example:
+ scenario installer, scenario version, scenario project, scenario custom,
+ scenario trustindicator, scenario score, pod , project, testcase, result,
+ deployresult and scenario.
+
+.. NOTE::
+ -u and -p are optional commands. The user can decide on them.
+
+There are many arguments for each commands. User can get them using help command in the
+cli.
+
+.. code-block:: shell
+
+ pod create --help/-h
+
+Pod
+^^^
+
+Create
+""""""
+
+Authentication required
+
+.. code-block:: shell
+
+ testapi pod create [-u] [username] [-p] [password] [pod-schema]
+
+or
+
+.. code-block:: shell
+
+ $ testapi [-u] [username] [-p] [password]
+ (testapi) pod create [pod-schema]
+
+.. NOTE::
+ pod-schema - '{"role": "", "name": "", "details": "", "mode": ""}'
+
+Get
+"""
+
+Authentication is not required
+
+.. code-block:: shell
+
+ testapi pod get [-name] [key-word]
+
+.. NOTE::
+ -name is not mandatory. The user can use the -name option to reduce the
+ search result otherwise they will get the details about all pods.
+
+Get one
+"""""""
+
+Authentication is not required
+
+.. code-block:: shell
+
+ testapi pod getone [name-keyword]
+
+.. NOTE::
+ name-keyword is mandatory.
+
+
+Delete
+""""""
+
+Authentication is required
+
+.. code-block:: shell
+
+ testapi pod delete [-u] [username] [-p] [password] [pod-name]
+
+or
+
+.. code-block:: shell
+
+ $ testapi [-u] [username] [-p] [password]
+ (testapi) pod delete [pod-name]
+
+.. NOTE::
+ pod-name is mandatory.
+
+
+Project
+^^^^^^^
+
+Create
+""""""
+
+Authentication required
+
+.. code-block:: shell
+
+ testapi project create [-u] [username] [-p] [password] [project-schema]
+
+or
+
+.. code-block:: shell
+
+ $ testapi [-u] [username] [-p] [password]
+ (testapi) project create [project-schema]
+
+.. NOTE::
+ project-schema - '{"description": "", "name": ""}'
+
+
+Get
+"""
+
+Authentication is not required
+
+.. code-block:: shell
+
+ testapi project get [-name] [key-word]
+
+.. NOTE::
+ -name is not mandatory. The user can use the -name option to reduce the
+ search result otherwise they will get the details about all projects.
+
+Get one
+"""""""
+
+Authentication is not required
+
+.. code-block:: shell
+
+ testapi project getone [name-keyword]
+
+.. NOTE::
+ name-keyword is mandatory.
+
+Update
+""""""
+
+Authentication required
+
+.. code-block:: shell
+
+ testapi project put [-u] [username] [-p] [password] [project-name]
+ [project-schema]
+
+or
+
+.. code-block:: shell
+
+ $ testapi [-u] [username] [-p] [password]
+ (testapi) project put [project-name] [project-schema]
+
+.. NOTE::
+ project-schema - '{"name": "", "description": ""}'
+
+
+Testcase
+^^^^^^^^
+
+Create
+""""""
+
+Authentication required
+
+.. code-block:: shell
+
+ testapi testcase create [-u] [username] [-p] [password]
+ [--project-name] [testcase-schema]
+
+or
+
+.. code-block:: shell
+
+ $ testapi [-u] [username] [-p] [password]
+ (testapi) testcase create [--project-name] [testcase-schema]
+
+.. NOTE::
+ testcase-schema - '{"run": "", "name": "", "ci_loop": "", "tags": "",
+ "url": "", "catalog_description": "", "tier": "",
+ "dependencies": "", "version": "", "criteria": "",
+ "domains": "", "trust": "", "blocking": "",
+ "description": ""}'
+
+
+Get
+"""
+
+Authentication is not required
+
+.. code-block:: shell
+
+ testapi testcase get [--project-name]
+
+.. NOTE::
+ --project-name is mandatory.
+
+Get one
+"""""""
+
+Authentication is not required
+
+.. code-block:: shell
+
+ testapi testcase getone [--project-name] [name]
+
+.. NOTE::
+ name and project-name are mandatory.
+
+Update
+""""""
+
+Authentication required
+
+.. code-block:: shell
+
+ testapi testcase put [-u] [username] [-p] [password] [--project-name]
+ [name] [testcase-schema]
+
+or
+
+.. code-block:: shell
+
+ $ testapi [-u] [username] [-p] [password]
+ (testapi) testcase put [--project-name] [name] [testcase-schema]
+
+.. NOTE::
+ testcase-schema - '{"run": "", "name": "", "ci_loop": "", "tags": "",
+ "url": "", "catalog_description": "", "tier": "",
+ "dependencies": "", "version": "", "criteria": "",
+ "domains": "", "trust": "", "blocking": "",
+ "description": ""}
+
+
+Result
+^^^^^^^
+
+Create
+""""""
+
+Token is required. Set token as an environment variable.
+
+.. code-block:: shell
+
+ testapi result create [-u] [username] [-p] [password] [result-schema]
+
+or
+
+.. code-block:: shell
+
+ $ testapi [-u] [username] [-p] [password]
+ (testapi) result create [result-schema]
+
+.. NOTE::
+ result-schema - '{"project_name": "", "scenario": "", "stop_date": "",
+ "case_name": "", "build_tag": "", "version": "",
+ "pod_name": "", "criteria": "", "installer": "",
+ "start_date": "", "details": ""}'
+
+
+Get
+"""
+
+Authentication is not required
+
+.. code-block:: shell
+
+ testapi result get [-cli-arguments] [arguments-value]
+
+.. NOTE::
+ List of commandline arguments
+
+ * -case : Search results using tesetcase
+ * -build-tag : Search results using build tag
+ * -from : Search results using from date
+ * -last : Search results using last date
+ * -scenario : Search results using scenario
+ * -period : Search results using period
+ * -project : Search results using project
+ * -to : Search results using to
+ * ---version : Search results using version
+ * -criteria : Search results using criteria
+ * -installer : Search results using installer
+ * -pod : Search results using pod
+ * -page : Search results using page
+
+Get one
+"""""""
+
+Token is required. Set token as an environment variable.
+
+.. code-block:: shell
+
+ testapi result getone [result_id]
+
+.. NOTE::
+ result_id is mandatory.
+
+Deploy Result
+^^^^^^^^^^^^^
+
+Create
+""""""
+
+Token is required. Set token as an environment variable.
+
+
+.. code-block:: shell
+
+ testapi deployresult [-u] [username] [-p] [password]
+ [--project-name] [deployresult-schema]
+
+or
+
+.. code-block:: shell
+
+ $ testapi [-u] [username] [-p] [password]
+ (testapi) deployresult create [deployresult-schema]
+
+.. NOTE::
+ deployresult-schema - '{"run": "", "name": "", "ci_loop": "", "tags": "",
+ "url": "", "catalog_description": "", "tier": "",
+ "dependencies": "", "version": "", "criteria": "",
+ "domains": "", "trust": "", "blocking": "",
+ "description": ""}'
+
+
+Get
+"""
+
+Authentication is not required
+
+.. code-block:: shell
+
+ testapi deployresult get [-cli-arguments] [arguments-value]
+
+.. NOTE::
+ List of command line arguments
+
+ * -job-name : Search results using job
+ * -build-id : Search results using build id
+ * -from : Search results using from date
+ * -last : Search results using last date
+ * -scenario : Search results using scenario
+ * -period : Search results using period
+ * -to : Search results using to
+ * ---version : Search results using version
+ * -criteria : Search results using criteria
+ * -installer : Search results using installer
+ * -pod-name : Search results using pod
+ * -page : Search results using page
+
+Get one
+"""""""
+
+Authentication is not required
+
+.. code-block:: shell
+
+ testapi deployresult getone [deployresult_id]
+
+.. NOTE::
+ deployresult_id is mandatory.
diff --git a/testapi/docs/developer/devguide/web-portal.rst b/testapi/docs/developer/devguide/web-portal.rst
index 62b2f17..8c4bc6c 100644
--- a/testapi/docs/developer/devguide/web-portal.rst
+++ b/testapi/docs/developer/devguide/web-portal.rst
@@ -6,5 +6,115 @@
Web portal
==========
-.. toctree::
- :maxdepth: 2
+**Web-portal of OPNFV Testapi**:
+
+This project aims to provide the web interface for the Testapi framework. It uses the Restful APIs
+of the testapi framework to provide front-end functionalities.
+
+If you are interested in how TestAPI looks like, please visit OPNFV's official `TestAPI Server`__
+
+.. __: http://testresults.opnfv.org/test
+
+Pre-requsites
+=============
+
+In the web portal, we are using AngularJS(1.3.15) as the frontend framework with Bootstrap(v3) CSS.
+
+Running locally
+===============
+
+Installation
+^^^^^^^^^^^^
+
+Web portal will be installed with the testapi framework. No extra installation.
+
+.. code-block:: shell
+
+ python setup.py install
+
+Start Server
+^^^^^^^^^^^^
+
+.. code-block:: shell
+
+ *opnfv-testapi [--config-file <config.ini>]*
+
+If --config-file is provided, the specified configuration file will be employed
+when starting the server, or else /etc/opnfv_testapi/config.ini will be utilized
+by default.
+
+After executing the command successfully, a TestAPI server will be started on
+port 8000, to visit web portal, please access http://hostname:8000
+
+Test
+===============
+
+There are few external requirements for the testing.
+They are
+
+1. npm : node package manager
+ you can get the installation package for nodejs from the official `website`__
+
+ .. __: https://nodejs.org/en/
+
+2. grunt cli : Automation tool
+
+.. code-block:: shell
+
+ npm install -g grunt-cli
+
+After installing global dependencies, you have to install the required local node modules.
+
+.. code-block:: shell
+
+ npm install
+
+**Running tests**
+
+.. code-block:: shell
+
+ grunt e2e
+
+Authentication
+==============
+
+The web portal is using Linux identity server as the Central Authentication Service. The following
+diagram will explain the authentication process.
+
+.. image:: /images/CAS-sequence.jpg
+ :width: 600
+ :alt: Workflow of the Athentication
+
+When a new user initially logs into an application they won't have established a
+session with the application. Instead of displaying a login form asking for the username and
+password, the application (via the CAS Client) will redirect the browser to the linux foundation
+login page. Linux foundation identity server then authenticates the user. If the authentication
+fails, the Linux foundation login page is displayed again with an error message. So until
+authentication succeeds, the user will not be returned to the application.
+
+Authorization
+=============
+
+TestAPI has 3 level authorization layer. They are
+
+**Public**
+
+The public can view the resources(pod, project, testcase, result, deploy result, scenario).
+They do not have the access to create, delete or modify the resources.
+
+**User - Contributors**
+
+Contributors level user can view all the resources(pod, project, testcase, result, deploy result,
+scenario). They can create/delete/modify pod and scenario.
+
+They do not have the access to create project or testcase.
+
+**User - Submitter**
+
+Submitter level user can view all the resources(pod, project, testcase, result, deploy result,
+scenario). They can create/delete/modify pod and scenario.
+
+If user want to create/modify/delete a project or testcase then user has to be in the Submitter
+group for that specific project.
+
+Currently, we can't create/modify/delete results or deploy results from the web portal. \ No newline at end of file