PEL: Add function to get PEL size

Add a size() function to the PEL class that adds up the size fields
in the header of every PEL section.

This required a fix to some testcases where the size field was wrong in
a header.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I0d70deae116cd3835f2c0ab34e13811da471fb14
diff --git a/extensions/openpower-pels/pel.cpp b/extensions/openpower-pels/pel.cpp
index 262865f..d1c9620 100644
--- a/extensions/openpower-pels/pel.cpp
+++ b/extensions/openpower-pels/pel.cpp
@@ -153,6 +153,28 @@
     return pelData;
 }
 
+size_t PEL::size() const
+{
+    size_t size = 0;
+
+    if (_ph)
+    {
+        size += _ph->header().size;
+    }
+
+    if (_uh)
+    {
+        size += _uh->header().size;
+    }
+
+    for (const auto& section : _optionalSections)
+    {
+        size += section->header().size;
+    }
+
+    return size;
+}
+
 std::optional<SRC*> PEL::primarySRC() const
 {
     auto src = std::find_if(