blob: 454eba5cff25288faf60231df25233bb126f20c6 [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
10Library ../Framework/utils/utils.py
11Library ../Framework/restApi.py
12
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
25 ${sliceList} = utils.jsonToList ${PATHFILE} sliceInfo
26 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}
37 ${sliceDict}= utils.listToDict ${sliceList} ${listIndex}
38 ${api_result}= restApi.ApiPost CORE_SANITY_SLICES ${sliceDict}
39 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}
43 ${json_result}= restApi.ApiGet CORE_SLICES
44 Log ${json_result}
45 ${sliceList}= Get Variable Value ${sList}
46 ${inputDict}= utils.listToDict ${sliceList} ${listIndex}
47 ${ID}= utils.getFieldValueFromDict ${inputDict} id
48 ${getJsonDict}= utils.getDictFromListOfDict ${json_result} id ${ID}
49 ${test_result}= utils.compare_dict ${inputDict} ${getJsonDict}
50 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}
54 ${json_getresult}= restApi.ApiGet CORE_SLICES
55 ${sliceList}= Get Variable Value ${sList}
56 ${sliceDict}= utils.listToDict ${sList} ${listIndex}
57 ${sliceName}= utils.getFieldValueFromDict ${sliceDict} name
58 Log ${sliceName}
59 ${getSliceDict}= utils.getDictFromListofDict ${json_getresult} name ${sliceName}
60 Log ${getSliceDict}
61 ${sliceID}= utils.getFieldValueFromDict ${getSliceDict} id
62 Log ${sliceID}
63 ${test_result}= restApi.ApiDelete CORE_SLICES ${sliceID}
64 Should be True ${test_result}