mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-23 21:31:00 +02:00
partial fix for default flows. Need to redesign packet requests
Change-Id: Ia68412c3843ecd7da3e7ae9f4f52750874fb1409
This commit is contained in:
parent
fbe25c5f72
commit
089bb77bd2
@ -15,14 +15,6 @@
|
||||
*/
|
||||
package org.onosproject.net.packet.impl;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.felix.scr.annotations.Activate;
|
||||
import org.apache.felix.scr.annotations.Component;
|
||||
import org.apache.felix.scr.annotations.Deactivate;
|
||||
@ -31,6 +23,7 @@ import org.apache.felix.scr.annotations.ReferenceCardinality;
|
||||
import org.apache.felix.scr.annotations.Service;
|
||||
import org.onosproject.core.ApplicationId;
|
||||
import org.onosproject.net.Device;
|
||||
import org.onosproject.net.MastershipRole;
|
||||
import org.onosproject.net.device.DeviceEvent;
|
||||
import org.onosproject.net.device.DeviceListener;
|
||||
import org.onosproject.net.device.DeviceService;
|
||||
@ -55,6 +48,14 @@ import org.onosproject.net.provider.AbstractProviderRegistry;
|
||||
import org.onosproject.net.provider.AbstractProviderService;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
/**
|
||||
* Provides a basic implementation of the packet SB & NB APIs.
|
||||
*/
|
||||
@ -193,9 +194,10 @@ implements PacketService, PacketProviderRegistry {
|
||||
PacketRequest request =
|
||||
new PacketRequest(selector, priority, appId, tableType);
|
||||
|
||||
packetRequests.add(request);
|
||||
if (packetRequests.add(request)) {
|
||||
pushToAllDevices(request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes a packet request flow rule to all devices.
|
||||
@ -204,9 +206,11 @@ implements PacketService, PacketProviderRegistry {
|
||||
*/
|
||||
private void pushToAllDevices(PacketRequest request) {
|
||||
for (Device device : deviceService.getDevices()) {
|
||||
if (deviceService.getRole(device.id()) == MastershipRole.MASTER) {
|
||||
pushRule(device, request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes flow rules to the device to request packets be sent to the
|
||||
|
Loading…
x
Reference in New Issue
Block a user