use of org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry.DmEntryBuilder in project onos by opennetworkinglab.
the class DmEntryCodecTest method setUp.
@Before
public void setUp() throws Exception, SoamConfigException {
mapper = new ObjectMapper();
context = new CfmCodecContext();
DmEntryBuilder builder = DefaultDelayMeasurementEntry.builder(SoamId.valueOf(12), DmType.DM1DMTX, Version.Y17312008, MepId.valueOf((short) 10), Priority.PRIO4);
builder = builder.sessionStatus(SessionStatus.NOT_ACTIVE);
builder = builder.frameDelayTwoWay(Duration.ofNanos(101 * 1000));
builder = builder.frameDelayForward(Duration.ofNanos(102 * 1000));
builder = builder.frameDelayBackward(Duration.ofNanos(103 * 1000));
builder = builder.interFrameDelayVariationTwoWay(Duration.ofNanos(104 * 1000));
builder = builder.interFrameDelayVariationForward(Duration.ofNanos(105 * 1000));
builder = builder.interFrameDelayVariationBackward(Duration.ofNanos(106 * 1000));
builder.addToMeasurementsEnabled(MeasurementOption.FRAME_DELAY_BACKWARD_MAX);
builder.addToMeasurementsEnabled(MeasurementOption.FRAME_DELAY_TWO_WAY_MAX);
builder.addToMeasurementsEnabled(MeasurementOption.INTER_FRAME_DELAY_VARIATION_BACKWARD_BINS);
dmEntry1 = builder.build();
}
use of org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry.DmEntryBuilder in project onos by opennetworkinglab.
the class DmEntryCodecTest method testEncodeIterableOfDelayMeasurementEntryCodecContext.
@Test
public void testEncodeIterableOfDelayMeasurementEntryCodecContext() throws SoamConfigException {
DmEntryBuilder builder2 = DefaultDelayMeasurementEntry.builder(SoamId.valueOf(14), DmType.DM1DMRX, Version.Y17312011, MepId.valueOf((short) 16), Priority.PRIO5);
builder2.addToMeasurementsEnabled(MeasurementOption.FRAME_DELAY_BACKWARD_MIN);
builder2.addToMeasurementsEnabled(MeasurementOption.FRAME_DELAY_TWO_WAY_MIN);
builder2.addToMeasurementsEnabled(MeasurementOption.INTER_FRAME_DELAY_VARIATION_BACKWARD_MIN);
Collection<DelayMeasurementEntry> dmEntries = new ArrayList<>();
dmEntries.add(dmEntry1);
dmEntries.add(builder2.build());
ObjectNode node = mapper.createObjectNode();
node.set("dm", context.codec(DelayMeasurementEntry.class).encode(dmEntries, context));
assertEquals(2, ((ArrayNode) node.get("dm")).size());
}
Aggregations