use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder in project bgpcep by opendaylight.
the class SrRroSubobjectParserTest method testSrRroSubobjectUnnumberedNAI.
@Test
public void testSrRroSubobjectUnnumberedNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder();
builder.setSidType(SidType.Unnumbered);
builder.setSid(123456L);
builder.setCFlag(false);
builder.setMFlag(false);
builder.setNai(new UnnumberedAdjacencyBuilder().setLocalNodeId(1L).setLocalInterfaceId(2L).setRemoteNodeId(3L).setRemoteInterfaceId(4L).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithUnnumbered, 2))));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithUnnumbered, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder in project bgpcep by opendaylight.
the class SrRroSubobjectParserTest method testSrRroSubobjectIpv4AdjacencyNAI.
@Test
public void testSrRroSubobjectIpv4AdjacencyNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder();
builder.setSidType(SidType.Ipv4Adjacency);
builder.setSid(123456L);
builder.setCFlag(false);
builder.setMFlag(false);
builder.setNai(new IpAdjacencyBuilder().setLocalIpAddress(new IpAddress(new Ipv4Address("74.125.43.99"))).setRemoteIpAddress(new IpAddress(new Ipv4Address("74.125.43.100"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv4Adjacency, 2))));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithIpv4Adjacency, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder in project bgpcep by opendaylight.
the class SrRroSubobjectParserTest method testSrRroSubobjectWithoutNAI.
@Test
public void testSrRroSubobjectWithoutNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder();
builder.setSidType(SidType.Ipv4NodeId);
builder.setSid(123470L);
builder.setCFlag(true);
builder.setMFlag(true);
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithoutNAI, 2))));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithoutNAI, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder in project bgpcep by opendaylight.
the class SrRroSubobjectParserTest method testSrRroSubobjectIpv4NodeIdNAI.
@Test
public void testSrRroSubobjectIpv4NodeIdNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder();
builder.setSidType(SidType.Ipv4NodeId);
builder.setSid(123456L);
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(srRroSubobjectWithIpv4NodeID, 2))));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithIpv4NodeID, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder in project bgpcep by opendaylight.
the class SrRroSubobjectParserTest method testSrRroSubobjectIpv6AdjacencyNAI.
@Test
public void testSrRroSubobjectIpv6AdjacencyNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder();
builder.setSidType(SidType.Ipv6Adjacency);
builder.setSid(123456L);
builder.setCFlag(false);
builder.setMFlag(false);
builder.setNai(new IpAdjacencyBuilder().setLocalIpAddress(new IpAddress(new Ipv6Address("fe80:cd00::211e:729c"))).setRemoteIpAddress(new IpAddress(new Ipv6Address("fe80:cd00::211e:729d"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv6Adjacency, 2))));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithIpv6Adjacency, ByteArray.getAllBytes(buffer));
}
Aggregations