2 Documentation Test suite to verify CRUD operations using RPCs
3 Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
6 Library OperatingSystem
7 Library RequestsLibrary
8 Library ../../../libraries/Common.py
9 Variables ../../../variables/Variables.py
10 Resource ../../../libraries/Utils.txt
13 ${RPC_URL_PREFIX} /restconf/operations/lfm-mapping-database
14 ${IPV4_C_KEY} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-key_ipv4.json
15 ${IPV4_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_ipv4.json
16 ${MISS_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_missing.json
17 ${IPV4_U_KEY} ${CURDIR}/../../../variables/lispflowmapping/rpc_update-key_ipv4.json
18 ${IPV4_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_ipv4_ipv4.json
19 ${IPV4_U_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_update-mapping_ipv4_ipv4.json
23 [Documentation] Create a key for an IPv4 EID
24 ${add_key}= OperatingSystem.Get File ${IPV4_C_KEY}
25 Post Log Check ${RPC_URL_PREFIX}:add-key ${add_key}
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 ${RPC_URL_PREFIX}:add-key ${add_key} 409
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 ${RPC_URL_PREFIX}:get-key ${get_key} 404
38 [Documentation] Read an existing key for an IPv4 EID
39 ${get_key}= OperatingSystem.Get File ${IPV4_RD}
40 ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-key ${get_key}
41 ${output}= Get From Dictionary ${resp.json()} output
42 ${password}= Get From Dictionary ${output} authkey
43 Should Be Equal As Strings ${password} password
46 [Documentation] Update an existing key for an IPv4 EID
47 ${update_key}= OperatingSystem.Get File ${IPV4_U_KEY}
48 Post Log Check ${RPC_URL_PREFIX}:update-key ${update_key}
51 [Documentation] Read the key updated in the previous test
52 ${get_key}= OperatingSystem.Get File ${IPV4_RD}
53 ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-key ${get_key}
54 ${output}= Get From Dictionary ${resp.json()} output
55 ${password}= Get From Dictionary ${output} authkey
56 Should Be Equal As Strings ${password} updated-password
59 [Documentation] Delete an existing key for an IPv4 EID
60 ${remove_key}= OperatingSystem.Get File ${IPV4_RD}
61 Post Log Check ${RPC_URL_PREFIX}:remove-key ${remove_key}
63 Attempt To Read Deleted Key
64 [Documentation] Try to read the key deleted in the previous test
65 ${get_key}= OperatingSystem.Get File ${IPV4_RD}
66 Post Log Check ${RPC_URL_PREFIX}:get-key ${get_key} 404
68 Attempt To Update Non-Existing Key
69 [Documentation] Update a non-existing key for an IPv4 EID
70 ${update_key}= OperatingSystem.Get File ${IPV4_U_KEY}
71 Post Log Check ${RPC_URL_PREFIX}:update-key ${update_key} 404
74 [Documentation] Create a mapping for an IPv4 EID
75 ${add_mapping}= OperatingSystem.Get File ${IPV4_C_MAP}
76 Post Log Check ${RPC_URL_PREFIX}:add-mapping ${add_mapping}
78 Attempt To Read Non-Existing Mapping
79 [Documentation] Try to read a non-existing mapping for an IPv4 EID
80 ${get_mapping}= OperatingSystem.Get File ${MISS_RD}
81 ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-mapping ${get_mapping}
82 ${output}= Get From Dictionary ${resp.json()} output
83 ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
84 ${eid_record_0}= Get From List ${eid_record} 0
85 ${action}= Get From Dictionary ${eid_record_0} action
86 Should Be Equal As Strings ${action} NativelyForward
89 [Documentation] Read an existing mapping for an IPv4 EID
90 ${get_mapping}= OperatingSystem.Get File ${IPV4_RD}
91 ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-mapping ${get_mapping}
92 ${output}= Get From Dictionary ${resp.json()} output
93 ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
94 ${eid_record_0}= Get From List ${eid_record} 0
95 ${loc_record}= Get From Dictionary ${eid_record_0} LocatorRecord
96 ${loc_record_0}= Get From List ${loc_record} 0
97 ${loc}= Get From Dictionary ${loc_record_0} LispAddressContainer
98 ${address}= Get From Dictionary ${loc} Ipv4Address
99 ${ipv4}= Get From Dictionary ${address} Ipv4Address
100 Should Be Equal As Strings ${ipv4} 10.10.10.10
103 [Documentation] Update an existing mapping for an IPv4 EID
104 ${update_mapping}= OperatingSystem.Get File ${IPV4_U_MAP}
105 Post Log Check ${RPC_URL_PREFIX}:update-mapping ${update_mapping}
108 [Documentation] Read the mapping updated in the previous test
109 ${get_mapping}= OperatingSystem.Get File ${IPV4_RD}
110 ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-mapping ${get_mapping}
111 ${output}= Get From Dictionary ${resp.json()} output
112 ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
113 ${eid_record_0}= Get From List ${eid_record} 0
114 ${loc_record}= Get From Dictionary ${eid_record_0} LocatorRecord
115 ${loc_record_0}= Get From List ${loc_record} 0
116 ${loc}= Get From Dictionary ${loc_record_0} LispAddressContainer
117 ${address}= Get From Dictionary ${loc} Ipv4Address
118 ${ipv4}= Get From Dictionary ${address} Ipv4Address
119 Should Be Equal As Strings ${ipv4} 20.20.20.20
122 [Documentation] Delete an existing mapping for an IPv4 EID
123 ${remove_mapping}= OperatingSystem.Get File ${IPV4_RD}
124 Post Log Check ${RPC_URL_PREFIX}:remove-mapping ${remove_mapping}
126 Attempt To Read Deleted Mapping
127 [Documentation] Try to read the mapping deleted in the previous test
128 ${get_mapping}= OperatingSystem.Get File ${IPV4_RD}
129 ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-mapping ${get_mapping}
130 ${output}= Get From Dictionary ${resp.json()} output
131 ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
132 ${eid_record_0}= Get From List ${eid_record} 0
133 ${action}= Get From Dictionary ${eid_record_0} action
134 Should Be Equal As Strings ${action} NativelyForward
138 [Arguments] ${uri} ${body} ${status_code}=200
139 [Documentation] Post body to uri, log response content, and check status
140 ${resp}= RequestsLibrary.Post session ${uri} ${body}
142 Should Be Equal As Strings ${resp.status_code} ${status_code}