fwupdate-tools: Support for multiple components

At present ComponentIdentifier is used in
ApplicableComponents field to select images that
apply for a firmware device. Which restricts to
have same ComponentIdentifier for multiple
components. This patch will enable to use
ComponentImageInformationArea index in
ApplicableComponents field.

Unit Tests:
  1. Modify ApplicableComponents with index and
     verify the package with previous package.
     There should not be any difference
  2. Verify multiple components with same
     component identifier
  3. Test out of index for ApplicableComponents

Signed-off-by: Chinmay Shripad Hegde <hosmanechinmay@gmail.com>
Change-Id: Ibf5069d568f0a922d52db261219c2557d2d2f715
diff --git a/tools/fw-update/pldm_fwup_pkg_creator.py b/tools/fw-update/pldm_fwup_pkg_creator.py
index 4c3d233..42e8a5a 100755
--- a/tools/fw-update/pldm_fwup_pkg_creator.py
+++ b/tools/fw-update/pldm_fwup_pkg_creator.py
@@ -215,9 +215,11 @@
         component_bitmap_bit_length, endian="little"
     )
     applicable_components.setall(0)
-    for component in components:
-        if component["ComponentIdentifier"] in applicable_components_list:
-            applicable_components[components.index(component)] = 1
+    for component_index in applicable_components_list:
+        if 0 <= component_index < len(components):
+            applicable_components[component_index] = 1
+        else:
+            sys.exit("ERROR: Applicable Component index not found.")
     return applicable_components