From: Olga Schukin Date: Tue, 13 Dec 2016 05:53:40 +0000 (+0200) Subject: Bug 7260: no rules in table 26 for default route X-Git-Tag: release/carbon~560 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=682cbe293647aa9ebf35fc64b5d5a498b1276d64;p=netvirt.git Bug 7260: no rules in table 26 for default route * the model of router gateway wasn't written to mdsal due to NPE * fix the race cond when add router gateway port done after handling ext network for this router Change-Id: Ide2e5d6bb8e90d1d13effb8456aeaed395c9675a Signed-off-by: Olga Schukin --- 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 c99fa9dda0..f077aa1144 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 @@ -351,7 +351,7 @@ public class NeutronPortChangeListener extends AsyncDataTreeChangeListenerBase

ext_fixed_ips = new ArrayList(); - for (ExternalFixedIps fixed_ips : update.getExternalGatewayInfo().getExternalFixedIps()) { - ext_fixed_ips.add(fixed_ips.getIpAddress().getIpv4Address().getValue()); - } - builder.setExternalIps(ext_fixed_ips); + builder.setRouterName(routerId.getValue()); + builder.setNetworkId(extNetId); + builder.setEnableSnat(update.getExternalGatewayInfo().isEnableSnat()); + + ArrayList ext_fixed_ips = new ArrayList(); + for (ExternalFixedIps fixed_ips : update.getExternalGatewayInfo().getExternalFixedIps()) { + ext_fixed_ips.add(fixed_ips.getIpAddress().getIpv4Address().getValue()); } + builder.setExternalIps(ext_fixed_ips); + if (gatewayPortId != null) { LOG.trace("Setting/Updating gateway Mac for router {}", routerId.getValue()); Port port = NeutronvpnUtils.getNeutronPort(broker, gatewayPortId); - if (port.getDeviceOwner().equals(NeutronConstants.DEVICE_OWNER_GATEWAY_INF)) { + if (port != null && port.getDeviceOwner().equals(NeutronConstants.DEVICE_OWNER_GATEWAY_INF)) { builder.setExtGwMacAddress(port.getMacAddress().getValue()); } }