Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
97bd2f3
New feature: VNF templates and appliances integration
weizhouapache Sep 29, 2023
82aa44c
VNF: fix pre-commit lint
weizhouapache Sep 29, 2023
047b5da
VNF: add management property to VNF template nics
weizhouapache Oct 2, 2023
100307e
VNF: changes as per Daan's comments
weizhouapache Oct 2, 2023
b2038f7
VNF: add unit tests
weizhouapache Oct 3, 2023
ae2177a
VNF: add more unit tests
weizhouapache Oct 3, 2023
61384b3
VNF/UI: fix apiName when register VNF template
weizhouapache Oct 3, 2023
c56ef00
VNF/UI: fix cannot update VNF details
weizhouapache Oct 3, 2023
d23424b
VNF: add more unit tests v2
weizhouapache Oct 3, 2023
f8434b0
VNF: move static methods to VnfTemplateUtils
weizhouapache Oct 3, 2023
cbb2e0e
VNF: add unit test VNFTest
weizhouapache Oct 3, 2023
2c3bfb3
VNF/UI: update ui/src/views/compute/DeployVnfAppliance.vue
weizhouapache Oct 3, 2023
93665a8
VNF/UI: fix ui/src/views/compute/DeployVnfAppliance.vue
weizhouapache Oct 3, 2023
d32fc4a
VNF: refactor VnfTemplateUtilsTest
weizhouapache Oct 4, 2023
2be32ac
VNF: changes as per Daan's comments v2
weizhouapache Oct 4, 2023
4f54cbd
VNF: change VNF.java from interface to class
weizhouapache Oct 4, 2023
950b6eb
Merge remote-tracking branch 'apache/main' into 4.19-vnf
weizhouapache Oct 4, 2023
cef7f4d
VNF: refactor test_vnf_templates.py
weizhouapache Oct 4, 2023
275374c
Merge remote-tracking branch 'apache/main' into 4.19-vnf
weizhouapache Oct 6, 2023
0c10626
VNF: ui polish part1
weizhouapache Oct 6, 2023
17425e8
Merge remote-tracking branch 'apache/main' into 4.19-vnf
weizhouapache Oct 6, 2023
f4e760a
VNF: api/ui polish part2
weizhouapache Oct 9, 2023
f7800dc
Merge remote-tracking branch 'apache/main' into 4.19-vnf
weizhouapache Oct 11, 2023
0ed5089
VNF: add cleanupnics to updateVnfTemplateCmd
weizhouapache Oct 11, 2023
a74b125
VNF/UI: hide 'Create Network' butthon when deploy VNF appliance
weizhouapache Oct 11, 2023
bb4d0d1
VNF/UI: hide 'Data disk' section if template type is VNF
weizhouapache Oct 11, 2023
358b64a
VNF/UI: Do not list VNF appliances in Compute->Instances view
weizhouapache Oct 11, 2023
8d8118d
VNF/UI: copy to 'VNF appliances'
weizhouapache Oct 11, 2023
12fe824
VNF/UI: copy to 'VNF templates'
weizhouapache Oct 11, 2023
ae606c2
VNF/UI: enable quick view for VNF appliances
weizhouapache Oct 11, 2023
5338be9
VNF/UI: enable group action for VNF appliances
weizhouapache Oct 11, 2023
f4158dc
VNF/UI: enable quick view for VNF templates
weizhouapache Oct 11, 2023
bc94a91
VNF/UI: fix access info is not displayed
weizhouapache Oct 12, 2023
965eace
VNF/UI: fix the first network is not selectable
weizhouapache Oct 12, 2023
01d21b8
VNF/UI: minor ui fixes
weizhouapache Oct 12, 2023
4c74f40
VNF/UI: ui polish part3
weizhouapache Oct 12, 2023
61e55ae
VNF: add 'VNF appliances' tab to network/vpc
weizhouapache Oct 12, 2023
88c81a5
VNF: create SG or SNAT/FW for ssh/http/https ports
weizhouapache Oct 12, 2023
13a1450
VNF: mask the passwords with asterisk on UI
weizhouapache Oct 13, 2023
39aedaf
VNF: fix empty FW rules if empty vnfcidrlist is passed
weizhouapache Oct 13, 2023
80c9a05
VNF/UI: remove 'Network->VNF templates' section
weizhouapache Oct 13, 2023
1f446b6
VNF/UI: fix 'View Console' and 'Copy console URL' icons are not displ…
weizhouapache Oct 13, 2023
9a3dc8b
VNF/UI: change the label of actions in the VNF appliance details page
weizhouapache Oct 13, 2023
f11a978
VNF: add public ip to nic response and display public ip if nic is ma…
weizhouapache Oct 13, 2023
21c2e30
VNF/UI: display the default passwords in notification area
weizhouapache Oct 16, 2023
0f0d833
VNF: add unit tests in VnfTemplateUtilsTest
weizhouapache Oct 16, 2023
087bf14
VNF: Configure network rules if management is Isolated networks or Sh…
weizhouapache Oct 17, 2023
b52498f
Merge remote-tracking branch 'apache/main' into 4.19-vnf
weizhouapache Oct 17, 2023
6d024b8
VNF: minor changes on UI
weizhouapache Oct 17, 2023
db044bd
VNF: update unit tests in api
weizhouapache Oct 18, 2023
7fb7c70
VNF: add unit tests in server
weizhouapache Oct 18, 2023
870792d
VNF: fix NPE if security group ids/names are empty
weizhouapache Oct 19, 2023
7d64bdc
VNF: fix 'Advanced mode' in vm deployment wizard
weizhouapache Oct 20, 2023
680c01c
Merge remote-tracking branch 'apache/main' into 4.19-vnf
weizhouapache Oct 20, 2023
a0e29dc
Merge remote-tracking branch 'apache/main' into 4.19-vnf
weizhouapache Oct 20, 2023
e45c22b
Merge remote-tracking branch 'apache/main' into 4.19-vnf
weizhouapache Oct 23, 2023
b69e02c
Merge remote-tracking branch 'apache/main' into 4.19-vnf and refactor…
weizhouapache Oct 26, 2023
cf562c4
Apply PR8150 to fix build errors
weizhouapache Oct 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions api/src/main/java/com/cloud/network/VNF.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.network;

import org.apache.commons.lang3.StringUtils;

public class VNF {

public enum AccessMethod {
SSH_WITH_PASSWORD("ssh-password"),
SSH_WITH_KEY("ssh-key"),
HTTP("http"),
HTTPS("https"),
CONSOLE("console");

String _method;

AccessMethod(String method) {
_method = method;
}

@Override
public String toString() {
return _method;
}

public static AccessMethod fromValue(String method) {
if (StringUtils.isBlank(method)) {
return null;
} else {
for (AccessMethod accessMethod : AccessMethod.values()) {
if (accessMethod.toString().equalsIgnoreCase(method)) {
return accessMethod;
}
}
}
return null;
}
}

public enum AccessDetail {
ACCESS_METHODS,
USERNAME,
PASSWORD,
SSH_USER,
SSH_PASSWORD,
SSH_PORT,
WEB_USER,
WEB_PASSWORD,
HTTP_PATH,
HTTP_PORT,
HTTPS_PATH,
HTTPS_PORT
}

public enum VnfDetail {
ICON,
VERSION,
VENDOR,
MAINTAINER
}

public static class VnfNic {
long deviceId;
String name;
boolean required;
boolean management;
String description;

public VnfNic(long deviceId, String nicName, boolean required, boolean management, String nicDescription) {
this.deviceId = deviceId;
this.name = nicName;
this.required = required;
this.management = management;
this.description = nicDescription;
}

public long getDeviceId() {
return deviceId;
}

public String getName() {
return name;
}

public boolean isRequired() {
return required;
}

public boolean isManagement() {
return management;
}

public String getDescription() {
return description;
}
}
}
1 change: 1 addition & 0 deletions api/src/main/java/com/cloud/server/ResourceTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
public enum ResourceObjectType {
UserVm(true, true, true),
Template(true, true, true),
VnfTemplate(true, true, true),
ISO(true, false, true),
Volume(true, true),
Snapshot(true, false),
Expand Down
1 change: 1 addition & 0 deletions api/src/main/java/com/cloud/storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public static enum TemplateType {
BUILTIN, /* buildin template */
PERHOST, /* every host has this template, don't need to install it in secondary storage */
USER, /* User supplied template/iso */
VNF, /* VNFs (virtual network functions) template */
DATADISK, /* Template corresponding to a datadisk(non root disk) present in an OVA */
ISODISK /* Template corresponding to a iso (non root disk) present in an OVA */
}
Expand Down
13 changes: 11 additions & 2 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ public class ApiConstants {
public static final String TEMPLATE_ID = "templateid";
public static final String TEMPLATE_IDS = "templateids";
public static final String TEMPLATE_NAME = "templatename";
public static final String TEMPLATE_TYPE = "templatetype";
public static final String TIMEOUT = "timeout";
public static final String TIMEZONE = "timezone";
public static final String TIMEZONEOFFSET = "timezoneoffset";
Expand Down Expand Up @@ -1013,7 +1014,6 @@ public class ApiConstants {
public static final String DEPLOY_AS_IS = "deployasis";
public static final String DEPLOY_AS_IS_DETAILS = "deployasisdetails";
public static final String CROSS_ZONES = "crossZones";
public static final String TEMPLATETYPE = "templatetype";
public static final String SOURCETEMPLATEID = "sourcetemplateid";
public static final String DYNAMIC_SCALING_ENABLED = "dynamicscalingenabled";
public static final String IOTHREADS_ENABLED = "iothreadsenabled";
Expand Down Expand Up @@ -1047,6 +1047,15 @@ public class ApiConstants {
public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid";
public static final String HAS_RULES = "hasrules";

public static final String MANAGEMENT = "management";
public static final String IS_VNF = "isvnf";
public static final String VNF_NICS = "vnfnics";
public static final String VNF_DETAILS = "vnfdetails";
public static final String CLEAN_UP_VNF_DETAILS = "cleanupvnfdetails";
public static final String CLEAN_UP_VNF_NICS = "cleanupvnfnics";
public static final String VNF_CONFIGURE_MANAGEMENT = "vnfconfiguremanagement";
public static final String VNF_CIDR_LIST = "vnfcidrlist";

/**
* This enum specifies IO Drivers, each option controls specific policies on I/O.
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).
Expand Down Expand Up @@ -1092,7 +1101,7 @@ public enum HostDetails {
}

public enum VMDetails {
all, group, nics, stats, secgrp, tmpl, servoff, diskoff, backoff, iso, volume, min, affgrp;
all, group, nics, stats, secgrp, tmpl, servoff, diskoff, backoff, iso, volume, min, affgrp, vnfnics;
}

public enum DomainDetails {
Expand Down
3 changes: 3 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/BaseCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
import org.apache.cloudstack.query.QueryService;
import org.apache.cloudstack.storage.ImageStoreService;
import org.apache.cloudstack.storage.template.VnfTemplateManager;
import org.apache.cloudstack.usage.UsageService;
import org.apache.commons.collections.MapUtils;
import org.apache.log4j.Logger;
Expand Down Expand Up @@ -213,6 +214,8 @@ public static enum CommandType {
public ResourceIconManager resourceIconManager;
@Inject
public Ipv6Service ipv6Service;
@Inject
public VnfTemplateManager vnfTemplateManager;

public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException, NetworkRuleConflictException;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.template;

import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.command.admin.AdminCmd;
import org.apache.cloudstack.api.command.user.template.ListVnfTemplatesCmd;
import org.apache.cloudstack.api.response.TemplateResponse;

import com.cloud.template.VirtualMachineTemplate;

@APICommand(name = "listVnfTemplates", description = "List all public, private, and privileged VNF templates.",
responseObject = TemplateResponse.class, entityType = {VirtualMachineTemplate.class}, responseView = ResponseView.Full,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
since = "4.19.0")
public class ListVnfTemplatesCmdByAdmin extends ListVnfTemplatesCmd implements AdminCmd {
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.command.admin.AdminCmd;
import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd;
import org.apache.cloudstack.api.response.TemplateResponse;

@APICommand(name = "registerTemplate", description = "Registers an existing template into the CloudStack cloud.", responseObject = TemplateResponse.class, responseView = ResponseView.Full,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class RegisterTemplateCmdByAdmin extends RegisterTemplateCmd {}
public class RegisterTemplateCmdByAdmin extends RegisterTemplateCmd implements AdminCmd {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.template;

import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.command.admin.AdminCmd;
import org.apache.cloudstack.api.command.user.template.RegisterVnfTemplateCmd;
import org.apache.cloudstack.api.response.TemplateResponse;

@APICommand(name = "registerVnfTemplate",
description = "Registers an existing VNF template into the CloudStack cloud. ",
responseObject = TemplateResponse.class, responseView = ResponseView.Full,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
since = "4.19.0")
public class RegisterVnfTemplateCmdByAdmin extends RegisterVnfTemplateCmd implements AdminCmd {
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@

@APICommand(name = "updateTemplate", description = "Updates attributes of a template.", responseObject = TemplateResponse.class, responseView = ResponseView.Full,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateTemplateCmdByAdmin extends UpdateTemplateCmd implements AdminCmd {}
public class UpdateTemplateCmdByAdmin extends UpdateTemplateCmd implements AdminCmd {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.template;

import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.command.admin.AdminCmd;
import org.apache.cloudstack.api.command.user.template.UpdateVnfTemplateCmd;
import org.apache.cloudstack.api.response.TemplateResponse;

@APICommand(name = "updateVnfTemplate",
description = "Updates a template to VNF template or attributes of a VNF template.",
responseObject = TemplateResponse.class, responseView = ResponseView.Full,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
since = "4.19.0")
public class UpdateVnfTemplateCmdByAdmin extends UpdateVnfTemplateCmd implements AdminCmd {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.vm;

import com.cloud.vm.VirtualMachine;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ResponseObject;
import org.apache.cloudstack.api.command.admin.AdminCmd;
import org.apache.cloudstack.api.command.user.vm.DeployVnfApplianceCmd;
import org.apache.cloudstack.api.response.UserVmResponse;

@APICommand(name = "deployVnfAppliance",
description = "Creates and automatically starts a VNF appliance based on a service offering, disk offering, and template.",
responseObject = UserVmResponse.class,
responseView = ResponseObject.ResponseView.Full,
entityType = {VirtualMachine.class},
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true,
since = "4.19.0")
public class DeployVnfApplianceCmdByAdmin extends DeployVnfApplianceCmd implements AdminCmd {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.user.template;

import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.response.SuccessResponse;

import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;

@APICommand(name = "deleteVnfTemplate",
responseObject = SuccessResponse.class,
description = "Deletes a VNF template from the system. All virtual machines using the deleted template will not be affected.",
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User},
since = "4.19.0")
public class DeleteVnfTemplateCmd extends DeleteTemplateCmd {

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

@Override
public long getEntityOwnerId() {
VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId());
if (template != null) {
return template.getAccountId();
}

return Account.ACCOUNT_ID_SYSTEM;
}
}
Loading