[CORD-3203] automate data plane for real OLT/ONU
Change-Id: Ifeb4358028d5c24d3e2febef525c8a11bdb57912
diff --git a/VERSION b/VERSION
index 38f77a6..488130a 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.0.1
+2.0.2.dev0
diff --git a/src/test/cord-api/Tests/FabricConfig.txt b/src/test/cord-api/Tests/FabricConfig.txt
new file mode 100644
index 0000000..fc57902
--- /dev/null
+++ b/src/test/cord-api/Tests/FabricConfig.txt
@@ -0,0 +1,133 @@
+*** 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} ${CURDIR}/data/FabricSwitch.json
+${PATHFILE1} ${CURDIR}/data/FabricSwitchPort.json
+${PATHFILE2} ${CURDIR}/data/FabricPortInterface.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 FabricPortInterface-1
+ INTERFACECREATE 0
+Test Get FabricPortInterface-1
+ INTERFACERETRIEVE 0
+Test Create FarbicSwitch-2
+ CREATE 1
+Test Get FabricSwitch-2
+ RETRIEVE 1
+Test Create FabricSwitchPort-2
+ PORTCREATE 1
+Test Get FabricSwitchPort-2
+ PORTRETRIEVE 1
+Test Create FabricPortInterface-2
+ INTERFACECREATE 1
+Test Get FabricPortInterface-2
+ INTERFACERETRIEVE 1
+Test Create FarbicSwitch-3
+ CREATE 2
+Test Get FabricSwitch-3
+ RETRIEVE 2
+Test Create FarbicSwitch-4
+ CREATE 3
+Test Get FabricSwitch-4
+ RETRIEVE 3
+
+*** 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}
+ ${FabricInterfaceList}= utils.jsonToList ${PATHFILE2} FabricPortInterface
+ Set Suite Variable ${ilist} ${FabricInterfaceList}
+ Set Global Variable ${FabricInterface_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}
+ Run Keyword If "${type}" == "INTERFACECREATE" Test Create Fabric Interface ${listIndex}
+ Run Keyword If "${type}" == "INTERFACERETRIEVE" Test Get Fabric Interface ${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}
+
+Test Create Fabric Interface
+ [Arguments] ${listIndex}
+ ${FabricInterfaceList}= Get Variable Value ${ilist}
+ ${FabricInterfaceDict}= utils.listToDict ${FabricInterfaceList} ${listIndex}
+ ${FabricInterfaceDict}= utils.setFieldValueInDict ${FabricInterfaceDict} port_id ${SwitchPort_Id}
+ ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson PORT_INTERFACE ${FabricInterfaceDict}
+ Should Be True ${api_result_status}
+ ${FabricInterface_Id}= Get From Dictionary ${api_result_json} id
+ Set Global Variable ${FabricInterface_Id}
+
+Test Get Fabric Interface
+ [Arguments] ${listIndex}
+ Log ${FabricInterface_Id}
+ ${json_result}= restApi.ApiChameleonGet PORT_INTERFACE ${FabricInterface_Id}
+ Log ${json_result}
+ ${FabricInterfaceList} = Get Variable Value ${ilist}
+ ${FabricInterfaceDict}= utils.listToDict ${FabricInterfaceList} ${listIndex}
+ Log ${FabricInterfaceDict}
+ ${test_result}= utils.compare_dict ${FabricInterfaceDict} ${json_result}
+ Should Be True ${test_result}
diff --git a/src/test/cord-api/Tests/RealOLT_Test.txt b/src/test/cord-api/Tests/RealOLT_Test.txt
new file mode 100644
index 0000000..86faa32
--- /dev/null
+++ b/src/test/cord-api/Tests/RealOLT_Test.txt
@@ -0,0 +1,57 @@
+*** Settings ***
+Documentation Test suite for configuring OLT device using REST APIs
+Suite Setup Read InputFile
+Test Template Configuring Real OLT device
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library ../Framework/utils/utils.py
+Library ../Framework/restApi.py
+
+*** Variables ***
+${PATHFILE} ${CURDIR}/data/RealOLTDevice.json
+
+*** Test Cases *** TYPE LISTINDEX
+Test Create VOLTDevice-1
+ CREATE 0
+Test Get VOLTDevice-1
+ RETRIEVE 0
+
+*** Keywords ***
+Read InputFile
+ ${voltDeviceList}= utils.jsonToList ${PATHFILE} VOLTDeviceInfo
+ Set Suite Variable ${dlist} ${voltDeviceList}
+ Set Global Variable ${VOLTDevice_Id} ${EMPTY}
+
+Configuring Real OLT device
+ [Arguments] ${type} ${listIndex}
+ Run Keyword If "${type}" == "CREATE" Test Post VOLT Device API ${listIndex}
+ Run Keyword If "${type}" == "RETRIEVE" Test Get VOLT Device API ${listIndex}
+
+Test Post VOLT Device API
+ [Arguments] ${listIndex}
+ ${voltDeviceList} = Get Variable Value ${dlist}
+ ${voltDeviceDict}= utils.listToDict ${voltDeviceList} ${listIndex}
+ ${api_getResult}= restApi.ApiGet VOLT_SERVICE
+ ${voltServiceList}= Get From Dictionary ${api_getResult} items
+ ${voltServiceDict}= utils.getDictFromListOfDict ${voltServiceList} leaf_model_name VOLTService
+ ${VOLTService_Id}= Get From Dictionary ${voltServiceDict} id
+ ${voltDeviceDict}= utils.setFieldValueInDict ${voltDeviceDict} volt_service_id ${VOLTService_Id}
+ Log ${voltDeviceDict}
+ ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson VOLT_DEVICE ${voltDeviceDict}
+ Should Be True ${api_result_status}
+ ${VOLTDevice_Id}= Get From Dictionary ${api_result_json} id
+ Set Global Variable ${VOLTDevice_Id}
+
+Test Get VOLT Device API
+ [Arguments] ${listIndex}
+ Log ${VOLTDevice_Id}
+ ${json_result}= restApi.ApiChameleonGet VOLT_DEVICE ${VOLTDevice_Id}
+ Log ${json_result}
+ ${voltDeviceList} = Get Variable Value ${dlist}
+ ${voltDeviceDict}= utils.listToDict ${voltDeviceList} ${listIndex}
+ Log ${voltDeviceDict}
+ ${test_result}= utils.compare_dict ${voltDeviceDict} ${json_result}
+ Should Be True ${test_result}
diff --git a/src/test/cord-api/Tests/Subscriber_TopDown.txt b/src/test/cord-api/Tests/Subscriber_TopDown.txt
new file mode 100644
index 0000000..ce3c12d
--- /dev/null
+++ b/src/test/cord-api/Tests/Subscriber_TopDown.txt
@@ -0,0 +1,51 @@
+*** Settings ***
+Documentation Test suite for configuring subscriber for Top Down Approach test
+Suite Setup Read InputFile
+Test Template Configuring Subscriber Top Down Test
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library ../Framework/utils/utils.py
+Library ../Framework/restApi.py
+
+*** Variables ***
+${PATHFILE} ${CURDIR}/data/Subscriber_TopDown.json
+
+*** Test Cases *** TYPE LISTINDEX
+Test Create Subscriber-1
+ CREATE 0
+Test Get Subscriber-1
+ RETRIEVE 0
+
+*** Keywords ***
+Read InputFile
+ ${SubscriberList}= utils.jsonToList ${PATHFILE} SubscriberInfo
+ Set Suite Variable ${slist} ${SubscriberList}
+ Set Global Variable ${Subscriber_Id} ${EMPTY}
+
+Configuring Subscriber Top Down Test
+ [Arguments] ${type} ${listIndex}
+ Run Keyword If "${type}" == "CREATE" Post Subscriber ${listIndex}
+ Run Keyword If "${type}" == "RETRIEVE" Get Subscriber ${listIndex}
+
+Post Subscriber
+ [Arguments] ${listIndex}
+ ${SubscriberList} = Get Variable Value ${slist}
+ ${SubscriberDict}= utils.listToDict ${SubscriberList} ${listIndex}
+ ${api_result_status} ${api_result_json}= restApi.ApiPostReturnJson VOLT_SUBSCRIBER ${SubscriberDict}
+ Should Be True ${api_result_status}
+ ${Subscriber_Id}= Get From Dictionary ${api_result_json} id
+ Set Global Variable ${Subscriber_Id}
+
+Get Subscriber
+ [Arguments] ${listIndex}
+ Log ${Subscriber_Id}
+ ${json_result}= restApi.ApiChameleonGet VOLT_SUBSCRIBER ${Subscriber_Id}
+ Log ${json_result}
+ ${SubscriberList} = Get Variable Value ${slist}
+ ${SubscriberDict}= utils.listToDict ${SubscriberList} ${listIndex}
+ Log ${SubscriberDict}
+ ${test_result}= utils.compare_dict ${SubscriberDict} ${json_result}
+ Should Be True ${test_result}
diff --git a/src/test/cord-api/Tests/data/FabricPortInterface.json b/src/test/cord-api/Tests/data/FabricPortInterface.json
index c711096..7a5061b 100644
--- a/src/test/cord-api/Tests/data/FabricPortInterface.json
+++ b/src/test/cord-api/Tests/data/FabricPortInterface.json
@@ -1,20 +1,15 @@
{
"FabricPortInterface" : [
{
- "name": "OLT1-Interface-1",
- "ips": "10.8.2.254",
- "port_id": 1
+ "name": "OLT Leaf1- Interface-1",
+ "ips": "10.8.2.254/24",
+ "port_id": 8
},
{
-
- "name": "Interface-2",
- "ips": "192.22.18.4",
- "port_id": 2
- },
- {
- "name": "Interface-2",
- "ips": "192.22.18.4",
- "port_id": 3
+ "name": "OLT Leaf2- Interface-2",
+ "ips": "10.8.3.254/24",
+ "vlanUntagged": 100,
+ "port_id": 9
}
]
}
diff --git a/src/test/cord-api/Tests/data/FabricSwitch.json b/src/test/cord-api/Tests/data/FabricSwitch.json
index e9cdcb6..6f32b22 100644
--- a/src/test/cord-api/Tests/data/FabricSwitch.json
+++ b/src/test/cord-api/Tests/data/FabricSwitch.json
@@ -2,39 +2,39 @@
"FabricSwitchInfo" : [
{
"driver": "ofdpa3",
- "ipv4Loopback": "192.168.9.100",
- "ipv4NodeSid": 17,
- "isEdgeRouter": True,
+ "ipv4Loopback": "192.168.9.22",
+ "ipv4NodeSid": 18,
+ "isEdgeRouter": true,
"name": "Fabric Switch - Leaf1",
"ofId": "of:0000cc37abd93769",
- "routerMac": "00:22:33"
+ "routerMac": "00:00:00:00:00:01"
},
{
"driver": "ofdpa3",
- "ipv4Loopback": "192.168.9.101",
+ "ipv4Loopback": "192.168.9.23",
"ipv4NodeSid": 17,
- "isEdgeRouter": True,
- "name": "Fabric Switch- Leaf2",
+ "isEdgeRouter": true,
+ "name": "Fabric Switch - Leaf2",
"ofId": "of:0000cc37abb6b564",
- "routerMac": "99:88:00"
+ "routerMac": "00:00:00:00:00:02"
},
{
"driver": "ofdpa3",
- "ipv4Loopback": "192.168.9.100",
- "ipv4NodeSid": 17,
- "isEdgeRouter": False,
+ "ipv4Loopback": "192.168.9.24",
+ "ipv4NodeSid": 19,
+ "isEdgeRouter": false,
"name": "Fabric Switch - Spine1",
"ofId": "of:0000cc37ab5b6da8",
- "routerMac": "44:33:55"
+ "routerMac": "00:00:00:00:00:03"
},
{
"driver": "ofdpa3",
- "ipv4Loopback": "192.168.9.100",
- "ipv4NodeSid": 17,
- "isEdgeRouter": False,
+ "ipv4Loopback": "192.168.9.25",
+ "ipv4NodeSid": 20,
+ "isEdgeRouter": false,
"name": "Fabric Switch - Spine2",
"ofId": "of:0000cc37abd9386d",
- "routerMac": "String"
+ "routerMac": "00:00:00:00:00:04"
}
]
}
diff --git a/src/test/cord-api/Tests/data/FabricSwitchPort.json b/src/test/cord-api/Tests/data/FabricSwitchPort.json
index 643194b..bfc2fee 100644
--- a/src/test/cord-api/Tests/data/FabricSwitchPort.json
+++ b/src/test/cord-api/Tests/data/FabricSwitchPort.json
@@ -1,8 +1,12 @@
{
"FabricSwitchPort" : [
{
- "portId": 7
+ "portId": 7,
"switch_id": 1
+ },
+ {
+ "portId": 5,
+ "switch_id" : 6
}
]
}
diff --git a/src/test/cord-api/Tests/data/RealOLTDevice.json b/src/test/cord-api/Tests/data/RealOLTDevice.json
new file mode 100644
index 0000000..802c3d1
--- /dev/null
+++ b/src/test/cord-api/Tests/data/RealOLTDevice.json
@@ -0,0 +1,15 @@
+{
+ "VOLTDeviceInfo" : [
+ {
+ "device_type": "openolt",
+ "host": "10.192.4.218",
+ "port": 9191,
+ "switch_datapath_id": "of:0000cc37abd93769",
+ "switch_port": "7",
+ "outer_tpid": "0x8100",
+ "name": "olt-1",
+ "uplink": "128",
+ "volt_service_id": 2
+ }
+ ]
+}
diff --git a/src/test/cord-api/Tests/data/Subscriber_TopDown.json b/src/test/cord-api/Tests/data/Subscriber_TopDown.json
new file mode 100644
index 0000000..89c82e2
--- /dev/null
+++ b/src/test/cord-api/Tests/data/Subscriber_TopDown.json
@@ -0,0 +1,20 @@
+{
+ "SubscriberInfo" : [
+ {
+ "name": "My House-305",
+ "c_tag": 999,
+ "mac_address" : "08:35:71:06:b9:69",
+ "ip_address" : "10.8.2.105",
+ "onu_device": "ALPHe3d1cfa7"
+ },
+ {
+ "name": "My House-306",
+ "c_tag": 998,
+ "mac_address" : "08:35:71:08:7d:8f",
+ "ip_address" : "10.8.2.106",
+ "onu_device": "ALPHe3d1cea3",
+ "downlink_speed": 100000000,
+ "uplink_speed": 100000000
+ }
+ ]
+}