use of org.onap.aai.domain.yang.RelationshipList in project so by onap.
the class HeatBridgeImpl method buildAddVserverLInterfacesToAaiAction.
@Override
public void buildAddVserverLInterfacesToAaiAction(final List<Resource> stackResources, final List<String> oobMgtNetIds, String cloudOwner) throws HeatBridgeException {
Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
List<String> portIds = extractStackResourceIdsByResourceType(stackResources, HeatBridgeConstants.OS_PORT_RESOURCE_TYPE);
if (portIds == null)
return;
for (String portId : portIds) {
boolean isL2Multicast = false;
Port port = osClient.getPortById(portId);
Network network = osClient.getNetworkById(port.getNetworkId());
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());
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));
updateLInterfaceIps(port, lIf);
if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) {
Server server = getOpenstackServerById(port.getDeviceId());
createVlanAndSriovVF(port, lIf, server.getHypervisorHostname());
updateSriovPfToSriovVF(port, lIf);
}
}
}
}
Aggregations