ONOS-3633 - Implementation of virtual network point to point intent provider.

Change-Id: Ie2c1e5ac278bc0dd6259479c44dd92b9b625e90b
diff --git a/core/api/src/main/java/org/onosproject/net/DefaultLink.java b/core/api/src/main/java/org/onosproject/net/DefaultLink.java
index 739b47e..9aed9c9 100644
--- a/core/api/src/main/java/org/onosproject/net/DefaultLink.java
+++ b/core/api/src/main/java/org/onosproject/net/DefaultLink.java
@@ -148,7 +148,7 @@
     /**
      * Builder for DefaultLink objects.
      */
-    public static final class Builder {
+    public static class Builder {
         private ProviderId providerId;
         private Annotations annotations = EMPTY;
         private ConnectPoint src;
@@ -157,7 +157,7 @@
         private State state = ACTIVE;
         private boolean isExpected = false;
 
-        private Builder() {
+        protected Builder() {
             // Hide constructor
         }
 
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/VirtualLinkCodec.java b/core/common/src/main/java/org/onosproject/codec/impl/VirtualLinkCodec.java
index 54f51e7..9f6b83a 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/VirtualLinkCodec.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/VirtualLinkCodec.java
@@ -1,9 +1,24 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onosproject.codec.impl;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.onosproject.codec.CodecContext;
 import org.onosproject.codec.JsonCodec;
-import org.onosproject.incubator.net.tunnel.TunnelId;
 import org.onosproject.incubator.net.virtual.DefaultVirtualLink;
 import org.onosproject.incubator.net.virtual.NetworkId;
 import org.onosproject.incubator.net.virtual.VirtualLink;
@@ -19,7 +34,6 @@
 
     // JSON field names
     private static final String NETWORK_ID = "networkId";
-    private static final String TUNNEL_ID = "tunnelId";
 
     private static final String NULL_OBJECT_MSG = "VirtualLink cannot be null";
     private static final String MISSING_MEMBER_MSG = " member is required in VirtualLink";
@@ -31,10 +45,6 @@
         JsonCodec<Link> codec = context.codec(Link.class);
         ObjectNode result = codec.encode(vLink, context);
         result.put(NETWORK_ID, vLink.networkId().toString());
-        // TODO check if tunnelId needs to be part of VirtualLink interface.
-        if (vLink instanceof DefaultVirtualLink) {
-            result.put(TUNNEL_ID, ((DefaultVirtualLink) vLink).tunnelId().toString());
-        }
         return result;
     }
 
@@ -46,16 +56,17 @@
         JsonCodec<Link> codec = context.codec(Link.class);
         Link link = codec.decode(json, context);
         NetworkId nId = NetworkId.networkId(Long.parseLong(extractMember(NETWORK_ID, json)));
-        String tunnelIdStr = json.path(TUNNEL_ID).asText();
-        TunnelId tunnelId = tunnelIdStr != null ? TunnelId.valueOf(tunnelIdStr)
-                : TunnelId.valueOf(0);
-        return new DefaultVirtualLink(nId, link.src(), link.dst(), tunnelId);
+        return DefaultVirtualLink.builder()
+                .networkId(nId)
+                .src(link.src())
+                .dst(link.dst())
+                .build();
     }
 
     /**
      * Extract member from JSON ObjectNode.
      *
-     * @param key key for which value is needed
+     * @param key  key for which value is needed
      * @param json JSON ObjectNode
      * @return member value
      */