summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main/java/org/onap
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2020-11-07 07:08:03 +0000
committerGerrit Code Review <gerrit@onap.org>2020-11-07 07:08:03 +0000
commiteedbbd085151d477ab2ec77ee78b389178efa980 (patch)
tree36ffaa6c1ccb754fb7181da1add20d4aa4a4c7de /adapters/mso-openstack-adapters/src/main/java/org/onap
parentea82d794ac51faa699b9b84ea003a9242b8d4ccc (diff)
parent7acf11b5b9e2bb0a03c8735f43a0e969c45d06d7 (diff)
Merge "us mso workaround to skip shared vip ports"
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java/org/onap')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java70
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 8ee87b50c3..6b4dbe061e 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;
@@ -374,44 +375,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);
+ }
}
}
}