Search in sources :

Example 1 with PCEPMonitoringObjectParser

use of org.opendaylight.protocol.pcep.parser.object.PCEPMonitoringObjectParser in project bgpcep by opendaylight.

the class PCEPObjectParserTest method testMonitoringObject.

@Test
public void testMonitoringObject() throws PCEPDeserializerException {
    final byte[] monitoringBytes = { /* object header */
    0x13, 0x10, 0x00, 0x0C, /* flags */
    0x00, 0x00, 0x00, 0x01, /* monitoring-id=16 */
    0x00, 0x00, 0x00, 0x10 };
    final PCEPMonitoringObjectParser parser = new PCEPMonitoringObjectParser(this.tlvRegistry, this.viTlvRegistry);
    final Monitoring monitoring = new MonitoringBuilder().setMonitoringId(16L).setFlags(new Flags(false, false, true, false, false)).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.monitoring.TlvsBuilder().build()).build();
    final ByteBuf result = Unpooled.wrappedBuffer(monitoringBytes);
    assertEquals(monitoring, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
    final ByteBuf buf = Unpooled.buffer(monitoringBytes.length);
    parser.serializeObject(monitoring, buf);
    assertArrayEquals(monitoringBytes, buf.array());
}
Also used : MonitoringBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.MonitoringBuilder) ObjectHeaderImpl(org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl) Flags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.Monitoring.Flags) ByteBuf(io.netty.buffer.ByteBuf) PCEPMonitoringObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPMonitoringObjectParser) Monitoring(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.Monitoring) Test(org.junit.Test)

Example 2 with PCEPMonitoringObjectParser

use of org.opendaylight.protocol.pcep.parser.object.PCEPMonitoringObjectParser 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));
}
Also used : PCEPProcTimeObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPProcTimeObjectParser) Overload(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.object.Overload) PCEPOverloadObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPOverloadObjectParser) PceId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pce.id.object.PceId) PccIdReq(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcc.id.req.object.PccIdReq) PCEPPccIdReqIPv6ObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPPccIdReqIPv6ObjectParser) PCEPPceIdIPv4ObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPPceIdIPv4ObjectParser) PCEPPceIdIPv6ObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPPceIdIPv6ObjectParser) ProcTime(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.proc.time.object.ProcTime) PCEPMonitoringObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPMonitoringObjectParser) PCEPPccIdReqIPv4ObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPPccIdReqIPv4ObjectParser) Monitoring(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.Monitoring)

Aggregations

PCEPMonitoringObjectParser (org.opendaylight.protocol.pcep.parser.object.PCEPMonitoringObjectParser)2 Monitoring (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.Monitoring)2 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 PCEPOverloadObjectParser (org.opendaylight.protocol.pcep.parser.object.PCEPOverloadObjectParser)1 PCEPPccIdReqIPv4ObjectParser (org.opendaylight.protocol.pcep.parser.object.PCEPPccIdReqIPv4ObjectParser)1 PCEPPccIdReqIPv6ObjectParser (org.opendaylight.protocol.pcep.parser.object.PCEPPccIdReqIPv6ObjectParser)1 PCEPPceIdIPv4ObjectParser (org.opendaylight.protocol.pcep.parser.object.PCEPPceIdIPv4ObjectParser)1 PCEPPceIdIPv6ObjectParser (org.opendaylight.protocol.pcep.parser.object.PCEPPceIdIPv6ObjectParser)1 PCEPProcTimeObjectParser (org.opendaylight.protocol.pcep.parser.object.PCEPProcTimeObjectParser)1 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)1 Flags (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.Monitoring.Flags)1 MonitoringBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.MonitoringBuilder)1 Overload (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.object.Overload)1 PccIdReq (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcc.id.req.object.PccIdReq)1 PceId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pce.id.object.PceId)1 ProcTime (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.proc.time.object.ProcTime)1