--- /dev/null
+*** Settings ***
+Documentation This resource file defines keywords that are used in more
+... than one lispflowmapping test suite. Those suites include
+... ../variables/Variables.py, which is where some of the
+... variables are coming from.
+
+*** Variables ***
+${ODL_VERSION} Be
+
+*** Keywords ***
+Check Mapping Removal
+ [Arguments] ${json}
+ Run Keyword If "${ODL_VERSION}" == "Li" Check Mapping Removal Lithium ${json} ELSE
+ ... Post Log Check ${LFM_RPC_API}:get-mapping ${json} 404
+
+Check Mapping Removal Lithium
+ [Arguments] ${json}
+ ${resp}= Post Log Check ${LFM_RPC_API}:get-mapping ${json}
+ ${output}= Get From Dictionary ${resp.json()} output
+ ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
+ ${eid_record_0}= Get From List ${eid_record} 0
+ ${action}= Get From Dictionary ${eid_record_0} action
+ Should Be Equal As Strings ${action} NativelyForward
+
+Post Log Check
+ [Arguments] ${uri} ${body} ${status_code}=200
+ [Documentation] Post body to uri, log response content, and check status
+ ${resp}= RequestsLibrary.Post session ${uri} ${body}
+ Log ${resp.content}
+ Should Be Equal As Strings ${resp.status_code} ${status_code}
+ [Return] ${resp}
+
+Create Session And Set External Variables
+ Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
+ Run Keyword If "${ODL_VERSION}" == "Li" Set Suite Variable ${LFM_RPC_API} ${LFM_RPC_API_LI}
*** Settings ***
Documentation Test suite to verify CRUD operations using RPCs
-Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
+Suite Setup Create Session And Set External Variables
Suite Teardown Delete All Sessions
Library Collections
Library OperatingSystem
Library RequestsLibrary
Library ../../../libraries/Common.py
Variables ../../../variables/Variables.py
+Resource ../../../libraries/LISPFlowMapping.robot
Resource ../../../libraries/Utils.robot
*** Variables ***
-${RPC_URL_PREFIX} /restconf/operations/mappingservice
${IPV4_C_KEY} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-key_ipv4.json
${IPV4_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_ipv4.json
${MISS_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_missing.json
Create Key
[Documentation] Create a key for an IPv4 EID
${add_key}= OperatingSystem.Get File ${IPV4_C_KEY}
- Post Log Check ${RPC_URL_PREFIX}:add-key ${add_key}
+ Post Log Check ${LFM_RPC_API}:add-key ${add_key}
Attempt To Create Key Again
[Documentation] Try to overwrite existing IPv4 EID key
${add_key}= OperatingSystem.Get File ${IPV4_C_KEY}
- Post Log Check ${RPC_URL_PREFIX}:add-key ${add_key} 409
+ Post Log Check ${LFM_RPC_API}:add-key ${add_key} 409
Attempt To Read Non-Existing Key
[Documentation] Try to read a non-existing key for an IPv4 EID
${get_key}= OperatingSystem.Get File ${MISS_RD}
- Post Log Check ${RPC_URL_PREFIX}:get-key ${get_key} 404
+ Post Log Check ${LFM_RPC_API}:get-key ${get_key} 404
Read Key
[Documentation] Read an existing key for an IPv4 EID
${get_key}= OperatingSystem.Get File ${IPV4_RD}
- ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-key ${get_key}
+ ${resp}= Post Log Check ${LFM_RPC_API}:get-key ${get_key}
${output}= Get From Dictionary ${resp.json()} output
${password}= Get From Dictionary ${output} authkey
Should Be Equal As Strings ${password} password
Update Key
[Documentation] Update an existing key for an IPv4 EID
${update_key}= OperatingSystem.Get File ${IPV4_U_KEY}
- Post Log Check ${RPC_URL_PREFIX}:update-key ${update_key}
+ Post Log Check ${LFM_RPC_API}:update-key ${update_key}
Read Updated Key
[Documentation] Read the key updated in the previous test
${get_key}= OperatingSystem.Get File ${IPV4_RD}
- ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-key ${get_key}
+ ${resp}= Post Log Check ${LFM_RPC_API}:get-key ${get_key}
${output}= Get From Dictionary ${resp.json()} output
${password}= Get From Dictionary ${output} authkey
Should Be Equal As Strings ${password} updated-password
Delete Key
[Documentation] Delete an existing key for an IPv4 EID
${remove_key}= OperatingSystem.Get File ${IPV4_RD}
- Post Log Check ${RPC_URL_PREFIX}:remove-key ${remove_key}
+ Post Log Check ${LFM_RPC_API}:remove-key ${remove_key}
Attempt To Read Deleted Key
[Documentation] Try to read the key deleted in the previous test
${get_key}= OperatingSystem.Get File ${IPV4_RD}
- Post Log Check ${RPC_URL_PREFIX}:get-key ${get_key} 404
+ Post Log Check ${LFM_RPC_API}:get-key ${get_key} 404
Attempt To Update Non-Existing Key
[Documentation] Update a non-existing key for an IPv4 EID
${update_key}= OperatingSystem.Get File ${IPV4_U_KEY}
- Post Log Check ${RPC_URL_PREFIX}:update-key ${update_key} 404
+ Post Log Check ${LFM_RPC_API}:update-key ${update_key} 404
Create Mapping
[Documentation] Create a mapping for an IPv4 EID
${add_mapping}= OperatingSystem.Get File ${IPV4_C_MAP}
- Post Log Check ${RPC_URL_PREFIX}:add-mapping ${add_mapping}
+ Post Log Check ${LFM_RPC_API}:add-mapping ${add_mapping}
Attempt To Read Non-Existing Mapping
[Documentation] Try to read a non-existing mapping for an IPv4 EID
${get_mapping}= OperatingSystem.Get File ${MISS_RD}
- ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-mapping ${get_mapping}
- ${output}= Get From Dictionary ${resp.json()} output
- ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
- ${eid_record_0}= Get From List ${eid_record} 0
- ${action}= Get From Dictionary ${eid_record_0} action
- Should Be Equal As Strings ${action} NativelyForward
+ Check Mapping Removal ${get_mapping}
Read Mapping
[Documentation] Read an existing mapping for an IPv4 EID
${get_mapping}= OperatingSystem.Get File ${IPV4_RD}
- ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-mapping ${get_mapping}
+ ${resp}= Post Log Check ${LFM_RPC_API}:get-mapping ${get_mapping}
${output}= Get From Dictionary ${resp.json()} output
${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
${eid_record_0}= Get From List ${eid_record} 0
Update Mapping
[Documentation] Update an existing mapping for an IPv4 EID
${update_mapping}= OperatingSystem.Get File ${IPV4_U_MAP}
- Post Log Check ${RPC_URL_PREFIX}:update-mapping ${update_mapping}
+ Post Log Check ${LFM_RPC_API}:update-mapping ${update_mapping}
Read Updated Mapping
[Documentation] Read the mapping updated in the previous test
${get_mapping}= OperatingSystem.Get File ${IPV4_RD}
- ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-mapping ${get_mapping}
+ ${resp}= Post Log Check ${LFM_RPC_API}:get-mapping ${get_mapping}
${output}= Get From Dictionary ${resp.json()} output
${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
${eid_record_0}= Get From List ${eid_record} 0
Delete Mapping
[Documentation] Delete an existing mapping for an IPv4 EID
${remove_mapping}= OperatingSystem.Get File ${IPV4_RD}
- Post Log Check ${RPC_URL_PREFIX}:remove-mapping ${remove_mapping}
+ Post Log Check ${LFM_RPC_API}:remove-mapping ${remove_mapping}
Attempt To Read Deleted Mapping
[Documentation] Try to read the mapping deleted in the previous test
Sleep 200ms Avoid race conditions
${get_mapping}= OperatingSystem.Get File ${IPV4_RD}
- ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-mapping ${get_mapping}
- ${output}= Get From Dictionary ${resp.json()} output
- ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
- ${eid_record_0}= Get From List ${eid_record} 0
- ${action}= Get From Dictionary ${eid_record_0} action
- Should Be Equal As Strings ${action} NativelyForward
-
-*** Keywords ***
-Post Log Check
- [Arguments] ${uri} ${body} ${status_code}=200
- [Documentation] Post body to uri, log response content, and check status
- ${resp}= RequestsLibrary.Post session ${uri} ${body}
- Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} ${status_code}
- [Return] ${resp}
+ Check Mapping Removal ${get_mapping}
*** Settings ***
Documentation Test suite to verify data types using RPCs
-Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
+Suite Setup Create Session And Set External Variables
Suite Teardown Delete All Sessions
-Test Setup Set Suite Variable ${CURJSON} ${EMPTY}
+Test Setup Set Suite Variable ${RPC_Datatype__current_json} ${EMPTY}
Test Template Check Datatype
Test Teardown Remove Datatype And Check Removal
Library Collections
Library RequestsLibrary
Library ../../../libraries/Common.py
Variables ../../../variables/Variables.py
+Resource ../../../libraries/LISPFlowMapping.robot
Resource ../../../libraries/Utils.robot
*** Variables ***
-${RPC_URL_PREFIX} /restconf/operations/mappingservice
${IPV4_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_ipv4_ipv4.json
${IPV4_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_ipv4.json
${IPV6_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_ipv6_ipv4.json
[Documentation] Perform CRD operations using a specific datatype
${add_mapping}= OperatingSystem.Get File ${add_mapping_json_file}
${get_mapping}= OperatingSystem.Get File ${get_mapping_json_file}
- Set Suite Variable ${CURJSON} ${get_mapping}
- Post Log Check ${RPC_URL_PREFIX}:add-mapping ${add_mapping}
+ Set Suite Variable ${RPC_Datatype__current_json} ${get_mapping}
+ Post Log Check ${LFM_RPC_API}:add-mapping ${add_mapping}
Sleep 200ms Avoid race conditions
- ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-mapping ${get_mapping}
+ ${resp}= Post Log Check ${LFM_RPC_API}:get-mapping ${get_mapping}
${output}= Get From Dictionary ${resp.json()} output
${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
${eid_record_0}= Get From List ${eid_record} 0
Dictionary Should Contain Key ${eid_record_0} LocatorRecord
Remove Datatype And Check Removal
- Variable Should Exist ${CURJSON}
- Post Log Check ${RPC_URL_PREFIX}:remove-mapping ${CURJSON}
+ Variable Should Exist ${RPC_Datatype__current_json}
+ Post Log Check ${LFM_RPC_API}:remove-mapping ${RPC_Datatype__current_json}
Sleep 200ms Avoid race conditions
- ${resp}= Post Log Check ${RPC_URL_PREFIX}:get-mapping ${CURJSON}
- ${output}= Get From Dictionary ${resp.json()} output
- ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
- ${eid_record_0}= Get From List ${eid_record} 0
- Dictionary Should Not Contain Key ${eid_record_0} LocatorRecord
- Set Suite Variable ${CURJSON} ${EMPTY}
-
-Post Log Check
- [Arguments] ${uri} ${body} ${status_code}=200
- [Documentation] Post body to uri, log response content, and check status
- ${resp}= RequestsLibrary.Post session ${uri} ${body}
- Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} ${status_code}
- [Return] ${resp}
+ Check Mapping Removal ${RPC_Datatype__current_json}
+ Set Suite Variable ${RPC_Datatype__current_json} ${EMPTY}