aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-25 17:08:41 -0500
committerSmokowski, Steve (ss835w) <ss835w@us.att.com>2019-01-28 14:39:43 -0500
commitfe91155454a27401e8c23780fa247c0ede196747 (patch)
tree26d0f2e56d9b31283c5f2173c5e765d035187137 /mso-catalog-db/src/main/java
parentd62389df8c10d46609c5770b45697f7ac401dc82 (diff)
parentfe76d074a452e58d4122cc234d17e7aa407a1b44 (diff)
Merge 'origin/casablanca' into master
Issue-ID: SO-1435 Change-Id: If065ef5c91e769452fd6701fa6c28a23b4bdf2b2 Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'mso-catalog-db/src/main/java')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java11
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java1
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HomingInstance.java152
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java11
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java11
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java11
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java33
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HomingInstanceRepository.java30
11 files changed, 263 insertions, 4 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java
index 00ddf35a5f..04b93c3886 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java
@@ -93,6 +93,9 @@ public class AllottedResourceCustomization implements Serializable {
@Column(name = "MAX_INSTANCES")
private Integer maxInstances;
+ @Column(name = "RESOURCE_INPUT")
+ private String resourceInput;
+
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "AR_MODEL_UUID")
private AllottedResource allottedResource;
@@ -241,4 +244,12 @@ public class AllottedResourceCustomization implements Serializable {
public void setMaxInstances(Integer maxInstances) {
this.maxInstances = maxInstances;
}
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java
index 820b47a2db..bb01f6f804 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java
@@ -23,6 +23,7 @@ package org.onap.so.db.catalog.beans;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.openpojo.business.annotation.BusinessKey;
import org.apache.commons.lang3.builder.HashCodeBuilder;
+
import java.util.Date;
import org.apache.commons.lang3.builder.EqualsBuilder;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HomingInstance.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HomingInstance.java
new file mode 100644
index 0000000000..ef474be159
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HomingInstance.java
@@ -0,0 +1,152 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018. Intel Corp. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.db.catalog.beans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import uk.co.blackpepper.bowman.annotation.RemoteResource;
+import uk.co.blackpepper.bowman.annotation.ResourceId;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import java.net.URI;
+
+/**
+ * EntityBean class for a HomingInstance. This bean represents a homing instance
+ * of a service, populated on successful homing
+ *
+ */
+@RemoteResource("/homingInstance")
+@Entity
+@Table(name = "homing_instances")
+public class HomingInstance {
+ @JsonProperty
+ @BusinessKey
+ @Id
+ @Column(name = "SERVICE_INSTANCE_ID")
+ private String serviceInstanceId;
+
+ @JsonProperty("cloud_region_id")
+ @BusinessKey
+ @Column(name = "CLOUD_REGION_ID")
+ private String cloudRegionId;
+
+ @JsonProperty("cloud_owner")
+ @BusinessKey
+ @Column(name = "CLOUD_OWNER")
+ private String cloudOwner;
+
+
+
+ @JsonProperty("oof_directives")
+ @BusinessKey
+ @Column(name = "OOF_DIRECTIVES", columnDefinition = "LONGTEXT")
+ private String oofDirectives;
+
+ @Transient
+ private URI uri;
+
+ public HomingInstance () {
+
+ }
+
+ public HomingInstance (HomingInstance homingInstance) {
+ this.serviceInstanceId = homingInstance.getServiceInstanceId();
+ this.cloudRegionId = homingInstance.getCloudRegionId();
+ this.cloudOwner = homingInstance.getCloudOwner();
+ this.oofDirectives = homingInstance.getOofDirectives();
+ }
+
+
+ public String getServiceInstanceId() {
+ return this.serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getCloudRegionId() {
+
+ return this.cloudRegionId;
+ }
+
+ public void setCloudRegionId(String cloudRegionId) {
+
+ this.cloudRegionId = cloudRegionId;
+ }
+
+ public String getCloudOwner() {
+
+ return this.cloudOwner;
+ }
+
+ public void setCloudOwner (String cloudOwner) {
+
+ this.cloudOwner = cloudOwner;
+ }
+
+ public String getOofDirectives() {
+ return oofDirectives;
+ }
+
+ public void setOofDirectives(String oofDirectives) {
+ this.oofDirectives = oofDirectives;
+ }
+
+ @ResourceId
+ public URI getUri() {
+ return this.uri;
+ }
+
+ public void setUri(URI uri) {
+
+ this.uri = uri;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId)
+ .append("cloudRegionId", cloudRegionId)
+ .append("cloudOwner", cloudOwner)
+ .append("oofDirectives", oofDirectives).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof HomingInstance)) {
+ return false;
+ }
+ HomingInstance castOther = (HomingInstance) other;
+ return new EqualsBuilder().append(serviceInstanceId, castOther.serviceInstanceId).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(serviceInstanceId).toHashCode();
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java
index 7afeac7710..1e3b6fc220 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java
@@ -99,6 +99,9 @@ public class NetworkResourceCustomization implements Serializable {
@Column(name = "NETWORK_ROLE")
private String networkRole;
+ @Column(name = "RESOURCE_INPUT")
+ private String resourceInput;
+
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID")
private NetworkResource networkResource = null;
@@ -168,4 +171,12 @@ public class NetworkResourceCustomization implements Serializable {
public String getNetworkRole() {
return this.networkRole;
}
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java
index 544e1cbf08..f92aadf7a7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java
@@ -22,7 +22,7 @@ package org.onap.so.db.catalog.beans;
//TODO find this file a new location?
public enum OrchestrationStatusValidationDirective {
- SILENT_SUCCESS("SilentSuccess"), CONTINUE("Continue"), FAIL("Fail");
+ SILENT_SUCCESS("SilentSuccess"), CONTINUE("Continue"), FAIL("Fail"), VALIDATION_SKIPPED("ValidationSkiPped");
private final String name;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
index 8e1d498e42..64eff56f97 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
@@ -28,7 +28,7 @@ public enum ResourceType {
NETWORK("Network"),
NETWORK_COLLECTION("NetworkCollection"),
CONFIGURATION("Configuration"),
- CUSTOM("Custom");
+ NO_VALIDATE("NoValidate");
private final String name;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
index 6eb453805b..28ff778d44 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
@@ -92,6 +92,9 @@ public class Service implements Serializable {
@Column(name = "SERVICE_CATEGORY")
private String category;
+ @Column(name = "RESOURCE_ORDER")
+ private String resourceOrder;
+
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "network_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
private List<NetworkResourceCustomization> networkCustomizations;
@@ -332,4 +335,12 @@ public class Service implements Serializable {
public void setWorkloadContext(String workloadContext) {
this.workloadContext = workloadContext;
}
+
+ public String getResourceOrder() {
+ return resourceOrder;
+ }
+
+ public void setResourceOrder(String resourceOrder) {
+ this.resourceOrder = resourceOrder;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java
index 764d2b7c39..83fe051233 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java
@@ -43,6 +43,8 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import com.openpojo.business.annotation.BusinessKey;
+import org.hibernate.annotations.NotFound;
+import org.hibernate.annotations.NotFoundAction;
import uk.co.blackpepper.bowman.annotation.LinkedResource;
@Entity
@@ -91,6 +93,7 @@ public class VnfResource implements Serializable {
private Date created;
@ManyToOne(fetch = FetchType.LAZY)
+ @NotFound(action = NotFoundAction.IGNORE)
@JoinColumn(name = "HEAT_TEMPLATE_ARTIFACT_UUID")
private HeatTemplate heatTemplates;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
index d286bc0727..53e8c9613e 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
@@ -97,6 +97,9 @@ public class VnfResourceCustomization implements Serializable {
@Column(name = "MULTI_STAGE_DESIGN")
private String multiStageDesign;
+ @Column(name = "RESOURCE_INPUT")
+ private String resourceInput;
+
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "VNF_RESOURCE_MODEL_UUID")
private VnfResource vnfResources;
@@ -283,4 +286,12 @@ public class VnfResourceCustomization implements Serializable {
public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
this.cvnfcCustomization = cvnfcCustomization;
}
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 3612d83359..828b2ff920 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -36,6 +36,7 @@ import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
+import org.onap.so.db.catalog.beans.HomingInstance;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkRecipe;
@@ -126,6 +127,7 @@ public class CatalogDbClient {
private static final String WORK_STEP = "workStep";
private static final String CLLI = "clli";
private static final String CLOUD_VERSION = "cloudVersion";
+ private static final String HOMING_INSTANCE = "/homingInstance";
private static final String TARGET_ENTITY = "SO:CatalogDB";
private static final String ASTERISK = "*";
@@ -157,6 +159,8 @@ public class CatalogDbClient {
private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType";
private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep";
private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
+ private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId";
+
private String serviceURI;
private String vfModuleURI;
@@ -169,6 +173,7 @@ public class CatalogDbClient {
private String instanceGroupURI;
private String cloudifyManagerURI;
private String cloudSiteURI;
+ private String homingInstanceURI;
private final Client<Service> serviceClient;
@@ -214,6 +219,8 @@ public class CatalogDbClient {
private final Client<CloudSite> cloudSiteClient;
+ private final Client<HomingInstance> homingInstanceClient;
+
private final Client<CloudifyManager> cloudifyManagerClient;
private Client<CvnfcCustomization> cvnfcCustomizationClient;
@@ -268,6 +275,7 @@ public class CatalogDbClient {
instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
cloudifyManagerURI = endpoint + CLOUDIFY_MANAGER + URI_SEPARATOR;
cloudSiteURI = endpoint + CLOUD_SITE + URI_SEPARATOR;
+ homingInstanceURI = endpoint + HOMING_INSTANCE + URI_SEPARATOR;
}
@@ -306,6 +314,7 @@ public class CatalogDbClient {
networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
cloudSiteClient = clientFactory.create(CloudSite.class);
+ homingInstanceClient = clientFactory.create(HomingInstance.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
@@ -348,6 +357,7 @@ public class CatalogDbClient {
networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
cloudSiteClient = clientFactory.create(CloudSite.class);
+ homingInstanceClient = clientFactory.create(HomingInstance.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
@@ -609,20 +619,39 @@ public class CatalogDbClient {
}
public CloudSite getCloudSite(String id){
- return this.getSingleResource(cloudSiteClient, getUri(cloudSiteURI + id));
+ return this.getSingleResource(cloudSiteClient,
+ getUri(cloudSiteURI + id));
+ }
+
+ public CloudSite getCloudSite(String id, String uri){
+ return this.getSingleResource(cloudSiteClient,
+ getUri(uri + id));
}
public void postCloudSite(CloudSite cloudSite){
this.postSingleResource(cloudSiteClient, cloudSite);
}
-
public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){
return this.getSingleResource(cloudSiteClient, getUri(UriBuilder
.fromUri(findByClliAndCloudVersion)
.queryParam(CLLI,clli).queryParam(CLOUD_VERSION,cloudVersion).build().toString()));
}
+ public HomingInstance getHomingInstance (String serviceInstanceId){
+ return this.getSingleResource(homingInstanceClient,
+ getUri(homingInstanceURI + serviceInstanceId));
+ }
+
+ public HomingInstance getHomingInstance (String serviceInstanceId, String uri){
+ return this.getSingleResource(homingInstanceClient,
+ getUri(uri + serviceInstanceId));
+ }
+
+ public void postHomingInstance(HomingInstance homingInstance){
+ this.postSingleResource(homingInstanceClient, homingInstance);
+ }
+
public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
return this.getSingleResource(serviceClient, getUri(UriBuilder
.fromUri(findFirstByModelVersionAndModelInvariantUUIDURI)
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HomingInstanceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HomingInstanceRepository.java
new file mode 100644
index 0000000000..aea8d3e537
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HomingInstanceRepository.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018. Intel Corp. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.HomingInstance;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "homingInstance", path = "homingInstance")
+public interface HomingInstanceRepository extends JpaRepository<HomingInstance, String> {
+ HomingInstance findServiceByServiceInstanceId(String serviceInstanceId);
+}