mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-18 02:41:49 +02:00
Small updates to SR to get it to ignore devices not configured as routers
Change-Id: I2c0f695af1a6eab10607a8117faae5f6161a66d9
This commit is contained in:
parent
003213301f
commit
8ca2bc0447
@ -271,12 +271,9 @@ public class Dhcp6HandlerImpl implements DhcpHandler, HostProvider {
|
||||
}
|
||||
|
||||
byte msgType = dhcp6Payload.getMsgType();
|
||||
log.warn("msgType is {}", msgType);
|
||||
|
||||
ConnectPoint inPort = context.inPacket().receivedFrom();
|
||||
if (inPort == null) {
|
||||
log.warn("incommin ConnectPoint is null");
|
||||
}
|
||||
|
||||
Set<Interface> receivingInterfaces = interfaceService.getInterfacesByPort(inPort);
|
||||
//ignore the packets if dhcp client interface is not configured on onos.
|
||||
if (receivingInterfaces.isEmpty()) {
|
||||
|
@ -191,29 +191,29 @@ public class DefaultRoutingHandler {
|
||||
updatedEcmpSpgMap = new HashMap<>();
|
||||
Set<EdgePair> edgePairs = new HashSet<>();
|
||||
Set<ArrayList<DeviceId>> routeChanges = new HashSet<>();
|
||||
for (Device dstSw : srManager.deviceService.getDevices()) {
|
||||
for (DeviceId dstSw : srManager.deviceConfiguration.getRouters()) {
|
||||
EcmpShortestPathGraph ecmpSpgUpdated =
|
||||
new EcmpShortestPathGraph(dstSw.id(), srManager);
|
||||
updatedEcmpSpgMap.put(dstSw.id(), ecmpSpgUpdated);
|
||||
DeviceId pairDev = getPairDev(dstSw.id());
|
||||
new EcmpShortestPathGraph(dstSw, srManager);
|
||||
updatedEcmpSpgMap.put(dstSw, ecmpSpgUpdated);
|
||||
DeviceId pairDev = getPairDev(dstSw);
|
||||
if (pairDev != null) {
|
||||
// pairDev may not be available yet, but we still need to add
|
||||
ecmpSpgUpdated = new EcmpShortestPathGraph(pairDev, srManager);
|
||||
updatedEcmpSpgMap.put(pairDev, ecmpSpgUpdated);
|
||||
edgePairs.add(new EdgePair(dstSw.id(), pairDev));
|
||||
edgePairs.add(new EdgePair(dstSw, pairDev));
|
||||
}
|
||||
DeviceId ret = shouldHandleRouting(dstSw.id());
|
||||
DeviceId ret = shouldHandleRouting(dstSw);
|
||||
if (ret == null) {
|
||||
continue;
|
||||
}
|
||||
Set<DeviceId> devsToProcess = Sets.newHashSet(dstSw.id(), ret);
|
||||
Set<DeviceId> devsToProcess = Sets.newHashSet(dstSw, ret);
|
||||
// To do a full reroute, assume all routes have changed
|
||||
for (DeviceId dev : devsToProcess) {
|
||||
for (Device targetSw : srManager.deviceService.getDevices()) {
|
||||
if (targetSw.id().equals(dev)) {
|
||||
for (DeviceId targetSw : srManager.deviceConfiguration.getRouters()) {
|
||||
if (targetSw.equals(dev)) {
|
||||
continue;
|
||||
}
|
||||
routeChanges.add(Lists.newArrayList(targetSw.id(), dev));
|
||||
routeChanges.add(Lists.newArrayList(targetSw, dev));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,23 +15,11 @@
|
||||
*/
|
||||
package org.onosproject.segmentrouting;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.apache.felix.scr.annotations.Activate;
|
||||
import org.apache.felix.scr.annotations.Component;
|
||||
@ -121,10 +109,21 @@ import org.onosproject.store.service.WallClockTimestamp;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static org.onlab.packet.Ethernet.TYPE_ARP;
|
||||
@ -581,9 +580,8 @@ public class SegmentRoutingManager implements SegmentRoutingService {
|
||||
@Override
|
||||
public Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap() {
|
||||
Map<DeviceId, Set<IpPrefix>> deviceSubnetMap = Maps.newHashMap();
|
||||
deviceService.getAvailableDevices().forEach(device -> {
|
||||
deviceSubnetMap.put(device.id(), deviceConfiguration.getSubnets(device.id()));
|
||||
});
|
||||
deviceConfiguration.getRouters().forEach(device ->
|
||||
deviceSubnetMap.put(device, deviceConfiguration.getSubnets(device)));
|
||||
return deviceSubnetMap;
|
||||
}
|
||||
|
||||
|
@ -27,18 +27,19 @@ import org.onlab.packet.IpAddress;
|
||||
import org.onlab.packet.IpPrefix;
|
||||
import org.onlab.packet.MacAddress;
|
||||
import org.onlab.packet.VlanId;
|
||||
import org.onosproject.net.config.ConfigException;
|
||||
import org.onosproject.net.config.basics.InterfaceConfig;
|
||||
import org.onosproject.net.intf.Interface;
|
||||
import org.onosproject.net.ConnectPoint;
|
||||
import org.onosproject.net.host.InterfaceIpAddress;
|
||||
import org.onosproject.net.DeviceId;
|
||||
import org.onosproject.net.PortNumber;
|
||||
import org.onosproject.net.config.ConfigException;
|
||||
import org.onosproject.net.config.basics.InterfaceConfig;
|
||||
import org.onosproject.net.host.InterfaceIpAddress;
|
||||
import org.onosproject.net.intf.Interface;
|
||||
import org.onosproject.segmentrouting.SegmentRoutingManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -126,7 +127,9 @@ public class DeviceConfiguration implements DeviceProperties {
|
||||
// Read gatewayIps and subnets from port subject. Ignore suppressed ports.
|
||||
Set<ConnectPoint> portSubjects = srManager.cfgService
|
||||
.getSubjects(ConnectPoint.class, InterfaceConfig.class);
|
||||
portSubjects.stream().filter(subject -> !isSuppressedPort(subject)).forEach(subject -> {
|
||||
portSubjects.stream()
|
||||
.filter(subject -> deviceConfigMap.containsKey(subject.deviceId()))
|
||||
.filter(subject -> !isSuppressedPort(subject)).forEach(subject -> {
|
||||
InterfaceConfig config =
|
||||
srManager.cfgService.getConfig(subject, InterfaceConfig.class);
|
||||
Set<Interface> networkInterfaces;
|
||||
@ -181,6 +184,9 @@ public class DeviceConfiguration implements DeviceProperties {
|
||||
});
|
||||
}
|
||||
|
||||
public Collection<DeviceId> getRouters() {
|
||||
return deviceConfigMap.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConfigured(DeviceId deviceId) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user