use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.rp.TlvsBuilder in project bgpcep by opendaylight.
the class Stateful07LspaObjectParser method addTlv.
@Override
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs2Builder nameBuilder = new Tlvs2Builder();
if (tbuilder.getAugmentation(Tlvs2.class) != null) {
final Tlvs2 t = tbuilder.getAugmentation(Tlvs2.class);
if (t.getSymbolicPathName() != null) {
nameBuilder.setSymbolicPathName(t.getSymbolicPathName());
}
}
if (tlv instanceof SymbolicPathName) {
nameBuilder.setSymbolicPathName((SymbolicPathName) tlv);
}
tbuilder.addAugmentation(Tlvs2.class, nameBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.rp.TlvsBuilder in project bgpcep by opendaylight.
the class BasePCEPSessionProposalFactory method getSessionProposal.
@Override
public Open getSessionProposal(final InetSocketAddress address, final int sessionId, final PCEPPeerProposal peerProposal) {
final OpenBuilder oBuilder = new OpenBuilder();
oBuilder.setSessionId((short) sessionId);
oBuilder.setKeepalive((short) BasePCEPSessionProposalFactory.this.keepAlive);
if (BasePCEPSessionProposalFactory.this.keepAlive == 0) {
oBuilder.setDeadTimer((short) 0);
} else {
oBuilder.setDeadTimer((short) BasePCEPSessionProposalFactory.this.deadTimer);
}
final TlvsBuilder builder = new TlvsBuilder();
addTlvs(address, builder);
if (peerProposal != null) {
peerProposal.setPeerSpecificProposal(address, builder);
}
return oBuilder.setTlvs(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.rp.TlvsBuilder in project bgpcep by opendaylight.
the class PcRptMessageCodecTest method testGetValidReportsPositive.
@Test
public void testGetValidReportsPositive() {
final PcRptMessageCodec codec = new PcRptMessageCodec(this.ctx.getObjectHandlerRegistry());
final BandwidthUsage bw = new BandwidthUsageBuilder().setBwSample(BW).build();
final Ipv4Builder builder = new Ipv4Builder();
builder.setIpv4TunnelSenderAddress(new Ipv4Address("127.0.1.1"));
builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4Address("127.0.1.2")));
builder.setIpv4TunnelEndpointAddress(new Ipv4Address("127.0.1.3"));
final AddressFamily afiLsp = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
final LspId lspId = new LspId(1L);
final TunnelId tunnelId = new TunnelId(1);
final LspIdentifiers identifier = new LspIdentifiersBuilder().setAddressFamily(afiLsp).setLspId(lspId).setTunnelId(tunnelId).build();
final Lsp lsp = new LspBuilder().setPlspId(new PlspId(1L)).setTlvs(new TlvsBuilder().setLspIdentifiers(identifier).build()).build();
final Ero ero = new EroBuilder().build();
final List<Object> objects = Lists.newArrayList(lsp, ero, bw);
final Reports validReports = codec.getValidReports(objects, Collections.emptyList());
assertNotNull(validReports.getPath().getBandwidth().getAugmentation(Bandwidth1.class));
assertTrue(objects.isEmpty());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.rp.TlvsBuilder in project bgpcep by opendaylight.
the class PCEPCloseObjectParser method parseObject.
@Override
public CClose parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final CCloseBuilder builder = new CCloseBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
bytes.skipBytes(FLAGS_F_LENGTH + RESERVED);
builder.setReason(bytes.readUnsignedByte());
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
parseTlvs(tlvsBuilder, bytes.slice());
builder.setTlvs(tlvsBuilder.build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.rp.TlvsBuilder in project bgpcep by opendaylight.
the class PCEPObjectiveFunctionObjectParser method parseObject.
@Override
public Of parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final OfBuilder builder = new OfBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
builder.setCode(new OfId(bytes.readUnsignedShort()));
bytes.readBytes(RESERVED);
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
parseTlvs(tlvsBuilder, bytes.slice());
builder.setTlvs(tlvsBuilder.build());
return builder.build();
}
Aggregations