import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import javax.annotation.PostConstruct;
import javax.inject.Singleton;
import org.apache.commons.lang3.ObjectUtils;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.netvirt.neutronvpn.api.enums.IpVersionChoice;
import org.opendaylight.netvirt.neutronvpn.api.utils.NeutronConstants;
import org.opendaylight.netvirt.neutronvpn.api.utils.NeutronUtils;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.L2vlan;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.SplitHorizon;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.SplitHorizonBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAcl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAclBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.RoutersBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.port.info.FloatingIpIdToPortMappingBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.port.info.FloatingIpIdToPortMappingKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.config.rev160806.NeutronvpnConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.port.id.subport.data.PortIdToSubport;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.hostconfig.rev150712.hostconfig.attributes.hostconfigs.Hostconfig;
private final NeutronvpnUtils neutronvpnUtils;
private final HostConfigCache hostConfigCache;
private final DataTreeEventCallbackRegistrar eventCallbacks;
+ private final NeutronvpnConfig neutronvpnConfig;
public NeutronPortChangeListener(final DataBroker dataBroker,
final NeutronvpnManager neutronvpnManager,
final JobCoordinator jobCoordinator,
final NeutronvpnUtils neutronvpnUtils,
final HostConfigCache hostConfigCache,
- final DataTreeEventCallbackRegistrar dataTreeEventCallbackRegistrar) {
+ final DataTreeEventCallbackRegistrar dataTreeEventCallbackRegistrar,
+ final NeutronvpnConfig neutronvpnConfig) {
super(Port.class, NeutronPortChangeListener.class);
this.dataBroker = dataBroker;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.neutronvpnUtils = neutronvpnUtils;
this.hostConfigCache = hostConfigCache;
this.eventCallbacks = dataTreeEventCallbackRegistrar;
+ this.neutronvpnConfig = neutronvpnConfig;
+
}
@Override
@Override
protected void add(InstanceIdentifier<Port> identifier, Port input) {
+ LOG.trace("Received port add event: port={}", input);
String portName = input.getUuid().getValue();
LOG.trace("Adding Port : key: {}, value={}", identifier, input);
Network network = neutronvpnUtils.getNeutronNetwork(input.getNetworkId());
return;
}
if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(input.getDeviceOwner())) {
- handleRouterGatewayUpdated(input);
+ handleRouterGatewayUpdated(input, false);
portStatus = NeutronUtils.PORT_STATUS_ACTIVE;
} else if (NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(input.getDeviceOwner())) {
handleFloatingIpPortUpdated(null, input);
return;
} else if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(input.getDeviceOwner())
|| NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(input.getDeviceOwner())) {
+ handleRouterGatewayUpdated(input, true);
elanService.removeKnownL3DmacAddress(input.getMacAddress().getValue(), input.getNetworkId().getValue());
}
}
@Override
protected void update(InstanceIdentifier<Port> identifier, Port original, Port update) {
+ LOG.trace("Received port update event: original={}, update={}", original, update);
// Switchdev ports need to be bounded to a host before creation
// in order to validate the supported vnic types from the hostconfig
if (isPortTypeSwitchdev(original)
}
final String portName = update.getUuid().getValue();
Network network = neutronvpnUtils.getNeutronNetwork(update.getNetworkId());
- LOG.info("Update port {} from network {}", portName, update.getNetworkId().toString());
if (network == null || !NeutronvpnUtils.isNetworkTypeSupported(network)) {
LOG.warn("neutron vpn received a port update() for a network without a provider extension augmentation "
+ "or with an unsupported network type for the port {} which is part of network {}",
return;
}
if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(update.getDeviceOwner())) {
- handleRouterGatewayUpdated(update);
+ handleRouterGatewayUpdated(update, false);
} else if (NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(update.getDeviceOwner())) {
handleFloatingIpPortUpdated(original, update);
}
// check if port security enabled/disabled as part of port update
boolean origSecurityEnabled = NeutronvpnUtils.getPortSecurityEnabled(original);
boolean updatedSecurityEnabled = NeutronvpnUtils.getPortSecurityEnabled(update);
-
- if (origSecurityEnabled || updatedSecurityEnabled) {
+ boolean isDhcpServerPort = neutronvpnConfig.isLimitBumtrafficToDhcpserver()
+ && NeutronvpnUtils.isDhcpServerPort(update);
+ if (origSecurityEnabled || updatedSecurityEnabled || isDhcpServerPort) {
InstanceIdentifier<Interface> interfaceIdentifier = NeutronvpnUtils.buildVlanInterfaceIdentifier(portName);
jobCoordinator.enqueueJob("PORT- " + portName,
() -> Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION,
confTx.read(interfaceIdentifier).get();
if (optionalInf.isPresent()) {
InterfaceBuilder interfaceBuilder = new InterfaceBuilder(optionalInf.get());
- InterfaceAcl infAcl = handlePortSecurityUpdated(original, update,
- origSecurityEnabled, updatedSecurityEnabled, interfaceBuilder).build();
- interfaceBuilder.addAugmentation(InterfaceAcl.class, infAcl);
+ if (origSecurityEnabled || updatedSecurityEnabled) {
+ InterfaceAcl infAcl = handlePortSecurityUpdated(original, update, origSecurityEnabled,
+ updatedSecurityEnabled, interfaceBuilder).build();
+ interfaceBuilder.addAugmentation(InterfaceAcl.class, infAcl);
+ } else if (isDhcpServerPort) {
+ Set<FixedIps> oldIPs = getFixedIpSet(original.getFixedIps());
+ Set<FixedIps> newIPs = getFixedIpSet(update.getFixedIps());
+ if (!oldIPs.equals(newIPs)) {
+ InterfaceAcl infAcl = neutronvpnUtils.getDhcpInterfaceAcl(update);
+ interfaceBuilder.addAugmentation(InterfaceAcl.class, infAcl);
+ }
+ }
LOG.info("update: Of-port-interface updation for port {}", portName);
// Update OFPort interface for this neutron port
confTx.put(interfaceIdentifier, interfaceBuilder.build());
}
}
- private void handleFloatingIpPortUpdated(Port original, Port update) {
- if ((original == null || original.getDeviceId().equals(NeutronConstants.FLOATING_IP_DEVICE_ID_PENDING))
- && !update.getDeviceId().equals(NeutronConstants.FLOATING_IP_DEVICE_ID_PENDING)) {
+ private void handleFloatingIpPortUpdated(@Nullable Port original, Port update) {
+ if ((original == null || NeutronConstants.FLOATING_IP_DEVICE_ID_PENDING.equals(original.getDeviceId())
+ && !NeutronConstants.FLOATING_IP_DEVICE_ID_PENDING.equals(update.getDeviceId()))) {
// populate floating-ip uuid and floating-ip port attributes (uuid, mac and subnet id for the ONLY
// fixed IP) to be used by NAT, depopulated in NATService once mac is retrieved in the removal path
addToFloatingIpPortInfo(new Uuid(update.getDeviceId()), update.getUuid(), update.getFixedIps().get(0)
listVpnIds.add(vpnId);
Uuid internetVpnId = neutronvpnUtils.getInternetvpnUuidBoundToRouterId(routerId);
List<Subnetmap> subnetMapList = new ArrayList<>();
- List<FixedIps> portIps = routerPort.getFixedIps();
boolean portIsIpv6 = false;
- for (FixedIps portIP : portIps) {
+ for (FixedIps portIP : routerPort.nonnullFixedIps()) {
// NOTE: Please donot change the order of calls to updateSubnetNodeWithFixedIP
// and addSubnetToVpn here
if (internetVpnId != null
&& portIP.getIpAddress().getIpv6Address() != null) {
portIsIpv6 = true;
}
- String ipValue = String.valueOf(portIP.getIpAddress().getValue());
+ String ipValue = portIP.getIpAddress().stringValue();
Uuid subnetId = portIP.getSubnetId();
nvpnManager.updateSubnetNodeWithFixedIp(subnetId, routerId,
routerPort.getUuid(), ipValue, routerPort.getMacAddress().getValue(), vpnId);
}
if (portIsIpv6) {
listVpnIds.add(internetVpnId);
- if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChangeToAdd(
- IpVersionChoice.IPV6, internetVpnId)) {
- neutronvpnUtils.updateVpnInstanceWithIpFamily(internetVpnId.getValue(),
- IpVersionChoice.IPV6, true);
- neutronvpnUtils.updateVpnInstanceWithFallback(internetVpnId.getValue(), true);
+ if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChange(
+ IpVersionChoice.IPV6, routerId, true)) {
+ neutronvpnUtils.updateVpnInstanceWithIpFamily(internetVpnId.getValue(), IpVersionChoice.IPV6,
+ true);
+ neutronvpnUtils.updateVpnInstanceWithFallback(routerId, internetVpnId, true);
}
}
if (! subnetMapList.isEmpty()) {
nvpnManager.createVpnInterface(listVpnIds, routerPort, null);
}
- for (FixedIps portIP : routerPort.getFixedIps()) {
- String ipValue = String.valueOf(portIP.getIpAddress().getValue());
- IpVersionChoice version = neutronvpnUtils.getIpVersionFromString(ipValue);
- if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChangeToAdd(version, vpnId)) {
- neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(),
- version, true);
- }
- if (version.isIpVersionChosen(IpVersionChoice.IPV4)) {
+ IpVersionChoice ipVersion = IpVersionChoice.UNDEFINED;
+ for (FixedIps portIP : routerPort.nonnullFixedIps()) {
+ String ipValue = portIP.getIpAddress().stringValue();
+ ipVersion = NeutronvpnUtils.getIpVersionFromString(ipValue);
+ if (ipVersion.isIpVersionChosen(IpVersionChoice.IPV4)) {
nvpnManager.addSubnetToVpn(vpnId, portIP.getSubnetId(),
null /* internet-vpn-id */);
} else {
ipValue, routerPort.getMacAddress(),
routerPort.getUuid().getValue(), vpnId.getValue());
}
+ if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChange(ipVersion, routerId, true)) {
+ LOG.debug("vpnInstanceOpDataEntry is getting update with ip address family {} for VPN {}",
+ ipVersion, vpnId.getValue());
+ neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(), ipVersion, true);
+ }
nvpnManager.addToNeutronRouterInterfacesMap(routerId, routerPort.getUuid().getValue());
- nvpnNatManager.handleSubnetsForExternalRouter(routerId);
+ jobCoordinator.enqueueJob(routerId.toString(), () -> {
+ nvpnNatManager.handleSubnetsForExternalRouter(routerId);
+ return Collections.emptyList();
+ });
ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
confTx -> {
String portInterfaceName = createOfPortInterface(routerPort, confTx);
Uuid routerId = new Uuid(routerPort.getDeviceId());
Uuid infNetworkId = routerPort.getNetworkId();
elanService.removeKnownL3DmacAddress(routerPort.getMacAddress().getValue(), infNetworkId.getValue());
- Uuid vpnId = ObjectUtils.defaultIfNull(neutronvpnUtils.getVpnForRouter(routerId, true), routerId);
- List<FixedIps> portIps = routerPort.getFixedIps();
+ Uuid vpnId = ObjectUtils.defaultIfNull(neutronvpnUtils.getVpnForRouter(routerId, true),
+ routerId);
+ List<FixedIps> portIps = routerPort.nonnullFixedIps();
boolean vpnInstanceInternetIpVersionRemoved = false;
Uuid vpnInstanceInternetUuid = null;
for (FixedIps portIP : portIps) {
* cleanup of router interface flows*/
nvpnManager.deleteVpnInterface(routerPort.getUuid().getValue(),
null /* vpn-id */, null /* wrtConfigTxn*/);
+ final Uuid internetVpnId = vpnInstanceInternetUuid;
// update RouterInterfaces map
ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
confTx -> {
- boolean vpnInstanceIpVersionRemoved = false;
- IpVersionChoice vpnInstanceIpVersionToRemove = IpVersionChoice.UNDEFINED;
+ IpVersionChoice ipVersion = IpVersionChoice.UNDEFINED;
for (FixedIps portIP : portIps) {
Subnetmap sn = neutronvpnUtils.getSubnetmap(portIP.getSubnetId());
// router Port have either IPv4 or IPv6, never both
- if (neutronvpnUtils.shouldVpnHandleIpVersionChangeToRemove(sn, vpnId)) {
- vpnInstanceIpVersionRemoved = true;
- vpnInstanceIpVersionToRemove = neutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
- }
- String ipValue = String.valueOf(portIP.getIpAddress().getValue());
+ ipVersion = neutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
+ String ipValue = portIP.getIpAddress().stringValue();
neutronvpnUtils.removeVpnPortFixedIpToPort(vpnId.getValue(), ipValue, confTx);
// NOTE: Please donot change the order of calls to removeSubnetFromVpn and
// and updateSubnetNodeWithFixedIP
- nvpnManager.removeSubnetFromVpn(vpnId, portIP.getSubnetId(),
- sn != null ? sn.getInternetVpnId() : null);
+ nvpnManager.removeSubnetFromVpn(vpnId, portIP.getSubnetId(), internetVpnId);
nvpnManager.updateSubnetNodeWithFixedIp(portIP.getSubnetId(), null, null,
null, null, null);
}
nvpnManager.removeFromNeutronRouterInterfacesMap(routerId, routerPort.getUuid().getValue());
deleteElanInterface(routerPort.getUuid().getValue(), confTx);
deleteOfPortInterface(routerPort, confTx);
- nvpnNatManager.handleSubnetsForExternalRouter(routerId);
- if (vpnInstanceIpVersionRemoved) {
- neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(), vpnInstanceIpVersionToRemove,
- false);
+ jobCoordinator.enqueueJob(routerId.toString(), () -> {
+ nvpnNatManager.handleSubnetsForExternalRouter(routerId);
+ return Collections.emptyList();
+ });
+ if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChange(ipVersion, routerId, false)) {
+ LOG.debug("vpnInstanceOpDataEntry is getting update with ip address family {} for VPN {}",
+ ipVersion, vpnId.getValue());
+ neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(), ipVersion, false);
}
}), LOG, "Error handling interface removal");
if (vpnInstanceInternetIpVersionRemoved) {
neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnInstanceInternetUuid.getValue(),
IpVersionChoice.IPV6, false);
- neutronvpnUtils.updateVpnInstanceWithFallback(vpnInstanceInternetUuid.getValue(), false);
+ neutronvpnUtils.updateVpnInstanceWithFallback(routerId, vpnInstanceInternetUuid, false);
}
}
}
- private void handleRouterGatewayUpdated(Port routerGwPort) {
+ private void handleRouterGatewayUpdated(Port routerGwPort, boolean isRtrGwRemoved) {
Uuid routerId = new Uuid(routerGwPort.getDeviceId());
Uuid networkId = routerGwPort.getNetworkId();
Network network = neutronvpnUtils.getNeutronNetwork(networkId);
if (network == null) {
return;
}
- boolean isExternal = neutronvpnUtils.getIsExternal(network);
+ boolean isExternal = NeutronvpnUtils.getIsExternal(network);
if (isExternal) {
Uuid vpnInternetId = neutronvpnUtils.getVpnForNetwork(networkId);
if (vpnInternetId != null) {
+ if (!isRtrGwRemoved) {
+ nvpnManager.updateVpnMaps(vpnInternetId, null, routerId, null, null);
+ }
List<Subnetmap> snList = neutronvpnUtils.getNeutronRouterSubnetMaps(routerId);
for (Subnetmap sn : snList) {
if (sn.getNetworkId() == networkId) {
continue;
}
- if (neutronvpnUtils.getIpVersionFromString(sn.getSubnetIp()) != IpVersionChoice.IPV6) {
+ if (NeutronvpnUtils.getIpVersionFromString(sn.getSubnetIp()) != IpVersionChoice.IPV6) {
continue;
}
- nvpnManager.addSubnetToVpn(null, sn.getId(), vpnInternetId);
+ if (isRtrGwRemoved) {
+ nvpnManager.removeV6PrivateSubnetToExtNetwork(routerId, vpnInternetId, sn);
+ } else {
+ nvpnManager.addV6PrivateSubnetToExtNetwork(routerId, vpnInternetId, sn);
+ }
+ }
+ //Update Internet BGP-VPN
+ if (isRtrGwRemoved) {
+ nvpnManager.updateVpnMaps(vpnInternetId, null, null, null, null);
}
}
}
private void setupGwMac(Router router, Port routerGwPort, Uuid routerId) {
gwMacResolver.sendArpRequestsToExtGateways(router);
- setExternalGwMac(routerGwPort, routerId);
-
+ jobCoordinator.enqueueJob(routerId.toString(), () -> {
+ setExternalGwMac(routerGwPort, routerId);
+ return Collections.emptyList();
+ });
}
private void setExternalGwMac(Port routerGwPort, Uuid routerId) {
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, routersId, builder.build());
}
+ @Nullable
private String getPortHostId(final Port port) {
if (port != null) {
PortBindingExtension portBinding = port.augmentation(PortBindingExtension.class);
return null;
}
+ @Nullable
private Hostconfig getHostConfig(final Port port) {
String hostId = getPortHostId(port);
if (hostId == null) {
LOG.error("failed to read host config from host {}", hostId, e);
return null;
}
- return hostConfig.isPresent() ? hostConfig.get() : null;
+ return hostConfig.orNull();
}
private boolean isPortBound(final Port port) {
return false;
}
String vnicType = portBinding.getVnicType().trim().toLowerCase(Locale.getDefault());
- return vnicType.equals(NeutronConstants.VNIC_TYPE_DIRECT);
+ return NeutronConstants.VNIC_TYPE_DIRECT.equals(vnicType);
}
private boolean isSupportedVnicTypeByHost(final Port port, final String vnicType) {
return false;
}
+ @Nullable
private Map<String, JsonElement> unmarshal(final String profile) {
if (null == profile) {
return null;
}
Gson gson = new Gson();
JsonObject jsonObject = gson.fromJson(profile, JsonObject.class);
- Map<String, JsonElement> map = new HashMap();
+ Map<String, JsonElement> map = new HashMap<>();
for (Map.Entry<String, JsonElement> entry : jsonObject.entrySet()) {
map.put(entry.getKey(), entry.getValue());
}
private void handleNeutronPortCreated(final Port port) {
final String portName = port.getUuid().getValue();
final Uuid portId = port.getUuid();
- final List<FixedIps> portIpAddrsList = port.getFixedIps();
+ final List<FixedIps> portIpAddrsList = port.nonnullFixedIps();
if (NeutronConstants.IS_ODL_DHCP_PORT.test(port)) {
return;
}
jobCoordinator.enqueueJob("PORT- " + portName, () -> {
// add direct port to subnetMaps config DS
if (!(NeutronUtils.isPortVnicTypeNormal(port)
- || (isPortTypeSwitchdev(port)
- && isSupportedVnicTypeByHost(port, NeutronConstants.VNIC_TYPE_DIRECT)))) {
+ || isPortTypeSwitchdev(port)
+ && isSupportedVnicTypeByHost(port, NeutronConstants.VNIC_TYPE_DIRECT))) {
for (FixedIps ip: portIpAddrsList) {
nvpnManager.updateSubnetmapNodeWithPorts(ip.getSubnetId(), null, portId);
}
private void handleNeutronPortDeleted(final Port port) {
final String portName = port.getUuid().getValue();
final Uuid portId = port.getUuid();
- final List<FixedIps> portIpsList = port.getFixedIps();
+ final List<FixedIps> portIpsList = port.nonnullFixedIps();
jobCoordinator.enqueueJob("PORT- " + portName,
() -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> {
if (!(NeutronUtils.isPortVnicTypeNormal(port) || isPortTypeSwitchdev(port))) {
if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(port.getDeviceOwner())
|| NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(port.getDeviceOwner())) {
- String ipAddress = String.valueOf(ip.getIpAddress().getValue());
+ String ipAddress = ip.getIpAddress().stringValue();
if (vpnId != null) {
neutronvpnUtils.removeVpnPortFixedIpToPort(vpnId.getValue(), ipAddress, confTx);
}
+ "during subnet deletion event.", portupdate.getUuid().getValue());
return;
}
+
+ if (NeutronConstants.IS_ODL_DHCP_PORT.test(portupdate)) {
+ return;
+ }
+
jobCoordinator.enqueueJob("PORT- " + portupdate.getUuid().getValue(),
() -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> {
final List<Uuid> originalSnMapsIds = portoriginalIps.stream().map(FixedIps::getSubnetId)
}
}
}
- Set<Uuid> newVpnIds = new HashSet();
+ Set<Uuid> newVpnIds = new HashSet<>();
Set<Uuid> newRouterIds = new HashSet<>();
for (Uuid snId: updateSnMapsIds) {
Subnetmap subnetMapNew = nvpnManager.updateSubnetmapNodeWithPorts(snId, portupdate.getUuid(), null);
})));
}
+ @Nullable
private InterfaceAclBuilder handlePortSecurityUpdated(Port portOriginal,
Port portUpdated, boolean origSecurityEnabled, boolean updatedSecurityEnabled,
InterfaceBuilder interfaceBuilder) {
interfaceAclBuilder.setPortSecurityEnabled(updatedSecurityEnabled);
if (updatedSecurityEnabled) {
// Handle security group enabled
- NeutronvpnUtils.populateInterfaceAclBuilder(interfaceAclBuilder, portUpdated);
- neutronvpnUtils.populateSubnetInfo(portUpdated);
+ neutronvpnUtils.populateInterfaceAclBuilder(interfaceAclBuilder, portUpdated);
} else {
// Handle security group disabled
interfaceAclBuilder.setSecurityGroups(new ArrayList<>());
interfaceAclBuilder.setAllowedAddressPairs(new ArrayList<>());
+ interfaceAclBuilder.setSubnetInfo(new ArrayList<>());
}
} else {
if (updatedSecurityEnabled) {
if (portOriginal.getFixedIps() != null
&& !portOriginal.getFixedIps().equals(portUpdated.getFixedIps())) {
- neutronvpnUtils.populateSubnetInfo(portUpdated);
+ neutronvpnUtils.populateSubnetInfo(interfaceAclBuilder, portUpdated);
}
}
}
Boolean isVlanTransparent = network.isVlanTransparent();
if (isVlanTransparent != null && isVlanTransparent) {
l2VlanMode = IfL2vlan.L2vlanMode.Transparent;
+ } else {
+ PortIdToSubport portIdToSubport = neutronvpnUtils.getPortIdToSubport(port.getUuid());
+ if (portIdToSubport != null) {
+ l2VlanMode = IfL2vlan.L2vlanMode.TrunkMember;
+ ifL2vlanBuilder.setVlanId(new VlanId(portIdToSubport.getVlanId().intValue()));
+ String parentRefName = portIdToSubport.getTrunkPortId().getValue();
+ ParentRefsBuilder parentRefsBuilder = new ParentRefsBuilder().setParentInterface(parentRefName);
+ interfaceBuilder.addAugmentation(ParentRefs.class, parentRefsBuilder.build());
+ SplitHorizon splitHorizon =
+ new SplitHorizonBuilder().setOverrideSplitHorizonProtection(true).build();
+ interfaceBuilder.addAugmentation(SplitHorizon.class, splitHorizon);
+ }
}
ifL2vlanBuilder.setL2vlanMode(l2VlanMode);
if (NeutronvpnUtils.getPortSecurityEnabled(port)) {
InterfaceAclBuilder interfaceAclBuilder = new InterfaceAclBuilder();
interfaceAclBuilder.setPortSecurityEnabled(true);
- NeutronvpnUtils.populateInterfaceAclBuilder(interfaceAclBuilder, port);
+ neutronvpnUtils.populateInterfaceAclBuilder(interfaceAclBuilder, port);
interfaceBuilder.addAugmentation(InterfaceAcl.class, interfaceAclBuilder.build());
- neutronvpnUtils.populateSubnetInfo(port);
+ } else if (neutronvpnConfig.isLimitBumtrafficToDhcpserver() && NeutronvpnUtils.isDhcpServerPort(port)) {
+ interfaceBuilder.addAugmentation(InterfaceAcl.class, neutronvpnUtils.getDhcpInterfaceAcl(port));
}
return interfaceBuilder.build();
}