Parser un fichier de log de simulation

wella_salwa Messages postés 33 Date d'inscription lundi 31 octobre 2022 Statut Membre Dernière intervention 11 décembre 2024 - Modifié le 18 oct. 2024 à 15:21
mamiemando Messages postés 33446 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 20 décembre 2024 - 21 oct. 2024 à 13:23

Bonjour à tous , 

Je veux extraire ces infos de log de simulation dans un fichier CSV , utilisant un code python .

Simulation version 1.4.0 started with time: 0.00
+0.000000000s -1 vndn-example-its:operator()(): [INFO ] Ns3SumoSetup: node [1] has initialized and the app installed!
+0.000000000s 0 its.rsu:RegisterPrefixes(): [DEBUG] Registering prefixes...
+0.000000000s 0 its.rsu:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+0.000000000s 0 its.rsu:GetCertificate(): [INFO ] >> myCert name: /ufba/RSU/idRsu_0/KEY/%D4%ECUW6%A4%7D%03/Test/%FD%00
+0.000000000s 1 its.car:RegisterPrefixes(): [DEBUG] Registering prefixes...
+0.000000000s 1 its.car:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+0.000000000s 1 its.car:GetCertificate(): [INFO ] >> myCert name: /ufba/CAR/idCar_1/KEY/%0Ed%DD%D6%3F%21%7C./Test/%FD%00
+0.500000000s -1 vndn-example-its:operator()(): [INFO ] Ns3SumoSetup: node [2] has initialized and the app installed!
+0.500000000s 2 its.car:RegisterPrefixes(): [DEBUG] Registering prefixes...
+0.500000000s 2 its.car:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+0.500000000s 2 its.car:GetCertificate(): [INFO ] >> myCert name: /ufba/CAR/idCar_2/KEY/5%80%97%25X%2F%08%C7/Test/%FD%01%F4
+1.000000000s 0 its.rsu:UpdateRoadTrafficDatabase(): [INFO ] Updating road-traffic database!
+1.000000000s 1 its.car:SendItsInterest(): [INFO ] Sending Navigo Interest /service/its/navigo/A1B6/B2B3/0
+1.000000000s -1 vndn-example-its:operator()(): [INFO ] Ns3SumoSetup: node [3] has initialized and the app installed!
+1.000000000s 3 its.car:RegisterPrefixes(): [DEBUG] Registering prefixes...
+1.000000000s 3 its.car:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+1.000000000s 3 its.car:GetCertificate(): [INFO ] >> myCert name: /ufba/CAR/idCar_3/KEY/%E1k%3F%40Fe%5E%D4/Test/%FD%03%E8
+1.000176050s 0 its.rsu:OnItsInterest(): [INFO ] Received ITS Interest /service/its/navigo/A1B6/B2B3/0
+1.000176050s 0 its.rsu:OnItsInterest(): [INFO ] ITS data message sent: /service/its/navigo/A1B6/B2B3/0
+1.000759100s 1 its.car:OnItsContent(): [INFO ] Data received: /service/its/navigo/A1B6/B2B3/0
+1.000759100s 1 its.car:OnItsContent(): [DEBUG] Data signed with: /ufba/RSU/idRsu_0/KEY/%D4%ECUW6%A4%7D%03 type=SignatureSha256WithEcdsa
+1.001024150s 0 its.rsu:OnKeyInterest(): [INFO ] Received KEY Interest /ufba/RSU/idRsu_0/KEY/%D4%ECUW6%A4%7D%03
+1.001876384s 1 its.car:OnMsgItsValidated(): [DEBUG] Validated data: /service/its/navigo/A1B6/B2B3/0
+1.001876384s 1 its.car:OnMsgItsValidated(): [INFO ] Received MSG ITS size=61 msg={"pathTime":11.65010799136069,...
+1.001876384s 1 its.car:OnMsgItsValidated(): [INFO ] Path (roads) has changed for a faster route! Estimated arrival time ~ 11.6501 (s)
+1.114000000s 1 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+1.114184050s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+1.114184281s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+1.114184612s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+1.164000000s 0 its.rsu:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/RSU/idRsu_0
+1.164184050s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/RSU/idRsu_0
+1.164184312s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/RSU/idRsu_0
+1.164184635s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/RSU/idRsu_0
+1.500000000s 2 its.car:SendItsInterest(): [INFO ] Sending Navigo Interest /service/its/navigo/B5B6/C6B6/0
+1.500000000s -1 vndn-example-its:operator()(): [INFO ] Ns3SumoSetup: node [4] has initialized and the app installed!
+1.500000000s 4 its.car:RegisterPrefixes(): [DEBUG] Registering prefixes...
+1.500000000s 4 its.car:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+1.500000000s 4 its.car:GetCertificate(): [INFO ] >> myCert name: /ufba/CAR/idCar_4/KEY/%C0i%3F%B2%8F%F8%0C%88/Test/%FD%05%DC
+1.500176311s 0 its.rsu:OnItsInterest(): [INFO ] Received ITS Interest /service/its/navigo/B5B6/C6B6/0
+1.500176311s 0 its.rsu:OnItsInterest(): [INFO ] ITS data message sent: /service/its/navigo/B5B6/C6B6/0
+1.500858263s 2 its.car:OnItsContent(): [INFO ] Data received: /service/its/navigo/B5B6/C6B6/0
+1.500858263s 2 its.car:OnItsContent(): [DEBUG] Data signed with: /ufba/RSU/idRsu_0/KEY/%D4%ECUW6%A4%7D%03 type=SignatureSha256WithEcdsa
+1.506383701s 2 its.car:OnMsgItsValidated(): [DEBUG] Validated data: /service/its/navigo/B5B6/C6B6/0
+1.506383701s 2 its.car:OnMsgItsValidated(): [INFO ] Received MSG ITS size=37 msg={"pathTime":0.0,"vehiclePath":"B5B6"}
+1.506383701s 2 its.car:OnMsgItsValidated(): [INFO ] Path (roads) has changed for a faster route! Estimated arrival time ~ 0 (s)
+1.667000000s 2 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+1.667184276s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+1.667184311s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+1.667184338s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+1.667184632s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+2.000000000s 3 its.car:SendItsInterest(): [INFO ] Sending Navigo Interest /service/its/navigo/C5C4/B6C6/0
+2.000176634s 0 its.rsu:OnItsInterest(): [INFO ] Received ITS Interest /service/its/navigo/C5C4/B6C6/0
+2.000176634s 0 its.rsu:OnItsInterest(): [INFO ] ITS data message sent: /service/its/navigo/C5C4/B6C6/0
+2.001515529s 3 its.car:OnItsContent(): [INFO ] Data received: /service/its/navigo/C5C4/B6C6/0
+2.001515529s 3 its.car:OnItsContent(): [DEBUG] Data signed with: /ufba/RSU/idRsu_0/KEY/%D4%ECUW6%A4%7D%03 type=SignatureSha256WithEcdsa
+2.001515529s 3 its.car:OnMsgItsValidated(): [DEBUG] Validated data: /service/its/navigo/C5C4/B6C6/0
+2.001515529s 3 its.car:OnMsgItsValidated(): [INFO ] Received MSG ITS size=62 msg={"pathTime":26.048956083513318...
+2.001515529s 3 its.car:OnMsgItsValidated(): [INFO ] Path (roads) has changed for a faster route! Estimated arrival time ~ 26.049 (s)
+2.199000000s 3 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+2.199184340s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+2.199184605s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+2.199184633s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+2.199184948s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+2.280000000s 1 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+2.280184064s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+2.280184269s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+2.280184366s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+2.280184605s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+2.500000000s 4 its.car:SendItsInterest(): [INFO ] Sending Navigo Interest /service/its/navigo/B2B3/C5C4/0
+2.500000000s -1 vndn-example-its:operator()(): [INFO ] Ns3SumoSetup: node [5] has initialized and the app installed!
+2.500000000s 5 its.car:RegisterPrefixes(): [DEBUG] Registering prefixes...
+2.500000000s 5 its.car:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+2.500000000s 5 its.car:GetCertificate(): [INFO ] >> myCert name: /ufba/CAR/idCar_5/KEY/%B0lz%0C%F0%B0%ACM/Test/%FD%09%C4
+2.500176319s 0 its.rsu:OnItsInterest(): [INFO ] Received ITS Interest /service/its/navigo/B2B3/C5C4/0
+2.500176319s 0 its.rsu:OnItsInterest(): [INFO ] ITS data message sent: /service/its/navigo/B2B3/C5C4/0
+2.501215921s 4 its.car:OnItsContent(): [INFO ] Data received: /service/its/navigo/B2B3/C5C4/0
+2.501215921s 4 its.car:OnItsContent(): [DEBUG] Data signed with: /ufba/RSU/idRsu_0/KEY/%D4%ECUW6%A4%7D%03 type=SignatureSha256WithEcdsa
+2.501215921s 4 its.car:OnMsgItsValidated(): [DEBUG] Validated data: /service/its/navigo/B2B3/C5C4/0
+2.501215921s 4 its.car:OnMsgItsValidated(): [INFO ] Received MSG ITS size=62 msg={"pathTime":11.916486681065514...
+2.501215921s 4 its.car:OnMsgItsValidated(): [INFO ] Path (roads) has changed for a faster route! Estimated arrival time ~ 11.9165 (s)
+2.641000000s 4 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+2.641184051s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+2.641184318s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+2.641184370s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+2.641184626s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+2.641184944s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+2.819000000s 2 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+2.819184260s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+2.819184306s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+2.819184346s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+2.819184592s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+2.819184624s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+3.000000000s -1 vndn-example-its:operator()(): [INFO ] Ns3SumoSetup: node [6] has initialized and the app installed!
+3.000000000s 6 its.car:RegisterPrefixes(): [DEBUG] Registering prefixes...
+3.000000000s 6 its.car:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+3.000000000s 6 its.car:GetCertificate(): [INFO ] >> myCert name: /ufba/CAR/idCar_6/KEY/g%11c3%26C%CF%A3/Test/%FD%0B%B8
+3.334000000s 3 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+3.334184352s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+3.334184559s 6 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+3.334184593s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+3.334184627s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+3.334184911s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+3.334184935s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+3.435000000s 1 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+3.435184088s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+3.435184248s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+3.435184341s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+3.435184366s 6 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+3.435184381s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+3.435184592s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+3.500000000s 5 its.car:SendItsInterest(): [INFO ] Sending Navigo Interest /service/its/navigo/B2A1/B4A1/0
+3.500176284s 0 its.rsu:OnItsInterest(): [INFO ] Received ITS Interest /service/its/navigo/B2A1/B4A1/0
+3.500176284s 0 its.rsu:OnItsInterest(): [INFO ] ITS data message sent: /service/its/navigo/B2A1/B4A1/0
+3.501743860s 5 its.car:OnItsContent(): [INFO ] Data received: /service/its/navigo/B2A1/B4A1/0
+3.501743860s 5 its.car:OnItsContent(): [DEBUG] Data signed with: /ufba/RSU/idRsu_0/KEY/%D4%ECUW6%A4%7D%03 type=SignatureSha256WithEcdsa
+3.505368503s 5 its.car:OnMsgItsValidated(): [DEBUG] Validated data: /service/its/navigo/B2A1/B4A1/0
+3.505368503s 5 its.car:OnMsgItsValidated(): [INFO ] Received MSG ITS size=37 msg={"pathTime":0.0,"vehiclePath":"B2A1"}
+3.505368503s 5 its.car:OnMsgItsValidated(): [INFO ] Path (roads) has changed for a faster route! Estimated arrival time ~ 0 (s)
+3.606000000s 5 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+3.606184060s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+3.606184283s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+3.606184343s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+3.606184483s 6 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+3.606184581s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+3.606184907s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+3.700000000s -1 vndn-example-its:operator()(): [INFO ] Ns3SumoSetup: node [7] has initialized and the app installed!
+3.700000000s 7 its.car:RegisterPrefixes(): [DEBUG] Registering prefixes...
+3.700000000s 7 its.car:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+3.700000000s 7 its.car:GetCertificate(): [INFO ] >> myCert name: /ufba/CAR/idCar_7/KEY/%1B%12%2B%3D%D1%AF%8E%EE/Test/%FD%0Et
+3.756000000s 4 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+3.756184061s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+3.756184314s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+3.756184386s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+3.756184475s 6 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+3.756184615s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+3.756184929s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+3.756184942s 7 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+3.910000000s 2 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+3.910184236s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+3.910184300s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+3.910184360s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+3.910184365s 7 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+3.910184405s 6 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+3.910184576s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+3.910184613s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_2
+4.000000000s 6 its.car:SendItsInterest(): [INFO ] Sending Navigo Interest /service/its/navigo/B4B3/B2B1/0
+4.000000000s -1 vndn-example-its:operator()(): [INFO ] Ns3SumoSetup: node [8] has initialized and the app installed!
+4.000000000s 8 its.car:RegisterPrefixes(): [DEBUG] Registering prefixes...
+4.000000000s 8 its.car:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+4.000000000s 8 its.car:GetCertificate(): [INFO ] >> myCert name: /ufba/CAR/idCar_8/KEY/%B3%0F%5B%CF%A2%DF9%2C/Test/%FD%0F%A0
+4.000176306s 0 its.rsu:OnItsInterest(): [INFO ] Received ITS Interest /service/its/navigo/B4B3/B2B1/0
+4.000176306s 0 its.rsu:OnItsInterest(): [INFO ] ITS data message sent: /service/its/navigo/B4B3/B2B1/0
+4.001681714s 6 its.car:OnItsContent(): [INFO ] Data received: /service/its/navigo/B4B3/B2B1/0
+4.001681714s 6 its.car:OnItsContent(): [DEBUG] Data signed with: /ufba/RSU/idRsu_0/KEY/%D4%ECUW6%A4%7D%03 type=SignatureSha256WithEcdsa
+4.001681714s 6 its.car:OnMsgItsValidated(): [DEBUG] Validated data: /service/its/navigo/B4B3/B2B1/0
+4.001681714s 6 its.car:OnMsgItsValidated(): [INFO ] Received MSG ITS size=61 msg={"pathTime":11.65010799136069,...
+4.001681714s 6 its.car:OnMsgItsValidated(): [INFO ] Path (roads) has changed for a faster route! Estimated arrival time ~ 11.6501 (s)
+4.100000000s -1 vndn-example-its:operator()(): [INFO ] Ns3SumoSetup: node [9] has initialized and the app installed!
+4.100000000s 9 its.car:RegisterPrefixes(): [DEBUG] Registering prefixes...
+4.100000000s 9 its.car:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+4.100000000s 9 its.car:GetCertificate(): [INFO ] >> myCert name: /ufba/CAR/idCar_9/KEY/E%FD%CF%F5%C3%F4%80./Test/%FD%10%04
+4.154000000s 6 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_6
+4.154184252s 8 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_6
+4.154184305s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_6
+4.154184380s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_6
+4.154184409s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_6
+4.154184466s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_6
+4.154184477s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_6
+4.154184488s 9 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_6
+4.154184551s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_6
+4.154184578s 7 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_6
+4.447000000s 3 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+4.447184038s 7 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+4.447184370s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+4.447184549s 6 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+4.447184580s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+4.447184619s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+4.447184774s 8 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+4.447184891s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+4.447184915s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+4.447184931s 9 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_3
+4.499000000s 1 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+4.499184115s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+4.499184222s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+4.499184351s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+4.499184386s 6 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+4.499184401s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+4.499184403s 8 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+4.499184404s 9 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+4.499184580s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+4.499184590s 7 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_1
+4.500000000s -1 vndn-example-its:operator()(): [INFO ] Ns3SumoSetup: node [10] has initialized and the app installed!
+4.500000000s 10 its.car:RegisterPrefixes(): [DEBUG] Registering prefixes...
+4.500000000s 10 its.car:RegisterPrefixes(): [DEBUG] FibHelper::AddRoute prefix=/localhop/beacon/hi-i-am via faceId=257
+4.500000000s 10 its.car:GetCertificate(): [INFO ] >> myCert name: /ufba/CAR/idCar_10/KEY/Ij%18%ECo%CE%90Q/Test/%FD%11%94
+4.689000000s 5 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.689184060s 9 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.689184075s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.689184271s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.689184275s 8 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.689184353s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.689184467s 6 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.689184533s 10 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.689184561s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.689184886s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.689184905s 7 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_5
+4.700000000s 7 its.car:SendItsInterest(): [INFO ] Sending Navigo Interest /service/its/navigo/C5C4/C2C1/0
+4.700176634s 0 its.rsu:OnItsInterest(): [INFO ] Received ITS Interest /service/its/navigo/C5C4/C2C1/0
+4.700176634s 0 its.rsu:OnItsInterest(): [INFO ] ITS data message sent: /service/its/navigo/C5C4/C2C1/0
+4.702013060s 7 its.car:OnItsContent(): [INFO ] Data received: /service/its/navigo/C5C4/C2C1/0
+4.702013060s 7 its.car:OnItsContent(): [DEBUG] Data signed with: /ufba/RSU/idRsu_0/KEY/%D4%ECUW6%A4%7D%03 type=SignatureSha256WithEcdsa
+4.864000000s 7 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.864184044s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.864184382s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.864184581s 6 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.864184586s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.864184633s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.864184797s 8 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.864184901s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.864184929s 4 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.864184948s 9 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.864185061s 10 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_7
+4.929000000s 4 its.car:SendBeaconInterest(): [INFO ] Sending BEACON /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+4.929184039s 9 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+4.929184082s 5 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+4.929184226s 8 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+4.929184307s 0 its.rsu:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+4.929184414s 1 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+4.929184444s 6 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+4.929184455s 10 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+4.929184601s 2 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+4.929184904s 3 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
+4.929184928s 7 its.car:OnBeaconHelloInterest(): [INFO ] Received BEACON (Hello Interest) /localhop/beacon/hi-i-am/ufba/CAR/idCar_4
[31m[1mPost simulation: [0m
+5.000000000s -1 its.car:OnMsgValidationFailed(): [DEBUG] Fail to validate data: /service/its/navigo/C5C4/C2C1/0 error: Internal implementation error (Validator/policy did not invoke success or failure callback)
Simulation ended at time: 5.00
Reason: TraCI requested termination.
Performance: 
 Duration: 938ms
 Real time factor: 5.33049
 UPS: 268.656716
Vehicles: 
 Inserted: 10 (Loaded: 20)
 Running: 10
 Waiting: 0


A voir également:

1 réponse

mamiemando Messages postés 33446 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 20 décembre 2024 7 812
Modifié le 18 oct. 2024 à 15:19

Bonjour,

Que veux-tu extraire ? Et à quelle fin ? En outre, n'as tu pas meilleur temps de faire ce que tu veux faire directement dans ton simulateur et en C++ (je suspecte qu'il s'agit d'un log produit avec ns3) ?

Voici un exemple de parseur de log que tu peux adapter. L'idée est d'utiliser des expressions régulières afin de détecter les lignes qui contiennent des données à extraire et peupler une structure de données.

#!/usr/bin/env python3

import argparse
import re
import sys
from pathlib import Path
from pprint import pprint

RE_INT = "[0-9]+"
RE_FLOAT = f"{RE_INT}.{RE_INT}"
MAP_REGEXPS = {
    "duration": re.compile(rf"Duration: ({RE_FLOAT})ms"),
    "real time factor": re.compile(rf"Real time factor: ({RE_FLOAT})"),
    "inserted vehicles": re.compile(rf"Inserted: ({RE_INT}) \(Loaded: ({RE_INT})\)"),
}

def smart_cast(x, types = None):
    if types is None:
        types = (int, float)
    for cast in types:
        try:
            return cast(x)
        except ValueError:
            pass
    return x

def parse_line(line, r):
    m = r.match(line)
    if m:
        num_values = r.groups
        if num_values > 1:
            return tuple(
                smart_cast(m.group(i + 1))
                for i in range(r.groups)
            )
        elif num_values == 1:
            return smart_cast(m.group(1))
    return None

def parse_log(f):
    data = dict()
    for line in f.readlines():
        line = line.strip()
        for (k, r) in MAP_REGEXPS.items():
            values = parse_line(line, r)
            if values is not None:
                data[k] = values
    return data

def main():
    parser = argparse.ArgumentParser(
        description="Log parser",
        epilog=f"Example: {sys.argv[0]} -i file.log"
    )
    g = parser.add_argument_group("Parser arguments")
    g.add_argument(
        "-i", "--input-filename",
        type=Path,
        required=True,
        help="Path to the input log"
    )
    args = parser.parse_args()
    with open(args.input_filename) as f:
        data = parse_log(f)
    pprint(data)

if __name__ == "__main__":
    main()

Comme tu peux le voir dans MAP_REGEXPS, je me suis contenté de traiter ces trois lignes :

... 
 Duration: 938ms
 Real time factor: 5.33049
... 
 Inserted: 10 (Loaded: 20)

Libre à toi de traiter d'autres lignes.

Exécution :

python3 parse_log.py fichier.log

Résultat :

{'duration': 938, 'inserted vehicles': (10, 20), 'real time factor': 5.33049}

Quelques explications sur les expressions régulières

Pour comprendre ce qui se passe, il faut déjà maîtriser ce qu'est une expression régulière et comment s'utilise le module python "re", qui les prend en charge.

Une expression régulière permet d'extraire une ou plusieurs sous chaînes (appelés matches) étant donnée une chaîne de caractère (par exemple une ligne de fichier de log). Dans une expression régulière, les sous-chaines en questions sont délimités par des parenthèses. Si la chaîne de caractère comporte de "vraies parenthèses" (comme dans "inserted vehicles"), il faut veiller à échapper ces "vraies parenthèses" en les précédant d'un "\".

Par exemple regardons quelques-unes d'entre elles :

  • RE_INT :
    • [0-9] signifie n'importe quel caractère compris entre 0 et 9 au sens ASCII, ce qui concerne 0, 1, 2, ... 9. Dans la même veine [A-Za-z] signifie n'importe quelle lettre minuscule ou majuscule.
    • + signifie au moins une répétition. Donc [0-9]+ signifie qu'on veut une suite non vide de caractères consécutifs entre 0 et 9. Cela définit donc du point de vue d'une chaîne de caractère bien n'importe quel entier.
    • Il existe d'autres opérateurs de répétitions :
      • ? : 0-1 répétitions
      • + : 1 ou plus répétitions
      • * : 0 ou plus répétitions
      • {m} : exactement m répétitions
      • {m,} : au moins m répétitions
      • {,n} : au plus n répétitions
      • {m, n}: entre m et n répétitions
      • Comme {, }, +, *, ? mais aussi (, ), et . sont des métacaractère (~opérateurs) des expressions régulières, lorsqu'une expression régulière met en jeu un tel caractère qui ne doit pas être vu comme métacaractère doit être échappé, soit en le précédent de \, soit en l'entourant avec des crochet. Exemple :
        • \. et [.] désignent le caractère "."
    • Comme on est en train de définir une expressions régulières, on a intérêt à utiliser r"..."
  • MAP_REGEXPS["duration"] :
    • Comme on cherche ici à capturer un entier, on va réutiliser l'expression régulière RE_INT. Les f-strings f"..." permettent d'injecter la valeur d'une variable dans une chaîne, comme par exemple dans f"...{RE_INT}...".
    • Comme c'est une expression régulière, on définit cette chaîne avec rf"...".
    • Et comme on veut capturer l'entier en question, l'expression régulière est de la forme rf"...({RE_INT})...".
  • MAP_REGEXPS["inserted vehicles"] :
    • C'est le même principe, mais on a deux entiers à extraire donc l'expression régulière est de la forme l'expression régulière est de la forme rf"...({RE_INT})...({RE_INT})..."
    • Comme notre expression régulière implique de "vraies parenthèses" il ne faut pas oublier de les échapper.

Quelques explications sur l'architecture du code

La fonction parse_log regarde pour chaque ligne et pour chaque expression régulière si l'une d'elle est capable d'extraire des valeurs. Si c'est le cas, les valeurs extraites sont mémorisés. Comme une expression régulière peut capturer plusieurs valeurs, il faut distinguer si on en extrait une ou plusieurs. Dans le premier cas, on retourne directement la valeur, dans l'autre, on stocke les valeurs dans un tuple. On observe cette différence de traitement dans le cas de "duration" et de "inserted vehicles".

Ces éventuelles sous-chaines sont par définition du texte. Et donc, si l'on souhaite avoir un type numérique (par exemple en vue de tracer des courbes), il faut les convertir dans le type adéquat (nombre entier, nombre flottant, etc). C'est le rôle de la fonction smart_cast.

Ensuite, toutes ces fonctions sont orchestrées par un programme principal (fonction main) qui s'occupe de récupérer les arguments passés en ligne de commande et d'appeler la fonction parse_log.

Bonne chance

0
wella_salwa Messages postés 33 Date d'inscription lundi 31 octobre 2022 Statut Membre Dernière intervention 11 décembre 2024
Modifié le 18 oct. 2024 à 14:55

Oui c'est un log produit par ns-3 . 

Je veux extraire les temps d'envoi des intérêts (Interest) et les temps de réception de chaque data équivalent (data) , ainsi que les IDs des stations (car) qui ont transmis ces messages , afin de calculer le délai de transmission pour chaque message.

0
mamiemando Messages postés 33446 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 20 décembre 2024 7 812 > wella_salwa Messages postés 33 Date d'inscription lundi 31 octobre 2022 Statut Membre Dernière intervention 11 décembre 2024
21 oct. 2024 à 13:23

Peux-tu clarifier ? Donne un exemple de ligne à considérer et ce que tu veux en extraire. As-tu essayé par toi-même sur l'extrait de code que je t'ai proposé ?

0