diff options
Diffstat (limited to 'testapi/docs')
-rw-r--r-- | testapi/docs/developer/devguide/testapi-client-import.rst | 974 | ||||
-rw-r--r-- | testapi/docs/developer/devguide/testapi-client.rst | 858 | ||||
-rw-r--r-- | testapi/docs/internship/webportal.rst | 169 |
3 files changed, 1999 insertions, 2 deletions
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..c6d7311 --- /dev/null +++ b/testapi/docs/developer/devguide/testapi-client-import.rst @@ -0,0 +1,974 @@ +.. 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 +""" + +Get a list of all the declared pods from the TestAPI server. + +.. code-block:: shell + + from testapiclient.client import pods + + pod_client = pods.PodsClient() + pod_client.get() + +The user can filter the results by the name attribute. Backend will +use a regular expression to find the list of pods which are +related to given name. + +.. code-block:: shell + + from testapiclient.client import pods + + pod_client = pods.PodsClient() + pod_client.get(name='pod1') + +.. NOTE:: + Response format: [{"_id": "", "creator": "", "role": "", "name": "", + "details": "", "mode": "", "creation_date": ""}] + + +GET ONE +""""""" + +Get a specific pod by its name. + +.. code-block:: shell + + from testapiclient.client import pods + + pod_client = pods.PodsClient() + pod_client.get_one('name') + +.. NOTE:: + Response format: {"_id": "", "creator": "", "role": "", "name": "", + "details": "", "mode": "", "creation_date": ""} + +CREATE +"""""" +This method used to create a project on the server. +The user should provide the user parameter and the password +parameter while initiating the PodsClient. + +Input for the function : + + * pod-json : Json object of the project + +.. NOTE:: + pod-json-schema - '{"role": "", "name": "", "details": "", "mode": ""}' + + * role should be either "community-ci" or "production-ci" + * mode should be either "metal" or "virtual" + +.. 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':''}) + + +Project +^^^^^^^ + +GET +""" + +Get a list of all the declared projects from the TestAPI server. + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient() + project_client.get() + +User can filter the results by the name attribute. Backend will +use a regular expression to find the list of projects which are +related to given name. + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient() + project_client.get(name='project1') + +.. NOTE:: + Response format: [{"_id": "", "creator": "", "description": "", + "name": "", "creation_date": ""}] + +GET ONE +""""""" + +Get a specific project by its name. + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient() + project_client.get_one('name') + +.. NOTE:: + Response format: {"_id": "", "creator": "", "description": "", + "name": "", "creation_date": ""} + +CREATE +"""""" + +This method used to create a project on the server. +The user should provide the user parameter and the password +parameter while initiating the ProjectsClient. + +Input for the function : + + * project-json : Json object of the project + +.. NOTE:: + project-json schema - '{"description": "", "name": ""}' + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient(user='test', password='pass') + project_client.create({'name': 'functest', 'description':'sample text'} + +UPDATE +"""""" + +This method used to update an existing project on the server. +The user should provide the user parameter and the password +parameter while initiating the ProjectsClient. + +Input for the function : + + * project-name: name of the project which user want to update. + * project-json: Json object of the project + +.. NOTE:: + project-json schema - '{"description": "", "name": ""}' + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient(user='test', password='pass') + project_client.update('functest', {'name': 'functest', + 'description':'updated text'}) + +DELETE +"""""" + +This method used to delete an existing project on the server. +The user should provide the user parameter and the password +parameter while initiating the ProjectsClient. + +Input for the function : + + * project-name: name of the project which user want to delete. + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient(user='test', password='pass') + project_client.delete('functest') + + +Testcase +^^^^^^^^ + +GET +""" + +Get a list of all the declared testcases under a project +from the TestAPI server. + +Input for the function : + + * project_name : Name of the project + +.. code-block:: shell + + from testapiclient.client import testcases + + testcase_client = testcases.TestcasesClient() + testcase_client.get(project_name='functest') + + +.. NOTE:: + Response format: [{ "project_name": "functest", "run": "", + "description": "", "tags": "", "creation_date": "", + "dependencies": "", "tier": "", "trust": "", "blocking": "", + "name": "", "ci_loop": "", "url": "", "version": "", + "criteria": "", "domains": "", "_id": "", "catalog_description": ""}] + +GET ONE +""""""" + +Get a specific testcase by its name and project name. + +.. code-block:: shell + + from testapiclient.client import testcases + + testcase_client = testcases.TestcasesClient() + testcase_client.get_one(project_name='functest', case_name='name') + +.. NOTE:: + Response format: { "project_name": "functest", "run": "", + "description": "", "tags": "", "creation_date": "", + "dependencies": "", "tier": "", "trust": "", "blocking": "", + "name": "", "ci_loop": "", "url": "", "version": "", + "criteria": "", "domains": "", "_id": "", "catalog_description": ""} + +CREATE +"""""" + +This method used to create a testcase on the server. +The user should provide the user parameter and the password +parameter while initiating the TestcasesClient. + +Input for the function : + * project_name : Project name + * testcase_json : Json object of the testcase + +.. NOTE:: + testcase_json schema - '{ "run": "", "description": "", "tags": "", + "dependencies": "", "tier": "", "trust": "", "blocking": "", + "name": "", "ci_loop": "", "url": "", "version": "", + "criteria": "", "domains": "", "catalog_description": ""}' + +.. code-block:: shell + + from testapiclient.client import testcases + + testcase_client = testcases.TestcasesClient(user='test', password='pass') + testcase_client.create(project_name, testcase_json) + +UPDATE +"""""" + +This method used to update an existing testcase on the server. +The user should provide the user parameter and the password +parameter while initiating the TestcasesClient. + +Input for the function : + * project_name : Project name + * testcase_name: name of the testcase which user want to update. + * testcase_json: Json object of the testcase + +.. NOTE:: + testcase-json schema - '{ "run": "", "description": "", "tags": "", + "dependencies": "", "tier": "", "trust": "", "blocking": "", + "name": "", "ci_loop": "", "url": "", "version": "", + "criteria": "", "domains": "", "catalog_description": ""}' + +.. code-block:: shell + + from testapiclient.client import testcases + + testcase_client = testcases.TestcasesClient(user='test', password='pass') + testcase_client.update(project_name, testcase_name, testcase_json) + +DELETE +"""""" + +This method used to delete an existing testcase on the server. +The user should provide the user parameter and the password +parameter while initiating the TestcasesClient. + +Input for the function : + + * project_name: name of the project + * testcase_name: name of the testcase which user want to delete. + +.. code-block:: shell + + from testapiclient.client import testcases + + testcase_client = testcases.TestcasesClient(user='test', password='pass') + testcase_client.delete(project_name, testcase_name) + + +Result +^^^^^^^ + +GET +""" + +Get a list of all the declared results from the TestAPI server. + +.. code-block:: shell + + from testapiclient.client import results + + result_client = results.ResultsClient() + result_client.get() + +User can filter the results by using some attributes. + +.. NOTE:: + List of search attributes. + + * 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 + +.. code-block:: shell + + from testapiclient.client import results + + result_client = results.ResultsClient() + result_client.get(pod='pod1', project='project1') + + +.. NOTE:: + Response format: [{ "project_name": "", "scenario": "", + "stop_date": "", "case_name": "", "build_tag": "", + "version": "", "pod_name": "", "criteria": "", + "installer": "", "start_date": "", "details": ""}] + +GET ONE +""""""" + +Get a specific result by its id. + +.. code-block:: shell + + from testapiclient.client import results + + result_client = results.ResultsClient() + result_client.get_one(result_id) + +.. NOTE:: + Response format: { "project_name": "", "scenario": "", + "stop_date": "", "case_name": "", "build_tag": "", + "version": "", "pod_name": "", "criteria": "", + "installer": "", "start_date": "", "details": ""} + +CREATE +"""""" + +This method used to create a result on the server. +The user should provide a valid token to run this method. +Read testapi-client.rst to more details. + +Input for the function : + * result_json : Json object of the result + +.. NOTE:: + result_json schema - '{ "project_name": "", "scenario": "", + "stop_date": "", "case_name": "", "build_tag": "", + "version": "", "pod_name": "", "criteria": "", + "installer": "", "start_date": "", "details": ""}' + +.. code-block:: shell + + from testapiclient.client import results + + result_client = results.ResultsClient() + result_client.create(result_json) + +DeployResult +^^^^^^^^^^^^ + +GET +""" + +Get a list of all the declared deploy results from the TestAPI server. + +.. code-block:: shell + + from testapiclient.client import deploy_results + + deploy_result_client = deploy_results.DeployResultsClient() + deploy_result_client.get() + +User can filter the deploy results by using some attributes. + +.. NOTE:: + List of search attributes. + + * 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 + +.. code-block:: shell + + from testapiclient.client import deploy_results + + deploy_result_client = deploy_results.DeployResultsClient() + deploy_result_client.get(scenario='scenario1', installer='installer1') + + +.. NOTE:: + Response format: [{"build_id": "", "upstream_build_id": "", + "scenario": "", "stop_date": "", "start_date": "", + "upstream_job_name": "", "version": "", "pod_name": "", + "criteria": "", "installer": "", "_id": "", "job_name": "", + "details": ""}] + +GET ONE +""""""" + +Get a specific deploy result by its id. + +.. code-block:: shell + + from testapiclient.client import deploy_results + + deploy_result_client = deploy_results.DeployResultsClient() + deploy_result_client.get_one(deploy_result_id) + +.. NOTE:: + Response format: {"build_id": "", "upstream_build_id": "", + "scenario": "", "stop_date": "", "start_date": "", + "upstream_job_name": "", "version": "", "pod_name": "", + "criteria": "", "installer": "", "_id": "", "job_name": "", + "details": ""} + +CREATE +"""""" + +This method used to create a deploy_result on the server. +The user should provide a valid token to run this method. +Read testapi-client.rst to more details. + +Input for the function : + * deploy_result_json : Json object of the deploy_result + +.. NOTE:: + deploy_result_json schema - '{"build_id": "", "upstream_build_id": "", + "scenario": "", "stop_date": "", "start_date": "", + "upstream_job_name": "", "version": "", "pod_name": "", + "criteria": "", "installer": "", "job_name": "", + "details": ""}' + +.. code-block:: shell + + from testapiclient.client import deploy_results + + deploy_result_client = deploy_results.DeployResultsClient() + deploy_result_client.create(deploy_result_json) + +Scenario +^^^^^^^^ + +GET +""" + +Get a list of all the declared scenarios from the TestAPI server. + +.. code-block:: shell + + from testapiclient.client import scenarios + + scenario_client = scenarios.ScenariosClient() + scenario_client.get() + +User can filter the scenarios by using some attributes. + +.. NOTE:: + List of search attributes. + + * project : Search scenarios using project + * installer : Search scenarios using project + * version : Search scenarios using project + * name: Search scenarios using project + +.. code-block:: shell + + from testapiclient.client import scenarios + + scenario_client = scenarios.ScenariosClient() + scenario_client.get(name='scenario1') + +.. NOTE:: + Response format: [{ "installers": [], "_id": "", "creation_date": "", + "name": "", "creator": ""}] + +GET ONE +""""""" + +Get a specific scenario by its name. + +.. code-block:: shell + + from testapiclient.client import scenarios + + scenario_client = scenarios.ScenariosClient() + scenario_client.get_one('name') + +.. NOTE:: + Response format: { "installers": [], "_id": "", "creation_date": "", + "name": "", "creator": ""} + +CREATE +"""""" + +This method used to create a scenario on the server. +The user should provide the user parameter and the password +parameter while initiating the ScenariosClient. + +Input for the function : + + * scenario-json : Json object of the scenario + +.. NOTE:: + scenario_json schema - '{ "installers": [], + "name": ""}' + + See Installer for installer_schema + +.. code-block:: shell + + from testapiclient.client import scenarios + + scenario_client = scenarios.ScenariosClient(user='test', password='pass') + scenario_client.create(scenario_json) + +UPDATE +"""""" + +This method used to update the name of an existing scenario on the server. +The user should provide the user parameter and the password +parameter while initiating the ScenariosClient. + +Input for the function : + + * scenario-name: name of the scenario which user want to update. + * scenario-json: Json object of the scenario + +.. NOTE:: + * scenario_name + * scenario_update_json schema - '{"name": ""}' + +.. code-block:: shell + + from testapiclient.client import scenarios + + scenario_client = scenarios.ScenariosClient(user='test', password='pass') + scenario_client.update(scenario_name, scenario_update_json) + +DELETE +"""""" + +This method used to delete an existing scenario on the server. +The user should provide the user parameter and the password +parameter while initiating the ScenariosClient. + +Input for the function : + + * scenario_name: name of the scenario which user want to delete. + +.. code-block:: shell + + from testapiclient.client import scenarios + + scenario_client = scenarios.ScenariosClient(user='test', password='pass') + scenario_client.delete('scenario_name') + +Scenario Installer +^^^^^^^^^^^^^^^^^^ + +CREATE +"""""" + +This method used to create an installer under a scenario +on the server. The user should provide the user parameter +and the password parameter while initiating the InstallersClient. + +Input for the function : + * scenario_name + * installer-json : Json object of the installer + +.. NOTE:: + installer_json schema - '{ "versions": [], + "installer": ""}' + + See version for version_schema + +.. code-block:: shell + + from testapiclient.client import installers + + installer_client = installers.InstallersClient(user='test', password='pass') + installer_client.create(scenario_name, installer_json) + +UPDATE +"""""" + +This method used to update the all existing installers of a scenario +The user should provide the user parameter and the password +parameter while initiating the InstallersClient. + +Input for the function : + + * scenario_name + * installer-json: Json object of the installer + +.. NOTE:: + * scenario_name + * installer_json schema - [{ "versions": [], "installer": ""}] + +.. code-block:: shell + + from testapiclient.client import installers + + installer_client = installers.InstallersClient(user='test', password='pass') + installer_client.update(scenario_name, installer_update_json) + +DELETE +"""""" + +This method used to delete existing installers from a scenario. +on the server. +The user should provide the user parameter and the password +parameter while initiating the InstallersClient. + +Input for the function : + * scenario_name + * installer_names: names of the installer which user want to delete. + +.. code-block:: shell + + from testapiclient.client import installers + + installer_client = installers.InstallersClient(user='test', password='pass') + installer_client.delete(scenario_name, installer_names) + +Scenario Version +^^^^^^^^^^^^^^^^ + +CREATE +"""""" + +This method used to create a version under a scenario +on the server. The user should provide the user parameter +and the password parameter while initiating the VersionsClient. + +Input for the function : + + * scenario_name + * installer_name + * version-json : Json object of the version + +.. NOTE:: + version_json schema - '{ "projects": [], "owner": "", + "version": ""}' + + See version for version_schema + +.. code-block:: shell + + from testapiclient.client import versions + + version_client = versions.VersionsClient(user='test', password='pass') + version_client.create(scenario_name, installer_name, version_json) + +UPDATE +"""""" + +This method used to update the all existing versions of a scenario +The user should provide the user parameter and the password +parameter while initiating the VersionsClient. + +Input for the function : + + * scenario_name + * installer_name + * version-json: Json object of the version + +.. NOTE:: + * scenario_name + * version_json schema - [{ "projects": [], "owner": "", "version": ""}] + +.. code-block:: shell + + from testapiclient.client import versions + + version_client = versions.VersionsClient(user='test', password='pass') + version_client.update(scenario_name, installer_name, version_update_json) + +DELETE +"""""" + +This method used to delete existing versions from a scenario. +on the server. +The user should provide the user parameter and the password +parameter while initiating the VersionsClient. + +Input for the function : + * scenario_name + * installer_name + * version_names: names of the version which user want to delete. + +.. code-block:: shell + + from testapiclient.client import versions + + version_client = versions.VersionsClient(user='test', password='pass') + version_client.delete(scenario_name, installer_name, version_names) + +Scenario Project +^^^^^^^^^^^^^^^^ + +CREATE +"""""" + +This method used to create a project under a scenario +on the server. The user should provide the user parameter +and the password parameter while initiating the ProjectsClient. + +Input for the function : + + * scenario_name + * installer_name + * version_name + * project-json : Json object of the project + +.. NOTE:: + project_json schema - '{ "scores": [], "trust_indcators": [], + "customs": [], "project": ""}' + + See project for project_schema + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient(user='test', password='pass') + project_client.create(scenario_name, installer_name, version_name, project_json) + +UPDATE +"""""" + +This method used to update the all existing projects of a scenario +The user should provide the user parameter and the password +parameter while initiating the ProjectsClient. + +Input for the function : + + * scenario_name + * installer_name + * version_name + * project-json: Json object of the project + +.. NOTE:: + * scenario_name + * project_json schema - [{"scores": [], "trust_indcators": [], "customs": [], "project": ""}] + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient(user='test', password='pass') + project_client.update(scenario_name, installer_name, version_name, project_update_json) + +DELETE +"""""" + +This method used to delete existing projects from a scenario. +on the server. +The user should provide the user parameter and the password +parameter while initiating the ProjectsClient. + +Input for the function : + * scenario_name + * installer_name + * version_name + * project_names: names of the project which user want to delete. + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient(user='test', password='pass') + project_client.delete(scenario_name, installer_name, version_name, project_names) + +Scenario Custom +^^^^^^^^^^^^^^^ + +CREATE +"""""" + +This method used to create a custom under a scenario +on the server. The user should provide the user parameter +and the password parameter while initiating the CustomsClient. + +Input for the function : + + * scenario_name + * installer_name + * version_name + * project_name + * custom : List of Customs + +.. NOTE:: + * scenario_name + * custom schema - ["List of Strings"] + + See custom for custom_schema + +.. code-block:: shell + + from testapiclient.client import customs + + custom_client = customs.CustomsClient(user='test', password='pass') + custom_client.create(scenario_name, installer_name, version_name, + project_name, custom_json) + +UPDATE +"""""" + +This method used to update the all existing customs of a scenario +The user should provide the user parameter and the password +parameter while initiating the CustomsClient. + +Input for the function : + + * scenario_name + * installer_name + * version_name + * project_name + * custom : List of Customs + +.. NOTE:: + * scenario_name + * custom schema - ["List of Strings"] + +.. code-block:: shell + + from testapiclient.client import customs + + custom_client = customs.CustomsClient(user='test', password='pass') + custom_client.update(scenario_name, installer_name, version_name, + project_name custom) + +DELETE +"""""" + +This method used to delete existing customs from a scenario. +on the server. +The user should provide the user parameter and the password +parameter while initiating the CustomsClient. + +Input for the function : + * scenario_name + * installer_name + * version_name + * project_name + * custom: custom which user want to delete. + +.. code-block:: shell + + from testapiclient.client import customs + + custom_client = customs.CustomsClient(user='test', password='pass') + custom_client.delete(scenario_name, installer_name, version_name, + project_name, customs) + +Scenario Scores +^^^^^^^^^^^^^^^ + +CREATE +"""""" + +This method used to create a score under a scenario +on the server. The user should provide the user parameter +and the password parameter while initiating the ScoresClient. + +Input for the function : + + * scenario_name + * installer_name + * version_name + * project_name + * score_json : Schema for the score + +.. NOTE:: + * scenario_name + * score_json schema - '{ "date": "", "score": ""}' + + See score for score_schema + +.. code-block:: shell + + from testapiclient.client import scores + + score_client = scores.ScoresClient(user='test', password='pass') + score_client.create(scenario_name, installer_name, version_name, + project_name, score_json) + +Scenario TrustIndicator +^^^^^^^^^^^^^^^^^^^^^^^ + +CREATE +"""""" + +This method used to create a trust indicator under a scenario +on the server. The user should provide the user parameter +and the password parameter while initiating the TrustIndicatorsClient. + +Input for the function : + + * scenario_name + * installer_name + * version_name + * project_name + * trust_indicator_json : Schema for the trust_indicator + +.. NOTE:: + * scenario_name + * trust_indicator_json schema - '{ "date": "", "status": ""}' + + See trust_indicator for trust_indicator_schema + +.. code-block:: shell + + from testapiclient.client import trust_indicators + + trust_indicator_client = trust_indicators.TrustIndicatorsClient(user='test', password='pass') + trust_indicator_client.create(scenario_name, installer_name, version_name, + project_name, trust_indicator_json)
\ No newline at end of file diff --git a/testapi/docs/developer/devguide/testapi-client.rst b/testapi/docs/developer/devguide/testapi-client.rst index ab4c8e8..5ba5df3 100644 --- a/testapi/docs/developer/devguide/testapi-client.rst +++ b/testapi/docs/developer/devguide/testapi-client.rst @@ -6,5 +6,859 @@ 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": ""}' + +Delete +"""""" + +Authentication is required + +.. code-block:: shell + + testapi project delete [-u] [username] [-p] [password] [project-name] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) project delete [project-name] + +.. NOTE:: + project-name is mandatory. + +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. + + +Scenario +^^^^^^^^ + +Create +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario create [-u] [username] [-p] [password] [scenario-schema] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario create [scenario-schema] + +.. NOTE:: + scenario-schema - '{"name": "", "installers": []}' + + +Get +""" + +Authentication is not required + +.. code-block:: shell + + testapi scenario get [-name] [key-word] + +.. NOTE:: + + user can use some attributes to reduce the search results. These are not + mandatory. + + * -name : Backend will use regular expression to search. + * -project : Search using project name + * -installer : Search using installer name + * -version : Search using version name + +Get one +""""""" + +Authentication is not required + +.. code-block:: shell + + testapi scenario getone [name-keyword] + +.. NOTE:: + name-keyword is mandatory. + +Update +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario put [-u] [username] [-p] [password] [scenario-name] + [scenario-schema] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario put [scenario-name] [scenario-schema] + +.. NOTE:: + scenario-schema - '{"name": "", "installers": []}' + +Delete +"""""" + +Authentication is required + +.. code-block:: shell + + testapi scenario delete [-u] [username] [-p] [password] [scenario-name] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario delete [scenario-name] + +.. NOTE:: + scenario-name is mandatory. + +Scenario installer +^^^^^^^^^^^^^^^^^^ + +Create +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario installer create [-u] [username] [-p] [password] + --scenario-name [scenario-name] [installer-schema] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario installer create --scenario-name [scenario-name] + [installer-schema] + +.. NOTE:: + installer-schema - '{"installer": "", "versions": []}' + +Update +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario installer put [-u] [username] [-p] [password] + --scenario-name [scenario-name] [installer-schema] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario put --scenario-name [scenario-name] [installer-schema] + +.. NOTE:: + scenario-schema - '{"installer": "", "installers": []}' + +Delete +"""""" + +Authentication is required + +.. code-block:: shell + + testapi scenario delete [-u] [username] [-p] [password] --scenario-name + [scenario-name] [name] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario delete --scenario-name [scenario-name] [name] + +Scenario version +^^^^^^^^^^^^^^^^ + +Create +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario version create [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] [version-schema] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario installer create --scenario-name [scenario-name] + --installer [installer] [version-schema] + +.. NOTE:: + installer-schema - '{"version": "", "owner": "", "projects": []}' + +Update +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario installer put [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] [version-schema] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario installer put --scenario-name [scenario-name] + --installer [installer] [installer-schema] + +.. NOTE:: + scenario-schema - '{"version": "","owner": "", "projects": []}' + +Delete +"""""" + +Authentication is required + +.. code-block:: shell + + testapi scenario installer delete [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] [name] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario installer delete --scenario-name [scenario-name] + --installer [installer] [name] + +Scenario Project +^^^^^^^^^^^^^^^^ + +Create +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario project create [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] + ---version [version] [project-schema] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario project create --scenario-name [scenario-name] + --installer [installer] ---version [version] [project-schema] + +.. NOTE:: + installer-schema - '{"scores": [],"customs": [], "trust_indicators": [], + project:""}' + +Update +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario project put [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] ---version + [version] [project-schema] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario project put --scenario-name [scenario-name] --installer + [installer] ---version [version] [project-schema] + +.. NOTE:: + scenario-schema - '{"scores": [],"customs": [], "trust_indicators": [], + project:""}' + +Delete +"""""" + +Authentication is required + +.. code-block:: shell + + testapi scenario project delete [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] ---version + [version] [name] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario project delete --scenario-name [scenario-name] + --installer [installer] ---version [version] [name] + +Scenario Customs +^^^^^^^^^^^^^^^^ + +Create +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario custom create [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] + ---version [version] --project [project] [customs] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario custom create --scenario-name [scenario-name] + --installer [installer] ---version [version] --project [project] [customs] + +.. NOTE:: + + customs : Space sperated strings + +Update +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario custom put [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] ---version + [version] --project [project] [customs] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario custom put --scenario-name [scenario-name] --installer + [installer] ---version [version] --project [project] [customs] + +.. NOTE:: + + customs : Space sperated strings + +Delete +"""""" + +Authentication is required + +.. code-block:: shell + + testapi scenario custom delete [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] ---version + [version] --project [project] [customs] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario custom delete --scenario-name [scenario-name] + --installer [installer] ---version [version] --project [project] + [customs] + +.. NOTE:: + + customs : Space sperated strings + +Scenario Score +^^^^^^^^^^^^^^ + +Create +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario score create [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] + ---version [version] --project [project] [score_schema] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario score create --scenario-name [scenario-name] + --installer [installer] ---version [version] --project [project] + [score_schema] + +.. NOTE:: + + score_schema : '{"score": "", "date": ""}' + +Scenario TrustIndicators +^^^^^^^^^^^^^^^^^^^^^^^^ + +Create +"""""" + +Authentication required + +.. code-block:: shell + + testapi scenario trustindicator create [-u] [username] [-p] [password] + --scenario-name [scenario-name] --installer [installer] + ---version [version] --project [project] [trustindicator_schema] + +or + +.. code-block:: shell + + $ testapi [-u] [username] [-p] [password] + (testapi) scenario trustindicator create --scenario-name [scenario-name] + --installer [installer] ---version [version] --project [project] + [trustindicator_schema] + +.. NOTE:: + + trustindicator_schema : '{"status": "", "date": ""}'
\ No newline at end of file diff --git a/testapi/docs/internship/webportal.rst b/testapi/docs/internship/webportal.rst new file mode 100644 index 0000000..1ea9c19 --- /dev/null +++ b/testapi/docs/internship/webportal.rst @@ -0,0 +1,169 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + + +***************************** +Web Portal for OPNFV Test API +***************************** + +Author: Tharmarajasingam Thuvarakan Mentors: S. Feng, J.Lausuch, M.Richomme + +Abstract +======== + +TestAPI is used by all the test projects to report results. It is also used to declare projects, +test cases and labs. It is defined in the Functest developer guide. The internship aims to add web +portal for TestAPI. The showcase user got through the web portal, will be more human-friendly +compared to the swagger page. Also, internship aims to build a python client to reduce the workload. +Python client can be used as a python module. + +Overview +======== + +The internship time period was from Oct 9th to May 18th. The project proposal page is here [1]_. +The intern project was assigned to Thuvarakan and was mentored by S. Feng, J.Lausuch, M.Richomme. +The link to the patches submitted is [2]_. The internship was successfully completed and the +documentation is as follows. + + + +Problem Statement +================= + +The following were to be accomplished within the internship time frame. + +* Redesign the website theme + + Change the existing theme of the frontend and design a unified theme. + +* Add separate pages to each resource + + Create a separate web page for each resource in the new theme. + +* Implement all the functionalities in the frontend + + Implement the backend functionalities in the frontend for each + resource. + +* Authentication for testapiclient + + Implement the authentication functionality in the testapiclient. + +* Add all functionalities to testapiclient + + Implement the backend functionalities in the testapiclient for each + resource. + +* Add support to testapiclient as a python module + + Convert the testapiclient from CLI only to CLI and python module + mode. + + +Curation Phase +============== + +The curation phase was the first 4 to 8 weeks of the internship. This phase +was to get familiar with the testapi code and functionality and propose the +solutions/tools for the tasks mentioned above. + +These are the tools, we proposed for the solutions. + +* protractor: An end-to-end test framework for Angular and AngularJS applications + +* grunt: A Javascript task runner, a tool used to automatically perform + frequent tasks such as minification, compilation, unit testing, and + linting. + +* cliff: Command Line Interface Formulation Framework. + + +Schedule +======== + +=================== ======================================================== + Date Comment +=================== ======================================================== +10th Oct ~17th Oct Setting up the development environment, design decisions +17th Oct ~ 24th Oct Pod web portal CRUD +24th Oct ~ 31st Oct Projects web portal CRUD +13st Oct ~ 7th Nov Test cases web portal CRUD +7th Nov ~ 14th Nov Results web portal R +14th Nov ~ 21st Nov Results web portal R +21st Nov ~ 28th Nov Scenario web portal CRUD +28th Nov ~ 5th Dec Testapi-client framework +5th Dec ~ 12nd Dec Pods testapi-client CRUD +12nd Dec ~ 19th Dec Projects testapi-client CRUD +19th Dec ~ 26th Dec Test cases testapi-client CRUD +26th Dec ~ 9th Jan Results testapi-client CRUD +9th Jan ~ 23rd Jan Scenario testapi-client CRUD +23rd Jan ~ 6th Mar Bugfix in the frontend and testapiclient +6th Mar ~ 20th Mar Convert testapiclient to python module +20th Mar ~ 3rd Apr Testing the python module +3rd Apr ~ 9th May Documentation & Bugfix +=================== ======================================================== + + +FAQ +=== + + +Frontend +******** + +1. How to add a new test file for the frontend? + + * Frontend test is handled by protractor [3]_ and + automated by the grunt [4]_. All the tests are located in + "opnfv_testapi/tests/UI/e2e". + First, create a text file in the e2e folder. Then add it to the spec + list in the "opnfv_testapi/ui/Gruntfile.js". + + +2. How to test application's functionalities interactively? + + * Application requires authentication for many functionalities. + It will cause time for the developer to check the functionalities. + Developers can use the application in the authentication false mode. + To do that, first, change the authenticate to false in the + "etc/config.ini" file then change the authenticate to false in + the "opnfv_testapi/ui/config.json" file. + + +3. Browser does not reflect the code changes, what is it mean? + + * Browser is saving the caches for fast reloadings. Sometime browser + won't reload the new changes, to solve that we have to clear the browser + caches. + + +Testapiclient +************* + +1. How to add a new test file for testapiclient? + + * Frontend test is handled by testtools [5]_ and automated by tox [6]_. + All the tests are located in "testapi-client/tests/unit". Create a text + file in the unit folder. The name of the test file should start with + 'test\_'. It will automatically add that test file to queue. + + +2. Difference between client and cli? + + * Client is used to importing testapiclient as a python module. + The cli folder contained the command line interface for the testapiclient. + +References +========== + +.. [1] https://wiki.opnfv.org/display/DEV/Intern+Project%3A+Web+Portal+for+OPNFV+Test+API + +.. [2] https://gerrit.opnfv.org/gerrit/#/q/status:merged+owner:%22Thuvarakan+Tharmarajasingam+%253Ctharma.thuva%2540gmail.com%253E%22 + +.. [3] https://www.protractortest.org/ + +.. [4] https://gruntjs.com + +.. [5] https://github.com/testing-cabal/testtools + +.. [6] https://tox.readthedocs.io/en/latest/#
\ No newline at end of file |