Thomas Vachuska

HostLocationProvider fix to avoid locating hosts on logical ports.

Change-Id: I39c754bbb204ef13799f4630557d29e2c18ad915
...@@ -15,12 +15,6 @@ ...@@ -15,12 +15,6 @@
15 */ 15 */
16 package org.onosproject.provider.host.impl; 16 package org.onosproject.provider.host.impl;
17 17
18 -import static com.google.common.base.Strings.isNullOrEmpty;
19 -import static org.slf4j.LoggerFactory.getLogger;
20 -
21 -import java.util.Dictionary;
22 -import java.util.Set;
23 -
24 import org.apache.felix.scr.annotations.Activate; 18 import org.apache.felix.scr.annotations.Activate;
25 import org.apache.felix.scr.annotations.Component; 19 import org.apache.felix.scr.annotations.Component;
26 import org.apache.felix.scr.annotations.Deactivate; 20 import org.apache.felix.scr.annotations.Deactivate;
...@@ -30,8 +24,8 @@ import org.apache.felix.scr.annotations.Reference; ...@@ -30,8 +24,8 @@ import org.apache.felix.scr.annotations.Reference;
30 import org.apache.felix.scr.annotations.ReferenceCardinality; 24 import org.apache.felix.scr.annotations.ReferenceCardinality;
31 import org.onlab.packet.ARP; 25 import org.onlab.packet.ARP;
32 import org.onlab.packet.Ethernet; 26 import org.onlab.packet.Ethernet;
33 -import org.onlab.packet.IPacket;
34 import org.onlab.packet.ICMP6; 27 import org.onlab.packet.ICMP6;
28 +import org.onlab.packet.IPacket;
35 import org.onlab.packet.IPv6; 29 import org.onlab.packet.IPv6;
36 import org.onlab.packet.IpAddress; 30 import org.onlab.packet.IpAddress;
37 import org.onlab.packet.VlanId; 31 import org.onlab.packet.VlanId;
...@@ -69,6 +63,12 @@ import org.onosproject.net.topology.TopologyService; ...@@ -69,6 +63,12 @@ import org.onosproject.net.topology.TopologyService;
69 import org.osgi.service.component.ComponentContext; 63 import org.osgi.service.component.ComponentContext;
70 import org.slf4j.Logger; 64 import org.slf4j.Logger;
71 65
66 +import java.util.Dictionary;
67 +import java.util.Set;
68 +
69 +import static com.google.common.base.Strings.isNullOrEmpty;
70 +import static org.slf4j.LoggerFactory.getLogger;
71 +
72 /** 72 /**
73 * Provider which uses an OpenFlow controller to detect network 73 * Provider which uses an OpenFlow controller to detect network
74 * end-station hosts. 74 * end-station hosts.
...@@ -236,8 +236,8 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid ...@@ -236,8 +236,8 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
236 if (context == null) { 236 if (context == null) {
237 return; 237 return;
238 } 238 }
239 - Ethernet eth = context.inPacket().parsed();
240 239
240 + Ethernet eth = context.inPacket().parsed();
241 if (eth == null) { 241 if (eth == null) {
242 return; 242 return;
243 } 243 }
...@@ -245,6 +245,11 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid ...@@ -245,6 +245,11 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
245 VlanId vlan = VlanId.vlanId(eth.getVlanID()); 245 VlanId vlan = VlanId.vlanId(eth.getVlanID());
246 ConnectPoint heardOn = context.inPacket().receivedFrom(); 246 ConnectPoint heardOn = context.inPacket().receivedFrom();
247 247
248 + // If this arrived on control port, bail out.
249 + if (heardOn.port().isLogical()) {
250 + return;
251 + }
252 +
248 // If this is not an edge port, bail out. 253 // If this is not an edge port, bail out.
249 Topology topology = topologyService.currentTopology(); 254 Topology topology = topologyService.currentTopology();
250 if (topologyService.isInfrastructure(topology, heardOn)) { 255 if (topologyService.isInfrastructure(topology, heardOn)) {
......