X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=vpnservice%2Fneutronvpn%2Fneutronvpn-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetvirt%2Fneutronvpn%2FNeutronPortChangeListener.java;h=1ae7aed907f71537e2915f08c94db9e075a43d94;hb=975a37088dce3a2ac8588e0b13fb3b744475c95b;hp=40f697c5c5a8f1aae33e2ff95c0708c4c04a9565;hpb=9b70e55848c4f710b20f4e23461b6c9985cf565f;p=netvirt.git diff --git a/vpnservice/neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronPortChangeListener.java b/vpnservice/neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronPortChangeListener.java index 40f697c5c5..1ae7aed907 100644 --- a/vpnservice/neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronPortChangeListener.java +++ b/vpnservice/neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronPortChangeListener.java @@ -66,19 +66,16 @@ public class NeutronPortChangeListener extends AbstractDataChangeListener private LockManagerService lockManager; private NotificationPublishService notificationPublishService; private NotificationService notificationService; - private NeutronFloatingToFixedIpMappingChangeListener floatingIpMapListener; public NeutronPortChangeListener(final DataBroker db, NeutronvpnManager nVpnMgr,NeutronvpnNatManager nVpnNatMgr, - NotificationPublishService notiPublishService, NotificationService notiService, - NeutronFloatingToFixedIpMappingChangeListener neutronFloatingToFixedIpMappingChangeListener) { + NotificationPublishService notiPublishService, NotificationService notiService) { super(Port.class); broker = db; nvpnManager = nVpnMgr; nvpnNatManager = nVpnNatMgr; notificationPublishService = notiPublishService; notificationService = notiService; - floatingIpMapListener = neutronFloatingToFixedIpMappingChangeListener; registerListener(db); } @@ -251,6 +248,7 @@ public class NeutronPortChangeListener extends AbstractDataChangeListener private void handleNeutronPortCreated(Port port) { if (!NeutronUtils.isPortVnicTypeNormal(port)) { + nvpnManager.updateSubnetmapNodeWithPorts(port.getFixedIps().get(0).getSubnetId(), null, port.getUuid()); LOG.info("Port {} is not a NORMAL VNIC Type port; OF Port interfaces are not created", port.getUuid().getValue()); return; @@ -276,8 +274,14 @@ public class NeutronPortChangeListener extends AbstractDataChangeListener } private void handleNeutronPortDeleted(Port port) { + if (!NeutronUtils.isPortVnicTypeNormal(port)) { + nvpnManager.removePortsFromSubnetmapNode(port.getFixedIps().get(0).getSubnetId(), null, port.getUuid()); + LOG.info("Port {} is not a NORMAL VNIC Type port; OF Port interfaces are not created", + port.getUuid().getValue()); + return; + } //dissociate fixedIP from floatingIP if associated - floatingIpMapListener.dissociatefixedIPFromFloatingIP(port.getUuid().getValue()); + nvpnManager.dissociatefixedIPFromFloatingIP(port.getUuid().getValue()); LOG.debug("Remove port from subnet"); // remove port from local Subnets DS Uuid vpnId = removePortFromSubnets(port); @@ -620,7 +624,7 @@ public class NeutronPortChangeListener extends AbstractDataChangeListener LOG.debug("fixedIp-name map for neutron port with fixedIp: {}, name: {} added to NeutronPortData DS", ipValue, infName); subnetId = ip.getSubnetId(); - subnetmap = nvpnManager.updateSubnetNode(subnetId, null, null, null, null, null, port.getUuid()); + subnetmap = nvpnManager.updateSubnetmapNodeWithPorts(subnetId, port.getUuid(), null); if (subnetmap != null) { vpnId = subnetmap.getVpnId(); } @@ -654,7 +658,7 @@ public class NeutronPortChangeListener extends AbstractDataChangeListener MDSALUtil.syncDelete(broker, LogicalDatastoreType.CONFIGURATION, id); LOG.debug("fixedIp-name map for neutron port with fixedIp: {} deleted from NeutronPortData DS", ipValue); subnetId = ip.getSubnetId(); - subnetmap = nvpnManager.removeFromSubnetNode(subnetId, null, null, null, port.getUuid()); + subnetmap = nvpnManager.removePortsFromSubnetmapNode(subnetId, port.getUuid(), null); if (subnetmap != null) { vpnId = subnetmap.getVpnId(); }