@@ -59,6 +59,9 @@ class ProgramStatus : public Program
5959 options.add_options ()(" monitoring" ,
6060 po::bool_switch (&mOptions .monitoring ),
6161 " Toggle monitoring metrics sending" );
62+ options.add_options ()(" onu-status" ,
63+ po::bool_switch (&mOptions .onu ),
64+ " Toggle ONU status output" );
6265 }
6366
6467 virtual void run (const boost::program_options::variables_map& map)
@@ -217,7 +220,7 @@ class ProgramStatus : public Program
217220 auto csvLine = " ,,,,,,,,,," + clock + " ," + offset + " ," + userLogic + " ," + runStats + " \n " ;
218221 std::cout << csvLine;
219222 } else {
220- std::cout << " ----------------------------" << std::endl;
223+ std::cout << " ----------------------------- " << std::endl;
221224 std::cout << " CRU ID: " << reportInfo.cruId << std::endl;
222225 std::cout << clock << " clock | " ;
223226 std::cout << offset << " offset" << std::endl;
@@ -230,9 +233,50 @@ class ProgramStatus : public Program
230233 if (reportInfo.userAndCommonLogicEnabled ) {
231234 std::cout << " User and Common logic enabled" << std::endl;
232235 }
233- std::cout << " ----------------------------" << std::endl;
234236 }
235237
238+ /* ONU PARAMETERS */
239+ if (mOptions .onu ) {
240+ Cru::OnuStatus onuStatus = cruBar2->reportOnuStatus ();
241+
242+ if (mOptions .monitoring ) {
243+ monitoring->send (Metric{ " onu" }
244+ .addValue (std::to_string (onuStatus.onuAddress ), " onuAddress" )
245+ .addValue (onuStatus.rx40Locked , " rx40Locked" )
246+ .addValue (onuStatus.phaseGood , " phaseGood" )
247+ .addValue (onuStatus.rxLocked , " rxLocked" )
248+ .addValue (onuStatus.operational , " operational" )
249+ .addValue (onuStatus.mgtTxReady , " mgtTxReady" )
250+ .addValue (onuStatus.mgtRxReady , " mgtRxReady" )
251+ .addValue (onuStatus.mgtTxPllLocked , " mgtTxPllLocked" )
252+ .addValue (onuStatus.mgtRxPllLocked , " mgtRxPllLocked" ));
253+ } else if (mOptions .jsonOut ) {
254+ root.put (" ONU address" , onuStatus.onuAddress );
255+ root.put (" ONU RX40 locked" , onuStatus.rx40Locked );
256+ root.put (" ONU phase good" , onuStatus.phaseGood );
257+ root.put (" ONU RX locked" , onuStatus.rxLocked );
258+ root.put (" ONU operational" , onuStatus.operational );
259+ root.put (" ONU MGT TX ready" , onuStatus.mgtTxReady );
260+ root.put (" ONU MGT RX ready" , onuStatus.mgtRxReady );
261+ root.put (" ONU MGT TX PLL locked" , onuStatus.mgtTxPllLocked );
262+ root.put (" ONU MGT RX PLL locked" , onuStatus.mgtRxPllLocked );
263+ } else {
264+ std::cout << " =============================" << std::endl;
265+ std::cout << " ONU address: \t\t 0x" << std::hex << onuStatus.onuAddress << std::endl;
266+ std::cout << " -----------------------------" << std::endl;
267+ std::cout << " ONU RX40 locked: \t " << std::boolalpha << onuStatus.rx40Locked << std::endl;
268+ std::cout << " ONU phase good: \t " << std::boolalpha << onuStatus.phaseGood << std::endl;
269+ std::cout << " ONU RX locked: \t\t " << std::boolalpha << onuStatus.rxLocked << std::endl;
270+ std::cout << " ONU operational: \t " << std::boolalpha << onuStatus.operational << std::endl;
271+ std::cout << " ONU MGT TX ready: \t " << std::boolalpha << onuStatus.mgtTxReady << std::endl;
272+ std::cout << " ONU MGT RX ready: \t " << std::boolalpha << onuStatus.mgtRxReady << std::endl;
273+ std::cout << " ONU MGT TX PLL locked: \t " << std::boolalpha << onuStatus.mgtTxPllLocked << std::endl;
274+ std::cout << " ONU MGT RX PLL locked: \t " << std::boolalpha << onuStatus.mgtRxPllLocked << std::endl;
275+ }
276+ }
277+
278+
279+
236280 /* PARAMETERS PER LINK */
237281 for (const auto & el : reportInfo.linkMap ) {
238282 auto link = el.second ;
@@ -333,6 +377,7 @@ class ProgramStatus : public Program
333377 bool jsonOut = false ;
334378 bool csvOut = false ;
335379 bool monitoring = false ;
380+ bool onu = false ;
336381 } mOptions ;
337382};
338383
0 commit comments