Search in sources :

Example 1 with TerminationPointType

use of 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 in project bgpcep by opendaylight.

the class NodeChangedListener method getIpTerminationPoint.

private InstanceIdentifier<TerminationPoint> getIpTerminationPoint(final ReadWriteTransaction trans, final IpAddress addr, final InstanceIdentifier<Node> sni, final Boolean inControl) throws ReadFailedException {
    final Topology topo = trans.read(LogicalDatastoreType.OPERATIONAL, this.target).checkedGet().get();
    if (topo.getNode() != null) {
        for (final Node n : topo.getNode()) {
            if (n.getTerminationPoint() != null) {
                for (final TerminationPoint tp : n.getTerminationPoint()) {
                    final TerminationPoint1 tpa = tp.getAugmentation(TerminationPoint1.class);
                    if (tpa != null) {
                        final TerminationPointType tpt = tpa.getIgpTerminationPointAttributes().getTerminationPointType();
                        if (tpt instanceof Ip) {
                            for (final IpAddress address : ((Ip) tpt).getIpAddress()) {
                                if (addr.equals(address)) {
                                    handleSni(sni, n, inControl, trans);
                                    return this.target.builder().child(Node.class, n.getKey()).child(TerminationPoint.class, tp.getKey()).build();
                                }
                            }
                        } else {
                            LOG.debug("Ignoring termination point type {}", tpt);
                        }
                    }
                }
            }
        }
    }
    LOG.debug("Termination point for {} not found, creating a new one", addr);
    return createTP(addr, sni, inControl, trans);
}
Also used : TerminationPoint1(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1) SupportingNode(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) Ip(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.termination.point.type.Ip) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) 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)

Example 2 with TerminationPointType

use of 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 in project bgpcep by opendaylight.

the class LinkstateTopologyBuilder method buildTp.

private static TerminationPoint buildTp(final TpId id, final TerminationPointType type) {
    final TerminationPointBuilder stpb = new TerminationPointBuilder();
    stpb.setKey(new TerminationPointKey(id));
    stpb.setTpId(id);
    if (type != null) {
        stpb.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder().setTerminationPointType(type).build()).build());
    }
    return stpb.build();
}
Also used : TerminationPointKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) IgpTerminationPointAttributesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.IgpTerminationPointAttributesBuilder) TerminationPoint1Builder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1Builder)

Example 3 with TerminationPointType

use of 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 in project bgpcep by opendaylight.

the class LinkstateTopologyBuilder method buildLocalTp.

private static TerminationPoint buildLocalTp(final UriBuilder base, final LinkDescriptors linkDescriptors) {
    final TpId id = buildLocalTpId(base, linkDescriptors);
    final TerminationPointType t = getTpType(linkDescriptors.getIpv4InterfaceAddress(), linkDescriptors.getIpv6InterfaceAddress(), linkDescriptors.getLinkLocalIdentifier());
    return buildTp(id, t);
}
Also used : TpId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId) 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)

Example 4 with TerminationPointType

use of 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 in project bgpcep by opendaylight.

the class LinkstateTopologyBuilder method buildRemoteTp.

private static TerminationPoint buildRemoteTp(final UriBuilder base, final LinkDescriptors linkDescriptors) {
    final TpId id = buildRemoteTpId(base, linkDescriptors);
    final TerminationPointType t = getTpType(linkDescriptors.getIpv4NeighborAddress(), linkDescriptors.getIpv6NeighborAddress(), linkDescriptors.getLinkRemoteIdentifier());
    return buildTp(id, t);
}
Also used : TpId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId) 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)

Example 5 with TerminationPointType

use of 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 in project bgpcep by opendaylight.

the class CreateTunnelInstructionExecutor method buildAddressFamily.

private static AddressFamily buildAddressFamily(final TerminationPoint sp, final TerminationPoint dp) {
    // We need the IGP augmentation -- it has IP addresses
    final TerminationPoint1 sp1 = requireNonNull(sp.getAugmentation(TerminationPoint1.class));
    final TerminationPoint1 dp1 = requireNonNull(dp.getAugmentation(TerminationPoint1.class));
    // Get the types
    final TerminationPointType spt = sp1.getIgpTerminationPointAttributes().getTerminationPointType();
    final TerminationPointType dpt = dp1.getIgpTerminationPointAttributes().getTerminationPointType();
    // The types have to match
    Preconditions.checkArgument(spt.getImplementedInterface().equals(dpt.getImplementedInterface()));
    // And they have to actually be Ip
    final Ip sips = (Ip) spt;
    final Ip dips = (Ip) dpt;
    /*
         * Now a bit of magic. We need to find 'like' addresses, e.g. both
         * IPv4 or both IPv6. We are in IPv6-enabled world now, so let's
         * prefer that.
         */
    Optional<AddressFamily> ret = findIpv6(sips.getIpAddress(), dips.getIpAddress());
    if (!ret.isPresent()) {
        ret = findIpv4(sips.getIpAddress(), dips.getIpAddress());
    }
    // We need to have a ret now
    Preconditions.checkArgument(ret != null, "Failed to find like Endpoint addresses");
    return ret.get();
}
Also used : TerminationPoint1(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1) Ip(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.termination.point.type.Ip) AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.AddressFamily) 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)

Aggregations

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)4 TpId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId)2 TerminationPoint1 (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1)2 Ip (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.termination.point.type.Ip)2 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 AddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.AddressFamily)1 Topology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology)1 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)1 TerminationPoint (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)1 TerminationPointBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder)1 TerminationPointKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey)1 SupportingNode (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode)1 TerminationPoint1Builder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1Builder)1 IgpTerminationPointAttributesBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.IgpTerminationPointAttributesBuilder)1