use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.
the class MdWebResourceTest method testCreateMd.
@Test
public void testCreateMd() throws CfmConfigException {
MaintenanceDomain md3 = DefaultMaintenanceDomain.builder(MdIdCharStr.asMdId("md-3")).mdLevel(MaintenanceDomain.MdLevel.LEVEL3).mdNumericId((short) 3).build();
expect(mdService.createMaintenanceDomain(mdList.get(1))).andReturn(false).anyTimes();
replay(mdService);
ObjectMapper mapper = new ObjectMapper();
CfmCodecContext context = new CfmCodecContext();
ObjectNode node = mapper.createObjectNode();
node.set("md", context.codec(MaintenanceDomain.class).encode(mdList.get(1), context));
final WebTarget wt = target();
final Response response = wt.path("md").request().post(Entity.json(node.toString()));
assertEquals(201, response.getStatus());
}
use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.
the class MepEntryCodecTest method setUp.
@Before
public void setUp() throws Exception, CfmConfigException {
mapper = new ObjectMapper();
context = new CfmCodecContext();
MepEntryBuilder builder = DefaultMepEntry.builder(MepId.valueOf((short) 22), DeviceId.deviceId("netconf:1234:830"), PortNumber.portNumber(2), MepDirection.UP_MEP, MdIdCharStr.asMdId("md-1"), MaIdCharStr.asMaId("ma-1-1")).macAddress(MacAddress.valueOf("aa:bb:cc:dd:ee:ff"));
builder = (MepEntryBuilder) builder.administrativeState(true).cciEnabled(true).ccmLtmPriority(Priority.PRIO1);
mepEntry1 = builder.buildEntry();
}
use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.
the class RemoteMepEntryCodecTest method setUp.
@Before
public void setUp() throws Exception, CfmConfigException {
mapper = new ObjectMapper();
context = new CfmCodecContext();
remoteMep1 = DefaultRemoteMepEntry.builder(MepId.valueOf((short) 10), RemoteMepState.RMEP_OK).failedOrOkTime(Duration.ofMillis(546546546L)).interfaceStatusTlvType(InterfaceStatusTlvType.IS_LOWERLAYERDOWN).macAddress(MacAddress.IPV4_MULTICAST).portStatusTlvType(PortStatusTlvType.PS_NO_STATUS_TLV).rdi(true).senderIdTlvType(SenderIdTlvType.SI_NETWORK_ADDRESS).build();
}
use of org.onosproject.cfm.CfmCodecContext 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.cfm.CfmCodecContext in project onos by opennetworkinglab.
the class MaWebResourceTest method testCreateMa.
@Test
public void testCreateMa() throws CfmConfigException {
MaintenanceDomain md1 = DefaultMaintenanceDomain.builder(MDNAME1).mdLevel(MaintenanceDomain.MdLevel.LEVEL2).build();
expect(mdService.getMaintenanceDomain(MDNAME1)).andReturn(Optional.ofNullable(md1)).anyTimes();
expect(mdService.createMaintenanceAssociation(MDNAME1, ma1)).andReturn(false).anyTimes();
replay(mdService);
ObjectMapper mapper = new ObjectMapper();
CfmCodecContext context = new CfmCodecContext();
ObjectNode node = mapper.createObjectNode();
node.set("ma", context.codec(MaintenanceAssociation.class).encode(ma1, context));
final WebTarget wt = target();
final Response response = wt.path("md/" + MDNAME1.mdName() + "/ma").request().post(Entity.json(node.toString()));
assertEquals(201, response.getStatus());
}
Aggregations