diff options
Diffstat (limited to 'bpmn/MSOCoreBPMN')
30 files changed, 1654 insertions, 248 deletions
diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml index 27d1c97d4b..690dd5414a 100644 --- a/bpmn/MSOCoreBPMN/pom.xml +++ b/bpmn/MSOCoreBPMN/pom.xml @@ -81,13 +81,6 @@ <version>3.0.1</version> <scope>provided</scope> </dependency> - - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.10.19</version> - <scope>test</scope> - </dependency> <!-- Connectors, in compile scope to include it in the war file --> <dependency> <groupId>org.camunda.connect</groupId> @@ -132,30 +125,20 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-jaxrs</artifactId> - <version>3.0.19.Final</version> - <scope>provided</scope> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20160212</version> </dependency> + <dependency> + <groupId>com.github.fge</groupId> + <artifactId>json-schema-validator</artifactId> + <version>2.2.6</version> + </dependency> + <dependency> + <groupId>com.github.fge</groupId> + <artifactId>json-schema-core</artifactId> + <version>1.2.4</version> + </dependency> <dependency> <groupId>org.xmlunit</groupId> <artifactId>xmlunit-core</artifactId> @@ -167,7 +150,12 @@ <artifactId>status-control</artifactId> <version>${project.version}</version> </dependency> - <dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>mso-api-handler-common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> <version>3.8.0</version> diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java index 89addb9b39..21943c047f 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/AllottedResource.java @@ -24,7 +24,10 @@ import java.util.UUID; import com.fasterxml.jackson.annotation.JsonRootName;
-
+/**
+ * Stores allotted-resource information
+ *
+ */
@JsonRootName("allottedResource")
public class AllottedResource extends Resource {
@@ -43,12 +46,16 @@ public class AllottedResource extends Resource { */
private String allottedResourceType;
private String allottedResourceRole;
+ private String providingServiceModelName;
private String providingServiceModelInvariantUuid;
+ private String providingServiceModelUuid;
private String nfFunction;
private String nfType;
private String nfRole;
private String nfNamingCode;
-
+ private String orchestrationStatus;
+ private TunnelConnect tunnelConnect;
+
/*
* GET and SET
*/
@@ -64,6 +71,12 @@ public class AllottedResource extends Resource { public void setAllottedResourceRole(String allottedResourceRole) {
this.allottedResourceRole = allottedResourceRole;
}
+ public String getProvidingServiceModelName() {
+ return providingServiceModelName;
+ }
+ public void setProvidingServiceModelName(String providingServiceModelName) {
+ this.providingServiceModelName = providingServiceModelName;
+ }
public String getProvidingServiceModelInvariantUuid() {
return providingServiceModelInvariantUuid;
}
@@ -71,6 +84,12 @@ public class AllottedResource extends Resource { String providingServiceModelInvariantUuid) {
this.providingServiceModelInvariantUuid = providingServiceModelInvariantUuid;
}
+ public String getProvidingServiceModelUuid() {
+ return providingServiceModelUuid;
+ }
+ public void setProvidingServiceModelUuid(String providingServiceModelUuid) {
+ this.providingServiceModelUuid = providingServiceModelUuid;
+ }
public String getNfFunction() {
return nfFunction;
}
@@ -95,4 +114,16 @@ public class AllottedResource extends Resource { public void setNfNamingCode(String nfNamingCode) {
this.nfNamingCode = nfNamingCode;
}
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+ public TunnelConnect getTunnelConnect() {
+ return tunnelConnect;
+ }
+ public void setTunnelConnect(TunnelConnect tunnelConnect) {
+ this.tunnelConnect = tunnelConnect;
+ }
}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.java new file mode 100644 index 0000000000..cd45309f28 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ConfigResource.java @@ -0,0 +1,60 @@ +/*- + * ============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.openecomp.mso.bpmn.core.domain; + +import java.util.UUID; + +import com.fasterxml.jackson.annotation.JsonRootName; + + +@JsonRootName("configResource") +public class ConfigResource extends Resource { + + private static final long serialVersionUID = 1L; + + /* + * set resourceType for this object + */ + public ConfigResource(){ + resourceType = ResourceType.CONFIGURATION; + setResourceId(UUID.randomUUID().toString()); + } + + /* + * fields specific to Config Resource resource type + */ + + /* + * GET and SET + */ + + private String toscaNodeType; + + public String getToscaNodeType() { + return toscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + +}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java new file mode 100644 index 0000000000..c80a1fddb4 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Configuration.java @@ -0,0 +1,88 @@ +/*- + * ============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.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * Stores configuration information and modeled off
+ * of the AAI configuration object
+ *
+ */
+@JsonRootName("configuration")
+public class Configuration extends JsonWrapper implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+ private String id;
+ private String name;
+ private String type;
+ private String orchestrationStatus;
+ private String tunnelBandwidth;
+ private String vendorAllowedMaxBandwidth;
+ private String resourceVersion;
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+ public String getTunnelBandwidth() {
+ return tunnelBandwidth;
+ }
+ public void setTunnelBandwidth(String tunnelBandwidth) {
+ this.tunnelBandwidth = tunnelBandwidth;
+ }
+ public String getVendorAllowedMaxBandwidth() {
+ return vendorAllowedMaxBandwidth;
+ }
+ public void setVendorAllowedMaxBandwidth(String vendorAllowedMaxBandwidth) {
+ this.vendorAllowedMaxBandwidth = vendorAllowedMaxBandwidth;
+ }
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java new file mode 100644 index 0000000000..623ab0df20 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Customer.java @@ -0,0 +1,52 @@ +/*- + * ============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.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+/**
+ * This class is used to store customer
+ * data of services aka ServiceDecomposition
+ *
+ * @author bb3476
+ *
+ */
+
+public class Customer extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String subscriptionServiceType;
+ private String globalSubscriberId;
+
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java index c038866e71..40506576a5 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java @@ -23,32 +23,47 @@ package org.openecomp.mso.bpmn.core.domain; import java.io.Serializable;
import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonRootName;
+/**
+ * Stores resources placement and licensing information
+ *
+ */
@JsonRootName("homingSolution")
-public class HomingSolution extends JsonWrapper implements Serializable {
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class HomingSolution extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
private InventoryType inventoryType;
- private String serviceInstanceId;
- private String vnfHostname;
+ private boolean isRehome;
+ private String serviceInstanceId; //TODO should start using si object instead
private String cloudOwner;
private String cloudRegionId;
private String aicClli;
private String aicVersion;
- private String ucpeId; //TODO Remove?
- private List<String> entitlementPoolList;
- private List<String> licenseKeyGroupList;
+ private String tenant;
+ private VnfResource vnf;
+ private License license = new License();
- public InventoryType getInventoryType(){
+ /**
+ * @return the inventoryType which indicates the solution type
+ */
+ public InventoryType getInventoryType() {
return inventoryType;
}
- public void setInventoryType(InventoryType inventoryType){
+ public void setInventoryType(InventoryType inventoryType) {
this.inventoryType = inventoryType;
}
+ public boolean isRehome() {
+ return isRehome;
+ }
+ public void setRehome(boolean isRehome) {
+ this.isRehome = isRehome;
+ }
public String getServiceInstanceId() {
return serviceInstanceId;
@@ -58,21 +73,11 @@ public class HomingSolution extends JsonWrapper implements Serializable { this.serviceInstanceId = serviceInstanceId;
}
- public String getVnfHostname(){
- return vnfHostname;
- }
-
- public void setVnfHostname(String vnfHostname){
- this.vnfHostname = vnfHostname;
- }
-
-
- public String getCloudOwner(){
+ public String getCloudOwner() {
return cloudOwner;
}
-
- public void setCloudOwner(String cloudOwner){
+ public void setCloudOwner(String cloudOwner) {
this.cloudOwner = cloudOwner;
}
@@ -83,48 +88,56 @@ public class HomingSolution extends JsonWrapper implements Serializable { public void setCloudRegionId(String cloudRegionId) {
this.cloudRegionId = cloudRegionId;
}
-
-
- public String getAicClli(){
+ /**
+ * @return the aicClli (aka aic site, physical location id)
+ */
+ public String getAicClli() {
return aicClli;
}
-
- public void setAicClli(String aicClli){
+ public void setAicClli(String aicClli) {
this.aicClli = aicClli;
}
-
- public String getAicVersion(){
+ public String getAicVersion() {
return aicVersion;
}
-
- public void setAicVersion(String aicVersion){
+ public void setAicVersion(String aicVersion) {
this.aicVersion = aicVersion;
}
- public String getUcpeId(){
- return ucpeId;
+ public String getTenant() {
+ return tenant;
}
- public void setUcpeId(String ucpeId){
- this.ucpeId = ucpeId;
+ public void setTenant(String tenant) {
+ this.tenant = tenant;
}
- public List<String> getEntitlementPoolList(){
- return entitlementPoolList;
+ /**
+ * @return the vnf that the resource was homed too.
+ */
+ public VnfResource getVnf() {
+ return vnf;
}
- public void setEntitlementPoolList(List<String> entitlementPoolList){
- this.entitlementPoolList = entitlementPoolList;
+ public void setVnf(VnfResource vnf) {
+ this.vnf = vnf;
}
- public List<String> getLicenseKeyGroupList(){
- return licenseKeyGroupList;
+ public License getLicense() {
+ return license;
}
- public void setLicenseKeyGroupList(List<String> licenseKeyGroupList){
- this.licenseKeyGroupList = licenseKeyGroupList;
+ public void setLicense(License license) {
+ this.license = license;
}
+
+
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+
}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java index f37db4abdd..5cd078d69c 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java @@ -37,7 +37,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.openecomp.mso.logger.MsoLogger;
-//import org.codehaus.jackson.map.SerializationConfig.Feature;
+//import com.fasterxml.jackson.map.SerializationFeature;
/**
@@ -84,11 +84,11 @@ public abstract class JsonWrapper implements Serializable { public JSONObject toJsonObject(){
ObjectMapper mapper = new ObjectMapper();
- // mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ // mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
//mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- // mapper.enable(org.codehaus.jackson.map.DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ // mapper.enable(com.fasterxml.jackson.map.DeserializationFeature.UNWRAP_ROOT_VALUE);
JSONObject json = new JSONObject();
try {
json = new JSONObject(mapper.writeValueAsString(this));
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java new file mode 100644 index 0000000000..eeb533c7f2 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/License.java @@ -0,0 +1,120 @@ +/*- + * ============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.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.json.JSONArray;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * Stores licensing information and is an attribute
+ * of a <class>HomingSolution</class>
+ *
+ */
+@JsonRootName("license")
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+public class License extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ StringBuilder sb = new StringBuilder();
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ private List<String> entitlementPoolList = new ArrayList<String>();
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ private List<String> licenseKeyGroupList = new ArrayList<String>();
+
+
+ public List<String> getEntitlementPoolList() {
+ return entitlementPoolList;
+ }
+
+ public void setEntitlementPoolList(List<String> entitlementPoolList) {
+ this.entitlementPoolList = entitlementPoolList;
+ }
+
+ public List<String> getLicenseKeyGroupList() {
+ return licenseKeyGroupList;
+ }
+
+ public void setLicenseKeyGroupList(List<String> licenseKeyGroupList) {
+ this.licenseKeyGroupList = licenseKeyGroupList;
+ }
+
+ /**
+ * This method adds a Entitlement Pool Uuid
+ * to the EntitlementPoolList
+ *
+ * @param the EntitlementPoolUuid
+ */
+ public void addEntitlementPool(String entitlementPoolUuid) {
+ entitlementPoolList.add(entitlementPoolUuid);
+ }
+
+ /**
+ * This method adds a License Key Group Uuid
+ * to the LicenseKeyGroupList
+ *
+ * @param the licenseKeyGroupUuid
+ */
+ public void addLicenseKeyGroup(String licenseKeyGroupUuid) {
+ licenseKeyGroupList.add(licenseKeyGroupUuid);
+ }
+
+ /**
+ * This method returns the licenseKeyGroupList
+ * as a json array
+ *
+ * @return the strList
+ */
+ @JsonIgnore
+ public JSONArray getLicenseKeyGroupListAsString() {
+ JSONArray array = new JSONArray(licenseKeyGroupList);
+ return array;
+ }
+
+ /**
+ * This method returns the entitlementPoolList
+ * as a json array
+ *
+ * @return the strList
+ */
+ @JsonIgnore
+ public JSONArray getEntitlementPoolListAsString() {
+ JSONArray array = new JSONArray(entitlementPoolList);
+ return array;
+ }
+
+ /**
+ * @return the serialversionuid
+ */
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java index 37bd7214a6..cbc9196289 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModuleResource.java @@ -33,19 +33,33 @@ public class ModuleResource extends Resource { public ModuleResource(){
resourceType = ResourceType.MODULE;
}
-
+
/*
* fields specific to VF Module resource type
*/
+ private String vfModuleName;
private String vfModuleType;
+ private String heatStackId;
private boolean hasVolumeGroup;
private boolean isBase;
private String vfModuleLabel;
private int initialCount;
-
+
/*
* GET && SET
*/
+ public String getVfModuleName() {
+ return vfModuleName;
+ }
+ public void setVfModuleName(String vfModuleName) {
+ this.vfModuleName = vfModuleName;
+ }
+ public String getHeatStackId() {
+ return heatStackId;
+ }
+ public void setHeatStackId(String heatStackId) {
+ this.heatStackId = heatStackId;
+ }
public boolean getIsBase() {
return isBase;
}
@@ -76,5 +90,5 @@ public class ModuleResource extends Resource { public void setHasVolumeGroup(boolean hasVolumeGroup) {
this.hasVolumeGroup = hasVolumeGroup;
}
-
+
}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.java new file mode 100644 index 0000000000..8fcbbd5d3f --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/OwningEntity.java @@ -0,0 +1,53 @@ +/*- + * ============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.openecomp.mso.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * This class is used to store instance + * data of owningEntity for ServiceDecomposition + * + * @author bb3476 + * + */ +@JsonRootName("owningEntity") +public class OwningEntity extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + private String owningEntityId; + private String owningEntityName; + public String getOwningEntityId() { + return owningEntityId; + } + public void setOwningEntityId(String owningEntityId) { + this.owningEntityId = owningEntityId; + } + public String getOwningEntityName() { + return owningEntityName; + } + public void setOwningEntityName(String owningEntityName) { + this.owningEntityName = owningEntityName; + } + +}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java new file mode 100644 index 0000000000..8088585d23 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Project.java @@ -0,0 +1,47 @@ +/*- + * ============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.openecomp.mso.bpmn.core.domain; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * This class is used to store instance + * data of projects for ServiceDecomposition + * + * @author bb3476 + * + */ +@JsonRootName("project") +public class Project extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + private String projectName; + + public String getProjectName() { + return projectName; + } + public void setProjectName(String projectName) { + this.projectName = projectName; + } + +}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.java new file mode 100644 index 0000000000..394528f897 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Request.java @@ -0,0 +1,69 @@ +/*- + * ============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.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * This class is used to store instance
+ * data of services aka ServiceDecomposition
+ *
+ * @author bb3476
+ *
+ */
+
+public class Request extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String sdncRequestId;
+ private String requestId;
+ private ModelInfo modelInfo;
+ private String productFamilyId;
+
+ public String getSdncRequestId() {
+ return sdncRequestId;
+ }
+ public void setSdncRequestId(String sdncRequestId) {
+ this.sdncRequestId = sdncRequestId;
+ }
+ public String getRequestId() {
+ return requestId;
+ }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+
+}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java index 60c4fcedb9..ce5ad47a15 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/Resource.java @@ -23,20 +23,23 @@ package org.openecomp.mso.bpmn.core.domain; import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
public abstract class Resource extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
- private String resourceId;
+ private String resourceId; // TODO name this field just id instead, should be the id of the object as it is in aai
protected ResourceType resourceType; // Enum of vnf or network or allotted resource
protected ModelInfo modelInfo;
private long concurrencyCounter = 1L;
//private List modules;
private ResourceInstance resourceInstance = new ResourceInstance(); // TODO possibly remove
- private HomingSolution homingSolution = new HomingSolution(); // TODO maybe this instead of resourceInstance being "bridge"
+ private HomingSolution homingSolution = new HomingSolution();
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private HomingSolution currentHomingSolution;
//common parameters for all Resources
private String toscaNodeType;
@@ -68,6 +71,12 @@ public abstract class Resource extends JsonWrapper implements Serializable { public void setHomingSolution(HomingSolution homingSolution){
this.homingSolution = homingSolution;
}
+ public HomingSolution getCurrentHomingSolution() {
+ return currentHomingSolution;
+ }
+ public void setCurrentHomingSolution(HomingSolution currentHomingSolution) {
+ this.currentHomingSolution = currentHomingSolution;
+ }
public void setResourceType(ResourceType resourceType) {
this.resourceType = resourceType;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java index 32cda68ba5..70977e1d86 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceInstance.java @@ -25,25 +25,33 @@ import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
- * This class is used to store instance
- * data of Resources
+ * Use resourceId in resource class instead
*
* @author cb645j
*
*/
//@JsonIgnoreProperties
+//TODO update any existing references then remove this pointless class
+@Deprecated
public class ResourceInstance extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
private String instanceId;
private String instanceName;
- private HomingSolution homingSolution;
public String getInstanceId() {
return instanceId;
}
+
+ /**
+ * This class and method is deprecated so use
+ * resourceId field in resource class instead
+ *
+ * @author cb645j
+ *
+ */
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
@@ -53,10 +61,5 @@ public class ResourceInstance extends JsonWrapper implements Serializable { public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
- public HomingSolution getHomingSolution() {
- return homingSolution;
- }
- public void setHomingSolution(HomingSolution homingSolution) {
- this.homingSolution = homingSolution;
- }
+
}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java index 05bccb9e7a..65cf03cd15 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ResourceType.java @@ -22,5 +22,5 @@ package org.openecomp.mso.bpmn.core.domain; public enum ResourceType {
- VNF, NETWORK, MODULE, ALLOTTED_RESOURCE // etc.
+ VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION // etc.
}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java index 8581eee25a..077e5726d7 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java @@ -30,11 +30,13 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-
+import org.json.JSONObject;
import org.openecomp.mso.bpmn.core.json.DecomposeJsonUtil;
import org.openecomp.mso.bpmn.core.json.JsonDecomposingException;
+
+
/**
* Service Decomposition Structure
* This Java object contains service information:
@@ -57,14 +59,69 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { @JsonProperty("serviceRole")
private String serviceRole;
private ServiceInstance serviceInstance;
+ private Request request;
+ private Customer customer;
+ private String callbackURN;
+ private String sdncVersion;
+ @JsonProperty("project")
+ private Project project;
+ @JsonProperty("owningEntity")
+ private OwningEntity owningEntity;
@JsonProperty("vnfResource")
private List <VnfResource> vnfResources;
@JsonProperty("networkResource")
private List <NetworkResource> networkResources;
@JsonProperty("allottedResource")
private List <AllottedResource> allottedResources;
+ @JsonProperty("configResource")
+ private List <ConfigResource> configResources;
public ServiceDecomposition () {
+ super();
+ }
+
+ public ServiceDecomposition (String catalogRestOutput) throws JsonDecomposingException {
+ ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogRestOutput);
+ this.modelInfo = serviceDecomposition.getModelInfo();
+ this.vnfResources = serviceDecomposition.getServiceVnfs();
+ this.allottedResources = serviceDecomposition.getServiceAllottedResources();
+ this.networkResources = serviceDecomposition.getServiceNetworks();
+ this.serviceRole = serviceDecomposition.getServiceRole();
+ this.serviceType = serviceDecomposition.getServiceType();
+ this.configResources = serviceDecomposition.getServiceConfigResources();
+ }
+
+ /**
+ * Constructor taking Catalog DB Adapter REST output (serviceResources model) + service Instance ID
+ * @param catalogRestOutput
+ * @param serviceInstanceId
+ */
+ public ServiceDecomposition (String catalogRestOutput, String serviceInstanceId) throws JsonDecomposingException {
+ ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogRestOutput);
+ this.modelInfo = serviceDecomposition.getModelInfo();
+ this.vnfResources = serviceDecomposition.getServiceVnfs();
+ this.allottedResources = serviceDecomposition.getServiceAllottedResources();
+ this.configResources = serviceDecomposition.getServiceConfigResources();
+ this.networkResources = serviceDecomposition.getServiceNetworks();
+
+ this.serviceRole = serviceDecomposition.getServiceRole();
+ this.serviceType = serviceDecomposition.getServiceType();
+
+ this.serviceInstance = new ServiceInstance();
+ this.serviceInstance.setInstanceId(serviceInstanceId);
+
+ this.project = serviceDecomposition.getProject();
+ this.owningEntity = serviceDecomposition.getOwningEntity();
+ }
+
+ /**
+ * Constructor taking a Service Decomposition JSON serialization
+ * @param catalogRestOutput
+ * @param serviceInstanceId
+ */
+ public ServiceDecomposition (JSONObject jsonServiceDecomposition, String serviceInstanceId) {
+ //TODO provide constructor implementation
+
}
//*****
@@ -86,6 +143,18 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { public void setServiceInstance(ServiceInstance serviceInstance) {
this.serviceInstance = serviceInstance;
}
+ public Project getProject() {
+ return project;
+ }
+ public OwningEntity getOwningEntity() {
+ return owningEntity;
+ }
+ public void setProject(Project project) {
+ this.project = project;
+ }
+ public void setOwningEntity(OwningEntity owningEntity) {
+ this.owningEntity = owningEntity;
+ }
public List<VnfResource> getServiceVnfs() {
return vnfResources;
}
@@ -95,6 +164,12 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { public List<NetworkResource> getServiceNetworks() {
return networkResources;
}
+ public void setServiceConfigs(List<ConfigResource> configResources) {
+ this.configResources = configResources;
+ }
+ public List<ConfigResource> getServiceConfigs() {
+ return configResources;
+ }
public void setServiceNetworks(List<NetworkResource> networkResources) {
this.networkResources = networkResources;
}
@@ -104,6 +179,12 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { public void setServiceAllottedResources(List<AllottedResource> allottedResources) {
this.allottedResources = allottedResources;
}
+ public List<ConfigResource> getServiceConfigResources() {
+ return configResources;
+ }
+ public void setServiceConfigResources(List<ConfigResource> configResources) {
+ this.configResources = configResources;
+ }
public String getServiceType() {
return serviceType;
}
@@ -119,6 +200,35 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { public void setServiceRole(String serviceRole) {
this.serviceRole = serviceRole;
}
+ public Request getRequest() {
+ return request;
+ }
+
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+ public Customer getCustomer() {
+ return customer;
+ }
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+ public String getCallbackURN() {
+ return callbackURN;
+ }
+
+ public void setCallbackURN(String callbackURN) {
+ this.callbackURN = callbackURN;
+ }
+
+ public String getSdncVersion() {
+ return sdncVersion;
+ }
+
+ public void setSdncVersion(String sdncVersion) {
+ this.sdncVersion = sdncVersion;
+ }
+
//*****
//*****
@@ -141,6 +251,9 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { if(this.getServiceVnfs() != null){
serviceResources.addAll(this.getServiceVnfs());
}
+ if(this.getServiceConfigResources() != null){
+ serviceResources.addAll(this.getServiceConfigResources());
+ }
return serviceResources;
}
@@ -151,7 +264,8 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { public String getServiceResourcesJsonString() {
return listToJson((this.getServiceNetworks())) +
listToJson((this.getServiceVnfs())) +
- listToJson((this.getServiceAllottedResources()));
+ listToJson((this.getServiceAllottedResources())) +
+ listToJson((this.getServiceConfigResources()));
}
/**
@@ -178,6 +292,14 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { public String getServiceAllottedResourcesJson(){
return listToJson(this.getServiceAllottedResources());
}
+ /**
+ * Returns a JSON list of all Config Resource structures (i.e. the serialized ConfigResource objects).
+ * @return
+ */
+ @JsonIgnore
+ public String getServiceConfigResourcesJson(){
+ return listToJson(this.getServiceConfigResources());
+ }
//TODO - define Resource Object ID
@JsonIgnore
@@ -224,7 +346,16 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { }
this.allottedResources.add((AllottedResource)allottedResource);
}
-
+ /**
+ * Add Config resource to the list
+ * @param allottedResource
+ */
+ public void addConfigResource(Resource configResource) {
+ if (configResources == null){
+ configResources = new ArrayList<>();
+ }
+ this.configResources.add((ConfigResource)configResource);
+ }
/**
* Add resource to the list
* Given a ResourceDecomposition (subclass) object, add it to the Service Decomposition (in the appropriate category, e.g. as a VNF, Network, or Allotted Resource).
@@ -243,6 +374,9 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { case ALLOTTED_RESOURCE:
this.addAllottedResource(resource);
break;
+ case CONFIGURATION:
+ this.addConfigResource(resource);
+ break;
default:
throw new IllegalArgumentException("Invalid resource type: " + resource.resourceType);
}
@@ -268,14 +402,22 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { }
/**
* Add resource to the list
- * @param jsonResource
+ * @param Resource
*/
public void addAllottedResource(String jsonResource) throws JsonDecomposingException {
AllottedResource allottedResource = null;
allottedResource = DecomposeJsonUtil.jsonToAllottedResource(jsonResource);
this.addVnfResource(allottedResource);
}
-
+ /**
+ * Add resource to the list
+ * @param Resource
+ */
+ public void addConfigResource(String jsonResource) throws JsonDecomposingException {
+ ConfigResource configResource = null;
+ configResource = DecomposeJsonUtil.jsonToConfigResource(jsonResource);
+ this.addVnfResource(configResource);
+ }
/**
* Given a ResourceDecomposition (subclass) object, locate it in the Service Decomposition by its unique ID, and replace the current version with the new one.
* This method should support concurrency control via an auto-incrementing field in the ResourceDecomposition class.
@@ -348,6 +490,9 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { case ALLOTTED_RESOURCE:
this.setServiceAllottedResources((List<AllottedResource>)(List<?>)resources);
break;
+ case CONFIGURATION:
+ this.setServiceConfigResources((List<ConfigResource>)(List<?>)resources);
+ break;
default:
throw new IllegalArgumentException("Invalid resource type: " + resources.get(0).resourceType);
}
@@ -375,4 +520,5 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { }
return null;
}
+
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java index ede995dbd6..aa5e9a035d 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceInstance.java @@ -21,6 +21,9 @@ package org.openecomp.mso.bpmn.core.domain;
import java.io.Serializable;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
/**
* This class is used to store instance
@@ -34,7 +37,33 @@ public class ServiceInstance extends JsonWrapper implements Serializable { private static final long serialVersionUID = 1L;
private String instanceId;
private String instanceName;
+ private String orchestrationStatus;
+ private Configuration configuration;
+ private String serviceType;
+ private String serviceId;
+ private ModelInfo modelInfo;
+ private String environmentContext;
+ private String workloadContext;
+ private Map serviceParams;
+ public String getServiceType() {
+ return serviceType;
+ }
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+ public String getServiceId() {
+ return serviceId;
+ }
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+ public Map getServiceParams() {
+ return serviceParams;
+ }
+ public void setServiceParams(Map serviceParams) {
+ this.serviceParams = serviceParams;
+ }
public String getInstanceId() {
return instanceId;
}
@@ -47,4 +76,34 @@ public class ServiceInstance extends JsonWrapper implements Serializable { public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+ public String getEnvironmentContext() {
+ return environmentContext;
+ }
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java new file mode 100644 index 0000000000..01e7245aa7 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/TunnelConnect.java @@ -0,0 +1,77 @@ +/*- + * ============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.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * This class represents the specifics of a tunnel
+ * cross connect piece of a resource
+ *
+ * @author cb645j
+ *
+ *TODO This may change to house both isp speeds
+ */
+@JsonRootName("tunnelConnect")
+public class TunnelConnect extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private String id;
+ private String upBandwidth;
+ private String downBandwidth;
+ private String upBandwidth2;
+ private String downBandwidth2;
+
+
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getUpBandwidth() {
+ return upBandwidth;
+ }
+ public void setUpBandwidth(String upBandwidth) {
+ this.upBandwidth = upBandwidth;
+ }
+ public String getDownBandwidth() {
+ return downBandwidth;
+ }
+ public void setDownBandwidth(String downBandwidth) {
+ this.downBandwidth = downBandwidth;
+ }
+ public String getUpBandwidth2() {
+ return upBandwidth2;
+ }
+ public void setUpBandwidth2(String upBandwidth2) {
+ this.upBandwidth2 = upBandwidth2;
+ }
+ public String getDownBandwidth2() {
+ return downBandwidth2;
+ }
+ public void setDownBandwidth2(String downBandwidth2) {
+ this.downBandwidth2 = downBandwidth2;
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java index 20903c0717..a328ddf719 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java @@ -44,17 +44,19 @@ public class VnfResource extends Resource { resourceType = ResourceType.VNF;
setResourceId(UUID.randomUUID().toString());
}
-
+
/*
* fields specific to VNF resource type
*/
@JsonProperty("vfModules")
private List <ModuleResource> vfModules;
+ private String vnfHostname;
private String vnfType;
private String nfFunction;
private String nfType;
private String nfRole;
private String nfNamingCode;
+ private String multiStageDesign;
/*
* GET and SET
@@ -65,6 +67,12 @@ public class VnfResource extends Resource { public void setModules(List<ModuleResource> moduleResources) {
this.vfModules = moduleResources;
}
+ public String getVnfHostname() {
+ return vnfHostname;
+ }
+ public void setVnfHostname(String vnfHostname) {
+ this.vnfHostname = vnfHostname;
+ }
@Deprecated
public void setVnfType(String vnfType) {
this.vnfType = vnfType;
@@ -96,10 +104,16 @@ public class VnfResource extends Resource { public void setNfNamingCode(String nfNamingCode) {
this.nfNamingCode = nfNamingCode;
}
+ public String getMultiStageDesign() {
+ return multiStageDesign;
+ }
+ public void setMultiStageDesign(String multiStageDesign) {
+ this.multiStageDesign = multiStageDesign;
+ }
/*
* GET accessors per design requirements
*/
-
+
/**
* Returns a list of all VfModule objects.
* Base module is first entry in the list
@@ -110,7 +124,7 @@ public class VnfResource extends Resource { if (vfModules == null) {
return null;
}
-
+
for (int i = 0; i < vfModules.size(); i++) {
ModuleResource moduleResource = vfModules.get(i);
if (moduleResource.getIsBase()){
@@ -120,17 +134,17 @@ public class VnfResource extends Resource { }
return vfModules;
}
-
+
/**
- *
+ *
* @return Returns JSON list of all VfModule structures.
*/
@JsonIgnore
public String getAllVfModulesJson(){
-
+
return listToJson(vfModules);
}
-
+
// methods to add to the list
public void addVfModule(ModuleResource moduleResource) {
if (vfModules == null){
@@ -138,12 +152,12 @@ public class VnfResource extends Resource { }
this.vfModules.add(moduleResource);
}
-
+
/**
- * Utility method to allow construction of the filed in the form of
+ * Utility method to allow construction of the filed in the form of
* <serviceResources.modelInfo.modelName>/<serviceVnfs.modelInfo.modelInstanceName>
- *
+ *
* default setter for this field deprecated
* @param modelName << serviceResources.modelInfo.modelName
*/
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java index dcd9e3b39a..8ab93f2842 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java @@ -20,16 +20,22 @@ package org.openecomp.mso.bpmn.core.json;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
+import java.io.Serializable;
+
import org.openecomp.mso.bpmn.core.domain.AllottedResource;
+import org.openecomp.mso.bpmn.core.domain.ConfigResource;
import org.openecomp.mso.bpmn.core.domain.NetworkResource;
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
import org.openecomp.mso.bpmn.core.domain.ServiceInstance;
import org.openecomp.mso.bpmn.core.domain.VnfResource;
-public class DecomposeJsonUtil {
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class DecomposeJsonUtil implements Serializable {
+
+ private static final long serialVersionUID = 1L;
private static final ObjectMapper OBJECT_MAPPER = createObjectMapper();
@@ -51,7 +57,10 @@ public class DecomposeJsonUtil { */
public static ServiceDecomposition jsonToServiceDecomposition(String jsonString) throws JsonDecomposingException {
try {
- return OBJECT_MAPPER.readValue(jsonString, ServiceDecomposition.class);
+ ObjectMapper om = new ObjectMapper();
+ om.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
+ om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ return om.readValue(jsonString, ServiceDecomposition.class);
} catch (IOException e) {
throw new JsonDecomposingException("Exception while converting json to service decomposition", e);
}
@@ -118,4 +127,12 @@ public class DecomposeJsonUtil { throw new JsonDecomposingException("Exception while converting json to allotted resource", e);
}
}
+
+ public static ConfigResource jsonToConfigResource(String jsonString) throws JsonDecomposingException {
+ try {
+ return OBJECT_MAPPER.readValue(jsonString, ConfigResource.class);
+ } catch (IOException e) {
+ throw new JsonDecomposingException("Exception while converting json to allotted resource", e);
+ }
+ }
}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java index bfad9bac26..79b9239015 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java @@ -21,27 +21,42 @@ package org.openecomp.mso.bpmn.core.json;
+import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.HashMap;
import java.util.StringTokenizer;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.runtime.Execution;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.XML;
-
+import org.openecomp.mso.apihandler.common.ValidationException;
//import org.openecomp.mso.bpmn.core.BPMNLogger;
import org.openecomp.mso.bpmn.core.xml.XmlTool;
import org.openecomp.mso.logger.MsoLogger;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.github.fge.jackson.JsonLoader;
+import com.github.fge.jsonschema.core.exceptions.ProcessingException;
+import com.github.fge.jsonschema.core.report.ProcessingReport;
+import com.github.fge.jsonschema.main.JsonSchemaFactory;
+import com.github.fge.jsonschema.main.JsonValidator;
+
/**
* Utility class for JSON processing
*
* @version 1.0
+ *
+ * Note: It was observed, that depending on the JSON implementation, an org.json.JSONException or a
+ * java.util.NoSuchElementException will be thrown in the event of the key value being "not found"
+ * in a JSON document. A general check has been added to the applicable catch blocks for this
+ * this type of behavior to reduce the amount of logging. As a key value not being found is
+ * expect behavior, it makes no sense to log the stack trace associated with this type of failure.
*/
public class JsonUtils {
@@ -117,7 +132,7 @@ public class JsonUtils { * to convert a JSONObject to an XML Doc. The intent of this is to
* correctly generate XML from JSON including TAGs for JSONArrays
*
- * @param obj object to be converted to XML
+ * @param obj org.json.JSON object to be converted to XML
* @param tagName optional XML tagname supplied primarily during recursive calls
* @return String containing the XML translation
*/
@@ -391,12 +406,12 @@ public class JsonUtils { msoLogger.debug("getJsonValue(): the raw value is an Integer Object=" + rawValue);
return (Integer) rawValue;
} else {
- msoLogger.debug("getJsonValue(): the raw value is NOT an Integer Object=" + rawValue.toString());
+ msoLogger.debug("getJsonIntValue(): the raw value is NOT an Integer Object=" + rawValue.toString());
return 0;
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e);
+ msoLogger.debug("getJsonIntValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e);
}
return 0;
}
@@ -416,15 +431,15 @@ public class JsonUtils { return false;
} else {
if (rawValue instanceof Boolean) {
- msoLogger.debug("getJsonValue(): the raw value is a Boolean Object=" + rawValue);
+ msoLogger.debug("getJsonBooleanValue(): the raw value is a Boolean Object=" + rawValue);
return (Boolean) rawValue;
} else {
- msoLogger.debug("getJsonValue(): the raw value is NOT an Boolean Object=" + rawValue.toString());
+ msoLogger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object=" + rawValue.toString());
return false;
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
+ msoLogger.debug("getJsonBooleanValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
}
return false;
}
@@ -472,7 +487,7 @@ public class JsonUtils { for (int i = 0; i < arrayLen; i++) {
msoLogger.debug("getJsonParamValue(): index: " + i + ", value: " + ((JSONArray) rawValue).get(i).toString());
if (((JSONArray) rawValue).get(i) instanceof JSONObject) {
- msoLogger.debug("getJsonParamValue(): index: " + i + " is a JSONObject");
+// msoLogger.debug("getJsonParamValue(): index: " + i + " is a JSONObject");
JSONObject jsonObj = (JSONObject)((JSONArray) rawValue).get(i);
String parmValue = jsonObj.get(name).toString();
if (parmValue != null) {
@@ -498,11 +513,13 @@ public class JsonUtils { return null;
}
}
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonParamValue(): caught JSONException attempting to retrieve param value for keys:" + keys + ", name=" + name, je);
} catch (Exception e) {
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("getJsonParamValue(): failed to retrieve param value for keys:" + keys + ", name=" + name + ": " + e.getMessage());
+ } else {
msoLogger.debug("getJsonParamValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e);
+ }
}
return null;
}
@@ -539,23 +556,25 @@ public class JsonUtils { String keyValue = null;
try {
if (jsonObj.has(key)) {
- msoLogger.debug("getJsonValueForKey(): found value for key=" + key);
Object value = jsonObj.get(key);
- if (value == null)
+ msoLogger.debug("getJsonValueForKey(): found value=" + (String) value + ", for key=" + key);
+ if (value == null) {
return null;
- else
+ } else {
return ((String) value);
+ }
} else {
- msoLogger.debug("getJsonValueForKey(): iterating over the keys");
+// msoLogger.debug("getJsonValueForKey(): iterating over the keys");
Iterator <String> itr = jsonObj.keys();
while (itr.hasNext()) {
String nextKey = itr.next();
Object obj = jsonObj.get(nextKey);
if (obj instanceof JSONObject) {
- msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
+// msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call on: " +
+// ((JSONObject) obj).toString(MSOJsonIndentFactor));
keyValue = getJsonValueForKey((JSONObject) obj, key);
if (keyValue != null) {
- msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key);
+// msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key);
break;
}
} else {
@@ -563,12 +582,14 @@ public class JsonUtils { }
}
}
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key, je);
- keyValue = null;
} catch (Exception e) {
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("getJsonValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage());
+ } else {
msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e);
+ }
+ keyValue = null;
}
return keyValue;
}
@@ -583,35 +604,38 @@ public class JsonUtils { */
public static Integer getJsonIntValueForKey(JSONObject jsonObj, String key) {
// String isDebugLogEnabled = "true";
- Integer keyValue = 0;
+ Integer keyValue = null;
try {
if (jsonObj.has(key)) {
- msoLogger.debug("getJsonValueForKey(): found value for key=" + key);
- return (Integer) jsonObj.get(key);
+ Integer value = (Integer) jsonObj.get(key);
+ msoLogger.debug("getJsonIntValueForKey(): found value=" + value + ", for key=" + key);
+ return value;
} else {
- msoLogger.debug("getJsonValueForKey(): iterating over the keys");
+// msoLogger.debug("getJsonIntValueForKey(): iterating over the keys");
Iterator <String> itr = jsonObj.keys();
while (itr.hasNext()) {
String nextKey = itr.next();
Object obj = jsonObj.get(nextKey);
if (obj instanceof JSONObject) {
- msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
+// msoLogger.debug("getJsonIntValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
keyValue = getJsonIntValueForKey((JSONObject) obj, key);
if (keyValue != null) {
- msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key);
+// msoLogger.debug("getJsonIntValueForKey(): found value=" + keyValue + ", for key=" + key);
break;
}
} else {
- msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key");
+ msoLogger.debug("getJsonIntValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key");
}
}
}
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key, je);
- keyValue = null;
} catch (Exception e) {
- msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e);
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("getJsonIntValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage());
+ } else {
+ msoLogger.debug("getJsonIntValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e);
+ }
+ keyValue = null;
}
return keyValue;
}
@@ -625,22 +649,23 @@ public class JsonUtils { * @return String field value associated with key
*/
public static Boolean getJsonBooleanValueForKey(JSONObject jsonObj, String key) {
- Boolean keyValue = false;
+ Boolean keyValue = null;
try {
if (jsonObj.has(key)) {
- msoLogger.debug("getJsonBooleanValueForKey(): found value for key=" + key);
- return (Boolean) jsonObj.get(key);
+ Boolean value = (Boolean) jsonObj.get(key);
+ msoLogger.debug("getJsonBooleanValueForKey(): found value=" + value + ", for key=" + key);
+ return value;
} else {
- msoLogger.debug("getJsonBooleanValueForKey(): iterating over the keys");
+// msoLogger.debug("getJsonBooleanValueForKey(): iterating over the keys");
Iterator <String> itr = jsonObj.keys();
while (itr.hasNext()) {
String nextKey = itr.next();
Object obj = jsonObj.get(nextKey);
if (obj instanceof JSONObject) {
- msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
+// msoLogger.debug("getJsonBooleanValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call");
keyValue = getJsonBooleanValueForKey((JSONObject) obj, key);
if (keyValue != null) {
- msoLogger.debug("getJsonBooleanValueForKey(): found value=" + keyValue + ", for key=" + key);
+// msoLogger.debug("getJsonBooleanValueForKey(): found value=" + keyValue + ", for key=" + key);
break;
}
} else {
@@ -648,12 +673,14 @@ public class JsonUtils { }
}
}
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonBooleanValueForKey(): caught JSONException attempting to retrieve value for key=" + key,je);
- keyValue = null;
} catch (Exception e) {
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("getJsonBooleanValueForKey(): failed to retrieve param value for key=" + key + ": " + e.getMessage());
+ } else {
msoLogger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e);
+ }
+ keyValue = null;
}
return keyValue;
}
@@ -773,7 +800,7 @@ public class JsonUtils { keyStr = keyTokens.nextToken();
Object keyValue = jsonObj.get(keyStr);
if (keyValue instanceof JSONObject) {
- msoLogger.debug("getJsonRawValue(): key=" + keyStr + " points to json object");
+// msoLogger.debug("getJsonRawValue(): key=" + keyStr + " points to json object");
jsonObj = (JSONObject) keyValue;
} else {
if (keyTokens.hasMoreElements()) {
@@ -795,11 +822,13 @@ public class JsonUtils { return jsonObj.toString();
}
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonRawValue(): caught JSONException attempting to retrieve raw value for key=" + keyStr,je);
} catch (Exception e) {
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("getJsonRawValue(): failed to retrieve param value for key=" + keyStr + ": " + e.getMessage());
+ } else {
msoLogger.debug("getJsonRawValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
+ }
}
return null;
}
@@ -823,7 +852,7 @@ public class JsonUtils { if (keyTokens.hasMoreElements()) {
Object keyValue = jsonObj.get(keyStr);
if (keyValue instanceof JSONObject) {
- msoLogger.debug("putJsonValue(): key=" + keyStr + " points to json object");
+// msoLogger.debug("putJsonValue(): key=" + keyStr + " points to json object");
jsonObj = (JSONObject) keyValue;
} else {
msoLogger.debug("putJsonValue(): key=" + keyStr + " not the last key but points to non-json object: " + keyValue);
@@ -837,12 +866,13 @@ public class JsonUtils { // should not hit this point if the key points to a valid key value
return null;
- } catch (JSONException je) {
- // JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("putJsonValue(): caught JSONException attempting to retrieve value for key=" + keyStr,je);
- return null;
} catch (Exception e) {
+ // JSONObject::get() throws a "not found" exception if one of the specified keys is not found
+ if (e.getMessage().contains("not found")) {
+ msoLogger.debug("putJsonValue(): failed to put param value for key=" + keyStr + ": " + e.getMessage());
+ } else {
msoLogger.debug("putJsonValue(): unable to parse json to put value for key=" + keys + ". Exception was: " + e.toString(),e);
+ }
}
return null;
}
@@ -856,23 +886,25 @@ public class JsonUtils { *
* @return Map - a Map containing the entries
*/
- public Map<String, String> entryArrayToMap(Execution execution, String entryArray) {
- msoLogger.debug("Started Entry Array To Map Util Method");
+ public Map<String, String> jsonStringToMap(DelegateExecution execution, String entry) {
+ msoLogger.debug("Started Json String To Map Method");
Map<String, String> map = new HashMap<>();
//Populate Map
- String entryListJson = "{ \"entry\":" + entryArray + "}";
- JSONObject obj = new JSONObject(entryListJson);
- JSONArray arr = obj.getJSONArray("entry");
- for (int i = 0; i < arr.length(); i++){
- JSONObject jo = arr.getJSONObject(i);
- String key = jo.getString("key");
- String value =jo.getString("value");
- map.put(key, value);
+ JSONObject obj = new JSONObject(entry);
+
+ /* Wildfly is pushing a version of org.json which does not
+ * auto cast to string. Leaving it as an object prevents
+ * a method not found exception at runtime.
+ */
+ final Iterator<String> keys = obj.keys();
+ while (keys.hasNext()) {
+ final String key = keys.next();
+ map.put(key, obj.getString(key));
}
msoLogger.debug("Outgoing Map is: " + map);
- msoLogger.debug("Completed Entry Array To Map Util Method");
+ msoLogger.debug("Completed Json String To Map Method");
return map;
}
@@ -888,14 +920,14 @@ public class JsonUtils { * @return Map - a Map containing the entries
*
*/
- public Map<String, String> entryArrayToMap(Execution execution, String entryArray, String keyNode, String valueNode) {
+ public Map<String, String> entryArrayToMap(DelegateExecution execution, String entryArray, String keyNode, String valueNode) {
msoLogger.debug("Started Entry Array To Map Util Method");
Map<String, String> map = new HashMap<>();
//Populate Map
- String entryListJson = "{ \"entry\":" + entryArray + "}";
+ String entryListJson = "{ \"wrapper\":" + entryArray + "}";
JSONObject obj = new JSONObject(entryListJson);
- JSONArray arr = obj.getJSONArray("entry");
+ JSONArray arr = obj.getJSONArray("wrapper");
for (int i = 0; i < arr.length(); i++){
JSONObject jo = arr.getJSONObject(i);
String key = jo.getString(keyNode);
@@ -961,4 +993,35 @@ public class JsonUtils { return true;
}
-}
\ No newline at end of file + /**
+ *
+ * Validates the JSON document against a schema file.
+ *
+ * @param jsonStr String containing the JSON doc
+ * @param jsonSchemaPath full path to a valid JSON schema file
+ * @return String the validation results/report
+ *
+ *
+ */
+ public static String jsonSchemaValidation(String jsonStr, String jsonSchemaPath) throws ValidationException {
+ try {
+ msoLogger.debug("JSON document to be validated: " + jsonStr);
+ JsonNode document = JsonLoader.fromString(jsonStr);
+// JsonNode document = JsonLoader.fromFile(jsonDoc);
+ JsonNode schema = JsonLoader.fromPath(jsonSchemaPath);
+
+ JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
+ JsonValidator validator = factory.getValidator();
+
+ ProcessingReport report = validator.validate(schema, document);
+ msoLogger.debug("JSON schema validation report: " + report.toString());
+ return report.toString();
+ } catch (IOException e) {
+ msoLogger.debug("IOException performing JSON schema validation on document: " + e.toString());
+ throw new ValidationException(e.getMessage());
+ } catch (ProcessingException e) {
+ msoLogger.debug("ProcessingException performing JSON schema validation on document: " + e.toString());
+ throw new ValidationException(e.getMessage());
+ }
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java index 2fe625849b..1efcf5f286 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java @@ -77,11 +77,11 @@ public abstract class JsonWrapper implements Serializable { public JSONObject toJsonObject() {
ObjectMapper mapper = new ObjectMapper();
- // mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ // mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
//mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- // mapper.enable(org.codehaus.jackson.map.DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ // mapper.enable(com.fasterxml.jackson.map.DeserializationFeature.UNWRAP_ROOT_VALUE);
JSONObject json = new JSONObject();
try {
json = new JSONObject(mapper.writeValueAsString(this));
@@ -128,4 +128,4 @@ public abstract class JsonWrapper implements Serializable { public String toString() {
return this.toJsonString();
}
-}
\ No newline at end of file +}
diff --git a/bpmn/MSOCoreBPMN/src/main/resources/normalize-namespaces.xsl b/bpmn/MSOCoreBPMN/src/main/resources/normalize-namespaces.xsl index 56c8a00987..6382bdb395 100644 --- a/bpmn/MSOCoreBPMN/src/main/resources/normalize-namespaces.xsl +++ b/bpmn/MSOCoreBPMN/src/main/resources/normalize-namespaces.xsl @@ -19,7 +19,7 @@ ============LICENSE_END========================================================= --> -<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" version="1.0" extension-element-prefixes="exsl"> +<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" version="2.0" extension-element-prefixes="exsl"> <!-- Select one namespace node for each unique URI (almost), excluding the implicit "xml" namespace. This does not filter out namespace diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java index 58f1ae264d..9643db7834 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java @@ -36,18 +36,24 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= - */ + */ package org.openecomp.mso.bpmn.core; -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + + +import static org.assertj.core.api.Assertions.assertThat; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; + +import org.json.JSONObject; +import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; +import org.openecomp.mso.apihandler.common.ValidationException; import org.openecomp.mso.bpmn.core.json.JsonUtils; import org.openecomp.mso.bpmn.core.xml.XmlTool; import org.xmlunit.builder.DiffBuilder; @@ -62,7 +68,7 @@ public class JsonUtilsTest { private static final String EOL = "\n"; private static final String XML_REQ = - "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL + + "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL + " <request-info>" + EOL + " <request-id>DEV-VF-0021</request-id>" + EOL + " <action>CREATE_VF_MODULE</action>" + EOL + @@ -91,9 +97,9 @@ public class JsonUtilsTest { " <param name=\"server\">server1111</param>" + EOL + " </vnf-params> " + EOL + "</vnf-request>" + EOL; - + private static final String XML_REQ_NO_ATTRS = - "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL + + "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL + " <source>PORTAL</source>" + EOL + @@ -114,49 +120,49 @@ public class JsonUtilsTest { "</vnf-request>" + EOL; private static final String XML_ARRAY_REQ = - "<ucpeInfo>" + EOL + + "<ucpeInfo>" + EOL + " <outOfBandManagementModem>BROADBAND</outOfBandManagementModem>" + EOL + - " <internetTopology>IVLAN</internetTopology>" + EOL + - " <ucpeAliasHostName>SHELLUCPE31</ucpeAliasHostName>" + EOL + - " <wanList>" + EOL + - " <wanInfo>" + EOL + - " <wanType>AVPN</wanType>" + EOL + - " <interfaceType>1000BASE-T</interfaceType>" + EOL + - " <transportProviderName>ATT</transportProviderName>" + EOL + - " <circuitId>BT/SLIR/70911</circuitId>" + EOL + - " <dualMode>Active</dualMode>" + EOL + - " <wanPortNumber>WAN1</wanPortNumber>" + EOL + - " <transportManagementOption>ATT</transportManagementOption>" + EOL + - " <transportVendorTotalBandwidth>100</transportVendorTotalBandwidth>" + EOL + - " <mediaType>ELECTRICAL</mediaType>" + EOL + - " </wanInfo>" + EOL + - " <wanInfo>" + EOL + - " <wanType>AVPN</wanType>" + EOL + - " <interfaceType>10/100/1000BASE-T</interfaceType>" + EOL + - " <transportProviderName>ATT</transportProviderName>" + EOL + - " <circuitId>AS/KRFN/34611</circuitId>" + EOL + - " <dualMode>Active</dualMode>" + EOL + - " <wanPortNumber>WAN2</wanPortNumber>" + EOL + - " <transportManagementOption>ATT</transportManagementOption>" + EOL + - " <transportVendorTotalBandwidth>10000</transportVendorTotalBandwidth>" + EOL + - " <mediaType>MMF</mediaType>" + EOL + - " </wanInfo>" + EOL + - " </wanList>" + EOL + - " <ucpeActivationCode>ASD-987-M31</ucpeActivationCode>" + EOL + - " <ucpeHostName>USOSTCDALTX0101UJZZ31</ucpeHostName>" + EOL + - " <ucpePartNumber>FG-VM00*</ucpePartNumber>" + EOL + + " <internetTopology>IVLAN</internetTopology>" + EOL + + " <ucpeAliasHostName>SHELLUCPE31</ucpeAliasHostName>" + EOL + + " <wanList>" + EOL + + " <wanInfo>" + EOL + + " <wanType>AVPN</wanType>" + EOL + + " <interfaceType>1000BASE-T</interfaceType>" + EOL + + " <transportProviderName>ATT</transportProviderName>" + EOL + + " <circuitId>BT/SLIR/70911</circuitId>" + EOL + + " <dualMode>Active</dualMode>" + EOL + + " <wanPortNumber>WAN1</wanPortNumber>" + EOL + + " <transportManagementOption>ATT</transportManagementOption>" + EOL + + " <transportVendorTotalBandwidth>100</transportVendorTotalBandwidth>" + EOL + + " <mediaType>ELECTRICAL</mediaType>" + EOL + + " </wanInfo>" + EOL + + " <wanInfo>" + EOL + + " <wanType>AVPN</wanType>" + EOL + + " <interfaceType>10/100/1000BASE-T</interfaceType>" + EOL + + " <transportProviderName>ATT</transportProviderName>" + EOL + + " <circuitId>AS/KRFN/34611</circuitId>" + EOL + + " <dualMode>Active</dualMode>" + EOL + + " <wanPortNumber>WAN2</wanPortNumber>" + EOL + + " <transportManagementOption>ATT</transportManagementOption>" + EOL + + " <transportVendorTotalBandwidth>10000</transportVendorTotalBandwidth>" + EOL + + " <mediaType>MMF</mediaType>" + EOL + + " </wanInfo>" + EOL + + " </wanList>" + EOL + + " <ucpeActivationCode>ASD-987-M31</ucpeActivationCode>" + EOL + + " <ucpeHostName>USOSTCDALTX0101UJZZ31</ucpeHostName>" + EOL + + " <ucpePartNumber>FG-VM00*</ucpePartNumber>" + EOL + "</ucpeInfo>"; // JSON request w/ embedded XML will be read from a file private static String jsonReq; private static String jsonReqArray; - + @BeforeClass public static void initialize() throws Exception { jsonReq = readFileToString("src/test/resources/request.json"); jsonReqArray = readFileToString("src/test/resources/requestArray.json"); - } - + } + private static String readFileToString(String path) throws IOException { File file = new File(path); return new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); @@ -164,16 +170,16 @@ public class JsonUtilsTest { @Test public void shouldConvertXmlToJsonAndBackToSameXml() throws Exception { - // Note: the current version of the JsonUtils.json2xml() method - // does not support converting the JSONObject representation - // of XML attributes (JSONArray) back to XML. So this test will - // only succeed if the original XML does not contain attributes - + // Note: the current version of the JsonUtils.json2xml() method + // does not support converting the JSONObject representation + // of XML attributes (JSONArray) back to XML. So this test will + // only succeed if the original XML does not contain attributes + // given String xmlIn = XmlTool.removeNamespaces(XML_REQ_NO_ATTRS); // when String json = JsonUtils.xml2json(XML_REQ_NO_ATTRS); - String xmlOut = JsonUtils.json2xml(json); + String xmlOut = JsonUtils.json2xml(json); // then Diff diffXml = DiffBuilder.compare(xmlIn).withTest(xmlOut).ignoreWhitespace() .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); @@ -233,7 +239,7 @@ public class JsonUtilsTest { assertThat(JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 2)) .withFailMessage("Expected null for index out of bound").isNull(); } - + @Test public void shouldAddJsonValue() throws Exception { // given @@ -259,7 +265,7 @@ public class JsonUtilsTest { // then String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); assertThat(extractedValue).isEqualTo(oldValue).isNotEqualTo(newValue); - } + } @Test public void shouldUpdateValueInJson() throws Exception { @@ -286,6 +292,11 @@ public class JsonUtilsTest { // then String extractedValue = JsonUtils.getJsonValue(jsonUpd, key); assertThat(extractedValue).isNotEqualTo(oldValue).isNull(); + JSONObject jsonObj = new JSONObject(json); + Integer intValue = JsonUtils.getJsonIntValueForKey(jsonObj, "persona-model-version"); + Assert.assertTrue(intValue == 1); + Boolean boolValue = JsonUtils.getJsonBooleanValueForKey(jsonObj, "is-base-module"); + Assert.assertTrue(boolValue); } @Test @@ -298,29 +309,48 @@ public class JsonUtilsTest { // then assertThat(jsonUpd).isEqualTo(json); } - + @Test public void shouldConvertXmlToJsonAndBackToSameXmlExtractedFromTheRequest() throws Exception { // given - String value = JsonUtils.getJsonValue(jsonReq, "variables.bpmnRequest.value"); - String xmlReq = XmlTool.removeNamespaces(XmlTool.normalize(value)); + String value = JsonUtils.getJsonValue(jsonReq, "variables.bpmnRequest.value"); + String xmlReq = XmlTool.removeNamespaces(XmlTool.normalize(value)); // when - String json = JsonUtils.xml2json(xmlReq); - String xmlOut = JsonUtils.json2xml(json); + String json = JsonUtils.xml2json(xmlReq); + String xmlOut = JsonUtils.json2xml(json); // then Diff diffXml = DiffBuilder.compare(xmlReq).withTest(xmlOut).ignoreWhitespace() .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); assertThat(diffXml.hasDifferences()).withFailMessage(diffXml.toString()).isFalse(); - } - + } + @Test public void shouldConvertJsonContainingArrayToXml() throws Exception { // when - String jsonParm = JsonUtils.getJsonNodeValue(jsonReqArray, "requestDetails.requestParameters.ucpeInfo"); - String xmlOut = JsonUtils.json2xml(jsonParm); + String jsonParm = JsonUtils.getJsonNodeValue(jsonReqArray, "requestDetails.requestParameters.ucpeInfo"); + String xmlOut = JsonUtils.json2xml(jsonParm); // then Diff diffXml = DiffBuilder.compare(XML_ARRAY_REQ).withTest(xmlOut).ignoreWhitespace() .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)).checkForSimilar().build(); assertThat(diffXml.hasDifferences()).withFailMessage(diffXml.toString()).isFalse(); } + + @Test + // Tests the jsonSchemaValidation() method + public void testJsonSchemaValidation() { + try { + String myReqArray = jsonReqArray; + String result = JsonUtils.jsonSchemaValidation(myReqArray, "src/test/resources/requestSchema.json"); + System.out.println("Schema Validation Result: " + result); + Assert.assertTrue(result.contains("success")); + // remove a required parameter from the JSON doc so that validation fails + myReqArray = JsonUtils.delJsonValue(myReqArray, "requestDetails.requestParameters.ucpeInfo.ucpeHostName"); + result = JsonUtils.jsonSchemaValidation(myReqArray, "src/test/resources/requestSchema.json"); + System.out.println("Schema Validation Result: " + result); + Assert.assertTrue(result.contains("failure")); + Assert.assertTrue(result.contains("error: object has missing required properties ([\"ucpeHostName\"])")); + } catch (ValidationException e) { + e.printStackTrace(); + } + } } diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java new file mode 100644 index 0000000000..7bb10007ac --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsTest.java @@ -0,0 +1,65 @@ +/*- + * ============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.openecomp.mso.bpmn.core.json; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Map; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Test; +import org.mockito.Mock; + +public class JsonUtilsTest { + + @Mock public DelegateExecution execution; + private final String fileLocation = "src/test/resources/json-examples/"; + + @Test + public void jsonStringToMapTest() throws IOException { + + JsonUtils utils = new JsonUtils(); + String response = this.getJson("SDNCServiceResponseExample.json"); + String entry = utils.getJsonValue(response, "SDNCServiceResponse.params"); + Map<String, String> map = utils.jsonStringToMap(execution, entry); + assertEquals(map.get("e2e-vpn-key"), "my-key"); + } + + @Test + public void entryArrayToMapTest() throws IOException { + JsonUtils utils = new JsonUtils(); + String response = this.getJson("SNIROExample.json"); + String entry = utils.getJsonValue(response, "solutionInfo.placementInfo"); + JSONArray arr = new JSONArray(entry); + JSONObject homingDataJson = arr.getJSONObject(0); + JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo"); + Map<String, String> map = utils.entryArrayToMap(execution, assignmentInfo.toString(), "variableName", "variableValue"); + assertEquals(map.get("cloudOwner"), "att-aic"); + } + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(fileLocation + filename))); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml b/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml index 3fa222988c..bc218f0125 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml +++ b/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml @@ -19,14 +19,6 @@ <property name="history" value="full" /> - <property name="customPostBPMNParseListeners"> - <list> - <bean class="org.camunda.bpm.engine.impl.bpmn.parser.FoxFailedJobParseListener" /> - </list> - </property> - - <property name="failedJobCommandFactory" ref="foxFailedJobCommandFactory" /> - <!--<property name="idGenerator" ref="uuidGenerator" />--> <!-- engine plugins --> @@ -46,8 +38,6 @@ <!-- Needed until all subflows generate MSOWorkflowException events --> <bean id="workflowExceptionPlugin" class="org.openecomp.mso.bpmn.core.plugins.WorkflowExceptionPlugin" /> - <bean id="foxFailedJobCommandFactory" class="org.camunda.bpm.engine.impl.jobexecutor.FoxFailedJobCommandFactory" /> - <!--<bean id="uuidGenerator" class="org.camunda.bpm.engine.impl.persistence.StrongUuidGenerator" />--> <!-- engine plugin beans --> diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SDNCServiceResponseExample.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SDNCServiceResponseExample.json new file mode 100644 index 0000000000..aefdfa8685 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SDNCServiceResponseExample.json @@ -0,0 +1,10 @@ +{ + "SDNCServiceResponse": { + "responseCode": "200", + "ackFinalIndicator": "Y", + "params": { + "e2e-vpn-key": "my-key" + }, + "sdncRequestId": "my-id" + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json new file mode 100644 index 0000000000..838bcd85a7 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/SNIROExample.json @@ -0,0 +1,163 @@ +{ + "solutionInfo": { + "licenseInfo": [ + { + "resourceModuleName": "vHNF for DHV Test_1 0", + "serviceResourceId": "eb05bdec-e815-40cd-99dd-7175f462d2ba", + "licenseKeyGroupList": [], + "entitlementPoolList": [ + "92718B2A0F91410B912F2A2C87AAA307", + "1EEF79979AD14EE498D31A7EF9DC9004" + ] + } + ], + "placementInfo": [ + { + "assignmentInfo": [ + { + "variableValue": "FRNKGE1A10", + "variableName": "aicClli" + }, + { + "variableValue": "3.0", + "variableName": "aicVersion" + }, + { + "variableValue": "att-aic", + "variableName": "cloudOwner" + } + ], + "inventoryType": "cloud", + "resourceModuleName": "Primary IP_Mux_Demux updated_1 0", + "serviceResourceId": "7d3d786b-ce6d-4498-813e-3e3028aebea8", + "cloudRegionId": "fnkge1a", + "serviceInstanceId": "" + }, + { + "assignmentInfo": [ + { + "variableValue": "MDTWNJ2B12", + "variableName": "aicClli" + }, + { + "variableValue": "vig20004vm002vig001", + "variableName": "vnfHostName" + }, + { + "variableValue": "3.0", + "variableName": "aicVersion" + }, + { + "variableValue": "att-aic", + "variableName": "cloudOwner" + }, + { + "variableValue": "vig20004vm002vig001", + "variableName": "vnfHostName" + } + ], + "inventoryType": "service", + "resourceModuleName": "Primary Tunnel_XConn for DHV Testing_1 0", + "serviceResourceId": "98fe07e7-4d9c-4f93-8138-18563c05a047", + "cloudRegionId": "mtrnj1b", + "serviceInstanceId": "519630c1-9b5c-45fb-8b84-3500ead7d77e" + }, + { + "assignmentInfo": [ + { + "variableValue": "FRNKGE1A10", + "variableName": "aicClli" + }, + { + "variableValue": "3.0", + "variableName": "aicVersion" + }, + { + "variableValue": "att-aic", + "variableName": "cloudOwner" + } + ], + "inventoryType": "cloud", + "resourceModuleName": "Secondary Service_Admin for DHV Test_1 1", + "serviceResourceId": "9a1abd7e-5afc-4e85-8f27-251454452350", + "cloudRegionId": "fnkge1a", + "serviceInstanceId": "" + }, + { + "assignmentInfo": [ + { + "variableValue": "FRNKGE1B10", + "variableName": "aicClli" + }, + { + "variableValue": "3.0", + "variableName": "aicVersion" + }, + { + "variableValue": "att-aic", + "variableName": "cloudOwner" + } + ], + "inventoryType": "cloud", + "resourceModuleName": "Primary Service_Admin for DHV Test_1 0", + "serviceResourceId": "11f557a2-72e3-4977-b2a3-5bf5d73e581c", + "cloudRegionId": "frkge1b", + "serviceInstanceId": "" + }, + { + "assignmentInfo": [ + { + "variableValue": "MDTWNJ2A22", + "variableName": "aicClli" + }, + { + "variableValue": "vig20004vm001vig001", + "variableName": "vnfHostName" + }, + { + "variableValue": "1.0", + "variableName": "aicVersion" + }, + { + "variableValue": "att-aic", + "variableName": "cloudOwner" + }, + { + "variableValue": "vig20004vm001vig001", + "variableName": "vnfHostName" + } + ], + "inventoryType": "service", + "resourceModuleName": "Secondary Tunnel_XConn for DHV Testing_1 1", + "serviceResourceId": "73f1b218-a062-43de-82ae-98682ca78392", + "cloudRegionId": "mtrn2", + "serviceInstanceId": "7b594c13-6b72-41bd-893a-2656f5dbb87a" + }, + { + "assignmentInfo": [ + { + "variableValue": "FRNKGE1B10", + "variableName": "aicClli" + }, + { + "variableValue": "3.0", + "variableName": "aicVersion" + }, + { + "variableValue": "att-aic", + "variableName": "cloudOwner" + } + ], + "inventoryType": "cloud", + "resourceModuleName": "Secondary IP_Mux_Demux updated_1 1", + "serviceResourceId": "20901d7f-4864-454b-99f1-5239fc353cfc", + "cloudRegionId": "frkge1b", + "serviceInstanceId": "" + } + ] + }, + "requestId": "90462920-208a-4e5e-bdf3-fcbe0454dde6", + "statusMessage": "", + "requestState": "done", + "transactionId": "" +}
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/test/resources/requestArray.json b/bpmn/MSOCoreBPMN/src/test/resources/requestArray.json index 238128865b..97a6359345 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/requestArray.json +++ b/bpmn/MSOCoreBPMN/src/test/resources/requestArray.json @@ -7,10 +7,10 @@ }, "modelInfo": { "modelType": "service", - "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", "modelName": "UCPE", - "modelVersion": 1 + "modelVersion": "1" }, "subscriberInfo": { "globalSubscriberId": "83031", diff --git a/bpmn/MSOCoreBPMN/src/test/resources/requestSchema.json b/bpmn/MSOCoreBPMN/src/test/resources/requestSchema.json new file mode 100644 index 0000000000..113528784b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/requestSchema.json @@ -0,0 +1,225 @@ +{ + "$schema":"http://json-schema.org/draft-03/schema#", + "type":"object", + "properties":{ + "requestDetails":{ + "properties":{ + "modelInfo":{ + "type":"object", + "required":true, + "properties":{ + "modelCustomizationId":{ + "type":"string", + "pattern":"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", + "required":false + }, + "modelCustomizationName":{ + "type":"string", + "required":false + }, + "modelInvariantId":{ + "type":"string", + "pattern":"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", + "required":true + }, + "modelVersionId":{ + "type":"string", + "pattern":"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", + "required":true + }, + "modelName":{ + "type":"string", + "required":true + }, + "modelType":{ + "type":"string", + "enum":[ + "service" + ], + "required":true + }, + "modelVersion":{ + "type":"string", + "required":true + } + } + }, + "requestInfo":{ + "type":"object", + "required":true, + "properties":{ + "billingAccountNumber":{ + "type":"string", + "required":false + }, + "callbackUrl":{ + "type":"string", + "required":true + }, + "correlator":{ + "type":"string", + "required":false + }, + "instanceName":{ + "type":"string", + "required":true + }, + "orderNumber":{ + "type":"string", + "required":false + }, + "orderVersion":{ + "type":"number", + "required":false + }, + "productFamilyId":{ + "type":"string", + "required":false + }, + "source":{ + "type":"string", + "required":true + }, + "suppressRollback":{ + "type":"boolean", + "required":false + } + } + }, + "subscriberInfo":{ + "type":"object", + "required":true, + "properties":{ + "globalSubscriberId":{ + "type":"string", + "required":true + }, + "subscriberCommonSiteId":{ + "type":"string", + "required":false + }, + "subscriberName":{ + "type":"string", + "required":true + } + } + }, + "requestParameters":{ + "type":"object", + "required":true, + "properties":{ + "ucpeInfo":{ + "type":"object", + "required":true, + "properties":{ + "internetTopology":{ + "type":"string", + "enum":[ + "IVLAN", + "LAN", + "WAN" + ], + "required":true + }, + "outOfBandManagementModem":{ + "type":"string", + "required":false + }, + "ucpeActivationCode":{ + "type":"string", + "required":true + }, + "ucpeAliasHostName":{ + "type":"string", + "required":false + }, + "ucpeHostName":{ + "type":"string", + "required":true + }, + "ucpePartNumber":{ + "type":"string", + "required":true + }, + "wanList":{ + "type":"array", + "required":true, + "items":{ + "type":"object", + "required":true, + "properties":{ + "wanInfo":{ + "type":"object", + "required":true, + "properties":{ + "circuitId":{ + "type":"string", + "required":false + }, + "dualMode":{ + "type":"string", + "enum":[ + "Active", + "Standby" + ], + "required":false + }, + "interfaceType":{ + "type":"string", + "required":false + }, + "mediaType":{ + "type":"string", + "enum":[ + "ELECTRICAL", + "MMF", + "SMF" + ], + "required":false + }, + "transportManagementOption":{ + "type":"string", + "required":false + }, + "transportProviderName":{ + "type":"string", + "required":false + }, + "transportVendorTotalBandwidth":{ + "type":"string", + "required":false + }, + "wanPortNumber":{ + "type":"string", + "enum":[ + "WAN1", + "WAN2" + ], + "required":true + }, + "wanType":{ + "type":"string", + "enum":[ + "3RDPARTYINTERNET", + "AVPN", + "AVPNIVLAN", + "GMIS", + "HSIA-E", + "MIS", + "PREMISESROUTER" + ], + "required":true + } + } + } + } + } + } + } + } + } + } + } + } + } +}
\ No newline at end of file |