Search in sources :

Example 1 with LinkDescriptors

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors in project bgpcep by opendaylight.

the class LinkstateNlriParserTest method testLinkNlri.

@Test
public void testLinkNlri() throws BGPParsingException {
    setUp(this.linkNlri);
    // test BA form
    assertNull(this.dest.getRouteDistinguisher());
    assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
    assertEquals(Uint64.ONE, this.dest.getIdentifier().getValue());
    final LinkCase lCase = (LinkCase) this.dest.getObjectType();
    final LocalNodeDescriptors local = lCase.getLocalNodeDescriptors();
    assertEquals(new AsNumber(Uint32.valueOf(72)), local.getAsNumber());
    assertEquals(new DomainIdentifier(Uint32.valueOf(0x28282828L)), local.getDomainId());
    assertEquals(new IsisNodeCaseBuilder().setIsisNode(new IsisNodeBuilder().setIsoSystemId(new IsoSystemIdentifier(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x42 })).build()).build(), local.getCRouterIdentifier());
    assertEquals("1.1.1.1", local.getBgpRouterId().getValue());
    assertEquals(new AsNumber(Uint32.valueOf(258)), local.getMemberAsn());
    final RemoteNodeDescriptors remote = lCase.getRemoteNodeDescriptors();
    assertEquals(new AsNumber(Uint32.valueOf(72)), remote.getAsNumber());
    assertEquals(new DomainIdentifier(Uint32.valueOf(0x28282828L)), remote.getDomainId());
    assertEquals(new OspfNodeCaseBuilder().setOspfNode(new OspfNodeBuilder().setOspfRouterId(Uint32.valueOf(0x00000040L)).build()).build(), remote.getCRouterIdentifier());
    assertEquals(new AsNumber(Uint32.valueOf(259)), remote.getMemberAsn());
    assertEquals("1.1.1.2", remote.getBgpRouterId().getValue());
    final LinkDescriptors ld = lCase.getLinkDescriptors();
    assertEquals("197.20.160.42", ld.getIpv4InterfaceAddress().getValue());
    assertEquals("197.20.160.40", ld.getIpv4NeighborAddress().getValue());
    final ByteBuf buffer = Unpooled.buffer();
    this.registry.serializeNlriType(this.dest, buffer);
    assertArrayEquals(this.linkNlri, ByteArray.readAllBytes(buffer));
    // test BI form
    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder.create();
    linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);
    final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
    protocolId.withNodeIdentifier(LinkstateNlriParser.PROTOCOL_ID_NID);
    protocolId.withValue("isis-level2");
    linkstateBI.addChild(protocolId.build());
    final ImmutableLeafNodeBuilder<Uint64> identifier = new ImmutableLeafNodeBuilder<>();
    identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
    identifier.withValue(Uint64.ONE);
    linkstateBI.addChild(identifier.build());
    final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
    objectType.withNodeIdentifier(LinkstateNlriParser.OBJECT_TYPE_NID);
    // local node descriptors
    final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> localNodeDescriptors = Builders.containerBuilder();
    localNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.LOCAL_NODE_DESCRIPTORS_NID);
    final ImmutableLeafNodeBuilder<Uint32> asNumber = new ImmutableLeafNodeBuilder<>();
    asNumber.withNodeIdentifier(NodeNlriParser.AS_NUMBER_NID);
    asNumber.withValue(Uint32.valueOf(72));
    localNodeDescriptors.addChild(asNumber.build());
    final ImmutableLeafNodeBuilder<Uint32> domainID = new ImmutableLeafNodeBuilder<>();
    domainID.withNodeIdentifier(NodeNlriParser.DOMAIN_NID);
    domainID.withValue(Uint32.valueOf(0x28282828L));
    localNodeDescriptors.addChild(domainID.build());
    final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId = Builders.choiceBuilder();
    crouterId.withNodeIdentifier(C_ROUTER_ID_NID);
    final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> isisNode = Builders.containerBuilder();
    isisNode.withNodeIdentifier(NodeNlriParser.ISIS_NODE_NID);
    final ImmutableLeafNodeBuilder<byte[]> isoSystemID = new ImmutableLeafNodeBuilder<>();
    isoSystemID.withNodeIdentifier(NodeNlriParser.ISO_SYSTEM_NID);
    isoSystemID.withValue(new byte[] { 0, 0, 0, 0, 0, (byte) 0x42 });
    isisNode.addChild(isoSystemID.build());
    crouterId.addChild(isisNode.build());
    localNodeDescriptors.addChild(crouterId.build());
    final ImmutableLeafNodeBuilder<String> bgpRouterId = new ImmutableLeafNodeBuilder<>();
    bgpRouterId.withNodeIdentifier(NodeNlriParser.BGP_ROUTER_NID);
    bgpRouterId.withValue("1.1.1.1");
    final ImmutableLeafNodeBuilder<Uint32> memberAsn = new ImmutableLeafNodeBuilder<>();
    memberAsn.withNodeIdentifier(NodeNlriParser.MEMBER_ASN_NID);
    memberAsn.withValue(Uint32.valueOf(258L));
    localNodeDescriptors.addChild(bgpRouterId.build());
    localNodeDescriptors.addChild(memberAsn.build());
    // remote descriptors
    final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> remoteNodeDescriptors = Builders.containerBuilder();
    remoteNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.REMOTE_NODE_DESCRIPTORS_NID);
    remoteNodeDescriptors.addChild(asNumber.build());
    remoteNodeDescriptors.addChild(domainID.build());
    final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId2 = Builders.choiceBuilder();
    crouterId2.withNodeIdentifier(C_ROUTER_ID_NID);
    final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> ospfNode = Builders.containerBuilder();
    ospfNode.withNodeIdentifier(NodeNlriParser.OSPF_NODE_NID);
    final ImmutableLeafNodeBuilder<Uint32> ospfRouterId = new ImmutableLeafNodeBuilder<>();
    ospfRouterId.withNodeIdentifier(NodeNlriParser.OSPF_ROUTER_NID);
    ospfRouterId.withValue(Uint32.valueOf(0x00000040L));
    ospfNode.addChild(ospfRouterId.build());
    crouterId2.addChild(ospfNode.build());
    remoteNodeDescriptors.addChild(crouterId2.build());
    final ImmutableLeafNodeBuilder<String> bgpRouterIdRemote = new ImmutableLeafNodeBuilder<>();
    bgpRouterIdRemote.withNodeIdentifier(NodeNlriParser.BGP_ROUTER_NID);
    bgpRouterIdRemote.withValue("1.1.1.2");
    remoteNodeDescriptors.addChild(bgpRouterIdRemote.build());
    final ImmutableLeafNodeBuilder<Uint32> memberAsnRemote = new ImmutableLeafNodeBuilder<>();
    memberAsnRemote.withNodeIdentifier(NodeNlriParser.MEMBER_ASN_NID);
    memberAsnRemote.withValue(Uint32.valueOf(259));
    remoteNodeDescriptors.addChild(memberAsnRemote.build());
    // link descritpors
    final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> linkDescriptors = Builders.containerBuilder();
    linkDescriptors.withNodeIdentifier(LinkstateNlriParser.LINK_DESCRIPTORS_NID);
    final ImmutableLeafNodeBuilder<Uint32> linkLocalIdentifier = new ImmutableLeafNodeBuilder<>();
    linkLocalIdentifier.withNodeIdentifier(LinkNlriParser.LINK_LOCAL_NID);
    linkLocalIdentifier.withValue(Uint32.valueOf(16909060L));
    final ImmutableLeafNodeBuilder<Uint32> linkRemoteIdentifier = new ImmutableLeafNodeBuilder<>();
    linkRemoteIdentifier.withNodeIdentifier(LinkNlriParser.LINK_REMOTE_NID);
    linkRemoteIdentifier.withValue(Uint32.valueOf(168496141L));
    final ImmutableLeafNodeBuilder<String> ipv4InterfaceAddress = new ImmutableLeafNodeBuilder<>();
    ipv4InterfaceAddress.withNodeIdentifier(LinkNlriParser.IPV4_IFACE_NID);
    ipv4InterfaceAddress.withValue("197.20.160.42");
    final ImmutableLeafNodeBuilder<String> ipv4NeighborAddress = new ImmutableLeafNodeBuilder<>();
    ipv4NeighborAddress.withNodeIdentifier(LinkNlriParser.IPV4_NEIGHBOR_NID);
    ipv4NeighborAddress.withValue("197.20.160.40");
    final ImmutableLeafNodeBuilder<Uint16> multiTopologyId = new ImmutableLeafNodeBuilder<>();
    multiTopologyId.withNodeIdentifier(TlvUtil.MULTI_TOPOLOGY_NID);
    multiTopologyId.withValue(Uint16.valueOf(3));
    linkDescriptors.addChild(linkLocalIdentifier.build());
    linkDescriptors.addChild(linkRemoteIdentifier.build());
    linkDescriptors.addChild(ipv4InterfaceAddress.build());
    linkDescriptors.addChild(ipv4NeighborAddress.build());
    linkDescriptors.addChild(multiTopologyId.build());
    objectType.addChild(localNodeDescriptors.build());
    objectType.addChild(remoteNodeDescriptors.build());
    objectType.addChild(linkDescriptors.build());
    linkstateBI.addChild(objectType.build());
    assertEquals(this.dest, LinkstateNlriParser.extractLinkstateDestination(linkstateBI.build()));
}
Also used : UnkeyedListEntryNode(org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode) ByteBuf(io.netty.buffer.ByteBuf) IsisNodeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.IsisNodeCaseBuilder) LocalNodeDescriptors(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LocalNodeDescriptors) OspfNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.ospf.node._case.OspfNodeBuilder) Uint16(org.opendaylight.yangtools.yang.common.Uint16) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) OspfNodeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.OspfNodeCaseBuilder) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) Uint32(org.opendaylight.yangtools.yang.common.Uint32) DomainIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.DomainIdentifier) LinkCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.LinkCase) IsoSystemIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.IsoSystemIdentifier) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) LinkDescriptors(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors) RemoteNodeDescriptors(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.RemoteNodeDescriptors) IsisNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.isis.node._case.IsisNodeBuilder) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ImmutableLeafNodeBuilder(org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder) Uint64(org.opendaylight.yangtools.yang.common.Uint64) Test(org.junit.Test)

Example 2 with LinkDescriptors

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors in project bgpcep by opendaylight.

the class LinkNlriParser method parseObjectType.

@Override
protected ObjectType parseObjectType(final ByteBuf buffer) {
    final SimpleNlriTypeRegistry reg = SimpleNlriTypeRegistry.getInstance();
    final LocalNodeDescriptors localDescriptor = reg.parseTlv(buffer);
    final RemoteNodeDescriptors remoteDescriptor = reg.parseTlv(buffer);
    final LinkDescriptors linkDescriptor = parseLinkDescriptor(buffer);
    return new LinkCaseBuilder().setLinkDescriptors(linkDescriptor).setLocalNodeDescriptors(localDescriptor).setRemoteNodeDescriptors(remoteDescriptor).build();
}
Also used : LocalNodeDescriptors(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LocalNodeDescriptors) LinkCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.LinkCaseBuilder) SimpleNlriTypeRegistry(org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry) LinkDescriptors(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors) RemoteNodeDescriptors(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.RemoteNodeDescriptors)

Example 3 with LinkDescriptors

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors in project bgpcep by opendaylight.

the class LinkstateGraphBuilder method createEdgeAttributes.

/**
 * Create Edge Attributes from Link attributes.
 *
 * @param la         Linkstate Attributes
 * @param linkDesc   Linkstate Descriptors
 *
 * @return EdgeAttributes
 */
private static EdgeAttributes createEdgeAttributes(final LinkAttributes la, final LinkDescriptors linkDesc) {
    EdgeAttributesBuilder builder = new EdgeAttributesBuilder();
    if (linkDesc.getIpv4InterfaceAddress() != null) {
        builder.setLocalAddress(new IpAddress(linkDesc.getIpv4InterfaceAddress()));
    }
    if (linkDesc.getIpv6InterfaceAddress() != null) {
        builder.setLocalAddress(new IpAddress(linkDesc.getIpv6InterfaceAddress()));
    }
    if (linkDesc.getIpv4NeighborAddress() != null) {
        builder.setRemoteAddress(new IpAddress(linkDesc.getIpv4NeighborAddress()));
    }
    if (linkDesc.getIpv6NeighborAddress() != null) {
        builder.setRemoteAddress(new IpAddress(linkDesc.getIpv6NeighborAddress()));
    }
    if (linkDesc.getLinkLocalIdentifier() != null) {
        builder.setLocalIdentifier(linkDesc.getLinkLocalIdentifier());
    }
    if (linkDesc.getLinkRemoteIdentifier() != null) {
        builder.setRemoteIdentifier(linkDesc.getLinkRemoteIdentifier());
    }
    if (la.getMetric() != null) {
        builder.setMetric(la.getMetric().getValue());
    }
    if (la.getTeMetric() != null) {
        builder.setTeMetric(la.getTeMetric().getValue());
    }
    if (la.getMaxLinkBandwidth() != null) {
        builder.setMaxLinkBandwidth(bandwithToDecimalBandwidth(la.getMaxLinkBandwidth()));
    }
    if (la.getMaxReservableBandwidth() != null) {
        builder.setMaxResvLinkBandwidth(bandwithToDecimalBandwidth(la.getMaxReservableBandwidth()));
    }
    if (la.getUnreservedBandwidth() != null) {
        int upperBound = Math.min(la.getUnreservedBandwidth().size(), MAX_PRIORITY);
        final List<UnreservedBandwidth> unRsvBw = new ArrayList<>(upperBound);
        for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.UnreservedBandwidth bandwidth : la.nonnullUnreservedBandwidth().values()) {
            unRsvBw.add(new UnreservedBandwidthBuilder().setBandwidth(bandwithToDecimalBandwidth(bandwidth.getBandwidth())).withKey(new UnreservedBandwidthKey(bandwidth.getPriority())).build());
        }
        builder.setUnreservedBandwidth(unRsvBw);
    }
    if (la.getAdminGroup() != null) {
        builder.setAdminGroup(la.getAdminGroup().getValue());
    }
    if (la.getLinkDelay() != null) {
        builder.setDelay(new Delay(la.getLinkDelay().getValue()));
    }
    if (la.getLinkMinMaxDelay() != null && la.getLinkMinMaxDelay() != null) {
        MinMaxDelay mmDelay = new MinMaxDelayBuilder().setMaxDelay(new Delay(la.getLinkMinMaxDelay().getMaxDelay().getValue())).setMinDelay(new Delay(la.getLinkMinMaxDelay().getMinDelay().getValue())).build();
        builder.setMinMaxDelay(mmDelay);
    }
    if (la.getDelayVariation() != null) {
        builder.setJitter(new Delay(la.getDelayVariation().getValue()));
    }
    if (la.getLinkLoss() != null) {
        builder.setLoss(new Loss(la.getLinkLoss().getValue()));
    }
    if (la.getAvailableBandwidth() != null) {
        builder.setAvailableBandwidth(bandwithToDecimalBandwidth(la.getAvailableBandwidth()));
    }
    if (la.getResidualBandwidth() != null) {
        builder.setResidualBandwidth(bandwithToDecimalBandwidth(la.getResidualBandwidth()));
    }
    if (la.getUtilizedBandwidth() != null) {
        builder.setUtilizedBandwidth(bandwithToDecimalBandwidth(la.getUtilizedBandwidth()));
    }
    if (la.getSharedRiskLinkGroups() != null) {
        List<Uint32> srlgs = new ArrayList<>();
        for (SrlgId srlg : la.getSharedRiskLinkGroups()) {
            srlgs.add(srlg.getValue());
        }
        builder.setSrlgs(srlgs);
    }
    for (SrAdjIds adj : la.nonnullSrAdjIds()) {
        if (adj.getSidLabelIndex() instanceof LocalLabelCase) {
            boolean backup = false;
            if (adj.getFlags() instanceof OspfAdjFlags) {
                backup = ((OspfAdjFlags) adj.getFlags()).getBackup();
            }
            if (adj.getFlags() instanceof IsisAdjFlags) {
                backup = ((IsisAdjFlags) adj.getFlags()).getBackup();
            }
            if (!backup) {
                builder.setAdjSid(((LocalLabelCase) adj.getSidLabelIndex()).getLocalLabel().getValue());
            } else {
                builder.setBackupAdjSid(((LocalLabelCase) adj.getSidLabelIndex()).getLocalLabel().getValue());
            }
        }
    }
    return builder.build();
}
Also used : EdgeAttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.edge.EdgeAttributesBuilder) 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) ArrayList(java.util.ArrayList) Delay(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.Delay) MinMaxDelay(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.edge.attributes.MinMaxDelay) SrAdjIds(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.attribute.SrAdjIds) LocalLabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.LocalLabelCase) Uint32(org.opendaylight.yangtools.yang.common.Uint32) UnreservedBandwidth(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.edge.attributes.UnreservedBandwidth) UnreservedBandwidthKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.edge.attributes.UnreservedBandwidthKey) MinMaxDelayBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.edge.attributes.MinMaxDelayBuilder) Loss(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.Loss) MinMaxDelay(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.edge.attributes.MinMaxDelay) SrlgId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId) UnreservedBandwidthBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.edge.attributes.UnreservedBandwidthBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) 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)

Example 4 with LinkDescriptors

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors in project bgpcep by opendaylight.

the class LinkstateGraphBuilder method getEdgeId.

/**
 * Determine the Source Edge Key from the link descriptor.
 * There is several case: IPv4, IPv6 address or Unnumbered Interface.
 *
 * @param linkCase The Link part of the Linkstate route
 *
 * @return Unique key
 */
private static Uint64 getEdgeId(final LinkCase linkCase) {
    Uint64 key = Uint64.ZERO;
    final LinkDescriptors linkDescriptors = linkCase.getLinkDescriptors();
    if (linkDescriptors.getIpv4InterfaceAddress() != null) {
        key = ipv4ToKey(linkDescriptors.getIpv4InterfaceAddress());
    }
    if (linkDescriptors.getIpv6InterfaceAddress() != null) {
        key = ipv6ToKey(linkDescriptors.getIpv6InterfaceAddress());
    }
    if (linkDescriptors.getLinkLocalIdentifier() != null) {
        key = linkDescriptors.getLinkLocalIdentifier().toUint64();
    }
    return key;
}
Also used : LinkDescriptors(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 5 with LinkDescriptors

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors in project bgpcep by opendaylight.

the class UriBuilder method add.

UriBuilder add(final LinkCase link) {
    addPrefix("local-", link.getLocalNodeDescriptors());
    addPrefix("remote-", link.getRemoteNodeDescriptors());
    final LinkDescriptors ld = link.getLinkDescriptors();
    if (ld.getIpv4InterfaceAddress() != null) {
        add("ipv4-iface", ld.getIpv4InterfaceAddress().getValue());
    }
    if (ld.getIpv4NeighborAddress() != null) {
        add("ipv4-neigh", ld.getIpv4NeighborAddress().getValue());
    }
    if (ld.getIpv6InterfaceAddress() != null) {
        add("ipv6-iface", ld.getIpv6InterfaceAddress().getValue());
    }
    if (ld.getIpv6NeighborAddress() != null) {
        add("ipv6-neigh", ld.getIpv6NeighborAddress().getValue());
    }
    if (ld.getMultiTopologyId() != null) {
        add("mt", ld.getMultiTopologyId().getValue());
    }
    add("local-id", ld.getLinkLocalIdentifier());
    add("remote-id", ld.getLinkRemoteIdentifier());
    return this;
}
Also used : LinkDescriptors(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors)

Aggregations

LinkDescriptors (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors)4 LinkDescriptorsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptorsBuilder)2 LocalNodeDescriptors (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LocalNodeDescriptors)2 RemoteNodeDescriptors (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.RemoteNodeDescriptors)2 TpId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId)2 TerminationPointType (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.igp.termination.point.attributes.TerminationPointType)2 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)2 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)2 ByteBuf (io.netty.buffer.ByteBuf)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 SimpleNlriTypeRegistry (org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry)1 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 DomainIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.DomainIdentifier)1 Ipv4InterfaceIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Ipv4InterfaceIdentifier)1 Ipv6InterfaceIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Ipv6InterfaceIdentifier)1 LinkLrIdentifiers (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.LinkLrIdentifiers)1 TopologyIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.TopologyIdentifier)1 SrAdjIds (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.attribute.SrAdjIds)1