-
Bug
-
Resolution: Done
-
None
-
Carbon
-
None
-
Operating System: All
Platform: All
-
8875
-
Normal
Issue was introduced by this gerrit change:
https://git.opendaylight.org/gerrit/#/c/45969
https://bugs.opendaylight.org/show_bug.cgi?id=6770
at NeutronPortChangeListener.java, handleNeutronPortUpdated method:
445 + final DataStoreJobCoordinator portDataStoreCoordinator = DataStoreJobCoordinator.getInstance();
446 + portDataStoreCoordinator.enqueueJob("PORT- " + portupdate.getUuid().getValue(), new
447 + Callable<List<ListenableFuture<Void>>>() {
448 + @Override
449 + public List<ListenableFuture<Void>> call() throws Exception {
450 + WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
451 + List<ListenableFuture<Void>> futures = new ArrayList<>();
452 +
453 + Uuid vpnIdNew = null;
454 + final Uuid subnetIdOr = portupdate.getFixedIps().get(0).getSubnetId();
455 + final Uuid subnetIdUp = portupdate.getFixedIps().get(0).getSubnetId();
456 + // check if subnet UUID has changed upon change in fixedIP
457 + final Boolean subnetUpdated = subnetIdUp.equals(subnetIdOr) ? false : true;
458 +
459 + if (subnetUpdated) {
460 + Subnetmap subnetMapOld = nvpnManager.removePortsFromSubnetmapNode(subnetIdOr, portoriginal
461 + .getUuid(), null);
462 + Uuid vpnIdOld = (subnetMapOld != null) ? subnetMapOld.getVpnId() : null;
463 + if (vpnIdOld != null) {
464 + // send port removed from subnet notification
465 + // only sent when the port was part of a VPN
466 + String elanInstanceName = portoriginal.getNetworkId().getValue();
467 + InstanceIdentifier<ElanInstance> elanIdentifierId = InstanceIdentifier.builder(ElanInstances
468 + .class).child(ElanInstance.class, new ElanInstanceKey(elanInstanceName)).build();
469 + Optional<ElanInstance> elanInstance = NeutronvpnUtils.read(dataBroker,
470 + LogicalDatastoreType.CONFIGURATION, elanIdentifierId);
471 + long elanTag = elanInstance.get().getElanTag();
472 + try
catch (Exception e)
{ 477 + LOG.error("Port removed from subnet notification failed", e); 478 + }479 + }
480 + Subnetmap subnetMapNew = nvpnManager.updateSubnetmapNodeWithPorts(subnetIdUp, portupdate.getUuid(),
481 + null);
482 + vpnIdNew = (subnetMapNew != null) ? subnetMapNew.getVpnId() : null;
483 + if (vpnIdNew != null) {
484 + // send port added to subnet notification
485 + // only sent when the port is part of a VPN
486 + String elanInstanceName = portupdate.getNetworkId().getValue();
487 + InstanceIdentifier<ElanInstance> elanIdentifierId = InstanceIdentifier.builder(ElanInstances
488 + .class).child(ElanInstance.class, new ElanInstanceKey(elanInstanceName)).build();
489 + Optional<ElanInstance> elanInstance = NeutronvpnUtils.read(dataBroker,
490 + LogicalDatastoreType
491 + .CONFIGURATION, elanIdentifierId);
492 + long elanTag = elanInstance.get().getElanTag();
493 + try
catch (Exception e)
{ 498 + LOG.error("Port added to subnet notification failed", e); 499 + }500 + }
501 + }
...
At lines 454, 455 we set values for subnetIdOr and subnetIdUp, but these variables will always have the same value, because we get SubnetId for both two variables from updated neutron port (portupdate) => comparation at line 457 will always give False => condition in line 459 will be never executed.
So this makes handleNeutronPortUpdated unable to catch, that Subnet ID for neutron port was changed (port was updated), hence, to threat a case, when we add a second subnet to a neutron network.
See appropriate log with added debug traces in attachement