Search in sources :

Example 1 with IntentSelection

use of org.onosproject.ui.impl.topo.util.IntentSelection in project onos by opennetworkinglab.

the class TrafficMonitorBase method monitor.

/**
 * Monitor for traffic data to be sent back to the web client, for the
 * given intent.
 *
 * @param intent the intent to monitor
 */
public synchronized void monitor(Intent intent) {
    log.debug("monitor intent: {}", intent.id());
    selectedNodes = null;
    selectedIntents = new IntentSelection(intent);
    mode = SELECTED_INTENT;
    scheduleTask();
    sendSelectedIntentTraffic();
}
Also used : IntentSelection(org.onosproject.ui.impl.topo.util.IntentSelection)

Example 2 with IntentSelection

use of org.onosproject.ui.impl.topo.util.IntentSelection in project onos by opennetworkinglab.

the class TrafficMonitorBase method monitor.

/**
 * Monitor for traffic data to be sent back to the web client, under
 * the given mode, using the given selection of devices and hosts.
 * In the case of "device link flows", this causes a background traffic
 * task to be scheduled to repeatedly compute and transmit the appropriate
 * traffic data to the client. In the case of "related intents", no
 * repeating task is scheduled.
 * <p>
 * The monitoring mode is expected to be one of:
 * <ul>
 * <li>DEV_LINK_FLOWS</li>
 * <li>RELATED_INTENTS</li>
 * </ul>
 *
 * @param mode          monitoring mode
 * @param nodeSelection how to select a node
 */
public synchronized void monitor(Mode mode, NodeSelection nodeSelection) {
    log.debug("monitor: {} -- {}", mode, nodeSelection);
    this.mode = mode;
    this.selectedNodes = nodeSelection;
    switch(mode) {
        case DEV_LINK_FLOWS:
            // only care about devices (not hosts)
            if (selectedNodes.devicesWithHover().isEmpty()) {
                clearAll();
            } else {
                scheduleTask();
                sendDeviceLinkFlows();
            }
            break;
        case RELATED_INTENTS:
            if (selectedNodes.none()) {
                clearAll();
            } else {
                selectedIntents = new IntentSelection(selectedNodes, intentFilter);
                if (selectedIntents.none()) {
                    clearAll();
                } else {
                    sendSelectedIntents();
                }
            }
            break;
        default:
            log.debug("Unexpected call to monitor({}, {})", mode, nodeSelection);
            clearAll();
            break;
    }
}
Also used : IntentSelection(org.onosproject.ui.impl.topo.util.IntentSelection)

Aggregations

IntentSelection (org.onosproject.ui.impl.topo.util.IntentSelection)2