Relax get entity timeouts
[integration/test.git] / csit / libraries / LISPFlowMapping.robot
1 *** Settings ***
2 Documentation     This resource file defines keywords that are used in more
3 ...               than one lispflowmapping test suite. Those suites include
4 ...               ../variables/Variables.py, which is where some of the
5 ...               variables are coming from.
6 Library           JsonGenerator.py
7
8 *** Variables ***
9 ${JSON_DIR}       ${CURDIR}/../variables/lispflowmapping/Be
10
11 *** Keywords ***
12 Authentication Key Should Be
13     [Arguments]    ${resp}    ${password}
14     [Documentation]    Check if the authentication key in the ${resp} is ${password}
15     ${authkey}=    Get Authentication Key    ${resp}
16     Should Be Equal As Strings    ${authkey}    ${password}
17
18 Get Authentication Key
19     [Arguments]    ${resp}
20     ${output}=    Get From Dictionary    ${resp.json()}    output
21     ${mapping_authkey}=    Get From Dictionary    ${output}    mapping-authkey
22     ${authkey}=    Get From Dictionary    ${mapping_authkey}    key-string
23     [Return]    ${authkey}
24
25 Ipv4 Rloc Should Be
26     [Arguments]    ${resp}    ${address}
27     [Documentation]    Check if the RLOC in the ${resp} is ${address}
28     ${eid_record}=    Get Eid Record    ${resp}
29     ${loc_record}=    Get From Dictionary    ${eid_record}    LocatorRecord
30     ${loc_record_0}=    Get From List    ${loc_record}    0
31     ${ipv4}=    Get Ipv4 Rloc    ${loc_record_0}
32     Should Be Equal As Strings    ${ipv4}    ${address}
33
34 Get Eid Record
35     [Arguments]    ${resp}
36     ${output}=    Get From Dictionary    ${resp.json()}    output
37     ${eid_record}=    Get From Dictionary    ${output}    mapping-record
38     [Return]    ${eid_record}
39
40 Get Ipv4 Rloc
41     [Arguments]    ${loc_record}
42     ${loc}=    Get From Dictionary    ${loc_record}    rloc
43     ${ipv4}=    Get From Dictionary    ${loc}    ipv4
44     [Return]    ${ipv4}
45
46 Get Elp Hop
47     [Arguments]    ${loc_record}    ${hop_index}
48     [Documentation]    Returns the Rloc object pointed to by ${hop_index}
49     ${rloc}=    Get From Dictionary    ${loc_record}    rloc
50     ${exp_loc_path}=    Get From Dictionary    ${rloc}    explicit-locator-path
51     ${actual_hop_index}=    Evaluate    ${hop_index} - 1
52     ${hop}=    Get From List    ${exp_loc_path}    ${actual_hop_index}
53     [Return]    ${hop}
54
55 Check Key Removal
56     [Arguments]    ${json}
57     Post Log Check    ${LFM_RPC_API}:get-key    ${json}    status_codes=${DELETED_STATUS_CODES}
58
59 Check Mapping Removal
60     [Arguments]    ${json}
61     Post Log Check    ${LFM_RPC_API}:get-mapping    ${json}    status_codes=${DELETED_STATUS_CODES}
62
63 Get Mapping JSON
64     [Arguments]    ${eid}    ${rloc}
65     [Documentation]    Returns mapping record JSON dict
66     ${loc_record}=    Get LocatorRecord Object    ${rloc}
67     ${lisp_address}=    Get LispAddress Object    ${eid}
68     ${loc_record_list}=    Create List    ${loc_record}
69     ${mapping_record_json}=    Get MappingRecord JSON    ${lisp_address}    ${loc_record_list}
70     ${mapping}=    Wrap input    ${mapping_record_json}
71     [Return]    ${mapping}
72
73 Post Log Check Authkey
74     [Arguments]    ${json}    ${password}
75     [Documentation]    Extend the 'Post Log Check' keyword to check for the correct authentication key
76     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-key    ${json}
77     Authentication Key Should Be    ${resp}    ${password}
78
79 Post Log Check Ipv4 Rloc
80     [Arguments]    ${json}    ${rloc}
81     [Documentation]    Extend the 'Post Log Check' keyword to check for the correct IPv4 RLOC
82     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-mapping    ${json}
83     Ipv4 Rloc Should Be    ${resp}    ${rloc}
84
85 Post Log Check LocatorRecord
86     [Arguments]    ${json}
87     [Documentation]    Extend the 'Post Log Check' keyword to check for the existence of a LocatorRecord
88     ${resp}=    Post Log Check    ${LFM_RPC_API}:get-mapping    ${json}
89     ${eid_record}=    Get Eid Record    ${resp}
90     Dictionary Should Contain Key    ${eid_record}    LocatorRecord