use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType in project bgpcep by opendaylight.
the class SrTlvParserTest method testPathSetupTypeTlvParser.
@Test
public void testPathSetupTypeTlvParser() throws PCEPDeserializerException {
final SrPathSetupTypeTlvParser parser = new SrPathSetupTypeTlvParser();
final PathSetupType pstTlv = new PathSetupTypeBuilder().setPst((short) 1).build();
assertEquals(pstTlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(SR_TE_PST_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(pstTlv, buff);
assertArrayEquals(SR_TE_PST_BYTES, ByteArray.getAllBytes(buff));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testUnsupportedPSTSerializer.
@Test(expected = IllegalArgumentException.class)
public void testUnsupportedPSTSerializer() {
final PathSetupTypeTlvParser parser = new PathSetupTypeTlvParser();
final PathSetupType pstTlv = new PathSetupTypeBuilder().setPst((short) 1).build();
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(pstTlv, buff);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testPathSetupTypeTlvParser.
@Test
public void testPathSetupTypeTlvParser() throws PCEPDeserializerException {
final PathSetupTypeTlvParser parser = new PathSetupTypeTlvParser();
final PathSetupType pstTlv = new PathSetupTypeBuilder().setPst((short) 0).build();
assertEquals(pstTlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(PST_TLV_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(pstTlv, buff);
assertArrayEquals(PST_TLV_BYTES, ByteArray.getAllBytes(buff));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType in project bgpcep by opendaylight.
the class PathSetupTypeTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof PathSetupType, "PathSetupType is mandatory.");
final PathSetupType pstTlv = (PathSetupType) tlv;
Preconditions.checkArgument(checkPST(pstTlv.getPst()), UNSUPPORTED_PST);
final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
body.writeZero(OFFSET);
writeUnsignedByte(pstTlv.getPst(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType in project bgpcep by opendaylight.
the class Stateful07TopologySessionListener method buildRequest.
private Requests buildRequest(final Optional<ReportedLsp> rep, final Lsp reportedLsp) {
// Build the request and send it
final RequestsBuilder rb = new RequestsBuilder();
final SrpBuilder srpBuilder = new SrpBuilder().addAugmentation(Srp1.class, new Srp1Builder().setRemove(Boolean.TRUE).build()).setOperationId(nextRequest()).setProcessingRule(Boolean.TRUE);
final Optional<PathSetupType> maybePST = getPST(rep);
if (maybePST.isPresent()) {
srpBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.TlvsBuilder().setPathSetupType(maybePST.get()).build());
}
rb.setSrp(srpBuilder.build());
rb.setLsp(new LspBuilder().setRemove(Boolean.FALSE).setPlspId(reportedLsp.getPlspId()).setDelegate(reportedLsp.isDelegate()).build());
return rb.build();
}
Aggregations