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);
}
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();
}
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);
}
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);
}
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();
}
Aggregations