From 10e7ece5e62abb6a3912177dc5b152552ae62cb3 Mon Sep 17 00:00:00 2001
From: Vishnu Emmadi <vishnu.emmadi@bigswitch.com>
Date: Tue, 7 May 2013 21:36:53 -0700
Subject: [PATCH] Json Serialization fixes for LinkInfo

add default constructor for LinkInfo
add JsonIgnore annotation for getLinkType as it does not correspond to an actual class variable
---
 .../floodlightcontroller/linkdiscovery/LinkInfo.java  | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java b/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java
index 9c0dd1a0a..cf1c8b71b 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java
@@ -19,6 +19,8 @@ import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType;
 
 import org.openflow.protocol.OFPhysicalPort.OFPortState;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
 public class LinkInfo {
 
     public LinkInfo(Long firstSeenTime,
@@ -34,6 +36,14 @@ public class LinkInfo {
         this.lastBddpReceivedTime = lastBddpReceivedTime;
     }
 
+    public LinkInfo() {
+        this.srcPortState = null;
+        this.dstPortState = null;
+        this.firstSeenTime = null;
+        this.lastLldpReceivedTime = null;
+        this.lastBddpReceivedTime = null;
+    }
+
     protected Integer srcPortState;
     protected Integer dstPortState;
     protected Long firstSeenTime;
@@ -97,6 +107,7 @@ public class LinkInfo {
         this.dstPortState = dstPortState;
     }
 
+    @JsonIgnore
     public LinkType getLinkType() {
         if (lastLldpReceivedTime != null) {
             return LinkType.DIRECT_LINK;
-- 
GitLab