[ONOS-7685]Improve failure inspection template for P4 Runtime developer

If P4InfoParser fail to parse p4info file, the parser will pass exact exception message to Apps by Cause of P4InfoParserException.

So, developer must use P4InfoParserException.getCause().getMessage() to gain exact failure cause.

This is hard to be reminded, especially when it is packed into IllegalStateException or other Exception class.

Change-Id: Ica9cd24521a9eb8700cd1cbfce573631c30cbff2
diff --git a/apps/p4-tutorial/pipeconf/src/main/java/org/onosproject/p4tutorial/pipeconf/PipeconfFactory.java b/apps/p4-tutorial/pipeconf/src/main/java/org/onosproject/p4tutorial/pipeconf/PipeconfFactory.java
index 47fad41..f0078ec 100644
--- a/apps/p4-tutorial/pipeconf/src/main/java/org/onosproject/p4tutorial/pipeconf/PipeconfFactory.java
+++ b/apps/p4-tutorial/pipeconf/src/main/java/org/onosproject/p4tutorial/pipeconf/PipeconfFactory.java
@@ -32,6 +32,8 @@
 import org.onosproject.net.pi.service.PiPipeconfService;
 import org.onosproject.p4runtime.model.P4InfoParser;
 import org.onosproject.p4runtime.model.P4InfoParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.net.URL;
 
@@ -44,6 +46,8 @@
 @Component(immediate = true)
 public final class PipeconfFactory {
 
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
     public static final PiPipeconfId PIPECONF_ID = new PiPipeconfId("p4-tutorial-pipeconf");
     private static final URL P4INFO_URL = PipeconfFactory.class.getResource("/mytunnel.p4info");
     private static final URL BMV2_JSON_URL = PipeconfFactory.class.getResource("/mytunnel.json");
@@ -54,21 +58,27 @@
     @Activate
     public void activate() {
         // Registers the pipeconf at component activation.
-        piPipeconfService.register(buildPipeconf());
+        try {
+            piPipeconfService.register(buildPipeconf());
+        } catch (P4InfoParserException e) {
+            log.error("Fail to register {} - Exception: {} - Cause: {}",
+                    PIPECONF_ID, e.getMessage(), e.getCause().getMessage());
+        }
     }
 
     @Deactivate
     public void deactivate() {
-        piPipeconfService.remove(PIPECONF_ID);
+        // Unregisters the pipeconf at component deactivation.
+        try {
+            piPipeconfService.remove(PIPECONF_ID);
+        } catch (IllegalStateException e) {
+            log.warn("{} haven't been registered", PIPECONF_ID);
+        }
     }
 
-    private PiPipeconf buildPipeconf() {
-        final PiPipelineModel pipelineModel;
-        try {
-            pipelineModel = P4InfoParser.parse(P4INFO_URL);
-        } catch (P4InfoParserException e) {
-            throw new IllegalStateException(e);
-        }
+    private PiPipeconf buildPipeconf() throws P4InfoParserException {
+
+        final PiPipelineModel pipelineModel = P4InfoParser.parse(P4INFO_URL);
 
         return DefaultPiPipeconf.builder()
                 .withId(PIPECONF_ID)