use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev200120.path.descriptions.PathDescriptionBuilder in project bgpcep by opendaylight.
the class AbstractPathComputation method getPathDescription.
/**
* Convert List of Connected Edges into a Path Description as a List of
* IPv4, IPv6 or MPLS Label depending of the requested Address Family.
*
* @param edges
* List of Connected Edges
*
* @return Path Description
*/
protected List<PathDescription> getPathDescription(final List<ConnectedEdge> edges) {
ArrayList<PathDescription> list = new ArrayList<>();
for (ConnectedEdge edge : edges) {
PathDescription pathDesc = null;
switch(constraints.getAddressFamily()) {
case Ipv4:
pathDesc = new PathDescriptionBuilder().setIpv4(edge.getEdge().getEdgeAttributes().getRemoteAddress().getIpv4Address()).build();
break;
case Ipv6:
pathDesc = new PathDescriptionBuilder().setIpv6(edge.getEdge().getEdgeAttributes().getRemoteAddress().getIpv6Address()).build();
break;
case SrIpv4:
pathDesc = new PathDescriptionBuilder().setLocalIpv4(edge.getEdge().getEdgeAttributes().getLocalAddress().getIpv4Address()).setRemoteIpv4(edge.getEdge().getEdgeAttributes().getRemoteAddress().getIpv4Address()).setSid(edge.getEdge().getEdgeAttributes().getAdjSid()).build();
break;
case SrIpv6:
pathDesc = new PathDescriptionBuilder().setLocalIpv6(edge.getEdge().getEdgeAttributes().getLocalAddress().getIpv6Address()).setRemoteIpv6(edge.getEdge().getEdgeAttributes().getRemoteAddress().getIpv6Address()).setSid(edge.getEdge().getEdgeAttributes().getAdjSid()).build();
break;
default:
break;
}
list.add(pathDesc);
}
return list;
}
Aggregations