Search in sources :

Example 6 with SidLabelIndex

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.SidLabelIndex in project bgpcep by opendaylight.

the class SrLinkAttributesParser method parseEpeAdjacencySegmentIdentifier.

public static EpeAdjSidTlv parseEpeAdjacencySegmentIdentifier(final ByteBuf buffer) {
    final Weight weight;
    final SidLabelIndex sidValue;
    if (buffer.isReadable()) {
        final BitArray flags = BitArray.valueOf(buffer, FLAGS_BITS_SIZE);
        weight = new Weight(readUint8(buffer));
        buffer.skipBytes(RESERVED);
        sidValue = SidLabelIndexParser.parseSidLabelIndexByFlags(Size.forValue(buffer.readableBytes()), buffer, flags.get(VALUE_EPE), flags.get(LOCAL_EPE));
    } else {
        weight = null;
        sidValue = null;
    }
    return new EpeAdjSidTlv() {

        @Override
        public Class<EpeAdjSidTlv> implementedInterface() {
            return EpeAdjSidTlv.class;
        }

        @Override
        public Weight getWeight() {
            return weight;
        }

        @Override
        public SidLabelIndex getSidLabelIndex() {
            return sidValue;
        }
    };
}
Also used : EpeAdjSidTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.EpeAdjSidTlv) SidLabelIndex(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.SidLabelIndex) BitArray(org.opendaylight.protocol.util.BitArray) Weight(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.Weight)

Example 7 with SidLabelIndex

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.SidLabelIndex in project bgpcep by opendaylight.

the class LinkstateGraphBuilder method getVertex.

/**
 * Create Vertex from the Node Attributes.
 *
 * @param na       Node Attributes
 * @param cvertex  Connected Vertex associated to this Vertex
 * @param as       As number
 *
 * @return New Vertex
 */
private static Vertex getVertex(final NodeAttributes na, final Uint64 id, final Uint32 as) {
    VertexBuilder builder = new VertexBuilder().setVertexId(id).setAsn(as);
    if (na.getIpv4RouterId() != null) {
        builder.setRouterId(new IpAddress(na.getIpv4RouterId()));
    }
    if (na.getIpv6RouterId() != null) {
        builder.setRouterId(new IpAddress(na.getIpv6RouterId()));
    }
    /*
         * Set Router Name with dynamic hostname (IS-IS) or IPv4 address in dot decimal format (OSPF)
         */
    if (na.getDynamicHostname() != null) {
        builder.setName(na.getDynamicHostname());
    } else {
        int key = id.intValue();
        builder.setName((key << 24 & 0xFF) + "." + (key << 16 & 0xFF) + "." + (key << 8 & 0xFF) + "." + (key & 0xFF));
    }
    if (na.getSrCapabilities() != null) {
        final SidLabelIndex labelIndex = na.getSrCapabilities().getSidLabelIndex();
        if (labelIndex instanceof LocalLabelCase) {
            builder.setSrgb(new SrgbBuilder().setLowerBound(((LocalLabelCase) labelIndex).getLocalLabel().getValue()).setRangeSize(na.getSrCapabilities().getRangeSize().getValue()).build());
        } else if (labelIndex instanceof SidCase) {
            builder.setSrgb(new SrgbBuilder().setLowerBound(((SidCase) labelIndex).getSid()).setRangeSize(na.getSrCapabilities().getRangeSize().getValue()).build());
        }
    }
    if (na.getNodeFlags() != null) {
        if (na.getNodeFlags().getAbr()) {
            builder.setVertexType(VertexType.Abr);
        }
        if (na.getNodeFlags().getExternal()) {
            builder.setVertexType(VertexType.AsbrOut);
        }
    } else {
        builder.setVertexType(VertexType.Standard);
    }
    return builder.build();
}
Also used : SrgbBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.vertex.SrgbBuilder) VertexBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.VertexBuilder) LocalLabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.LocalLabelCase) SidLabelIndex(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.SidLabelIndex) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) SidCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.SidCase)

Aggregations

SidLabelIndex (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.SidLabelIndex)5 BitArray (org.opendaylight.protocol.util.BitArray)4 LocalLabelCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.LocalLabelCase)3 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)2 LinkStateAttribute (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.path.attribute.LinkStateAttribute)2 Attributes1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.routes.linkstate.routes.linkstate.route.Attributes1)2 Weight (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.Weight)2 IsisAdjFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.flags.isis.adj.flags._case.IsisAdjFlags)2 OspfAdjFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.flags.ospf.adj.flags._case.OspfAdjFlags)2 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)2 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)2 Preconditions (com.google.common.base.Preconditions)1 ArrayList (java.util.ArrayList)1 DomainName (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.DomainName)1 SrAdjIds (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.attribute.SrAdjIds)1 SrAdjIdsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.attribute.SrAdjIdsBuilder)1 LinkAttributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.path.attribute.link.state.attribute.link.attributes._case.LinkAttributes)1 NodeAttributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.path.attribute.link.state.attribute.node.attributes._case.NodeAttributes)1 EpeAdjSidTlv (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.EpeAdjSidTlv)1 Flags (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.adj.flags.Flags)1