Search in sources :

Example 6 with LinkCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.LinkCase 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 7 with LinkCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.LinkCase 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)

Example 8 with LinkCase

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

the class LinkstateGraphBuilder method createObject.

@Override
protected void createObject(final ReadWriteTransaction trans, final InstanceIdentifier<LinkstateRoute> id, final LinkstateRoute value) {
    final ObjectType t = value.getObjectType();
    checkArgument(t != null, "Route %s value %s has null object type", id, value);
    if (t instanceof LinkCase) {
        createEdge(value, (LinkCase) t, value.getAttributes());
    } else if (t instanceof NodeCase) {
        createVertex(value, (NodeCase) t, value.getAttributes());
    } else if (t instanceof PrefixCase) {
        createPrefix(value, (PrefixCase) t, value.getAttributes());
    } else {
        LOG.debug(UNHANDLED_OBJECT_CLASS, t.implementedInterface());
    }
}
Also used : ObjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType) OspfNodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.OspfNodeCase) NodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.NodeCase) IsisNodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.IsisNodeCase) PrefixCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.PrefixCase) LinkCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.LinkCase)

Example 9 with LinkCase

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

the class LinkstateGraphBuilder method removeEdge.

private void removeEdge(final LinkCase linkCase) {
    /* Get Source and Destination Connected Vertex */
    if (linkCase.getLinkDescriptors() == null) {
        LOG.warn("Missing Link descriptor in link {}, skipping it", linkCase);
        return;
    }
    EdgeKey edgeKey = new EdgeKey(getEdgeId(linkCase));
    if (edgeKey == null || edgeKey.getEdgeId() == Uint64.ZERO) {
        LOG.warn("Unable to get the Edge Key from link {}, skipping it", linkCase);
        return;
    }
    LOG.info("Deleted Edge {} from TED[{}]", edgeKey, cgraph);
    cgraph.deleteEdge(edgeKey);
}
Also used : EdgeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.EdgeKey)

Example 10 with LinkCase

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

the class LinkstateTopologyBuilder method createObject.

@Override
protected void createObject(final ReadWriteTransaction trans, final InstanceIdentifier<LinkstateRoute> id, final LinkstateRoute value) {
    final UriBuilder base = new UriBuilder(value);
    final ObjectType t = value.getObjectType();
    Preconditions.checkArgument(t != null, "Route %s value %s has null object type", id, value);
    if (t instanceof LinkCase) {
        createLink(trans, base, value, (LinkCase) t, value.getAttributes());
    } else if (t instanceof NodeCase) {
        createNode(trans, base, value, (NodeCase) t, value.getAttributes());
    } else if (t instanceof PrefixCase) {
        createPrefix(trans, base, value, (PrefixCase) t, value.getAttributes());
    } else {
        LOG.debug(UNHANDLED_OBJECT_CLASS, t.implementedInterface());
    }
}
Also used : ObjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType) NodeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.NodeCase) PrefixCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.PrefixCase) LinkCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.LinkCase)

Aggregations

LinkCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.LinkCase)5 ObjectType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType)3 NodeCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.NodeCase)3 PrefixCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.PrefixCase)3 LinkDescriptors (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors)3 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)3 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)2 Preconditions (com.google.common.base.Preconditions)1 ByteBuf (io.netty.buffer.ByteBuf)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 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)1 DomainIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.DomainIdentifier)1 SrAdjIds (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.attribute.SrAdjIds)1 LocalNodeDescriptors (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LocalNodeDescriptors)1 RemoteNodeDescriptors (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.RemoteNodeDescriptors)1 LinkStateAttribute (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.path.attribute.LinkStateAttribute)1 Attributes1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.routes.linkstate.routes.linkstate.route.Attributes1)1 IsisNodeCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.IsisNodeCase)1