use of org.opendaylight.protocol.pcep.parser.object.end.points.PCEPP2MPEndPointsIpv6ObjectParser in project bgpcep by opendaylight.
the class BaseParserExtensionActivator method registerObjectParsers.
private static void registerObjectParsers(final List<Registration> regs, final PCEPExtensionProviderContext context) {
final TlvRegistry tlvReg = context.getTlvHandlerRegistry();
final VendorInformationTlvRegistry viTlvReg = context.getVendorInformationTlvRegistry();
final PCEPOpenObjectParser openParser = new PCEPOpenObjectParser(tlvReg, viTlvReg);
regs.add(context.registerObjectParser(openParser));
regs.add(context.registerObjectSerializer(Open.class, openParser));
final PCEPRequestParameterObjectParser rpParser = new PCEPRequestParameterObjectParser(tlvReg, viTlvReg);
regs.add(context.registerObjectParser(rpParser));
regs.add(context.registerObjectSerializer(Rp.class, rpParser));
final PCEPNoPathObjectParser noPathParser = new PCEPNoPathObjectParser(tlvReg, viTlvReg);
regs.add(context.registerObjectParser(noPathParser));
regs.add(context.registerObjectSerializer(NoPath.class, noPathParser));
final PCEPEndPointsObjectSerializer endpointsSerializer = new PCEPEndPointsObjectSerializer();
regs.add(context.registerObjectSerializer(EndpointsObj.class, endpointsSerializer));
final PCEPEndPointsIpv4ObjectParser endpoints4Parser = new PCEPEndPointsIpv4ObjectParser();
regs.add(context.registerObjectParser(endpoints4Parser));
final PCEPEndPointsIpv6ObjectParser endpoints6Parser = new PCEPEndPointsIpv6ObjectParser();
regs.add(context.registerObjectParser(endpoints6Parser));
final PCEPIpv4UnreachDestinationParser unreachIpv4Parser = new PCEPIpv4UnreachDestinationParser();
final PCEPIpv6UnreachDestinationParser unreachIpv6Parser = new PCEPIpv6UnreachDestinationParser();
regs.add(context.registerObjectParser(unreachIpv4Parser));
regs.add(context.registerObjectParser(unreachIpv6Parser));
final PCEPUnreachDestinationSerializer unreachSerializer = new PCEPUnreachDestinationSerializer();
regs.add(context.registerObjectSerializer(UnreachDestinationObj.class, unreachSerializer));
final PCEPP2MPEndPointsIpv4ObjectParser endpoints4Pp2mparser = new PCEPP2MPEndPointsIpv4ObjectParser();
regs.add(context.registerObjectParser(endpoints4Pp2mparser));
final PCEPP2MPEndPointsIpv6ObjectParser endpoints6Pp2mparser = new PCEPP2MPEndPointsIpv6ObjectParser();
regs.add(context.registerObjectParser(endpoints6Pp2mparser));
final EROSubobjectRegistry subRegistry = context.getEROSubobjectHandlerRegistry();
final BranchNodeListObjectParser bncPArser = new BranchNodeListObjectParser(subRegistry);
regs.add(context.registerObjectParser(bncPArser));
regs.add(context.registerObjectSerializer(BranchNodeList.class, bncPArser));
final NonBranchNodeListObjectParser nonBncPArser = new NonBranchNodeListObjectParser(subRegistry);
regs.add(context.registerObjectParser(nonBncPArser));
final PCEPBandwidthObjectParser bwParser = new PCEPBandwidthObjectParser();
final PCEPExistingBandwidthObjectParser bwExistingParser = new PCEPExistingBandwidthObjectParser();
regs.add(context.registerObjectParser(bwParser));
regs.add(context.registerObjectParser(bwExistingParser));
regs.add(context.registerObjectSerializer(Bandwidth.class, bwParser));
regs.add(context.registerObjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reoptimization.bandwidth.object.ReoptimizationBandwidth.class, bwExistingParser));
final PCEPMetricObjectParser metricParser = new PCEPMetricObjectParser();
regs.add(context.registerObjectParser(metricParser));
regs.add(context.registerObjectSerializer(Metric.class, metricParser));
final EROSubobjectRegistry eroSubReg = context.getEROSubobjectHandlerRegistry();
final PCEPExplicitRouteObjectParser eroParser = new PCEPExplicitRouteObjectParser(eroSubReg);
regs.add(context.registerObjectParser(eroParser));
regs.add(context.registerObjectSerializer(Ero.class, eroParser));
final RROSubobjectRegistry rroSubReg = context.getRROSubobjectHandlerRegistry();
final PCEPReportedRouteObjectParser rroParser = new PCEPReportedRouteObjectParser(rroSubReg);
regs.add(context.registerObjectParser(rroParser));
regs.add(context.registerObjectSerializer(Rro.class, rroParser));
final PCEPLspaObjectParser lspaParser = new PCEPLspaObjectParser(tlvReg, viTlvReg);
regs.add(context.registerObjectParser(lspaParser));
regs.add(context.registerObjectSerializer(Lspa.class, lspaParser));
final PCEPIncludeRouteObjectParser iroParser = new PCEPIncludeRouteObjectParser(eroSubReg);
regs.add(context.registerObjectParser(iroParser));
regs.add(context.registerObjectSerializer(Iro.class, iroParser));
final PCEPSvecObjectParser svecParser = new PCEPSvecObjectParser();
regs.add(context.registerObjectParser(svecParser));
regs.add(context.registerObjectSerializer(Svec.class, svecParser));
final PCEPNotificationObjectParser notParser = new PCEPNotificationObjectParser(tlvReg, viTlvReg);
regs.add(context.registerObjectParser(notParser));
regs.add(context.registerObjectSerializer(CNotification.class, notParser));
final PCEPErrorObjectParser errParser = new PCEPErrorObjectParser(tlvReg, viTlvReg);
regs.add(context.registerObjectParser(errParser));
regs.add(context.registerObjectSerializer(ErrorObject.class, errParser));
final PCEPLoadBalancingObjectParser lbParser = new PCEPLoadBalancingObjectParser();
regs.add(context.registerObjectParser(lbParser));
regs.add(context.registerObjectSerializer(LoadBalancing.class, lbParser));
final PCEPCloseObjectParser closeParser = new PCEPCloseObjectParser(tlvReg, viTlvReg);
regs.add(context.registerObjectParser(closeParser));
regs.add(context.registerObjectSerializer(CClose.class, closeParser));
registerExtensionsObjectParsers(regs, context, tlvReg, viTlvReg, eroSubReg, rroSubReg);
}
use of org.opendaylight.protocol.pcep.parser.object.end.points.PCEPP2MPEndPointsIpv6ObjectParser in project bgpcep by opendaylight.
the class PCEPObjectParserTest method testEndPointsObjectP2MPIPv6.
@Test
public void testEndPointsObjectP2MPIPv6() throws IOException, PCEPDeserializerException {
final byte[] destIPBytes = { (byte) 0x04, (byte) 0x42, (byte) 0x00, (byte) 0x38, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x02, (byte) 0x5D, (byte) 0xD2, (byte) 0xFF, (byte) 0xEC, (byte) 0xA1, (byte) 0xB6, (byte) 0x58, (byte) 0x1E, (byte) 0x9F, (byte) 0x50, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x5D, (byte) 0xD2, (byte) 0xFF, (byte) 0xEC, (byte) 0xA1, (byte) 0xB6, (byte) 0x58, (byte) 0x1E, (byte) 0x9F, (byte) 0x50, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
final byte[] srcIPBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
final PCEPP2MPEndPointsIpv6ObjectParser parser = new PCEPP2MPEndPointsIpv6ObjectParser();
final ByteBuf result = Unpooled.wrappedBuffer(destIPBytes);
final EndpointsObjBuilder builder = new EndpointsObjBuilder();
builder.setProcessingRule(true);
builder.setIgnore(false);
builder.setAddressFamily(new P2mpIpv6CaseBuilder().setP2mpIpv6(new P2mpIpv6Builder().setP2mpLeaves(P2mpLeaves.NewLeavesToAdd).setSourceIpv6Address(Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes))).setDestinationIpv6Address(Arrays.asList(new Ipv6AddressNoZone("2:5dd2:ffec:a1b6:581e:9f50::"), new Ipv6AddressNoZone("3:5dd2:ffec:a1b6:581e:9f50::"))).build()).build());
assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer();
final PCEPEndPointsObjectSerializer serializer = new PCEPEndPointsObjectSerializer();
serializer.serializeObject(builder.build(), buf);
assertArrayEquals(result.array(), ByteArray.getAllBytes(buf));
try {
parser.parseObject(new ObjectHeaderImpl(true, true), null);
fail();
} catch (final IllegalArgumentException e) {
assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
}
try {
parser.parseObject(new ObjectHeaderImpl(true, true), Unpooled.EMPTY_BUFFER);
fail();
} catch (final IllegalArgumentException e) {
assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
}
}
Aggregations