@@ -121,6 +121,11 @@ Manager::Manager(
121
121
this ->performVpdRecollection ();
122
122
});
123
123
124
+ iFace->register_method (" performVpdSanityCheck" ,
125
+ [this ](const types::Path i_vpdPath) {
126
+ this ->performVpdSanityCheck (i_vpdPath);
127
+ });
128
+
124
129
// Indicates FRU VPD collection for the system has not started.
125
130
iFace->register_property_rw <std::string>(
126
131
" CollectionStatus" , sdbusplus::vtable::property_::emits_change,
@@ -640,4 +645,42 @@ void Manager::performVpdRecollection()
640
645
m_worker->performVpdRecollection ();
641
646
}
642
647
}
648
+
649
+ int Manager::performVpdSanityCheck (const types::Path i_vpdPath)
650
+ {
651
+ try
652
+ {
653
+ if (i_vpdPath.empty ())
654
+ {
655
+ throw std::runtime_error (" Given FRU path is empty" );
656
+ }
657
+
658
+ nlohmann::json l_sysCfgJsonObj{};
659
+
660
+ if (m_worker.get () != nullptr )
661
+ {
662
+ l_sysCfgJsonObj = m_worker->getSysCfgJsonObj ();
663
+ }
664
+
665
+ std::shared_ptr<Parser> l_parserObj =
666
+ std::make_shared<Parser>(i_vpdPath, l_sysCfgJsonObj);
667
+
668
+ std::shared_ptr<vpd::ParserInterface> l_vpdParserInstance =
669
+ l_parserObj->getVpdParserInstance ();
670
+
671
+ return l_vpdParserInstance->vpdSanityCheck ();
672
+ }
673
+ catch (const std::exception& l_exception)
674
+ {
675
+ EventLogger::createAsyncPel (
676
+ types::ErrorType::InvalidEeprom, types::SeverityType::Informational,
677
+ __FILE__, __FUNCTION__, 0 ,
678
+ " Sanity check failed for file[" + i_vpdPath +
679
+ " ], reason: " + std::string (l_exception.what ()),
680
+ std::nullopt , std::nullopt , std::nullopt , std::nullopt );
681
+
682
+ return constants::FAILURE;
683
+ }
684
+ }
685
+
643
686
} // namespace vpd
0 commit comments