summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-03-25 17:26:12 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-25 17:26:12 +0000
commitb0bb4733ee29dabfe024dc93869a2ede09ef010f (patch)
tree120ae1a629f239155a76b80c84e9ee58081bfb0f /mso-catalog-db
parente2708cba9e8190fd022a87d962721eeea2b1a2e3 (diff)
parent0c6057ea8f21c63af4791107c2440a6ed992f5f0 (diff)
Merge "mso to add support for creating the cloud region"
Diffstat (limited to 'mso-catalog-db')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java15
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java101
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java32
-rw-r--r--mso-catalog-db/src/test/resources/data.sql2
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql1
5 files changed, 149 insertions, 2 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
index deaa2a3221..0d7fe7d38f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
@@ -93,6 +93,11 @@ public class CloudSite {
@Column(name = "CLOUDIFY_ID")
private String cloudifyId;
+ @JsonProperty("cloud_owner")
+ @BusinessKey
+ @Column(name = "CLOUD_OWNER")
+ private String cloudOwner;
+
// Derived property (set by CloudConfig loader based on identityServiceId)
@BusinessKey
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@@ -266,12 +271,20 @@ public class CloudSite {
this.identityServiceId = identityServiceId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("regionId", getRegionId())
.append("identityServiceId", getIdentityServiceId()).append("cloudVersion", getCloudVersion())
.append("clli", getClli()).append("cloudifyId", getCloudifyId()).append("platform", getPlatform())
- .append("orchestrator", getOrchestrator()).toString();
+ .append("orchestrator", getOrchestrator()).append("cloud-owner", getCloudOwner()).toString();
}
@Override
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java
new file mode 100644
index 0000000000..1f19dcc1dd
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * 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 java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.openpojo.business.annotation.BusinessKey;
+
+@Entity
+@Table(name = "network_technology_reference")
+public class NetworkTechnologyReference implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name = "ID", nullable = false, updatable = false)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
+
+ @BusinessKey
+ @Column(name = "cloud_owner")
+ private String cloudOwner;
+
+ @BusinessKey
+ @Column(name = "network_technology")
+ private String networkTechnology;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("id", id).append("cloudOwner", cloudOwner)
+ .append("networkTechnology", networkTechnology).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof NetworkTechnologyReference)) {
+ return false;
+ }
+ NetworkTechnologyReference castOther = (NetworkTechnologyReference) other;
+ return new EqualsBuilder().append(cloudOwner, castOther.cloudOwner)
+ .append(networkTechnology, castOther.networkTechnology).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(cloudOwner).append(networkTechnology).toHashCode();
+ }
+
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
+ public String getNetworkTechnology() {
+ return networkTechnology;
+ }
+
+ public void setNetworkTechnology(String networkTechnology) {
+ this.networkTechnology = networkTechnology;
+ }
+
+
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java
new file mode 100644
index 0000000000..0b7065490b
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * 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 java.util.List;
+import org.onap.so.db.catalog.beans.NetworkTechnologyReference;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+
+public interface NetworkTechnologyReferenceRepository extends JpaRepository<NetworkTechnologyReference, Integer> {
+
+ List<NetworkTechnologyReference> findAllByCloudOwner(String cloudOwner);
+}
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index 0852aa026d..b38d4d9376 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -683,7 +683,7 @@ INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `
INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `PROJECT_DOMAIN_NAME`, `USER_DOMAIN_NAME`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, NULL, 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33');
-INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`, `SUPPORT_FABRIC`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28', 1);
+INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`, `SUPPORT_FABRIC`,`CLOUD_OWNER`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28', 1,'cloudOwner');
INSERT INTO `controller_selection_reference` (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`) VALUES
('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'ConfigScaleOut'),
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 6573def570..b949684b7b 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -121,6 +121,7 @@ CREATE TABLE `cloud_sites` (
`CREATION_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`UPDATE_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`SUPPORT_FABRIC` bit(1) NOT NULL DEFAULT 1,
+ `CLOUD_OWNER` varchar(225) NOT NULL,
PRIMARY KEY (`ID`),
KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`),
CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`)