HostLocationProvider fix to avoid locating hosts on logical ports.

Change-Id: I39c754bbb204ef13799f4630557d29e2c18ad915
This commit is contained in:
Thomas Vachuska 2015-03-24 10:13:09 -07:00
parent 7c5210069d
commit f845cf6cfd

View File

@ -15,12 +15,6 @@
*/ */
package org.onosproject.provider.host.impl; 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.Activate;
import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate; 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.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.packet.ARP; import org.onlab.packet.ARP;
import org.onlab.packet.Ethernet; import org.onlab.packet.Ethernet;
import org.onlab.packet.IPacket;
import org.onlab.packet.ICMP6; import org.onlab.packet.ICMP6;
import org.onlab.packet.IPacket;
import org.onlab.packet.IPv6; import org.onlab.packet.IPv6;
import org.onlab.packet.IpAddress; import org.onlab.packet.IpAddress;
import org.onlab.packet.VlanId; import org.onlab.packet.VlanId;
@ -69,6 +63,12 @@ import org.onosproject.net.topology.TopologyService;
import org.osgi.service.component.ComponentContext; import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger; 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 * Provider which uses an OpenFlow controller to detect network
* end-station hosts. * end-station hosts.
@ -236,8 +236,8 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
if (context == null) { if (context == null) {
return; return;
} }
Ethernet eth = context.inPacket().parsed();
Ethernet eth = context.inPacket().parsed();
if (eth == null) { if (eth == null) {
return; return;
} }
@ -245,6 +245,11 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
VlanId vlan = VlanId.vlanId(eth.getVlanID()); VlanId vlan = VlanId.vlanId(eth.getVlanID());
ConnectPoint heardOn = context.inPacket().receivedFrom(); 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. // If this is not an edge port, bail out.
Topology topology = topologyService.currentTopology(); Topology topology = topologyService.currentTopology();
if (topologyService.isInfrastructure(topology, heardOn)) { if (topologyService.isInfrastructure(topology, heardOn)) {