Migrate LISP tests to new Beryllium API
[integration/test.git] / csit / suites / lispflowmapping / basic / 020_RPC_CRUD.robot
1 *** Settings ***
2 Documentation     Test suite to verify CRUD operations using RPCs
3 Suite Setup       Create Session And Set External Variables
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           OperatingSystem
7 Library           RequestsLibrary
8 Library           ../../../libraries/Common.py
9 Variables         ../../../variables/Variables.py
10 Resource          ../../../libraries/LISPFlowMapping.robot
11 Resource          ../../../libraries/Utils.robot
12
13 *** Variables ***
14 ${IPV4_C_KEY}     ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-key_ipv4.json
15 ${IPV4_RD}        ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_ipv4.json
16 ${MISS_RD}        ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_missing.json
17 ${IPV4_U_KEY}     ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_update-key_ipv4.json
18 ${IPV4_C_MAP}     ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_ipv4_ipv4.json
19 ${IPV4_U_MAP}     ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_update-mapping_ipv4_ipv4.json
20
21 *** Test Cases ***
22 Create Key
23     [Documentation]    Create a key for an IPv4 EID
24     ${add_key}=    OperatingSystem.Get File    ${IPV4_C_KEY}
25     Post Log Check    ${LFM_RPC_API}:add-key    ${add_key}
26
27 Attempt To Create Key Again
28     [Documentation]    Try to overwrite existing IPv4 EID key
29     ${add_key}=    OperatingSystem.Get File    ${IPV4_C_KEY}
30     Post Log Check    ${LFM_RPC_API}:add-key    ${add_key}    409
31
32 Attempt To Read Non-Existing Key
33     [Documentation]    Try to read a non-existing key for an IPv4 EID
34     ${get_key}=    OperatingSystem.Get File    ${MISS_RD}
35     Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}    404
36
37 Read Key
38     [Documentation]    Read an existing key for an IPv4 EID
39     ${get_key}=    OperatingSystem.Get File    ${IPV4_RD}
40     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}
41     Authentication Key Should Be    ${resp}    password
42
43 Update Key
44     [Documentation]    Update an existing key for an IPv4 EID
45     ${update_key}=    OperatingSystem.Get File    ${IPV4_U_KEY}
46     Post Log Check    ${LFM_RPC_API}:update-key    ${update_key}
47
48 Read Updated Key
49     [Documentation]    Read the key updated in the previous test
50     ${get_key}=    OperatingSystem.Get File    ${IPV4_RD}
51     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}
52     Authentication Key Should Be    ${resp}    updated-password
53
54 Delete Key
55     [Documentation]    Delete an existing key for an IPv4 EID
56     ${remove_key}=    OperatingSystem.Get File    ${IPV4_RD}
57     Post Log Check    ${LFM_RPC_API}:remove-key    ${remove_key}
58
59 Attempt To Read Deleted Key
60     [Documentation]    Try to read the key deleted in the previous test
61     ${get_key}=    OperatingSystem.Get File    ${IPV4_RD}
62     Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}    404
63
64 Attempt To Update Non-Existing Key
65     [Documentation]    Update a non-existing key for an IPv4 EID
66     ${update_key}=    OperatingSystem.Get File    ${IPV4_U_KEY}
67     Post Log Check    ${LFM_RPC_API}:update-key    ${update_key}    404
68
69 Create Mapping
70     [Documentation]    Create a mapping for an IPv4 EID
71     ${add_mapping}=    OperatingSystem.Get File    ${IPV4_C_MAP}
72     Post Log Check    ${LFM_RPC_API}:add-mapping    ${add_mapping}
73
74 Attempt To Read Non-Existing Mapping
75     [Documentation]    Try to read a non-existing mapping for an IPv4 EID
76     ${get_mapping}=    OperatingSystem.Get File    ${MISS_RD}
77     Check Mapping Removal    ${get_mapping}
78
79 Read Mapping
80     [Documentation]    Read an existing mapping for an IPv4 EID
81     ${get_mapping}=    OperatingSystem.Get File    ${IPV4_RD}
82     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-mapping    ${get_mapping}
83     Ipv4 Rloc Should Be    ${resp}    10.10.10.10
84
85 Update Mapping
86     [Documentation]    Update an existing mapping for an IPv4 EID
87     ${update_mapping}=    OperatingSystem.Get File    ${IPV4_U_MAP}
88     Post Log Check    ${LFM_RPC_API}:update-mapping    ${update_mapping}
89
90 Read Updated Mapping
91     [Documentation]    Read the mapping updated in the previous test
92     ${get_mapping}=    OperatingSystem.Get File    ${IPV4_RD}
93     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-mapping    ${get_mapping}
94     Ipv4 Rloc Should Be    ${resp}    20.20.20.20
95
96 Delete Mapping
97     [Documentation]    Delete an existing mapping for an IPv4 EID
98     ${remove_mapping}=    OperatingSystem.Get File    ${IPV4_RD}
99     Post Log Check    ${LFM_RPC_API}:remove-mapping    ${remove_mapping}
100
101 Attempt To Read Deleted Mapping
102     [Documentation]    Try to read the mapping deleted in the previous test
103     Sleep    200ms    Avoid race conditions
104     ${get_mapping}=    OperatingSystem.Get File    ${IPV4_RD}
105     Check Mapping Removal    ${get_mapping}