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

Fixed action serializer for actions that do not have values e.g. strip_vlan...

Fixed action serializer for actions that do not have values e.g. strip_vlan and such. Added in a 'n/a' value for the JSON key's value. Perhaps we should rethink how a list of actions is serialized to avoid the 'n/a' all together.
parent 260570ef
No related branches found
No related tags found
No related merge requests found
...@@ -152,7 +152,7 @@ public class OFActionListSerializer extends JsonSerializer<List<OFAction>> { ...@@ -152,7 +152,7 @@ public class OFActionListSerializer extends JsonSerializer<List<OFAction>> {
jsonGenerator.writeStringField(ActionUtils.STR_GROUP, ((OFActionGroup)a).getGroup().toString()); jsonGenerator.writeStringField(ActionUtils.STR_GROUP, ((OFActionGroup)a).getGroup().toString());
break; break;
case STRIP_VLAN: case STRIP_VLAN:
jsonGenerator.writeString(ActionUtils.STR_VLAN_STRIP); jsonGenerator.writeStringField(ActionUtils.STR_VLAN_STRIP, ActionUtils.STR_NOT_APPLICABLE);
break; break;
case PUSH_VLAN: case PUSH_VLAN:
jsonGenerator.writeNumberField(ActionUtils.STR_VLAN_PUSH, ((OFActionPushVlan)a).getEthertype().getValue()); jsonGenerator.writeNumberField(ActionUtils.STR_VLAN_PUSH, ((OFActionPushVlan)a).getEthertype().getValue());
...@@ -164,25 +164,25 @@ public class OFActionListSerializer extends JsonSerializer<List<OFAction>> { ...@@ -164,25 +164,25 @@ public class OFActionListSerializer extends JsonSerializer<List<OFAction>> {
jsonGenerator.writeNumberField(ActionUtils.STR_PBB_PUSH, ((OFActionPushPbb)a).getEthertype().getValue()); jsonGenerator.writeNumberField(ActionUtils.STR_PBB_PUSH, ((OFActionPushPbb)a).getEthertype().getValue());
break; break;
case POP_VLAN: case POP_VLAN:
jsonGenerator.writeString(ActionUtils.STR_VLAN_POP); jsonGenerator.writeStringField(ActionUtils.STR_VLAN_POP, ActionUtils.STR_NOT_APPLICABLE);
break; break;
case POP_MPLS: case POP_MPLS:
jsonGenerator.writeNumberField(ActionUtils.STR_MPLS_POP, ((OFActionPopMpls)a).getEthertype().getValue()); jsonGenerator.writeNumberField(ActionUtils.STR_MPLS_POP, ((OFActionPopMpls)a).getEthertype().getValue());
break; break;
case POP_PBB: case POP_PBB:
jsonGenerator.writeString(ActionUtils.STR_PBB_POP); jsonGenerator.writeStringField(ActionUtils.STR_PBB_POP, ActionUtils.STR_NOT_APPLICABLE);
break; break;
case COPY_TTL_IN: case COPY_TTL_IN:
jsonGenerator.writeString(ActionUtils.STR_TTL_IN_COPY); jsonGenerator.writeStringField(ActionUtils.STR_TTL_IN_COPY, ActionUtils.STR_NOT_APPLICABLE);
break; break;
case COPY_TTL_OUT: case COPY_TTL_OUT:
jsonGenerator.writeString(ActionUtils.STR_TTL_OUT_COPY); jsonGenerator.writeStringField(ActionUtils.STR_TTL_OUT_COPY, ActionUtils.STR_NOT_APPLICABLE);
break; break;
case DEC_NW_TTL: case DEC_NW_TTL:
jsonGenerator.writeString(ActionUtils.STR_NW_TTL_DEC); jsonGenerator.writeStringField(ActionUtils.STR_NW_TTL_DEC, ActionUtils.STR_NOT_APPLICABLE);
break; break;
case DEC_MPLS_TTL: case DEC_MPLS_TTL:
jsonGenerator.writeString(ActionUtils.STR_MPLS_TTL_DEC); jsonGenerator.writeStringField(ActionUtils.STR_MPLS_TTL_DEC, ActionUtils.STR_NOT_APPLICABLE);
break; break;
case SET_MPLS_LABEL: case SET_MPLS_LABEL:
jsonGenerator.writeNumberField(ActionUtils.STR_MPLS_LABEL_SET, ((OFActionSetMplsLabel)a).getMplsLabel()); jsonGenerator.writeNumberField(ActionUtils.STR_MPLS_LABEL_SET, ((OFActionSetMplsLabel)a).getMplsLabel());
......
...@@ -137,6 +137,7 @@ public class ActionUtils { ...@@ -137,6 +137,7 @@ public class ActionUtils {
public static final String STR_GROUP = "group"; public static final String STR_GROUP = "group";
public static final String STR_FIELD_SET = "set_field"; public static final String STR_FIELD_SET = "set_field";
public static final String STR_EXPERIMENTER = "experimenter"; public static final String STR_EXPERIMENTER = "experimenter";
public static final String STR_NOT_APPLICABLE = "n/a";
/* OF1.3 set-field operations are defined as any OF1.3 match. /* OF1.3 set-field operations are defined as any OF1.3 match.
* We will borrow MatchUtils's String definitions of all OF1.3 * We will borrow MatchUtils's String definitions of all OF1.3
......
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