use of org.onosproject.openstacknode.api.OpenstackNode in project onos by opennetworkinglab.
the class OpenstackTroubleshootManager method probeNorthSouth.
@Override
public Reachability probeNorthSouth(InstancePort port) {
Optional<OpenstackNode> gw = osNodeService.completeNodes(GATEWAY).stream().findFirst();
if (!gw.isPresent()) {
log.warn("Gateway is not available to troubleshoot north-south traffic.");
return null;
}
// install flow rules to enforce forwarding ICMP_REPLY to controller
eventExecutor.execute(() -> setNorthSouthIcmpReplyRule(port, gw.get(), true));
timeoutPredicate(1, ICMP_RULE_INSTALL_TIMEOUT_MS, this::checkNorthSouthIcmpReplyRule, port.ipAddress().toString());
// send out ICMP ECHO request
sendIcmpEchoRequest(null, port, gw.get(), Direction.NORTH_SOUTH);
BooleanSupplier checkReachability = () -> icmpReachabilityMap.asJavaMap().values().stream().allMatch(Reachability::isReachable);
timeoutSupplier(1, ICMP_REPLY_TIMEOUT_MS, checkReachability);
// uninstall ICMP_REPLY enforcing rules
eventExecutor.execute(() -> setNorthSouthIcmpReplyRule(port, gw.get(), false));
return icmpReachabilityMap.asJavaMap().get(String.valueOf(icmpIdCounter.get()));
}
Aggregations