use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType in project bgpcep by opendaylight.
the class LinkNlriParser method serializeObjectType.
@Override
protected void serializeObjectType(final ObjectType objectType, final ByteBuf buffer) {
final LinkCase linkNlri = (LinkCase) objectType;
final SimpleNlriTypeRegistry reg = SimpleNlriTypeRegistry.getInstance();
reg.serializeTlv(LocalNodeDescriptors.QNAME, linkNlri.getLocalNodeDescriptors(), buffer);
reg.serializeTlv(RemoteNodeDescriptors.QNAME, linkNlri.getRemoteNodeDescriptors(), buffer);
serializeLinkDescriptor(linkNlri.getLinkDescriptors(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType in project bgpcep by opendaylight.
the class LinkstateNlriParser method serializeLocalNodeDescriptor.
private static void serializeLocalNodeDescriptor(final CLinkstateDestinationBuilder builder, final ChoiceNode objectType) {
// link local node descriptors
final LinkCaseBuilder linkBuilder = new LinkCaseBuilder();
linkBuilder.setLocalNodeDescriptors(NodeNlriParser.serializeLocalNodeDescriptors((ContainerNode) objectType.findChildByArg(LOCAL_NODE_DESCRIPTORS_NID).get()));
// link remote node descriptors
if (objectType.findChildByArg(REMOTE_NODE_DESCRIPTORS_NID).isPresent()) {
linkBuilder.setRemoteNodeDescriptors(NodeNlriParser.serializeRemoteNodeDescriptors((ContainerNode) objectType.findChildByArg(REMOTE_NODE_DESCRIPTORS_NID).get()));
}
// link descriptors
objectType.findChildByArg(LINK_DESCRIPTORS_NID).ifPresent(dataContainerChild -> linkBuilder.setLinkDescriptors(LinkNlriParser.serializeLinkDescriptors((ContainerNode) dataContainerChild)));
builder.setObjectType(linkBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType in project bgpcep by opendaylight.
the class LinkstateNlriParser method extractLinkstateDestination.
public static CLinkstateDestination extractLinkstateDestination(final DataContainerNode linkstate) {
final CLinkstateDestinationBuilder builder = new CLinkstateDestinationBuilder();
serializeCommonParts(builder, linkstate);
final ChoiceNode objectType = (ChoiceNode) linkstate.findChildByArg(OBJECT_TYPE_NID).get();
if (objectType.findChildByArg(ADVERTISING_NODE_DESCRIPTORS_NID).isPresent()) {
serializeAdvertisedNodeDescriptor(builder, objectType);
} else if (objectType.findChildByArg(LOCAL_NODE_DESCRIPTORS_NID).isPresent()) {
serializeLocalNodeDescriptor(builder, objectType);
} else if (objectType.findChildByArg(NODE_DESCRIPTORS_NID).isPresent()) {
serializeNodeDescriptor(builder, objectType);
} else if (AbstractTeLspNlriCodec.isTeLsp(objectType)) {
builder.setObjectType(AbstractTeLspNlriCodec.serializeTeLsp(objectType));
} else {
LOG.warn("Unknown Object Type: {}.", objectType);
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType in project bgpcep by opendaylight.
the class AbstractTeLspNlriCodec method serializeObjectType.
@Override
protected final void serializeObjectType(final ObjectType objectType, final ByteBuf buffer) {
checkArgument(objectType instanceof TeLspCase);
final TeLspCase teLSP = (TeLspCase) objectType;
final AddressFamily addressFamily = teLSP.getAddressFamily();
if (addressFamily instanceof Ipv4Case) {
serializeIpv4Case(teLSP, (Ipv4Case) addressFamily, buffer);
} else {
serializeIpv6Case(teLSP, (Ipv6Case) addressFamily, buffer);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType in project bgpcep by opendaylight.
the class LinkstateAttributeParser method parseAttribute.
@Override
public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder, final RevisedErrorHandling errorHandling, final PeerSpecificParserConstraint constraint) throws BGPParsingException {
// FIXME: BGPCEP-359: we need an updated link-state spec for RFC7606
final CLinkstateDestination lsDestination = getNlriType(builder);
if (lsDestination == null) {
LOG.warn("No Linkstate NLRI found, not parsing Linkstate attribute");
return;
}
final ObjectType nlriType = lsDestination.getObjectType();
final ProtocolId protocolId = lsDestination.getProtocolId();
builder.addAugmentation(new Attributes1Builder().setLinkStateAttribute(parseLinkState(nlriType, protocolId, buffer)).build());
}
Aggregations