forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New feature: VNF templates and appliances integration
This feature introduce a new type of template in CloudStack: "VNF" It supports the life cycle of VNF templates: - register - update - list - delete It also supports the management of VNF templates and deployment of VNF appliances (from VNF templates) on GUI Design: https://cwiki.apache.org/confluence/display/CLOUDSTACK/VNF+Appliance+Integration
- Loading branch information
1 parent
a256604
commit 97bd2f3
Showing
62 changed files
with
6,536 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// 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 interface VNF { | ||
|
||
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; | ||
} | ||
} | ||
|
||
enum AccessDetail { | ||
ACCESS_METHODS, | ||
USERNAME, | ||
PASSWORD, | ||
SSH_USER, | ||
SSH_PASSWORD, | ||
SSH_PORT, | ||
WEB_USER, | ||
WEB_PASSWORD, | ||
HTTP_PATH, | ||
HTTP_PORT, | ||
HTTPS_PATH, | ||
HTTPS_PORT | ||
} | ||
|
||
enum VnfDetail { | ||
ICON, | ||
VERSION, | ||
VENDOR, | ||
MAINTAINER | ||
} | ||
|
||
class VnfNic { | ||
int deviceId; | ||
String name; | ||
boolean required; | ||
String description; | ||
|
||
public VnfNic(int deviceId, String nicName, boolean required, String nicDescription) { | ||
this.deviceId = deviceId; | ||
this.name = nicName; | ||
this.required = required; | ||
this.description = nicDescription; | ||
} | ||
|
||
public int getDeviceId() { | ||
return deviceId; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public boolean isRequired() { | ||
return required; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ain/java/org/apache/cloudstack/api/command/admin/template/ListVnfTemplatesCmdByAdmin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.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) | ||
public class ListVnfTemplatesCmdByAdmin extends ListVnfTemplatesCmd implements AdminCmd { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../java/org/apache/cloudstack/api/command/admin/template/RegisterVnfTemplateCmdByAdmin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 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) | ||
public class RegisterVnfTemplateCmdByAdmin extends RegisterVnfTemplateCmd implements AdminCmd { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...in/java/org/apache/cloudstack/api/command/admin/template/UpdateVnfTemplateCmdByAdmin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 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) | ||
public class UpdateVnfTemplateCmdByAdmin extends UpdateVnfTemplateCmd implements AdminCmd { | ||
} |
31 changes: 31 additions & 0 deletions
31
...rc/main/java/org/apache/cloudstack/api/command/admin/vm/DeployVnfApplianceCmdByAdmin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.vm; | ||
|
||
import com.cloud.vm.VirtualMachine; | ||
import org.apache.cloudstack.api.APICommand; | ||
import org.apache.cloudstack.api.ResponseObject; | ||
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) | ||
public class DeployVnfApplianceCmdByAdmin extends DeployVMCmdByAdmin { | ||
} |
46 changes: 46 additions & 0 deletions
46
api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteVnfTemplateCmd.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// 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}) | ||
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; | ||
} | ||
} |
Oops, something went wrong.