ONOS-574 - Complete REST APIs for flows
- codecs for all objects referenced by flows
- codecs for HostToHost and PointToPoint intents
- standardized on context.codec() rather than direct calls to new codec()
Change-Id: I94fcb6e31a9161132c6efc2793b9c46fa3cc4570
diff --git a/web/api/src/main/java/org/onosproject/codec/impl/TrafficTreatmentCodec.java b/web/api/src/main/java/org/onosproject/codec/impl/TrafficTreatmentCodec.java
index c2a9a78..ba804d1 100644
--- a/web/api/src/main/java/org/onosproject/codec/impl/TrafficTreatmentCodec.java
+++ b/web/api/src/main/java/org/onosproject/codec/impl/TrafficTreatmentCodec.java
@@ -37,9 +37,10 @@
final ArrayNode jsonInstructions = result.putArray("instructions");
if (treatment.instructions() != null) {
+ final JsonCodec<Instruction> instructionCodec =
+ context.codec(Instruction.class);
for (final Instruction instruction : treatment.instructions()) {
- // TODO: would be better to have a codec that understands instructions
- jsonInstructions.add(instruction.toString());
+ jsonInstructions.add(instructionCodec.encode(instruction, context));
}
}