blob: a4d69cd1785be343a6c2af994b8b3c3f6d433c88 [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 -080023Test Add Slice-2 CREATE 1
24
25Test Get Slice-2 RETRIEVE 1
26
Suchitra.Vemuri75dffd42016-12-20 15:35:25 -080027*** Keywords ***
28Read InputFile
29 ${sliceList} = utils.jsonToList ${PATHFILE} sliceInfo
30 Set Suite Variable ${sList} ${sliceList}
31
32Verify Slice API functionality
33 [Arguments] ${type} ${listIndex}
34 Run Keyword If "${type}" == "CREATE" Test Post Instances ${listIndex}
35 Run Keyword If "${type}" == "RETRIEVE" Test Get Instances ${listIndex}
36 Run Keyword If "${type}" == "DELETE" Test Delete Instances ${listIndex}
37
38Test Post Instances
39 [Arguments] ${listIndex}
40 ${sliceList} = Get Variable Value ${sList}
41 ${sliceDict}= utils.listToDict ${sliceList} ${listIndex}
42 ${api_result}= restApi.ApiPost CORE_SANITY_SLICES ${sliceDict}
43 Should Be True ${api_result}
44
45Test Get Instances
46 [Arguments] ${listIndex}
47 ${json_result}= restApi.ApiGet CORE_SLICES
48 Log ${json_result}
49 ${sliceList}= Get Variable Value ${sList}
50 ${inputDict}= utils.listToDict ${sliceList} ${listIndex}
51 ${ID}= utils.getFieldValueFromDict ${inputDict} id
52 ${getJsonDict}= utils.getDictFromListOfDict ${json_result} id ${ID}
53 ${test_result}= utils.compare_dict ${inputDict} ${getJsonDict}
54 Should Be True ${json_result}
55
56Test Delete Instances
57 [Arguments] ${listIndex}
58 ${json_getresult}= restApi.ApiGet CORE_SLICES
59 ${sliceList}= Get Variable Value ${sList}
60 ${sliceDict}= utils.listToDict ${sList} ${listIndex}
61 ${sliceName}= utils.getFieldValueFromDict ${sliceDict} name
62 Log ${sliceName}
63 ${getSliceDict}= utils.getDictFromListofDict ${json_getresult} name ${sliceName}
64 Log ${getSliceDict}
65 ${sliceID}= utils.getFieldValueFromDict ${getSliceDict} id
66 Log ${sliceID}
67 ${test_result}= restApi.ApiDelete CORE_SLICES ${sliceID}
68 Should be True ${test_result}