Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change vim_images from a set to a list in order to maintain the order… #274

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions catalogue/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ apply from: '../gradle/gradle/nexus.upload.plugin.gradle'
dependencies {
compile 'org.springframework.boot:spring-boot-starter-security:'+ springBootVersion
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.2.Final'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.0.12.Final'

compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.6'
compile 'org.hibernate:hibernate-validator:5.3.5.Final'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.openbaton.catalogue.mano.descriptor;

import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.ElementCollection;
Expand All @@ -24,6 +25,8 @@
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.validation.constraints.Min;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.openbaton.catalogue.mano.common.HighAvailability;
import org.openbaton.catalogue.mano.common.LifecycleEvent;
import org.openbaton.catalogue.mano.common.faultmanagement.FaultManagementPolicy;
Expand All @@ -46,7 +49,8 @@ public class VirtualDeploymentUnit extends BaseEntity {
* virtualisation containers as per (ETSI GS NFV-SWA 001 [i.8]).
*/
@ElementCollection(fetch = FetchType.EAGER)
private Set<String> vm_image;
@Fetch(FetchMode.SELECT)
private List<String> vm_image;
/** Reference to the VDU (vnfd:vdu:id) used to instantiate this element. */
private String parent_vdu;
/**
Expand Down Expand Up @@ -126,11 +130,11 @@ public void setVnfc_instance(Set<VNFCInstance> vnfc_instance) {
this.vnfc_instance = vnfc_instance;
}

public Set<String> getVm_image() {
public List<String> getVm_image() {
return vm_image;
}

public void setVm_image(Set<String> vm_image) {
public void setVm_image(List<String> vm_image) {
this.vm_image = vm_image;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public BaseNfvImage handleImage(
image = vim.add(vimInstance, image, imageFile);
}
if (vdu.getVm_image() == null) {
vdu.setVm_image(new LinkedHashSet<>());
vdu.setVm_image(new ArrayList<>());
}
vdu.getVm_image().add(image.getExtId());
vimInstance = vimManagement.refresh(vimInstance, true).get();
Expand All @@ -629,7 +629,7 @@ public BaseNfvImage handleImage(
.forEach(
virtualDeploymentUnit -> {
if (virtualDeploymentUnit.getVm_image() == null) {
virtualDeploymentUnit.setVm_image(new LinkedHashSet<>());
virtualDeploymentUnit.setVm_image(new ArrayList<>());
}
if (ids != null) virtualDeploymentUnit.getVm_image().addAll(ids);
if (names != null) virtualDeploymentUnit.getVm_image().addAll(names);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ private VirtualNetworkFunctionDescriptor createVirtualNetworkFunctionDescriptor(
{
VirtualDeploymentUnit vdu = new VirtualDeploymentUnit();
vdu.setVm_image(
new LinkedHashSet<String>() {
new ArrayList<String>() {
{
add("mocked_image");
}
Expand Down Expand Up @@ -560,7 +560,7 @@ private NetworkServiceRecord createNetworkServiceRecord() {
highAvailability.setResiliencyLevel(ResiliencyLevel.ACTIVE_STANDBY_STATELESS);
vdu.setHigh_availability(highAvailability);
vdu.setVm_image(
new LinkedHashSet<String>() {
new ArrayList<String>() {
{
add("mocked_image");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.openbaton.nfvo.core.test.TestUtils.createMinQuota;
import static org.openbaton.nfvo.core.test.TestUtils.createVimInstance;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
Expand Down Expand Up @@ -126,7 +127,7 @@ private VirtualDeploymentUnit createVDU(int suffix, BaseVimInstance vimInstance)
highAvailability.setResiliencyLevel(ResiliencyLevel.ACTIVE_STANDBY_STATELESS);
vdu.setHigh_availability(highAvailability);
vdu.setVm_image(
new HashSet<String>() {
new ArrayList<String>() {
{
add("mocked_image");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@

package org.openbaton.tosca.templates.TopologyTemplate.Nodes.VDU;

import java.util.LinkedHashSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.openbaton.tosca.templates.TopologyTemplate.Nodes.NodeTemplate;

@SuppressWarnings({"unsafe", "unchecked"})
public class VDUNodeTemplate {

private String type;
private String name;
private Set<String> artifacts = new LinkedHashSet<>();
private List<String> artifacts = new ArrayList<>();
private VDUProperties properties;

public VDUNodeTemplate(NodeTemplate nodeTemplate, String name) {
Expand Down Expand Up @@ -61,11 +61,11 @@ public void setType(String type) {
this.type = type;
}

public Set<String> getArtifacts() {
public List<String> getArtifacts() {
return artifacts;
}

public void setArtifacts(LinkedHashSet<String> vduArtifact) {
public void setArtifacts(ArrayList<String> vduArtifact) {
this.artifacts = vduArtifact;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
Expand Down Expand Up @@ -224,7 +225,7 @@ private VirtualDeploymentUnit createVDU() {
monitoring_parameter.add("parameter_3");
vdu.setMonitoring_parameter(monitoring_parameter);
vdu.setComputation_requirement("m1.small");
Set<String> vm_images = new LinkedHashSet<>();
List<String> vm_images = new ArrayList<>();
vm_images.add("image_1234");
vdu.setVm_image(vm_images);
vimInstance.setFlavours(new HashSet<>());
Expand Down