Thomas Vachuska

HostLocationProvider fix to avoid locating hosts on logical ports.

Change-Id: I39c754bbb204ef13799f4630557d29e2c18ad915
......@@ -15,12 +15,6 @@
*/
package org.onosproject.provider.host.impl;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Dictionary;
import java.util.Set;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
......@@ -30,8 +24,8 @@ import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.packet.ARP;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IPacket;
import org.onlab.packet.ICMP6;
import org.onlab.packet.IPacket;
import org.onlab.packet.IPv6;
import org.onlab.packet.IpAddress;
import org.onlab.packet.VlanId;
......@@ -69,6 +63,12 @@ import org.onosproject.net.topology.TopologyService;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import java.util.Dictionary;
import java.util.Set;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Provider which uses an OpenFlow controller to detect network
* end-station hosts.
......@@ -236,8 +236,8 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
if (context == null) {
return;
}
Ethernet eth = context.inPacket().parsed();
Ethernet eth = context.inPacket().parsed();
if (eth == null) {
return;
}
......@@ -245,6 +245,11 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
VlanId vlan = VlanId.vlanId(eth.getVlanID());
ConnectPoint heardOn = context.inPacket().receivedFrom();
// If this arrived on control port, bail out.
if (heardOn.port().isLogical()) {
return;
}
// If this is not an edge port, bail out.
Topology topology = topologyService.currentTopology();
if (topologyService.isInfrastructure(topology, heardOn)) {
......