use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.IpNodeIdBuilder in project bgpcep by opendaylight.
the class SrEroSubobjectParserTest method testSrEroSubobjectIpv6NodeIdNAI.
@Test
public void testSrEroSubobjectIpv6NodeIdNAI() throws PCEPDeserializerException {
final SrEroTypeBuilder builder = new SrEroTypeBuilder();
builder.setSidType(SidType.Ipv6NodeId);
builder.setSid(123456L);
builder.setCFlag(false);
builder.setMFlag(false);
builder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv6Address("fe80:cd00::211e:729c"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv6NodeID, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srEroSubobjectWithIpv6NodeID, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.IpNodeIdBuilder in project bgpcep by opendaylight.
the class SrObjectParserTest method testSrEroSerializerWithUpdateLspAugmentation.
@Test
public void testSrEroSerializerWithUpdateLspAugmentation() throws PCEPDeserializerException {
final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
final EroBuilder builder = new EroBuilder();
builder.setProcessingRule(false);
builder.setIgnore(false);
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.update.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder srEroSubBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.update.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder();
srEroSubBuilder.setCFlag(false);
srEroSubBuilder.setMFlag(false);
srEroSubBuilder.setSidType(SidType.Ipv4NodeId);
srEroSubBuilder.setSid(123456L);
srEroSubBuilder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("74.125.43.99"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(srEroSubBuilder.build()).setLoose(false);
builder.setSubobject(Lists.newArrayList(subobjBuilder.build()));
final ByteBuf buffer = Unpooled.buffer();
parser.serializeObject(builder.build(), buffer);
assertArrayEquals(srEroObjectBytes, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.IpNodeIdBuilder in project bgpcep by opendaylight.
the class SrRroSubobjectParserTest method testSrRroSubobjectWithoutBody.
@Test
public void testSrRroSubobjectWithoutBody() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder();
builder.setSidType(SidType.Ipv4NodeId);
builder.setCFlag(false);
builder.setMFlag(false);
builder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("74.125.43.99"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithoutSID, 2))));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithoutSID, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.IpNodeIdBuilder in project bgpcep by opendaylight.
the class SrRroSubobjectParserTest method testSrRroSubobjectIpv6NodeIdNAI.
@Test
public void testSrRroSubobjectIpv6NodeIdNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder();
builder.setSidType(SidType.Ipv6NodeId);
builder.setCFlag(false);
builder.setMFlag(false);
builder.setSid(123456L);
builder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv6Address("fe80:cd00::211e:729c"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv6NodeID, 2))));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithIpv6NodeID, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.IpNodeIdBuilder in project bgpcep by opendaylight.
the class TopologyProviderTest method createSrEroObject.
private static Ero createSrEroObject(final String nai) {
final SrEroTypeBuilder srEroBuilder = new SrEroTypeBuilder();
srEroBuilder.setCFlag(false);
srEroBuilder.setMFlag(false);
srEroBuilder.setSidType(SidType.Ipv4NodeId);
srEroBuilder.setSid(123456L);
srEroBuilder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address(nai))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(srEroBuilder.build()).setLoose(false);
final List<Subobject> subobjects = Lists.newArrayList(subobjBuilder.build());
return new EroBuilder().setProcessingRule(false).setIgnore(false).setSubobject(subobjects).build();
}
Aggregations