use of org.opendaylight.protocol.pcep.parser.object.PCEPProcTimeObjectParser in project bgpcep by opendaylight.
the class PCEPObjectParserTest method testProcTimeObject.
@Test
public void testProcTimeObject() throws PCEPDeserializerException {
final byte[] proctimeBytes = { /* object header */
0x1A, 0x10, 0x00, 0x1C, /* E flag */
0x00, 0x00, 0x00, 0x01, /* current proc. time */
0x00, 0x00, 0x00, 0x01, /* min proc. time */
0x00, 0x00, 0x00, 0x02, /* max proc time */
0x00, 0x00, 0x00, 0x03, /* average proc time */
0x00, 0x00, 0x00, 0x04, /* variance proc time */
0x00, 0x00, 0x00, 0x05 };
final PCEPProcTimeObjectParser parser = new PCEPProcTimeObjectParser();
final ProcTime procTime = new ProcTimeBuilder().setEstimated(true).setAverageProcTime(4L).setCurrentProcTime(1L).setMaxProcTime(3L).setMinProcTime(2L).setVarianceProcTime(5L).build();
final ByteBuf result = Unpooled.wrappedBuffer(proctimeBytes);
assertEquals(procTime, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer(proctimeBytes.length);
parser.serializeObject(procTime, buf);
assertArrayEquals(proctimeBytes, buf.array());
}
use of org.opendaylight.protocol.pcep.parser.object.PCEPProcTimeObjectParser in project bgpcep by opendaylight.
the class BaseParserExtensionActivator method registerMonitoringExtensionParsers.
private static void registerMonitoringExtensionParsers(final List<AutoCloseable> regs, final PCEPExtensionProviderContext context, final TlvRegistry tlvReg, final VendorInformationTlvRegistry viTlvReg) {
final PCEPMonitoringObjectParser monParser = new PCEPMonitoringObjectParser(tlvReg, viTlvReg);
regs.add(context.registerObjectParser(PCEPMonitoringObjectParser.CLASS, PCEPMonitoringObjectParser.TYPE, monParser));
regs.add(context.registerObjectSerializer(Monitoring.class, monParser));
final PCEPPccIdReqIPv4ObjectParser pccIdIPv4Parser = new PCEPPccIdReqIPv4ObjectParser();
regs.add(context.registerObjectParser(PCEPPccIdReqIPv4ObjectParser.CLASS, PCEPPccIdReqIPv4ObjectParser.IPV4_TYPE, pccIdIPv4Parser));
regs.add(context.registerObjectSerializer(PccIdReq.class, pccIdIPv4Parser));
final PCEPPccIdReqIPv6ObjectParser pccIdIPv6Parser = new PCEPPccIdReqIPv6ObjectParser();
regs.add(context.registerObjectParser(PCEPPccIdReqIPv6ObjectParser.CLASS, PCEPPccIdReqIPv6ObjectParser.IPV6_TYPE, pccIdIPv6Parser));
regs.add(context.registerObjectSerializer(PccIdReq.class, pccIdIPv6Parser));
final PCEPPceIdIPv4ObjectParser pceIdIP4Parser = new PCEPPceIdIPv4ObjectParser();
regs.add(context.registerObjectParser(PCEPPceIdIPv4ObjectParser.CLASS, PCEPPceIdIPv4ObjectParser.IPV4_TYPE, pceIdIP4Parser));
regs.add(context.registerObjectSerializer(PceId.class, pceIdIP4Parser));
final PCEPPceIdIPv6ObjectParser pceIdIP6Parser = new PCEPPceIdIPv6ObjectParser();
regs.add(context.registerObjectParser(PCEPPceIdIPv6ObjectParser.CLASS, PCEPPceIdIPv6ObjectParser.IPV6_TYPE, pceIdIP6Parser));
regs.add(context.registerObjectSerializer(PceId.class, pceIdIP6Parser));
final PCEPProcTimeObjectParser procTimeParser = new PCEPProcTimeObjectParser();
regs.add(context.registerObjectParser(PCEPProcTimeObjectParser.CLASS, PCEPProcTimeObjectParser.TYPE, procTimeParser));
regs.add(context.registerObjectSerializer(ProcTime.class, procTimeParser));
final PCEPOverloadObjectParser overloadParser = new PCEPOverloadObjectParser();
regs.add(context.registerObjectParser(PCEPOverloadObjectParser.CLASS, PCEPOverloadObjectParser.TYPE, overloadParser));
regs.add(context.registerObjectSerializer(Overload.class, overloadParser));
}
Aggregations