use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Srp1Builder in project bgpcep by opendaylight.
the class CInitiated00SrpObjectParser method parseFlags.
@Override
protected void parseFlags(final SrpBuilder builder, final ByteBuf bytes) {
final BitArray flags = BitArray.valueOf(bytes, FLAGS_SIZE);
builder.addAugmentation(Srp1.class, new Srp1Builder().setRemove(flags.get(REMOVE_FLAG)).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Srp1Builder in project bgpcep by opendaylight.
the class PCEPObjectParserTest method testSRPObjectWithPSTTlv.
@Test
public void testSRPObjectWithPSTTlv() throws PCEPDeserializerException {
final byte[] srpObjectWithPstTlvBytes = { 0x21, 0x10, 0x00, 0x14, 0x0, 0x0, 0x0, 0x01, 0x0, 0x0, 0x0, 0x01, /* pst-tlv */
0x0, 0x1C, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0 };
final InitiatedSrpObjectParser parser = new InitiatedSrpObjectParser(this.tlvRegistry, this.viTlvRegistry);
final SrpBuilder builder = new SrpBuilder().setProcessingRule(false).setIgnore(false).setOperationId(new SrpIdNumber(Uint32.ONE)).addAugmentation(new Srp1Builder().setRemove(true).build()).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.srp.TlvsBuilder().setPathSetupType(new PathSetupTypeBuilder().setPst(Uint8.ZERO).build()).build());
final ByteBuf result = Unpooled.wrappedBuffer(srpObjectWithPstTlvBytes);
assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer();
parser.serializeObject(builder.build(), buf);
assertArrayEquals(srpObjectWithPstTlvBytes, ByteArray.getAllBytes(buf));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Srp1Builder in project bgpcep by opendaylight.
the class InitiatedSrpObjectParser method parseFlags.
@Override
protected void parseFlags(final SrpBuilder builder, final ByteBuf bytes) {
final BitArray flags = BitArray.valueOf(bytes, FLAGS_SIZE);
builder.addAugmentation(new Srp1Builder().setRemove(flags.get(REMOVE_FLAG)).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Srp1Builder in project bgpcep by opendaylight.
the class PCCTunnelManagerImplTest method createRequests.
private static Requests createRequests(final long plspId, final Optional<Boolean> remove, final Optional<Boolean> delegate) {
final LspBuilder lsp = new LspBuilder().setTlvs(new TlvsBuilder().setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName(SYMBOLIC_NAME)).build()).build()).setPlspId(new PlspId(Uint32.valueOf(plspId)));
if (delegate.isPresent()) {
lsp.setDelegate(Boolean.TRUE);
}
final SrpBuilder srpBuilder = new SrpBuilder();
if (remove.isPresent()) {
srpBuilder.addAugmentation(new Srp1Builder().setRemove(Boolean.TRUE).build());
}
return new RequestsBuilder().setEro(ERO).setLsp(lsp.build()).setSrp(srpBuilder.setOperationId(new SrpIdNumber(Uint32.ZERO)).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Srp1Builder in project bgpcep by opendaylight.
the class PCEPTopologySessionListener 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(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.rev200720.srp.object.srp.TlvsBuilder().setPathSetupType(maybePST.get()).build());
}
rb.setSrp(srpBuilder.build());
rb.setLsp(new LspBuilder().setRemove(Boolean.FALSE).setPlspId(reportedLsp.getPlspId()).setDelegate(reportedLsp.getDelegate()).build());
return rb.build();
}
Aggregations