use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.initiation.Tlvs in project bgpcep by opendaylight.
the class Stateful07PCReportMessageParser method validateLsp.
private static boolean validateLsp(final Object object, final boolean lspViaSR, final List<Message> errors, final ReportsBuilder builder) {
if (object instanceof Lsp) {
final Lsp lsp = (Lsp) object;
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.Tlvs tlvs = lsp.getTlvs();
if (!lspViaSR && lsp.getPlspId().getValue() != 0 && (tlvs == null || tlvs.getLspIdentifiers() == null)) {
final Message errorMsg = createErrorMsg(PCEPErrors.LSP_IDENTIFIERS_TLV_MISSING, Optional.absent());
errors.add(errorMsg);
return false;
}
builder.setLsp(lsp);
return true;
}
errors.add(createErrorMsg(PCEPErrors.LSP_MISSING, Optional.absent()));
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.initiation.Tlvs in project bgpcep by opendaylight.
the class AbstractPrefixNlriParser method parsePrefixDescriptor.
private static PrefixDescriptors parsePrefixDescriptor(final ByteBuf buffer) {
final Map<QName, Object> tlvs = SimpleNlriTypeRegistry.getInstance().parseSubTlvs(buffer);
final PrefixDescriptorsBuilder builder = new PrefixDescriptorsBuilder();
builder.setMultiTopologyId((TopologyIdentifier) tlvs.get(MultiTopoIdTlvParser.MULTI_TOPOLOGY_ID_QNAME));
builder.setOspfRouteType((OspfRouteType) tlvs.get(OspfRouteTlvParser.OSPF_ROUTE_TYPE_QNAME));
builder.setIpReachabilityInformation((IpPrefix) tlvs.get(ReachTlvParser.IP_REACHABILITY_QNAME));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.initiation.Tlvs in project bgpcep by opendaylight.
the class AbstractAddPathTest method configurePeer.
static BGPPeer configurePeer(final BGPTableTypeRegistryConsumer tableRegistry, final Ipv4AddressNoZone peerAddress, final RIBImpl ribImpl, final BgpParameters bgpParameters, final PeerRole peerRole, final BGPPeerRegistry bgpPeerRegistry, final Set<TablesKey> afiSafiAdvertised, final Set<TablesKey> gracefulAfiSafiAdvertised, final Map<TablesKey, Integer> llGracefulTimersAdvertised, final BgpPeer peer) {
final IpAddressNoZone ipAddress = new IpAddressNoZone(peerAddress);
final BGPPeer bgpPeer = new BGPPeer(tableRegistry, new IpAddressNoZone(peerAddress), null, ribImpl, peerRole, null, null, null, afiSafiAdvertised, gracefulAfiSafiAdvertised, llGracefulTimersAdvertised, peer);
final List<BgpParameters> tlvs = Lists.newArrayList(bgpParameters);
bgpPeerRegistry.addPeer(ipAddress, bgpPeer, new BGPSessionPreferences(AS_NUMBER, HOLDTIMER, new BgpId(RIB_ID), AS_NUMBER, tlvs));
bgpPeer.instantiateServiceInstance();
return bgpPeer;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.initiation.Tlvs in project bgpcep by opendaylight.
the class RouteMirroringMessageHandler method serializeTlvs.
protected void serializeTlvs(final Tlvs tlvs, final ByteBuf output) {
final ByteBuf tlvsBuffer = Unpooled.buffer();
if (tlvs.getMirrorInformationTlv() != null) {
serializeTlv(tlvs.getMirrorInformationTlv(), tlvsBuffer);
}
if (tlvs.getPduUpdateTlv() != null) {
getBgpMessageRegistry().serializeMessage(new UpdateBuilder(tlvs.getPduUpdateTlv()).build(), tlvsBuffer);
}
if (tlvs.getPduOpenTlv() != null) {
getBgpMessageRegistry().serializeMessage(new OpenBuilder(tlvs.getPduOpenTlv()).build(), tlvsBuffer);
}
output.writeBytes(tlvsBuffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.initiation.Tlvs in project bgpcep by opendaylight.
the class InitiationHandler method serializeTlvs.
private void serializeTlvs(final Tlvs tlvs, final ByteBuf output) {
serializeTlv(tlvs.getNameTlv(), output);
serializeTlv(tlvs.getDescriptionTlv(), output);
if (tlvs.getStringInformation() != null) {
for (final StringInformation stringInfo : tlvs.getStringInformation()) {
if (stringInfo.getStringTlv() != null) {
serializeTlv(stringInfo.getStringTlv(), output);
}
}
}
}
Aggregations