aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShubham Mishra <shivam828787@gmail.com>2020-06-16 18:42:58 +0530
committerShubham Mishra <shivam828787@gmail.com>2020-06-16 20:57:22 +0530
commitb5609493e9a3366a64bcf5931322bda96d965854 (patch)
tree7bc88a86442e8260eaf66ea0fd7f19e9951f77db
parent06bf8cf347d8af6740ab5df842abebf17dabac30 (diff)
Merged depends.yml and cases.yml for general cases
Updated create_real_url() function to retreive and process parent url to get child url. All cases are indepedent now and order doesn't matter, same can be extended to exception cases too. Change-Id: I77c9ad1b406fde01a7853872a515b560b9265871 Signed-off-by: Shubham Mishra <shivam828787@gmail.com>
-rw-r--r--hdv/redfish/conf/cases.yaml855
-rw-r--r--hdv/redfish/conf/config.yaml4
-rw-r--r--hdv/redfish/hdv_redfish.py117
3 files changed, 504 insertions, 472 deletions
diff --git a/hdv/redfish/conf/cases.yaml b/hdv/redfish/conf/cases.yaml
index 5609708..5d92689 100644
--- a/hdv/redfish/conf/cases.yaml
+++ b/hdv/redfish/conf/cases.yaml
@@ -1,22 +1,58 @@
---
-- case_name: set asset code
+- case_name: get asset code
case_sn: 1
expected_code: 200
expected_result: '{"AssetTag": "CM_cc@1234"}'
group: asset managment
header: null
- method: PATCH
- request_body: '{"AssetTag": "CM_cc@1234"}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}
-- case_name: get asset code
- case_sn: 2
+ method: GET
+ request_body: null
+ url: /redfish/v1/Systems/{system_id}
+ key_flag_dict: {"system_id": "Members"}
+- case_name: check main board name
+ case_sn: 8
expected_code: 200
- expected_result: '{"AssetTag": "CM_cc@1234"}'
+ expected_result: '{"Oem":{"Mainboard": {"BoardName": "RS33M2C9S"}}}'
group: asset managment
header: null
method: GET
request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}
+ url: /redfish/v1/Chassis/{chassis_id}
+ key_flag_dict: {"chassis_id": "Members"}
+- case_name: check CPU amount
+ case_sn: 11
+ expected_code: 200
+ expected_result: '{"Members@odata.count": 2}'
+ group: compoment management
+ header: null
+ method: GET
+ request_body: null
+ url: /redfish/v1/Systems/{system_id}/Processors
+ key_flag_dict: {"system_id": "Members"}
+- case_name: check CPU info
+ case_sn: 2
+ expected_code: 200
+ expected_result: '{ "count": 2, "Manufacturer": "Intel(R) Corporation", "MaxSpeedMHz":
+ 2300, "Model": "Intel(R) Xeon(R) Gold 5218N CPU @ 2.30GHz", "ProcessorArchitecture":
+ ["x86", "IA-64", "ARM", "MIPS", "OEM"], "Socket": [1, 2], "Status": { "Health":
+ "OK", "State": "Enabled" }, "TotalCores": 16, "TotalThreads":
+ 32}'
+ group: compoment management
+ header: null
+ method: GET
+ request_body: null
+ url: /redfish/v1/Systems/{system_id}/Processors/{cpu_id}
+ key_flag_dict: {"system_id": "Members", "cpu_id": "Members"}
+- case_name: set asset code
+ case_sn: 1
+ expected_code: 200
+ expected_result: '{"AssetTag": "CM_cc@1234"}'
+ group: asset managment
+ header: null
+ method: PATCH
+ request_body: '{"AssetTag": "CM_cc@1234"}'
+ url: /redfish/v1/Systems/{system_id}
+ key_flag_dict: {"system_id": "Members"}
- case_name: set host name
case_sn: 3
expected_code: 200
@@ -25,7 +61,8 @@
header: null
method: PATCH
request_body: '{"HostName": "NFV-RPZJHZ-01B"}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}
+ url: /redfish/v1/Systems/{system_id}
+ key_flag_dict: {"system_id": "Members"}
- case_name: check host name
case_sn: 4
expected_code: 200
@@ -34,7 +71,8 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}
+ url: /redfish/v1/Systems/{system_id}
+ key_flag_dict: {"system_id": "Members"}
- case_name: check manufacturer
case_sn: 5
expected_code: 200
@@ -43,7 +81,8 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}
+ url: /redfish/v1/Systems/{system_id}
+ key_flag_dict: {"system_id": "Members"}
- case_name: check model
case_sn: 6
expected_code: 200
@@ -52,7 +91,8 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}
+ url: /redfish/v1/Systems/{system_id}
+ key_flag_dict: {"system_id": "Members"}
- case_name: check serial number
case_sn: 7
expected_code: 200
@@ -61,7 +101,8 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}
+ url: /redfish/v1/Systems/{system_id}
+ key_flag_dict: {"system_id": "Members"}
- case_name: check main board name
case_sn: 8
expected_code: 200
@@ -70,7 +111,8 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}
+ url: /redfish/v1/Chassis/{chassis_id}
+ key_flag_dict: {"chassis_id": "Members"}
- case_name: check main board serial number
case_sn: 9
expected_code: 200
@@ -79,7 +121,8 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}
+ url: /redfish/v1/Chassis/{chassis_id}
+ key_flag_dict: {"chassis_id": "Members"}
- case_name: check BIOS version
case_sn: 10
expected_code: 200
@@ -88,7 +131,8 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}
+ url: /redfish/v1/Systems/{system_id}
+ key_flag_dict: {"system_id": "Members"}
- case_name: check CPU amount
case_sn: 11
expected_code: 200
@@ -97,7 +141,8 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Processors
+ url: /redfish/v1/Systems/{system_id}/Processors
+ key_flag_dict: {"system_id": "Members"}
- case_name: check CPU info
case_sn: 12
expected_code: 200
@@ -110,7 +155,8 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}{cpu_id}
+ url: /redfish/v1/Systems/{system_id}/Processors/{cpu_id}
+ key_flag_dict: {"system_id": "Members","cpu_id": "Members"}
- case_name: check memory mount
case_sn: 13
expected_code: 200
@@ -119,7 +165,8 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Memory
+ url: /redfish/v1/Systems/{system_id}/Memory
+ key_flag_dict: {"system_id": "Members"}
- case_name: check memory information
case_sn: 14
expected_code: 200
@@ -131,387 +178,389 @@
header: null
method: GET
request_body: null
- url: https://{bmc_ip}{memory_id}
-- case_name: check raid card amount
- case_sn: 15
- expected_code: 200
- expected_result: '{"Members@odata.count": 1}'
- group: compoment management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Storages
-- case_name: check raid card information
- case_sn: 16
- expected_code: 200
- expected_result: '{ "count": 1, "StorageControllers": [ { "FirmwareVersion":
- "2.62", "Manufacturer": "H3C", "Model": "N/A", "Status":
- { "Health": "OK", "State": "Enabled" } } ]}'
- group: compoment management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}{storage_id}
-- case_name: check harddisk information
- case_sn: 17
- expected_code: 200
- expected_result: '{ "count": 4, "CapacityBytes": [480102187008, 960193626112], "Location":
- { "Info": "N/A", "InfoFormat": "DeviceName" }, "Manufacturer":
- "ATA", "MediaType": "SSD", "Model": ["INTEL SSDSC2KB48", "INTEL SSDSC2KB96"], "Protocol":
- "SATA", "Status": { "Health": "OK", "State": "Enabled" }}'
- group: compoment management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}{drives_id}
-- case_name: check network interface adapter information
- case_sn: 18
- expected_code: 200
- expected_result: '{ "count": 3, "Manufacturer": "Mellanox", "Model": "NIC-620F-B2-25Gb-2P-1-X", "Name":
- ["PCIeSlot2", "PCIeSlot3", "PCIeSlot6"], "Oem": { "Public": { "CardModel":
- "2*25GE", "RootBDF": ["0000:17:00.0", "0000:17:02.0", "0000:AE:02.0"], } }, "Status":
- { "Health": "OK", "State": "Enabled" }}'
- group: compoment management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}{networkadapters_id}
-- case_name: check network interface adapter port information
- case_sn: 19
- expected_code: 200
- expected_result: '{ "count": 6, "AssociatedNetworkAddresses": [ "N/A" ], "Oem":
- { "Public": { "BDF": "N/A", "PortType": "OpticalPort" } }, "PhysicalPortNumber":
- ["1", "2"]}'
- group: compoment management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}{networkports_id}
-- case_name: check fans information
- case_sn: 20
- expected_code: 200
- expected_result: '{ "FanSummary": { "Count": 6 }, "Fans": [ { "MemberId":
- "N/A", "Oem": { "Public": { "SpeedRatio":
- "N/A" } }, "Status": { "Health":
- "OK", "State": "Enabled" } }, { "MemberId":
- "N/A", "Oem": { "Public": { "SpeedRatio":
- "N/A" } }, "Status": { "Health":
- "OK", "State": "Enabled" } },{ "MemberId":
- "N/A", "Oem": { "Public": { "SpeedRatio":
- "N/A" } }, "Status": { "Health":
- "OK", "State": "Enabled" } },{ "MemberId":
- "N/A", "Oem": { "Public": { "SpeedRatio":
- "N/A" } }, "Status": { "Health":
- "OK", "State": "Enabled" } },{ "MemberId":
- "N/A", "Oem": { "Public": { "SpeedRatio":
- "N/A" } }, "Status": { "Health":
- "OK", "State": "Enabled" } },{ "MemberId":
- "N/A", "Oem": { "Public": { "SpeedRatio":
- "N/A" } }, "Status": { "Health":
- "OK", "State": "Enabled" } } ],}'
- group: compoment management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}/Thermal
-- case_name: check power amount
- case_sn: 21
- expected_code: 200
- expected_result: '{ "DeviceMaxNum": { "PowerSupplyNum": 2},}'
- group: compoment management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}
-- case_name: check power detail info
- case_sn: 22
- expected_code: 200
- expected_result: '{ "PowerControl": [ { "PowerConsumedWatts":
- "N/A","Status":{ "Health": "OK", "State": "Enabled" } }, ], "PowerSupplies":
- [ { "LineInputVoltage": "N/A", "MemberId": "1", "PowerCapacityWatts":
- 800,"Status": { "Health": "OK", "State": "Enabled" } }, { "LineInputVoltage":
- "N/A", "MemberId": "2", "PowerCapacityWatts": 800,"Status":
- { "Health": "OK", "State": "Enabled" } } ],}'
- group: compoment management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}/Power
-- case_name: check logical dirve health status
- case_sn: 23
- expected_code: 200
- expected_result: '{ "count": 2, "Name": "N/A", "Status": { "Health":
- ["OK", "Critical"], "State": "Enabled" }}'
- group: compoment management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}{volume_id}
-- case_name: check server temperature air intake
- case_sn: 24
- expected_code: 200
- expected_result: '{ "Temperatures": [ { "Name": "INPUT_TEMP", "ReadingCelsius":
- "N/A", } ]}'
- group: sensor management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}/Thermal
-- case_name: check cpu temperature
- case_sn: 25
- expected_code: 200
- expected_result: '{ "Temperatures": [ { "Name": "INPUT_TEMP", "ReadingCelsius":
- "N/A", }, { "Name": "CPU1_TEMP", "ReadingCelsius":
- "N/A", }, { "Name": "CPU2_TEMP", "ReadingCelsius":
- "N/A", }, ]}'
- group: sensor management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}/Thermal
-- case_name: check server power state
- case_sn: 26
- expected_code: 200
- expected_result: '{"PowerState": "On"}'
- group: power management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}
-- case_name: remote power on server
- case_sn: 27
- expected_code: 200
- expected_result: '{"error":{"@Message.ExtendedInfo": [{"Message": "Successfully
- Completed Request", "Severity":"OK"}]}}'
- group: power management
- header: null
- method: POST
- request_body: '{"ResetType": "On"}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Actions/ComputerSystem.Reset
-- case_name: remote power off server
- case_sn: 28
- expected_code: 200
- expected_result: '{"error":{"@Message.ExtendedInfo": [{"Message": "Successfully
- Completed Request", "Severity":"OK"}]}}'
- group: power management
- header: null
- method: POST
- request_body: '{"ResetType": "GracefulShutdown"}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Actions/ComputerSystem.Reset
-- case_name: remote reset server
- case_sn: 29
- expected_code: 200
- expected_result: '{"error":{"@Message.ExtendedInfo": [{"Message": "Successfully
- Completed Request", "Severity":"OK"}]}}'
- group: power management
- header: null
- method: POST
- request_body: '{"ResetType": "ForceRestart"}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Actions/ComputerSystem.Reset
-- case_name: remote configure CPU in hyperthreading disabled
- case_sn: 30
- expected_code: 200
- expected_result: '{"Attributes": {"ProcessorHyperThreading": "Disabled"}}'
- group: remote configure
- header: null
- method: PATCH
- request_body: '{ "Attributes": { "ProcessorHyperThreading": "Disabled" }}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
-- case_name: remote get CPU hyperthreading in disabled
- case_sn: 31
- expected_code: 200
- expected_result: '{"Attributes": {"ProcessorHyperThreading": "Disabled"}}'
- group: remote configure
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
-- case_name: remote configure CPU in hyperthreading enabled
- case_sn: 32
- expected_code: 200
- expected_result: '{"Attributes": {"ProcessorHyperThreading": "Enabled"}}'
- group: remote configure
- header: null
- method: PATCH
- request_body: '{ "Attributes": { "ProcessorHyperThreading": "Enabled" }}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
-- case_name: remote get CPU hyperthreading in enabled
- case_sn: 33
- expected_code: 200
- expected_result: '{"Attributes": {"ProcessorHyperThreading": "Enabled"}}'
- group: remote configure
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
-- case_name: disable PXE mode
- case_sn: 34
- expected_code: 200
- expected_result: '{ "Attributes": { "IPv4PXESupport": "Disabled" }}'
- group: remote configure
- header: null
- method: PATCH
- request_body: '{ "Attributes": { "IPv4PXESupport": "Disabled" }}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
-- case_name: check IPV4 PXE mode in disabled
- case_sn: 35
- expected_code: 200
- expected_result: '{ "Attributes": { "IPv4PXESupport": "Disabled" }}'
- group: remote configure
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
-- case_name: enable PXE mode
- case_sn: 36
- expected_code: 200
- expected_result: '{ "Attributes": { "IPv4PXESupport": "Enabled" }}'
- group: remote configure
- header: null
- method: PATCH
- request_body: '{ "Attributes": { "IPv4PXESupport": "Enabled" }}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
-- case_name: check ipv4 PXE mode in enabled
- case_sn: 37
- expected_code: 200
- expected_result: '{ "Attributes": { "IPv4PXESupport": "Enabled" }}'
- group: remote configure
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
-- case_name: set boot type order
- case_sn: 38
- expected_code: 200
- expected_result: '{ "Attributes": { "BootTypeOrder0": "HardDiskDrive", "BootTypeOrder1":
- "DVDROMDrive", "BootTypeOrder2": "PXE", "BootTypeOrder3":
- "Others", }}'
- group: remote interface management
- header: null
- method: PATCH
- request_body: '{ "Attributes": { "BootTypeOrder0": "HardDiskDrive", "BootTypeOrder1":
- "DVDROMDrive", "BootTypeOrder2": "PXE", "BootTypeOrder3":
- "Others", }}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
-- case_name: check boot order
- case_sn: 39
- expected_code: 200
- expected_result: '{ "Attributes": { "BootTypeOrder0": "HardDiskDrive", "BootTypeOrder1":
- "DVDROMDrive", "BootTypeOrder2": "PXE", "BootTypeOrder3":
- "Others", }}'
- group: remote interface management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
-- case_name: configure boot order
- case_sn: 40
- expected_code: 200
- expected_result: '{ "Attributes": { "BootTypeOrder0": "DVDROMDrive", "BootTypeOrder1":
- "HardDiskDrive", "BootTypeOrder2": "Others", "BootTypeOrder3":
- "PXE", }}'
- group: remote interface management
- header: null
- method: PATCH
- request_body: '{ "Attributes": { "BootTypeOrder0": "DVDROMDrive", "BootTypeOrder1":
- "HardDiskDrive", "BootTypeOrder2": "Others", "BootTypeOrder3":
- "PXE", }}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
-- case_name: check boot order
- case_sn: 41
- expected_code: 200
- expected_result: '{ "Attributes": { "BootTypeOrder0": "DVDROMDrive", "BootTypeOrder1":
- "HardDiskDrive", "BootTypeOrder2": "Others", "BootTypeOrder3":
- "PXE", }}'
- group: remote interface management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
-- case_name: configure new boot PXE order first
- case_sn: 42
- expected_code: 200
- expected_result: '{ "Attributes": { "BootTypeOrder0": "PXE", "BootTypeOrder1":
- "HardDiskDrive", "BootTypeOrder2": "DVDROMDrive", "BootTypeOrder3":
- "Others", }}'
- group: remote interface management
- header: null
- method: PATCH
- request_body: '{ "Attributes": { "BootTypeOrder0": "PXE", "BootTypeOrder1":
- "HardDiskDrive", "BootTypeOrder2": "DVDROMDrive", "BootTypeOrder3":
- "Others", }}'
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
-- case_name: check boot order PEX order first
- case_sn: 43
- expected_code: 200
- expected_result: '{ "Attributes": { "BootTypeOrder0": "PXE", "BootTypeOrder1":
- "HardDiskDrive", "BootTypeOrder2": "DVDROMDrive", "BootTypeOrder3":
- "Others", }}'
- group: remote interface management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
-- case_name: check BMC Firmware version
- case_sn: 44
- expected_code: 200
- expected_result: '{"count": 1, "FirmwareVersion": "1.30.11P01 HDM V100R001B03D011SP01"}'
- group: remote interface management
- header: null
- method: GET
- request_body: null
- url: https://{bmc_ip}{manager_id}
-- case_name: change BMC account
- case_sn: 45
- expected_code: 200
- expected_result: '{"UserName": "CM_cc@1234","RoleId": "Administrator",}'
- group: remote interface management
- header: null
- method: PATCH
- request_body: '{"UserName": "CM_cc@1234","Password": "1234@CM_cc","RoleId": "Administrator",}'
- url: https://{bmc_ip}/redfish/v1/AccountService/Accounts/3
-- case_name: configure BMC ip in static, ipv4
- case_sn: 46
- expected_code: 200
- expected_result: '{"count": 1, "IPv4Addresses": [ { "Address":
- "192.168.66.120", "AddressOrigin": "Static", "Gateway":
- "192.168.66.1", "SubnetMask": "255.255.255.128" } ]}'
- group: remote interface management
- header: null
- method: PATCH
- request_body: '{ "IPv4Addresses": [ { "Address": "192.168.66.120", "AddressOrigin":
- "Static", "Gateway": "192.168.66.1", "SubnetMask": "255.255.255.128" } ]}'
- url: https://{bmc_ip}{manager_id}/EthernetInterfaces/eth1
-- case_name: configure BMC ip in DHCP, gateway and subnet mask ipv4
- case_sn: 47
- expected_code: 200
- expected_result: '{"count": 1, "IPv4Addresses": [ { "Address":
- "192.168.66.120", "AddressOrigin": "DHCP", "Gateway": "192.168.66.1", "SubnetMask":
- "255.255.255.128" } ]}'
- group: remote interface management
- header: null
- method: PATCH
- request_body: '{ "IPv4Addresses": [ { "AddressOrigin": "DHCP" } ]}'
- url: https://{bmc_ip}{manager_id}/EthernetInterfaces/eth1
-- case_name: configure BMC ip in static, ipv4
- case_sn: 48
- expected_code: 200
- expected_result: '{"count": 1, "IPv4Addresses": [ { "AddressOrigin":
- "DHCP", } ]}'
- group: remote interface management
- header: null
- method: PATCH
- request_body: '{ "IPv4Addresses": [ { "AddressOrigin": "DHCP" } ]}'
- url: https://{bmc_ip}{manager_id}/EthernetInterfaces/eth1
-- case_name: configure BMC ip in static, ipv6
- case_sn: 49
- expected_code: 200
- expected_result: '{"count": 1, "IPv6Addresses": [ { "Address":
- "N/A", "AddressOrigin": "N/A", "PrefixLength": 64 }, { "Address":
- "2019::11", "AddressOrigin": "Static", "PrefixLength": 64 } ]}'
- group: remote interface management
- header: null
- method: PATCH
- request_body: '{ "IPv6Addresses": [ { "Address": "2019::11", "AddressOrigin":
- "Static", "PrefixLength": 64 } ]}'
- url: https://{bmc_ip}{manager_id}/EthernetInterfaces/eth1
+ url: /redfish/v1/Systems/{system_id}/Memory/{memory_id}
+ key_flag_dict: {"system_id" : "Members", "memory_id" : "Members"}
+
+# - case_name: check raid card amount
+# case_sn: 15
+# expected_code: 200
+# expected_result: '{"Members@odata.count": 1}'
+# group: compoment management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Storages
+# - case_name: check raid card information
+# case_sn: 16
+# expected_code: 200
+# expected_result: '{ "count": 1, "StorageControllers": [ { "FirmwareVersion":
+# "2.62", "Manufacturer": "H3C", "Model": "N/A", "Status":
+# { "Health": "OK", "State": "Enabled" } } ]}'
+# group: compoment management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}{storage_id}
+# - case_name: check harddisk information
+# case_sn: 17
+# expected_code: 200
+# expected_result: '{ "count": 4, "CapacityBytes": [480102187008, 960193626112], "Location":
+# { "Info": "N/A", "InfoFormat": "DeviceName" }, "Manufacturer":
+# "ATA", "MediaType": "SSD", "Model": ["INTEL SSDSC2KB48", "INTEL SSDSC2KB96"], "Protocol":
+# "SATA", "Status": { "Health": "OK", "State": "Enabled" }}'
+# group: compoment management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}{drives_id}
+# - case_name: check network interface adapter information
+# case_sn: 18
+# expected_code: 200
+# expected_result: '{ "count": 3, "Manufacturer": "Mellanox", "Model": "NIC-620F-B2-25Gb-2P-1-X", "Name":
+# ["PCIeSlot2", "PCIeSlot3", "PCIeSlot6"], "Oem": { "Public": { "CardModel":
+# "2*25GE", "RootBDF": ["0000:17:00.0", "0000:17:02.0", "0000:AE:02.0"], } }, "Status":
+# { "Health": "OK", "State": "Enabled" }}'
+# group: compoment management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}{networkadapters_id}
+# - case_name: check network interface adapter port information
+# case_sn: 19
+# expected_code: 200
+# expected_result: '{ "count": 6, "AssociatedNetworkAddresses": [ "N/A" ], "Oem":
+# { "Public": { "BDF": "N/A", "PortType": "OpticalPort" } }, "PhysicalPortNumber":
+# ["1", "2"]}'
+# group: compoment management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}{networkports_id}
+# - case_name: check fans information
+# case_sn: 20
+# expected_code: 200
+# expected_result: '{ "FanSummary": { "Count": 6 }, "Fans": [ { "MemberId":
+# "N/A", "Oem": { "Public": { "SpeedRatio":
+# "N/A" } }, "Status": { "Health":
+# "OK", "State": "Enabled" } }, { "MemberId":
+# "N/A", "Oem": { "Public": { "SpeedRatio":
+# "N/A" } }, "Status": { "Health":
+# "OK", "State": "Enabled" } },{ "MemberId":
+# "N/A", "Oem": { "Public": { "SpeedRatio":
+# "N/A" } }, "Status": { "Health":
+# "OK", "State": "Enabled" } },{ "MemberId":
+# "N/A", "Oem": { "Public": { "SpeedRatio":
+# "N/A" } }, "Status": { "Health":
+# "OK", "State": "Enabled" } },{ "MemberId":
+# "N/A", "Oem": { "Public": { "SpeedRatio":
+# "N/A" } }, "Status": { "Health":
+# "OK", "State": "Enabled" } },{ "MemberId":
+# "N/A", "Oem": { "Public": { "SpeedRatio":
+# "N/A" } }, "Status": { "Health":
+# "OK", "State": "Enabled" } } ],}'
+# group: compoment management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}/Thermal
+# - case_name: check power amount
+# case_sn: 21
+# expected_code: 200
+# expected_result: '{ "DeviceMaxNum": { "PowerSupplyNum": 2},}'
+# group: compoment management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}
+# - case_name: check power detail info
+# case_sn: 22
+# expected_code: 200
+# expected_result: '{ "PowerControl": [ { "PowerConsumedWatts":
+# "N/A","Status":{ "Health": "OK", "State": "Enabled" } }, ], "PowerSupplies":
+# [ { "LineInputVoltage": "N/A", "MemberId": "1", "PowerCapacityWatts":
+# 800,"Status": { "Health": "OK", "State": "Enabled" } }, { "LineInputVoltage":
+# "N/A", "MemberId": "2", "PowerCapacityWatts": 800,"Status":
+# { "Health": "OK", "State": "Enabled" } } ],}'
+# group: compoment management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}/Power
+# - case_name: check logical dirve health status
+# case_sn: 23
+# expected_code: 200
+# expected_result: '{ "count": 2, "Name": "N/A", "Status": { "Health":
+# ["OK", "Critical"], "State": "Enabled" }}'
+# group: compoment management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}{volume_id}
+# - case_name: check server temperature air intake
+# case_sn: 24
+# expected_code: 200
+# expected_result: '{ "Temperatures": [ { "Name": "INPUT_TEMP", "ReadingCelsius":
+# "N/A", } ]}'
+# group: sensor management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}/Thermal
+# - case_name: check cpu temperature
+# case_sn: 25
+# expected_code: 200
+# expected_result: '{ "Temperatures": [ { "Name": "INPUT_TEMP", "ReadingCelsius":
+# "N/A", }, { "Name": "CPU1_TEMP", "ReadingCelsius":
+# "N/A", }, { "Name": "CPU2_TEMP", "ReadingCelsius":
+# "N/A", }, ]}'
+# group: sensor management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Chassis/{chassis_id}/Thermal
+# - case_name: check server power state
+# case_sn: 26
+# expected_code: 200
+# expected_result: '{"PowerState": "On"}'
+# group: power management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}
+# - case_name: remote power on server
+# case_sn: 27
+# expected_code: 200
+# expected_result: '{"error":{"@Message.ExtendedInfo": [{"Message": "Successfully
+# Completed Request", "Severity":"OK"}]}}'
+# group: power management
+# header: null
+# method: POST
+# request_body: '{"ResetType": "On"}'
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Actions/ComputerSystem.Reset
+# - case_name: remote power off server
+# case_sn: 28
+# expected_code: 200
+# expected_result: '{"error":{"@Message.ExtendedInfo": [{"Message": "Successfully
+# Completed Request", "Severity":"OK"}]}}'
+# group: power management
+# header: null
+# method: POST
+# request_body: '{"ResetType": "GracefulShutdown"}'
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Actions/ComputerSystem.Reset
+# - case_name: remote reset server
+# case_sn: 29
+# expected_code: 200
+# expected_result: '{"error":{"@Message.ExtendedInfo": [{"Message": "Successfully
+# Completed Request", "Severity":"OK"}]}}'
+# group: power management
+# header: null
+# method: POST
+# request_body: '{"ResetType": "ForceRestart"}'
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Actions/ComputerSystem.Reset
+# - case_name: remote configure CPU in hyperthreading disabled
+# case_sn: 30
+# expected_code: 200
+# expected_result: '{"Attributes": {"ProcessorHyperThreading": "Disabled"}}'
+# group: remote configure
+# header: null
+# method: PATCH
+# request_body: '{ "Attributes": { "ProcessorHyperThreading": "Disabled" }}'
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
+# - case_name: remote get CPU hyperthreading in disabled
+# case_sn: 31
+# expected_code: 200
+# expected_result: '{"Attributes": {"ProcessorHyperThreading": "Disabled"}}'
+# group: remote configure
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
+# - case_name: remote configure CPU in hyperthreading enabled
+# case_sn: 32
+# expected_code: 200
+# expected_result: '{"Attributes": {"ProcessorHyperThreading": "Enabled"}}'
+# group: remote configure
+# header: null
+# method: PATCH
+# request_body: '{ "Attributes": { "ProcessorHyperThreading": "Enabled" }}'
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
+# - case_name: remote get CPU hyperthreading in enabled
+# case_sn: 33
+# expected_code: 200
+# expected_result: '{"Attributes": {"ProcessorHyperThreading": "Enabled"}}'
+# group: remote configure
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
+# - case_name: disable PXE mode
+# case_sn: 34
+# expected_code: 200
+# expected_result: '{ "Attributes": { "IPv4PXESupport": "Disabled" }}'
+# group: remote configure
+# header: null
+# method: PATCH
+# request_body: '{ "Attributes": { "IPv4PXESupport": "Disabled" }}'
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
+# - case_name: check IPV4 PXE mode in disabled
+# case_sn: 35
+# expected_code: 200
+# expected_result: '{ "Attributes": { "IPv4PXESupport": "Disabled" }}'
+# group: remote configure
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
+# - case_name: enable PXE mode
+# case_sn: 36
+# expected_code: 200
+# expected_result: '{ "Attributes": { "IPv4PXESupport": "Enabled" }}'
+# group: remote configure
+# header: null
+# method: PATCH
+# request_body: '{ "Attributes": { "IPv4PXESupport": "Enabled" }}'
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
+# - case_name: check ipv4 PXE mode in enabled
+# case_sn: 37
+# expected_code: 200
+# expected_result: '{ "Attributes": { "IPv4PXESupport": "Enabled" }}'
+# group: remote configure
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
+# - case_name: set boot type order
+# case_sn: 38
+# expected_code: 200
+# expected_result: '{ "Attributes": { "BootTypeOrder0": "HardDiskDrive", "BootTypeOrder1":
+# "DVDROMDrive", "BootTypeOrder2": "PXE", "BootTypeOrder3":
+# "Others", }}'
+# group: remote interface management
+# header: null
+# method: PATCH
+# request_body: '{ "Attributes": { "BootTypeOrder0": "HardDiskDrive", "BootTypeOrder1":
+# "DVDROMDrive", "BootTypeOrder2": "PXE", "BootTypeOrder3":
+# "Others", }}'
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
+# - case_name: check boot order
+# case_sn: 39
+# expected_code: 200
+# expected_result: '{ "Attributes": { "BootTypeOrder0": "HardDiskDrive", "BootTypeOrder1":
+# "DVDROMDrive", "BootTypeOrder2": "PXE", "BootTypeOrder3":
+# "Others", }}'
+# group: remote interface management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
+# - case_name: configure boot order
+# case_sn: 40
+# expected_code: 200
+# expected_result: '{ "Attributes": { "BootTypeOrder0": "DVDROMDrive", "BootTypeOrder1":
+# "HardDiskDrive", "BootTypeOrder2": "Others", "BootTypeOrder3":
+# "PXE", }}'
+# group: remote interface management
+# header: null
+# method: PATCH
+# request_body: '{ "Attributes": { "BootTypeOrder0": "DVDROMDrive", "BootTypeOrder1":
+# "HardDiskDrive", "BootTypeOrder2": "Others", "BootTypeOrder3":
+# "PXE", }}'
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
+# - case_name: check boot order
+# case_sn: 41
+# expected_code: 200
+# expected_result: '{ "Attributes": { "BootTypeOrder0": "DVDROMDrive", "BootTypeOrder1":
+# "HardDiskDrive", "BootTypeOrder2": "Others", "BootTypeOrder3":
+# "PXE", }}'
+# group: remote interface management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
+# - case_name: configure new boot PXE order first
+# case_sn: 42
+# expected_code: 200
+# expected_result: '{ "Attributes": { "BootTypeOrder0": "PXE", "BootTypeOrder1":
+# "HardDiskDrive", "BootTypeOrder2": "DVDROMDrive", "BootTypeOrder3":
+# "Others", }}'
+# group: remote interface management
+# header: null
+# method: PATCH
+# request_body: '{ "Attributes": { "BootTypeOrder0": "PXE", "BootTypeOrder1":
+# "HardDiskDrive", "BootTypeOrder2": "DVDROMDrive", "BootTypeOrder3":
+# "Others", }}'
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios/Settings
+# - case_name: check boot order PEX order first
+# case_sn: 43
+# expected_code: 200
+# expected_result: '{ "Attributes": { "BootTypeOrder0": "PXE", "BootTypeOrder1":
+# "HardDiskDrive", "BootTypeOrder2": "DVDROMDrive", "BootTypeOrder3":
+# "Others", }}'
+# group: remote interface management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}/redfish/v1/Systems/{system_id}/Bios
+# - case_name: check BMC Firmware version
+# case_sn: 44
+# expected_code: 200
+# expected_result: '{"count": 1, "FirmwareVersion": "1.30.11P01 HDM V100R001B03D011SP01"}'
+# group: remote interface management
+# header: null
+# method: GET
+# request_body: null
+# url: https://{bmc_ip}{manager_id}
+# - case_name: change BMC account
+# case_sn: 45
+# expected_code: 200
+# expected_result: '{"UserName": "CM_cc@1234","RoleId": "Administrator",}'
+# group: remote interface management
+# header: null
+# method: PATCH
+# request_body: '{"UserName": "CM_cc@1234","Password": "1234@CM_cc","RoleId": "Administrator",}'
+# url: https://{bmc_ip}/redfish/v1/AccountService/Accounts/3
+# - case_name: configure BMC ip in static, ipv4
+# case_sn: 46
+# expected_code: 200
+# expected_result: '{"count": 1, "IPv4Addresses": [ { "Address":
+# "192.168.66.120", "AddressOrigin": "Static", "Gateway":
+# "192.168.66.1", "SubnetMask": "255.255.255.128" } ]}'
+# group: remote interface management
+# header: null
+# method: PATCH
+# request_body: '{ "IPv4Addresses": [ { "Address": "192.168.66.120", "AddressOrigin":
+# "Static", "Gateway": "192.168.66.1", "SubnetMask": "255.255.255.128" } ]}'
+# url: https://{bmc_ip}{manager_id}/EthernetInterfaces/eth1
+# - case_name: configure BMC ip in DHCP, gateway and subnet mask ipv4
+# case_sn: 47
+# expected_code: 200
+# expected_result: '{"count": 1, "IPv4Addresses": [ { "Address":
+# "192.168.66.120", "AddressOrigin": "DHCP", "Gateway": "192.168.66.1", "SubnetMask":
+# "255.255.255.128" } ]}'
+# group: remote interface management
+# header: null
+# method: PATCH
+# request_body: '{ "IPv4Addresses": [ { "AddressOrigin": "DHCP" } ]}'
+# url: https://{bmc_ip}{manager_id}/EthernetInterfaces/eth1
+# - case_name: configure BMC ip in static, ipv4
+# case_sn: 48
+# expected_code: 200
+# expected_result: '{"count": 1, "IPv4Addresses": [ { "AddressOrigin":
+# "DHCP", } ]}'
+# group: remote interface management
+# header: null
+# method: PATCH
+# request_body: '{ "IPv4Addresses": [ { "AddressOrigin": "DHCP" } ]}'
+# url: https://{bmc_ip}{manager_id}/EthernetInterfaces/eth1
+# - case_name: configure BMC ip in static, ipv6
+# case_sn: 49
+# expected_code: 200
+# expected_result: '{"count": 1, "IPv6Addresses": [ { "Address":
+# "N/A", "AddressOrigin": "N/A", "PrefixLength": 64 }, { "Address":
+# "2019::11", "AddressOrigin": "Static", "PrefixLength": 64 } ]}'
+# group: remote interface management
+# header: null
+# method: PATCH
+# request_body: '{ "IPv6Addresses": [ { "Address": "2019::11", "AddressOrigin":
+# "Static", "PrefixLength": 64 } ]}'
+# url: https://{bmc_ip}{manager_id}/EthernetInterfaces/eth1
diff --git a/hdv/redfish/conf/config.yaml b/hdv/redfish/conf/config.yaml
index b57b71c..4f71234 100644
--- a/hdv/redfish/conf/config.yaml
+++ b/hdv/redfish/conf/config.yaml
@@ -1,9 +1,7 @@
---
-bmc_ip: 172.29.160.22
+bmc_ip: https://172.29.160.22
bmc_user: root
bmc_pwd: Huawei12#$
-system_id: 1
-chassis_id: 1
attr_name: 3
pro_seq: 4
url_seq: 5
diff --git a/hdv/redfish/hdv_redfish.py b/hdv/redfish/hdv_redfish.py
index 5fc44ca..db819da 100644
--- a/hdv/redfish/hdv_redfish.py
+++ b/hdv/redfish/hdv_redfish.py
@@ -192,7 +192,7 @@ def get_component_ids_excel(excel_file):
return id_info_list
-def create_real_url(url_value, id_dict, config_file):
+def create_real_url(url_value, id_dict, config_file, key_flag_dict, http_handler, bmc_ip):
'''
create the real url
either a static url, or a replaced url by depended_id
@@ -204,28 +204,48 @@ def create_real_url(url_value, id_dict, config_file):
pattern = re.compile(regexp, DT)
LOGGER.info("url_value %s", url_value)
matches = list(pattern.finditer(url_value))
+
for match in matches:
value = match.groupdict()
- if value['var'] in config_file:
- url_value = url_value.replace('{' + str(value['var']) + '}',
- str(config_file[value['var']]))
+ #stripping out value['var'] from end of the URL
+ parent_url = match.group().rstrip('{' +value['var']+ '}')
- elif value['var'] in id_dict:
+ if value['var'] in id_dict:
replaced = 1
- instance_list = id_dict[value['var']]
- for instance in instance_list:
- sgl_url = url_value.replace('{' + str(value['var']) + '}',
- str(instance))
- LOGGER.debug("replaced url value %s", sgl_url)
- url_list.append(sgl_url)
- else:
+ url_list = id_dict[value['var']].copy()
+
+ elif value['var'] in key_flag_dict:
replaced = 2
+ if(len(url_list) == 0):
+ url_list.append(parent_url)
+ else:
+ for index in range(len(url_list)):
+ url_list[index] = url_list[index] + parent_url
+
+ response_list = handle_depend_url("GET", url_list, http_handler, bmc_ip)
+ url_list = create_obj_id_list(key_flag_dict[value['var']], response_list)
+
+ if url_list is None or url_list.__len__() == 0:
+ LOGGER.error("%s,%s", ERROR_CODE['E300003'], value['var'])
+ continue
+ id_dict.update({value['var']: url_list.copy()})
+ LOGGER.debug("id_dict content is %s", id_dict)
+ else:
+ replaced = 3
LOGGER.error("%s for parameter %s",
- ERROR_CODE['E300002'], value['var'])
+ ERROR_CODE['E300002'], value['var'])
+
+ LOGGER.debug('url_list content is %s', url_list)
+
# combine single case with list case together.
if replaced == 0:
LOGGER.info("adding static url %s into list", url_value)
url_list.append(url_value)
+
+ for index in range(len(url_list)):
+ url_list[index] = url_list[index] + url_value.split('}')[-1]
+
+ LOGGER.debug("created real url list is %s", url_list)
return url_list
@@ -247,14 +267,14 @@ def execute_get_url(url, http_handler):
return ret_dict
-def handle_depend_url(method, url_list, http_handler):
+def handle_depend_url(method, url_list, http_handler, bmc_ip):
'''
run request url in url_list and collect the response as list
'''
response_list = []
if method == 'GET':
for url_case in url_list:
- response = execute_get_url(url_case, http_handler)
+ response = execute_get_url(bmc_ip + url_case, http_handler)
response_list.append(response)
elif method == 'POST':
pass
@@ -302,35 +322,6 @@ def create_obj_id_list(key_flags, response_list):
LOGGER.error("%s %s", ERROR_CODE['E400003'], key_flags)
return end_id_list
-
-def get_depend_id(config_file, http_handler, depend_ids):
- '''
- @param mode: yaml or excel,default value "excel"
- parse the component id list
- build up the id resource for each component_id
- return: id_dict like {component_id:[obj_list]}
- '''
- id_dict = {}
- for case in depend_ids:
- component_name = case.get('component_id')
- LOGGER.info("parsing component %s", component_name)
- pro_value = case.get('pro_value')
- url_value = case.get('url_value')
- key_flags = case.get('key_flags')
- # url_list = []
- url_list = create_real_url(url_value, id_dict, config_file)
- # response_list = []
- response_list = handle_depend_url(pro_value, url_list, http_handler)
- # end_id_list = []
- end_id_list = create_obj_id_list(key_flags, response_list)
- if end_id_list is None or end_id_list.__len__() == 0:
- LOGGER.error("%s,%s", ERROR_CODE['E300003'], component_name)
- continue
- id_dict.update({component_name: end_id_list})
- LOGGER.debug("id_dict content is %s", id_dict)
- return id_dict
-
-
def read_row(input_ws, row, config_file):
'''
read a row value
@@ -392,25 +383,26 @@ def execute_patch_url(body, http_handler, url):
return ret_dict
-def handle_final_url(method, url_list, req_body=None, http_handler=None):
+def handle_final_url(bmc_ip, method, url_list, req_body=None, http_handler=None):
'''execute the requested url to get the response
'''
+
response_list = []
if method == 'GET':
for url_case in url_list:
- rsp = execute_get_url(url_case, http_handler)
+ rsp = execute_get_url(bmc_ip + url_case, http_handler)
response_list.append(rsp)
elif method == 'POST':
if len(url_list) > 1:
LOGGER.error(ERROR_CODE['E100002'])
return None
url_value = url_list[0]
- rsp = execute_post_url(req_body, http_handler, url_value)
+ rsp = execute_post_url(req_body, http_handler, bmc_ip + url_value)
response_list.append(rsp)
elif method == 'PATCH':
for url_case in url_list:
LOGGER.info(url_case)
- temp = execute_patch_url(req_body, http_handler, url_case)
+ temp = execute_patch_url(req_body, http_handler, bmc_ip + url_case)
if temp is not None:
response_list.append(temp)
elif method == 'DELETE':
@@ -512,31 +504,32 @@ def write_result_2_excel(config_file, input_ws, row, flag, result):
def execute_final_url(config_file, depends_id, http_handler,
- method, url, req_body):
+ method, url, req_body, key_flag_dict, bmc_ip):
'''
execute final url to get the request result
'''
- url_list = create_real_url(url, depends_id, config_file)
- rsp_list = handle_final_url(method, url_list, req_body, http_handler)
+ url_list = create_real_url(url, depends_id, config_file, key_flag_dict, http_handler, bmc_ip)
+ rsp_list = handle_final_url(bmc_ip, method, url_list, req_body, http_handler)
return rsp_list
-def run_test_case_yaml(config_file, case_file, depends_id, http_handler):
+def run_test_case_yaml(config_file, case_file, depends_id, http_handler, bmc_ip):
'''run test case from cases.yaml
'''
LOGGER.info("############### start perform test case #################")
cases_result = []
cases = read_yaml(case_file)
for case in cases:
- method, url, req_body, expected_code, expected_value, tc_name \
+ method, url, req_body, expected_code, expected_value, tc_name, key_flag_dict \
= case['method'], case['url'], case['request_body'], \
- case['expected_code'], case['expected_result'], case['case_name']
+ case['expected_code'], case['expected_result'], case['case_name'], case['key_flag_dict']
expected_value = literal_eval(expected_value)
+
flag = 0
final_rst = {}
rsp_list = execute_final_url(config_file, depends_id,
- http_handler, method, url, req_body)
+ http_handler, method, url, req_body, key_flag_dict, bmc_ip)
if rsp_list is not None and len(rsp_list) > 0:
return_value_list, return_code_list, final_rst, flag = \
parse_test_result(
@@ -639,7 +632,7 @@ def run(conf_file, case_excel_file=None, depend_yaml_file=None,
ACCOUNT_INFO.update({"UserName": bmc_user})
ACCOUNT_INFO.update({"Password": bmc_pwd})
- url = "https://{0}/redfish/v1/SessionService/Sessions".format(bmc_ip)
+ url = "{0}/redfish/v1/SessionService/Sessions".format(bmc_ip)
x_auth_token = get_token(http_handler, url)
LOGGER.info("x_auth_token: %s", x_auth_token)
@@ -649,16 +642,8 @@ def run(conf_file, case_excel_file=None, depend_yaml_file=None,
HEADERS.update({"X-Auth-Token": x_auth_token})
id_info_list = None
- if file_mode == "excel":
- id_info_list = get_component_ids_excel(case_excel_file)
- elif file_mode == "yaml":
- id_info_list = get_component_ids_yaml(depend_yaml_file)
- else:
- LOGGER.error("%s,%s", ERROR_CODE['E200001'], file_mode)
- return None
- # get dependent id
- depends_id = get_depend_id(config_file, http_handler, id_info_list)
+ depends_id = {}
# read the test case sheet and perform test
if file_mode == "excel":
@@ -666,7 +651,7 @@ def run(conf_file, case_excel_file=None, depend_yaml_file=None,
case_excel_file, depends_id, http_handler)
elif file_mode == "yaml":
run_test_case_yaml(config_file,
- case_yaml_file, depends_id, http_handler)
+ case_yaml_file, depends_id, http_handler, bmc_ip)
else:
LOGGER.error("%s,%s", ERROR_CODE['E200001'], file_mode)
return None