Search in sources :

Example 76 with OpenstackNode

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()));
}
Also used : OpenstackNode(org.onosproject.openstacknode.api.OpenstackNode) BooleanSupplier(java.util.function.BooleanSupplier) Reachability(org.onosproject.openstacktroubleshoot.api.Reachability)

Aggregations

OpenstackNode (org.onosproject.openstacknode.api.OpenstackNode)76 OpenstackNodeService (org.onosproject.openstacknode.api.OpenstackNodeService)22 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)19 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)19 TrafficSelector (org.onosproject.net.flow.TrafficSelector)19 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)19 PortNumber (org.onosproject.net.PortNumber)14 DefaultOpenstackNode (org.onosproject.openstacknode.api.DefaultOpenstackNode)14 DeviceService (org.onosproject.net.device.DeviceService)13 Set (java.util.Set)12 Test (org.junit.Test)12 IpAddress (org.onlab.packet.IpAddress)12 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)9 Objects (java.util.Objects)9 Optional (java.util.Optional)9 ExecutorService (java.util.concurrent.ExecutorService)9 Collectors (java.util.stream.Collectors)9 ComponentConfigService (org.onosproject.cfg.ComponentConfigService)9 Produces (javax.ws.rs.Produces)8 InstancePort (org.onosproject.openstacknetworking.api.InstancePort)7