summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/pom.xml2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java17
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java26
-rw-r--r--common/src/main/java/org/onap/so/constants/Defaults.java18
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java23
-rw-r--r--common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java17
6 files changed, 84 insertions, 19 deletions
diff --git a/common/pom.xml b/common/pom.xml
index d8e71b0e44..d2dba45ebd 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -62,7 +62,7 @@
<dependency>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-schema</artifactId>
- <version>1.3.0</version>
+ <version>1.3.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
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();
+ }
+
+
}
diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java b/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java
index 7a4af7808e..5af84fdb86 100644
--- a/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java
+++ b/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java
@@ -20,10 +20,16 @@
package org.onap.so.serviceinstancebeans;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
import org.junit.Test;
import org.onap.so.openpojo.rules.HasToStringRule;
import org.onap.so.openpojo.rules.ToStringTester;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.PojoClassFilter;
import com.openpojo.reflection.filters.FilterEnum;
@@ -43,6 +49,17 @@ public class ServiceInstanceBeansTest {
public void pojoStructure() {
test("org.onap.so.serviceinstancebeans");
}
+
+ @Test
+ public void cloudConfigurationkeepDefaultValues() throws IOException {
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setLcpCloudRegionId("myRegionId");
+ ObjectMapper mapper = new ObjectMapper();
+
+ assertEquals("{\"cloudOwner\":\"att-aic\",\"lcpCloudRegionId\":\"myRegionId\"}", mapper.writeValueAsString(cloudConfiguration));
+
+
+ }
private void test(String pojoPackage) {
Validator validator = ValidatorBuilder.create()