All of lore.kernel.org
 help / color / mirror / Atom feed
From: OpenBMC Patches <openbmc-patches@stwcx.xyz>
To: openbmc@lists.ozlabs.org
Cc: manjunath <manjunath@localhost.localdomain>
Subject: [PATCH openbmc-test-automation 32/60] added files
Date: Mon, 11 Jan 2016 10:49:58 -0600	[thread overview]
Message-ID: <1452531026-13715-33-git-send-email-openbmc-patches@stwcx.xyz> (raw)
In-Reply-To: <1452531026-13715-1-git-send-email-openbmc-patches@stwcx.xyz>

From: manjunath <manjunath@localhost.localdomain>

---
 .project              |  17 ++++++++
 .pydevproject         |   7 ++++
 lib/resource.txt      |  12 ++++++
 lib/rest_client.robot | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++
 requirements.txt      |   4 ++
 tests/data.json       |   1 +
 tests/test_fan.robot  |   9 +++++
 tests/test_ssh.robot  |  55 +++++++++++++++++++++++++
 tox.ini               |  32 +++++++++++++++
 9 files changed, 246 insertions(+)
 create mode 100644 .project
 create mode 100644 .pydevproject
 create mode 100644 lib/resource.txt
 create mode 100644 lib/rest_client.robot
 create mode 100644 requirements.txt
 create mode 100755 tests/data.json
 create mode 100644 tests/test_fan.robot
 create mode 100644 tests/test_ssh.robot
 create mode 100644 tox.ini

diff --git a/.project b/.project
new file mode 100644
index 0000000..9b83158
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>openbmc-automation</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.python.pydev.PyDevBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.python.pydev.pythonNature</nature>
+	</natures>
+</projectDescription>
diff --git a/.pydevproject b/.pydevproject
new file mode 100644
index 0000000..08ea93f
--- /dev/null
+++ b/.pydevproject
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><?eclipse-pydev version="1.0"?><pydev_project>
+<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
+<path>/${PROJECT_DIR_NAME}</path>
+</pydev_pathproperty>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
+</pydev_project>
\ No newline at end of file
diff --git a/lib/resource.txt b/lib/resource.txt
new file mode 100644
index 0000000..5acddcf
--- /dev/null
+++ b/lib/resource.txt
@@ -0,0 +1,12 @@
+*** Settings ***
+Library           Collections
+Library           String
+Library           RequestsLibrary.RequestsKeywords
+Library           OperatingSystem
+
+*** Variables ***
+${HOST}           192.168.122.100    # openbmc ip address
+${PORT}           3000
+${AUTH_URI}       http://${HOST}:${PORT}
+${USERNAME}       root
+${PASSWORD}       abc123
diff --git a/lib/rest_client.robot b/lib/rest_client.robot
new file mode 100644
index 0000000..1de2b77
--- /dev/null
+++ b/lib/rest_client.robot
@@ -0,0 +1,109 @@
+*** Settings ***
+Library           Collections
+Library           String
+Library           RequestsLibrary.RequestsKeywords
+Library           OperatingSystem
+
+*** Variables ***
+${HOST}           192.168.122.100    # openbmc ip address
+${DBUS_PREFIX}    /bus/session
+${PORT}           3000
+${AUTH_URI}       http://${HOST}:${PORT}
+${USERNAME}       root
+${PASSWORD}       abc123
+# Response codes
+${HTTP_CONTINUE}    100
+${HTTP_SWITCHING_PROTOCOLS}    101
+${HTTP_PROCESSING}    102
+${HTTP_OK}        200
+${HTTP_CREATED}    201
+${HTTP_ACCEPTED}    202
+${HTTP_NON_AUTHORITATIVE_INFORMATION}    203
+${HTTP_NO_CONTENT}    204
+${HTTP_RESET_CONTENT}    205
+${HTTP_PARTIAL_CONTENT}    206
+${HTTP_MULTI_STATUS}    207
+${HTTP_IM_USED}    226
+${HTTP_MULTIPLE_CHOICES}    300
+${HTTP_MOVED_PERMANENTLY}    301
+${HTTP_FOUND}     302
+${HTTP_SEE_OTHER}    303
+${HTTP_NOT_MODIFIED}    304
+${HTTP_USE_PROXY}    305
+${HTTP_TEMPORARY_REDIRECT}    307
+${HTTP_BAD_REQUEST}    400
+${HTTP_UNAUTHORIZED}    401
+${HTTP_PAYMENT_REQUIRED}    402
+${HTTP_FORBIDDEN}    403
+${HTTP_NOT_FOUND}    404
+${HTTP_METHOD_NOT_ALLOWED}    405
+${HTTP_NOT_ACCEPTABLE}    406
+${HTTP_PROXY_AUTHENTICATION_REQUIRED}    407
+${HTTP_REQUEST_TIMEOUT}    408
+${HTTP_CONFLICT}    409
+${HTTP_GONE}      410
+${HTTP_LENGTH_REQUIRED}    411
+${HTTP_PRECONDITION_FAILED}    412
+${HTTP_REQUEST_ENTITY_TOO_LARGE}    413
+${HTTP_REQUEST_URI_TOO_LONG}    414
+${HTTP_UNSUPPORTED_MEDIA_TYPE}    415
+${HTTP_REQUESTED_RANGE_NOT_SATISFIABLE}    416
+${HTTP_EXPECTATION_FAILED}    417
+${HTTP_UNPROCESSABLE_ENTITY}    422
+${HTTP_LOCKED}    423
+${HTTP_FAILED_DEPENDENCY}    424
+${HTTP_UPGRADE_REQUIRED}    426
+${HTTP_INTERNAL_SERVER_ERROR}    500
+${HTTP_NOT_IMPLEMENTED}    501
+${HTTP_BAD_GATEWAY}    502
+${HTTP_SERVICE_UNAVAILABLE}    503
+${HTTP_GATEWAY_TIMEOUT}    504
+${HTTP_HTTP_VERSION_NOT_SUPPORTED}    505
+${HTTP_INSUFFICIENT_STORAGE}    507
+${HTTP_NOT_EXTENDED}    510
+
+*** Keywords ***
+OpenBMC Get Request
+    [Arguments]    ${uri}    &{kwargs}
+    ${base_uri}=    Catenate    SEPARATOR=    ${DBUS_PREFIX}    ${uri}
+    Log Request    method=Get    base_uri=${base_uri}    args=&{kwargs}
+    Initialize OpenBMC
+    ${ret}=    Get Request    openbmc    ${base_uri}    &{kwargs}
+    Log Response    ${ret}
+    [Return]    ${ret}
+
+OpenBMC Post Request
+    [Arguments]    ${uri}    &{kwargs}
+    ${base_uri}=    Catenate    SEPARATOR=    ${DBUS_PREFIX}    ${uri}
+    Log Request    method=Post    base_uri=${base_uri}    args=&{kwargs}
+    Initialize OpenBMC
+    ${ret}=    Post Request    openbmc    ${base_uri}    &{kwargs}
+    Log Response    ${ret}
+    [Return]    ${ret}
+
+OpenBMC Put Request
+    [Arguments]    ${uri}    &{kwargs}
+    ${base_uri}=    Catenate    SEPARATOR=    ${DBUS_PREFIX}    ${uri}
+    Log Request    method=Put    base_uri=${base_uri}    args=&{kwargs}
+    Initialize OpenBMC
+    ${ret}=    Put Request    openbmc    ${base_uri}    &{kwargs}
+    Log Response    ${ret}
+    [Return]    ${ret}
+
+Initialize OpenBMC
+    Create Session    openbmc    ${AUTH_URI}
+
+Log Request
+    [Arguments]    &{kwargs}
+    ${msg}=    Catenate    SEPARATOR=    URI:    ${AUTH_URI}    ${kwargs["base_uri"]}    , method:
+    ...    ${kwargs["method"]}    , args:    ${kwargs["args"]}
+    Logging    ${msg}    console=True
+
+Log Response
+    [Arguments]    ${resp}
+    ${msg}=    Catenate    SEPARATOR=    Response code:    ${resp.status_code}    , Content:    ${resp.content}
+    Logging    ${msg}    console=True
+
+Logging
+    [Arguments]    ${msg}    ${console}=default False
+    Log    ${msg}    console=True
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..8434d52
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,4 @@
+robotframework
+requests
+robotframework-requests
+robotframework-sshlibrary
\ No newline at end of file
diff --git a/tests/data.json b/tests/data.json
new file mode 100755
index 0000000..7bfd886
--- /dev/null
+++ b/tests/data.json
@@ -0,0 +1 @@
+{"two": 2, "one": 1}
diff --git a/tests/test_fan.robot b/tests/test_fan.robot
new file mode 100644
index 0000000..61255e6
--- /dev/null
+++ b/tests/test_fan.robot
@@ -0,0 +1,9 @@
+*** Settings ***
+Documentation     This testsuite is for testing fan interface for openbmc
+Suite Teardown    Delete All Sessions
+Resource          ../lib/rest_client.robot
+
+*** Test Cases ***
+List all the fans
+    ${resp} =    OpenBMC Get Request    /org.openbmc.control.Fan/
+    Should Be Equal As Strings    ${resp.status_code}    ${HTTP_OK}
diff --git a/tests/test_ssh.robot b/tests/test_ssh.robot
new file mode 100644
index 0000000..0801d8a
--- /dev/null
+++ b/tests/test_ssh.robot
@@ -0,0 +1,55 @@
+*** Settings ***
+Documentation     This example demonstrates executing commands on a remote machine
+...               and getting their output and the return code.
+...
+...               Notice how connections are handled as part of the suite setup and
+...               teardown. This saves some time when executing several test cases.
+Suite Setup       Open Connection And Log In
+Suite Teardown    Close All Connections
+Library           SSHLibrary
+
+*** Variables ***
+${HOST}           192.168.122.100
+${USERNAME}       manjunath
+${PASSWORD}       passw0rd
+
+*** Test Cases ***
+Execute Command And Verify Output
+    [Documentation]    Execute Command can be used to ran commands on the remote machine.
+    ...    The keyword returns the standard output by default.
+    ${output}=    Execute Command    echo Hello SSHLibrary!
+    Should Be Equal    ${output}    Hello SSHLibrary!
+
+Execute Command And Verify Return Code
+    [Documentation]    Often getting the return code of the command is enough.
+    ...    This behaviour can be adjusted as Execute Command arguments.
+    ${rc}=    Execute Command    echo Success guaranteed.    return_stdout=False    return_rc=True
+    Should Be Equal    ${rc}    ${0}
+
+Executing Commands In An Interactive Session
+    [Documentation]    Execute Command always executes the command in a new shell.
+    ...    This means that changes to the environment are not persisted
+    ...    between subsequent Execute Command keyword calls.
+    ...    Write and Read Until variants can be used to operate in the same shell.
+    Write    cd ..
+    Write    echo Hello from the parent directory!
+    ${output}=    Read Until    directory!
+    Should End With    ${output}    Hello from the parent directory!
+
+List all the files
+    [Documentation]    List all the files in the remote machine
+    ${output}    ${stderr}    ${rc}=    Execute Command    ls    return_stderr=True    return_rc=True
+    ${msg}=    Catenate    output:${output}    stderr:${stderr}    rc:${rc}
+    Log To Console    ${msg}
+
+File Not Found
+    [Documentation]    This testcase is for testing ls command with non existing file
+    ${output}    ${stderr}    ${rc}=    Execute Command    ls file_doesnotexist.txt    return_stderr=True    return_rc=True
+    ${msg}=    Catenate    output:${output}    stderr:${stderr}    rc:${rc}
+    Should Be Equal    ${rc}    ${2}
+    Should Contain    ${stderr}    No such file or directory
+
+*** Keywords ***
+Open Connection And Log In
+    Open Connection    ${HOST}
+    Login    ${USERNAME}    ${PASSWORD}
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..fc08416
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,32 @@
+[tox]
+skipsdist = True
+
+[openbmcenv]
+sitepackages = False
+setenv = VIRTUAL_ENV={envdir}
+deps = setuptools
+       -r{toxinidir}/requirements.txt
+
+[testenv]
+install_command = pip install -U {opts} {packages}
+deps = -r{toxinidir}/requirements.txt
+commands =
+	python -m robot.run {posargs}
+
+[testenv:full]
+install_command = pip install -U {opts} {packages}
+deps = -r{toxinidir}/requirements.txt
+commands =
+	python -m robot.run .
+
+[testenv:tests]
+install_command = pip install -U {opts} {packages}
+deps = -r{toxinidir}/requirements.txt
+commands =
+	python -m robot.run tests
+
+[testenv:custom]
+install_command = pip install -U {opts} {packages}
+deps = -r{toxinidir}/requirements.txt
+commands =
+	python -m robot.run {posargs}
\ No newline at end of file
-- 
2.6.4

  parent reply	other threads:[~2016-01-11 16:51 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 16:49 [PATCH openbmc-test-automation 00/60] Pull Manjunath's automation repository OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 01/60] first commit OpenBMC Patches
2016-01-12  4:18   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 02/60] added files OpenBMC Patches
2016-01-12  4:20   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 03/60] Update README.md OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 04/60] added log statement OpenBMC Patches
2016-01-12  4:20   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 05/60] added testcase for etc passwd OpenBMC Patches
2016-01-12  4:20   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 06/60] Added git ignore file OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 07/60] Use argumnet file with pyrobot and added instructions to READEME file OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 08/60] Update README for better html display OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 09/60] Added Inventory list testcase OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 10/60] Added DIMM specific inventory tests OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 11/60] base add for sensor tests OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 12/60] fixed errors in tox and generate_argumentfile.sh script OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 13/60] fixed review comments OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 14/60] created loops for tests OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 15/60] Add initial rest test cases Support to test Null properties OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 16/60] Moved Read Attribute and Read Properties to rest_client OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 17/60] fix review comment OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 18/60] Added full sensor suite OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 19/60] Update README.md OpenBMC Patches
2016-01-12  4:21   ` Stewart Smith
2016-01-11 16:49 ` [PATCH openbmc-test-automation 20/60] Added SSL tests OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 21/60] Handle new rest client from Brad OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 22/60] Ran the tests and fixed errors in SSL tests OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 23/60] Modified the doc OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 24/60] Added firmware version validation test OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 25/60] update readme file with tox version OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 26/60] Fix errors OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 27/60] Fix Errors in test_obmcrest.robot and removed the empty testcases OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 28/60] Added one more testcase to test non-ssl connection to port 443 OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 29/60] OpenBMC REST Testing OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 30/60] updated the REST API for firmware version OpenBMC Patches
2016-01-11 16:49 ` [PATCH openbmc-test-automation 31/60] first commit OpenBMC Patches
2016-01-12  5:07   ` Stewart Smith
2016-01-11 16:49 ` OpenBMC Patches [this message]
2016-01-11 16:49 ` [PATCH openbmc-test-automation 33/60] Update README.md OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 34/60] added log statement OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 35/60] added testcase for etc passwd OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 36/60] Added git ignore file OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 37/60] Use argumnet file with pyrobot and added instructions to READEME file OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 38/60] Update README for better html display OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 39/60] Added Inventory list testcase OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 40/60] Added DIMM specific inventory tests OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 41/60] base add for sensor tests OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 42/60] fixed errors in tox and generate_argumentfile.sh script OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 43/60] fixed review comments OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 44/60] created loops for tests OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 45/60] Add initial rest test cases Support to test Null properties OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 46/60] Moved Read Attribute and Read Properties to rest_client OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 47/60] fix review comment OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 48/60] Added full sensor suite OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 49/60] Update README.md OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 50/60] Added SSL tests OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 51/60] Handle new rest client from Brad OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 52/60] Ran the tests and fixed errors in SSL tests OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 53/60] Modified the doc OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 54/60] Added firmware version validation test OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 55/60] update readme file with tox version OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 56/60] Fix errors OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 57/60] Fix Errors in test_obmcrest.robot and removed the empty testcases OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 58/60] Added one more testcase to test non-ssl connection to port 443 OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 59/60] OpenBMC REST Testing OpenBMC Patches
2016-01-11 16:50 ` [PATCH openbmc-test-automation 60/60] updated the REST API for firmware version OpenBMC Patches
2016-01-12  0:00 ` [PATCH openbmc-test-automation 00/60] Pull Manjunath's automation repository Daniel Axtens
2016-01-12  0:10 ` Cyril Bur
2016-01-12  9:35   ` Manjunath A Kumatagi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452531026-13715-33-git-send-email-openbmc-patches@stwcx.xyz \
    --to=openbmc-patches@stwcx.xyz \
    --cc=manjunath@localhost.localdomain \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.