Updated and refactored the JSON serialization of Topology-related
and "Low Intent" objects:

* Added JSON serialization for topology-related FooEvent objects
  For now, their format matches exactly the corresponding Topology Foo object:
  - DeviceEvent: matches Device
  - SwitchEvent: matches Switch
  - PortEvent: matches Port
  - LinkEvent: matches Link

* Refactored the JSON serialization of existing objects so it
  is more consistent:

============================================
  - Topology Device serialization: "port" is renamed to "portNumber"

  OLD:
{
    "mac": "00:01:02:03:04:05"
    "attachmentPoints": [
        {
            "dpid": "11:22:33:44:55:66:77:88",
            "port": 1
        },
        ...
    ]
}

  NEW:
{
    "mac": "00:01:02:03:04:05"
    "attachmentPoints": [
        {
            "dpid": "11:22:33:44:55:66:77:88",
            "portNumber": 1
        },
        ...
    ]
}
============================================
   - Low Level Intent serialization (LinkEvent used by "path"):
     portNumber is an integer instead of a string

OLD:
[
        ...
        "path": [
            {
                "src": {
                    "portNumber": "2",
                    "dpid": "00:00:00:00:00:00:02:02"
                },
                "dst": {
                    "portNumber": "2",
                    "dpid": "00:00:00:00:00:00:02:01"
                }
            },

NEW:
[
        ...
        "path": [
            {
                "src": {
                    "portNumber": 2,
                    "dpid": "00:00:00:00:00:00:02:02"
                },
                "dst": {
                    "portNumber": 2,
                    "dpid": "00:00:00:00:00:00:02:01"
                }
            },
============================================
   - Topology Link serialization: Format changed to match LinkEvent (and SwitchPort):

OLD:
{
    ...
    "links": [
        {
            "dst-switch": "00:00:00:00:00:00:01:03",
            "src-switch": "00:00:00:00:00:00:01:06",
            "src-port": 3,
            "dst-port": 4
        },

NEW:
{
    ...
    "links": [
        {
            "src": {
                "portNumber": 3,
                "dpid": "00:00:00:00:00:00:01:06"
            },
            "dst": {
                "portNumber": 4,
                "dpid": "00:00:00:00:00:00:01:03"
            }
        },

============================================
    - Topology Port serialization: Renamed "number" to "portNumber"

OLD:
{
    "switches": [
        {
            "state": "ACTIVE",
            "ports": [
                {
                    "state": "ACTIVE",
                    "desc": null,
                    "number": 1,
                    "dpid": "00:00:00:00:00:00:04:0e"
                },

NEW:
{
    "switches": [
        {
            "state": "ACTIVE",
            "ports": [
                {
                    "state": "ACTIVE",
                    "desc": null,
                    "portNumber": 1,
                    "dpid": "00:00:00:00:00:00:04:0e"
                },

============================================
      - SwitchPort serialization (used in number of places referred above):
        portNumber is an integer instead of a string
OLD:
                {
                    "portNumber": "2",
                    "dpid": "00:00:00:00:00:00:02:02"
                }

NEW:
                {
                    "portNumber": 2,
                    "dpid": "00:00:00:00:00:00:02:02"
                }

======================

* Added JSON serialization for TopologyEvents. The format is:

{
    "addedSwitches": [
        {
            "state": "ACTIVE",
            "ports": [
            ],
            "dpid": "00:00:00:00:00:00:02:07"
        },
        ...
    ],
    "removedSwitches": [
        {
            "state": "ACTIVE",
            "ports": [
            ],
            "dpid": "00:00:00:00:00:00:02:08"
        },
        ...
    ],
    "addedPorts": [
        {
            "state": "ACTIVE",
            "desc": null,
            "portNumber": 1,
            "dpid": "00:00:00:00:00:00:02:07"
        },
        ...
    ],
    "removedPorts": [
        {
            "state": "ACTIVE",
            "desc": null,
            "portNumber": 1,
            "dpid": "00:00:00:00:00:00:02:08"
        },
        ...
    ],
    "addedLinks": [
        {
            "src": {
                "portNumber": 10,
                "dpid": "00:00:00:00:00:00:04:01"
            },
            "dst": {
                "portNumber": 2,
                "dpid": "00:00:00:00:00:00:04:0a"
            }
        },
        ...
    ],
    "removedLinks": [
        {
            "src": {
                "portNumber": 5,
                "dpid": "00:00:00:00:00:00:05:01"
            },
            "dst": {
                "portNumber": 6,
                "dpid": "00:00:00:00:00:00:05:0a"
            }
        },
        ...
    ],
    "addedHosts": [
        {
            "mac": "00:01:02:03:04:05"
            "attachmentPoints": [
                {
                    "dpid": "11:22:33:44:55:66:77:88",
                    "port": 1
                },
                ...
            ]
        },
        ...
    ],
    "removedHosts": [
        {
            "mac": "00:01:02:03:08:08"
            "attachmentPoints": [
                {
                    "dpid": "11:22:33:44:55:11:11:11",
                    "port": 1
                },
                ...
            ]
        },
        ...
    ]
}

Change-Id: Ib72be653bc03444b888c0417b3f026966a7df3f3
diff --git a/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java b/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java
index 4e9418a..de0fff6 100644
--- a/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java
+++ b/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java
@@ -1,15 +1,19 @@
 package net.onrc.onos.core.topology;
 
+import net.onrc.onos.core.topology.web.serializers.SwitchEventSerializer;
 import net.onrc.onos.core.util.Dpid;
 
 import java.nio.ByteBuffer;
 import java.util.Objects;
 
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
 /**
  * Self-contained Switch Object.
  * <p/>
  * TODO: We probably want common base class/interface for Self-Contained Event Object.
  */
+@JsonSerialize(using = SwitchEventSerializer.class)
 public class SwitchEvent {
     protected final Dpid dpid;