diff options
author | Smokowski, Steven <steve.smokowski@att.com> | 2020-11-03 12:02:42 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-11-03 12:45:27 -0500 |
commit | 7acf11b5b9e2bb0a03c8735f43a0e969c45d06d7 (patch) | |
tree | 41006ca9be15e9da8915804a806c4dcaadd90071 /adapters/mso-openstack-adapters/src/main | |
parent | 83ff479029986df8326e3119d3ee31f77209c455 (diff) |
us mso workaround to skip shared vip ports
Update to filter out cases where ports have no server
Issue-ID: SO-3359
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I7400abde420db754716906d7f3a6954734435495
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index 1264727f35..baef24cbc8 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -48,6 +48,7 @@ import javax.ws.rs.NotFoundException; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.UriBuilder; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.validator.routines.InetAddressValidator; import org.onap.aai.domain.yang.Flavor; import org.onap.aai.domain.yang.Image; @@ -357,44 +358,47 @@ public class HeatBridgeImpl implements HeatBridgeApi { boolean isL2Multicast = false; Port port = osClient.getPortById(portId); Network network = osClient.getNetworkById(port.getNetworkId()); - LInterface lIf = new LInterface(); - lIf.setInterfaceId(port.getId()); - lIf.setInterfaceName(port.getName()); - lIf.setMacaddr(port.getMacAddress()); - lIf.setNetworkName(network.getName()); - lIf.setIsPortMirrored(false); - lIf.setIsIpUnnumbered(false); - lIf.setInMaint(false); - - if (port.getProfile() != null && port.getProfile().get("trusted") != null) { - String trusted = port.getProfile().get("trusted").toString(); - if (Boolean.parseBoolean(trusted)) { - isL2Multicast = true; + if (!StringUtils.isEmpty(port.getDeviceId())) { + LInterface lIf = new LInterface(); + lIf.setInterfaceId(port.getId()); + lIf.setInterfaceName(port.getName()); + lIf.setMacaddr(port.getMacAddress()); + lIf.setNetworkName(network.getName()); + lIf.setIsPortMirrored(false); + lIf.setIsIpUnnumbered(false); + lIf.setInMaint(false); + + if (port.getProfile() != null && port.getProfile().get("trusted") != null) { + String trusted = port.getProfile().get("trusted").toString(); + if (Boolean.parseBoolean(trusted)) { + isL2Multicast = true; + } } - } - lIf.setL2Multicasting(isL2Multicast); - lIf.setInterfaceType(getInterfaceType(nodeType, port.getvNicType())); - lIf.setRelationshipList(new RelationshipList()); + lIf.setL2Multicasting(isL2Multicast); + lIf.setInterfaceType(getInterfaceType(nodeType, port.getvNicType())); + lIf.setRelationshipList(new RelationshipList()); - if (oobMgtNetIds != null && oobMgtNetIds.contains(port.getNetworkId())) { - lIf.setInterfaceRole(OOB_MGT_NETWORK_IDENTIFIER); - } else { - lIf.setInterfaceRole(port.getvNicType()); - } + if (oobMgtNetIds != null && oobMgtNetIds.contains(port.getNetworkId())) { + lIf.setInterfaceRole(OOB_MGT_NETWORK_IDENTIFIER); + } else { + lIf.setInterfaceRole(port.getvNicType()); + } - // Update l-interface to the vserver - transaction.createIfNotExists( - AAIUriFactory.createResourceUri( - AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId) - .tenant(tenantId).vserver(port.getDeviceId()).lInterface(lIf.getInterfaceName())), - Optional.of(lIf)); + // Update l-interface to the vserver + transaction + .createIfNotExists( + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId) + .vserver(port.getDeviceId()).lInterface(lIf.getInterfaceName())), + Optional.of(lIf)); - updateLInterfaceIps(port, lIf); + updateLInterfaceIps(port, lIf); - if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) { - Server server = getOpenstackServerById(port.getDeviceId()); - createVlanAndSriovVF(port, lIf, server.getHypervisorHostname()); - updateSriovPfToSriovVF(port, lIf); + if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) { + Server server = getOpenstackServerById(port.getDeviceId()); + createVlanAndSriovVF(port, lIf, server.getHypervisorHostname()); + updateSriovPfToSriovVF(port, lIf); + } } } } |