Pseudowire support for leaf-spine

- Added pw support for pseudowires containing leaf and spine switches as endpoints.
- Inject empty pw config if it is not found for the first time
- Minor refactoring such as more log messages and fixing missing javadoc

Change-Id: Ib57d39cfa36fcd48c01b5781c7445a3f1ffcfbda
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index 6250ffd..a0fc532 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -15,7 +15,7 @@
  */
 package org.onosproject.segmentrouting;
 
-
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.ImmutableMap;
@@ -559,11 +559,12 @@
                                          String cP1InnerVlan, String cP1OuterVlan, String cP2,
                                          String cP2InnerVlan, String cP2OuterVlan,
                                          String mode, String sdTag) {
-
+        // Try to inject an empty Pwaas config if it is not found for the first time
         PwaasConfig config = cfgService.getConfig(appId(), PwaasConfig.class);
         if (config == null) {
-            log.warn("Configuration for Pwaas class could not be found!");
-            return L2TunnelHandler.Result.CONFIG_NOT_FOUND;
+            log.debug("Pwaas config not found. Try to create an empty one.");
+            cfgService.applyConfig(appId(), PwaasConfig.class, new ObjectMapper().createObjectNode());
+            config = cfgService.getConfig(appId(), PwaasConfig.class);
         }
 
         ObjectNode object = config.addPseudowire(tunnelId, pwLabel,