Search in sources :

Example 16 with CfmCodecContext

use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.

the class MepLtCreateCodecTest method setUp.

@Before
public void setUp() throws Exception {
    mapper = new ObjectMapper();
    context = new CfmCodecContext();
}
Also used : CfmCodecContext(org.onosproject.cfm.CfmCodecContext) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 17 with CfmCodecContext

use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.

the class DmWebResourceTest method setUpTest.

@Before
public void setUpTest() throws CfmConfigException, SoamConfigException {
    CfmCodecContext context = new CfmCodecContext();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(CfmMepService.class, mepService).add(SoamService.class, soamService).add(CodecService.class, context.codecManager());
    setServiceDirectory(testDirectory);
    DelayMeasurementStatCurrent.DmStatCurrentBuilder dmCurrBuilder1 = (DelayMeasurementStatCurrent.DmStatCurrentBuilder) DefaultDelayMeasurementStatCurrent.builder(Duration.ofMinutes(1), false).startTime(now).frameDelayBackwardAvg(Duration.ofMillis(10)).frameDelayForwardAvg(Duration.ofMillis(11)).frameDelayRangeBackwardAvg(Duration.ofMillis(12));
    dm1 = DefaultDelayMeasurementEntry.builder(DM1, DelayMeasurementCreate.DmType.DMDMM, DelayMeasurementCreate.Version.Y17312008, MepId.valueOf((short) 2), Mep.Priority.PRIO1).sessionStatus(DelayMeasurementEntry.SessionStatus.ACTIVE).frameDelayTwoWay(Duration.ofMillis(40)).frameDelayBackward(Duration.ofMillis(30)).frameDelayForward(Duration.ofMillis(10)).interFrameDelayVariationTwoWay(Duration.ofMillis(8)).interFrameDelayVariationBackward(Duration.ofMillis(3)).interFrameDelayVariationForward(Duration.ofMillis(5)).currentResult((DelayMeasurementStatCurrent) dmCurrBuilder1.build()).build();
    dm2 = DefaultDelayMeasurementEntry.builder(DM2, DelayMeasurementCreate.DmType.DMDMM, DelayMeasurementCreate.Version.Y17312011, MepId.valueOf((short) 2), Mep.Priority.PRIO2).build();
}
Also used : CfmCodecContext(org.onosproject.cfm.CfmCodecContext) SoamService(org.onosproject.incubator.net.l2monitoring.soam.SoamService) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) DefaultDelayMeasurementStatCurrent(org.onosproject.incubator.net.l2monitoring.soam.delay.DefaultDelayMeasurementStatCurrent) DelayMeasurementStatCurrent(org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatCurrent) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 18 with CfmCodecContext

use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.

the class DmWebResourceTest method testCreateDm.

@Test
public void testCreateDm() throws CfmConfigException, SoamConfigException {
    MepEntry mep1 = DefaultMepEntry.builder(MEPID1, DeviceId.deviceId("netconf:1.2.3.4:830"), PortNumber.portNumber(1), Mep.MepDirection.UP_MEP, MDNAME1, MANAME1).buildEntry();
    expect(mepService.getMep(MDNAME1, MANAME1, MEPID1)).andReturn(mep1).anyTimes();
    replay(mepService);
    ObjectMapper mapper = new ObjectMapper();
    CfmCodecContext context = new CfmCodecContext();
    ObjectNode node = mapper.createObjectNode();
    node.set("dm", context.codec(DelayMeasurementCreate.class).encode(dm1, context));
    final WebTarget wt = target();
    final Response response = wt.path("md/" + MDNAME1.mdName() + "/ma/" + MANAME1.maName() + "/mep/" + MEPID1.value() + "/dm").request().post(Entity.json(node.toString()));
    assertEquals(201, response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) CfmCodecContext(org.onosproject.cfm.CfmCodecContext) DefaultMepEntry(org.onosproject.incubator.net.l2monitoring.cfm.DefaultMepEntry) MepEntry(org.onosproject.incubator.net.l2monitoring.cfm.MepEntry) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) WebTarget(javax.ws.rs.client.WebTarget) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test) CfmResourceTest(org.onosproject.cfm.impl.CfmResourceTest)

Example 19 with CfmCodecContext

use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.

the class DmCreateCodecTest method setUp.

@Before
public void setUp() throws Exception {
    mapper = new ObjectMapper();
    context = new CfmCodecContext();
}
Also used : CfmCodecContext(org.onosproject.cfm.CfmCodecContext) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 20 with CfmCodecContext

use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.

the class DmMeasurementOptionCodecTest method setUp.

@Before
public void setUp() throws Exception {
    mapper = new ObjectMapper();
    context = new CfmCodecContext();
}
Also used : CfmCodecContext(org.onosproject.cfm.CfmCodecContext) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Aggregations

CfmCodecContext (org.onosproject.cfm.CfmCodecContext)24 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)19 Before (org.junit.Before)15 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)9 Test (org.junit.Test)9 WebTarget (javax.ws.rs.client.WebTarget)8 Response (javax.ws.rs.core.Response)8 ServiceDirectory (org.onlab.osgi.ServiceDirectory)5 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)5 DefaultMaintenanceAssociation (org.onosproject.incubator.net.l2monitoring.cfm.DefaultMaintenanceAssociation)4 DefaultMaintenanceDomain (org.onosproject.incubator.net.l2monitoring.cfm.DefaultMaintenanceDomain)4 MaintenanceAssociation (org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation)4 MaintenanceDomain (org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain)4 MepId (org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId)3 CfmMdService (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService)3 CfmResourceTest (org.onosproject.cfm.impl.CfmResourceTest)2 DefaultMep (org.onosproject.incubator.net.l2monitoring.cfm.DefaultMep)2 DefaultMepEntry (org.onosproject.incubator.net.l2monitoring.cfm.DefaultMepEntry)2 DefaultMepLtCreate (org.onosproject.incubator.net.l2monitoring.cfm.DefaultMepLtCreate)2 Mep (org.onosproject.incubator.net.l2monitoring.cfm.Mep)2