blob: a984f5c3c6dcef67c403a0e997e2522bef761913 [file] [log] [blame]
*** Settings ***
Documentation Test to Configure White List
Suite Setup Read InputFile
Test Template Configuring White List
Library Collections
Library String
Library OperatingSystem
Library XML
Library RequestsLibrary
Library CORDRobot
Library ImportResource resources=CORDRobot
*** Variables ***
${PATHFILE} ${CURDIR}/data/ATTWhiteList.json
*** Test Cases *** TYPE LISTINDEX
Test Create ONUWhiteList-1
CREATE 0
Test Get ONUWhiteList-1
RETRIEVE 0
*** Keywords ***
Read InputFile
${AttWhiteListList}= CORDRobot.jsonToList ${PATHFILE} AttWhiteListInfo
Set Suite Variable ${slist} ${AttWhiteListList}
Set Global Variable ${AttWorkFlowDriver_Id} ${EMPTY}
Set Global Variable ${AttWhiteList_Id} ${EMPTY}
Configuring White List
[Arguments] ${type} ${listIndex}
Run Keyword If "${type}" == "CREATE" Post White List ${listIndex}
Run Keyword If "${type}" == "RETRIEVE" Get White List ${listIndex}
Post White List
[Arguments] ${listIndex}
${AttWhiteListList} = Get Variable Value ${slist}
${AttWhiteListDict}= CORDRobot.listToDict ${AttWhiteListList} ${listIndex}
# Retrieve ATT Service Driver Id
${api_getResult}= CORDRobot.ApiGet ATT_SERVICE
${AttWorkFlowDriverList}= Get From Dictionary ${api_getResult} items
${AttWorkFlowDriverDict}= CORDRobot.getDictFromListOfDict ${AttWorkFlowDriverList} leaf_model_name AttWorkflowDriverService
${AttWorkFlowDriver_Id}= Get From Dictionary ${AttWorkFlowDriverDict} id
${AttWhiteListDict}= CORDRobot.setFieldValueInDict ${AttWhiteListDict} owner_id ${AttWorkFlowDriver_Id}
Log ${AttWhiteListDict}
${api_result_status} ${api_result_json}= CORDRobot.ApiPostReturnJson ATT_WHITELIST ${AttWhiteListDict}
Should Be True ${api_result_status}
${AttWhiteList_Id}= Get From Dictionary ${api_result_json} id
Set Global Variable ${AttWhiteList_Id}
Get White List
[Arguments] ${listIndex}
Log ${AttWhiteList_Id}
${json_result}= CORDRobot.ApiChameleonGet ATT_WHITELIST ${AttWhiteList_Id}
Log ${json_result}
${AttWhiteListList} = Get Variable Value ${slist}
${AttWhiteListDict}= CORDRobot.listToDict ${AttWhiteListList} ${listIndex}
Log ${AttWhiteListDict}
${test_result}= CORDRobot.compare_dict ${AttWhiteListDict} ${json_result}
Should Be True ${test_result}