1f58cce03SPrashanth Katti*** Settings *** 2f58cce03SPrashanth KattiDocumentation Network interface configuration and verification 3f58cce03SPrashanth Katti ... tests. 4f58cce03SPrashanth Katti 5f58cce03SPrashanth KattiResource ../../lib/bmc_redfish_resource.robot 6f58cce03SPrashanth KattiResource ../../lib/bmc_network_utils.robot 7f58cce03SPrashanth KattiResource ../../lib/openbmc_ffdc.robot 8f58cce03SPrashanth Katti 9f58cce03SPrashanth KattiTest Setup Test Setup Execution 10f58cce03SPrashanth KattiTest Teardown Test Teardown Execution 11f58cce03SPrashanth Katti 12f58cce03SPrashanth Katti*** Test Cases *** 13f58cce03SPrashanth Katti 14f58cce03SPrashanth KattiGet IP Address And Verify 15f58cce03SPrashanth Katti [Documentation] Get IP Address And Verify. 16f58cce03SPrashanth Katti [Tags] Get_IP_Address_And_Verify 17f58cce03SPrashanth Katti 18f58cce03SPrashanth Katti : FOR ${network_configuration} IN @{network_configurations} 19f58cce03SPrashanth Katti \ Validate IP On BMC ${network_configuration['Address']} 20f58cce03SPrashanth Katti 21f58cce03SPrashanth KattiGet Netmask And Verify 22f58cce03SPrashanth Katti [Documentation] Get Netmask And Verify. 23f58cce03SPrashanth Katti [Tags] Get_Netmask_And_Verify 24f58cce03SPrashanth Katti 25f58cce03SPrashanth Katti : FOR ${network_configuration} IN @{network_configurations} 26f58cce03SPrashanth Katti \ Validate Netmask On BMC ${network_configuration['SubnetMask']} 27f58cce03SPrashanth Katti 28f58cce03SPrashanth Katti*** Keywords *** 29f58cce03SPrashanth Katti 30f58cce03SPrashanth KattiTest Setup Execution 31f58cce03SPrashanth Katti [Documentation] Test setup execution. 32f58cce03SPrashanth Katti 33f58cce03SPrashanth Katti redfish.Login 34f58cce03SPrashanth Katti 35f58cce03SPrashanth Katti @{network_configurations}= Get Network Configuration 36f58cce03SPrashanth Katti Set Test Variable @{network_configurations} 37f58cce03SPrashanth Katti 38f58cce03SPrashanth Katti # Get BMC IP address and prefix length. 39f58cce03SPrashanth Katti ${ip_data}= Get BMC IP Info 40f58cce03SPrashanth Katti Set Test Variable ${ip_data} 41f58cce03SPrashanth Katti 42f58cce03SPrashanth KattiGet Network Configuration 43f58cce03SPrashanth Katti [Documentation] Get network configuration. 44f58cce03SPrashanth Katti 45f58cce03SPrashanth Katti # Sample output: 46f58cce03SPrashanth Katti #{ 47f58cce03SPrashanth Katti # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface", 48f58cce03SPrashanth Katti # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0", 49f58cce03SPrashanth Katti # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface", 50f58cce03SPrashanth Katti # "Description": "Management Network Interface", 51f58cce03SPrashanth Katti # "IPv4Addresses": [ 52f58cce03SPrashanth Katti # { 53f58cce03SPrashanth Katti # "Address": "169.254.xx.xx", 54f58cce03SPrashanth Katti # "AddressOrigin": "IPv4LinkLocal", 55f58cce03SPrashanth Katti # "Gateway": "0.0.0.0", 56f58cce03SPrashanth Katti # "SubnetMask": "255.255.0.0" 57f58cce03SPrashanth Katti # }, 58f58cce03SPrashanth Katti # { 59f58cce03SPrashanth Katti # "Address": "xx.xx.xx.xx", 60f58cce03SPrashanth Katti # "AddressOrigin": "Static", 61f58cce03SPrashanth Katti # "Gateway": "xx.xx.xx.1", 62f58cce03SPrashanth Katti # "SubnetMask": "xx.xx.xx.xx" 63f58cce03SPrashanth Katti # } 64f58cce03SPrashanth Katti # ], 65f58cce03SPrashanth Katti # "Id": "eth0", 66f58cce03SPrashanth Katti # "MACAddress": "xx:xx:xx:xx:xx:xx", 67f58cce03SPrashanth Katti # "Name": "Manager Ethernet Interface", 68f58cce03SPrashanth Katti # "SpeedMbps": 0, 69f58cce03SPrashanth Katti # "VLAN": { 70f58cce03SPrashanth Katti # "VLANEnable": false, 71f58cce03SPrashanth Katti # "VLANId": 0 72f58cce03SPrashanth Katti # } 73f58cce03SPrashanth Katti 74f58cce03SPrashanth Katti ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI} 75f58cce03SPrashanth Katti @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses 76f58cce03SPrashanth Katti [Return] @{network_configurations} 77f58cce03SPrashanth Katti 78*5d46755bSGeorge Keishing 79f58cce03SPrashanth KattiValidate IP On BMC 80f58cce03SPrashanth Katti [Documentation] Validate IP on BMC. 81f58cce03SPrashanth Katti [Arguments] ${ip} 82f58cce03SPrashanth Katti 83f58cce03SPrashanth Katti # Description of the argument(s): 84f58cce03SPrashanth Katti # ip IP address to be verified. 85f58cce03SPrashanth Katti 86f58cce03SPrashanth Katti # Get IP address details on BMC using IP command. 87f58cce03SPrashanth Katti @{ip_data}= Get BMC IP Info 88f58cce03SPrashanth Katti Should Contain Match ${ip_data} ${ip}/* 89f58cce03SPrashanth Katti ... msg=IP address does not exist. 90f58cce03SPrashanth Katti 91*5d46755bSGeorge Keishing 92f58cce03SPrashanth KattiValidate Netmask On BMC 93f58cce03SPrashanth Katti [Documentation] Validate netmask on BMC. 94f58cce03SPrashanth Katti [Arguments] ${netmask} 95f58cce03SPrashanth Katti 96f58cce03SPrashanth Katti # Description of the argument(s): 97f58cce03SPrashanth Katti # netmask netmask value to be verified. 98f58cce03SPrashanth Katti 99f58cce03SPrashanth Katti # TBD- openbmc/openbmc-test-automation#1541 100f58cce03SPrashanth Katti 101*5d46755bSGeorge Keishing 102f58cce03SPrashanth KattiTest Teardown Execution 103f58cce03SPrashanth Katti [Documentation] Test teardown execution. 104f58cce03SPrashanth Katti 105f58cce03SPrashanth Katti FFDC On Test Case Fail 106f58cce03SPrashanth Katti redfish.Logout 107