use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder 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 RequestsBuilder reqBuilder = new RequestsBuilder();
reqBuilder.setEro(ERO);
final LspBuilder lsp = new LspBuilder().setTlvs(new TlvsBuilder().setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName(SYMBOLIC_NAME)).build()).build()).setPlspId(new PlspId(plspId));
if (delegate.isPresent()) {
lsp.setDelegate(Boolean.TRUE);
}
reqBuilder.setLsp(lsp.build());
final SrpBuilder srpBuilder = new SrpBuilder();
if (remove.isPresent()) {
srpBuilder.addAugmentation(Srp1.class, new Srp1Builder().setRemove(Boolean.TRUE).build());
}
reqBuilder.setSrp(srpBuilder.setOperationId(new SrpIdNumber(0L)).build());
return reqBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder in project bgpcep by opendaylight.
the class SrObjectParserTest method testOpenObjectWithSpcTlv.
@Test
public void testOpenObjectWithSpcTlv() throws PCEPDeserializerException {
final PcepOpenObjectWithSpcTlvParser parser = new PcepOpenObjectWithSpcTlvParser(this.tlvRegistry, this.viTlvRegistry);
final OpenBuilder builder = new OpenBuilder();
builder.setProcessingRule(false);
builder.setIgnore(false);
builder.setVersion(new ProtocolVersion((short) 1));
builder.setKeepalive((short) 30);
builder.setDeadTimer((short) 120);
builder.setSessionId((short) 1);
final Tlvs1 tlv = new Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder().setMsd((short) 1).build()).build();
builder.setTlvs(new TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1Builder().build()).addAugmentation(Tlvs1.class, tlv).addAugmentation(Tlvs3.class, new Tlvs3Builder().build()).build());
final ByteBuf result = Unpooled.wrappedBuffer(openObjectBytes);
assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buffer = Unpooled.buffer();
parser.serializeObject(builder.build(), buffer);
parser.serializeTlvs(null, Unpooled.EMPTY_BUFFER);
parser.serializeTlvs(new TlvsBuilder().build(), Unpooled.EMPTY_BUFFER);
assertArrayEquals(openObjectBytes, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder in project bgpcep by opendaylight.
the class PCCPeerProposal method setPeerSpecificProposal.
@Override
public void setPeerSpecificProposal(@Nonnull final InetSocketAddress address, @Nonnull final TlvsBuilder openBuilder) {
requireNonNull(address);
final LspDbVersion lspDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(this.dbVersion).build();
openBuilder.addAugmentation(Tlvs3.class, new Tlvs3Builder().setLspDbVersion(lspDbVersion).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder in project bgpcep by opendaylight.
the class PcepOpenObjectWithSpcTlvParser method addTlv.
@Override
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs1Builder tlvBuilder = new Tlvs1Builder();
if (tbuilder.getAugmentation(Tlvs1.class) != null) {
final Tlvs1 tlvs = tbuilder.getAugmentation(Tlvs1.class);
if (tlvs.getSrPceCapability() != null) {
tlvBuilder.setSrPceCapability(tlvs.getSrPceCapability());
}
}
if (tlv instanceof SrPceCapability) {
tlvBuilder.setSrPceCapability((SrPceCapability) tlv);
}
tbuilder.addAugmentation(Tlvs1.class, tlvBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder in project bgpcep by opendaylight.
the class TestUtil method createTerminationMsg.
public static TerminationMessage createTerminationMsg() {
final TerminationMessageBuilder terminatMsgBuilder = new TerminationMessageBuilder();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.termination.TlvsBuilder tlvsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.termination.TlvsBuilder();
tlvsBuilder.setReasonTlv(new ReasonTlvBuilder().setReason(Reason.AdministrativelyClosed).build());
tlvsBuilder.setStringInformation(Lists.newArrayList(createStringInfo("error1"), createStringInfo("error1")));
return terminatMsgBuilder.setTlvs(tlvsBuilder.build()).build();
}
Aggregations