Search in sources :

Example 6 with DelayMeasurementEntry

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());
}
Also used : DelayMeasurementEntry(org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry) DefaultDelayMeasurementEntry(org.onosproject.incubator.net.l2monitoring.soam.delay.DefaultDelayMeasurementEntry) Test(org.junit.Test)

Example 7 with DelayMeasurementEntry

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\":[]}]]" + "}"));
}
Also used : DelayMeasurementEntry(org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry) DefaultDelayMeasurementEntry(org.onosproject.incubator.net.l2monitoring.soam.delay.DefaultDelayMeasurementEntry) ArrayList(java.util.ArrayList) WebTarget(javax.ws.rs.client.WebTarget) Test(org.junit.Test) CfmResourceTest(org.onosproject.cfm.impl.CfmResourceTest)

Example 8 with DelayMeasurementEntry

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());
}
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

DelayMeasurementEntry (org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry)8 DefaultDelayMeasurementEntry (org.onosproject.incubator.net.l2monitoring.soam.delay.DefaultDelayMeasurementEntry)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 Consumes (javax.ws.rs.Consumes)2 GET (javax.ws.rs.GET)2 Produces (javax.ws.rs.Produces)2 WebTarget (javax.ws.rs.client.WebTarget)2 CfmResourceTest (org.onosproject.cfm.impl.CfmResourceTest)2 MaIdShort (org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort)2 MdId (org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId)2 MepId (org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId)2 CfmConfigException (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException)2 SoamConfigException (org.onosproject.incubator.net.l2monitoring.soam.SoamConfigException)2 SoamService (org.onosproject.incubator.net.l2monitoring.soam.SoamService)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 HashMap (java.util.HashMap)1 Entry (java.util.Map.Entry)1