diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-10-11 13:55:37 -0400 |
---|---|---|
committer | Rob Daugherty <rd472p@att.com> | 2018-10-12 10:10:16 -0400 |
commit | 6ba0a22bc952232d14d2d24c5f73a42aae2791a9 (patch) | |
tree | 9046e63bccb77ca3e2df4ae7ceab44cc238dd074 /common/src/main/java | |
parent | 58c1d90a787979e507f559d7075aac8a1428df42 (diff) |
Dynamic Cloud Owner Support
added in cloud configuration object to request params
Fix Bean scanning so it picks up the resttemplate
removed unnecessary RestTemplate Bean configurations
corrected typo in CloudConfiguration class
updated gr api test cases with dynamic cloud owner
updated groovy files to allow for dynamic cloud owner values
updated GR API layer to include cloud owner
added enum for default cloud owner
add cloud owner variable to camunda in mapping
removed references to att-aic from BBInputSetup
updated aai schema dependency to 1.3.1 from 1.3.0
Fixed incorrect type AAIUri and updated logging in the method.
use existing service instance id instead of generating
Pass cloudOwner to process to propagate to subprocesses.
NOTE: our aai-schema dependency is 1.3.1-SNAPSHOT to be
compatible with the cloud owner changes here. The
releaesed 1.3.0 version is NOT compatible.
Change-Id: I43b46774b77981d1c8bfe7c7a79b9434889e62ae
Issue-ID: SO-1128
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'common/src/main/java')
4 files changed, 66 insertions, 18 deletions
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java index 553c1e0db0..4f3816ad90 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java @@ -20,22 +20,31 @@ package org.onap.so.client.aai; +import org.onap.aai.domain.yang.NetworkTechnologies; import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; +import org.onap.so.constants.Defaults; import com.google.common.base.CaseFormat; public enum AAIObjectPlurals implements GraphInventoryObjectPlurals { + CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers"), GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs"), PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers"), P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces"), L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks"), + NETWORK_POLICY(AAINamespaceConstants.NETWORK, "/network-policies"), + VPN_BINDING(AAINamespaceConstants.NETWORK, "/vpn-bindings"), SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions"), SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances"), - OWNING_ENTITIES(AAINamespaceConstants.BUSINESS, "/owning-entities"), - VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups/"), - AVAILIBILITY_ZONE(AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones/"); - + OWNING_ENTITY(AAINamespaceConstants.BUSINESS, "/owning-entities"), + VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups"), + AVAILIBILITY_ZONE(AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones"), + VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules"), + CONFIGURATION(AAINamespaceConstants.NETWORK, "/configurations"), + DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants"), + NETWORK_TECHNOLOGY(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies"), + LOGICAL_LINK(AAINamespaceConstants.NETWORK, "/logical-links"); private final String uriTemplate; private final String partialUri; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java index 4b646f9ed7..0e50818f0f 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java @@ -7,9 +7,9 @@ * 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. @@ -29,13 +29,16 @@ import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.Collection; import org.onap.aai.domain.yang.Complex; import org.onap.aai.domain.yang.Configuration; +import org.onap.aai.domain.yang.Connector; import org.onap.aai.domain.yang.Customer; +import org.onap.aai.domain.yang.ExtAaiNetwork; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.InstanceGroup; import org.onap.aai.domain.yang.L3Network; import org.onap.aai.domain.yang.LineOfBusiness; import org.onap.aai.domain.yang.ModelVer; import org.onap.aai.domain.yang.NetworkPolicy; +import org.onap.aai.domain.yang.NetworkTechnology; import org.onap.aai.domain.yang.OperationalEnvironment; import org.onap.aai.domain.yang.OwningEntity; import org.onap.aai.domain.yang.PInterface; @@ -46,6 +49,7 @@ import org.onap.aai.domain.yang.Pserver; import org.onap.aai.domain.yang.RouteTableReferences; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.ServiceSubscription; +import org.onap.aai.domain.yang.Subnet; import org.onap.aai.domain.yang.Tenant; import org.onap.aai.domain.yang.TunnelXconnect; import org.onap.aai.domain.yang.Vce; @@ -56,12 +60,13 @@ import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aai.domain.yang.VpnBinding; import org.onap.aai.domain.yang.Vserver; import org.onap.so.client.graphinventory.GraphInventoryObjectType; +import org.onap.so.constants.Defaults; import com.google.common.base.CaseFormat; public enum AAIObjectType implements GraphInventoryObjectType { - DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/att-aic/{cloud-region-id}"), + DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/{cloud-region-id}"), CUSTOMER(AAINamespaceConstants.BUSINESS, Customer.class), GENERIC_QUERY("/search", "/generic-query"), BULK_PROCESS("/bulkprocess", ""), @@ -73,10 +78,9 @@ public enum AAIObjectType implements GraphInventoryObjectType { NODES_QUERY("/search", "/nodes-query"), CUSTOM_QUERY("/query", ""), ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, RouteTableReferences.class), - DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/att-aic/AAIAIC25", "/tenants/tenant/{tenant-id}"), + DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants/tenant/{tenant-id}"), VCE(AAINamespaceConstants.NETWORK, Vce.class), VPN_BINDING(AAINamespaceConstants.NETWORK, VpnBinding.class), - VPN_BINDINGS(AAINamespaceConstants.NETWORK, "/vpn-bindings"), CONFIGURATION(AAINamespaceConstants.NETWORK, Configuration.class), PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Pserver.class), SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), ServiceSubscription.class), @@ -101,6 +105,10 @@ public enum AAIObjectType implements GraphInventoryObjectType { VNFC(AAINamespaceConstants.NETWORK, Vnfc.class), VLAN_TAG(AAINamespaceConstants.NETWORK, VlanTag.class), COMPLEX(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Complex.class), + CONNECTOR(AAINamespaceConstants.BUSINESS, Connector.class), + NETWORK_TECHNOLOGY(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, NetworkTechnology.class), + SUBNET(AAIObjectType.L3_NETWORK.uriTemplate(), Subnet.class), + EXT_AAI_NETWORK(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class), UNKNOWN("", ""); private final String uriTemplate; @@ -114,7 +122,7 @@ public enum AAIObjectType implements GraphInventoryObjectType { this.uriTemplate = parentUri + partialUri; this.aaiObjectClass = null; } - + private AAIObjectType(String parentUri, Class<?> aaiObjectClass) { this.parentUri = parentUri; this.partialUri = removeParentUri(aaiObjectClass, parentUri); @@ -126,14 +134,14 @@ public enum AAIObjectType implements GraphInventoryObjectType { public String toString() { return this.uriTemplate(); } - + public static AAIObjectType fromTypeName(String name) { if (map.isEmpty()) { for (AAIObjectType type : AAIObjectType.values()) { map.put(type.typeName(), type); } } - + if (map.containsKey(name)) { return map.get(name); } else { @@ -163,7 +171,7 @@ public enum AAIObjectType implements GraphInventoryObjectType { public String partialUri() { return this.partialUri; } - + protected String removeParentUri(Class<?> aaiObjectClass, String parentUri) { return aaiObjectClass.getAnnotation(Metadata.class).uriTemplate().replace(parentUri, ""); } diff --git a/common/src/main/java/org/onap/so/constants/Defaults.java b/common/src/main/java/org/onap/so/constants/Defaults.java new file mode 100644 index 0000000000..abbd522b4e --- /dev/null +++ b/common/src/main/java/org/onap/so/constants/Defaults.java @@ -0,0 +1,18 @@ +package org.onap.so.constants; + +public enum Defaults { + + CLOUD_OWNER("att-aic"); + + + private final String value; + + private Defaults(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } +} diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java index a58949e498..67d852eff8 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java @@ -22,13 +22,16 @@ package org.onap.so.serviceinstancebeans; import java.io.Serializable; +import org.onap.so.constants.Defaults; + import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.ToStringBuilder; @JsonRootName(value = "cloudConfiguration") -@JsonInclude(Include.NON_DEFAULT) +@JsonInclude(Include.NON_EMPTY) public class CloudConfiguration implements Serializable { private static final long serialVersionUID = 6260165690180745471L; @@ -36,6 +39,8 @@ public class CloudConfiguration implements Serializable { protected String aicNodeClli; @JsonProperty("tenantId") protected String tenantId; + @JsonProperty("cloudOwner") + protected String cloudOwner = Defaults.CLOUD_OWNER.toString(); @JsonProperty("lcpCloudRegionId") protected String lcpCloudRegionId; @@ -96,11 +101,19 @@ public class CloudConfiguration implements Serializable { this.lcpCloudRegionId = lcpCloudRegionId; } - @Override - public String toString() { - return "CloudConfiguration [aicNodeClli=" + aicNodeClli + ", tenantId=" - + tenantId + ", lcpCloudRegionId=" + lcpCloudRegionId + "]"; + public String getCloudOwner() { + return cloudOwner; } + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + @Override + public String toString() { + return new ToStringBuilder(this).append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId()) + .append("cloudOwner", getCloudOwner()).append("lcpCloudRegionId", getLcpCloudRegionId()).toString(); + } + + } |