daa09b2552da554daa957571b503de2848ee8427
[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/TemplatedRequests.robot
13 Resource          ../../../libraries/Utils.robot
14
15 *** Test Cases ***
16 Create Key
17     [Documentation]    Create a key for an IPv4 EID
18     ${eid_json}=    Get LispAddress JSON    ipv4:192.0.2.1/32
19     ${authkey_json}=    Get MappingAuthkey JSON
20     ${add_key}=    Merge And Wrap input    ${eid_json}    ${authkey_json}
21     Post Log Check    ${LFM_RPC_API}:add-key    ${add_key}    status_codes=${ALLOWED_STATUS_CODES}
22
23 Attempt To Read Non-Existing Key
24     [Documentation]    Try to read a non-existing key for an IPv4 EID
25     ${get_key}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.255/32
26     Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}    status_codes=${DELETED_STATUS_CODES}
27
28 Read Key
29     [Documentation]    Read an existing key for an IPv4 EID
30     ${get_key}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
31     Wait Until Keyword Succeeds    5s    200ms    Post Log Check Authkey    ${get_key}    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}    status_codes=${ALLOWED_STATUS_CODESS}
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     Wait Until Keyword Succeeds    5s    200ms    Post Log Check Authkey    ${get_key}    updated-password
44
45 Delete Key
46     [Documentation]    Delete an existing key for an IPv4 EID
47     ${remove_key}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
48     Post Log Check    ${LFM_RPC_API}:remove-key    ${remove_key}    status_codes=${ALLOWED_STATUS_CODES}
49
50 Attempt To Read Deleted Key
51     [Documentation]    Try to read the key deleted in the previous test
52     ${get_key}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
53     Wait Until Keyword Succeeds    5s    200ms    Check Key Removal    ${get_key}
54
55 Attempt To Update Non-Existing Key
56     [Documentation]    Update a non-existing key for an IPv4 EID
57     ${eid_json}=    Get LispAddress JSON    ipv4:192.0.2.1/32
58     ${authkey_json}=    Get MappingAuthkey JSON    key_string=updated-password
59     ${update_key}=    Merge And Wrap input    ${eid_json}    ${authkey_json}
60     Post Log Check    ${LFM_RPC_API}:update-key    ${update_key}    status_codes=${DELETED_STATUS_CODES}
61
62 Create Mapping
63     [Documentation]    Create a mapping for an IPv4 EID
64     ${add_mapping}=    Get Mapping JSON    ipv4:192.0.2.1/32    ipv4:10.10.10.10
65     Post Log Check    ${LFM_RPC_API}:add-mapping    ${add_mapping}    status_codes=${ALLOWED_STATUS_CODES}
66
67 Attempt To Read Non-Existing Mapping
68     [Documentation]    Try to read a non-existing mapping for an IPv4 EID
69     ${get_mapping}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.255/32
70     Check Mapping Removal    ${get_mapping}
71
72 Read Mapping
73     [Documentation]    Read an existing mapping for an IPv4 EID
74     ${get_mapping}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
75     Wait Until Keyword Succeeds    5s    200ms    Post Log Check Ipv4 Rloc    ${get_mapping}    10.10.10.10
76
77 Update Mapping
78     [Documentation]    Update an existing mapping for an IPv4 EID
79     ${update_mapping}=    Get Mapping JSON    ipv4:192.0.2.1/32    ipv4:20.20.20.20
80     Post Log Check    ${LFM_RPC_API}:update-mapping    ${update_mapping}    status_codes=${ALLOWED_STATUS_CODES}
81
82 Read Updated Mapping
83     [Documentation]    Read the mapping updated in the previous test
84     ${get_mapping}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
85     Wait Until Keyword Succeeds    5s    200ms    Post Log Check Ipv4 Rloc    ${get_mapping}    20.20.20.20
86
87 Delete Mapping
88     [Documentation]    Delete an existing mapping for an IPv4 EID
89     ${remove_mapping}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
90     Post Log Check    ${LFM_RPC_API}:remove-mapping    ${remove_mapping}    status_codes=${ALLOWED_STATUS_CODES}
91
92 Attempt To Read Deleted Mapping
93     [Documentation]    Try to read the mapping deleted in the previous test
94     ${get_mapping}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.1/32
95     Wait Until Keyword Succeeds    5s    200ms    Check Mapping Removal    ${get_mapping}