summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-13 09:48:57 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-13 09:51:54 -0400
commita81aef2172c2cb4c6735f6018aee7deb04140b5d (patch)
tree2ef9daca8d8a075142d1f900bb8862c6ce322491 /mso-catalog-db/src/main/java
parentc703669697084b5bd9be0f8f016bbf8ed11213a4 (diff)
Cloud config database table support
added cloud config database entities added cloud config repository converted existing cloud config class converted all code interacting with previous cloud config object created migration to automatically load cloud config properties from application.yaml Issue-ID: SO-854 Change-Id: Icf408e5d0fcabd1b7e97298963c555fae6964930 Signed-off-by: Benjamin, Max (mb388a) <mb388a@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/AuthenticationType.java25
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java278
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java261
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java208
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java25
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java71
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java10
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java14
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java10
9 files changed, 882 insertions, 20 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AuthenticationType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AuthenticationType.java
new file mode 100644
index 0000000000..b1cb07447d
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AuthenticationType.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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;
+
+public enum AuthenticationType {
+ USERNAME_PASSWORD, RACKSPACE_APIKEY;
+}
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
new file mode 100644
index 0000000000..e6d02c6836
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java
@@ -0,0 +1,278 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.HashCodeBuilder;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ * EntityBean class for a CloudIdentity. This bean represents a cloud identity
+ * service instance (i.e. a DCP node) in the NVP/AIC cloud. It will be loaded via
+ * CloudConfig object, of which it is a component.
+ *
+ */
+@Entity
+@Table(name = "identity_services")
+public class CloudIdentity {
+
+ @JsonProperty
+ @BusinessKey
+ @Id
+ @Column(name = "ID")
+ private String id;
+
+ @JsonProperty("identity_url")
+ @BusinessKey
+ @Column(name = "IDENTITY_URL")
+ private String identityUrl;
+
+ @JsonProperty("mso_id")
+ @BusinessKey
+ @Column(name = "MSO_ID")
+ private String msoId;
+
+ @JsonProperty("mso_pass")
+ @BusinessKey
+ @Column(name = "MSO_PASS")
+ private String msoPass;
+
+ @JsonProperty("admin_tenant")
+ @BusinessKey
+ @Column(name = "ADMIN_TENANT")
+ private String adminTenant;
+
+ @JsonProperty("member_role")
+ @BusinessKey
+ @Column(name = "MEMBER_ROLE")
+ private String memberRole;
+
+ @JsonProperty("tenant_metadata")
+ @BusinessKey
+ @Column(name = "TENANT_METADATA")
+ private Boolean tenantMetadata;
+
+ @JsonProperty("identity_server_type")
+ @BusinessKey
+ @Enumerated(EnumType.STRING)
+ @Column(name = "IDENTITY_SERVER_TYPE")
+ private ServerType identityServerType;
+
+ @JsonProperty("identity_authentication_type")
+ @BusinessKey
+ @Enumerated(EnumType.STRING)
+ @Column(name = "IDENTITY_AUTHENTICATION_TYPE")
+ private AuthenticationType identityAuthenticationType;
+
+ @JsonProperty("last_updated_by")
+ @BusinessKey
+ @Column(name = "LAST_UPDATED_BY")
+ private String lastUpdatedBy ;
+
+ @JsonProperty("creation_timestamp")
+ @BusinessKey
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @JsonProperty("update_timestamp")
+ @BusinessKey
+ @Column(name = "UPDATE_TIMESTAMP")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date updated;
+
+ public CloudIdentity() {}
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ this.updated = new Date();
+ }
+
+ public String getId () {
+ return id;
+ }
+
+ public void setId (String id) {
+ this.id = id;
+ }
+
+ public String getIdentityUrl() {
+ return this.identityUrl;
+ }
+ public void setIdentityUrl(String url) {
+ this.identityUrl = url;
+ }
+
+ public String getMsoId () {
+ return msoId;
+ }
+
+ public void setMsoId (String id) {
+ this.msoId = id;
+ }
+
+ public String getMsoPass () {
+ return msoPass;
+ }
+
+ public void setMsoPass (String pwd) {
+ this.msoPass = pwd;
+ }
+
+ public String getAdminTenant () {
+ return adminTenant;
+ }
+
+ public String getLastUpdatedBy() {
+ return lastUpdatedBy;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setLastUpdatedBy(String lastUpdatedBy) {
+ this.lastUpdatedBy = lastUpdatedBy;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+
+ public void setAdminTenant (String tenant) {
+ this.adminTenant = tenant;
+ }
+
+ public String getMemberRole () {
+ return memberRole;
+ }
+
+ public void setMemberRole (String role) {
+ this.memberRole = role;
+ }
+
+ public Boolean getTenantMetadata() {
+ return tenantMetadata;
+ }
+
+ public void setTenantMetadata (Boolean meta) {
+ this.tenantMetadata = meta;
+ }
+
+ public ServerType getIdentityServerType() {
+ return this.identityServerType;
+ }
+ public void setIdentityServerType(ServerType ist) {
+ this.identityServerType = ist;
+ }
+ public String getIdentityServerTypeAsString() {
+ return this.identityServerType.toString();
+ }
+ /**
+ * @return the identityAuthenticationType
+ */
+ public AuthenticationType getIdentityAuthenticationType() {
+ return identityAuthenticationType;
+ }
+
+ /**
+ * @param identityAuthenticationType the identityAuthenticationType to set
+ */
+ public void setIdentityAuthenticationType(AuthenticationType identityAuthenticationType) {
+ this.identityAuthenticationType = identityAuthenticationType;
+ }
+
+ @Override
+ public CloudIdentity clone() {
+ CloudIdentity cloudIdentityCopy = new CloudIdentity();
+
+ cloudIdentityCopy.id = this.id;
+ cloudIdentityCopy.identityUrl = this.identityUrl;
+ cloudIdentityCopy.msoId = this.msoId;
+ cloudIdentityCopy.msoPass = this.msoPass;
+ cloudIdentityCopy.adminTenant = this.adminTenant;
+ cloudIdentityCopy.memberRole = this.memberRole;
+ cloudIdentityCopy.tenantMetadata = this.tenantMetadata;
+ cloudIdentityCopy.identityServerType = this.identityServerType;
+ cloudIdentityCopy.identityAuthenticationType = this.identityAuthenticationType;
+
+ return cloudIdentityCopy;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
+ .append("identityUrl", getIdentityUrl()).append("msoId", getMsoId())
+ .append("adminTenant", getAdminTenant()).append("memberRole", getMemberRole())
+ .append("tenantMetadata", getTenantMetadata()).append("identityServerType", getIdentityServerType())
+ .append("identityAuthenticationType", getIdentityAuthenticationType()).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (!getClass().equals(other.getClass())) {
+ return false;
+ }
+ CloudIdentity castOther = (CloudIdentity) other;
+ return new EqualsBuilder().append(getId(), castOther.getId())
+ .append(getIdentityUrl(), castOther.getIdentityUrl()).append(getMsoId(), castOther.getMsoId())
+ .append(getMsoPass(), castOther.getMsoPass()).append(getAdminTenant(), castOther.getAdminTenant())
+ .append(getMemberRole(), castOther.getMemberRole())
+ .append(getTenantMetadata(), castOther.getTenantMetadata())
+ .append(getIdentityServerType(), castOther.getIdentityServerType())
+ .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType()).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(1, 31).append(getId()).append(getIdentityUrl()).append(getMsoId())
+ .append(getMsoPass()).append(getAdminTenant()).append(getMemberRole()).append(getTenantMetadata())
+ .append(getIdentityServerType()).append(getIdentityAuthenticationType()).toHashCode();
+ }
+} \ No newline at end of file
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
new file mode 100644
index 0000000000..53c97fbce6
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
@@ -0,0 +1,261 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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 java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ * EntityBean class for a CloudSite. This bean represents a cloud location
+ * (i.e. and LCP node) in the NVP/AIC cloud. It will be loaded via CloudConfig
+ * object, of which it is a component
+ *
+ */
+@Entity
+@Table(name = "cloud_sites")
+public class CloudSite {
+
+ @JsonProperty
+ @BusinessKey
+ @Id
+ @Column(name = "ID")
+ private String id;
+
+ @JsonProperty("region_id")
+ @BusinessKey
+ @Column(name = "REGION_ID")
+ private String regionId;
+
+ @JsonProperty("aic_version")
+ @BusinessKey
+ @Column(name = "CLOUD_VERSION")
+ private String cloudVersion;
+
+ @JsonProperty("clli")
+ @BusinessKey
+ @Column(name = "CLLI")
+ private String clli;
+
+ @JsonProperty("platform")
+ @BusinessKey
+ @Column(name = "PLATFORM")
+ private String platform;
+
+ @JsonProperty("orchestrator")
+ @BusinessKey
+ @Column(name = "ORCHESTRATOR")
+ private String orchestrator;
+
+ @JsonProperty("cloudify_id")
+ @BusinessKey
+ @Column(name = "CLOUDIFY_ID")
+ private String cloudifyId;
+
+ // Derived property (set by CloudConfig loader based on identityServiceId)
+ @BusinessKey
+ @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "IDENTITY_SERVICE_ID")
+ private CloudIdentity identityService;
+
+ @BusinessKey
+ @JsonProperty("identity_service_id")
+ transient private String identityServiceId;
+
+ @JsonProperty("last_updated_by")
+ @BusinessKey
+ @Column(name = "LAST_UPDATED_BY")
+ private String lastUpdatedBy ;
+
+ @JsonProperty("creation_timestamp")
+ @BusinessKey
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @JsonProperty("update_timestamp")
+ @BusinessKey
+ @Column(name = "UPDATE_TIMESTAMP")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date updated;
+
+ public CloudSite() {
+
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ this.updated = new Date();
+ }
+
+ public CloudSite(CloudSite site) {
+ this.cloudVersion = site.getCloudVersion();
+ this.clli = site.getClli();
+ this.id = site.getId();
+ this.identityService = site.getIdentityService();
+ this.orchestrator = site.getOrchestrator();
+ this.platform = site.getPlatform();
+ this.regionId = site.getRegionId();
+ this.identityServiceId = site.getIdentityServiceId();
+ }
+ public String getId() {
+ return this.id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getRegionId() {
+ return regionId;
+ }
+
+ public void setRegionId(String regionId) {
+ this.regionId = regionId;
+ }
+
+ public String getIdentityServiceId() {
+ return identityServiceId == null ? (identityService== null? null:identityService.getId()):identityServiceId;
+ }
+
+ public String getCloudVersion() {
+ return cloudVersion;
+ }
+
+ public void setCloudVersion(String cloudVersion) {
+ this.cloudVersion = cloudVersion;
+ }
+
+ public String getClli() {
+ return clli;
+ }
+
+ public void setClli(String clli) {
+ this.clli = clli;
+ }
+
+ public String getCloudifyId() {
+ return cloudifyId;
+ }
+
+ public void setCloudifyId(String cloudifyId) {
+ this.cloudifyId = cloudifyId;
+ }
+
+ public String getLastUpdatedBy() {
+ return lastUpdatedBy;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setLastUpdatedBy(String lastUpdatedBy) {
+ this.lastUpdatedBy = lastUpdatedBy;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+
+ public String getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(String platform) {
+ this.platform = platform;
+ }
+
+ public String getOrchestrator() {
+ return orchestrator;
+ }
+
+ public void setOrchestrator(String orchestrator) {
+ this.orchestrator = orchestrator;
+ }
+
+ public CloudIdentity getIdentityService () {
+ return identityService;
+ }
+
+ public void setIdentityService (CloudIdentity identity) {
+ this.identityService = identity;
+ }
+ @Deprecated
+ public void setIdentityServiceId(String identityServiceId) {
+ this.identityServiceId = identityServiceId;
+ }
+
+ @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();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (!getClass().equals(other.getClass())) {
+ return false;
+ }
+ CloudSite castOther = (CloudSite) other;
+ return new EqualsBuilder().append(getRegionId(), castOther.getRegionId())
+ .append(getIdentityServiceId(), castOther.getIdentityServiceId())
+ .append(getCloudVersion(), castOther.getCloudVersion()).append(getClli(), castOther.getClli()).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(1, 31).append(getRegionId()).append(getIdentityServiceId()).append(getCloudVersion())
+ .append(getClli()).toHashCode();
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java
new file mode 100644
index 0000000000..eb9078fd57
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java
@@ -0,0 +1,208 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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 java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.openpojo.business.annotation.BusinessKey;
+import org.onap.so.logger.MsoLogger;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ * EntityBean class for a Cloudify Manager. This bean represents a Cloudify
+ * node through which TOSCA-based VNFs may be deployed. Each CloudSite in the
+ * CloudConfig may have a Cloudify Manager for deployments using TOSCA blueprints.
+ * Cloudify Managers may support multiple Cloud Sites, but each site will have
+ * at most one Cloudify Manager.
+ *
+ * This does not replace the ability to use the CloudSite directly via Openstack.
+ *
+ * @author JC1348
+ */
+@Entity
+@Table(name = "cloudify_managers")
+public class CloudifyManager {
+
+ @JsonProperty
+ @BusinessKey
+ @Id
+ @Column(name = "ID")
+ private String id;
+
+ @BusinessKey
+ @JsonProperty ("cloudify_url")
+ @Column(name = "CLOUDIFY_URL")
+ private String cloudifyUrl;
+
+ @BusinessKey
+ @JsonProperty("username")
+ @Column(name = "USERNAME")
+ private String username;
+
+ @BusinessKey
+ @JsonProperty("password")
+ @Column(name = "PASSWORD")
+ private String password;
+
+ @BusinessKey
+ @JsonProperty("version")
+ @Column(name = "VERSION")
+ private String version;
+
+ @JsonProperty("last_updated_by")
+ @BusinessKey
+ @Column(name = "LAST_UPDATED_BY")
+ private String lastUpdatedBy ;
+
+ @JsonProperty("creation_timestamp")
+ @BusinessKey
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @JsonProperty("update_timestamp")
+ @BusinessKey
+ @Column(name = "UPDATE_TIMESTAMP")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date updated;
+
+ public CloudifyManager() {}
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ this.updated = new Date();
+ }
+
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getCloudifyUrl() {
+ return cloudifyUrl;
+ }
+
+ public void setCloudifyUrl(String cloudifyUrl) {
+ this.cloudifyUrl = cloudifyUrl;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getLastUpdatedBy() {
+ return lastUpdatedBy;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setLastUpdatedBy(String lastUpdatedBy) {
+ this.lastUpdatedBy = lastUpdatedBy;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+
+ @Override
+ public CloudifyManager clone() {
+ CloudifyManager cloudifyManagerCopy = new CloudifyManager();
+ cloudifyManagerCopy.id = this.id;
+ cloudifyManagerCopy.cloudifyUrl = this.cloudifyUrl;
+ cloudifyManagerCopy.username = this.username;
+ cloudifyManagerCopy.password = this.password;
+ cloudifyManagerCopy.version = this.version;
+ return cloudifyManagerCopy;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
+ .append("cloudifyUrl", getCloudifyUrl()).append("username", getUsername())
+ .append("password", getPassword()).append("version", getVersion()).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (!getClass().equals(other.getClass())) {
+ return false;
+ }
+ CloudifyManager castOther = (CloudifyManager) other;
+ return new EqualsBuilder().append(getId(), castOther.getId())
+ .append(getCloudifyUrl(), castOther.getCloudifyUrl()).append(getUsername(), castOther.getUsername())
+ .append(getPassword(), castOther.getPassword()).append(getVersion(), castOther.getVersion()).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(1, 31).append(getId()).append(getCloudifyUrl()).append(getUsername())
+ .append(getPassword()).append(getVersion()).toHashCode();
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java
new file mode 100644
index 0000000000..d8d386db8c
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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;
+
+public enum ServerType {
+ KEYSTONE, ORM;
+}
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 edfaba0fb2..0caafc794b 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
@@ -32,18 +32,17 @@ import org.onap.so.db.catalog.beans.ResourceType;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpRequest;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestFactory;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
@@ -100,8 +99,14 @@ public class CatalogDbClient {
private Client<ServiceRecipe> serviceRecipeClient;
+ private Client<CloudSite> cloudSiteClient;
+
+ private Client<CloudIdentity> cloudIdentityClient;
+
+ private Client<CloudifyManager> cloudifyManagerClient;
+
@Value("${mso.catalog.db.spring.endpoint}")
- protected String endpoint;
+ private String endpoint;
@Value("${mso.db.auth}")
private String msoAdaptersAuth;
@@ -116,21 +121,14 @@ public class CatalogDbClient {
public CatalogDbClient() {
ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
- ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(new RestTemplateConfigurer() {
-
- public void configure(RestTemplate restTemplate) {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
-
- restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() {
-
- public ClientHttpResponse intercept(HttpRequest request, byte[] body,
- ClientHttpRequestExecution execution) throws IOException {
-
- request.getHeaders().add("Authorization", msoAdaptersAuth);
- return execution.execute(request, body);
- }
- });
- }
+ ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
+ restTemplate.getInterceptors().add((new SpringClientFilter()));
+
+ restTemplate.getInterceptors().add((request, body, execution) -> {
+
+ request.getHeaders().add("Authorization", msoAdaptersAuth);
+ return execution.execute(request, body);
+ });
}).build().buildClientFactory();
serviceClient = clientFactory.create(Service.class);
orchestrationClient = clientFactory.create(OrchestrationFlow.class);
@@ -146,6 +144,9 @@ public class CatalogDbClient {
instanceGroupClient = clientFactory.create(InstanceGroup.class);
networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
+ cloudSiteClient = clientFactory.create(CloudSite.class);
+ cloudIdentityClient = clientFactory.create(CloudIdentity.class);
+ cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
}
@@ -303,6 +304,24 @@ public class CatalogDbClient {
return collectionNetworkResourceCustomizationClient.get(uri);
}
+ public CloudifyManager getCloudifyManager(String id) {
+ return this.getSingleCloudifyManager(UriBuilder.fromUri(endpoint+"/cloudifyManager/"+id).build());
+ }
+
+ public CloudSite getCloudSite(String id){
+ return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloudSite/"+id).build());
+ }
+
+ public CloudIdentity getCloudIdentity(String id){
+ return this.getSingleCloudIdentity(UriBuilder.fromUri(endpoint+"/cloudIdentity/"+id).build());
+ }
+
+ public CloudSite getCloudSiteByClliAndAicVersion (String clli, String aicVersion){
+ return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloud_sites/search/findByClliAndCloudVersion")
+ .queryParam("CLLI",clli).queryParam("AIC_VERSION",aicVersion)
+ .build());
+ }
+
private InstanceGroup getSingleInstanceGroup(URI uri) {
return instanceGroupClient.get(uri);
}
@@ -327,6 +346,18 @@ public class CatalogDbClient {
return serviceRecipeClient.get(uri);
}
+ protected CloudSite getSinglCloudSite(URI uri) {
+ return cloudSiteClient.get(uri);
+ }
+
+ protected CloudIdentity getSingleCloudIdentity(URI uri) {
+ return cloudIdentityClient.get(uri);
+ }
+
+ protected CloudifyManager getSingleCloudifyManager(URI uri) {
+ return cloudifyManagerClient.get(uri);
+ }
+
public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
return this.getSingleService(
UriBuilder.fromUri(findByModelVersionAndModelInvariantUUIDURI)
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java
new file mode 100644
index 0000000000..c1714821ee
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java
@@ -0,0 +1,10 @@
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "cloudIdentity", path = "cloudIdentity")
+public interface CloudIdentityRepository extends JpaRepository<CloudIdentity, String> {
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
new file mode 100644
index 0000000000..78f117b3ae
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
@@ -0,0 +1,14 @@
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+import javax.transaction.Transactional;
+
+@RepositoryRestResource(collectionResourceRel = "cloudSite", path = "cloudSite")
+@Transactional
+public interface CloudSiteRepository extends JpaRepository<CloudSite, String> {
+
+ CloudSite findByClliAndCloudVersion(String clli, String aicVersion);
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java
new file mode 100644
index 0000000000..dfa677b402
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java
@@ -0,0 +1,10 @@
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.CloudifyManager;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "cloudifyManager", path = "cloudifyManager")
+public interface CloudifyManagerRepository extends JpaRepository<CloudifyManager, String> {
+
+}