use of org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry in project onos by opennetworkinglab.
the class SoamManagerTest method testGetDm.
@Test
public void testGetDm() throws CfmConfigException, SoamConfigException {
expect(deviceService.getDevice(DEVICE_ID1)).andReturn(device1).anyTimes();
replay(deviceService);
expect(mepService.getMep(MDNAME1, MANAME1, MEPID1)).andReturn(mep1).anyTimes();
replay(mepService);
expect(driverService.getDriver(DEVICE_ID1)).andReturn(testDriver).anyTimes();
replay(driverService);
DelayMeasurementEntry dmEntry = soamManager.getDm(MDNAME1, MANAME1, MEPID1, DMID101);
assertNotNull(dmEntry);
assertEquals(DMID101, dmEntry.dmId());
}
use of org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry in project onos by opennetworkinglab.
the class DmWebResourceTest method testGetAllDmsForMep.
@Test
public void testGetAllDmsForMep() throws CfmConfigException, SoamConfigException {
List<DelayMeasurementEntry> dmList = new ArrayList<>();
dmList.add(dm1);
dmList.add(dm2);
expect(soamService.getAllDms(MDNAME1, MANAME1, MEPID1)).andReturn(dmList).anyTimes();
replay(soamService);
final WebTarget wt = target();
final String response = wt.path("md/" + MDNAME1.mdName() + "/ma/" + MANAME1.maName() + "/mep/" + MEPID1.value() + "/dm").request().get(String.class);
assertThat(response, is("{\"dms\":[[" + "{" + "\"dmId\":\"1\"," + "\"sessionStatus\":\"ACTIVE\"," + "\"frameDelayTwoWay\":\"PT0.04S\"," + "\"frameDelayForward\":\"PT0.01S\"," + "\"frameDelayBackward\":\"PT0.03S\"," + "\"interFrameDelayVariationTwoWay\":\"PT0.008S\"," + "\"interFrameDelayVariationForward\":\"PT0.005S\"," + "\"interFrameDelayVariationBackward\":\"PT0.003S\"," + "\"dmCfgType\":\"DMDMM\"," + "\"version\":\"Y17312008\"," + "\"remoteMepId\":2," + "\"priority\":\"PRIO1\"," + "\"measurementsEnabled\":[]," + "\"current\":{" + "\"startTime\":\"" + now + "\"," + "\"elapsedTime\":\"PT1M\"," + "\"suspectStatus\":\"false\"," + "\"frameDelayForwardAvg\":\"PT0.011S\"," + "\"frameDelayBackwardAvg\":\"PT0.01S\"," + "\"frameDelayRangeBackwardAvg\":\"PT0.012S\"" + "}," + "\"historic\":[]" + "},{" + "\"dmId\":\"2\"," + "\"dmCfgType\":\"DMDMM\"," + "\"version\":\"Y17312011\"," + "\"remoteMepId\":2," + "\"priority\":\"PRIO2\"," + "\"measurementsEnabled\":[]," + "\"historic\":[]}]]" + "}"));
}
use of org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry 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