Search in sources :

Example 36 with Object

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object in project bgpcep by opendaylight.

the class AbstractLabeledUnicastRIBSupport method extractCLabeledUnicastDestination.

/**
 * Conversion from DataContainer to LabeledUnicastDestination Object
 *
 * @param route DataContainer
 * @return LabeledUnicastDestination Object
 */
private CLabeledUnicastDestination extractCLabeledUnicastDestination(final DataContainerNode<? extends PathArgument> route) {
    final CLabeledUnicastDestinationBuilder builder = new CLabeledUnicastDestinationBuilder();
    builder.setPrefix(extractPrefix(route, PREFIX_TYPE_NID));
    builder.setLabelStack(extractLabel(route, LABEL_STACK_NID, LV_NID));
    builder.setPathId(PathIdUtil.buildPathId(route, routePathIdNid()));
    return builder.build();
}
Also used : CLabeledUnicastDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.destination.CLabeledUnicastDestinationBuilder)

Example 37 with Object

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object 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();
}
Also used : PrefixDescriptorsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.object.type.prefix._case.PrefixDescriptorsBuilder) QName(org.opendaylight.yangtools.yang.common.QName)

Example 38 with Object

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object in project bgpcep by opendaylight.

the class LinkstateNlriParser method extractLinkstateDestination.

public static CLinkstateDestination extractLinkstateDestination(final DataContainerNode<? extends PathArgument> linkstate) {
    final CLinkstateDestinationBuilder builder = new CLinkstateDestinationBuilder();
    serializeCommonParts(builder, linkstate);
    final ChoiceNode objectType = (ChoiceNode) linkstate.getChild(OBJECT_TYPE_NID).get();
    if (objectType.getChild(ADVERTISING_NODE_DESCRIPTORS_NID).isPresent()) {
        serializeAdvertisedNodeDescriptor(builder, objectType);
    } else if (objectType.getChild(LOCAL_NODE_DESCRIPTORS_NID).isPresent()) {
        serializeLocalNodeDescriptor(builder, objectType);
    } else if (objectType.getChild(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();
}
Also used : CLinkstateDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.destination.CLinkstateDestinationBuilder) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode)

Example 39 with Object

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object in project bgpcep by opendaylight.

the class RemoteNodeDescriptorTlvParser method parseTlvBody.

@Override
public RemoteNodeDescriptors parseTlvBody(final ByteBuf value) {
    final Map<QName, Object> parsedSubTlvs = new HashMap<>();
    final RemoteNodeDescriptorsBuilder builder = new RemoteNodeDescriptorsBuilder(parseNodeDescriptor(value, parsedSubTlvs));
    builder.setBgpRouterId((Ipv4Address) parsedSubTlvs.get(BgpRouterIdTlvParser.BGP_ROUTER_ID_QNAME));
    builder.setMemberAsn((AsNumber) parsedSubTlvs.get(MemAsNumTlvParser.MEMBER_AS_NUMBER_QNAME));
    return builder.build();
}
Also used : HashMap(java.util.HashMap) QName(org.opendaylight.yangtools.yang.common.QName) RemoteNodeDescriptorsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.object.type.link._case.RemoteNodeDescriptorsBuilder)

Example 40 with Object

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object in project bgpcep by opendaylight.

the class AbstractLocalNodeDescriptorTlvCodec method parseTlvBody.

@Override
public final LocalNodeDescriptors parseTlvBody(final ByteBuf value) {
    final Map<QName, Object> parsedSubTlvs = new HashMap<>();
    final LocalNodeDescriptorsBuilder builder = new LocalNodeDescriptorsBuilder(parseNodeDescriptor(value, parsedSubTlvs));
    builder.setBgpRouterId((Ipv4Address) parsedSubTlvs.get(BgpRouterIdTlvParser.BGP_ROUTER_ID_QNAME));
    builder.setMemberAsn((AsNumber) parsedSubTlvs.get(MemAsNumTlvParser.MEMBER_AS_NUMBER_QNAME));
    return builder.build();
}
Also used : LocalNodeDescriptorsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.object.type.link._case.LocalNodeDescriptorsBuilder) HashMap(java.util.HashMap) QName(org.opendaylight.yangtools.yang.common.QName)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)72 Test (org.junit.Test)60 ArrayList (java.util.ArrayList)46 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)29 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)28 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)25 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)23 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)18 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)17 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)16 VendorInformationObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject)15 BigInteger (java.math.BigInteger)14 Preconditions (com.google.common.base.Preconditions)13 HashMap (java.util.HashMap)13 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)13 List (java.util.List)12 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)10 UnknownObject (org.opendaylight.protocol.pcep.spi.UnknownObject)10 BitArray (org.opendaylight.protocol.util.BitArray)9 Flowspec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.Flowspec)9