Automation of pldmtool bios GetBIOSTable test cases.

    - verification part for GetBIOSTable for table type 'StringTable'.
    - Add TCs for GetBIOSTable for table type 'AttributeTable' and
      'AttributeValueTable'.

Change-Id: I2a5220ac9b518daec54407292ee0d2adb3061731
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/data/pldm_variables.py b/data/pldm_variables.py
index 515806f..7c2536e 100755
--- a/data/pldm_variables.py
+++ b/data/pldm_variables.py
@@ -128,3 +128,11 @@
     'PLDM_STATE_EFFECTER_PDR': '11',
     'PLDM_PDR_FRU_RECORD_SET': '20',
     'PLDM_PDR_ENTITY_ASSOCIATION': '15'}
+
+RESPONSE_LIST_GETBIOSTABLE_STRTABLE = [
+    'Allowed', 'Disabled', 'Enabled', 'IPv4DHCP', 'IPv4Static', 'Not Allowed',
+    'Perm', 'Temp', 'pvm-fw-boot-side', 'pvm-inband-code-update', 'pvm-os-boot-side',
+    'pvm-pcie-error-inject', 'pvm-surveillance', 'pvm-system-name', 'vmi-hostname',
+    'vmi-if-count', 'vmi-if0-ipv4-ipaddr', 'vmi-if0-ipv4-method',
+    'vmi-if0-ipv4-prefix-length', 'vmi-if1-ipv4-ipaddr', 'vmi-if1-ipv4-method',
+    'vmi-if1-ipv4-prefix-length', 'vmi-ipv4-gateway']
diff --git a/lib/pldm_utils.py b/lib/pldm_utils.py
index dd0a91f..99fa3ff 100644
--- a/lib/pldm_utils.py
+++ b/lib/pldm_utils.py
@@ -93,6 +93,34 @@
             dict_data1, dict_data2 = vf.split_dict_on_key('containerentitycontainerid', result)
             return dict_data1
 
+        # Collect bios strings from bios string table in to list.
+        # Example output for pldmtool GetBIOSTable --type stringTable
+        # PLDM StringTable:
+        # BIOSStringHandle : BIOSString
+        # 0 : Allowed
+        # 1 : Disabled
+        # 2 : Enabled
+        elif 'pldm_stringtable' in result:
+            result.pop('pldm_stringtable')
+            result.pop('biosstringhandle')
+            bios_string_list = []
+            for data in result:
+                bios_string_list.append(result[data])
+            # Example for bios_string_list:
+            # bios_string_list = ['Allowed', 'Disabled', 'Enabled']
+            return bios_string_list
+
+        # Check if parameter pldm_attributetable/pldm_attributevaluetable present for
+        # pldmtool GetBIOSTable --type AttributeTable/AttributeValueTable.
+        # Note: Ouput for AttributeTable/AttributeValueTable is huge and verification of
+        #       table content is not available.
+        elif 'pldm_attributetable' in result:
+            result['pldm_attributetable'] = True
+            return result
+        elif 'pldm_attributevaluetable' in result:
+            result['pldm_attributevaluetable'] = True
+            return result
+
         return result
 
     return stdout
diff --git a/pldm/test_pldm_bios.robot b/pldm/test_pldm_bios.robot
index ef02930..51de0f1 100644
--- a/pldm/test_pldm_bios.robot
+++ b/pldm/test_pldm_bios.robot
@@ -61,7 +61,7 @@
     [Documentation]  Verify GetBIOSTable for table type string table.
     [Tags]  Verify_GetBIOSTable_For_StringTable
 
-    # pldm_output:
+    # Example pldm_output:
     # [biosstringhandle]:                             BIOSString
     # [0]:                                            Allowed
     # [1]:                                            Disabled
@@ -77,10 +77,47 @@
     # [11]:                                           pvm-system-name
     # [12]:                                           vmi-if-count
 
-    ${pldm_output}=  Pldmtool  bios GetBIOSTable -t 0
+    ${pldm_output}=  Pldmtool  bios GetBIOSTable --type StringTable
+    Valid List  pldm_output  required_values=${RESPONSE_LIST_GETBIOSTABLE_STRTABLE}
+
+
+Verify GetBIOSTable For AttributeTable
+    [Documentation]  Verify if attribute table content exist for
+    ...            GetBIOSTable with table type attribute table.
+    [Tags]  Verify_GetBIOSTable_For_AttributeTable
+
+    # Example pldm_output:
+    # [pldm_attributetable]:                          True
+    # [attributehandle]:                               0
+    # [ AttributeNameHandle]:                          20(vmi-if1-ipv4-method)
+    # [     attributetype]:                            BIOSStringReadOnly
+    # [     StringType]:                               0x01
+    # [     minimumstringlength]:                      1
+    # [     maximumstringlength]:                      100
+    # [     defaultstringlength]:                      15
+    # [     defaultstring]:                            witherspoon-128
+
+    ${pldm_output}=  Pldmtool  bios GetBIOSTable --type AttributeTable
     Rprint Vars  pldm_output
-    # TODO: Implement verification for GetBIOSTable response message.
-    # Valid Dict  pldm_output  valid_values=${RESPONSE_DICT_GETBIOSTABLE_STRTABLE}
+    Valid Value  pldm_output['pldm_attributetable']  [True]
+
+
+Verify GetBIOSTable For AttributeValueTable
+    [Documentation]  Verify if attribute value table content exist for
+    ...              GetBIOSTable with table type attribute value table.
+    [Tags]  Verify_GetBIOSTable_For_AttributeValueTable
+
+    # Example pldm_output:
+    # [pldm_attributevaluetable]:                     True
+    # [attributehandle]:                              0
+    # [     attributetype]:                           BIOSStringReadOnly
+    # [     currentstringlength]:                     15
+    # [     currentstring]:                           witherspoon-128
+
+    ${pldm_output}=  Pldmtool  bios GetBIOSTable --type AttributeValueTable
+    Log To Console  ${pldm_output}
+    Rprint Vars  pldm_output
+    Valid Value  pldm_output['pldm_attributevaluetable']  [True]
 
 *** Keywords ***