[SECIOTSRK-668] - Update audit-trail for Rpi3 to support FIM test emulation
authori.metelytsia <i.metelytsia@samsung.com>
Wed, 1 Nov 2017 16:01:27 +0000 (18:01 +0200)
committeri.metelytsia <i.metelytsia@samsung.com>
Wed, 1 Nov 2017 16:01:27 +0000 (18:01 +0200)
device_core/nmdaemon/audit_trail_client.cpp
device_core/utest/test_report_service.cpp

index ec256d0..efac875 100644 (file)
@@ -18,6 +18,7 @@ namespace
 {
     const int DLP_REPORT_TYPE = 1111;
     const int PAD_REPORT_TYPE = 1112;
+    const int FIM_REPORT_TYPE = 1113;
 }
 
 namespace NMD
@@ -226,8 +227,29 @@ void userLogCallback(audit_trail_user_h handle, void* user_data)
         return;
     }
 
-    std::string report_type{ (type == PAD_REPORT_TYPE) ? "pad" : "dlp"};
-    std::string log_type{ (type == PAD_REPORT_TYPE) ? "PAD" : "DLP"};
+    std::string report_type;
+    std::string log_type;
+    switch(type)
+    {
+    case DLP_REPORT_TYPE:
+        {
+            report_type = "dlp";
+            log_type = "DLP";
+        }
+        break;
+    case PAD_REPORT_TYPE:
+        {
+            report_type = "pad";
+            log_type = "PAD";
+        }
+        break;
+    default:
+        {
+            report_type = "fim";
+            log_type = "FIM";
+        }
+        break;
+    }
 
     std::ostringstream os;
     os << '[' << log_type << "] audit(" << time << '.' << ms << ":0) type=" << type << " text=" << text;
index ebe83c5..02fb69d 100644 (file)
@@ -59,3 +59,25 @@ TEST(DISABLED_test_report_service, dlpReport)
     });
     ASSERT_EQ(0, result) << "sendReport() error\n";
 }
+
+/**
+ * Test for check FIM reports
+ * 1. Create RMI client and connect to report service
+ * 2. Call sendReport() method
+ * 3. Check result
+ * 4. Disconnect client
+ */
+TEST(DISABLED_test_report_service, fimReport)
+{
+    int result = -1;
+
+    ASSERT_NO_THROW({
+        rmi::Client client(ReportService::RMI_ADDRESS);
+        client.connect();
+        result = client.methodCall<int>("ReportService::sendReport",
+                        std::string{"fim"},
+                        std::string{"[FIM] operation=write gpa=7fffd19c5592 start_symbol=_text end_symbol=__start_rodata mode=debug"});
+        client.disconnect();
+    });
+    ASSERT_EQ(0, result) << "sendReport() error\n";
+}