import org.junit.Before;
import org.junit.Test;
import org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation;
-import org.opendaylight.protocol.pcep.impl.object.PCEPBandwidthObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPClassTypeObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPCloseObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPEndPointsIpv4ObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPEndPointsIpv6ObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPErrorObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPExcludeRouteObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPExistingBandwidthObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPExplicitRouteObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPGlobalConstraintsObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPIncludeRouteObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPLoadBalancingObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPLspaObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPMetricObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPMonitoringObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPNoPathObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPNotificationObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPObjectiveFunctionObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPOpenObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPOverloadObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPPathKeyObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPPccIdReqIPv4ObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPPccIdReqIPv6ObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPPceIdIPv4ObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPPceIdIPv6ObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPProcTimeObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPReportedRouteObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPRequestParameterObjectParser;
-import org.opendaylight.protocol.pcep.impl.object.PCEPSvecObjectParser;
+import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
+import org.opendaylight.protocol.pcep.parser.object.PCEPBandwidthObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPClassTypeObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPCloseObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPEndPointsIpv4ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPEndPointsIpv6ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPErrorObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPExcludeRouteObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPExistingBandwidthObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPExplicitRouteObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPGlobalConstraintsObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPIncludeRouteObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPLoadBalancingObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPLspaObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPMetricObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPMonitoringObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPNoPathObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPNotificationObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPObjectiveFunctionObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPOpenObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPOverloadObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPPathKeyObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPPccIdReqIPv4ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPPccIdReqIPv6ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPPceIdIPv4ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPPceIdIPv6ObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPProcTimeObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPReportedRouteObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPRequestParameterObjectParser;
+import org.opendaylight.protocol.pcep.parser.object.PCEPSvecObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.util.Ipv4Util;
import org.opendaylight.protocol.util.Ipv6Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth;
private VendorInformationTlvRegistry viTlvRegistry;
private SimplePCEPExtensionProviderContext ctx;
- private Activator act;
+ private BaseParserExtensionActivator act;
private TestVendorInformationActivator viAct;
@Before
public void setUp() {
this.ctx = new SimplePCEPExtensionProviderContext();
- this.act = new Activator();
+ this.act = new BaseParserExtensionActivator();
this.viAct = new TestVendorInformationActivator();
this.act.start(this.ctx);
this.viAct.start(this.ctx);
final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPBandwidthObject2UpperBounds.bin"));
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization
- .bandwidth.object.BandwidthBuilder builder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
- .ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.BandwidthBuilder();
+ .bandwidth.object.ReoptimizationBandwidthBuilder builder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
+ .ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidthBuilder();
builder.setProcessingRule(true);
builder.setIgnore(true);
builder.setBandwidth(new Bandwidth(new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }));
builder.setProcessingRule(true);
builder.setIgnore(false);
builder.setAddressFamily(new Ipv4CaseBuilder().setIpv4(
- new Ipv4Builder().setSourceIpv4Address(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes))).setDestinationIpv4Address(
- Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(destIPBytes))).build()).build());
+ new Ipv4Builder().setSourceIpv4Address(Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes))).setDestinationIpv4Address(
+ Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(destIPBytes))).build()).build());
assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer();
builder.setProcessingRule(true);
builder.setIgnore(false);
builder.setAddressFamily(new Ipv6CaseBuilder().setIpv6(
- new Ipv6Builder().setSourceIpv6Address(Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes))).setDestinationIpv6Address(
- Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(destIPBytes))).build()).build());
+ new Ipv6Builder().setSourceIpv6Address(Ipv6Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes))).setDestinationIpv6Address(
+ Ipv6Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(destIPBytes))).build()).build());
assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer();
- parser.serializeObject(builder.build(), buf);
+ PCEPEndPointsIpv6ObjectParser.serializeObject(builder.build(), buf);
assertArrayEquals(result.array(),ByteArray.getAllBytes(buf));
try {
0x7f, 0x00, 0x00, 0x01
};
final PCEPPccIdReqIPv4ObjectParser parser = new PCEPPccIdReqIPv4ObjectParser();
- final PccIdReq pccIdReq = new PccIdReqBuilder().setIpAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).build();
+ final PccIdReq pccIdReq = new PccIdReqBuilder().setIpAddress(new IpAddressNoZone(new Ipv4AddressNoZone("127.0.0.1"))).build();
final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
assertEquals(pccIdReq, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
0x00, 0x00, 0x00, 0x01
};
final PCEPPccIdReqIPv6ObjectParser parser = new PCEPPccIdReqIPv6ObjectParser();
- final PccIdReq pccIdReq = new PccIdReqBuilder().setIpAddress(new IpAddress(new Ipv6Address("::1"))).build();
+ final PccIdReq pccIdReq = new PccIdReqBuilder().setIpAddress(new IpAddressNoZone(new Ipv6AddressNoZone("::1"))).build();
final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
assertEquals(pccIdReq, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
0x7f, 0x00, 0x00, 0x01
};
final PCEPPceIdIPv4ObjectParser parser = new PCEPPceIdIPv4ObjectParser();
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pce.id.object.PceId pceId = new PceIdBuilder().setIpAddress(new IpAddress(
- new Ipv4Address("127.0.0.1"))).build();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pce.id.object.PceId pceId = new PceIdBuilder().setIpAddress(new IpAddressNoZone(
+ new Ipv4AddressNoZone("127.0.0.1"))).build();
final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
assertEquals(pceId, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
0x00, 0x00, 0x00, 0x01
};
final PCEPPceIdIPv6ObjectParser parser = new PCEPPceIdIPv6ObjectParser();
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pce.id.object.PceId pccIdReq = new PceIdBuilder().setIpAddress(new IpAddress(
- new Ipv6Address("::1"))).build();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pce.id.object.PceId pccIdReq = new PceIdBuilder().setIpAddress(new IpAddressNoZone(
+ new Ipv6AddressNoZone("::1"))).build();
final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
assertEquals(pccIdReq, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));