use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.
the class MdWebResourceTest method setUpTest.
@Before
public void setUpTest() throws CfmConfigException {
CfmCodecContext context = new CfmCodecContext();
ServiceDirectory testDirectory = new TestServiceDirectory().add(CfmMdService.class, mdService).add(CodecService.class, context.codecManager());
setServiceDirectory(testDirectory);
mdList = new ArrayList<>();
mdList.add(DefaultMaintenanceDomain.builder(MDNAME1).mdLevel(MaintenanceDomain.MdLevel.LEVEL1).build());
mdList.add(DefaultMaintenanceDomain.builder(MDNAME2).mdLevel(MaintenanceDomain.MdLevel.LEVEL2).build());
}
use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.
the class LmWebResourceTest 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);
lm1 = DefaultLmEntry.builder(DelayMeasurementCreate.Version.Y17312008, MepId.valueOf((short) 10), Mep.Priority.PRIO1, LossMeasurementCreate.LmType.LMLMM, LMID1).build();
lm2 = DefaultLmEntry.builder(DelayMeasurementCreate.Version.Y17312011, MepId.valueOf((short) 10), Mep.Priority.PRIO2, LossMeasurementCreate.LmType.LMLMM, LMID2).measuredAvailabilityBackwardStatus(LossMeasurementEntry.AvailabilityType.AVAILABLE).measuredAvailabilityForwardStatus(LossMeasurementEntry.AvailabilityType.UNKNOWN).measuredBackwardFlr(MilliPct.ofPercent(49.9f)).measuredForwardFlr(MilliPct.ofRatio(0.51f)).measuredBackwardLastTransitionTime(now).measuredForwardLastTransitionTime(now).build();
}
use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.
the class LmWebResourceTest method testCreateLm.
@Test
public void testCreateLm() 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("lm", context.codec(LossMeasurementCreate.class).encode(lm1, context));
final WebTarget wt = target();
final Response response = wt.path("md/" + MDNAME1.mdName() + "/ma/" + MANAME1.maName() + "/mep/" + MEPID1.value() + "/lm").request().post(Entity.json(node.toString()));
assertEquals(201, response.getStatus());
}
use of org.onosproject.cfm.CfmCodecContext in project onos by opennetworkinglab.
the class MaWebResourceTest method setUpTest.
@Before
public void setUpTest() throws CfmConfigException {
CfmCodecContext context = new CfmCodecContext();
ServiceDirectory testDirectory = new TestServiceDirectory().add(CfmMdService.class, mdService).add(CodecService.class, context.codecManager());
setServiceDirectory(testDirectory);
ma1 = DefaultMaintenanceAssociation.builder(MANAME1, MDNAME1.getNameLength()).addToRemoteMepIdList(MepId.valueOf((short) 101)).addToRemoteMepIdList(MepId.valueOf((short) 102)).ccmInterval(MaintenanceAssociation.CcmInterval.INTERVAL_3MS).maNumericId((short) 1).addToComponentList(DefaultComponent.builder(1).tagType(Component.TagType.VLAN_STAG).mhfCreationType(Component.MhfCreationType.NONE).idPermission(Component.IdPermissionType.MANAGE).addToVidList(VlanId.vlanId((short) 1010)).build()).build();
}
Aggregations