Skip to content
Snippets Groups Projects
Commit 7e994171 authored by Ryan Izard's avatar Ryan Izard
Browse files

OFStatsReply custom serializer. Works for OFFlowStatsReply presently.

parent 52b58aa8
No related branches found
No related tags found
No related merge requests found
package net.floodlightcontroller.core.web;
public class OFStatsTypeStrings {
public static final String AGGREGATE = "aggregate";
public static final String DESC = "desc";
public static final String EXPERIMENTER = "experimenter";
public static final String FLOW = "flow";
public static final String GROUP = "group";
public static final String GROUP_DESC = "group-desc";
public static final String GROUP_FEATURES = "group-features";
public static final String METER = "meter";
public static final String METER_CONFIG = "meter-config";
public static final String METER_FEATURES = "meter-features";
public static final String PORT = "port";
public static final String PORT_DESC = "port-desc";
public static final String QUEUE = "queue";
public static final String TABLE = "table";
public static final String TABLE_FEATURES = "table-features";
public static final String FEATURES = "features"; // TODO not a stats but a features request
// not sure where to put it though
}
/**
* Copyright 2011,2012 Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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 net.floodlightcontroller.core.web.serializers;
import java.io.IOException;
import org.projectfloodlight.openflow.types.MacAddress;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
/**
* Serialize a MAC as colon-separated hexadecimal
*/
public class MacSerializer extends JsonSerializer<Long> {
@Override
public void serialize(Long mac, JsonGenerator jGen,
SerializerProvider serializer)
throws IOException, JsonProcessingException {
jGen.writeString(MacAddress.of(mac).toString());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment