Committed by
Gerrit Code Review
[ONOS-3364] Update the bug: when neutron delete port and VTNManager
monitor the event, get the port information which is null. Change-Id: I844b24e3a1d3a8aba621f63bc1d17fdbad783929
Showing
1 changed file
with
25 additions
and
3 deletions
... | @@ -81,6 +81,11 @@ import org.onosproject.vtn.table.impl.L2ForwardServiceImpl; | ... | @@ -81,6 +81,11 @@ import org.onosproject.vtn.table.impl.L2ForwardServiceImpl; |
81 | import org.onosproject.vtn.util.DataPathIdGenerator; | 81 | import org.onosproject.vtn.util.DataPathIdGenerator; |
82 | import org.onosproject.vtn.util.VtnConfig; | 82 | import org.onosproject.vtn.util.VtnConfig; |
83 | import org.onosproject.vtn.util.VtnData; | 83 | import org.onosproject.vtn.util.VtnData; |
84 | +import org.onosproject.vtnrsc.AllowedAddressPair; | ||
85 | +import org.onosproject.vtnrsc.BindingHostId; | ||
86 | +import org.onosproject.vtnrsc.DefaultVirtualPort; | ||
87 | +import org.onosproject.vtnrsc.FixedIp; | ||
88 | +import org.onosproject.vtnrsc.SecurityGroup; | ||
84 | import org.onosproject.vtnrsc.SegmentationId; | 89 | import org.onosproject.vtnrsc.SegmentationId; |
85 | import org.onosproject.vtnrsc.SubnetId; | 90 | import org.onosproject.vtnrsc.SubnetId; |
86 | import org.onosproject.vtnrsc.TenantId; | 91 | import org.onosproject.vtnrsc.TenantId; |
... | @@ -148,10 +153,12 @@ public class VTNManager implements VTNService { | ... | @@ -148,10 +153,12 @@ public class VTNManager implements VTNService { |
148 | private static final String CONTROLLER_IP_KEY = "ipaddress"; | 153 | private static final String CONTROLLER_IP_KEY = "ipaddress"; |
149 | public static final String DRIVER_NAME = "onosfw"; | 154 | public static final String DRIVER_NAME = "onosfw"; |
150 | private static final String EX_PORT_NAME = "eth0"; | 155 | private static final String EX_PORT_NAME = "eth0"; |
156 | + private static final String VIRTUALPORT = "vtn-virtual-port"; | ||
151 | private static final String SWITCHES_OF_CONTROLLER = "switchesOfController"; | 157 | private static final String SWITCHES_OF_CONTROLLER = "switchesOfController"; |
152 | private static final String SWITCH_OF_LOCAL_HOST_PORTS = "switchOfLocalHostPorts"; | 158 | private static final String SWITCH_OF_LOCAL_HOST_PORTS = "switchOfLocalHostPorts"; |
153 | private static final String DEFAULT_IP = "0.0.0.0"; | 159 | private static final String DEFAULT_IP = "0.0.0.0"; |
154 | 160 | ||
161 | + private EventuallyConsistentMap<VirtualPortId, VirtualPort> vPortStore; | ||
155 | private EventuallyConsistentMap<IpAddress, Boolean> switchesOfController; | 162 | private EventuallyConsistentMap<IpAddress, Boolean> switchesOfController; |
156 | private EventuallyConsistentMap<DeviceId, NetworkOfLocalHostPorts> switchOfLocalHostPorts; | 163 | private EventuallyConsistentMap<DeviceId, NetworkOfLocalHostPorts> switchOfLocalHostPorts; |
157 | 164 | ||
... | @@ -171,7 +178,21 @@ public class VTNManager implements VTNService { | ... | @@ -171,7 +178,21 @@ public class VTNManager implements VTNService { |
171 | .register(Host.class) | 178 | .register(Host.class) |
172 | .register(TenantNetwork.class) | 179 | .register(TenantNetwork.class) |
173 | .register(TenantId.class) | 180 | .register(TenantId.class) |
174 | - .register(SubnetId.class); | 181 | + .register(SubnetId.class) |
182 | + .register(VirtualPortId.class) | ||
183 | + .register(VirtualPort.State.class) | ||
184 | + .register(AllowedAddressPair.class) | ||
185 | + .register(FixedIp.class) | ||
186 | + .register(BindingHostId.class) | ||
187 | + .register(SecurityGroup.class) | ||
188 | + .register(IpAddress.class) | ||
189 | + .register(DefaultVirtualPort.class); | ||
190 | + | ||
191 | + vPortStore = storageService | ||
192 | + .<VirtualPortId, VirtualPort>eventuallyConsistentMapBuilder() | ||
193 | + .withName(VIRTUALPORT).withSerializer(serializer) | ||
194 | + .withTimestampProvider((k, v) -> clockService.getTimestamp()) | ||
195 | + .build(); | ||
175 | 196 | ||
176 | switchesOfController = storageService | 197 | switchesOfController = storageService |
177 | .<IpAddress, Boolean>eventuallyConsistentMapBuilder() | 198 | .<IpAddress, Boolean>eventuallyConsistentMapBuilder() |
... | @@ -355,8 +376,7 @@ public class VTNManager implements VTNService { | ... | @@ -355,8 +376,7 @@ public class VTNManager implements VTNService { |
355 | VirtualPortId virtualPortId = VirtualPortId.portId(ifaceId); | 376 | VirtualPortId virtualPortId = VirtualPortId.portId(ifaceId); |
356 | VirtualPort virtualPort = virtualPortService.getPort(virtualPortId); | 377 | VirtualPort virtualPort = virtualPortService.getPort(virtualPortId); |
357 | if (virtualPort == null) { | 378 | if (virtualPort == null) { |
358 | - log.error("The virtualPort of host is null"); | 379 | + virtualPort = vPortStore.get(virtualPortId); |
359 | - return; | ||
360 | } | 380 | } |
361 | 381 | ||
362 | Iterable<Device> devices = deviceService.getAvailableDevices(); | 382 | Iterable<Device> devices = deviceService.getAvailableDevices(); |
... | @@ -383,6 +403,7 @@ public class VTNManager implements VTNService { | ... | @@ -383,6 +403,7 @@ public class VTNManager implements VTNService { |
383 | } | 403 | } |
384 | 404 | ||
385 | if (type == Objective.Operation.ADD) { | 405 | if (type == Objective.Operation.ADD) { |
406 | + vPortStore.put(virtualPortId, virtualPort); | ||
386 | if (networkOflocalHostPorts == null) { | 407 | if (networkOflocalHostPorts == null) { |
387 | networkOflocalHostPorts = new HashSet<PortNumber>(); | 408 | networkOflocalHostPorts = new HashSet<PortNumber>(); |
388 | localHostPorts.putIfAbsent(network.id(), networkOflocalHostPorts); | 409 | localHostPorts.putIfAbsent(network.id(), networkOflocalHostPorts); |
... | @@ -396,6 +417,7 @@ public class VTNManager implements VTNService { | ... | @@ -396,6 +417,7 @@ public class VTNManager implements VTNService { |
396 | localTunnelPorts, | 417 | localTunnelPorts, |
397 | type); | 418 | type); |
398 | } else if (type == Objective.Operation.REMOVE) { | 419 | } else if (type == Objective.Operation.REMOVE) { |
420 | + vPortStore.remove(virtualPortId); | ||
399 | if (networkOflocalHostPorts != null) { | 421 | if (networkOflocalHostPorts != null) { |
400 | l2ForwardService.programLocalBcastRules(deviceId, segmentationId, | 422 | l2ForwardService.programLocalBcastRules(deviceId, segmentationId, |
401 | inPort, networkOflocalHostPorts, | 423 | inPort, networkOflocalHostPorts, | ... | ... |
-
Please register or login to post a comment