Update Bier CSIT with template
[integration/test.git] / csit / suites / lispflowmapping / msmr / 020_RPC_CRUD.robot
1 *** Settings ***
2 Documentation     Test suite to verify CRUD operations using RPCs
3 Suite Setup       Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           OperatingSystem
7 Library           RequestsLibrary
8 Library           ../../../libraries/Common.py
9 Library           ../../../libraries/JsonGenerator.py
10 Variables         ../../../variables/Variables.py
11 Resource          ../../../libraries/LISPFlowMapping.robot
12 Resource          ../../../libraries/Utils.robot
13
14 *** Test Cases ***
15 Create Key
16     [Documentation]    Create a key for an IPv4 EID
17     ${eid_json}=    Get LispAddress JSON    ipv4:192.0.2.1/32
18     ${authkey_json}=    Get MappingAuthkey JSON
19     ${add_key}=    Merge And Wrap input    ${eid_json}    ${authkey_json}
20     Post Log Check    ${LFM_RPC_API}:add-key    ${add_key}
21
22 Attempt To Read Non-Existing Key
23     [Documentation]    Try to read a non-existing key for an IPv4 EID
24     ${get_key}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.255/32
25     Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}    404
26
27 Read Key
28     [Documentation]    Read an existing key for an IPv4 EID
29     ${get_key}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
30     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}
31     Authentication Key Should Be    ${resp}    password
32
33 Update Key
34     [Documentation]    Update an existing key for an IPv4 EID
35     ${eid_json}=    Get LispAddress JSON    ipv4:192.0.2.1/32
36     ${authkey_json}=    Get MappingAuthkey JSON    key_string=updated-password
37     ${update_key}=    Merge And Wrap input    ${eid_json}    ${authkey_json}
38     Post Log Check    ${LFM_RPC_API}:update-key    ${update_key}
39
40 Read Updated Key
41     [Documentation]    Read the key updated in the previous test
42     ${get_key}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
43     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}
44     Authentication Key Should Be    ${resp}    updated-password
45
46 Delete Key
47     [Documentation]    Delete an existing key for an IPv4 EID
48     ${remove_key}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
49     Post Log Check    ${LFM_RPC_API}:remove-key    ${remove_key}
50
51 Attempt To Read Deleted Key
52     [Documentation]    Try to read the key deleted in the previous test
53     ${get_key}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
54     Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}    404
55
56 Attempt To Update Non-Existing Key
57     [Documentation]    Update a non-existing key for an IPv4 EID
58     ${eid_json}=    Get LispAddress JSON    ipv4:192.0.2.1/32
59     ${authkey_json}=    Get MappingAuthkey JSON    key_string=updated-password
60     ${update_key}=    Merge And Wrap input    ${eid_json}    ${authkey_json}
61     Post Log Check    ${LFM_RPC_API}:update-key    ${update_key}    404
62
63 Create Mapping
64     [Documentation]    Create a mapping for an IPv4 EID
65     ${add_mapping}=    Get Mapping JSON    ipv4:192.0.2.1/32    ipv4:10.10.10.10
66     Post Log Check    ${LFM_RPC_API}:add-mapping    ${add_mapping}
67
68 Attempt To Read Non-Existing Mapping
69     [Documentation]    Try to read a non-existing mapping for an IPv4 EID
70     ${get_mapping}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.255/32
71     Check Mapping Removal    ${get_mapping}
72
73 Read Mapping
74     [Documentation]    Read an existing mapping for an IPv4 EID
75     ${get_mapping}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
76     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-mapping    ${get_mapping}
77     Ipv4 Rloc Should Be    ${resp}    10.10.10.10
78
79 Update Mapping
80     [Documentation]    Update an existing mapping for an IPv4 EID
81     ${update_mapping}=    Get Mapping JSON    ipv4:192.0.2.1/32    ipv4:20.20.20.20
82     Post Log Check    ${LFM_RPC_API}:update-mapping    ${update_mapping}
83
84 Read Updated Mapping
85     [Documentation]    Read the mapping updated in the previous test
86     ${get_mapping}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
87     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-mapping    ${get_mapping}
88     Ipv4 Rloc Should Be    ${resp}    20.20.20.20
89
90 Delete Mapping
91     [Documentation]    Delete an existing mapping for an IPv4 EID
92     ${remove_mapping}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
93     Post Log Check    ${LFM_RPC_API}:remove-mapping    ${remove_mapping}
94
95 Attempt To Read Deleted Mapping
96     [Documentation]    Try to read the mapping deleted in the previous test
97     Sleep    200ms    Avoid race conditions
98     ${get_mapping}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
99     Check Mapping Removal    ${get_mapping}