Update Robot Framework format - step 5
[integration/test.git] / csit / suites / controller / OneNode_Datastore / carpeople_library_test.robot
1 *** Settings ***
2 Documentation       Basic library verification suite, handling cars/people in 1-node setup.
3 ...
4 ...                 Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
5 ...
6 ...                 This program and the accompanying materials are made available under the
7 ...                 terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ...                 and is available at http://www.eclipse.org/legal/epl-v10.html
9 ...
10 ...                 This is a lightweight and stripped-down functional analogue of performance suite.
11 ...                 Intention is to use this as a verify suite for changes in TemplatedRequests resource.
12
13 Variables           ${CURDIR}/../../../variables/Variables.py
14 Resource            ${CURDIR}/../../../libraries/SetupUtils.robot
15 Resource            ${CURDIR}/../../../libraries/TemplatedRequests.robot
16
17 Suite Setup         Start_Suite
18 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
19 Test Teardown       SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
20
21
22 *** Variables ***
23 ${VAR_BASE}             ${CURDIR}/../../../variables/carpeople/libtest
24 ${BULK_SIZE}            2
25 ${TIMEOUT_BUG_4220}     60s
26
27
28 *** Test Cases ***
29 Wait_For_Rpcs
30     [Documentation]    Issue (invalid) RPC requests until 501 goes away (or timeout expires).
31     ...    See https://bugs.opendaylight.org/show_bug.cgi?id=4220
32     BuiltIn.Wait_Until_Keyword_Succeeds    ${TIMEOUT_BUG_4220}    5s    Check_Rpc_Readiness
33
34 Add_And_Verify_Person
35     [Documentation]    Add a person entry, verify it is seen in the datastore.
36     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/person
37     TemplatedRequests.Get_As_Json_Templated    folder=${VAR_BASE}/person    verify=True
38
39 Add_And_Verify_Car
40     [Documentation]    Add a car entry, verify it is seen in the datastore.
41     TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/car
42     TemplatedRequests.Get_As_Json_Templated    folder=${VAR_BASE}/car    verify=True
43
44 Purchase_And_Verify_Car
45     [Documentation]    Post RPC to buy a car.
46     TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/purchase
47     TemplatedRequests.Get_As_Json_Templated    folder=${VAR_BASE}/car_person    verify=True
48
49 Delete_CarPerson
50     [Documentation]    Remove the car-people entry from the datastore.
51     TemplatedRequests.Delete_Templated    folder=${VAR_BASE}/car_person
52     # TODO: Add specific error check on Get attempt.
53
54 Delete_Car
55     [Documentation]    Remove the car entry from the datastore.
56     TemplatedRequests.Delete_Templated    folder=${VAR_BASE}/car
57     # TODO: Add specific error check on Get attempt.
58
59 Delete_Person
60     [Documentation]    Remove the person entry from the datastore.
61     TemplatedRequests.Delete_Templated    folder=${VAR_BASE}/person
62     # TODO: Add specific error check on Get attempt.
63
64 Add_And_Verify_People
65     [Documentation]    Create container with several people, verify it is seen in the datastore..
66     TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/people    iterations=${BULK_SIZE}
67     TemplatedRequests.Get_As_Json_Templated    folder=${VAR_BASE}/people    verify=True    iterations=${BULK_SIZE}
68
69 Add_And_Verify_Cars
70     [Documentation]    Create container with several cars, verify it is seen in the datastore.
71     TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/cars    iterations=${BULK_SIZE}
72     TemplatedRequests.Get_As_Json_Templated    folder=${VAR_BASE}/cars    verify=True    iterations=${BULK_SIZE}
73     # TODO: Add cases with purchase loop.
74
75 Delete_CarsPeople
76     [Documentation]    Remove cars-people container from the datastore.
77     TemplatedRequests.Delete_Templated    folder=${VAR_BASE}/cars_people
78     # TODO: Add specific error check on Get attempt.
79
80 Delete_Cars
81     [Documentation]    Remove cars container from the datastore.
82     TemplatedRequests.Delete_Templated    folder=${VAR_BASE}/cars
83     # TODO: Add specific error check on Get attempt.
84
85 Delete_People
86     [Documentation]    Remove people container from the datastore.
87     TemplatedRequests.Delete_Templated    folder=${VAR_BASE}/people
88     # TODO: Add specific error check on Get attempt.
89
90
91 *** Keywords ***
92 Start_Suite
93     [Documentation]    Suite setup keyword
94     SetupUtils.Setup_Utils_For_Setup_And_Teardown
95     TemplatedRequests.Create_Default_Session
96
97 Check_Rpc_Readiness
98     [Documentation]    Issue invalid RPC requests and assert appropriate http status code
99     # So far only buy-car is checked, but other RPCs such as add-car may be added later.
100     ${status}    ${message} =    BuiltIn.Run_Keyword_And_Ignore_Error
101     ...    TemplatedRequests.Post_As_Json_To_Uri
102     ...    uri=restconf/operations/car-purchase:buy-car
103     ...    data={"input":{}}
104     # TODO: Create template directory for this?
105     BuiltIn.Should_Not_Contain    ${message}    '50