use of org.onap.so.cloud.resource.beans.NodeType in project so by onap.
the class HeatBridgeImpl method createVlanAndSriovVF.
protected void createVlanAndSriovVF(final Port port, final LInterface lIf, final String hostName) throws HeatBridgeException {
// add back all vlan logic
Vlan vlan = new Vlan();
Network network = osClient.getNetworkById(port.getNetworkId());
if (network.getNetworkType() != null && network.getNetworkType().equals(NetworkType.VLAN)) {
vlan.setVlanInterface(port.getName() + network.getProviderSegID());
vlan.setVlanIdOuter(Long.parseLong(network.getProviderSegID()));
vlan.setVlanIdInner(0L);
vlan.setInMaint(false);
vlan.setIsIpUnnumbered(false);
vlan.setIsPrivate(false);
transaction.createIfNotExists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId()).lInterface(lIf.getInterfaceName()).vlan(vlan.getVlanInterface())), Optional.of(vlan));
}
if (!lIf.getInterfaceType().equals(SRIOV)) {
if (nodeType == NodeType.GREENFIELD) {
validatePhysicalNetwork(port, network);
processOVS(lIf, hostName, NodeType.GREENFIELD.getInterfaceName());
} else {
processOVS(lIf, hostName, NodeType.BROWNFIELD.getInterfaceName());
}
}
List<String> privateVlans = (ArrayList<String>) port.getProfile().get(PRIVATE_VLANS);
List<String> publicVlans = (ArrayList<String>) port.getProfile().get(PUBLIC_VLANS);
List<String> vlans = null;
if (publicVlans != null && !publicVlans.isEmpty()) {
vlans = publicVlans.stream().filter(publicVlan -> !Strings.isNullOrEmpty(publicVlan)).collect(Collectors.toList());
} else {
vlans = new ArrayList<>();
}
if (privateVlans != null && !privateVlans.isEmpty()) {
List<String> temp = privateVlans.stream().filter(privateVlan -> !Strings.isNullOrEmpty(privateVlan)).collect(Collectors.toList());
vlans.addAll(temp);
}
vlans.stream().forEach(vlanLocal -> logger.debug("Vlan Id: {}", vlanLocal));
processVlanTag(lIf, vlans);
if (port.getvNicType() != null && port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
SriovVf sriovVf = new SriovVf();
sriovVf.setPciId(port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
sriovVf.setNeutronNetworkId(port.getNetworkId());
sriovVf.setVfVlanFilter("0");
sriovVf.setVfVlanAntiSpoofCheck(false);
sriovVf.setVfMacAntiSpoofCheck(false);
transaction.createIfNotExists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId()).lInterface(lIf.getInterfaceName()).sriovVf(sriovVf.getPciId())), Optional.of(sriovVf));
}
}
Aggregations