Search in sources :

Example 1 with DmEntryBuilder

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();
}
Also used : CfmCodecContext(org.onosproject.cfm.CfmCodecContext) DmEntryBuilder(org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry.DmEntryBuilder) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 2 with DmEntryBuilder

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());
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) DmEntryBuilder(org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry.DmEntryBuilder) DelayMeasurementEntry(org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry) DefaultDelayMeasurementEntry(org.onosproject.incubator.net.l2monitoring.soam.delay.DefaultDelayMeasurementEntry) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

DmEntryBuilder (org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry.DmEntryBuilder)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 Test (org.junit.Test)1 CfmCodecContext (org.onosproject.cfm.CfmCodecContext)1 DefaultDelayMeasurementEntry (org.onosproject.incubator.net.l2monitoring.soam.delay.DefaultDelayMeasurementEntry)1 DelayMeasurementEntry (org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry)1