blob: e19fbec6cbd26154b325e8c7870544b924c40742 [file] [log] [blame]
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -08001*** Settings ***
2Documentation Test suite for Sanity Test of Slice API
3Suite Setup Read InputFile
4Test Template Verify Slice API functionality
5Library Collections
6Library String
7Library OperatingSystem
8Library XML
9Library RequestsLibrary
Zack Williams821c5022020-01-15 15:11:46 -070010Library CORDRobot
11Library ImportResource resources=CORDRobot
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080012
13*** Variables ***
14${USER} admin
15${PASSWORD} admin
16${PATHFILE} ${CURDIR}/data/Sanity_slice.json
17
18*** Test Cases *** TYPE LISTINDEX
19Test Add Slice-1 CREATE 0
20
21Test Get Slice-1 RETRIEVE 0
22
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080023*** Keywords ***
24Read InputFile
Zack Williams821c5022020-01-15 15:11:46 -070025 ${sliceList} = CORDRobot.jsonToList ${PATHFILE} sliceInfo
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080026 Set Suite Variable ${sList} ${sliceList}
27
28Verify Slice API functionality
29 [Arguments] ${type} ${listIndex}
You Wang123d6942017-03-01 12:33:02 -080030 Run Keyword If "${type}" == "CREATE" Test Post Slices ${listIndex}
31 Run Keyword If "${type}" == "RETRIEVE" Test Get Slices ${listIndex}
32 Run Keyword If "${type}" == "DELETE" Test Delete Slices ${listIndex}
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080033
You Wang123d6942017-03-01 12:33:02 -080034Test Post Slices
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080035 [Arguments] ${listIndex}
36 ${sliceList} = Get Variable Value ${sList}
Zack Williams821c5022020-01-15 15:11:46 -070037 ${sliceDict}= CORDRobot.listToDict ${sliceList} ${listIndex}
38 ${api_result}= CORDRobot.ApiPost CORE_SANITY_SLICES ${sliceDict}
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080039 Should Be True ${api_result}
40
You Wang123d6942017-03-01 12:33:02 -080041Test Get Slices
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080042 [Arguments] ${listIndex}
Zack Williams821c5022020-01-15 15:11:46 -070043 ${json_result}= CORDRobot.ApiGet CORE_SLICES
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080044 Log ${json_result}
45 ${sliceList}= Get Variable Value ${sList}
Zack Williams821c5022020-01-15 15:11:46 -070046 ${inputDict}= CORDRobot.listToDict ${sliceList} ${listIndex}
47 ${ID}= CORDRobot.getFieldValueFromDict ${inputDict} id
48 ${getJsonDict}= CORDRobot.getDictFromListOfDict ${json_result} id ${ID}
49 ${test_result}= CORDRobot.compare_dict ${inputDict} ${getJsonDict}
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080050 Should Be True ${json_result}
51
You Wang123d6942017-03-01 12:33:02 -080052Test Delete Slices
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080053 [Arguments] ${listIndex}
Zack Williams821c5022020-01-15 15:11:46 -070054 ${json_getresult}= CORDRobot.ApiGet CORE_SLICES
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080055 ${sliceList}= Get Variable Value ${sList}
Zack Williams821c5022020-01-15 15:11:46 -070056 ${sliceDict}= CORDRobot.listToDict ${sList} ${listIndex}
57 ${sliceName}= CORDRobot.getFieldValueFromDict ${sliceDict} name
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080058 Log ${sliceName}
Zack Williams821c5022020-01-15 15:11:46 -070059 ${getSliceDict}= CORDRobot.getDictFromListofDict ${json_getresult} name ${sliceName}
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080060 Log ${getSliceDict}
Zack Williams821c5022020-01-15 15:11:46 -070061 ${sliceID}= CORDRobot.getFieldValueFromDict ${getSliceDict} id
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080062 Log ${sliceID}
Zack Williams821c5022020-01-15 15:11:46 -070063 ${test_result}= CORDRobot.ApiDelete CORE_SLICES ${sliceID}
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080064 Should be True ${test_result}