Refactored pseudowire code.

This refactoring is needed in order to be able to further
refactor the sr application in api / app / web, where api contains
the interfaces, used by other modules, app contains the implementations
and web contains rest related code.

Change-Id: I147442e5d1248941a6c3c4df2715b01e72c40b3f
diff --git a/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index 525f84a..d951b53 100644
--- a/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -102,8 +102,11 @@
 import org.onosproject.segmentrouting.grouphandler.DestinationSet;
 import org.onosproject.segmentrouting.grouphandler.NextNeighbors;
 import org.onosproject.segmentrouting.pwaas.DefaultL2Tunnel;
+import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelHandler;
 import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelPolicy;
+import org.onosproject.segmentrouting.pwaas.L2Tunnel;
 import org.onosproject.segmentrouting.pwaas.L2TunnelHandler;
+import org.onosproject.segmentrouting.pwaas.L2TunnelPolicy;
 import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
 import org.onosproject.segmentrouting.storekey.McastStoreKey;
 import org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey;
@@ -420,7 +423,7 @@
         linkHandler = new LinkHandler(this);
         routeHandler = new RouteHandler(this);
         neighbourHandler = new SegmentRoutingNeighbourDispatcher(this);
-        l2TunnelHandler = new L2TunnelHandler(this);
+        l2TunnelHandler = new DefaultL2TunnelHandler(this);
 
         cfgService.addListener(cfgListener);
         cfgService.registerConfigFactory(deviceConfigFactory);
@@ -447,18 +450,20 @@
         return new KryoNamespace.Builder()
                 .register(KryoNamespaces.API)
                 .register(DestinationSetNextObjectiveStoreKey.class,
-                        VlanNextObjectiveStoreKey.class,
-                        DestinationSet.class,
-                        NextNeighbors.class,
-                        Tunnel.class,
-                        DefaultTunnel.class,
-                        Policy.class,
-                        TunnelPolicy.class,
-                        Policy.Type.class,
-                        PortNextObjectiveStoreKey.class,
-                        XConnectStoreKey.class,
-                        DefaultL2Tunnel.class,
-                        DefaultL2TunnelPolicy.class
+                          VlanNextObjectiveStoreKey.class,
+                          DestinationSet.class,
+                          NextNeighbors.class,
+                          Tunnel.class,
+                          DefaultTunnel.class,
+                          Policy.class,
+                          TunnelPolicy.class,
+                          Policy.Type.class,
+                          PortNextObjectiveStoreKey.class,
+                          XConnectStoreKey.class,
+                          L2Tunnel.class,
+                          L2TunnelPolicy.class,
+                          DefaultL2Tunnel.class,
+                          DefaultL2TunnelPolicy.class
                 );
     }
 
@@ -552,20 +557,20 @@
     }
 
     @Override
-    public List<DefaultL2Tunnel> getL2Tunnels() {
+    public List<L2Tunnel> getL2Tunnels() {
         return l2TunnelHandler.getL2Tunnels();
     }
 
     @Override
-    public List<DefaultL2TunnelPolicy> getL2Policies() {
+    public List<L2TunnelPolicy> getL2Policies() {
         return l2TunnelHandler.getL2Policies();
     }
 
     @Override
     public L2TunnelHandler.Result addPseudowire(String tunnelId, String pwLabel, String cP1,
-                                         String cP1InnerVlan, String cP1OuterVlan, String cP2,
-                                         String cP2InnerVlan, String cP2OuterVlan,
-                                         String mode, String sdTag) {
+                                                 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) {
@@ -1407,7 +1412,7 @@
                         break;
                 }
             } else if (event.configClass().equals(PwaasConfig.class)) {
-                checkState(l2TunnelHandler != null, "L2TunnelHandler is not initialized");
+                checkState(l2TunnelHandler != null, "DefaultL2TunnelHandler is not initialized");
                 switch (event.type()) {
                     case CONFIG_ADDED:
                         l2TunnelHandler.processPwaasConfigAdded(event);