Committed by
Gerrit Code Review
HostLocationProvider should not remove hosts installed by other providers
Change-Id: I0d95a3c9409a9d8bb4e0c0039ea24dc9c0efc45f
Showing
2 changed files
with
8 additions
and
3 deletions
... | @@ -462,7 +462,9 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid | ... | @@ -462,7 +462,9 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid |
462 | // Signals host vanish for all specified hosts. | 462 | // Signals host vanish for all specified hosts. |
463 | private void removeHosts(Set<Host> hosts) { | 463 | private void removeHosts(Set<Host> hosts) { |
464 | for (Host host : hosts) { | 464 | for (Host host : hosts) { |
465 | - providerService.hostVanished(host.id()); | 465 | + if (host.providerId().equals(HostLocationProvider.this.id())) { |
466 | + providerService.hostVanished(host.id()); | ||
467 | + } | ||
466 | } | 468 | } |
467 | } | 469 | } |
468 | 470 | ... | ... |
... | @@ -86,6 +86,9 @@ import static org.onosproject.net.PortNumber.portNumber; | ... | @@ -86,6 +86,9 @@ import static org.onosproject.net.PortNumber.portNumber; |
86 | import static org.onosproject.net.device.DeviceEvent.Type.*; | 86 | import static org.onosproject.net.device.DeviceEvent.Type.*; |
87 | 87 | ||
88 | public class HostLocationProviderTest { | 88 | public class HostLocationProviderTest { |
89 | + private static final ProviderId PROVIDER_ID = | ||
90 | + new ProviderId("of", "org.onosproject.provider.host"); | ||
91 | + | ||
89 | private static final Integer INPORT = 10; | 92 | private static final Integer INPORT = 10; |
90 | private static final String DEV1 = "of:1"; | 93 | private static final String DEV1 = "of:1"; |
91 | private static final String DEV2 = "of:2"; | 94 | private static final String DEV2 = "of:2"; |
... | @@ -105,7 +108,7 @@ public class HostLocationProviderTest { | ... | @@ -105,7 +108,7 @@ public class HostLocationProviderTest { |
105 | private static final HostLocation LOCATION = | 108 | private static final HostLocation LOCATION = |
106 | new HostLocation(deviceId(DEV1), portNumber(INPORT), 0L); | 109 | new HostLocation(deviceId(DEV1), portNumber(INPORT), 0L); |
107 | private static final DefaultHost HOST = | 110 | private static final DefaultHost HOST = |
108 | - new DefaultHost(ProviderId.NONE, hostId(MAC), MAC, | 111 | + new DefaultHost(PROVIDER_ID, hostId(MAC), MAC, |
109 | vlanId(VlanId.UNTAGGED), LOCATION, | 112 | vlanId(VlanId.UNTAGGED), LOCATION, |
110 | ImmutableSet.of(IP_ADDRESS)); | 113 | ImmutableSet.of(IP_ADDRESS)); |
111 | 114 | ||
... | @@ -118,7 +121,7 @@ public class HostLocationProviderTest { | ... | @@ -118,7 +121,7 @@ public class HostLocationProviderTest { |
118 | private static final HostLocation LOCATION2 = | 121 | private static final HostLocation LOCATION2 = |
119 | new HostLocation(deviceId(DEV4), portNumber(INPORT), 0L); | 122 | new HostLocation(deviceId(DEV4), portNumber(INPORT), 0L); |
120 | private static final DefaultHost HOST2 = | 123 | private static final DefaultHost HOST2 = |
121 | - new DefaultHost(ProviderId.NONE, hostId(MAC2), MAC2, | 124 | + new DefaultHost(PROVIDER_ID, hostId(MAC2), MAC2, |
122 | vlanId(VlanId.UNTAGGED), LOCATION2, | 125 | vlanId(VlanId.UNTAGGED), LOCATION2, |
123 | ImmutableSet.of(IP_ADDRESS2)); | 126 | ImmutableSet.of(IP_ADDRESS2)); |
124 | 127 | ... | ... |
-
Please register or login to post a comment