blob: 6a933611ce89c471f4087ada14ee38c7e9c36c59 [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}
30 Run Keyword If "${type}" == "CREATE" Test Post Instances ${listIndex}
31 Run Keyword If "${type}" == "RETRIEVE" Test Get Instances ${listIndex}
32 Run Keyword If "${type}" == "DELETE" Test Delete Instances ${listIndex}
33
34Test Post Instances
35 [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
41Test Get Instances
42 [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
52Test Delete Instances
53 [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}