Fabric changes for ATT WorkFlow
Change-Id: I74e9241541bd18133d288963e0fcfe22745d950d
diff --git a/src/test/cord-api/Tests/WorkflowValidations/ATT_FabricConfig.txt b/src/test/cord-api/Tests/WorkflowValidations/ATT_FabricConfig.txt
new file mode 100644
index 0000000..beb277a
--- /dev/null
+++ b/src/test/cord-api/Tests/WorkflowValidations/ATT_FabricConfig.txt
@@ -0,0 +1,86 @@
+*** Settings ***
+Documentation Test suite for FabricSwitch
+Suite Setup Read InputFile
+Test Template Verify FabricSwitch functionality
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library ../../Framework/utils/utils.py
+Library ../../Framework/restApi.py
+
+*** Variables ***
+${PATHFILE} ../data/FabricSwitch.json
+${PATHFILE1} ../data/FabricSwitchPort.json
+
+*** Test Cases *** TYPE LISTINDEX
+Test Create FarbicSwitch-1
+ CREATE 0
+Test Get FabricSwitch-1
+ RETRIEVE 0
+Test Create FabricSwitchPort-1
+ PORTCREATE 0
+Test Get FabricSwitchPort-1
+ PORTRETRIEVE 0
+Test Create FabricSwitchPort-2
+ PORTCREATE 1
+Test Get FabricSwitchPort-2
+ PORTRETRIEVE 1
+
+*** Keywords ***
+Read InputFile
+ ${FabricList}= utils.jsonToList ${PATHFILE} FabricSwitchInfo
+ Set Suite Variable ${dlist} ${FabricList}
+ Set Global Variable ${Fabric_Id} ${EMPTY}
+ ${FabricPortList}= utils.jsonToList ${PATHFILE1} FabricSwitchPort
+ Set Suite Variable ${plist} ${FabricPortList}
+ Set Global Variable ${SwitchPort_Id} ${EMPTY}
+
+Verify FabricSwitch functionality
+ [Arguments] ${type} ${listIndex}
+ Run Keyword If "${type}" == "CREATE" Test Create Fabric Switch ${listIndex}
+ Run Keyword If "${type}" == "RETRIEVE" Test Get Fabric Switch ${listIndex}
+ Run Keyword If "${type}" == "PORTCREATE" Test Create Switch Port API ${listIndex}
+ Run Keyword If "${type}" == "PORTRETRIEVE" Test Get Switch Port API ${listIndex}
+
+Test Create Fabric Switch
+ [Arguments] ${listIndex}
+ ${FabricList} = Get Variable Value ${dlist}
+ ${FabricDict}= utils.listToDict ${FabricList} ${listIndex}
+ ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson FABRIC_SWITCH ${FabricDict}
+ Should Be True ${api_result_status}
+ ${Fabric_Id}= Get From Dictionary ${api_result_json} id
+ Set Global Variable ${Fabric_Id}
+
+Test Get Fabric Switch
+ [Arguments] ${listIndex}
+ Log ${Fabric_Id}
+ ${json_result}= restApi.ApiChameleonGet FABRIC_SWITCH ${Fabric_Id}
+ Log ${json_result}
+ ${FabricList} = Get Variable Value ${dlist}
+ ${FabricDict}= utils.listToDict ${FabricList} ${listIndex}
+ Log ${FabricDict}
+ ${test_result}= utils.compare_dict ${FabricDict} ${json_result}
+ Should Be True ${test_result}
+
+Test Create Switch Port API
+ [Arguments] ${listIndex}
+ ${SwitchPortList} = Get Variable Value ${plist}
+ ${SwitchPortDict}= utils.listToDict ${SwitchPortList} ${listIndex}
+ ${SwitchPortDict}= utils.setFieldValueInDict ${SwitchPortDict} switch_id ${Fabric_Id}
+ ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson SWITCH_PORT ${SwitchPortDict}
+ Should Be True ${api_result_status}
+ ${SwitchPort_Id}= Get From Dictionary ${api_result_json} id
+ Set Global Variable ${SwitchPort_Id}
+
+Test Get Switch Port API
+ [Arguments] ${listIndex}
+ Log ${SwitchPort_Id}
+ ${json_result}= restApi.ApiChameleonGet SWITCH_PORT ${SwitchPort_Id}
+ Log ${json_result}
+ ${SwitchPortList} = Get Variable Value ${plist}
+ ${SwitchPortDict}= utils.listToDict ${SwitchPortList} ${listIndex}
+ Log ${SwitchPortDict}
+ ${test_result}= utils.compare_dict ${SwitchPortDict} ${json_result}
+ Should Be True ${test_result}