From e72ead8edaee756d07eaa25dbabe40d4534520e5 Mon Sep 17 00:00:00 2001 From: Lorand Jakab Date: Mon, 8 Jun 2015 12:45:23 +0300 Subject: [PATCH 1/1] Add RPC CRUD test cases for lispflowmapping Change-Id: I2dcc1de462e03db11deb11cdd690e130ecbb9fed Signed-off-by: Lorand Jakab (cherry picked from commit ca3ae4dbcda2d6fa9c4b3f7f46a5f377b25981be) --- .../lispflowmapping/basic/020_RPC_CRUD.robot | 143 ++++++++++++++++++ .../lispflowmapping/rpc_add-key_ipv4.json | 13 ++ .../rpc_add-mapping_ipv4_ipv4.json | 31 ++++ .../lispflowmapping/rpc_get-remove_ipv4.json | 11 ++ .../rpc_get-remove_missing.json | 11 ++ .../lispflowmapping/rpc_update-key_ipv4.json | 17 +++ .../rpc_update-mapping_ipv4_ipv4.json | 31 ++++ 7 files changed, 257 insertions(+) create mode 100644 test/csit/suites/lispflowmapping/basic/020_RPC_CRUD.robot create mode 100644 test/csit/variables/lispflowmapping/rpc_add-key_ipv4.json create mode 100644 test/csit/variables/lispflowmapping/rpc_add-mapping_ipv4_ipv4.json create mode 100644 test/csit/variables/lispflowmapping/rpc_get-remove_ipv4.json create mode 100644 test/csit/variables/lispflowmapping/rpc_get-remove_missing.json create mode 100644 test/csit/variables/lispflowmapping/rpc_update-key_ipv4.json create mode 100644 test/csit/variables/lispflowmapping/rpc_update-mapping_ipv4_ipv4.json diff --git a/test/csit/suites/lispflowmapping/basic/020_RPC_CRUD.robot b/test/csit/suites/lispflowmapping/basic/020_RPC_CRUD.robot new file mode 100644 index 0000000000..b5943a03c2 --- /dev/null +++ b/test/csit/suites/lispflowmapping/basic/020_RPC_CRUD.robot @@ -0,0 +1,143 @@ +*** Settings *** +Documentation Test suite to verify CRUD operations using RPCs +Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS} +Suite Teardown Delete All Sessions +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library ../../../libraries/Common.py +Variables ../../../variables/Variables.py +Resource ../../../libraries/Utils.txt + +*** Variables *** +${RPC_URL_PREFIX} /restconf/operations/lfm-mapping-database +${IPV4_C_KEY} ../../../variables/lispflowmapping/rpc_add-key_ipv4.json +${IPV4_RD} ../../../variables/lispflowmapping/rpc_get-remove_ipv4.json +${MISS_RD} ../../../variables/lispflowmapping/rpc_get-remove_missing.json +${IPV4_U_KEY} ../../../variables/lispflowmapping/rpc_update-key_ipv4.json +${IPV4_C_MAP} ../../../variables/lispflowmapping/rpc_add-mapping_ipv4_ipv4.json +${IPV4_U_MAP} ../../../variables/lispflowmapping/rpc_update-mapping_ipv4_ipv4.json + +*** Test Cases *** +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} + +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 + +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 + +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} + ${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} + +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} + ${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} + +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 + +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 + +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} + +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 + +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} + ${output}= Get From Dictionary ${resp.json()} output + ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord + ${eid_record_0}= Get From List ${eid_record} 0 + ${loc_record}= Get From Dictionary ${eid_record_0} LocatorRecord + ${loc_record_0}= Get From List ${loc_record} 0 + ${loc}= Get From Dictionary ${loc_record_0} LispAddressContainer + ${address}= Get From Dictionary ${loc} Ipv4Address + ${ipv4}= Get From Dictionary ${address} Ipv4Address + Should Be Equal As Strings ${ipv4} 10.10.10.10 + +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} + +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} + ${output}= Get From Dictionary ${resp.json()} output + ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord + ${eid_record_0}= Get From List ${eid_record} 0 + ${loc_record}= Get From Dictionary ${eid_record_0} LocatorRecord + ${loc_record_0}= Get From List ${loc_record} 0 + ${loc}= Get From Dictionary ${loc_record_0} LispAddressContainer + ${address}= Get From Dictionary ${loc} Ipv4Address + ${ipv4}= Get From Dictionary ${address} Ipv4Address + Should Be Equal As Strings ${ipv4} 20.20.20.20 + +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} + +Attempt To Read Deleted Mapping + [Documentation] Try to read the mapping deleted in the previous test + ${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} diff --git a/test/csit/variables/lispflowmapping/rpc_add-key_ipv4.json b/test/csit/variables/lispflowmapping/rpc_add-key_ipv4.json new file mode 100644 index 0000000000..3adef1fb3f --- /dev/null +++ b/test/csit/variables/lispflowmapping/rpc_add-key_ipv4.json @@ -0,0 +1,13 @@ +{ + "input": { + "LispAddressContainer": { + "Ipv4Address": { + "afi": 1, + "Ipv4Address": "192.0.2.1" + } + }, + "mask-length": 32, + "key-type": 1, + "authkey": "password" + } +} diff --git a/test/csit/variables/lispflowmapping/rpc_add-mapping_ipv4_ipv4.json b/test/csit/variables/lispflowmapping/rpc_add-mapping_ipv4_ipv4.json new file mode 100644 index 0000000000..c883525713 --- /dev/null +++ b/test/csit/variables/lispflowmapping/rpc_add-mapping_ipv4_ipv4.json @@ -0,0 +1,31 @@ +{ + "input": { + "recordTtl": 1440, + "maskLength": 32, + "authoritative": true, + "LispAddressContainer": { + "Ipv4Address": { + "afi": 1, + "Ipv4Address": "192.0.2.1" + } + }, + "LocatorRecord": [ + { + "name": "ISP1", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": false, + "LispAddressContainer": { + "Ipv4Address": { + "afi": 1, + "Ipv4Address": "10.10.10.10" + } + } + } + ] + } +} diff --git a/test/csit/variables/lispflowmapping/rpc_get-remove_ipv4.json b/test/csit/variables/lispflowmapping/rpc_get-remove_ipv4.json new file mode 100644 index 0000000000..f3d374e6b3 --- /dev/null +++ b/test/csit/variables/lispflowmapping/rpc_get-remove_ipv4.json @@ -0,0 +1,11 @@ +{ + "input": { + "LispAddressContainer": { + "Ipv4Address": { + "afi": 1, + "Ipv4Address": "192.0.2.1" + } + }, + "mask-length": 32 + } +} diff --git a/test/csit/variables/lispflowmapping/rpc_get-remove_missing.json b/test/csit/variables/lispflowmapping/rpc_get-remove_missing.json new file mode 100644 index 0000000000..d4752dc6ed --- /dev/null +++ b/test/csit/variables/lispflowmapping/rpc_get-remove_missing.json @@ -0,0 +1,11 @@ +{ + "input": { + "LispAddressContainer": { + "Ipv4Address": { + "afi": 1, + "Ipv4Address": "192.0.2.255" + } + }, + "mask-length": 32 + } +} diff --git a/test/csit/variables/lispflowmapping/rpc_update-key_ipv4.json b/test/csit/variables/lispflowmapping/rpc_update-key_ipv4.json new file mode 100644 index 0000000000..3237856e3e --- /dev/null +++ b/test/csit/variables/lispflowmapping/rpc_update-key_ipv4.json @@ -0,0 +1,17 @@ +{ + "input": { + "eid": { + "LispAddressContainer": { + "Ipv4Address": { + "afi": 1, + "Ipv4Address": "192.0.2.1" + } + }, + "mask-length": 32 + }, + "key": { + "key-type": 1, + "authkey": "updated-password" + } + } +} diff --git a/test/csit/variables/lispflowmapping/rpc_update-mapping_ipv4_ipv4.json b/test/csit/variables/lispflowmapping/rpc_update-mapping_ipv4_ipv4.json new file mode 100644 index 0000000000..2f9a06869d --- /dev/null +++ b/test/csit/variables/lispflowmapping/rpc_update-mapping_ipv4_ipv4.json @@ -0,0 +1,31 @@ +{ + "input": { + "recordTtl": 1440, + "maskLength": 32, + "authoritative": true, + "LispAddressContainer": { + "Ipv4Address": { + "afi": 1, + "Ipv4Address": "192.0.2.1" + } + }, + "LocatorRecord": [ + { + "name": "ISP1", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": false, + "LispAddressContainer": { + "Ipv4Address": { + "afi": 1, + "Ipv4Address": "20.20.20.20" + } + } + } + ] + } +} -- 2.36.6