Update robot codes with latest directives
Changes:
- Non local variable is not uppercase
- The assignment sign is not consistent within the file.
Expected = but instead of blank spaces
- Run KeyWord If is deprecated since Robot
Framework version 5.*, use 'IF' instead
Tested:
- Checked using robot dry-run to make sure the
syntax is not broken
Change-Id: I08a142a18a9066abdd6494bcddc167122564fd17
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/network/test_bmc_dhcp_conf.robot b/network/test_bmc_dhcp_conf.robot
index 808dded..7f38f53 100644
--- a/network/test_bmc_dhcp_conf.robot
+++ b/network/test_bmc_dhcp_conf.robot
@@ -8,27 +8,27 @@
Suite Setup Suite Setup Execution
Suite Teardown Run Keywords Restore Configuration AND Redfish.Logout
-Test Tags BMC_DHCP_Conf
+Test Tags BMC_DHCP_Conf
*** Variables ***
-&{dhcp_enable_dict} DHCPEnabled=${True}
-&{dhcp_disable_dict} DHCPEnabled=${False}
+&{DHCP_ENABLE_DICT} DHCPEnabled=${True}
+&{DHCP_DISABLE_DICT} DHCPEnabled=${False}
-&{dns_enable_dict} UseDNSServers=${True}
-&{dns_disable_dict} UseDNSServers=${False}
+&{DNS_ENABLE_DICT} UseDNSServers=${True}
+&{DNS_DISABLE_DICT} UseDNSServers=${False}
-&{ntp_enable_dict} UseNTPServers=${True}
-&{ntp_disable_dict} UseNTPServers=${False}
+&{NTP_ENABLE_DICT} UseNTPServers=${True}
+&{NTP_DISABLE_DICT} UseNTPServers=${False}
-&{domain_name_enable_dict} UseDomainName=${True}
-&{domain_name_disable_dict} UseDomainName=${False}
+&{DOMAIN_NAME_ENABLE_DICT} UseDomainName=${True}
+&{DOMAIN_NAME_DISABLE_DICT} UseDomainName=${False}
-&{enable_multiple_properties} UseDomainName=${True}
+&{ENABLE_MULTIPLE_PROPRETIES} UseDomainName=${True}
... UseNTPServers=${True}
... UseDNSServers=${True}
-&{disable_multiple_properties} UseDomainName=${False}
+&{DISABLE_MULTIPLE_PROPERTIES} UseDomainName=${False}
... UseNTPServers=${False}
... UseDNSServers=${False}
@@ -39,18 +39,17 @@
[Tags] Set_Network_Property_via_Redfish_And_Verify
[Template] Apply Ethernet Config
- # property
- ${dhcp_enable_dict}
- ${dhcp_disable_dict}
- ${dns_enable_dict}
- ${dns_disable_dict}
- ${domain_name_enable_dict}
- ${domain_name_disable_dict}
- ${ntp_enable_dict}
- ${ntp_disable_dict}
- ${enable_multiple_properties}
- ${disable_multiple_properties}
-
+ # property
+ ${DHCP_ENABLE_DICT}
+ ${DHCP_DISABLE_DICT}
+ ${DNS_ENABLE_DICT}
+ $NTP_ENABLE_DICT{DNS_DISABLE_DICT}
+ ${DOMAIN_NAME_ENABLE_DICT}
+ ${DOMAIN_NAME_DISABLE_DICT}
+ ${NTP_ENABLE_DICT}
+ ${NTP_DISABLE_DICT}
+ ${ENABLE_MULTIPLE_PROPRETIES}
+ ${DISABLE_MULTIPLE_PROPERTIES}
*** Keywords ***
@@ -61,20 +60,24 @@
Ping Host ${OPENBMC_HOST_ETH1}
Redfish.Login
- ${network_configurations}= Get Network Configuration Using Channel Number ${2}
+ ${network_configurations}=
+ ... Get Network Configuration Using Channel Number ${2}
FOR ${network_configuration} IN @{network_configurations}
- Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST_ETH1}'
- ... Run Keywords Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']}
- ... AND Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']}
- ... AND Exit For Loop
+ IF '${network_configuration['Address']}' == '${OPENBMC_HOST_ETH1}'
+ Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']}
+ Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']}
+ BREAK
+ END
END
- ${network_configurations}= Get Network Configuration Using Channel Number ${1}
+ ${network_configurations}=
+ ... Get Network Configuration Using Channel Number ${1}
FOR ${network_configuration} IN @{network_configurations}
- Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST}'
- ... Run Keywords Set Suite Variable ${eth0_subnet_mask} ${network_configuration['SubnetMask']}
- ... AND Set Suite Variable ${eth0_gateway} ${network_configuration['Gateway']}
- ... AND Exit For Loop
+ IF '${network_configuration['Address']}' == '${OPENBMC_HOST}'
+ Set Suite Variable ${eth0_subnet_mask} ${network_configuration['SubnetMask']}
+ Set Suite Variable ${eth0_gateway} ${network_configuration['Gateway']}
+ BREAK
+ END
END
Get Network Configuration Using Channel Number
@@ -82,13 +85,16 @@
[Arguments] ${channel_number}
# Description of argument(s):
- # channel_number Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1").
+ # channel_number Ethernet channel number, 1 is for eth0 and 2 is for
+ # eth1 (e.g. "1").
${active_channel_config}= Get Active Channel Config
- ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
+ ${ethernet_interface}=
+ ... Set Variable ${active_channel_config['${channel_number}']['name']}
${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
- @{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses
+ @{network_configurations}=
+ ... Get From Dictionary ${resp.dict} IPv4StaticAddresses
RETURN @{network_configurations}
Apply Ethernet Config
@@ -110,8 +116,12 @@
Restore Configuration
[Documentation] Restore the configuration to Both Static Network
- Run Keyword If '${CHANNEL_NUMBER}' == '1' Add IP Address ${OPENBMC_HOST} ${eth0_subnet_mask} ${eth0_gateway}
- ... ELSE IF '${CHANNEL_NUMBER}' == '2' Add IP Address ${OPENBMC_HOST_ETH1} ${eth1_subnet_mask} ${eth1_gateway}
+ IF '${CHANNEL_NUMBER}' == '1'
+ Add IP Address ${OPENBMC_HOST} ${eth0_subnet_mask} ${eth0_gateway}
+ ELSE IF '${CHANNEL_NUMBER}' == '2'
+ Add IP Address
+ ... ${OPENBMC_HOST_ETH1} ${eth1_subnet_mask} ${eth1_gateway}
+ END
Verify Ethernet Config Property
[Documentation] verify ethernet config properties.
@@ -133,8 +143,8 @@
# UseNTPServers :True
# UseDNSServers :True
- ${key_map}= Get Dictionary Items ${property}
- FOR ${key} ${value} IN @{key_map}
- Should Be Equal As Strings ${response_data['${key}']} ${value}
- END
+ ${key_map}= Get Dictionary Items ${property}
+ FOR ${key} ${value} IN @{key_map}
+ Should Be Equal As Strings ${response_data['${key}']} ${value}
+ END
diff --git a/network/test_cable_pull_recover.robot b/network/test_cable_pull_recover.robot
index d1fc2c8..db9f8ca 100644
--- a/network/test_cable_pull_recover.robot
+++ b/network/test_cable_pull_recover.robot
@@ -21,7 +21,7 @@
Suite Setup Test Setup Execution
-Test Tags Cable_Pull_Recover
+Test Tags Cable_Pull_Recover
*** Variables ***
@@ -53,10 +53,11 @@
Device Write enable
Device Write configure terminal
Device Write interface port ${PORT_NUMBER}
- Run Keyword If '${state}' == 'DOWN'
- ... Device Write shutdown
- ... ELSE
- ... Device Write no shutdown
+ IF '${state}' == 'DOWN'
+ Device Write shutdown
+ ELSE
+ Device Write no shutdown
+ END
Wait Until Keyword Succeeds 30 sec 5 sec
... Check Network Interface State ${state}
diff --git a/network/test_host_network_interfaces.robot b/network/test_host_network_interfaces.robot
index 7321301..6d9e6c7 100644
--- a/network/test_host_network_interfaces.robot
+++ b/network/test_host_network_interfaces.robot
@@ -29,7 +29,8 @@
@{interface_names}= Get OS Network Interface Names
FOR ${interface_name} IN @{interface_names}
${ethtool_dict}= Get OS Ethtool ${interface_name}
- Run Keyword If ${FAIL_ON__LINK_DOWN} == 1
- ... Should Be Equal ${ethtool_dict['link_detected']} yes
- ... msg=Link ${interface_name} is down.
+ IF ${FAIL_ON__LINK_DOWN} == 1
+ Should Be Equal ${ethtool_dict['link_detected']} yes
+ ... msg=Link ${interface_name} is down.
+ END
END
diff --git a/network/test_network_nping.robot b/network/test_network_nping.robot
index 6d1e72a..a401f9b 100644
--- a/network/test_network_nping.robot
+++ b/network/test_network_nping.robot
@@ -50,15 +50,13 @@
# and rate at which packets to be sent, should be given in command line
# by default it sends 100 TCP packets at 5 packets/second.
- ${cmd_buff}= Run Keyword If '${packet_type}' == 'icmp'
- ... Set Variable
- ... echo ${CLIENT_PASSWORD} | sudo -S nping --delay ${delay} ${host} -c ${count} --${packet_type}
- ... ELSE
- ... Set variable
- ... echo ${CLIENT_PASSWORD} | sudo -S nping --delay ${delay} ${host} -c ${count} -p ${port} --${packet_type}
- ${rc} ${output} Run And Return RC And Output ${cmd_buff}
+ ${cmd_buff}= Set Variable If '${packet_type}' == 'icmp'
+ ... echo ${CLIENT_PASSWORD} | sudo -S nping --delay ${delay} ${host} -c ${count} --${packet_type}
+ ... echo ${CLIENT_PASSWORD} | sudo -S nping --delay ${delay} ${host} -c ${count} -p ${port} --${packet_type}
+
+ ${rc} ${output}= Run And Return RC And Output ${cmd_buff}
Should Be Equal As Integers ${rc} 0 msg=Command execution failed.
- ${packet_loss} Get Packet Loss ${host} ${output}
+ ${packet_loss}= Get Packet Loss ${host} ${output}
RETURN ${packet_loss}
Get Packet Loss
diff --git a/network/test_vlan_network.robot b/network/test_vlan_network.robot
index 73106bc..c884100 100644
--- a/network/test_vlan_network.robot
+++ b/network/test_vlan_network.robot
@@ -278,8 +278,9 @@
... ${vlan_record['${uri}']['PrefixLength']}
END
- Run Keyword If @{uris} == @{EMPTY}
- ... Append To List ${initial_vlan_config} ${id} ${EMPTY} ${EMPTY}
+ IF @{uris} == @{EMPTY}
+ Append To List ${initial_vlan_config} ${id} ${EMPTY} ${EMPTY}
+ END
Suite Teardown Execution
@@ -290,15 +291,16 @@
${previous_id}= Set Variable ${EMPTY}
FOR ${index} IN RANGE 0 ${length} 3
-
- Run Keyword If '${initial_vlan_config[${index+1}]}' == '${EMPTY}'
- ... Create VLAN ${initial_vlan_config[${index}]}
- ... ELSE IF '${previous_id}' == '${initial_vlan_config[${index}]}'
- ... Configure Network Settings On VLAN ${initial_vlan_config[${index}]}
- ... ${initial_vlan_config[${index+1}]} ${initial_vlan_config[${index+2}]}
- ... ELSE Run Keywords Create VLAN ${initial_vlan_config[${index}]} AND
- ... Configure Network Settings On VLAN ${initial_vlan_config[${index}]}
- ... ${initial_vlan_config[${index+1}]} ${initial_vlan_config[${index+2}]}
+ IF '${initial_vlan_config[${index+1}]}' == '${EMPTY}'
+ Create VLAN ${initial_vlan_config[${index}]}
+ ELSE IF '${previous_id}' == '${initial_vlan_config[${index}]}'
+ Configure Network Settings On VLAN ${initial_vlan_config[${index}]}
+ ... ${initial_vlan_config[${index+1}]} ${initial_vlan_config[${index+2}]}
+ ELSE
+ Create VLAN ${initial_vlan_config[${index}]}
+ Configure Network Settings On VLAN ${initial_vlan_config[${index}]}
+ ... ${initial_vlan_config[${index+1}]} ${initial_vlan_config[${index+2}]}
+ END
${previous_id}= Set Variable ${initial_vlan_config[${index}]}
END
@@ -352,12 +354,12 @@
${status}= Run Keyword And Return Status Should Be True ${num_vlan_records} > 0
... msg=Could not find a uri for vlan "${vlan_id}" with IP "${vlan_ip}".
- Run Keyword If '${expected_result}' == 'valid'
- ... Should Be Equal ${status} ${True}
- ... msg=VLAN IP URI doesn't exist!.
- ... ELSE
- ... Should Be Equal ${status} ${False}
- ... msg=VLAN IP URI exists!.
+ IF '${expected_result}' == 'valid'
+ Should Be Equal ${status} ${True} msg=VLAN IP URI doesn't exist!.
+ ELSE
+ Should Be Equal ${status} ${False} msg=VLAN IP URI exists!.
+ END
+
${uris}= Get Dictionary Keys ${vlan_record}
Return From Keyword If @{uris} == @{EMPTY}
@@ -383,9 +385,8 @@
Should Be Equal ${rest_status} ${cli_status}
... msg=REST and CLI Output are not the same.
- Run Keyword If '${expected_result}' == 'valid'
- ... Should Be Equal ${rest_status} ${True}
- ... msg=VLAN ID doesn't exist!.
- ... ELSE
- ... Should Be Equal ${rest_status} ${False}
- ... msg=VLAN ID exists!.
+ IF '${expected_result}' == 'valid'
+ Should Be Equal ${rest_status} ${True} msg=VLAN ID doesn't exist!.
+ ELSE
+ Should Be Equal ${rest_status} ${False} msg=VLAN ID exists!.
+ END