Added keyword to get the rloc object pointed to by hop_index.
[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
7 *** Variables ***
8 ${JSON_DIR}       ${CURDIR}/../variables/lispflowmapping/Be
9
10 *** Keywords ***
11 Authentication Key Should Be
12     [Arguments]    ${resp}    ${password}
13     [Documentation]    Check if the authentication key in the ${resp} is ${password}
14     ${authkey}=    Get Authentication Key    ${resp}
15     Should Be Equal As Strings    ${authkey}    ${password}
16
17 Get Authentication Key
18     [Arguments]    ${resp}
19     ${output}=    Get From Dictionary    ${resp.json()}    output
20     ${mapping_authkey}=    Get From Dictionary    ${output}    mapping-authkey
21     ${authkey}=    Get From Dictionary    ${mapping_authkey}    key-string
22     [Return]    ${authkey}
23
24 Ipv4 Rloc Should Be
25     [Arguments]    ${resp}    ${address}
26     [Documentation]    Check if the RLOC in the ${resp} is ${address}
27     ${eid_record}=    Get Eid Record    ${resp}
28     ${loc_record}=    Get From Dictionary    ${eid_record}    LocatorRecord
29     ${loc_record_0}=    Get From List    ${loc_record}    0
30     ${ipv4}=    Get Ipv4 Rloc    ${loc_record_0}
31     Should Be Equal As Strings    ${ipv4}    ${address}
32
33 Get Eid Record
34     [Arguments]    ${resp}
35     ${output}=    Get From Dictionary    ${resp.json()}    output
36     ${eid_record}=    Get From Dictionary    ${output}    mapping-record
37     [Return]    ${eid_record}
38
39 Get Ipv4 Rloc
40     [Arguments]    ${loc_record}
41     ${loc}=    Get From Dictionary    ${loc_record}    rloc
42     ${ipv4}=    Get From Dictionary    ${loc}    ipv4
43     [Return]    ${ipv4}
44
45 Get Elp Hop
46     [Arguments]    ${loc_record}    ${hop_index}
47     [Documentation]    Returns the Rloc object pointed to by ${hop_index}
48     ${rloc}=    Get From Dictionary    ${loc_record}    rloc
49     ${exp_loc_path}=    Get From Dictionary    ${rloc}    explicit-locator-path
50     ${actual_hop_index}=    Evaluate    ${hop_index} - 1
51     ${hop}=    Get From List    ${exp_loc_path}     ${actual_hop_index}
52     [Return]    ${hop}
53
54 Check Mapping Removal
55     [Arguments]    ${json}
56     Post Log Check    ${LFM_RPC_API}:get-mapping    ${json}    404