summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTait,Trevor(rt0435) <rtait@amdocs.com>2018-10-26 13:27:54 -0400
committerLeigh, Phillip (pl876u) <phillip.leigh@amdocs.com>2018-10-26 15:28:46 -0400
commitf6a725a0b5b6864c09443e7f328927772a78ea05 (patch)
tree9a7aec7d4a93059e28ea1b15eee2576f1ad87c5a
parentb5f75d3996fbfd270e301abbe38766a9f6cf3a40 (diff)
SDNC context builder API Mapping Configuration
Issue-ID: LOG-421 Add code to use the VNF-API on SDNC where required. This involves using the api-mapping logic to select the VNF-API over the GNERIC-RESOURCES-API as well as adding the code to extract the information required by the VNF-API from AAI and adding the code to parse the VNF-API resonse into ModelContext. Change-Id: I4447a14d7fa39b2c5d9b655c2b20e651e56d3d77 Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
-rw-r--r--config/application.properties31
-rw-r--r--config/logback.xml18
-rw-r--r--config/rules/api-mapping-rules.drl4
-rw-r--r--config/sdncgenericresource.spec (renamed from config/sdnccontextbuilder.spec)20
-rw-r--r--config/vnflist.spec19
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/SdncConfiguration.java21
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/exception/AuditError.java26
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/exception/AuditException.java7
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/GenericResourceApiHandler.java6
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/VnfApiHandler.java109
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/AvailabilityZone.java89
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIp.java89
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIpV6.java89
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/OperStatus.java125
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelatedToProperty.java92
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Relationship.java122
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipDatum.java92
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipList.java82
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RequestInformation.java125
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/SdncRequestHeader.java125
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceData.java197
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceEntity.java9
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInformation.java143
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInstance.java212
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceStatus.java197
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModule.java211
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModules.java82
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmName.java89
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmNetwork.java181
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Vnf.java126
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfAssignments.java127
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfInstance.java438
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfList.java110
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfNetwork.java161
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfParameter.java107
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfRequestInformation.java233
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyIdentifier.java161
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyInformation.java127
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfVm.java146
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringService.java3
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringServiceImpl.java69
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestService.java33
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestServiceImpl.java19
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java334
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/AudutExceptionTest.java47
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/AvailabilityZoneTest.java50
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/NetworkIpTest.java50
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/NetworkIpV6Test.java50
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/OperStatusTest.java57
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelatedToPropertyTest.java57
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipDatumTest.java60
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipListTest.java102
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipTest.java88
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RequestInformationTest.java57
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/SdncRequestHeaderTest.java61
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceDataTest.java86
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceEntityTest.java44
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceInformationTest.java67
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceInstanceTest.java148
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceStatusTest.java83
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VfModuleTest.java149
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VfModulesTest.java58
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VmNameTest.java50
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VmNetworkTest.java81
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfAssignmentsTest.java66
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfInstanceTest.java253
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfListTest.java52
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfNetworkTest.java72
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfParameterTest.java54
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfRequestInformationTest.java93
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTest.java56
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyIdentifierTest.java72
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyInformationTest.java62
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfVmTest.java59
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdnc/unittest/service/SdncContextBuilderTest.java209
-rw-r--r--src/test/resources/junit/aaiResourcesData-1.json8
-rw-r--r--src/test/resources/junit/customerData.json (renamed from src/test/resources/junit/customerData-1.json)0
-rw-r--r--src/test/resources/junit/customerDataCustomerIdNotFound.json (renamed from src/test/resources/junit/customerData-CustomerIdNotFound.json)0
-rw-r--r--src/test/resources/junit/genericVnf.json100
-rw-r--r--src/test/resources/junit/queryNodeDataNullResourceLink.json (renamed from src/test/resources/junit/queryNodeData-nullResourceLink.json)0
-rw-r--r--src/test/resources/junit/queryNodeDataVcpe.json9
-rw-r--r--src/test/resources/junit/queryNodeDataVfw.json (renamed from src/test/resources/junit/queryNodeData-1.json)0
-rw-r--r--src/test/resources/junit/sdncGenericResponse.json (renamed from src/test/resources/sdncResponse.json)0
-rw-r--r--src/test/resources/junit/serviceInstance.json66
-rw-r--r--src/test/resources/junit/vnfApiResponse.json187
85 files changed, 7445 insertions, 224 deletions
diff --git a/config/application.properties b/config/application.properties
index 8fc2503..6084aa0 100644
--- a/config/application.properties
+++ b/config/application.properties
@@ -1,27 +1,10 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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=====================================================
- */
spring.jersey.type=filter
spring.mvc.urls=swagger,docs,prometheus,auditevents,info,heapdump,autoconfig,beans,loggers,dump,env,trace,health,configprops,mappings,metrics,webjars
camel.springboot.xmlRoutes = file:config/dynamic/routes/*.route
service.xml.beans = config/dynamic/conf/*.xml
-server.contextPath=/sdnccontextbuilder/v1
+server.contextPath=/sdnccontextbuilder
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
#This property is used to set the Tomcat connector attributes.developers can define multiple attributes separated by comma
@@ -36,21 +19,22 @@ sdncCtxBuilder.userId=admin
sdncCtxBuilder.password=OBF:1u2a1toa1w8v1tok1u30
# SDNC REST Client Configuration
-sdnc.serviceName=10.69.100.139
-sdnc.servicePort=30202
+sdnc.serviceName=10.147.112.136
+sdnc.servicePort=9506
sdnc.httpProtocol=http
sdnc.user=admin
sdnc.password=OBF:1ks51l8d1o3i1pcc1r2r1e211r391kls1pyj1z7u1njf1lx51go21hnj1y0k1mli1sop1k8o1j651vu91mxw1vun1mze1vv11j8x1k5i1sp11mjc1y161hlr1gm41m111nkj1z781pw31kku1r4p1e391r571pbm1o741l4x1ksp
sdnc.connectionTimeout=5000
sdnc.readTimeout=1000
sdnc.genericResourcePath=/restconf/config/GENERIC-RESOURCE-API:services/service/{0}
+sdnc.vnfPath=/restconf/config/VNF-API:vnfs/vnf-list/{0}
#Servlet context parameters
server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
# AAI REST Client Configuration
-aai.serviceName=10.12.6.120
-aai.servicePort=30233
+aai.serviceName=10.147.112.136
+aai.servicePort=9507
aai.username=AAI
aai.password=OBF:1gfr1ev31gg7
aai.httpProtocol=https
@@ -63,4 +47,7 @@ aai.http.password=OBF:1u2a1toa1w8v1tok1u30
aai.searchNodeQuery=/aai/v11/search/nodes-query?search-node-type=service-instance&filter=service-instance-id:EQUALS:
aai.customerQuery=/aai/v11/business/customers/customer/
+aai.serviceInstancePath=/aai/v11/business/customers/customer/{0}/service-subscriptions/service-subscription/{1}/service-instances/service-instance/{2}
+
+
diff --git a/config/logback.xml b/config/logback.xml
index 2f53172..8074057 100644
--- a/config/logback.xml
+++ b/config/logback.xml
@@ -1,21 +1,3 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * 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=====================================================
- */
-
<configuration>
<property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>
<property name="p_lvl" value="%level"/>
diff --git a/config/rules/api-mapping-rules.drl b/config/rules/api-mapping-rules.drl
index 6278d48..629d683 100644
--- a/config/rules/api-mapping-rules.drl
+++ b/config/rules/api-mapping-rules.drl
@@ -23,7 +23,7 @@ rule "ApiMapping-1"
no-loop true
lock-on-active true
when
- $s : ServiceEntity( serviceType not contains "vFW" )
+ $s : ServiceEntity( (serviceType not contains "vFW") && (serviceType not contains "vDNS") )
then
$s.setApiName("GENERIC-RESOURCE-API");
end
@@ -33,7 +33,7 @@ rule "ApiMapping-2"
no-loop true
lock-on-active true
when
- $s : ServiceEntity( serviceType contains "vFW" )
+ $s : ServiceEntity( (serviceType contains "vFW") || (serviceType contains "vDNS") )
then
$s.setApiName("VNF-API");
end
diff --git a/config/sdnccontextbuilder.spec b/config/sdncgenericresource.spec
index 1f15b22..652afb9 100644
--- a/config/sdnccontextbuilder.spec
+++ b/config/sdncgenericresource.spec
@@ -3,7 +3,7 @@
// any changes to this file
{
- // This section converts the updated json from service-decompostion
+ // This section converts the GENERIC-RESOURCES-API response from sdnc
// to org.onap.pomba.common.datatypes.ModelContext
"operation": "shift",
"spec": {
@@ -67,6 +67,24 @@
}
}
}
+ },
+ "networks": {
+ "network": {
+ "*": {
+ "network-data": {
+ "network-topology": {
+ "onap-model-information": {
+ "model-uuid": "vfList[0].vfModuleList[0].networkList[&4].uuid",
+ "model-invariant-uuid": "vfList[0].vfModuleList[0].networkList[&4].invariantUUID"
+ },
+ "network-topology-identifier-structure": {
+ "network-type": "vfList[0].vfModuleList[0].networkList[&4].type",
+ "network-name": "vfList[0].vfModuleList[0].networkList[&4].name"
+ }
+ }
+ }
+ }
+ }
}
}
}
diff --git a/config/vnflist.spec b/config/vnflist.spec
new file mode 100644
index 0000000..49c2434
--- /dev/null
+++ b/config/vnflist.spec
@@ -0,0 +1,19 @@
+[
+ // Use https://jolt-demo.appspot.com/#inception to develop/test
+ // any changes to this file
+
+ {
+ // This section converts aai response for GET VNF-API from SDNC
+ // to org.onap.pomba.common.datatypes.VF
+ "operation": "shift",
+ "spec": {
+ "vnfs": {
+ "vnf-list": {
+ "*": {
+ "*": "vnf-list[&1].&"
+ }
+ }
+ }
+ }
+ }
+ ]
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/SdncConfiguration.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/SdncConfiguration.java
index 71c3502..7180c0b 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/SdncConfiguration.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/SdncConfiguration.java
@@ -21,10 +21,10 @@ package org.onap.pomba.contextbuilder.sdnc;
import java.util.Base64;
import javax.ws.rs.ApplicationPath;
import org.eclipse.jetty.util.security.Password;
+import org.onap.aai.restclient.client.RestClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
-import org.onap.aai.restclient.client.RestClient;
@Component
@ApplicationPath("/")
@@ -54,16 +54,24 @@ public class SdncConfiguration {
@Value("${sdnc.genericResourcePath}")
private String genericResourcePath;
+ @Value("${sdnc.vnfPath}")
+ private String vnfPath;
+
@Bean(name="sdncBaseUrl")
public String getURL() {
return httpProtocol + "://" + serviceName + ":" + servicePort;
}
@Bean(name="sdncGenericResourcePath")
- public String getgenericResourcePath() {
+ public String getGenericResourcePath() {
return genericResourcePath;
}
+ @Bean(name="sdncVnfPath")
+ public String getVnfPath() {
+ return vnfPath;
+ }
+
@Bean(name = "sdncBasicAuthorization")
public String getSdncBasicAuth() {
String auth = this.user + ":"+ Password.deobfuscate(this.password);
@@ -98,6 +106,10 @@ public class SdncConfiguration {
@Value("${aai.customerQuery}")
private String aaiCustomerQuery;
+ @Value("${aai.serviceInstancePath}")
+ private String serviceInstancePath;
+
+
@Bean(name="aaiHttpBasicAuthorization")
public String getHttpBasicAuth() {
String auth = new String(this.aaiHttpUserId + ":" + Password.deobfuscate(this.aaiHttpPassword));
@@ -138,4 +150,9 @@ public class SdncConfiguration {
return aaiCustomerQuery.trim();
}
+ @Bean(name="aaiServiceInstancePath")
+ public String getserviceInstancePathL() {
+ return serviceInstancePath;
+ }
+
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/exception/AuditError.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/exception/AuditError.java
new file mode 100644
index 0000000..f4caafe
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/exception/AuditError.java
@@ -0,0 +1,26 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.exception;
+
+public class AuditError {
+
+ public static final String INTERNAL_SERVER_ERROR = "Internal Server Error";
+ public static final String JSON_PARSE_ERROR = "Json Parse Error ";
+ public static final String JSON_EMPTY_RESPONSE = "Json Empty Response ";
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/exception/AuditException.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/exception/AuditException.java
index 63137a1..9c7348f 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/exception/AuditException.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/exception/AuditException.java
@@ -26,7 +26,6 @@ public class AuditException extends Exception {
private Status httpStatus;
-
public AuditException(String message) {
super(message);
}
@@ -36,6 +35,10 @@ public class AuditException extends Exception {
this.setHttpStatus(httpStatus);
}
+ public AuditException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
public Status getHttpStatus() {
return httpStatus;
}
@@ -43,4 +46,6 @@ public class AuditException extends Exception {
public void setHttpStatus(Status httpStatus) {
this.httpStatus = httpStatus;
}
+
+
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/GenericResourceApiHandler.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/GenericResourceApiHandler.java
index 885c923..09e1d6b 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/GenericResourceApiHandler.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/GenericResourceApiHandler.java
@@ -43,11 +43,11 @@ public class GenericResourceApiHandler {
@Autowired
private String sdncGenericResourcePath;
-
+ private String specPath = "config/sdncgenericresource.spec";
public ModelContext process(Exchange exchange) throws Exception {
- ModelContext context;
+ ModelContext context = new ModelContext();
log.info("in GENERIC-RESOURCE-API HANDLER: ");
ServiceEntity serviceEntity = (ServiceEntity)exchange.getIn().getBody();
@@ -55,7 +55,7 @@ public class GenericResourceApiHandler {
try {
String sdncResponse = RestUtil.getSdncGenericResource(jerseyClient, sdncBaseUrl, sdncBasicAuthorization, sdncGenericResourcePath, serviceInstanceId);
- context = RestUtil.transform(sdncResponse);
+ context = RestUtil.transformGenericResource(sdncResponse, specPath);
} catch (AuditException ae) {
throw ae;
} catch (Exception e) {
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/VnfApiHandler.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/VnfApiHandler.java
index bfedf69..bdc08d0 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/VnfApiHandler.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/VnfApiHandler.java
@@ -18,35 +18,134 @@
package org.onap.pomba.contextbuilder.sdnc.handlers;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.core.MediaType;
import org.apache.camel.Exchange;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.onap.aai.restclient.client.RestClient;
import org.onap.pomba.common.datatypes.ModelContext;
import org.onap.pomba.common.datatypes.Service;
+import org.onap.pomba.contextbuilder.sdnc.exception.AuditError;
+import org.onap.pomba.contextbuilder.sdnc.exception.AuditException;
import org.onap.pomba.contextbuilder.sdnc.model.ServiceEntity;
+import org.onap.pomba.contextbuilder.sdnc.model.Vnf;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfInstance;
+import org.onap.pomba.contextbuilder.sdnc.util.RestUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class VnfApiHandler {
private static Logger log = LoggerFactory.getLogger(VnfApiHandler.class);
+ @Autowired
+ private String aaiBasicAuthorization;
+ @Autowired
+ private RestClient aaiClient;
+ @Autowired
+ private String aaiBaseUrl;
+ @Autowired
+ private String aaiServiceInstancePath;
+ @Autowired
+ private Client jerseyClient;
+ @Autowired
+ private String sdncBaseUrl;
+ @Autowired
+ private String sdncBasicAuthorization;
+ @Autowired
+ private String sdncVnfPath;
+
+ private static final String JSON_RELATIONSHIP_LIST = "relationship-list";
+ private static final String JSON_RELATIONSHIP = "relationship";
+ private static final String JSON_RELATED_TO = "related-to";
+ private static final String JSON_RELATED_LINK = "related-link";
+ private static final String JSON_GENERIC_VNF = "generic-vnf";
+ private static final String EMPTY_JSON_STRING = "{}";
public ModelContext process(Exchange exchange) throws Exception {
log.info("in VNF-API HANDLER: ");
-
-// dummy population of the model context
-// The following lines should be replaced with the logic of calling to SDN-C VNF-API
-// and transforming the response into common model
ModelContext context = new ModelContext();
Service service = new Service();
ServiceEntity serviceEntity = (ServiceEntity)exchange.getIn().getBody();
+ service.setUuid(serviceEntity.getServiceInstanceId());
service.setName( serviceEntity.getServiceType() + " service instance");
+
+ // GET the list of VNF related-to links from AAI
+ String url= aaiBaseUrl+generateServiceInstanceURL(aaiServiceInstancePath, serviceEntity.getCustomerId(), serviceEntity.getServiceType(), serviceEntity.getServiceInstanceId());
+ String serviceInstancePayload = RestUtil.getAaiResource(aaiClient, url, aaiBasicAuthorization, serviceEntity.getTransactionId(), MediaType.valueOf(MediaType.APPLICATION_JSON));
+ List<String> genericVnfLinks = extractGenericVnfRelatedLink(serviceInstancePayload);
+
+ // GET the VNF list (module-id) from AAI
+ List <VnfInstance> vnfList = retrieveAaiVnfList(aaiClient, aaiBaseUrl, aaiBasicAuthorization, serviceEntity.getTransactionId(), genericVnfLinks);
+
+
+ // GET the module-id from SDNC using VNF-API
+ Map<String,List<Vnf>> sdncVnfMap = RestUtil.getSdncVnfList(jerseyClient, sdncBaseUrl, sdncVnfPath,
+ sdncBasicAuthorization, vnfList);
+
+ // Transform the AAI and SDNC models to the audit common model
+ context = RestUtil.transformVnfList(vnfList, sdncVnfMap);
+
context.setService(service);
-// end dummy code
return context;
}
+ private static String generateServiceInstanceURL(String siPath, String customerId, String serviceType, String serviceInstanceId) {
+ return MessageFormat.format(siPath, customerId, serviceType, serviceInstanceId);
+ }
+
+ /*
+ * Extract the generic-vnf related-linkfrom Json payload. For example
+ * {
+ * "related-to": "generic-vnf",
+ * "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/d94daff6-7d5b-4d2e-bc99-c9af0754b59d",
+ * }
+ */
+ private static List<String> extractGenericVnfRelatedLink(String serviceInstancePayload) throws AuditException {
+ List<String> genericVnfLinks = new ArrayList<String>();;
+ try {
+ JSONObject relationshipList = new JSONObject(serviceInstancePayload).getJSONObject(JSON_RELATIONSHIP_LIST);
+ JSONArray relationship = relationshipList.getJSONArray(JSON_RELATIONSHIP);
+ if (relationship != null) {
+ for (int i = 0; i < relationship.length(); i++) {
+ JSONObject relationshipInstance = relationship.optJSONObject(i);
+ if (relationshipInstance.has(JSON_RELATED_TO) && (relationshipInstance.getString(JSON_RELATED_TO).equals(JSON_GENERIC_VNF))) {
+ genericVnfLinks.add(relationshipInstance.getString(JSON_RELATED_LINK));
+ }
+ }
+ }
+ } catch (JSONException e) {
+ log.error(e.getMessage());
+ throw new AuditException(AuditError.JSON_PARSE_ERROR + e.getMessage());
+ }
+ return genericVnfLinks;
+ }
+
+ private static List<VnfInstance> retrieveAaiVnfList(RestClient aaiClient, String aaiBaseUrl, String aaiBasicAuthorization, String transactionId, List <String>genericVnfLinks) throws AuditException {
+ List<VnfInstance> vnfList = new ArrayList<VnfInstance>();
+ for (String genericVnfLink : genericVnfLinks) {
+ String genericVnfUrl = RestUtil.generateAaiUrl(aaiBaseUrl, genericVnfLink, null);
+ String genericVnfPayload = RestUtil.getAaiResource(aaiClient, genericVnfUrl, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ if (genericVnfPayload.equals(EMPTY_JSON_STRING)) {
+ log.info("retrieveAaiVnfList "+ genericVnfPayload +" is not found, " + "return empty Json ");
+ } else {
+ // Create the AAI VnfInstance from the AAI generic-vnf json
+ VnfInstance vnfInstance = VnfInstance.fromJson(genericVnfPayload);
+ vnfList.add(vnfInstance);
+ }
+ }
+ log.debug("The size of vnfList:"+ vnfList.size());
+ return vnfList;
+ }
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/AvailabilityZone.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/AvailabilityZone.java
new file mode 100644
index 0000000..6cd70e6
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/AvailabilityZone.java
@@ -0,0 +1,89 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class AvailabilityZone {
+
+ @SerializedName("availability-zone")
+ @Expose
+ private String availabilityZone;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public AvailabilityZone() {
+ }
+
+ /**
+ *
+ * @param availabilityZone
+ */
+ public AvailabilityZone(String availabilityZone) {
+ super();
+ this.availabilityZone = availabilityZone;
+ }
+
+ public String getAvailabilityZone() {
+ return availabilityZone;
+ }
+
+ public void setAvailabilityZone(String availabilityZone) {
+ this.availabilityZone = availabilityZone;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(AvailabilityZone.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("availabilityZone");
+ sb.append('=');
+ sb.append(((this.availabilityZone == null)?"<null>":this.availabilityZone));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.availabilityZone == null)? 0 :this.availabilityZone.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof AvailabilityZone) == false) {
+ return false;
+ }
+ AvailabilityZone rhs = ((AvailabilityZone) other);
+ return ((this.availabilityZone == rhs.availabilityZone)||((this.availabilityZone!= null)&&this.availabilityZone.equals(rhs.availabilityZone)));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIp.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIp.java
new file mode 100644
index 0000000..dca49f6
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIp.java
@@ -0,0 +1,89 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class NetworkIp {
+
+ @SerializedName("ip-address")
+ @Expose
+ private String ipAddress;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public NetworkIp() {
+ }
+
+ /**
+ *
+ * @param ipAddress
+ */
+ public NetworkIp(String ipAddress) {
+ super();
+ this.ipAddress = ipAddress;
+ }
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(NetworkIp.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("ipAddress");
+ sb.append('=');
+ sb.append(((this.ipAddress == null)?"<null>":this.ipAddress));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.ipAddress == null)? 0 :this.ipAddress.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof NetworkIp) == false) {
+ return false;
+ }
+ NetworkIp rhs = ((NetworkIp) other);
+ return ((this.ipAddress == rhs.ipAddress)||((this.ipAddress!= null)&&this.ipAddress.equals(rhs.ipAddress)));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIpV6.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIpV6.java
new file mode 100644
index 0000000..bb0245a
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIpV6.java
@@ -0,0 +1,89 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class NetworkIpV6 {
+
+ @SerializedName("ip-address-ipv6")
+ @Expose
+ private String ipAddressIpV6;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public NetworkIpV6() {
+ }
+
+ /**
+ *
+ * @param ipAddressIpV6
+ */
+ public NetworkIpV6(String ipAddressIpV6) {
+ super();
+ this.ipAddressIpV6 = ipAddressIpV6;
+ }
+
+ public String getIpAddressIpV6() {
+ return ipAddressIpV6;
+ }
+
+ public void setIpAddressIpV6(String ipAddressIpV6) {
+ this.ipAddressIpV6 = ipAddressIpV6;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(NetworkIpV6 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("ipAddressIpV6");
+ sb.append('=');
+ sb.append(((this.ipAddressIpV6 == null)?"<null>":this.ipAddressIpV6));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.ipAddressIpV6 == null)? 0 :this.ipAddressIpV6 .hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof NetworkIpV6) == false) {
+ return false;
+ }
+ NetworkIpV6 rhs = ((NetworkIpV6) other);
+ return ((this.ipAddressIpV6 == rhs.ipAddressIpV6)||((this.ipAddressIpV6 != null)&&this.ipAddressIpV6 .equals(rhs.ipAddressIpV6)));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/OperStatus.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/OperStatus.java
new file mode 100644
index 0000000..127b521
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/OperStatus.java
@@ -0,0 +1,125 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class OperStatus {
+
+ @SerializedName("last-action")
+ @Expose
+ private String lastAction;
+ @SerializedName("order-status")
+ @Expose
+ private String orderStatus;
+ @SerializedName("last-order-status")
+ @Expose
+ private String lastOrderStatus;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public OperStatus() {
+ }
+
+ /**
+ *
+ * @param orderStatus
+ * @param lastAction
+ * @param lastOrderStatus
+ */
+ public OperStatus(String lastAction, String orderStatus, String lastOrderStatus) {
+ super();
+ this.lastAction = lastAction;
+ this.orderStatus = orderStatus;
+ this.lastOrderStatus = lastOrderStatus;
+ }
+
+ public String getLastAction() {
+ return lastAction;
+ }
+
+ public void setLastAction(String lastAction) {
+ this.lastAction = lastAction;
+ }
+
+ public String getOrderStatus() {
+ return orderStatus;
+ }
+
+ public void setOrderStatus(String orderStatus) {
+ this.orderStatus = orderStatus;
+ }
+
+ public String getLastOrderStatus() {
+ return lastOrderStatus;
+ }
+
+ public void setLastOrderStatus(String lastOrderStatus) {
+ this.lastOrderStatus = lastOrderStatus;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(OperStatus.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("lastAction");
+ sb.append('=');
+ sb.append(((this.lastAction == null)?"<null>":this.lastAction));
+ sb.append(',');
+ sb.append("orderStatus");
+ sb.append('=');
+ sb.append(((this.orderStatus == null)?"<null>":this.orderStatus));
+ sb.append(',');
+ sb.append("lastOrderStatus");
+ sb.append('=');
+ sb.append(((this.lastOrderStatus == null)?"<null>":this.lastOrderStatus));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.orderStatus == null)? 0 :this.orderStatus.hashCode()));
+ result = ((result* 31)+((this.lastAction == null)? 0 :this.lastAction.hashCode()));
+ result = ((result* 31)+((this.lastOrderStatus == null)? 0 :this.lastOrderStatus.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof OperStatus) == false) {
+ return false;
+ }
+ OperStatus rhs = ((OperStatus) other);
+ return ((((this.orderStatus == rhs.orderStatus)||((this.orderStatus!= null)&&this.orderStatus.equals(rhs.orderStatus)))&&((this.lastAction == rhs.lastAction)||((this.lastAction!= null)&&this.lastAction.equals(rhs.lastAction))))&&((this.lastOrderStatus == rhs.lastOrderStatus)||((this.lastOrderStatus!= null)&&this.lastOrderStatus.equals(rhs.lastOrderStatus))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelatedToProperty.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelatedToProperty.java
new file mode 100644
index 0000000..f64d2a3
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelatedToProperty.java
@@ -0,0 +1,92 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+public class RelatedToProperty {
+
+ @SerializedName("property-key")
+ @Expose
+ private String propertyKey;
+ @SerializedName("property-value")
+ @Expose
+ private String propertyValue;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public RelatedToProperty() {
+ }
+
+ /**
+ *
+ * @param propertyKey
+ * @param propertyValue
+ */
+ public RelatedToProperty(String propertyKey, String propertyValue) {
+ super();
+ this.propertyKey = propertyKey;
+ this.propertyValue = propertyValue;
+ }
+
+ public String getPropertyKey() {
+ return propertyKey;
+ }
+
+ public void setPropertyKey(String propertyKey) {
+ this.propertyKey = propertyKey;
+ }
+
+ public String getPropertyValue() {
+ return propertyValue;
+ }
+
+ public void setPropertyValue(String propertyValue) {
+ this.propertyValue = propertyValue;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("propertyKey", propertyKey).append("propertyValue", propertyValue).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(propertyKey).append(propertyValue).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof RelatedToProperty) == false) {
+ return false;
+ }
+ RelatedToProperty rhs = ((RelatedToProperty) other);
+ return new EqualsBuilder().append(propertyKey, rhs.propertyKey).append(propertyValue, rhs.propertyValue).isEquals();
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Relationship.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Relationship.java
new file mode 100644
index 0000000..74637b5
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Relationship.java
@@ -0,0 +1,122 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import java.util.List;
+import javax.validation.Valid;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+public class Relationship {
+
+ @SerializedName("related-to")
+ @Expose
+ private String relatedTo;
+ @SerializedName("related-link")
+ @Expose
+ private String relatedLink;
+ @SerializedName("relationship-data")
+ @Expose
+ @Valid
+ private List<RelationshipDatum> relationshipData = null;
+ @SerializedName("related-to-property")
+ @Expose
+ @Valid
+ private List<RelatedToProperty> relatedToProperty = null;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public Relationship() {
+ }
+
+ /**
+ *
+ * @param relatedToProperty
+ * @param relatedLink
+ * @param relationshipData
+ * @param relatedTo
+ */
+ public Relationship(String relatedTo, String relatedLink, List<RelationshipDatum> relationshipData, List<RelatedToProperty> relatedToProperty) {
+ super();
+ this.relatedTo = relatedTo;
+ this.relatedLink = relatedLink;
+ this.relationshipData = relationshipData;
+ this.relatedToProperty = relatedToProperty;
+ }
+
+ public String getRelatedTo() {
+ return relatedTo;
+ }
+
+ public void setRelatedTo(String relatedTo) {
+ this.relatedTo = relatedTo;
+ }
+
+ public String getRelatedLink() {
+ return relatedLink;
+ }
+
+ public void setRelatedLink(String relatedLink) {
+ this.relatedLink = relatedLink;
+ }
+
+ public List<RelationshipDatum> getRelationshipData() {
+ return relationshipData;
+ }
+
+ public void setRelationshipData(List<RelationshipDatum> relationshipData) {
+ this.relationshipData = relationshipData;
+ }
+
+ public List<RelatedToProperty> getRelatedToProperty() {
+ return relatedToProperty;
+ }
+
+ public void setRelatedToProperty(List<RelatedToProperty> relatedToProperty) {
+ this.relatedToProperty = relatedToProperty;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("relatedTo", relatedTo).append("relatedLink", relatedLink).append("relationshipData", relationshipData).append("relatedToProperty", relatedToProperty).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(relatedToProperty).append(relatedLink).append(relationshipData).append(relatedTo).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof Relationship) == false) {
+ return false;
+ }
+ Relationship rhs = ((Relationship) other);
+ return new EqualsBuilder().append(relatedToProperty, rhs.relatedToProperty).append(relatedLink, rhs.relatedLink).append(relationshipData, rhs.relationshipData).append(relatedTo, rhs.relatedTo).isEquals();
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipDatum.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipDatum.java
new file mode 100644
index 0000000..5a0756d
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipDatum.java
@@ -0,0 +1,92 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+public class RelationshipDatum {
+
+ @SerializedName("relationship-key")
+ @Expose
+ private String relationshipKey;
+ @SerializedName("relationship-value")
+ @Expose
+ private String relationshipValue;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public RelationshipDatum() {
+ }
+
+ /**
+ *
+ * @param relationshipValue
+ * @param relationshipKey
+ */
+ public RelationshipDatum(String relationshipKey, String relationshipValue) {
+ super();
+ this.relationshipKey = relationshipKey;
+ this.relationshipValue = relationshipValue;
+ }
+
+ public String getRelationshipKey() {
+ return relationshipKey;
+ }
+
+ public void setRelationshipKey(String relationshipKey) {
+ this.relationshipKey = relationshipKey;
+ }
+
+ public String getRelationshipValue() {
+ return relationshipValue;
+ }
+
+ public void setRelationshipValue(String relationshipValue) {
+ this.relationshipValue = relationshipValue;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("relationshipKey", relationshipKey).append("relationshipValue", relationshipValue).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(relationshipValue).append(relationshipKey).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof RelationshipDatum) == false) {
+ return false;
+ }
+ RelationshipDatum rhs = ((RelationshipDatum) other);
+ return new EqualsBuilder().append(relationshipValue, rhs.relationshipValue).append(relationshipKey, rhs.relationshipKey).isEquals();
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipList.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipList.java
new file mode 100644
index 0000000..a57e02c
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipList.java
@@ -0,0 +1,82 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import java.util.List;
+import javax.validation.Valid;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+public class RelationshipList {
+
+ @SerializedName("relationship")
+ @Expose
+ @Valid
+ private List<Relationship> relationship = null;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public RelationshipList() {
+ }
+
+ /**
+ *
+ * @param relationship
+ */
+ public RelationshipList(List<Relationship> relationship) {
+ super();
+ this.relationship = relationship;
+ }
+
+ public List<Relationship> getRelationship() {
+ return relationship;
+ }
+
+ public void setRelationship(List<Relationship> relationship) {
+ this.relationship = relationship;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("relationship", relationship).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(relationship).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof RelationshipList) == false) {
+ return false;
+ }
+ RelationshipList rhs = ((RelationshipList) other);
+ return new EqualsBuilder().append(relationship, rhs.relationship).isEquals();
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RequestInformation.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RequestInformation.java
new file mode 100644
index 0000000..f556845
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RequestInformation.java
@@ -0,0 +1,125 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class RequestInformation {
+
+ @SerializedName("request-id")
+ @Expose
+ private String requestId;
+ @SerializedName("source")
+ @Expose
+ private String source;
+ @SerializedName("request-action")
+ @Expose
+ private String requestAction;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public RequestInformation() {
+ }
+
+ /**
+ *
+ * @param requestAction
+ * @param source
+ * @param requestId
+ */
+ public RequestInformation(String requestId, String source, String requestAction) {
+ super();
+ this.requestId = requestId;
+ this.source = source;
+ this.requestAction = requestAction;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public String getRequestAction() {
+ return requestAction;
+ }
+
+ public void setRequestAction(String requestAction) {
+ this.requestAction = requestAction;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(RequestInformation.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("requestId");
+ sb.append('=');
+ sb.append(((this.requestId == null)?"<null>":this.requestId));
+ sb.append(',');
+ sb.append("source");
+ sb.append('=');
+ sb.append(((this.source == null)?"<null>":this.source));
+ sb.append(',');
+ sb.append("requestAction");
+ sb.append('=');
+ sb.append(((this.requestAction == null)?"<null>":this.requestAction));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.requestAction == null)? 0 :this.requestAction.hashCode()));
+ result = ((result* 31)+((this.source == null)? 0 :this.source.hashCode()));
+ result = ((result* 31)+((this.requestId == null)? 0 :this.requestId.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof RequestInformation) == false) {
+ return false;
+ }
+ RequestInformation rhs = ((RequestInformation) other);
+ return ((((this.requestAction == rhs.requestAction)||((this.requestAction!= null)&&this.requestAction.equals(rhs.requestAction)))&&((this.source == rhs.source)||((this.source!= null)&&this.source.equals(rhs.source))))&&((this.requestId == rhs.requestId)||((this.requestId!= null)&&this.requestId.equals(rhs.requestId))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/SdncRequestHeader.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/SdncRequestHeader.java
new file mode 100644
index 0000000..b483da4
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/SdncRequestHeader.java
@@ -0,0 +1,125 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class SdncRequestHeader {
+
+ @SerializedName("svc-notification-url")
+ @Expose
+ private String svcNotificationUrl;
+ @SerializedName("svc-request-id")
+ @Expose
+ private String svcRequestId;
+ @SerializedName("svc-action")
+ @Expose
+ private String svcAction;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public SdncRequestHeader() {
+ }
+
+ /**
+ *
+ * @param svcRequestId
+ * @param svcNotificationUrl
+ * @param svcAction
+ */
+ public SdncRequestHeader(String svcNotificationUrl, String svcRequestId, String svcAction) {
+ super();
+ this.svcNotificationUrl = svcNotificationUrl;
+ this.svcRequestId = svcRequestId;
+ this.svcAction = svcAction;
+ }
+
+ public String getSvcNotificationUrl() {
+ return svcNotificationUrl;
+ }
+
+ public void setSvcNotificationUrl(String svcNotificationUrl) {
+ this.svcNotificationUrl = svcNotificationUrl;
+ }
+
+ public String getSvcRequestId() {
+ return svcRequestId;
+ }
+
+ public void setSvcRequestId(String svcRequestId) {
+ this.svcRequestId = svcRequestId;
+ }
+
+ public String getSvcAction() {
+ return svcAction;
+ }
+
+ public void setSvcAction(String svcAction) {
+ this.svcAction = svcAction;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(SdncRequestHeader.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("svcNotificationUrl");
+ sb.append('=');
+ sb.append(((this.svcNotificationUrl == null)?"<null>":this.svcNotificationUrl));
+ sb.append(',');
+ sb.append("svcRequestId");
+ sb.append('=');
+ sb.append(((this.svcRequestId == null)?"<null>":this.svcRequestId));
+ sb.append(',');
+ sb.append("svcAction");
+ sb.append('=');
+ sb.append(((this.svcAction == null)?"<null>":this.svcAction));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.svcNotificationUrl == null)? 0 :this.svcNotificationUrl.hashCode()));
+ result = ((result* 31)+((this.svcAction == null)? 0 :this.svcAction.hashCode()));
+ result = ((result* 31)+((this.svcRequestId == null)? 0 :this.svcRequestId.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof SdncRequestHeader) == false) {
+ return false;
+ }
+ SdncRequestHeader rhs = ((SdncRequestHeader) other);
+ return ((((this.svcNotificationUrl == rhs.svcNotificationUrl)||((this.svcNotificationUrl!= null)&&this.svcNotificationUrl.equals(rhs.svcNotificationUrl)))&&((this.svcAction == rhs.svcAction)||((this.svcAction!= null)&&this.svcAction.equals(rhs.svcAction))))&&((this.svcRequestId == rhs.svcRequestId)||((this.svcRequestId!= null)&&this.svcRequestId.equals(rhs.svcRequestId))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceData.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceData.java
new file mode 100644
index 0000000..0f745fc
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceData.java
@@ -0,0 +1,197 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class ServiceData {
+
+ @SerializedName("request-information")
+ @Expose
+ private RequestInformation requestInformation;
+ @SerializedName("service-information")
+ @Expose
+ private ServiceInformation serviceInformation;
+ @SerializedName("vnf-id")
+ @Expose
+ private String vnfId;
+ @SerializedName("sdnc-request-header")
+ @Expose
+ private SdncRequestHeader sdncRequestHeader;
+ @SerializedName("vnf-request-information")
+ @Expose
+ private VnfRequestInformation vnfRequestInformation;
+ @SerializedName("oper-status")
+ @Expose
+ private OperStatus operStatus;
+ @SerializedName("vnf-topology-information")
+ @Expose
+ private VnfTopologyInformation vnfTopologyInformation;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public ServiceData() {
+ }
+
+ /**
+ *
+ * @param vnfRequestInformation
+ * @param vnfTopologyInformation
+ * @param erviceInformation
+ * @param sdncRequestHeader
+ * @param vnfId
+ * @param requestInformation
+ * @param operStatus
+ */
+ public ServiceData(RequestInformation requestInformation, ServiceInformation serviceInformation, String vnfId, SdncRequestHeader sdncRequestHeader, VnfRequestInformation vnfRequestInformation, OperStatus operStatus, VnfTopologyInformation vnfTopologyInformation) {
+ super();
+ this.requestInformation = requestInformation;
+ this.serviceInformation = serviceInformation;
+ this.vnfId = vnfId;
+ this.sdncRequestHeader = sdncRequestHeader;
+ this.vnfRequestInformation = vnfRequestInformation;
+ this.operStatus = operStatus;
+ this.vnfTopologyInformation = vnfTopologyInformation;
+ }
+
+ public RequestInformation getRequestInformation() {
+ return requestInformation;
+ }
+
+ public void setRequestInformation(RequestInformation requestInformation) {
+ this.requestInformation = requestInformation;
+ }
+
+ public ServiceInformation getServiceInformation() {
+ return serviceInformation;
+ }
+
+ public void setServiceInformation(ServiceInformation serviceInformation) {
+ this.serviceInformation = serviceInformation;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public SdncRequestHeader getSdncRequestHeader() {
+ return sdncRequestHeader;
+ }
+
+ public void setSdncRequestHeader(SdncRequestHeader sdncRequestHeader) {
+ this.sdncRequestHeader = sdncRequestHeader;
+ }
+
+ public VnfRequestInformation getVnfRequestInformation() {
+ return vnfRequestInformation;
+ }
+
+ public void setVnfRequestInformation(VnfRequestInformation vnfRequestInformation) {
+ this.vnfRequestInformation = vnfRequestInformation;
+ }
+
+ public OperStatus getOperStatus() {
+ return operStatus;
+ }
+
+ public void setOperStatus(OperStatus operStatus) {
+ this.operStatus = operStatus;
+ }
+
+ public VnfTopologyInformation getVnfTopologyInformation() {
+ return vnfTopologyInformation;
+ }
+
+ public void setVnfTopologyInformation(VnfTopologyInformation vnfTopologyInformation) {
+ this.vnfTopologyInformation = vnfTopologyInformation;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(ServiceData.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("requestInformation");
+ sb.append('=');
+ sb.append(((this.requestInformation == null)?"<null>":this.requestInformation));
+ sb.append(',');
+ sb.append("erviceInformation");
+ sb.append('=');
+ sb.append(((this.serviceInformation == null)?"<null>":this.serviceInformation));
+ sb.append(',');
+ sb.append("vnfId");
+ sb.append('=');
+ sb.append(((this.vnfId == null)?"<null>":this.vnfId));
+ sb.append(',');
+ sb.append("sdncRequestHeader");
+ sb.append('=');
+ sb.append(((this.sdncRequestHeader == null)?"<null>":this.sdncRequestHeader));
+ sb.append(',');
+ sb.append("vnfRequestInformation");
+ sb.append('=');
+ sb.append(((this.vnfRequestInformation == null)?"<null>":this.vnfRequestInformation));
+ sb.append(',');
+ sb.append("operStatus");
+ sb.append('=');
+ sb.append(((this.operStatus == null)?"<null>":this.operStatus));
+ sb.append(',');
+ sb.append("vnfTopologyInformation");
+ sb.append('=');
+ sb.append(((this.vnfTopologyInformation == null)?"<null>":this.vnfTopologyInformation));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.vnfRequestInformation == null)? 0 :this.vnfRequestInformation.hashCode()));
+ result = ((result* 31)+((this.vnfTopologyInformation == null)? 0 :this.vnfTopologyInformation.hashCode()));
+ result = ((result* 31)+((this.serviceInformation == null)? 0 :this.serviceInformation.hashCode()));
+ result = ((result* 31)+((this.sdncRequestHeader == null)? 0 :this.sdncRequestHeader.hashCode()));
+ result = ((result* 31)+((this.vnfId == null)? 0 :this.vnfId.hashCode()));
+ result = ((result* 31)+((this.requestInformation == null)? 0 :this.requestInformation.hashCode()));
+ result = ((result* 31)+((this.operStatus == null)? 0 :this.operStatus.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof ServiceData) == false) {
+ return false;
+ }
+ ServiceData rhs = ((ServiceData) other);
+ return ((((((((this.vnfRequestInformation == rhs.vnfRequestInformation)||((this.vnfRequestInformation!= null)&&this.vnfRequestInformation.equals(rhs.vnfRequestInformation)))&&((this.vnfTopologyInformation == rhs.vnfTopologyInformation)||((this.vnfTopologyInformation!= null)&&this.vnfTopologyInformation.equals(rhs.vnfTopologyInformation))))&&((this.serviceInformation == rhs.serviceInformation)||((this.serviceInformation!= null)&&this.serviceInformation.equals(rhs.serviceInformation))))&&((this.sdncRequestHeader == rhs.sdncRequestHeader)||((this.sdncRequestHeader!= null)&&this.sdncRequestHeader.equals(rhs.sdncRequestHeader))))&&((this.vnfId == rhs.vnfId)||((this.vnfId!= null)&&this.vnfId.equals(rhs.vnfId))))&&((this.requestInformation == rhs.requestInformation)||((this.requestInformation!= null)&&this.requestInformation.equals(rhs.requestInformation))))&&((this.operStatus == rhs.operStatus)||((this.operStatus!= null)&&this.operStatus.equals(rhs.operStatus))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceEntity.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceEntity.java
index 2f08533..6af0746 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceEntity.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceEntity.java
@@ -25,6 +25,7 @@ public class ServiceEntity {
private String apiName;
private String serviceInstanceId;
private String customerId;
+ private String transactionId;
public String getCustomerId() {
return customerId;
@@ -70,4 +71,12 @@ public class ServiceEntity {
this.apiName = apiName;
}
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(String transactionId) {
+ this.transactionId = transactionId;
+ }
+
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInformation.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInformation.java
new file mode 100644
index 0000000..f289f76
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInformation.java
@@ -0,0 +1,143 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class ServiceInformation {
+
+ @SerializedName("service-id")
+ @Expose
+ private String serviceId;
+ @SerializedName("service-type")
+ @Expose
+ private String serviceType;
+ @SerializedName("subscriber-name")
+ @Expose
+ private String subscriberName;
+ @SerializedName("serviceInstanceId")
+ @Expose
+ private String serviceInstanceId;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public ServiceInformation() {
+ }
+
+ /**
+ *
+ * @param serviceType
+ * @param serviceId
+ * @param subscriberName
+ * @param serviceInstanceId
+ */
+ public ServiceInformation(String serviceId, String serviceType, String subscriberName, String serviceInstanceId) {
+ super();
+ this.serviceId = serviceId;
+ this.serviceType = serviceType;
+ this.subscriberName = subscriberName;
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ public void setSubscriberName(String subscriberName) {
+ this.subscriberName = subscriberName;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(ServiceInformation.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("serviceId");
+ sb.append('=');
+ sb.append(((this.serviceId == null)?"<null>":this.serviceId));
+ sb.append(',');
+ sb.append("serviceType");
+ sb.append('=');
+ sb.append(((this.serviceType == null)?"<null>":this.serviceType));
+ sb.append(',');
+ sb.append("subscriberName");
+ sb.append('=');
+ sb.append(((this.subscriberName == null)?"<null>":this.subscriberName));
+ sb.append(',');
+ sb.append("serviceInstanceId");
+ sb.append('=');
+ sb.append(((this.serviceInstanceId == null)?"<null>":this.serviceInstanceId));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.serviceType == null)? 0 :this.serviceType.hashCode()));
+ result = ((result* 31)+((this.subscriberName == null)? 0 :this.subscriberName.hashCode()));
+ result = ((result* 31)+((this.serviceInstanceId == null)? 0 :this.serviceInstanceId.hashCode()));
+ result = ((result* 31)+((this.serviceId == null)? 0 :this.serviceId.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof ServiceInformation) == false) {
+ return false;
+ }
+ ServiceInformation rhs = ((ServiceInformation) other);
+ return (((((this.serviceType == rhs.serviceType)||((this.serviceType!= null)&&this.serviceType.equals(rhs.serviceType)))&&((this.subscriberName == rhs.subscriberName)||((this.subscriberName!= null)&&this.subscriberName.equals(rhs.subscriberName))))&&((this.serviceInstanceId == rhs.serviceInstanceId)||((this.serviceInstanceId!= null)&&this.serviceInstanceId.equals(rhs.serviceInstanceId))))&&((this.serviceId == rhs.serviceId)||((this.serviceId!= null)&&this.serviceId.equals(rhs.serviceId))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInstance.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInstance.java
new file mode 100644
index 0000000..2844814
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInstance.java
@@ -0,0 +1,212 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import javax.validation.Valid;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+public class ServiceInstance {
+
+ @SerializedName("service-instance-id")
+ @Expose
+ private String serviceInstanceId;
+ @SerializedName("service-instance-name")
+ @Expose
+ private String serviceInstanceName;
+ @SerializedName("service-type")
+ @Expose
+ private String serviceType;
+ @SerializedName("service-role")
+ @Expose
+ private String serviceRole;
+ @SerializedName("environment-context")
+ @Expose
+ private String environmentContext;
+ @SerializedName("workload-context")
+ @Expose
+ private String workloadContext;
+ @SerializedName("model-invariant-id")
+ @Expose
+ private String modelInvariantId;
+ @SerializedName("model-version-id")
+ @Expose
+ private String modelVersionId;
+ @SerializedName("resource-version")
+ @Expose
+ private String resourceVersion;
+ @SerializedName("orchestration-status")
+ @Expose
+ private String orchestrationStatus;
+ @SerializedName("relationship-list")
+ @Expose
+ @Valid
+ private RelationshipList relationshipList;
+
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public ServiceInstance() {
+ }
+
+ /**
+ *
+ * @param serviceRole
+ * @param serviceInstanceName
+ * @param orchestrationStatus
+ * @param serviceType
+ * @param modelInvariantId
+ * @param workloadContext
+ * @param environmentContext
+ * @param resourceVersion
+ * @param relationshipList
+ * @param modelVersionId
+ * @param serviceInstanceId
+ */
+ public ServiceInstance(String serviceInstanceId, String serviceInstanceName, String serviceType, String serviceRole, String environmentContext, String workloadContext, String modelInvariantId, String modelVersionId, String resourceVersion, String orchestrationStatus, RelationshipList relationshipList) {
+ super();
+ this.serviceInstanceId = serviceInstanceId;
+ this.serviceInstanceName = serviceInstanceName;
+ this.serviceType = serviceType;
+ this.serviceRole = serviceRole;
+ this.environmentContext = environmentContext;
+ this.workloadContext = workloadContext;
+ this.modelInvariantId = modelInvariantId;
+ this.modelVersionId = modelVersionId;
+ this.resourceVersion = resourceVersion;
+ this.orchestrationStatus = orchestrationStatus;
+ this.relationshipList = relationshipList;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ 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;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("serviceInstanceName", serviceInstanceName).append("serviceType", serviceType).append("serviceRole", serviceRole).append("environmentContext", environmentContext).append("workloadContext", workloadContext).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("resourceVersion", resourceVersion).append("orchestrationStatus", orchestrationStatus).append("relationshipList", relationshipList).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(serviceRole).append(serviceInstanceName).append(orchestrationStatus).append(serviceType).append(modelInvariantId).append(workloadContext).append(environmentContext).append(resourceVersion).append(relationshipList).append(modelVersionId).append(serviceInstanceId).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof ServiceInstance) == false) {
+ return false;
+ }
+ ServiceInstance rhs = ((ServiceInstance) other);
+ return new EqualsBuilder().append(serviceRole, rhs.serviceRole).append(serviceInstanceName, rhs.serviceInstanceName).append(orchestrationStatus, rhs.orchestrationStatus).append(serviceType, rhs.serviceType).append(modelInvariantId, rhs.modelInvariantId).append(workloadContext, rhs.workloadContext).append(environmentContext, rhs.environmentContext).append(resourceVersion, rhs.resourceVersion).append(relationshipList, rhs.relationshipList).append(modelVersionId, rhs.modelVersionId).append(serviceInstanceId, rhs.serviceInstanceId).isEquals();
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceStatus.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceStatus.java
new file mode 100644
index 0000000..a60dd61
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceStatus.java
@@ -0,0 +1,197 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class ServiceStatus {
+
+ @SerializedName("response-timestamp")
+ @Expose
+ private String responseTimestamp;
+ @SerializedName("vnfsdn-action")
+ @Expose
+ private String vnfsdnAction;
+ @SerializedName("rpc-action")
+ @Expose
+ private String rpcAction;
+ @SerializedName("rpc-name")
+ @Expose
+ private String rpcName;
+ @SerializedName("response-code")
+ @Expose
+ private String responseCode;
+ @SerializedName("final-indicator")
+ @Expose
+ private String finalIndicator;
+ @SerializedName("request-status")
+ @Expose
+ private String requestStatus;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public ServiceStatus() {
+ }
+
+ /**
+ *
+ * @param requestStatus
+ * @param responseTimestamp
+ * @param responseCode
+ * @param vnfsdnAction
+ * @param rpcAction
+ * @param rpcName
+ * @param finalIndicator
+ */
+ public ServiceStatus(String responseTimestamp, String vnfsdnAction, String rpcAction, String rpcName, String responseCode, String finalIndicator, String requestStatus) {
+ super();
+ this.responseTimestamp = responseTimestamp;
+ this.vnfsdnAction = vnfsdnAction;
+ this.rpcAction = rpcAction;
+ this.rpcName = rpcName;
+ this.responseCode = responseCode;
+ this.finalIndicator = finalIndicator;
+ this.requestStatus = requestStatus;
+ }
+
+ public String getResponseTimestamp() {
+ return responseTimestamp;
+ }
+
+ public void setResponseTimestamp(String responseTimestamp) {
+ this.responseTimestamp = responseTimestamp;
+ }
+
+ public String getVnfsdnAction() {
+ return vnfsdnAction;
+ }
+
+ public void setVnfsdnAction(String vnfsdnAction) {
+ this.vnfsdnAction = vnfsdnAction;
+ }
+
+ public String getRpcAction() {
+ return rpcAction;
+ }
+
+ public void setRpcAction(String rpcAction) {
+ this.rpcAction = rpcAction;
+ }
+
+ public String getRpcName() {
+ return rpcName;
+ }
+
+ public void setRpcName(String rpcName) {
+ this.rpcName = rpcName;
+ }
+
+ public String getResponseCode() {
+ return responseCode;
+ }
+
+ public void setResponseCode(String responseCode) {
+ this.responseCode = responseCode;
+ }
+
+ public String getFinalIndicator() {
+ return finalIndicator;
+ }
+
+ public void setFinalIndicator(String finalIndicator) {
+ this.finalIndicator = finalIndicator;
+ }
+
+ public String getRequestStatus() {
+ return requestStatus;
+ }
+
+ public void setRequestStatus(String requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(ServiceStatus.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("responseTimestamp");
+ sb.append('=');
+ sb.append(((this.responseTimestamp == null)?"<null>":this.responseTimestamp));
+ sb.append(',');
+ sb.append("vnfsdnAction");
+ sb.append('=');
+ sb.append(((this.vnfsdnAction == null)?"<null>":this.vnfsdnAction));
+ sb.append(',');
+ sb.append("rpcAction");
+ sb.append('=');
+ sb.append(((this.rpcAction == null)?"<null>":this.rpcAction));
+ sb.append(',');
+ sb.append("rpcName");
+ sb.append('=');
+ sb.append(((this.rpcName == null)?"<null>":this.rpcName));
+ sb.append(',');
+ sb.append("responseCode");
+ sb.append('=');
+ sb.append(((this.responseCode == null)?"<null>":this.responseCode));
+ sb.append(',');
+ sb.append("finalIndicator");
+ sb.append('=');
+ sb.append(((this.finalIndicator == null)?"<null>":this.finalIndicator));
+ sb.append(',');
+ sb.append("requestStatus");
+ sb.append('=');
+ sb.append(((this.requestStatus == null)?"<null>":this.requestStatus));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.requestStatus == null)? 0 :this.requestStatus.hashCode()));
+ result = ((result* 31)+((this.responseTimestamp == null)? 0 :this.responseTimestamp.hashCode()));
+ result = ((result* 31)+((this.responseCode == null)? 0 :this.responseCode.hashCode()));
+ result = ((result* 31)+((this.vnfsdnAction == null)? 0 :this.vnfsdnAction.hashCode()));
+ result = ((result* 31)+((this.rpcAction == null)? 0 :this.rpcAction.hashCode()));
+ result = ((result* 31)+((this.rpcName == null)? 0 :this.rpcName.hashCode()));
+ result = ((result* 31)+((this.finalIndicator == null)? 0 :this.finalIndicator.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof ServiceStatus) == false) {
+ return false;
+ }
+ ServiceStatus rhs = ((ServiceStatus) other);
+ return ((((((((this.requestStatus == rhs.requestStatus)||((this.requestStatus!= null)&&this.requestStatus.equals(rhs.requestStatus)))&&((this.responseTimestamp == rhs.responseTimestamp)||((this.responseTimestamp!= null)&&this.responseTimestamp.equals(rhs.responseTimestamp))))&&((this.responseCode == rhs.responseCode)||((this.responseCode!= null)&&this.responseCode.equals(rhs.responseCode))))&&((this.vnfsdnAction == rhs.vnfsdnAction)||((this.vnfsdnAction!= null)&&this.vnfsdnAction.equals(rhs.vnfsdnAction))))&&((this.rpcAction == rhs.rpcAction)||((this.rpcAction!= null)&&this.rpcAction.equals(rhs.rpcAction))))&&((this.rpcName == rhs.rpcName)||((this.rpcName!= null)&&this.rpcName.equals(rhs.rpcName))))&&((this.finalIndicator == rhs.finalIndicator)||((this.finalIndicator!= null)&&this.finalIndicator.equals(rhs.finalIndicator))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModule.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModule.java
new file mode 100644
index 0000000..8cb614e
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModule.java
@@ -0,0 +1,211 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import javax.validation.Valid;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+public class VfModule {
+
+ @SerializedName("vf-module-id")
+ @Expose
+ private String vfModuleId;
+ @SerializedName("vf-module-name")
+ @Expose
+ private String vfModuleName;
+ @SerializedName("heat-stack-id")
+ @Expose
+ private String heatStackId;
+ @SerializedName("orchestration-status")
+ @Expose
+ private String orchestrationStatus;
+ @SerializedName("is-base-vf-module")
+ @Expose
+ private Boolean isBaseVfModule;
+ @SerializedName("resource-version")
+ @Expose
+ private String resourceVersion;
+ @SerializedName("model-invariant-id")
+ @Expose
+ private String modelInvariantId;
+ @SerializedName("model-version-id")
+ @Expose
+ private String modelVersionId;
+ @SerializedName("model-customization-id")
+ @Expose
+ private String modelCustomizationId;
+ @SerializedName("module-index")
+ @Expose
+ private Integer moduleIndex;
+ @SerializedName("relationship-list")
+ @Expose
+ @Valid
+ private RelationshipList relationshipList;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VfModule() {
+ }
+
+ /**
+ *
+ * @param modelCustomizationId
+ * @param moduleIndex
+ * @param vfModuleName
+ * @param orchestrationStatus
+ * @param vfModuleId
+ * @param modelInvariantId
+ * @param heatStackId
+ * @param isBaseVfModule
+ * @param resourceVersion
+ * @param relationshipList
+ * @param modelVersionId
+ */
+ public VfModule(String vfModuleId, String vfModuleName, String heatStackId, String orchestrationStatus, Boolean isBaseVfModule, String resourceVersion, String modelInvariantId, String modelVersionId, String modelCustomizationId, Integer moduleIndex, RelationshipList relationshipList) {
+ super();
+ this.vfModuleId = vfModuleId;
+ this.vfModuleName = vfModuleName;
+ this.heatStackId = heatStackId;
+ this.orchestrationStatus = orchestrationStatus;
+ this.isBaseVfModule = isBaseVfModule;
+ this.resourceVersion = resourceVersion;
+ this.modelInvariantId = modelInvariantId;
+ this.modelVersionId = modelVersionId;
+ this.modelCustomizationId = modelCustomizationId;
+ this.moduleIndex = moduleIndex;
+ this.relationshipList = relationshipList;
+ }
+
+ public String getVfModuleId() {
+ return vfModuleId;
+ }
+
+ public void setVfModuleId(String vfModuleId) {
+ this.vfModuleId = vfModuleId;
+ }
+
+ 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 String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ public Boolean getIsBaseVfModule() {
+ return isBaseVfModule;
+ }
+
+ public void setIsBaseVfModule(Boolean isBaseVfModule) {
+ this.isBaseVfModule = isBaseVfModule;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ public Integer getModuleIndex() {
+ return moduleIndex;
+ }
+
+ public void setModuleIndex(Integer moduleIndex) {
+ this.moduleIndex = moduleIndex;
+ }
+
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("vfModuleId", vfModuleId).append("vfModuleName", vfModuleName).append("heatStackId", heatStackId).append("orchestrationStatus", orchestrationStatus).append("isBaseVfModule", isBaseVfModule).append("resourceVersion", resourceVersion).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("modelCustomizationId", modelCustomizationId).append("moduleIndex", moduleIndex).append("relationshipList", relationshipList).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationId).append(moduleIndex).append(vfModuleName).append(orchestrationStatus).append(vfModuleId).append(modelInvariantId).append(heatStackId).append(isBaseVfModule).append(resourceVersion).append(relationshipList).append(modelVersionId).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VfModule) == false) {
+ return false;
+ }
+ VfModule rhs = ((VfModule) other);
+ return new EqualsBuilder().append(modelCustomizationId, rhs.modelCustomizationId).append(moduleIndex, rhs.moduleIndex).append(vfModuleName, rhs.vfModuleName).append(orchestrationStatus, rhs.orchestrationStatus).append(vfModuleId, rhs.vfModuleId).append(modelInvariantId, rhs.modelInvariantId).append(heatStackId, rhs.heatStackId).append(isBaseVfModule, rhs.isBaseVfModule).append(resourceVersion, rhs.resourceVersion).append(relationshipList, rhs.relationshipList).append(modelVersionId, rhs.modelVersionId).isEquals();
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModules.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModules.java
new file mode 100644
index 0000000..904da55
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModules.java
@@ -0,0 +1,82 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import java.util.List;
+import javax.validation.Valid;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+public class VfModules {
+
+ @SerializedName("vf-module")
+ @Expose
+ @Valid
+ private List<VfModule> vfModule = null;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VfModules() {
+ }
+
+ /**
+ *
+ * @param vfModule
+ */
+ public VfModules(List<VfModule> vfModule) {
+ super();
+ this.vfModule = vfModule;
+ }
+
+ public List<VfModule> getVfModule() {
+ return vfModule;
+ }
+
+ public void setVfModule(List<VfModule> vfModule) {
+ this.vfModule = vfModule;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("vfModule", vfModule).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(vfModule).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VfModules) == false) {
+ return false;
+ }
+ VfModules rhs = ((VfModules) other);
+ return new EqualsBuilder().append(vfModule, rhs.vfModule).isEquals();
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmName.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmName.java
new file mode 100644
index 0000000..5336dbe
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmName.java
@@ -0,0 +1,89 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class VmName {
+
+ @SerializedName("vm-name")
+ @Expose
+ private String vmName;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VmName() {
+ }
+
+ /**
+ *
+ * @param vmName
+ */
+ public VmName(String vmName) {
+ super();
+ this.vmName = vmName;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ public void setVmName(String vmName) {
+ this.vmName = vmName;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(VmName.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("vmName");
+ sb.append('=');
+ sb.append(((this.vmName == null)?"<null>":this.vmName));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.vmName == null)? 0 :this.vmName.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VmName) == false) {
+ return false;
+ }
+ VmName rhs = ((VmName) other);
+ return ((this.vmName == rhs.vmName)||((this.vmName!= null)&&this.vmName.equals(rhs.vmName)));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmNetwork.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmNetwork.java
new file mode 100644
index 0000000..cb12c26
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmNetwork.java
@@ -0,0 +1,181 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import java.util.ArrayList;
+import java.util.List;
+
+public class VmNetwork {
+
+ @SerializedName("network-role")
+ @Expose
+ private String networkRole;
+ @SerializedName("network-ips-v6")
+ @Expose
+ private List<NetworkIpV6> networkIpsV6 = new ArrayList<NetworkIpV6>();
+ @SerializedName("floating-ip")
+ @Expose
+ private String floatingIp;
+ @SerializedName("use-dhcp")
+ @Expose
+ private String useDhcp;
+ @SerializedName("network-ips")
+ @Expose
+ private List<NetworkIp> networkIps = new ArrayList<NetworkIp>();
+ @SerializedName("floating-ip-v6")
+ @Expose
+ private String floatingIpV6;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VmNetwork() {
+ }
+
+ /**
+ *
+ * @param useDhcp
+ * @param networkRole
+ * @param networkIps
+ * @param floatingIp
+ * @param floatingIpV6
+ * @param networkIpsV6
+ */
+ public VmNetwork(String networkRole, List<NetworkIpV6> networkIpsV6, String floatingIp, String useDhcp, List<NetworkIp> networkIps, String floatingIpV6) {
+ super();
+ this.networkRole = networkRole;
+ this.networkIpsV6 = networkIpsV6;
+ this.floatingIp = floatingIp;
+ this.useDhcp = useDhcp;
+ this.networkIps = networkIps;
+ this.floatingIpV6 = floatingIpV6;
+ }
+
+ public String getNetworkRole() {
+ return networkRole;
+ }
+
+ public void setNetworkRole(String networkRole) {
+ this.networkRole = networkRole;
+ }
+
+ public List<NetworkIpV6> getNetworkIpsV6() {
+ return networkIpsV6;
+ }
+
+ public void setNetworkIpsV6(List<NetworkIpV6> networkIpsV6) {
+ this.networkIpsV6 = networkIpsV6;
+ }
+
+ public String getFloatingIp() {
+ return floatingIp;
+ }
+
+ public void setFloatingIp(String floatingIp) {
+ this.floatingIp = floatingIp;
+ }
+
+ public String getUseDhcp() {
+ return useDhcp;
+ }
+
+ public void setUseDhcp(String useDhcp) {
+ this.useDhcp = useDhcp;
+ }
+
+ public List<NetworkIp> getNetworkIps() {
+ return networkIps;
+ }
+
+ public void setNetworkIps(List<NetworkIp> networkIps) {
+ this.networkIps = networkIps;
+ }
+
+ public String getFloatingIpV6() {
+ return floatingIpV6;
+ }
+
+ public void setFloatingIpV6(String floatingIpV6) {
+ this.floatingIpV6 = floatingIpV6;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(VmNetwork.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("networkRole");
+ sb.append('=');
+ sb.append(((this.networkRole == null)?"<null>":this.networkRole));
+ sb.append(',');
+ sb.append("networkIpsV6");
+ sb.append('=');
+ sb.append(((this.networkIpsV6 == null)?"<null>":this.networkIpsV6));
+ sb.append(',');
+ sb.append("floatingIp");
+ sb.append('=');
+ sb.append(((this.floatingIp == null)?"<null>":this.floatingIp));
+ sb.append(',');
+ sb.append("useDhcp");
+ sb.append('=');
+ sb.append(((this.useDhcp == null)?"<null>":this.useDhcp));
+ sb.append(',');
+ sb.append("networkIps");
+ sb.append('=');
+ sb.append(((this.networkIps == null)?"<null>":this.networkIps));
+ sb.append(',');
+ sb.append("floatingIpV6");
+ sb.append('=');
+ sb.append(((this.floatingIpV6 == null)?"<null>":this.floatingIpV6));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.useDhcp == null)? 0 :this.useDhcp.hashCode()));
+ result = ((result* 31)+((this.networkRole == null)? 0 :this.networkRole.hashCode()));
+ result = ((result* 31)+((this.networkIps == null)? 0 :this.networkIps.hashCode()));
+ result = ((result* 31)+((this.floatingIp == null)? 0 :this.floatingIp.hashCode()));
+ result = ((result* 31)+((this.floatingIpV6 == null)? 0 :this.floatingIpV6 .hashCode()));
+ result = ((result* 31)+((this.networkIpsV6 == null)? 0 :this.networkIpsV6 .hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VmNetwork) == false) {
+ return false;
+ }
+ VmNetwork rhs = ((VmNetwork) other);
+ return (((((((this.useDhcp == rhs.useDhcp)||((this.useDhcp!= null)&&this.useDhcp.equals(rhs.useDhcp)))&&((this.networkRole == rhs.networkRole)||((this.networkRole!= null)&&this.networkRole.equals(rhs.networkRole))))&&((this.networkIps == rhs.networkIps)||((this.networkIps!= null)&&this.networkIps.equals(rhs.networkIps))))&&((this.floatingIp == rhs.floatingIp)||((this.floatingIp!= null)&&this.floatingIp.equals(rhs.floatingIp))))&&((this.floatingIpV6 == rhs.floatingIpV6)||((this.floatingIpV6 != null)&&this.floatingIpV6 .equals(rhs.floatingIpV6))))&&((this.networkIpsV6 == rhs.networkIpsV6)||((this.networkIpsV6 != null)&&this.networkIpsV6 .equals(rhs.networkIpsV6))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Vnf.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Vnf.java
new file mode 100644
index 0000000..36842a3
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Vnf.java
@@ -0,0 +1,126 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class Vnf {
+
+ @SerializedName("vnf-id")
+ @Expose
+ private String vnfId;
+ @SerializedName("service-status")
+ @Expose
+ private ServiceStatus serviceStatus;
+ @SerializedName("service-data")
+ @Expose
+ private ServiceData serviceData;
+
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public Vnf() {
+ }
+
+ /**
+ *
+ * @param vnfId
+ * @param serviceStatus
+ * @param serviceData
+ */
+ public Vnf(String vnfId, ServiceStatus serviceStatus, ServiceData serviceData) {
+ super();
+ this.vnfId = vnfId;
+ this.serviceStatus = serviceStatus;
+ this.serviceData = serviceData;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public ServiceStatus getServiceStatus() {
+ return serviceStatus;
+ }
+
+ public void setServiceStatus(ServiceStatus serviceStatus) {
+ this.serviceStatus = serviceStatus;
+ }
+
+ public ServiceData getServiceData() {
+ return serviceData;
+ }
+
+ public void setServiceData(ServiceData serviceData) {
+ this.serviceData = serviceData;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(Vnf.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("vnfId");
+ sb.append('=');
+ sb.append(((this.vnfId == null)?"<null>":this.vnfId));
+ sb.append(',');
+ sb.append("serviceStatus");
+ sb.append('=');
+ sb.append(((this.serviceStatus == null)?"<null>":this.serviceStatus));
+ sb.append(',');
+ sb.append("serviceData");
+ sb.append('=');
+ sb.append(((this.serviceData == null)?"<null>":this.serviceData));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.serviceStatus == null)? 0 :this.serviceStatus.hashCode()));
+ result = ((result* 31)+((this.serviceData == null)? 0 :this.serviceData.hashCode()));
+ result = ((result* 31)+((this.vnfId == null)? 0 :this.vnfId.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof Vnf) == false) {
+ return false;
+ }
+ Vnf rhs = ((Vnf) other);
+ return ((((this.serviceStatus == rhs.serviceStatus)||((this.serviceStatus!= null)&&this.serviceStatus.equals(rhs.serviceStatus)))&&((this.serviceData == rhs.serviceData)||((this.serviceData!= null)&&this.serviceData.equals(rhs.serviceData))))&&((this.vnfId == rhs.vnfId)||((this.vnfId!= null)&&this.vnfId.equals(rhs.vnfId))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfAssignments.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfAssignments.java
new file mode 100644
index 0000000..2abfb31
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfAssignments.java
@@ -0,0 +1,127 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class VnfAssignments {
+
+ @SerializedName("vnf-networks")
+ @Expose
+ private List<VnfNetwork> vnfNetworks = new ArrayList<VnfNetwork>();
+ @SerializedName("availability-zones")
+ @Expose
+ private List<AvailabilityZone> availabilityZones = new ArrayList<AvailabilityZone>();
+ @SerializedName("vnf-vms")
+ @Expose
+ private List<VnfVm> vnfVms = new ArrayList<VnfVm>();
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VnfAssignments() {
+ }
+
+ /**
+ *
+ * @param vnfVms
+ * @param availabilityZones
+ * @param vnfNetworks
+ */
+ public VnfAssignments(List<VnfNetwork> vnfNetworks, List<AvailabilityZone> availabilityZones, List<VnfVm> vnfVms) {
+ super();
+ this.vnfNetworks = vnfNetworks;
+ this.availabilityZones = availabilityZones;
+ this.vnfVms = vnfVms;
+ }
+
+ public List<VnfNetwork> getVnfNetworks() {
+ return vnfNetworks;
+ }
+
+ public void setVnfNetworks(List<VnfNetwork> vnfNetworks) {
+ this.vnfNetworks = vnfNetworks;
+ }
+
+ public List<AvailabilityZone> getAvailabilityZones() {
+ return availabilityZones;
+ }
+
+ public void setAvailabilityZones(List<AvailabilityZone> availabilityZones) {
+ this.availabilityZones = availabilityZones;
+ }
+
+ public List<VnfVm> getVnfVms() {
+ return vnfVms;
+ }
+
+ public void setVnfVms(List<VnfVm> vnfVms) {
+ this.vnfVms = vnfVms;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(VnfAssignments.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("vnfNetworks");
+ sb.append('=');
+ sb.append(((this.vnfNetworks == null)?"<null>":this.vnfNetworks));
+ sb.append(',');
+ sb.append("availabilityZones");
+ sb.append('=');
+ sb.append(((this.availabilityZones == null)?"<null>":this.availabilityZones));
+ sb.append(',');
+ sb.append("vnfVms");
+ sb.append('=');
+ sb.append(((this.vnfVms == null)?"<null>":this.vnfVms));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.availabilityZones == null)? 0 :this.availabilityZones.hashCode()));
+ result = ((result* 31)+((this.vnfVms == null)? 0 :this.vnfVms.hashCode()));
+ result = ((result* 31)+((this.vnfNetworks == null)? 0 :this.vnfNetworks.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VnfAssignments) == false) {
+ return false;
+ }
+ VnfAssignments rhs = ((VnfAssignments) other);
+ return ((((this.availabilityZones == rhs.availabilityZones)||((this.availabilityZones!= null)&&this.availabilityZones.equals(rhs.availabilityZones)))&&((this.vnfVms == rhs.vnfVms)||((this.vnfVms!= null)&&this.vnfVms.equals(rhs.vnfVms))))&&((this.vnfNetworks == rhs.vnfNetworks)||((this.vnfNetworks!= null)&&this.vnfNetworks.equals(rhs.vnfNetworks))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfInstance.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfInstance.java
new file mode 100644
index 0000000..e3fb756
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfInstance.java
@@ -0,0 +1,438 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import javax.validation.Valid;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.onap.pomba.contextbuilder.sdnc.exception.AuditError;
+import org.onap.pomba.contextbuilder.sdnc.exception.AuditException;
+
+
+public class VnfInstance {
+
+ @SerializedName("vnf-id")
+ @Expose
+ private String vnfId;
+ @SerializedName("vnf-name")
+ @Expose
+ private String vnfName;
+ @SerializedName("vnf-name2")
+ @Expose
+ private String vnfName2;
+ @SerializedName("vnf-type")
+ @Expose
+ private String vnfType;
+ @SerializedName("service-id")
+ @Expose
+ private String serviceId;
+ @SerializedName("prov-status")
+ @Expose
+ private String provStatus;
+ @SerializedName("license-key")
+ @Expose
+ private String licenseKey;
+ @SerializedName("equipment-role")
+ @Expose
+ private String equipmentRole;
+ @SerializedName("orchestration-status")
+ @Expose
+ private String orchestrationStatus;
+ @SerializedName("heat-stack-id")
+ @Expose
+ private String heatStackId;
+ @SerializedName("mso-catalog-key")
+ @Expose
+ private String msoCatalogKey;
+ @SerializedName("ipv4-oam-address")
+ @Expose
+ private String ipv4OamAddress;
+ @SerializedName("ipv4-loopback0-address")
+ @Expose
+ private String ipv4Loopback0Address;
+ @SerializedName("nm-lan-v6-address")
+ @Expose
+ private String nmLanV6Address;
+ @SerializedName("management-v6-address")
+ @Expose
+ private String managementV6Address;
+ @SerializedName("in-maint")
+ @Expose
+ private Boolean inMaint;
+ @SerializedName("is-closed-loop-disabled")
+ @Expose
+ private Boolean isClosedLoopDisabled;
+ @SerializedName("resource-version")
+ @Expose
+ private String resourceVersion;
+ @SerializedName("model-invariant-id")
+ @Expose
+ private String modelInvariantId;
+ @SerializedName("model-version-id")
+ @Expose
+ private String modelVersionId;
+ @SerializedName("model-customization-id")
+ @Expose
+ private String modelCustomizationId;
+ @SerializedName("nf-type")
+ @Expose
+ private String nfType;
+ @SerializedName("nf-function")
+ @Expose
+ private String nfFunction;
+ @SerializedName("nf-role")
+ @Expose
+ private String nfRole;
+ @SerializedName("nf-naming-code")
+ @Expose
+ private String nfNamingCode;
+ @SerializedName("relationship-list")
+ @Expose
+ @Valid
+ private RelationshipList relationshipList;
+ @SerializedName("vf-modules")
+ @Expose
+ @Valid
+ private VfModules vfModules;
+
+ private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+
+ public static VnfInstance fromJson(String payload) throws AuditException {
+ try {
+ if (payload == null || payload.isEmpty()) {
+ throw new Exception(AuditError.JSON_EMPTY_RESPONSE);
+ }
+ return gson.fromJson(payload, VnfInstance.class);
+ } catch (Exception ex) {
+ throw new AuditException(AuditError.JSON_PARSE_ERROR, ex);
+ }
+ }
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VnfInstance() {
+ }
+
+ /**
+ *
+ * @param serviceId
+ * @param modelCustomizationId
+ * @param vnfType
+ * @param ipv4Loopback0Address
+ * @param nfFunction
+ * @param modelInvariantId
+ * @param resourceVersion
+ * @param vnfName2
+ * @param relationshipList
+ * @param nmLanV6Address
+ * @param nfRole
+ * @param nfType
+ * @param modelVersionId
+ * @param ipv4OamAddress
+ * @param vnfName
+ * @param inMaint
+ * @param msoCatalogKey
+ * @param provStatus
+ * @param vfModules
+ * @param equipmentRole
+ * @param vnfId
+ * @param orchestrationStatus
+ * @param nfNamingCode
+ * @param heatStackId
+ * @param isClosedLoopDisabled
+ * @param licenseKey
+ * @param managementV6Address
+ */
+ public VnfInstance(String vnfId, String vnfName, String vnfName2, String vnfType, String serviceId, String provStatus, String licenseKey, String equipmentRole, String orchestrationStatus, String heatStackId, String msoCatalogKey, String ipv4OamAddress, String ipv4Loopback0Address, String nmLanV6Address, String managementV6Address, Boolean inMaint, Boolean isClosedLoopDisabled, String resourceVersion, String modelInvariantId, String modelVersionId, String modelCustomizationId, String nfType, String nfFunction, String nfRole, String nfNamingCode, RelationshipList relationshipList, VfModules vfModules) {
+ super();
+ this.vnfId = vnfId;
+ this.vnfName = vnfName;
+ this.vnfName2 = vnfName2;
+ this.vnfType = vnfType;
+ this.serviceId= serviceId;
+ this.provStatus = provStatus;
+ this.licenseKey = licenseKey;
+ this.equipmentRole = equipmentRole;
+ this.orchestrationStatus = orchestrationStatus;
+ this.heatStackId= heatStackId;
+ this.msoCatalogKey = msoCatalogKey;
+ this.ipv4OamAddress = ipv4OamAddress;
+ this.ipv4Loopback0Address = ipv4Loopback0Address;
+ this.nmLanV6Address = nmLanV6Address;
+ this.managementV6Address = managementV6Address;
+ this.inMaint = inMaint;
+ this.isClosedLoopDisabled = isClosedLoopDisabled;
+ this.resourceVersion = resourceVersion;
+ this.modelInvariantId= modelInvariantId;
+ this.modelVersionId= modelVersionId;
+ this.modelCustomizationId= modelCustomizationId;
+ this.nfType = nfType;
+ this.nfFunction = nfFunction;
+ this.nfRole = nfRole;
+ this.nfNamingCode = nfNamingCode;
+ this.relationshipList = relationshipList;
+ this.vfModules = vfModules;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public String getVnfName2() {
+ return vnfName2;
+ }
+
+ public void setVnfName2(String vnfName2) {
+ this.vnfName2 = vnfName2;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ public void setServiceId(String serviceId) {
+ this.serviceId= serviceId;
+ }
+
+ public String getProvStatus() {
+ return provStatus;
+ }
+
+ public void setProvStatus(String provStatus) {
+ this.provStatus = provStatus;
+ }
+
+ public String getLicenseKey() {
+ return licenseKey;
+ }
+
+ public void setLicenseKey(String licenseKey) {
+ this.licenseKey = licenseKey;
+ }
+
+ public String getEquipmentRole() {
+ return equipmentRole;
+ }
+
+ public void setEquipmentRole(String equipmentRole) {
+ this.equipmentRole = equipmentRole;
+ }
+
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ public String getHeatStackId() {
+ return heatStackId;
+ }
+
+ public void setHeatStackId(String heatStackId) {
+ this.heatStackId= heatStackId;
+ }
+
+ public String getMsoCatalogKey() {
+ return msoCatalogKey;
+ }
+
+ public void setMsoCatalogKey(String msoCatalogKey) {
+ this.msoCatalogKey = msoCatalogKey;
+ }
+
+ public String getIpv4OamAddress() {
+ return ipv4OamAddress;
+ }
+
+ public void setIpv4OamAddress(String ipv4OamAddress) {
+ this.ipv4OamAddress = ipv4OamAddress;
+ }
+
+ public String getIpv4Loopback0Address() {
+ return ipv4Loopback0Address;
+ }
+
+ public void setIpv4Loopback0Address(String ipv4Loopback0Address) {
+ this.ipv4Loopback0Address = ipv4Loopback0Address;
+ }
+
+ public String getNmLanV6Address() {
+ return nmLanV6Address;
+ }
+
+ public void setNmLanV6Address(String nmLanV6Address) {
+ this.nmLanV6Address = nmLanV6Address;
+ }
+
+ public String getManagementV6Address() {
+ return managementV6Address;
+ }
+
+ public void setManagementV6Address(String managementV6Address) {
+ this.managementV6Address = managementV6Address;
+ }
+
+ public Boolean getInMaint() {
+ return inMaint;
+ }
+
+ public void setInMaint(Boolean inMaint) {
+ this.inMaint = inMaint;
+ }
+
+ public Boolean getIsClosedLoopDisabled() {
+ return isClosedLoopDisabled;
+ }
+
+ public void setIsClosedLoopDisabled(Boolean isClosedLoopDisabled) {
+ this.isClosedLoopDisabled = isClosedLoopDisabled;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId= modelInvariantId;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId= modelVersionId;
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId= modelCustomizationId;
+ }
+
+ public String getNfType() {
+ return nfType;
+ }
+
+ public void setNfType(String nfType) {
+ this.nfType = nfType;
+ }
+
+ public String getNfFunction() {
+ return nfFunction;
+ }
+
+ public void setNfFunction(String nfFunction) {
+ this.nfFunction = nfFunction;
+ }
+
+ public String getNfRole() {
+ return nfRole;
+ }
+
+ public void setNfRole(String nfRole) {
+ this.nfRole = nfRole;
+ }
+
+ public String getNfNamingCode() {
+ return nfNamingCode;
+ }
+
+ public void setNfNamingCode(String nfNamingCode) {
+ this.nfNamingCode = nfNamingCode;
+ }
+
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+
+ public VfModules getVfModules() {
+ return vfModules;
+ }
+
+ public void setVfModules(VfModules vfModules) {
+ this.vfModules = vfModules;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("vnfId", vnfId).append("vnfName", vnfName).append("vnfName2", vnfName2).append("vnfType", vnfType).append("serviceId", serviceId).append("provStatus", provStatus).append("licenseKey", licenseKey).append("equipmentRole", equipmentRole).append("orchestrationStatus", orchestrationStatus).append("heatStackId", heatStackId).append("msoCatalogKey", msoCatalogKey).append("ipv4OamAddress", ipv4OamAddress).append("ipv4Loopback0Address", ipv4Loopback0Address).append("nmLanV6Address", nmLanV6Address).append("managementV6Address", managementV6Address).append("inMaint", inMaint).append("isClosedLoopDisabled", isClosedLoopDisabled).append("resourceVersion", resourceVersion).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("modelCustomizationId", modelCustomizationId).append("nfType", nfType).append("nfFunction", nfFunction).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode).append("relationshipList", relationshipList).append("vfModules", vfModules).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationId).append(serviceId).append(ipv4Loopback0Address).append(vnfType).append(nfFunction).append(modelInvariantId).append(resourceVersion).append(vnfName2).append(relationshipList).append(nmLanV6Address).append(nfRole).append(nfType).append(modelVersionId).append(ipv4OamAddress).append(vnfName).append(inMaint).append(msoCatalogKey).append(provStatus).append(vfModules).append(equipmentRole).append(vnfId).append(orchestrationStatus).append(nfNamingCode).append(isClosedLoopDisabled).append(heatStackId).append(licenseKey).append(managementV6Address).toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VnfInstance) == false) {
+ return false;
+ }
+ VnfInstance rhs = ((VnfInstance) other);
+ return new EqualsBuilder().append(modelCustomizationId, rhs.modelCustomizationId).append(serviceId, rhs.serviceId).append(ipv4Loopback0Address, rhs.ipv4Loopback0Address).append(vnfType, rhs.vnfType).append(nfFunction, rhs.nfFunction).append(modelInvariantId, rhs.modelInvariantId).append(resourceVersion, rhs.resourceVersion).append(vnfName2, rhs.vnfName2).append(relationshipList, rhs.relationshipList).append(nmLanV6Address, rhs.nmLanV6Address).append(nfRole, rhs.nfRole).append(nfType, rhs.nfType).append(modelVersionId, rhs.modelVersionId).append(ipv4OamAddress, rhs.ipv4OamAddress).append(vnfName, rhs.vnfName).append(inMaint, rhs.inMaint).append(msoCatalogKey, rhs.msoCatalogKey).append(provStatus, rhs.provStatus).append(vfModules, rhs.vfModules).append(equipmentRole, rhs.equipmentRole).append(vnfId, rhs.vnfId).append(orchestrationStatus, rhs.orchestrationStatus).append(nfNamingCode, rhs.nfNamingCode).append(isClosedLoopDisabled, rhs.isClosedLoopDisabled).append(heatStackId, rhs.heatStackId).append(licenseKey, rhs.licenseKey).append(managementV6Address, rhs.managementV6Address).isEquals();
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfList.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfList.java
new file mode 100644
index 0000000..e6360fb
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfList.java
@@ -0,0 +1,110 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import java.util.ArrayList;
+import java.util.List;
+import org.onap.pomba.contextbuilder.sdnc.exception.AuditError;
+import org.onap.pomba.contextbuilder.sdnc.exception.AuditException;
+
+public class VnfList {
+
+
+ @SerializedName("vnf-list")
+ @Expose
+ private List<Vnf> vnfList = new ArrayList<Vnf>();
+
+ private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
+
+ public static VnfList fromJson(String payload) throws AuditException {
+ try {
+ if (payload == null || payload.isEmpty()) {
+ throw new Exception(AuditError.JSON_EMPTY_RESPONSE);
+ }
+ return gson.fromJson(payload, VnfList.class);
+ } catch (Exception ex) {
+ throw new AuditException(AuditError.JSON_PARSE_ERROR, ex);
+ }
+ }
+
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VnfList() {
+ }
+
+ /**
+ *
+ * @param vnfList
+ */
+ public VnfList(List<Vnf> vnfList) {
+ super();
+ this.vnfList = vnfList;
+ }
+
+ public List<Vnf> getVnfList() {
+ return vnfList;
+ }
+
+ public void setVnfList(List<Vnf> vnfList) {
+ this.vnfList = vnfList;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(VnfList.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("vnfList");
+ sb.append('=');
+ sb.append(((this.vnfList == null)?"<null>":this.vnfList));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.vnfList == null)? 0 :this.vnfList.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VnfList) == false) {
+ return false;
+ }
+ VnfList rhs = ((VnfList) other);
+ return ((this.vnfList == rhs.vnfList)||((this.vnfList!= null)&&this.vnfList.equals(rhs.vnfList)));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfNetwork.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfNetwork.java
new file mode 100644
index 0000000..084e4e0
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfNetwork.java
@@ -0,0 +1,161 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class VnfNetwork {
+
+ @SerializedName("network-role")
+ @Expose
+ private String networkRole;
+ @SerializedName("contrail-network-fqdn")
+ @Expose
+ private String contrailNetworkFqdn;
+ @SerializedName("network-name")
+ @Expose
+ private String networkName;
+ @SerializedName("network-id")
+ @Expose
+ private String networkId;
+ @SerializedName("neutron-id")
+ @Expose
+ private String neutronId;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VnfNetwork() {
+ }
+
+ /**
+ *
+ * @param networkRole
+ * @param networkId
+ * @param networkName
+ * @param contrailNetworkFqdn
+ * @param neutronId
+ */
+ public VnfNetwork(String networkRole, String contrailNetworkFqdn, String networkName, String networkId, String neutronId) {
+ super();
+ this.networkRole = networkRole;
+ this.contrailNetworkFqdn = contrailNetworkFqdn;
+ this.networkName = networkName;
+ this.networkId = networkId;
+ this.neutronId = neutronId;
+ }
+
+ public String getNetworkRole() {
+ return networkRole;
+ }
+
+ public void setNetworkRole(String networkRole) {
+ this.networkRole = networkRole;
+ }
+
+ public String getContrailNetworkFqdn() {
+ return contrailNetworkFqdn;
+ }
+
+ public void setContrailNetworkFqdn(String contrailNetworkFqdn) {
+ this.contrailNetworkFqdn = contrailNetworkFqdn;
+ }
+
+ public String getNetworkName() {
+ return networkName;
+ }
+
+ public void setNetworkName(String networkName) {
+ this.networkName = networkName;
+ }
+
+ public String getNetworkId() {
+ return networkId;
+ }
+
+ public void setNetworkId(String networkId) {
+ this.networkId = networkId;
+ }
+
+ public String getNeutronId() {
+ return neutronId;
+ }
+
+ public void setNeutronId(String neutronId) {
+ this.neutronId = neutronId;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(VnfNetwork.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("networkRole");
+ sb.append('=');
+ sb.append(((this.networkRole == null)?"<null>":this.networkRole));
+ sb.append(',');
+ sb.append("contrailNetworkFqdn");
+ sb.append('=');
+ sb.append(((this.contrailNetworkFqdn == null)?"<null>":this.contrailNetworkFqdn));
+ sb.append(',');
+ sb.append("networkName");
+ sb.append('=');
+ sb.append(((this.networkName == null)?"<null>":this.networkName));
+ sb.append(',');
+ sb.append("networkId");
+ sb.append('=');
+ sb.append(((this.networkId == null)?"<null>":this.networkId));
+ sb.append(',');
+ sb.append("neutronId");
+ sb.append('=');
+ sb.append(((this.neutronId == null)?"<null>":this.neutronId));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.networkName == null)? 0 :this.networkName.hashCode()));
+ result = ((result* 31)+((this.networkRole == null)? 0 :this.networkRole.hashCode()));
+ result = ((result* 31)+((this.networkId == null)? 0 :this.networkId.hashCode()));
+ result = ((result* 31)+((this.contrailNetworkFqdn == null)? 0 :this.contrailNetworkFqdn.hashCode()));
+ result = ((result* 31)+((this.neutronId == null)? 0 :this.neutronId.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VnfNetwork) == false) {
+ return false;
+ }
+ VnfNetwork rhs = ((VnfNetwork) other);
+ return ((((((this.networkName == rhs.networkName)||((this.networkName!= null)&&this.networkName.equals(rhs.networkName)))&&((this.networkRole == rhs.networkRole)||((this.networkRole!= null)&&this.networkRole.equals(rhs.networkRole))))&&((this.networkId == rhs.networkId)||((this.networkId!= null)&&this.networkId.equals(rhs.networkId))))&&((this.contrailNetworkFqdn == rhs.contrailNetworkFqdn)||((this.contrailNetworkFqdn!= null)&&this.contrailNetworkFqdn.equals(rhs.contrailNetworkFqdn))))&&((this.neutronId == rhs.neutronId)||((this.neutronId!= null)&&this.neutronId.equals(rhs.neutronId))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfParameter.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfParameter.java
new file mode 100644
index 0000000..4ac602f
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfParameter.java
@@ -0,0 +1,107 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class VnfParameter {
+
+ @SerializedName("vnf-parameter-name")
+ @Expose
+ private String vnfParameterName;
+ @SerializedName("vnf-parameter-value")
+ @Expose
+ private String vnfParameterValue;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VnfParameter() {
+ }
+
+ /**
+ *
+ * @param vnfParameterValue
+ * @param vnfParameterName
+ */
+ public VnfParameter(String vnfParameterName, String vnfParameterValue) {
+ super();
+ this.vnfParameterName = vnfParameterName;
+ this.vnfParameterValue = vnfParameterValue;
+ }
+
+ public String getVnfParameterName() {
+ return vnfParameterName;
+ }
+
+ public void setVnfParameterName(String vnfParameterName) {
+ this.vnfParameterName = vnfParameterName;
+ }
+
+ public String getVnfParameterValue() {
+ return vnfParameterValue;
+ }
+
+ public void setVnfParameterValue(String vnfParameterValue) {
+ this.vnfParameterValue = vnfParameterValue;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(VnfParameter.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("vnfParameterName");
+ sb.append('=');
+ sb.append(((this.vnfParameterName == null)?"<null>":this.vnfParameterName));
+ sb.append(',');
+ sb.append("vnfParameterValue");
+ sb.append('=');
+ sb.append(((this.vnfParameterValue == null)?"<null>":this.vnfParameterValue));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.vnfParameterValue == null)? 0 :this.vnfParameterValue.hashCode()));
+ result = ((result* 31)+((this.vnfParameterName == null)? 0 :this.vnfParameterName.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VnfParameter) == false) {
+ return false;
+ }
+ VnfParameter rhs = ((VnfParameter) other);
+ return (((this.vnfParameterValue == rhs.vnfParameterValue)||((this.vnfParameterValue!= null)&&this.vnfParameterValue.equals(rhs.vnfParameterValue)))&&((this.vnfParameterName == rhs.vnfParameterName)||((this.vnfParameterName!= null)&&this.vnfParameterName.equals(rhs.vnfParameterName))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfRequestInformation.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfRequestInformation.java
new file mode 100644
index 0000000..8cd4b99
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfRequestInformation.java
@@ -0,0 +1,233 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class VnfRequestInformation {
+
+ @SerializedName("vnf-name")
+ @Expose
+ private String vnfName;
+ @SerializedName("tenant")
+ @Expose
+ private String tenant;
+ @SerializedName("aic-cloud-region")
+ @Expose
+ private String aicCloudRegion;
+ @SerializedName("use-preload")
+ @Expose
+ private String usePreload;
+ @SerializedName("vnf-type")
+ @Expose
+ private String vnfType;
+ @SerializedName("vnf-id")
+ @Expose
+ private String vnfId;
+ @SerializedName("generic-vnf-type")
+ @Expose
+ private String genericVnfType;
+ @SerializedName("generic-vnf-name")
+ @Expose
+ private String genericVnfName;
+ @SerializedName("generic-vnf-id")
+ @Expose
+ private String genericVnfId;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VnfRequestInformation() {
+ }
+
+ /**
+ *
+ * @param aicCloudRegion
+ * @param vnfId
+ * @param genericVnfId
+ * @param usePreload
+ * @param vnfName
+ * @param vnfType
+ * @param genericVnfName
+ * @param tenant
+ * @param genericVnfType
+ */
+ public VnfRequestInformation(String vnfName, String tenant, String aicCloudRegion, String usePreload, String vnfType, String vnfId, String genericVnfType, String genericVnfName, String genericVnfId) {
+ super();
+ this.vnfName = vnfName;
+ this.tenant = tenant;
+ this.aicCloudRegion = aicCloudRegion;
+ this.usePreload = usePreload;
+ this.vnfType = vnfType;
+ this.vnfId = vnfId;
+ this.genericVnfType = genericVnfType;
+ this.genericVnfName = genericVnfName;
+ this.genericVnfId = genericVnfId;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public String getTenant() {
+ return tenant;
+ }
+
+ public void setTenant(String tenant) {
+ this.tenant = tenant;
+ }
+
+ public String getAicCloudRegion() {
+ return aicCloudRegion;
+ }
+
+ public void setAicCloudRegion(String aicCloudRegion) {
+ this.aicCloudRegion = aicCloudRegion;
+ }
+
+ public String getUsePreload() {
+ return usePreload;
+ }
+
+ public void setUsePreload(String usePreload) {
+ this.usePreload = usePreload;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public String getGenericVnfType() {
+ return genericVnfType;
+ }
+
+ public void setGenericVnfType(String genericVnfType) {
+ this.genericVnfType = genericVnfType;
+ }
+
+ public String getGenericVnfName() {
+ return genericVnfName;
+ }
+
+ public void setGenericVnfName(String genericVnfName) {
+ this.genericVnfName = genericVnfName;
+ }
+
+ public String getGenericVnfId() {
+ return genericVnfId;
+ }
+
+ public void setGenericVnfId(String genericVnfId) {
+ this.genericVnfId = genericVnfId;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(VnfRequestInformation.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("vnfName");
+ sb.append('=');
+ sb.append(((this.vnfName == null)?"<null>":this.vnfName));
+ sb.append(',');
+ sb.append("tenant");
+ sb.append('=');
+ sb.append(((this.tenant == null)?"<null>":this.tenant));
+ sb.append(',');
+ sb.append("aicCloudRegion");
+ sb.append('=');
+ sb.append(((this.aicCloudRegion == null)?"<null>":this.aicCloudRegion));
+ sb.append(',');
+ sb.append("usePreload");
+ sb.append('=');
+ sb.append(((this.usePreload == null)?"<null>":this.usePreload));
+ sb.append(',');
+ sb.append("vnfType");
+ sb.append('=');
+ sb.append(((this.vnfType == null)?"<null>":this.vnfType));
+ sb.append(',');
+ sb.append("vnfId");
+ sb.append('=');
+ sb.append(((this.vnfId == null)?"<null>":this.vnfId));
+ sb.append(',');
+ sb.append("genericVnfType");
+ sb.append('=');
+ sb.append(((this.genericVnfType == null)?"<null>":this.genericVnfType));
+ sb.append(',');
+ sb.append("genericVnfName");
+ sb.append('=');
+ sb.append(((this.genericVnfName == null)?"<null>":this.genericVnfName));
+ sb.append(',');
+ sb.append("genericVnfId");
+ sb.append('=');
+ sb.append(((this.genericVnfId == null)?"<null>":this.genericVnfId));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.aicCloudRegion == null)? 0 :this.aicCloudRegion.hashCode()));
+ result = ((result* 31)+((this.vnfId == null)? 0 :this.vnfId.hashCode()));
+ result = ((result* 31)+((this.genericVnfId == null)? 0 :this.genericVnfId.hashCode()));
+ result = ((result* 31)+((this.usePreload == null)? 0 :this.usePreload.hashCode()));
+ result = ((result* 31)+((this.vnfName == null)? 0 :this.vnfName.hashCode()));
+ result = ((result* 31)+((this.vnfType == null)? 0 :this.vnfType.hashCode()));
+ result = ((result* 31)+((this.genericVnfName == null)? 0 :this.genericVnfName.hashCode()));
+ result = ((result* 31)+((this.tenant == null)? 0 :this.tenant.hashCode()));
+ result = ((result* 31)+((this.genericVnfType == null)? 0 :this.genericVnfType.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VnfRequestInformation) == false) {
+ return false;
+ }
+ VnfRequestInformation rhs = ((VnfRequestInformation) other);
+ return ((((((((((this.aicCloudRegion == rhs.aicCloudRegion)||((this.aicCloudRegion!= null)&&this.aicCloudRegion.equals(rhs.aicCloudRegion)))&&((this.vnfId == rhs.vnfId)||((this.vnfId!= null)&&this.vnfId.equals(rhs.vnfId))))&&((this.genericVnfId == rhs.genericVnfId)||((this.genericVnfId!= null)&&this.genericVnfId.equals(rhs.genericVnfId))))&&((this.usePreload == rhs.usePreload)||((this.usePreload!= null)&&this.usePreload.equals(rhs.usePreload))))&&((this.vnfName == rhs.vnfName)||((this.vnfName!= null)&&this.vnfName.equals(rhs.vnfName))))&&((this.vnfType == rhs.vnfType)||((this.vnfType!= null)&&this.vnfType.equals(rhs.vnfType))))&&((this.genericVnfName == rhs.genericVnfName)||((this.genericVnfName!= null)&&this.genericVnfName.equals(rhs.genericVnfName))))&&((this.tenant == rhs.tenant)||((this.tenant!= null)&&this.tenant.equals(rhs.tenant))))&&((this.genericVnfType == rhs.genericVnfType)||((this.genericVnfType!= null)&&this.genericVnfType.equals(rhs.genericVnfType))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyIdentifier.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyIdentifier.java
new file mode 100644
index 0000000..507ae1d
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyIdentifier.java
@@ -0,0 +1,161 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class VnfTopologyIdentifier {
+
+ @SerializedName("generic-vnf-type")
+ @Expose
+ private String genericVnfType;
+ @SerializedName("service-type")
+ @Expose
+ private String serviceType;
+ @SerializedName("vnf-name")
+ @Expose
+ private String vnfName;
+ @SerializedName("generic-vnf-name")
+ @Expose
+ private String genericVnfName;
+ @SerializedName("vnf-type")
+ @Expose
+ private String vnfType;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VnfTopologyIdentifier() {
+ }
+
+ /**
+ *
+ * @param serviceType
+ * @param vnfName
+ * @param genericVnfName
+ * @param vnfType
+ * @param genericVnfType
+ */
+ public VnfTopologyIdentifier(String genericVnfType, String serviceType, String vnfName, String genericVnfName, String vnfType) {
+ super();
+ this.genericVnfType = genericVnfType;
+ this.serviceType = serviceType;
+ this.vnfName = vnfName;
+ this.genericVnfName = genericVnfName;
+ this.vnfType = vnfType;
+ }
+
+ public String getGenericVnfType() {
+ return genericVnfType;
+ }
+
+ public void setGenericVnfType(String genericVnfType) {
+ this.genericVnfType = genericVnfType;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public String getGenericVnfName() {
+ return genericVnfName;
+ }
+
+ public void setGenericVnfName(String genericVnfName) {
+ this.genericVnfName = genericVnfName;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(VnfTopologyIdentifier.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("genericVnfType");
+ sb.append('=');
+ sb.append(((this.genericVnfType == null)?"<null>":this.genericVnfType));
+ sb.append(',');
+ sb.append("serviceType");
+ sb.append('=');
+ sb.append(((this.serviceType == null)?"<null>":this.serviceType));
+ sb.append(',');
+ sb.append("vnfName");
+ sb.append('=');
+ sb.append(((this.vnfName == null)?"<null>":this.vnfName));
+ sb.append(',');
+ sb.append("genericVnfName");
+ sb.append('=');
+ sb.append(((this.genericVnfName == null)?"<null>":this.genericVnfName));
+ sb.append(',');
+ sb.append("vnfType");
+ sb.append('=');
+ sb.append(((this.vnfType == null)?"<null>":this.vnfType));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.vnfName == null)? 0 :this.vnfName.hashCode()));
+ result = ((result* 31)+((this.serviceType == null)? 0 :this.serviceType.hashCode()));
+ result = ((result* 31)+((this.genericVnfName == null)? 0 :this.genericVnfName.hashCode()));
+ result = ((result* 31)+((this.vnfType == null)? 0 :this.vnfType.hashCode()));
+ result = ((result* 31)+((this.genericVnfType == null)? 0 :this.genericVnfType.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VnfTopologyIdentifier) == false) {
+ return false;
+ }
+ VnfTopologyIdentifier rhs = ((VnfTopologyIdentifier) other);
+ return ((((((this.vnfName == rhs.vnfName)||((this.vnfName!= null)&&this.vnfName.equals(rhs.vnfName)))&&((this.serviceType == rhs.serviceType)||((this.serviceType!= null)&&this.serviceType.equals(rhs.serviceType))))&&((this.genericVnfName == rhs.genericVnfName)||((this.genericVnfName!= null)&&this.genericVnfName.equals(rhs.genericVnfName))))&&((this.vnfType == rhs.vnfType)||((this.vnfType!= null)&&this.vnfType.equals(rhs.vnfType))))&&((this.genericVnfType == rhs.genericVnfType)||((this.genericVnfType!= null)&&this.genericVnfType.equals(rhs.genericVnfType))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyInformation.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyInformation.java
new file mode 100644
index 0000000..26ebb66
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyInformation.java
@@ -0,0 +1,127 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import java.util.ArrayList;
+import java.util.List;
+
+public class VnfTopologyInformation {
+
+ @SerializedName("vnf-topology-identifier")
+ @Expose
+ private VnfTopologyIdentifier vnfTopologyIdentifier;
+ @SerializedName("vnf-assignments")
+ @Expose
+ private VnfAssignments vnfAssignments;
+ @SerializedName("vnf-parameters")
+ @Expose
+ private List<VnfParameter> vnfParameters = new ArrayList<VnfParameter>();
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VnfTopologyInformation() {
+ }
+
+ /**
+ *
+ * @param vnfAssignments
+ * @param vnfTopologyIdentifier
+ * @param vnfParameters
+ */
+ public VnfTopologyInformation(VnfTopologyIdentifier vnfTopologyIdentifier, VnfAssignments vnfAssignments, List<VnfParameter> vnfParameters) {
+ super();
+ this.vnfTopologyIdentifier = vnfTopologyIdentifier;
+ this.vnfAssignments = vnfAssignments;
+ this.vnfParameters = vnfParameters;
+ }
+
+ public VnfTopologyIdentifier getVnfTopologyIdentifier() {
+ return vnfTopologyIdentifier;
+ }
+
+ public void setVnfTopologyIdentifier(VnfTopologyIdentifier vnfTopologyIdentifier) {
+ this.vnfTopologyIdentifier = vnfTopologyIdentifier;
+ }
+
+ public VnfAssignments getVnfAssignments() {
+ return vnfAssignments;
+ }
+
+ public void setVnfAssignments(VnfAssignments vnfAssignments) {
+ this.vnfAssignments = vnfAssignments;
+ }
+
+ public List<VnfParameter> getVnfParameters() {
+ return vnfParameters;
+ }
+
+ public void setVnfParameters(List<VnfParameter> vnfParameters) {
+ this.vnfParameters = vnfParameters;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(VnfTopologyInformation.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("vnfTopologyIdentifier");
+ sb.append('=');
+ sb.append(((this.vnfTopologyIdentifier == null)?"<null>":this.vnfTopologyIdentifier));
+ sb.append(',');
+ sb.append("vnfAssignments");
+ sb.append('=');
+ sb.append(((this.vnfAssignments == null)?"<null>":this.vnfAssignments));
+ sb.append(',');
+ sb.append("vnfParameters");
+ sb.append('=');
+ sb.append(((this.vnfParameters == null)?"<null>":this.vnfParameters));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.vnfAssignments == null)? 0 :this.vnfAssignments.hashCode()));
+ result = ((result* 31)+((this.vnfTopologyIdentifier == null)? 0 :this.vnfTopologyIdentifier.hashCode()));
+ result = ((result* 31)+((this.vnfParameters == null)? 0 :this.vnfParameters.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VnfTopologyInformation) == false) {
+ return false;
+ }
+ VnfTopologyInformation rhs = ((VnfTopologyInformation) other);
+ return ((((this.vnfAssignments == rhs.vnfAssignments)||((this.vnfAssignments!= null)&&this.vnfAssignments.equals(rhs.vnfAssignments)))&&((this.vnfTopologyIdentifier == rhs.vnfTopologyIdentifier)||((this.vnfTopologyIdentifier!= null)&&this.vnfTopologyIdentifier.equals(rhs.vnfTopologyIdentifier))))&&((this.vnfParameters == rhs.vnfParameters)||((this.vnfParameters!= null)&&this.vnfParameters.equals(rhs.vnfParameters))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfVm.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfVm.java
new file mode 100644
index 0000000..ab39105
--- /dev/null
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfVm.java
@@ -0,0 +1,146 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+import java.util.ArrayList;
+import java.util.List;
+
+public class VnfVm {
+
+ @SerializedName("vm-type")
+ @Expose
+ private String vmType;
+ @SerializedName("vm-networks")
+ @Expose
+ private List<VmNetwork> vmNetworks = new ArrayList<VmNetwork>();
+ @SerializedName("vm-count")
+ @Expose
+ private Integer vmCount;
+ @SerializedName("vm-names")
+ @Expose
+ private List<VmName> vmNames = new ArrayList<VmName>();
+
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public VnfVm() {
+ }
+
+ /**
+ *
+ * @param vmType
+ * @param vmCount
+ * @param vmNetworks
+ * @param vmNames
+ */
+ public VnfVm(String vmType, List<VmNetwork> vmNetworks, Integer vmCount, List<VmName> vmNames) {
+ super();
+ this.vmType = vmType;
+ this.vmNetworks = vmNetworks;
+ this.vmCount = vmCount;
+ this.vmNames = vmNames;
+ }
+
+ public String getVmType() {
+ return vmType;
+ }
+
+ public void setVmType(String vmType) {
+ this.vmType = vmType;
+ }
+
+ public List<VmNetwork> getVmNetworks() {
+ return vmNetworks;
+ }
+
+ public void setVmNetworks(List<VmNetwork> vmNetworks) {
+ this.vmNetworks = vmNetworks;
+ }
+
+ public Integer getVmCount() {
+ return vmCount;
+ }
+
+ public void setVmCount(Integer vmCount) {
+ this.vmCount = vmCount;
+ }
+
+ public List<VmName> getVmNames() {
+ return vmNames;
+ }
+
+ public void setVmNames(List<VmName> vmNames) {
+ this.vmNames = vmNames;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(VnfVm.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("vmType");
+ sb.append('=');
+ sb.append(((this.vmType == null)?"<null>":this.vmType));
+ sb.append(',');
+ sb.append("vmNetworks");
+ sb.append('=');
+ sb.append(((this.vmNetworks == null)?"<null>":this.vmNetworks));
+ sb.append(',');
+ sb.append("vmCount");
+ sb.append('=');
+ sb.append(((this.vmCount == null)?"<null>":this.vmCount));
+ sb.append(',');
+ sb.append("vmNames");
+ sb.append('=');
+ sb.append(((this.vmNames == null)?"<null>":this.vmNames));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.vmType == null)? 0 :this.vmType.hashCode()));
+ result = ((result* 31)+((this.vmCount == null)? 0 :this.vmCount.hashCode()));
+ result = ((result* 31)+((this.vmNames == null)? 0 :this.vmNames.hashCode()));
+ result = ((result* 31)+((this.vmNetworks == null)? 0 :this.vmNetworks.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof VnfVm) == false) {
+ return false;
+ }
+ VnfVm rhs = ((VnfVm) other);
+ return (((((this.vmType == rhs.vmType)||((this.vmType!= null)&&this.vmType.equals(rhs.vmType)))&&((this.vmCount == rhs.vmCount)||((this.vmCount!= null)&&this.vmCount.equals(rhs.vmCount))))&&((this.vmNames == rhs.vmNames)||((this.vmNames!= null)&&this.vmNames.equals(rhs.vmNames))))&&((this.vmNetworks == rhs.vmNetworks)||((this.vmNetworks!= null)&&this.vmNetworks.equals(rhs.vmNetworks))));
+ }
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringService.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringService.java
index 6ead761..ebb3277 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringService.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringService.java
@@ -19,10 +19,11 @@
package org.onap.pomba.contextbuilder.sdnc.service;
+import javax.servlet.http.HttpServletRequest;
import org.onap.pomba.common.datatypes.ModelContext;
import org.onap.pomba.contextbuilder.sdnc.exception.AuditException;
public interface SpringService {
- public ModelContext getContext(String serviceInstanceId, String transactionId) throws AuditException;
+ public ModelContext getContext(HttpServletRequest request, String serviceInstanceId, String transactionId, String partnerName) throws AuditException;
public String getSdncAuthoriztion();
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringServiceImpl.java
index b19c24c..b21a76b 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringServiceImpl.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringServiceImpl.java
@@ -18,22 +18,29 @@
package org.onap.pomba.contextbuilder.sdnc.service;
+import java.net.InetAddress;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.UUID;
+import javax.servlet.http.HttpServletRequest;
import org.apache.camel.ProducerTemplate;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
+import org.onap.aai.restclient.client.RestClient;
import org.onap.pomba.common.datatypes.ModelContext;
import org.onap.pomba.contextbuilder.sdnc.exception.AuditException;
-import org.onap.pomba.contextbuilder.sdnc.service.rs.RestService;
import org.onap.pomba.contextbuilder.sdnc.model.ServiceEntity;
+import org.onap.pomba.contextbuilder.sdnc.service.rs.RestService;
+import org.onap.pomba.contextbuilder.sdnc.util.RestUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.onap.pomba.contextbuilder.sdnc.util.RestUtil;
-import org.onap.aai.restclient.client.RestClient;
@Service
public class SpringServiceImpl implements SpringService {
+
private static Logger log = LoggerFactory.getLogger(RestService.class);
@Autowired
@@ -41,8 +48,6 @@ public class SpringServiceImpl implements SpringService {
private KieContainer kieContainer;
@Autowired
private ProducerTemplate producerTemplate;
-
- //AAI related
@Autowired
private String aaiBasicAuthorization;
@Autowired
@@ -53,24 +58,45 @@ public class SpringServiceImpl implements SpringService {
private String aaiPathToSearchNodeQuery;
@Autowired
private String aaiPathToCustomerQuery;
-
- public SpringServiceImpl() {
- // needed for instantiation
- }
-
@Autowired
public SpringServiceImpl(KieContainer kieContainer) {
this.kieContainer = kieContainer;
+ }
+ public SpringServiceImpl() {
+ // needed for instantiation
}
+ public static final String APP_NAME = "SdncContextBuilder";
+ public static final String MDC_REQUEST_ID = "RequestId";
+ public static final String MDC_SERVER_FQDN = "ServerFQDN";
+ public static final String MDC_SERVICE_NAME = "ServiceName";
+ public static final String MDC_PARTNER_NAME = "PartnerName";
+ public static final String MDC_START_TIME = "StartTime";
+ public static final String MDC_SERVICE_INSTANCE_ID = "ServiceInstanceId";
+ public static final String MDC_INVOCATION_ID = "InvocationID";
+ public static final String MDC_CLIENT_ADDRESS = "ClientAddress";
+ public static final String MDC_STATUS_CODE = "StatusCode";
+ public static final String MDC_RESPONSE_CODE = "ResponseCode";
+ public static final String MDC_INSTANCE_UUID = "InstanceUUID";
+
+ private static UUID instanceUUID = UUID.randomUUID();
+
@Override
- public ModelContext getContext(String serviceInstanceId, String transactionId) throws AuditException {
+ public ModelContext getContext(HttpServletRequest request, String serviceInstanceId, String transactionId, String partnerName) throws AuditException {
+
+ String remoteAddress = request.getRemoteAddr() != null ? request.getRemoteAddr() : null;
+ initMDC(transactionId, partnerName, serviceInstanceId, remoteAddress);
+
ModelContext context = null;
// Call AAI system to populate ServiceData
ServiceEntity serviceEntity = RestUtil.getServiceEntity(aaiClient, aaiBaseUrl, aaiBasicAuthorization, aaiPathToSearchNodeQuery, aaiPathToCustomerQuery, serviceInstanceId, transactionId);
+ if (null == serviceEntity) {
+ return context;
+ }
+
processApiMappingRules(serviceEntity);
log.info("SDN-C determined API: " + serviceEntity.getApiName());
@@ -79,6 +105,27 @@ public class SpringServiceImpl implements SpringService {
return context;
}
+ private void initMDC(String requestId, String partnerName, String serviceInstanceId, String remoteAddress) {
+ MDC.clear();
+ MDC.put(MDC_REQUEST_ID, requestId);
+ MDC.put(MDC_SERVICE_NAME, APP_NAME);
+ MDC.put(MDC_SERVICE_INSTANCE_ID, serviceInstanceId);
+ MDC.put(MDC_PARTNER_NAME, partnerName);
+ MDC.put(MDC_CLIENT_ADDRESS, remoteAddress);
+ MDC.put(MDC_START_TIME, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").format(new Date()));
+ MDC.put(MDC_INVOCATION_ID, UUID.randomUUID().toString());
+ MDC.put(MDC_INSTANCE_UUID, instanceUUID.toString());
+
+ try {
+ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getCanonicalHostName());
+ } catch (Exception e) {
+ // If, for some reason we are unable to get the canonical host name,
+ // we
+ // just want to leave the field null.
+ log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null");
+ }
+ }
+
private void processApiMappingRules(ServiceEntity serviceData){
KieSession kieSession = kieContainer.newKieSession();
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestService.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestService.java
index ec1581a..efab905 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestService.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestService.java
@@ -22,6 +22,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -33,12 +34,12 @@ import javax.ws.rs.core.Response;
@Api
-@Path("/service")
+@Path("/")
@Produces({MediaType.APPLICATION_JSON})
public interface RestService {
@GET
- @Path("/context")
+ @Path("service/context")
@Produces({MediaType.APPLICATION_JSON})
@ApiOperation(
value = "Respond SDNCContext Model Data",
@@ -52,7 +53,29 @@ public interface RestService {
@ApiResponse(code = 404, message = "Service not available"),
@ApiResponse(code = 500, message = "Unexpected Runtime error")
})
- public Response getContext(@Context HttpHeaders headers,
- @QueryParam("serviceInstanceId") String serviceInstanceId
+ public Response getContext(@Context HttpServletRequest request,
+ @Context HttpHeaders headers,
+ @QueryParam("serviceInstanceId") String serviceInstanceId
);
-} \ No newline at end of file
+
+ @GET
+ @Path("{version:[vV][1-5]}/service/context")
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(
+ value = "Respond SDNCContext v1 - v5 Model Data",
+ notes = "Returns a JSON object which represents the SDNCConetxt V1 model data",
+ response = Response.class
+ )
+ @ApiResponses(
+ value = {
+ @ApiResponse(code = 200, message = "OK"),
+ @ApiResponse(code = 400, message = "Bad Request"),
+ @ApiResponse(code = 404, message = "Service not available"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")
+ })
+ public Response getV1Context(@Context HttpServletRequest request,
+ @Context HttpHeaders headers,
+ @QueryParam("serviceInstanceId") String serviceInstanceId
+ );
+
+}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestServiceImpl.java
index d3b6378..a70012f 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestServiceImpl.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestServiceImpl.java
@@ -20,6 +20,7 @@ package org.onap.pomba.contextbuilder.sdnc.service.rs;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
@@ -43,20 +44,22 @@ public class RestServiceImpl implements RestService {
}
@Override
- public Response getContext(HttpHeaders headers, String serviceInstanceId) {
+ public Response getContext(HttpServletRequest request, HttpHeaders headers, String serviceInstanceId) {
Response response = null;
ModelContext sdncContext= null;
Gson gson = new GsonBuilder().create();
try {
- // Do some validation on Http headers and URL parameters
- RestUtil.validateHeader(headers, service.getSdncAuthoriztion());
+ // Validate URL parameters
RestUtil.validateURL(serviceInstanceId);
+ // Validate Headers and extract Partner Name
+ String partnerName = RestUtil.validateHeader(headers, service.getSdncAuthoriztion());
+
// Keep the same transaction id for logging purposeString transactionId
- String transactionId = RestUtil.extractTranIdHeader(headers);
+ String transactionId = RestUtil.extractTranactionIdHeader(headers);
- sdncContext = service.getContext(serviceInstanceId, transactionId);
+ sdncContext = service.getContext(request, serviceInstanceId, transactionId, partnerName);
if (sdncContext==null) {
// Return empty JSON
@@ -78,4 +81,10 @@ public class RestServiceImpl implements RestService {
return response;
}
+ @Override
+ public Response getV1Context(HttpServletRequest request, HttpHeaders headers, String serviceInstanceId) {
+ return getContext(request, headers, serviceInstanceId);
+ }
+
+
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java
index 8701c89..c29374b 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java
@@ -21,36 +21,51 @@ package org.onap.pomba.contextbuilder.sdnc.util;
import com.bazaarvoice.jolt.Chainr;
import com.bazaarvoice.jolt.JsonUtils;
import com.google.gson.Gson;
+import com.sun.jersey.core.util.MultivaluedMapImpl;
import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicInteger;
import javax.ws.rs.client.Client;
import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
+import org.json.JSONArray;
+import org.json.JSONException;
import org.json.JSONObject;
+import org.onap.aai.restclient.client.OperationResult;
+import org.onap.aai.restclient.client.RestClient;
import org.onap.pomba.common.datatypes.ModelContext;
+import org.onap.pomba.common.datatypes.Service;
+import org.onap.pomba.common.datatypes.VF;
+import org.onap.pomba.common.datatypes.VFModule;
+import org.onap.pomba.common.datatypes.VNFC;
+import org.onap.pomba.contextbuilder.sdnc.exception.AuditError;
import org.onap.pomba.contextbuilder.sdnc.exception.AuditException;
+import org.onap.pomba.contextbuilder.sdnc.model.ServiceEntity;
+import org.onap.pomba.contextbuilder.sdnc.model.VfModule;
+import org.onap.pomba.contextbuilder.sdnc.model.VmName;
+import org.onap.pomba.contextbuilder.sdnc.model.Vnf;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfInstance;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfList;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfTopologyIdentifier;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfVm;
import org.onap.pomba.contextbuilder.sdnc.service.rs.RestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.onap.aai.restclient.client.OperationResult;
-import org.onap.aai.restclient.client.RestClient;
-import javax.ws.rs.core.MediaType;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
-import java.util.Map;
-import java.util.Collections;
-import javax.ws.rs.core.MultivaluedMap;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.onap.pomba.contextbuilder.sdnc.model.ServiceEntity;
public class RestUtil {
private static Logger log = LoggerFactory.getLogger(RestService.class);
- public static final String INTERNAL_SERVER_ERROR = "Internal Server Error";
-
// HTTP headers
public static final String TRANSACTION_ID = "X-TransactionId";
public static final String FROM_APP_ID = "X-FromAppId";
@@ -59,18 +74,19 @@ public class RestUtil {
// AAI related
private static final String APP_NAME = "sdncCtxBuilder";
private static final String EMPTY_JSON_STRING = "{}";
- private static final String JSON_ATT_RESOURCE_TYPE = "resource-type";
- private static final String JSON_ATT_RESOURCE_LINK = "resource-link";
+ private static final String JSON_RESOURCE_TYPE = "resource-type";
+ private static final String JSON_RESOURCE_LINK = "resource-link";
+ private static final String JSON_GLOBAL_CUSTOMER_ID = "global-customer-id";
+ private static final String JSON_SUBSCRIBER_TYPE = "subscriber-type";
+ private static final String JSON_SUBSCRIBER_NAME = "subscriber-name";
private static final String RESULT_DATA = "result-data";
private static final String CATALOG_SERVICE_INSTANCE = "service-instance";
private static final String CUSTOMER_ID_STRING = "/customers/customer/";
private static final String SERVICE_TYPE_STRING = "/service-subscriptions/service-subscription/";
- private static final String CUSTOMER = "customer";
- private static final String JSON_ATT_GLOBAL_CUSTOMER_ID = "global-customer-id";
- private static final String JSON_ATT_SUBSCRIBER_TYPE = "subscriber-type";
- private static final String JSON_ATT_SUBSCRIBER_NAME = "subscriber-name";
private static final String FORWARD_SLASH = "/";
+ // SDNC vnf Json Path
+ private static final String specPath = "config/vnflist.spec";
// Parameters for Query SDNC Model Data REST API URL
private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
@@ -89,7 +105,11 @@ public class RestUtil {
}
- public static void validateHeader(HttpHeaders headers, String sdncCtxBuilderBasicAuthorization) throws AuditException {
+ public static String validateHeader(HttpHeaders headers, String sdncCtxBuilderBasicAuthorization) throws AuditException {
+
+ /*
+ * Validate that the headers are there and return the FROM_APP_ID
+ */
String fromAppId = headers.getRequestHeaders().getFirst(FROM_APP_ID);
if((fromAppId == null) || fromAppId.trim().isEmpty()) {
@@ -103,13 +123,15 @@ public class RestUtil {
if((!headerAuthorization.contentEquals(sdncCtxBuilderBasicAuthorization))) {
throw new AuditException("Failed Basic "+ AUTHORIZATION, Status.UNAUTHORIZED);
}
+
+ return fromAppId;
}
/*
* The purpose is to keep same transaction Id from north bound interface to south bound interface
*/
- public static String extractTranIdHeader(HttpHeaders headers) {
+ public static String extractTranactionIdHeader(HttpHeaders headers) {
String transactionId = null;
transactionId = headers.getRequestHeaders().getFirst(TRANSACTION_ID);
if((transactionId == null) || transactionId.trim().isEmpty()) {
@@ -133,14 +155,55 @@ public class RestUtil {
*/
public static String getSdncGenericResource(Client sdncClient, String sdncBaseUrl, String authorization, String sdncGenericResourcePath,
String serviceInstaceId) throws AuditException {
- String vnfSdncURL = sdncBaseUrl+generateSdncInstanceURL(sdncGenericResourcePath, serviceInstaceId);
- // send rest request to SDNC VNF-API
- return getSdncResource(sdncClient, vnfSdncURL, authorization);
+ String genericResourceSdncURL = sdncBaseUrl+generateSdncInstanceURL(sdncGenericResourcePath, serviceInstaceId);
+ // send rest request to SDNC GENERIC-RESOURCE-API
+ return getSdncResource(sdncClient, genericResourceSdncURL, authorization);
+ }
+
+ /**
+ * For each AAI VnfInstance, use the AAI Vf_module_id to make a rest call to SDNC VNF-API to create a list of all SDNC Vnfs.
+ * The URL for VNF-API is https://<SDN-C_HOST_NAME>:8543/restconf/config/VNF-API:vnfs/vnf-list/<vnf-id>
+ * @param sdncClient
+ * @param sdncBaseUrl
+ * @param sdncVnfInstancePath
+ * @param transactionId
+ * @param genericVNFPayload
+ * @param vnfInstance
+ * @return
+ * @throws AuditException
+ */
+ public static Map<String,List<Vnf>> getSdncVnfList(Client sdncClient, String sdncBaseUrl, String sdncVnfInstancePath,
+ String authorization, List<VnfInstance> vnfList) throws AuditException {
+
+ // define map [key: vnf-id, value: list of SDNC vnfs, which in fact are vf_modules]
+ Map<String,List<Vnf>> sdncVnfMap = new HashMap<String,List<Vnf>>();
+ for (VnfInstance vnfInstance: vnfList) {
+ if (vnfInstance.getVfModules() != null) {
+ List<Vnf> sdncVnfList = new ArrayList<>();
+ List<VfModule> vfModuleList = vnfInstance.getVfModules().getVfModule();
+ if (vfModuleList != null && !vfModuleList.isEmpty()) {
+ for (VfModule vfModuleInstance : vfModuleList) {
+ // create SDNC VNF-API url using AAI VnfInstance VfModule Vf_module_id
+ String vnfSdncURL = sdncBaseUrl+generateSdncInstanceURL(sdncVnfInstancePath, vfModuleInstance.getVfModuleId());
+ // send rest request to SDNC VNF-API
+ String sndcVNFPayload = getSdncResource(sdncClient, vnfSdncURL, authorization);
+ if (isEmptyJson(sndcVNFPayload)) {
+ log.info("VNF with vf-module-id is not found from SDNC");
+ } else {
+ List<Vnf> vnfsList = extractVnfList(sndcVNFPayload);
+ sdncVnfList.addAll(vnfsList);
+ }
+ }
+ }
+ sdncVnfMap.put(vnfInstance.getVnfId(),sdncVnfList);
+ }
+ }
+ return sdncVnfMap;
}
- public static ModelContext transform(String sdncResponse) {
- List<Object> jsonSpec = JsonUtils.filepathToList("config/sdnccontextbuilder.spec");
+ public static ModelContext transformGenericResource(String sdncResponse, String specPath) {
+ List<Object> jsonSpec = JsonUtils.filepathToList(specPath);
Object jsonInput = JsonUtils.jsonToObject(sdncResponse);
Chainr chainr = Chainr.fromSpec(jsonSpec);
Object transObject = chainr.transform(jsonInput);
@@ -149,9 +212,66 @@ public class RestUtil {
}
+ /**
+ * Transform the AAI and SDNC models to the audit common model
+ * @param aaiVnfLst
+ * @param sdncVnfMap
+ * @return
+ * @throws AuditException
+ */
+ public static ModelContext transformVnfList(List<VnfInstance> aaiVnfLst, Map<String,List<Vnf>> sdncVnfMap) {
+ ModelContext context = new ModelContext();
+ Service service = new Service();
+ List<VF> vfList = new ArrayList<>();
+
+ // Initialize common model members to null
+ service.setInvariantUuid("null");
+ service.setUuid("null");
+ service.setName("null");
+
+ for(VnfInstance aaiVnfInstance : aaiVnfLst) {
+ VF vf = new VF();
+ // Initialize common model members to null
+ vf.setName("null");
+ vf.setType("null");
+ vf.setInvariantUuid("null");
+ vf.setUuid("null");
+ List<Vnf> sdncVnfList = sdncVnfMap.get(aaiVnfInstance.getVnfId());
+ try {
+ // Set the common model VF name and type from the SDNC topology info
+ VnfTopologyIdentifier vnfTopologyId = null;
+ if (sdncVnfList != null && !sdncVnfList.isEmpty()) {
+ for(Vnf sdncVnf : sdncVnfList) {
+ vnfTopologyId = sdncVnf.getServiceData().getVnfTopologyInformation().getVnfTopologyIdentifier();
+ if (vf.getName().contentEquals("null")) {
+ vf.setName(vnfTopologyId.getGenericVnfName());
+ }
+ if (vf.getType().contentEquals("null")) {
+ vf.setType(vnfTopologyId.getGenericVnfType());
+ }
+ }
+ }
+ } catch (Exception e) {
+ log.info(e.getMessage());
+ }
+ // Get the common model list of VFModule from the SDNC VNF List
+ List<VFModule> vfmoduleLst = getVfModuleList(aaiVnfInstance, sdncVnfList);
+ vf.setVfModules(vfmoduleLst);
+
+ // Get the common model list of VNFC from the SDNC Vnf
+ List<VNFC> vnfcList = getVnfcList(sdncVnfList);
+ vf.setVnfcs(vnfcList);
+ vfList.add(vf);
+ }
- private static String getSdncResource(Client sdncClient, String url, String authorization) throws AuditException {
+ context.setService(service);
+ context.setVfs(vfList);
+ return context;
+ }
+
+ public static String getSdncResource(Client sdncClient, String url, String authorization) throws AuditException {
+ log.info("SDNC GET request at url = " + url);
Response response = sdncClient.target(url).request()
.header("Accept", "application/json")
.header(AUTHORIZATION, authorization).get();
@@ -164,7 +284,7 @@ public class RestUtil {
return new JSONObject().toString();
} else {
- throw new AuditException(INTERNAL_SERVER_ERROR + " with " + response.getStatus());
+ throw new AuditException(AuditError.INTERNAL_SERVER_ERROR + " with " + response.getStatus());
}
}
@@ -191,10 +311,10 @@ public class RestUtil {
String aaiPathToSearchNodeQuery,
String aaiPathToCustomerQuery,
String serviceInstanceId,
- String transactionId)throws AuditException {
+ String transactionId) throws AuditException {
- String obtainResourceLink_url = generateUrl_ForResourceLink(aaiBaseUrl, aaiPathToSearchNodeQuery, serviceInstanceId);
- String aaiResourceData = getAaiResource(aaiClient, obtainResourceLink_url, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ String getResourceLinkUrl = generateAaiUrl(aaiBaseUrl, aaiPathToSearchNodeQuery, serviceInstanceId);
+ String aaiResourceData = getAaiResource(aaiClient, getResourceLinkUrl, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
// Handle the case if the service instance is not found in AAI
if (isEmptyJson(aaiResourceData)) {
@@ -203,22 +323,23 @@ public class RestUtil {
return null;
}
- String resourceLink = extractResourceLinkBasedOnServiceInstance(aaiResourceData, CATALOG_SERVICE_INSTANCE);
+ String resourceLink = extractResourceLink(aaiResourceData, CATALOG_SERVICE_INSTANCE);
ServiceEntity serviceEntityObj = createServiceEntityObj (resourceLink); //customerId and serviceType are updated here.
if (serviceEntityObj != null) {
- serviceEntityObj.setServiceInstanceId(serviceInstanceId);
- String customerId = serviceEntityObj.getCustomerId();
- // Obtain customerType and customerName
- String obtainCustomer_url = generateUrl_ForCustomer (aaiBaseUrl, aaiPathToCustomerQuery, customerId);
- String aaiCustomerData = getAaiResource(aaiClient, obtainCustomer_url, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
- if (isEmptyJson(aaiCustomerData)) {
- log.info(" Customer name {} is not found from AAI", customerId);
- // Only return the empty Json on the root level. i.e service instance
- throw new AuditException(INTERNAL_SERVER_ERROR + ": Customer ID cannot be found from AAI :" + customerId);
- }
- // Update customerType and customerName to the existing serviceEntityObj
- updateServiceEntityObj ( aaiCustomerData , serviceEntityObj);
+ serviceEntityObj.setTransactionId(transactionId);
+ serviceEntityObj.setServiceInstanceId(serviceInstanceId);
+ String customerId = serviceEntityObj.getCustomerId();
+ // Obtain customerType and customerName
+ String getCustomerUrl = generateAaiUrl (aaiBaseUrl, aaiPathToCustomerQuery, customerId);
+ String aaiCustomerData = getAaiResource(aaiClient, getCustomerUrl, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ if (isEmptyJson(aaiCustomerData)) {
+ log.info(" Customer name {} is not found from AAI", customerId);
+ // Only return the empty Json on the root level. i.e service instance
+ throw new AuditException(AuditError.INTERNAL_SERVER_ERROR + ": Customer ID cannot be found from AAI :" + customerId);
+ }
+ // Update customerType and customerName to the existing serviceEntityObj
+ updateServiceEntityObj ( aaiCustomerData , serviceEntityObj);
}
return serviceEntityObj;
@@ -228,15 +349,10 @@ public class RestUtil {
return (serviceInstancePayload.equals(EMPTY_JSON_STRING));
}
- private static String generateUrl_ForResourceLink (String aaiBaseURL, String aaiPathToSearchNodeQuery ,String serviceInstanceId) {
- return aaiBaseURL + aaiPathToSearchNodeQuery + serviceInstanceId;
+ public static String generateAaiUrl (String aaiBaseURL, String aaiPathToCustomerQuery, String parameter) {
+ return aaiBaseURL + aaiPathToCustomerQuery + (parameter != null ? parameter : "");
}
- private static String generateUrl_ForCustomer (String aaiBaseURL, String aaiPathToCustomerQuery ,String customerId) {
- return aaiBaseURL + aaiPathToCustomerQuery + customerId;
- }
-
- @SuppressWarnings("unchecked")
private static Map<String, List<String>> buildHeaders(String aaiBasicAuthorization, String transactionId) {
MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
headers.put(TRANSACTION_ID, Collections.singletonList(transactionId));
@@ -245,9 +361,9 @@ public class RestUtil {
return headers;
}
- private static String getAaiResource(RestClient client, String url, String aaiBasicAuthorization, String transId, MediaType mediaType)
+ public static String getAaiResource(RestClient client, String url, String aaiBasicAuthorization, String transactionId, MediaType mediaType)
throws AuditException {
- OperationResult result = client.get(url, buildHeaders(aaiBasicAuthorization, transId), MediaType.valueOf(MediaType.APPLICATION_JSON));
+ OperationResult result = client.get(url, buildHeaders(aaiBasicAuthorization, transactionId), MediaType.valueOf(MediaType.APPLICATION_JSON));
if (result.getResultCode() == 200) {
return result.getResult();
@@ -257,7 +373,7 @@ public class RestUtil {
return new JSONObject().toString();
} else {
- throw new AuditException(INTERNAL_SERVER_ERROR + " with " + result.getFailureCause());
+ throw new AuditException(AuditError.INTERNAL_SERVER_ERROR + " with " + result.getFailureCause());
}
}
@@ -272,7 +388,7 @@ public class RestUtil {
* ]
* }
*/
- private static String extractResourceLinkBasedOnServiceInstance(String payload, String catalog) throws AuditException {
+ private static String extractResourceLink(String payload, String catalog) throws AuditException {
String resourceLink = null;
log.info("Fetching the resource-link based on resource-type=" + catalog);
@@ -281,8 +397,8 @@ public class RestUtil {
if (result_data_list != null) {
for (int i = 0; i < result_data_list.length(); i++) {
JSONObject obj = result_data_list.optJSONObject(i);
- if (obj.has(JSON_ATT_RESOURCE_TYPE) && (obj.getString(JSON_ATT_RESOURCE_TYPE).equals(catalog) )) {
- resourceLink = obj.getString(JSON_ATT_RESOURCE_LINK);
+ if (obj.has(JSON_RESOURCE_TYPE) && (obj.getString(JSON_RESOURCE_TYPE).equals(catalog) )) {
+ resourceLink = obj.getString(JSON_RESOURCE_LINK);
log.info(resourceLink);
return resourceLink;
}
@@ -290,7 +406,7 @@ public class RestUtil {
}
} catch (JSONException e) {
log.error(e.getMessage());
- throw new AuditException("Json Reader Parse Error " + e.getMessage());
+ throw new AuditException(AuditError.JSON_PARSE_ERROR + e.getMessage());
}
log.warn("resource-link CANNOT be found: ", payload );
@@ -298,6 +414,7 @@ public class RestUtil {
return resourceLink;
}
+
/*
* Extract the "subscriber-name" and "subscriber-type" from Json payload. For example
* {
@@ -316,9 +433,9 @@ public class RestUtil {
try {
JSONObject obj = new JSONObject (payload);
- if (obj.has(JSON_ATT_GLOBAL_CUSTOMER_ID) && (obj.getString(JSON_ATT_GLOBAL_CUSTOMER_ID).equals(customerId) )) {
- serviceEntityObj.setCustomerType(obj.getString(JSON_ATT_SUBSCRIBER_TYPE));
- serviceEntityObj.setCustomerName(obj.getString(JSON_ATT_SUBSCRIBER_NAME));
+ if (obj.has(JSON_GLOBAL_CUSTOMER_ID) && (obj.getString(JSON_GLOBAL_CUSTOMER_ID).equals(customerId) )) {
+ serviceEntityObj.setCustomerType(obj.getString(JSON_SUBSCRIBER_TYPE));
+ serviceEntityObj.setCustomerName(obj.getString(JSON_SUBSCRIBER_NAME));
return;
}
} catch (JSONException e) {
@@ -353,9 +470,106 @@ public class RestUtil {
return serviceEntity;
}
+
+ /*
+ * Extract the vnf-list from the Json payload.
+ */
+ private static List<Vnf> extractVnfList(String payload) throws AuditException {
+ List<Object> jsonSpec = JsonUtils.filepathToList(specPath);
+ Object jsonInput = JsonUtils.jsonToObject(payload);
+ Chainr chainr = Chainr.fromSpec(jsonSpec);
+ Object transObject = chainr.transform(jsonInput);
+ String vnfListString = JsonUtils.toPrettyJsonString(transObject);
+ VnfList vnfList = VnfList.fromJson(vnfListString);
+ return vnfList.getVnfList();
+ }
+
private static String abstractStrInfo (String origStr, String matchStr) {
String after = origStr.substring( origStr.indexOf(matchStr) + matchStr.length());
return after.substring(0, after.indexOf(FORWARD_SLASH));
}
+
+ /**
+ * Get the common model list of AAI exist in SDNC per each (AAI GenericVNF > vf-modules > vf-module > model-version-id )
+ * @param aaiVnf
+ * @param sdncVnfList
+ * @return
+ * @throws AuditException
+ */
+ private static List<VFModule> getVfModuleList(VnfInstance aaiVnf, List<Vnf> sdncVnfList) {
+ List<VFModule> vfmoduleLst = new ArrayList<>();
+ if (aaiVnf.getVfModules() != null && aaiVnf.getVfModules().getVfModule() != null ) {
+ ConcurrentMap<String, AtomicInteger> vnfModulemap = buildMaxInstanceMap(aaiVnf.getVfModules().getVfModule()) ;
+ for (Map.Entry<String, AtomicInteger> entry : vnfModulemap.entrySet()) {
+ String modelVersionId = entry.getKey();
+ for (Vnf sdncVnf : sdncVnfList) {
+ if ( sdncVnf.getVnfId().equals(modelVersionId)) {
+ VFModule vfModule = new VFModule();
+ vfModule.setUuid(modelVersionId);
+ vfModule.setMaxInstances(entry.getValue().intValue());
+ vfmoduleLst.add(vfModule);
+ }
+ }
+ }
+ }
+ log.debug("The size of vfmoduleLst:"+ vfmoduleLst.size());
+ return vfmoduleLst;
+ }
+
+ /*
+ * Build the map with key (model_version_id) and with the max occurrences of the value in the map
+ * @param vf_module_List
+ * @return
+ */
+ private static ConcurrentMap<String, AtomicInteger> buildMaxInstanceMap(List<VfModule> vfModuleList) {
+
+ ConcurrentMap<String, AtomicInteger> map = new ConcurrentHashMap<>();
+
+ for (VfModule vfModule: vfModuleList) {
+ String vfModuleId = vfModule.getVfModuleId();
+ map.putIfAbsent(vfModuleId, new AtomicInteger(0));
+ map.get(vfModuleId).incrementAndGet();
+ }
+ return map;
+ }
+
+ /*
+ * Get the common model list of VNFC from the SDNC Vnfs
+ * @param sdncVnfMap
+ * @return
+ */
+ private static List<VNFC> getVnfcList(List<Vnf> sdncVnfList) {
+ List<VNFC> vnfcList = new ArrayList<>();
+ if (sdncVnfList != null && !sdncVnfList.isEmpty()) {
+ for (Vnf sdncVnf : sdncVnfList) {
+ try {
+ List<VnfVm> sdncVnfVmLst = sdncVnf.getServiceData().getVnfTopologyInformation().getVnfAssignments().getVnfVms();
+ if (sdncVnfVmLst != null && !sdncVnfVmLst.isEmpty()) {
+ for (VnfVm sdncVnfVm : sdncVnfVmLst) {
+ List<VmName> sdncVmNameLst = sdncVnfVm.getVmNames();
+ if (sdncVmNameLst != null && !sdncVmNameLst.isEmpty()) {
+ for (VmName sdncVmName : sdncVmNameLst) {
+ VNFC vnfc = new VNFC();
+ // Initialize common model members to null
+ vnfc.setInvariantUuid("null");
+ vnfc.setUuid("null");
+ vnfc.setType(sdncVnfVm.getVmType() == null ? "null" : sdncVnfVm.getVmType());
+ vnfc.setName(sdncVmName.getVmName() == null ? "null" : sdncVmName.getVmName());
+ vnfcList.add(vnfc);
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ log.info(e.getMessage());
+ }
+ }
+ }
+ log.debug("The size of vnfcList:"+ vnfcList.size());
+ return vnfcList;
+ }
+
+
+
}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/AudutExceptionTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/AudutExceptionTest.java
new file mode 100644
index 0000000..b9c9db4
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/AudutExceptionTest.java
@@ -0,0 +1,47 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertTrue;
+
+import javax.ws.rs.core.Response.Status;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.exception.AuditError;
+import org.onap.pomba.contextbuilder.sdnc.exception.AuditException;
+
+public class AudutExceptionTest {
+ @Test
+ public void testAudutException() {
+ AuditException auditException1 = new AuditException(AuditError.JSON_PARSE_ERROR);
+ assertTrue(auditException1.getMessage().equals(AuditError.JSON_PARSE_ERROR));
+
+ AuditException auditException2 = new AuditException(AuditError.INTERNAL_SERVER_ERROR,
+ Status.INTERNAL_SERVER_ERROR);
+ assertTrue(auditException2.getMessage().equals(AuditError.INTERNAL_SERVER_ERROR));
+ assertTrue(auditException2.getHttpStatus().equals(Status.INTERNAL_SERVER_ERROR));
+
+ Exception ex = new Exception(AuditError.JSON_EMPTY_RESPONSE);
+ AuditException auditException3 = new AuditException(AuditError.JSON_EMPTY_RESPONSE, ex);
+ assertTrue(auditException3.getMessage().equals(AuditError.JSON_EMPTY_RESPONSE));
+ assertTrue(auditException3.getCause().getMessage().equals(AuditError.JSON_EMPTY_RESPONSE));
+
+
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/AvailabilityZoneTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/AvailabilityZoneTest.java
new file mode 100644
index 0000000..b826946
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/AvailabilityZoneTest.java
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.AvailabilityZone;
+
+public class AvailabilityZoneTest {
+ @Test
+ public void testAvailabilityZoneWithParameters() {
+ AvailabilityZone availabilityZone = new AvailabilityZone("availabilityZone");
+ assertEquals("availabilityZone", availabilityZone.getAvailabilityZone());
+ }
+
+ @Test
+ public void testAvailabilityZone() {
+ AvailabilityZone availabilityZone = new AvailabilityZone();
+ availabilityZone.setAvailabilityZone("availabilityZone");
+ assertEquals("availabilityZone", availabilityZone.getAvailabilityZone());
+ String availabilityZoneString = availabilityZone.toString();
+ assertTrue(availabilityZoneString.contains("[availabilityZone=availabilityZone]"));
+ }
+
+ @Test
+ public void testAvailabilityZoneIsEqual() {
+ AvailabilityZone availabilityZone1 = new AvailabilityZone("availabilityZone1");
+ assertTrue(availabilityZone1.equals(availabilityZone1));
+ assertTrue(availabilityZone1.hashCode() == -383357559);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/NetworkIpTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/NetworkIpTest.java
new file mode 100644
index 0000000..13ba678
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/NetworkIpTest.java
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.NetworkIp;
+
+public class NetworkIpTest {
+ @Test
+ public void testNetworkIpWithParameters() {
+ NetworkIp networkIp = new NetworkIp("networkIp");
+ assertEquals("networkIp", networkIp.getIpAddress());
+ }
+
+ @Test
+ public void testNetworkIp() {
+ NetworkIp networkIp = new NetworkIp();
+ networkIp.setIpAddress("networkIp");
+ assertEquals("networkIp", networkIp.getIpAddress());
+ String networkIpString = networkIp.toString();
+ assertTrue(networkIpString.contains("[ipAddress=networkIp]"));
+ }
+
+ @Test
+ public void testNetworkIpIsEqual() {
+ NetworkIp networkIp1 = new NetworkIp("networkIp1");
+ assertTrue(networkIp1.equals(networkIp1));
+ assertTrue(networkIp1.hashCode() == -478253317);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/NetworkIpV6Test.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/NetworkIpV6Test.java
new file mode 100644
index 0000000..68e1e48
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/NetworkIpV6Test.java
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.NetworkIpV6;
+
+public class NetworkIpV6Test {
+ @Test
+ public void testNetworkIpV6WithParameters() {
+ NetworkIpV6 networkIpV6 = new NetworkIpV6("networkIpV6");
+ assertEquals("networkIpV6", networkIpV6.getIpAddressIpV6());
+ }
+
+ @Test
+ public void testNetworkIpV6() {
+ NetworkIpV6 networkIpV6 = new NetworkIpV6();
+ networkIpV6.setIpAddressIpV6("networkIpV6");
+ assertEquals("networkIpV6", networkIpV6.getIpAddressIpV6());
+ String networkIpV6String = networkIpV6.toString();
+ assertTrue(networkIpV6String.contains("[ipAddressIpV6=networkIpV6]"));
+ }
+
+ @Test
+ public void testNetworkIpV6IsEqual() {
+ NetworkIpV6 networkIpV61 = new NetworkIpV6("networkIpV61");
+ assertTrue(networkIpV61.equals(networkIpV61));
+ assertTrue(networkIpV61.hashCode() == -39929445);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/OperStatusTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/OperStatusTest.java
new file mode 100644
index 0000000..5c9dc4b
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/OperStatusTest.java
@@ -0,0 +1,57 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.OperStatus;
+
+public class OperStatusTest {
+ @Test
+ public void testOperStatusWithParameters() {
+ OperStatus operStatus = new OperStatus("lastAction", "orderStatus", "lastOrderStatus");
+ assertEquals("lastAction", operStatus.getLastAction());
+ assertEquals("orderStatus", operStatus.getOrderStatus());
+ assertEquals("lastOrderStatus", operStatus.getLastOrderStatus());
+ }
+
+ @Test
+ public void testOperStatus() {
+ OperStatus operStatus = new OperStatus();
+ operStatus.setLastAction("lastAction");
+ operStatus.setOrderStatus("orderStatus");
+ operStatus.setLastOrderStatus("lastOrderStatus");
+ assertEquals("lastAction", operStatus.getLastAction());
+ assertEquals("orderStatus", operStatus.getOrderStatus());
+ assertEquals("lastOrderStatus", operStatus.getLastOrderStatus());
+ String operStatusString = operStatus.toString();
+ assertTrue(operStatusString
+ .contains("[lastAction=lastAction,orderStatus=orderStatus,lastOrderStatus=lastOrderStatus]"));
+ }
+
+ @Test
+ public void testOperStatusIsEqual() {
+ OperStatus operStatus1 = new OperStatus("lastAction1", "orderStatus1", "lastOrderStatus1");
+ assertTrue(operStatus1.equals(operStatus1));
+ assertTrue(operStatus1.hashCode() == 1846706130);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelatedToPropertyTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelatedToPropertyTest.java
new file mode 100644
index 0000000..c60d89c
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelatedToPropertyTest.java
@@ -0,0 +1,57 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.RelatedToProperty;
+
+public class RelatedToPropertyTest {
+
+ @Test
+ public void testRelatedToPropertyWithParameters() {
+ RelatedToProperty relatedToProperty = new RelatedToProperty("propertyKey", "propertyValue");
+ assertEquals("propertyKey", relatedToProperty.getPropertyKey());
+ assertEquals("propertyValue", relatedToProperty.getPropertyValue());
+ }
+
+ @Test
+ public void testRelatedToProperty() {
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ relatedToProperty.setPropertyKey("propertyKey");
+ relatedToProperty.setPropertyValue("propertyValue");
+ assertEquals("propertyKey", relatedToProperty.getPropertyKey());
+ assertEquals("propertyValue", relatedToProperty.getPropertyValue());
+ String relatedToPropertyString = relatedToProperty.toString();
+ assertTrue(relatedToPropertyString.contains("[propertyKey=propertyKey,propertyValue=propertyValue]"));
+ }
+
+ @Test
+ public void testRelatedToPropertyIsEqual() {
+ RelatedToProperty relatedToProperty1 = new RelatedToProperty("propertyKey1", "propertyValue1");
+ RelatedToProperty relatedToProperty2 = new RelatedToProperty("propertyKey2", "propertyValue2");
+ RelatedToProperty relatedToProperty3 = new RelatedToProperty("propertyKey1", "propertyValue1");
+ assertTrue(relatedToProperty1.equals(relatedToProperty1));
+ assertTrue(!relatedToProperty1.equals(relatedToProperty2));
+ assertTrue(relatedToProperty1.equals(relatedToProperty3));
+ assertTrue(relatedToProperty1.hashCode() == 551990433);
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipDatumTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipDatumTest.java
new file mode 100644
index 0000000..8581f0b
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipDatumTest.java
@@ -0,0 +1,60 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.RelationshipDatum;
+
+public class RelationshipDatumTest {
+ @Test
+ public void testRelationshipDatum() {
+ RelationshipDatum relationshipDatum = new RelationshipDatum();
+
+ relationshipDatum.setRelationshipKey("relationshipKey");
+ relationshipDatum.setRelationshipValue("relationshipValue");
+
+ assertEquals("relationshipKey", relationshipDatum.getRelationshipKey());
+ assertEquals("relationshipValue", relationshipDatum.getRelationshipValue());
+ }
+
+ @Test
+ public void testRelationshipDatumWithParameters() {
+ RelationshipDatum relationshipDatum = new RelationshipDatum("relationshipKey", "relationshipValue");
+
+ assertEquals("relationshipKey", relationshipDatum.getRelationshipKey());
+ assertEquals("relationshipValue", relationshipDatum.getRelationshipValue());
+ String relationshipDatumString = relationshipDatum.toString();
+ assertTrue(relationshipDatumString
+ .contains("[relationshipKey=relationshipKey,relationshipValue=relationshipValue]"));
+ }
+
+ @Test
+ public void testRelationshipDatumEqual() {
+ RelationshipDatum relationshipDatum1 = new RelationshipDatum("relationshipKey1", "relationshipValue1");
+ RelationshipDatum relationshipDatum2 = new RelationshipDatum("relationshipKey2", "relationshipValue2");
+ RelationshipDatum relationshipDatum3 = new RelationshipDatum("relationshipKey1", "relationshipValue1");
+ assertTrue(relationshipDatum1.equals(relationshipDatum1));
+ assertTrue(!relationshipDatum1.equals(relationshipDatum2));
+ assertTrue(relationshipDatum1.equals(relationshipDatum3));
+ assertTrue(relationshipDatum1.hashCode() == 1756006411);
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipListTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipListTest.java
new file mode 100644
index 0000000..5656932
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipListTest.java
@@ -0,0 +1,102 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.RelatedToProperty;
+import org.onap.pomba.contextbuilder.sdnc.model.Relationship;
+import org.onap.pomba.contextbuilder.sdnc.model.RelationshipDatum;
+import org.onap.pomba.contextbuilder.sdnc.model.RelationshipList;
+
+public class RelationshipListTest {
+ @Test
+ public void testRelationshipList() {
+ RelationshipList relationshipList = new RelationshipList();
+ Relationship relationship = new Relationship();
+ List<Relationship> list = new ArrayList<Relationship>();
+ list.add(relationship);
+ relationshipList.setRelationship(list);
+
+ assertTrue(relationshipList.getRelationship().size() == 1);
+
+ relationship.setRelatedLink("relatedLink");
+ relationship.setRelatedTo("relatedTo");
+
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ List<RelatedToProperty> relatedToPropertyList = new ArrayList<RelatedToProperty>();
+ relatedToPropertyList.add(relatedToProperty);
+ relationship.setRelatedToProperty(relatedToPropertyList);
+ list.add(relationship);
+ relationshipList.setRelationship(list);
+
+ String relationshipListString = relationshipList.toString();
+ assertTrue(relationshipListString.contains("[relationship="));
+
+ }
+
+ @Test
+ public void testRelationshipListWithParameters() {
+ Relationship relationship = new Relationship("relatedTo",
+ "relatedLink",
+ new ArrayList<RelationshipDatum>(),
+ new ArrayList<RelatedToProperty>());
+ List<Relationship> listOfRelationship = new ArrayList<Relationship>();
+ listOfRelationship.add(relationship);
+ RelationshipList relationshipList = new RelationshipList(listOfRelationship);
+
+ assertTrue(relationshipList.getRelationship().size() == 1);
+ }
+
+ @Test
+ public void testRelationshipListEquals() {
+
+ Relationship relationship1 = new Relationship("relatedTo1",
+ "relatedLink1",
+ new ArrayList<RelationshipDatum>(),
+ new ArrayList<RelatedToProperty>());
+ List<Relationship> listOfRelationship = new ArrayList<Relationship>();
+ listOfRelationship.add(relationship1);
+ RelationshipList relationshipList1 = new RelationshipList(listOfRelationship);
+
+ Relationship relationship2 = new Relationship("relatedTo2",
+ "relatedLink2",
+ new ArrayList<RelationshipDatum>(),
+ new ArrayList<RelatedToProperty>());
+ List<Relationship> listOfRelationship2 = new ArrayList<Relationship>();
+ listOfRelationship.add(relationship2);
+ RelationshipList relationshipList2 = new RelationshipList(listOfRelationship2);
+
+ Relationship relationship3 = new Relationship("relatedTo1",
+ "relatedLink1",
+ new ArrayList<RelationshipDatum>(),
+ new ArrayList<RelatedToProperty>());
+ List<Relationship> listOfRelationship3 = new ArrayList<Relationship>();
+ listOfRelationship.add(relationship3);
+ RelationshipList relationshipList3 = new RelationshipList(listOfRelationship3);
+
+ assertTrue(relationshipList1.equals(relationshipList1));
+ assertTrue(!relationshipList1.equals(relationshipList2));
+ assertTrue(!relationshipList1.equals(relationshipList3));
+ assertTrue(relationshipList1.hashCode() == 489848468);
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipTest.java
new file mode 100644
index 0000000..8535575
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RelationshipTest.java
@@ -0,0 +1,88 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.RelatedToProperty;
+import org.onap.pomba.contextbuilder.sdnc.model.Relationship;
+import org.onap.pomba.contextbuilder.sdnc.model.RelationshipDatum;
+
+public class RelationshipTest {
+
+ @Test
+ public void testRelationshipWithParameters() {
+ List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>();
+ List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>();
+ Relationship relationship = new Relationship("relatedTo", "relatedLink", relationshipDatum, relatedToProperty);
+
+ assertEquals("relatedTo", relationship.getRelatedTo());
+ assertEquals("relatedLink", relationship.getRelatedLink());
+ assertTrue(relationship.getRelationshipData().isEmpty());
+ assertTrue(relationship.getRelatedToProperty().isEmpty());
+ }
+
+ @Test
+ public void testRelationship() {
+ Relationship relationship = new Relationship();
+ List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>();
+ List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>();
+
+ relationship.setRelatedLink("relatedLink");
+ relationship.setRelatedTo("relatedTo");
+ relationship.setRelatedToProperty(relatedToProperty);
+ relationship.setRelationshipData(relationshipDatum);
+
+ assertEquals("relatedTo", relationship.getRelatedTo());
+ assertEquals("relatedLink", relationship.getRelatedLink());
+ assertTrue(relationship.getRelationshipData().isEmpty());
+ assertTrue(relationship.getRelatedToProperty().isEmpty());
+
+ String relationshipString = relationship.toString();
+ assertTrue(relationshipString
+ .contains("[relatedTo=relatedTo,relatedLink=relatedLink,relationshipData=[],relatedToProperty=[]]"));
+ }
+
+ @Test
+ public void testRelationshipEquals() {
+ List<RelationshipDatum> relationshipDatum = new ArrayList<RelationshipDatum>();
+ List<RelatedToProperty> relatedToProperty = new ArrayList<RelatedToProperty>();
+ Relationship relationship1 = new Relationship("relatedTo1",
+ "relatedLink1",
+ relationshipDatum,
+ relatedToProperty);
+ Relationship relationship2 = new Relationship("relatedTo2",
+ "relatedLink2",
+ relationshipDatum,
+ relatedToProperty);
+ Relationship relationship3 = new Relationship("relatedTo1",
+ "relatedLink1",
+ relationshipDatum,
+ relatedToProperty);
+ assertTrue(relationship1.equals(relationship1));
+ assertTrue(!relationship1.equals(relationship2));
+ assertTrue(relationship1.equals(relationship3));
+ assertTrue(relationship1.hashCode() == 1959828762);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RequestInformationTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RequestInformationTest.java
new file mode 100644
index 0000000..5208ce1
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/RequestInformationTest.java
@@ -0,0 +1,57 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.RequestInformation;
+
+public class RequestInformationTest {
+ @Test
+ public void testRequestInformationWithParameters() {
+ RequestInformation requestInformation = new RequestInformation("requestId", "source", "requestAction");
+ assertEquals("requestId", requestInformation.getRequestId());
+ assertEquals("source", requestInformation.getSource());
+ assertEquals("requestAction", requestInformation.getRequestAction());
+ }
+
+ @Test
+ public void testRequestInformation() {
+ RequestInformation requestInformation = new RequestInformation();
+ requestInformation.setRequestId("requestId");
+ requestInformation.setSource("source");
+ requestInformation.setRequestAction("requestAction");
+ assertEquals("requestId", requestInformation.getRequestId());
+ assertEquals("source", requestInformation.getSource());
+ assertEquals("requestAction", requestInformation.getRequestAction());
+ String requestInformationString = requestInformation.toString();
+ assertTrue(requestInformationString
+ .contains("[requestId=requestId,source=source,requestAction=requestAction]"));
+ }
+
+ @Test
+ public void testRequestInformationIsEqual() {
+ RequestInformation requestInformation1 = new RequestInformation("requestId1", "source1", "requestAction1");
+ assertTrue(requestInformation1.equals(requestInformation1));
+ assertTrue(requestInformation1.hashCode() == 636999996);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/SdncRequestHeaderTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/SdncRequestHeaderTest.java
new file mode 100644
index 0000000..1fc18a7
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/SdncRequestHeaderTest.java
@@ -0,0 +1,61 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.SdncRequestHeader;
+
+public class SdncRequestHeaderTest {
+ @Test
+ public void testSdncRequestHeaderWithParameters() {
+ SdncRequestHeader sdncRequestHeader = new SdncRequestHeader("svcNotificationUrl",
+ "svcRequestId",
+ "svcAction");
+ assertEquals("svcNotificationUrl", sdncRequestHeader.getSvcNotificationUrl());
+ assertEquals("svcRequestId", sdncRequestHeader.getSvcRequestId());
+ assertEquals("svcAction", sdncRequestHeader.getSvcAction());
+ }
+
+ @Test
+ public void testSdncRequestHeader() {
+ SdncRequestHeader sdncRequestHeader = new SdncRequestHeader();
+ sdncRequestHeader.setSvcNotificationUrl("svcNotificationUrl");
+ sdncRequestHeader.setSvcRequestId("svcRequestId");
+ sdncRequestHeader.setSvcAction("svcAction");
+ assertEquals("svcNotificationUrl", sdncRequestHeader.getSvcNotificationUrl());
+ assertEquals("svcRequestId", sdncRequestHeader.getSvcRequestId());
+ assertEquals("svcAction", sdncRequestHeader.getSvcAction());
+ String sdncRequestHeaderString = sdncRequestHeader.toString();
+ assertTrue(sdncRequestHeaderString
+ .contains("[svcNotificationUrl=svcNotificationUrl,svcRequestId=svcRequestId,svcAction=svcAction]"));
+ }
+
+ @Test
+ public void testSdncRequestHeaderIsEqual() {
+ SdncRequestHeader sdncRequestHeader1 = new SdncRequestHeader("svcNotificationUrl1",
+ "svcRequestId1",
+ "svcAction1");
+ assertTrue(sdncRequestHeader1.equals(sdncRequestHeader1));
+ assertTrue(sdncRequestHeader1.hashCode() == 749721816);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceDataTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceDataTest.java
new file mode 100644
index 0000000..12f2af3
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceDataTest.java
@@ -0,0 +1,86 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.OperStatus;
+import org.onap.pomba.contextbuilder.sdnc.model.RequestInformation;
+import org.onap.pomba.contextbuilder.sdnc.model.SdncRequestHeader;
+import org.onap.pomba.contextbuilder.sdnc.model.ServiceData;
+import org.onap.pomba.contextbuilder.sdnc.model.ServiceInformation;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfRequestInformation;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfTopologyInformation;
+
+public class ServiceDataTest {
+ @Test
+ public void testServiceDataWithParameters() {
+ ServiceData serviceData = new ServiceData(new RequestInformation(),
+ new ServiceInformation(),
+ "vnfId",
+ new SdncRequestHeader(),
+ new VnfRequestInformation(),
+ new OperStatus(),
+ new VnfTopologyInformation());
+ assertEquals(new RequestInformation(), serviceData.getRequestInformation());
+ assertEquals(new ServiceInformation(), serviceData.getServiceInformation());
+ assertEquals("vnfId", serviceData.getVnfId());
+ assertEquals(new SdncRequestHeader(), serviceData.getSdncRequestHeader());
+ assertEquals(new VnfRequestInformation(), serviceData.getVnfRequestInformation());
+ assertEquals(new OperStatus(), serviceData.getOperStatus());
+ assertEquals(new VnfTopologyInformation(), serviceData.getVnfTopologyInformation());
+ }
+
+ @Test
+ public void testServiceData() {
+ ServiceData serviceData = new ServiceData();
+ serviceData.setRequestInformation(new RequestInformation());
+ serviceData.setServiceInformation(new ServiceInformation());
+ serviceData.setVnfId("vnfId");
+ serviceData.setSdncRequestHeader(new SdncRequestHeader());
+ serviceData.setVnfRequestInformation(new VnfRequestInformation());
+ serviceData.setOperStatus(new OperStatus());
+ serviceData.setVnfTopologyInformation(new VnfTopologyInformation());
+ assertEquals(new RequestInformation(), serviceData.getRequestInformation());
+ assertEquals(new ServiceInformation(), serviceData.getServiceInformation());
+ assertEquals("vnfId", serviceData.getVnfId());
+ assertEquals(new SdncRequestHeader(), serviceData.getSdncRequestHeader());
+ assertEquals(new VnfRequestInformation(), serviceData.getVnfRequestInformation());
+ assertEquals(new OperStatus(), serviceData.getOperStatus());
+ assertEquals(new VnfTopologyInformation(), serviceData.getVnfTopologyInformation());
+ String serviceDataString = serviceData.toString();
+ assertTrue(serviceDataString.contains("vnfId=vnfId"));
+ }
+
+ @Test
+ public void testServiceDataIsEqual() {
+ ServiceData serviceData1 = new ServiceData(new RequestInformation(),
+ new ServiceInformation(),
+ "vnfId1",
+ new SdncRequestHeader(),
+ new VnfRequestInformation(),
+ new OperStatus(),
+ new VnfTopologyInformation());
+ assertTrue(serviceData1.equals(serviceData1));
+ assertTrue(serviceData1.hashCode() == -140583576);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceEntityTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceEntityTest.java
new file mode 100644
index 0000000..510fcb8
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceEntityTest.java
@@ -0,0 +1,44 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.ServiceEntity;
+
+public class ServiceEntityTest {
+
+ @Test
+ public void testGenericResponse() {
+ ServiceEntity serviceEntity = new ServiceEntity();
+
+ serviceEntity.setApiName("VNF-API");
+ serviceEntity.setCustomerName("customer");
+ serviceEntity.setCustomerType("customerType");
+ serviceEntity.setServiceInstanceId("serviceInstanceId");
+ serviceEntity.setServiceType("vFW");
+
+ assertEquals("VNF-API", serviceEntity.getApiName());
+ assertEquals("customer", serviceEntity.getCustomerName());
+ assertEquals("customerType", serviceEntity.getCustomerType());
+ assertEquals("serviceInstanceId", serviceEntity.getServiceInstanceId());
+ assertEquals("vFW", serviceEntity.getServiceType());
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceInformationTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceInformationTest.java
new file mode 100644
index 0000000..45a1114
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceInformationTest.java
@@ -0,0 +1,67 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.ServiceInformation;
+
+public class ServiceInformationTest {
+ @Test
+ public void testServiceInformationWithParameters() {
+ ServiceInformation serviceInformation = new ServiceInformation("serviceId",
+ "serviceType",
+ "subscriberName",
+ "serviceInstanceId");
+ assertEquals("serviceId", serviceInformation.getServiceId());
+ assertEquals("serviceType", serviceInformation.getServiceType());
+ assertEquals("subscriberName", serviceInformation.getSubscriberName());
+ assertEquals("serviceInstanceId", serviceInformation.getServiceInstanceId());
+ }
+
+ @Test
+ public void testServiceInformation() {
+ ServiceInformation serviceInformation = new ServiceInformation();
+ serviceInformation.setServiceId("serviceId");
+ serviceInformation.setServiceType("serviceType");
+ serviceInformation.setSubscriberName("subscriberName");
+ serviceInformation.setServiceInstanceId("serviceInstanceId");
+ assertEquals("serviceId", serviceInformation.getServiceId());
+ assertEquals("serviceType", serviceInformation.getServiceType());
+ assertEquals("subscriberName", serviceInformation.getSubscriberName());
+ assertEquals("serviceInstanceId", serviceInformation.getServiceInstanceId());
+ String serviceInformationString = serviceInformation.toString();
+ assertTrue(serviceInformationString
+ .contains("[serviceId=serviceId,serviceType=serviceType,subscriberName=subscriberName,"
+ + "serviceInstanceId=serviceInstanceId]"));
+ }
+
+ @Test
+ public void testServiceInformationIsEqual() {
+ ServiceInformation serviceInformation1 = new ServiceInformation("serviceId1",
+ "serviceType1",
+ "subscriberName1",
+ "serviceInstanceId1");
+ assertTrue(serviceInformation1.equals(serviceInformation1));
+ assertTrue(serviceInformation1.hashCode() == -1226728686);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceInstanceTest.java
new file mode 100644
index 0000000..73e839e
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceInstanceTest.java
@@ -0,0 +1,148 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.RelatedToProperty;
+import org.onap.pomba.contextbuilder.sdnc.model.Relationship;
+import org.onap.pomba.contextbuilder.sdnc.model.RelationshipDatum;
+import org.onap.pomba.contextbuilder.sdnc.model.RelationshipList;
+import org.onap.pomba.contextbuilder.sdnc.model.ServiceInstance;
+
+public class ServiceInstanceTest {
+ @Test
+ public void testServiceInstanceWithParameters() {
+ ServiceInstance serviceInstance = new ServiceInstance("serviceInstanceId",
+ "serviceInstanceName",
+ "serviceType",
+ "serviceRole",
+ "environmentContext",
+ "workloadContext",
+ "modelInvariantId",
+ "modelVersionId",
+ "resourceVersion",
+ "orchestrationStatus",
+ new RelationshipList());
+
+ assertEquals("serviceInstanceId", serviceInstance.getServiceInstanceId());
+ assertEquals("serviceInstanceName", serviceInstance.getServiceInstanceName());
+ assertEquals("serviceType", serviceInstance.getServiceType());
+ assertEquals("serviceRole", serviceInstance.getServiceRole());
+ assertEquals("environmentContext", serviceInstance.getEnvironmentContext());
+ assertEquals("workloadContext", serviceInstance.getWorkloadContext());
+ assertEquals("modelInvariantId", serviceInstance.getModelInvariantId());
+ assertEquals("modelVersionId", serviceInstance.getModelVersionId());
+ assertEquals("resourceVersion", serviceInstance.getResourceVersion());
+ assertEquals("orchestrationStatus", serviceInstance.getOrchestrationStatus());
+
+ }
+
+ @Test
+ public void testServiceInstance() {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ serviceInstance.setServiceInstanceName("serviceInstanceName");
+ serviceInstance.setServiceType("serviceType");
+ serviceInstance.setServiceRole("serviceRole");
+ serviceInstance.setEnvironmentContext("environmentContext");
+ serviceInstance.setWorkloadContext("workloadContext");
+ serviceInstance.setModelInvariantId("modelInvariantId");
+ serviceInstance.setModelVersionId("modelVersionId");
+ serviceInstance.setResourceVersion("resourceVersion");
+ serviceInstance.setOrchestrationStatus("orchestrationStatus");
+ RelationshipList relationshipList = new RelationshipList();
+ List<Relationship> listOfRelationship = new ArrayList<Relationship>();
+ Relationship relationship = new Relationship("relatedTo",
+ "relatedLink",
+ new ArrayList<RelationshipDatum>(),
+ new ArrayList<RelatedToProperty>());
+ listOfRelationship.add(relationship);
+ relationshipList.setRelationship(listOfRelationship);
+
+ serviceInstance.setRelationshipList(relationshipList);
+
+ assertEquals("serviceInstanceId", serviceInstance.getServiceInstanceId());
+ assertEquals("serviceInstanceName", serviceInstance.getServiceInstanceName());
+ assertEquals("serviceType", serviceInstance.getServiceType());
+ assertEquals("serviceRole", serviceInstance.getServiceRole());
+ assertEquals("environmentContext", serviceInstance.getEnvironmentContext());
+ assertEquals("workloadContext", serviceInstance.getWorkloadContext());
+ assertEquals("modelInvariantId", serviceInstance.getModelInvariantId());
+ assertEquals("modelVersionId", serviceInstance.getModelVersionId());
+ assertEquals("resourceVersion", serviceInstance.getResourceVersion());
+ assertEquals("orchestrationStatus", serviceInstance.getOrchestrationStatus());
+ assertEquals("relatedTo", serviceInstance.getRelationshipList().getRelationship().get(0).getRelatedTo());
+
+ String serviceInstanceString = serviceInstance.toString();
+ assertTrue(serviceInstanceString
+ .contains("[serviceInstanceId=serviceInstanceId,serviceInstanceName=serviceInstanceName,"
+ + "serviceType=serviceType,serviceRole=serviceRole,environmentContext=environmentContext,"
+ + "workloadContext=workloadContext,modelInvariantId=modelInvariantId,"
+ + "modelVersionId=modelVersionId,resourceVersion=resourceVersion,"
+ + "orchestrationStatus=orchestrationStatus,"));
+ }
+
+
+ @Test
+ public void testServiceInstanceEquals() {
+ ServiceInstance serviceInstance1 = new ServiceInstance("serviceInstanceId1",
+ "serviceInstanceName1",
+ "serviceType1",
+ "serviceRole1",
+ "environmentContext1",
+ "workloadContext1",
+ "modelInvariantId1",
+ "modelVersionId1",
+ "resourceVersion1",
+ "orchestrationStatus1",
+ new RelationshipList());
+ ServiceInstance serviceInstance2 = new ServiceInstance("serviceInstanceId2",
+ "serviceInstanceName2",
+ "serviceType2",
+ "serviceRole2",
+ "environmentContext2",
+ "workloadContext2",
+ "modelInvariantId2",
+ "modelVersionId2",
+ "resourceVersion2",
+ "orchestrationStatus2",
+ new RelationshipList());
+ ServiceInstance serviceInstance3 = new ServiceInstance("serviceInstanceId1",
+ "serviceInstanceName1",
+ "serviceType1",
+ "serviceRole1",
+ "environmentContext1",
+ "workloadContext1",
+ "modelInvariantId1",
+ "modelVersionId1",
+ "resourceVersion1",
+ "orchestrationStatus1",
+ new RelationshipList());
+
+ assertTrue(serviceInstance1.equals(serviceInstance1));
+ assertTrue(!serviceInstance1.equals(serviceInstance2));
+ assertTrue(serviceInstance1.equals(serviceInstance3));
+ assertTrue(serviceInstance1.hashCode() == 535776279);
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceStatusTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceStatusTest.java
new file mode 100644
index 0000000..ea6a9d6
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ServiceStatusTest.java
@@ -0,0 +1,83 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.ServiceStatus;
+
+public class ServiceStatusTest {
+ @Test
+ public void testServiceStatusWithParameters() {
+ ServiceStatus serviceStatus = new ServiceStatus("responseTimestamp",
+ "vnfsdnAction",
+ "rpcAction",
+ "rpcName",
+ "responseCode",
+ "finalIndicator",
+ "requestStatus");
+ assertEquals("responseTimestamp", serviceStatus.getResponseTimestamp());
+ assertEquals("vnfsdnAction", serviceStatus.getVnfsdnAction());
+ assertEquals("rpcAction", serviceStatus.getRpcAction());
+ assertEquals("rpcName", serviceStatus.getRpcName());
+ assertEquals("responseCode", serviceStatus.getResponseCode());
+ assertEquals("finalIndicator", serviceStatus.getFinalIndicator());
+ assertEquals("requestStatus", serviceStatus.getRequestStatus());
+ }
+
+ @Test
+ public void testServiceStatus() {
+ ServiceStatus serviceStatus = new ServiceStatus();
+ serviceStatus.setResponseTimestamp("responseTimestamp");
+ serviceStatus.setVnfsdnAction("vnfsdnAction");
+ serviceStatus.setRpcAction("rpcAction");
+ serviceStatus.setRpcName("rpcName");
+ serviceStatus.setResponseCode("responseCode");
+ serviceStatus.setFinalIndicator("finalIndicator");
+ serviceStatus.setRequestStatus("requestStatus");
+ assertEquals("responseTimestamp", serviceStatus.getResponseTimestamp());
+ assertEquals("vnfsdnAction", serviceStatus.getVnfsdnAction());
+ assertEquals("rpcAction", serviceStatus.getRpcAction());
+ assertEquals("responseCode", serviceStatus.getResponseCode());
+ assertEquals("rpcName", serviceStatus.getRpcName());
+ assertEquals("finalIndicator", serviceStatus.getFinalIndicator());
+ assertEquals("requestStatus", serviceStatus.getRequestStatus());
+ String serviceStatusString = serviceStatus.toString();
+ assertTrue(serviceStatusString
+ .contains("[responseTimestamp=responseTimestamp,vnfsdnAction=vnfsdnAction,rpcAction=rpcAction,"
+ + "rpcName=rpcName,responseCode=responseCode,finalIndicator=finalIndicator,"
+ + "requestStatus=requestStatus]"));
+ }
+
+ @Test
+ public void testServiceStatusIsEqual() {
+ ServiceStatus serviceStatus1 = new ServiceStatus("responseTimestamp1",
+ "vnfsdnAction1",
+ "rpcAction1",
+ "rpcName1",
+ "responseCode1",
+ "finalIndicator1",
+ "requestStatus1");
+ assertTrue(serviceStatus1.equals(serviceStatus1));
+ assertTrue(serviceStatus1.hashCode() == -1947783113);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VfModuleTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VfModuleTest.java
new file mode 100644
index 0000000..37b3a0a
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VfModuleTest.java
@@ -0,0 +1,149 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.RelatedToProperty;
+import org.onap.pomba.contextbuilder.sdnc.model.Relationship;
+import org.onap.pomba.contextbuilder.sdnc.model.RelationshipDatum;
+import org.onap.pomba.contextbuilder.sdnc.model.RelationshipList;
+import org.onap.pomba.contextbuilder.sdnc.model.VfModule;
+
+public class VfModuleTest {
+ @Test
+ public void testVfModule() {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setVfModuleName("vfModuleName");
+ vfModule.setHeatStackId("heatStackId");
+ vfModule.setOrchestrationStatus("orchestrationStatus");
+ vfModule.setIsBaseVfModule(true);
+ vfModule.setResourceVersion("resourceVersion");
+ vfModule.setModelInvariantId("modelInvariantId");
+ vfModule.setModelVersionId("modelVersionId");
+ vfModule.setModelCustomizationId("modelCustomizationId");
+ vfModule.setModuleIndex(1);
+
+ RelationshipList relationshipList = new RelationshipList();
+ List<Relationship> listOfRelationship = new ArrayList<Relationship>();
+ Relationship relationship = new Relationship("relatedTo",
+ "relatedLink",
+ new ArrayList<RelationshipDatum>(),
+ new ArrayList<RelatedToProperty>());
+ listOfRelationship.add(relationship);
+ relationshipList.setRelationship(listOfRelationship);
+
+ vfModule.setRelationshipList(relationshipList);
+
+ assertEquals("vfModuleId", vfModule.getVfModuleId());
+ assertEquals("vfModuleName", vfModule.getVfModuleName());
+ assertEquals("heatStackId", vfModule.getHeatStackId());
+ assertEquals("orchestrationStatus", vfModule.getOrchestrationStatus());
+ assertTrue(vfModule.getIsBaseVfModule());
+ assertEquals("resourceVersion", vfModule.getResourceVersion());
+ assertEquals("modelInvariantId", vfModule.getModelInvariantId());
+ assertEquals("modelVersionId", vfModule.getModelVersionId());
+ assertEquals("modelCustomizationId", vfModule.getModelCustomizationId());
+ assertEquals(new Integer(1), vfModule.getModuleIndex());
+ assertEquals("relatedTo", vfModule.getRelationshipList().getRelationship().get(0).getRelatedTo());
+ }
+
+ @Test
+ public void testVfModuleWithParameters() {
+ VfModule vfModule = new VfModule("vfModuleId",
+ "vfModuleName",
+ "heatStackId",
+ "orchestrationStatus",
+ true,
+ "resourceVersion",
+ "modelInvariantId",
+ "modelVersionId",
+ "modelCustomizationId",
+ 1,
+ new RelationshipList() );
+
+ assertEquals("vfModuleId", vfModule.getVfModuleId());
+ assertEquals("vfModuleName", vfModule.getVfModuleName());
+ assertEquals("heatStackId", vfModule.getHeatStackId());
+ assertEquals("orchestrationStatus", vfModule.getOrchestrationStatus());
+ assertTrue(vfModule.getIsBaseVfModule());
+ assertEquals("resourceVersion", vfModule.getResourceVersion());
+ assertEquals("modelInvariantId", vfModule.getModelInvariantId());
+ assertEquals("modelVersionId", vfModule.getModelVersionId());
+ assertEquals("modelCustomizationId", vfModule.getModelCustomizationId());
+ assertEquals(new Integer(1), vfModule.getModuleIndex());
+
+ String vfModuleString = vfModule.toString();
+ assertTrue(vfModuleString
+ .contains("[vfModuleId=vfModuleId,vfModuleName=vfModuleName,heatStackId=heatStackId,"
+ + "orchestrationStatus=orchestrationStatus,isBaseVfModule=true,"
+ + "resourceVersion=resourceVersion,modelInvariantId=modelInvariantId,"
+ + "modelVersionId=modelVersionId,modelCustomizationId=modelCustomizationId,"
+ + "moduleIndex=1"));
+
+ }
+
+ @Test
+ public void testVfModuleEquals() {
+ VfModule vfModule1 = new VfModule("vfModuleId1",
+ "vfModuleName1",
+ "heatStackId1",
+ "orchestrationStatus1",
+ true,
+ "resourceVersion1",
+ "modelInvariantId1",
+ "modelVersionId1",
+ "modelCustomizationId1",
+ 1,
+ new RelationshipList() );
+ VfModule vfModule2 = new VfModule("vfModuleId2",
+ "vfModuleName2",
+ "heatStackId2",
+ "orchestrationStatus2",
+ true,
+ "resourceVersion2",
+ "modelInvariantId2",
+ "modelVersionId2",
+ "modelCustomizationId2",
+ 1,
+ new RelationshipList() );
+ VfModule vfModule3 = new VfModule("vfModuleId1",
+ "vfModuleName1",
+ "heatStackId1",
+ "orchestrationStatus1",
+ true,
+ "resourceVersion1",
+ "modelInvariantId1",
+ "modelVersionId1",
+ "modelCustomizationId1",
+ 1,
+ new RelationshipList() );
+
+ assertTrue(vfModule1.equals(vfModule1));
+ assertTrue(!vfModule1.equals(vfModule2));
+ assertTrue(vfModule1.equals(vfModule3));
+ assertTrue(vfModule1.hashCode() == -1559779341);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VfModulesTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VfModulesTest.java
new file mode 100644
index 0000000..5229a9e
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VfModulesTest.java
@@ -0,0 +1,58 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.VfModule;
+import org.onap.pomba.contextbuilder.sdnc.model.VfModules;
+
+public class VfModulesTest {
+ @Test
+ public void testVfModules() {
+ VfModules vfModules = new VfModules();
+
+ List<VfModule> vfModuleList = new ArrayList<VfModule>();
+ vfModuleList.add(new VfModule());
+ vfModules.setVfModule(vfModuleList);
+
+ assertTrue(vfModules.getVfModule().get(0) instanceof VfModule);
+ }
+
+ @Test
+ public void testVfModulesWithParameters() {
+ VfModules vfModules = new VfModules(new ArrayList<VfModule>());
+
+ String vfModulesString = vfModules.toString();
+ assertTrue(vfModulesString.contains("[vfModule="));
+ }
+
+ @Test
+ public void testVfModulesEquals() {
+ VfModules vfModules1 = new VfModules(new ArrayList<VfModule>());
+ VfModules vfModules2 = new VfModules(new ArrayList<VfModule>());
+
+ assertTrue(vfModules1.equals(vfModules1));
+ assertTrue(vfModules1.equals(vfModules2));
+ assertTrue(vfModules1.hashCode() == 630);
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VmNameTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VmNameTest.java
new file mode 100644
index 0000000..ae738ef
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VmNameTest.java
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.VmName;
+
+public class VmNameTest {
+ @Test
+ public void testVmNameWithParameters() {
+ VmName vmName = new VmName("vmName");
+ assertEquals("vmName", vmName.getVmName());
+ }
+
+ @Test
+ public void testVmName() {
+ VmName vmName = new VmName();
+ vmName.setVmName("vmName");
+ assertEquals("vmName", vmName.getVmName());
+ String vmNameString = vmName.toString();
+ assertTrue(vmNameString.contains("[vmName=vmName]"));
+ }
+
+ @Test
+ public void testVmNameIsEqual() {
+ VmName vmName1 = new VmName("vmName1");
+ assertTrue(vmName1.equals(vmName1));
+ assertTrue(vmName1.hashCode() == 546861742);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VmNetworkTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VmNetworkTest.java
new file mode 100644
index 0000000..b6704c4
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VmNetworkTest.java
@@ -0,0 +1,81 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.NetworkIp;
+import org.onap.pomba.contextbuilder.sdnc.model.NetworkIpV6;
+import org.onap.pomba.contextbuilder.sdnc.model.VmNetwork;
+
+public class VmNetworkTest {
+ @Test
+ public void testVmNetworkWithParameters() {
+ VmNetwork vmNetwork = new VmNetwork("networkRole",
+ new ArrayList<NetworkIpV6>(),
+ "floatingIp",
+ "useDhcp",
+ new ArrayList<NetworkIp>(),
+ "floatingIpV6");
+ assertEquals("networkRole", vmNetwork.getNetworkRole());
+ assertEquals(new ArrayList<NetworkIpV6>(), vmNetwork.getNetworkIpsV6());
+ assertEquals("floatingIp", vmNetwork.getFloatingIp());
+ assertEquals("useDhcp", vmNetwork.getUseDhcp());
+ assertEquals(new ArrayList<NetworkIp>(), vmNetwork.getNetworkIps());
+ assertEquals("floatingIpV6", vmNetwork.getFloatingIpV6());
+ }
+
+ @Test
+ public void testVmNetwork() {
+ VmNetwork vmNetwork = new VmNetwork();
+ vmNetwork.setNetworkRole("networkRole");
+ vmNetwork.setNetworkIpsV6(new ArrayList<NetworkIpV6>());
+ vmNetwork.setFloatingIp("floatingIp");
+ vmNetwork.setUseDhcp("useDhcp");
+ vmNetwork.setNetworkIps(new ArrayList<NetworkIp>());
+ vmNetwork.setFloatingIpV6("floatingIpV6");
+ assertEquals("networkRole", vmNetwork.getNetworkRole());
+ assertEquals(new ArrayList<NetworkIpV6>(), vmNetwork.getNetworkIpsV6());
+ assertEquals("floatingIp", vmNetwork.getFloatingIp());
+ assertEquals(new ArrayList<NetworkIp>(), vmNetwork.getNetworkIps());
+ assertEquals("useDhcp", vmNetwork.getUseDhcp());
+ assertEquals("floatingIpV6", vmNetwork.getFloatingIpV6());
+ String vmNetworkString = vmNetwork.toString();
+ assertTrue(vmNetworkString.contains("networkRole=networkRole"));
+ assertTrue(vmNetworkString.contains("floatingIp=floatingIp,useDhcp=useDhcp"));
+ assertTrue(vmNetworkString.contains("floatingIpV6=floatingIpV6"));
+ }
+
+
+ @Test
+ public void testVmNetworkIsEqual() {
+ VmNetwork vmNetwork1 = new VmNetwork("networkRole1",
+ new ArrayList<NetworkIpV6>(),
+ "floatingIp1",
+ "useDhcp1",
+ new ArrayList<NetworkIp>(),
+ "floatingIpV61");
+ assertTrue(vmNetwork1.equals(vmNetwork1));
+ assertTrue(vmNetwork1.hashCode() == -103133323);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfAssignmentsTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfAssignmentsTest.java
new file mode 100644
index 0000000..e499d73
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfAssignmentsTest.java
@@ -0,0 +1,66 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.AvailabilityZone;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfAssignments;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfNetwork;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfVm;
+
+public class VnfAssignmentsTest {
+ @Test
+ public void testVnfAssignmentsWithParameters() {
+ VnfAssignments vnfAssignments = new VnfAssignments(new ArrayList<VnfNetwork>(),
+ new ArrayList<AvailabilityZone>(),
+ new ArrayList<VnfVm>());
+ assertEquals(new ArrayList<VnfNetwork>(), vnfAssignments.getVnfNetworks());
+ assertEquals(new ArrayList<AvailabilityZone>(), vnfAssignments.getAvailabilityZones());
+ assertEquals(new ArrayList<VnfVm>(), vnfAssignments.getVnfVms());
+ }
+
+ @Test
+ public void testVnfAssignments() {
+ VnfAssignments vnfAssignments = new VnfAssignments();
+ vnfAssignments.setVnfNetworks(new ArrayList<VnfNetwork>());
+ vnfAssignments.setAvailabilityZones(new ArrayList<AvailabilityZone>());
+ vnfAssignments.setVnfVms(new ArrayList<VnfVm>());
+
+ assertEquals(new ArrayList<VnfNetwork>(), vnfAssignments.getVnfNetworks());
+ assertEquals(new ArrayList<AvailabilityZone>(), vnfAssignments.getAvailabilityZones());
+ assertEquals(new ArrayList<VnfVm>(), vnfAssignments.getVnfVms());
+
+ String vnfAssignmentsString = vnfAssignments.toString();
+ assertTrue(vnfAssignmentsString.contains("vnfNetworks"));
+ }
+
+ @Test
+ public void testVnfAssignmentsIsEqual() {
+ VnfAssignments vnfAssignments1 = new VnfAssignments(new ArrayList<VnfNetwork>(),
+ new ArrayList<AvailabilityZone>(),
+ new ArrayList<VnfVm>());
+ assertTrue(vnfAssignments1.equals(vnfAssignments1));
+ assertTrue(vnfAssignments1.hashCode() == 30784);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfInstanceTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfInstanceTest.java
new file mode 100644
index 0000000..73b8213
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfInstanceTest.java
@@ -0,0 +1,253 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.RelationshipList;
+import org.onap.pomba.contextbuilder.sdnc.model.VfModules;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfInstance;
+
+public class VnfInstanceTest {
+ @Test
+ public void testVnfInstance() {
+ VnfInstance vnfInstance = new VnfInstance();
+
+ vnfInstance.setServiceId("serviceId");
+ vnfInstance.setModelCustomizationId("modelCustomizationId");
+ vnfInstance.setVnfType("vnfType");
+ vnfInstance.setIpv4Loopback0Address("ipv4Loopback0Address");
+ vnfInstance.setNfFunction("nfFunction");
+ vnfInstance.setModelInvariantId("modelInvariantId");
+ vnfInstance.setResourceVersion("resourceVersion");
+ vnfInstance.setVnfName2("vnfName2");
+ vnfInstance.setRelationshipList(new RelationshipList());
+ vnfInstance.setNmLanV6Address("nmLanV6Address");
+ vnfInstance.setNfRole("nfRole");
+ vnfInstance.setNfType("nfType");
+ vnfInstance.setModelVersionId("modelVersionId");
+ vnfInstance.setIpv4OamAddress("ipv4OamAddress");
+ vnfInstance.setVnfName("vnfName");
+ vnfInstance.setInMaint(true);
+ vnfInstance.setMsoCatalogKey("msoCatalogKey");
+ vnfInstance.setProvStatus("ProvStatus");
+ vnfInstance.setVfModules(new VfModules());
+ vnfInstance.setEquipmentRole("equipmentRole");
+ vnfInstance.setVnfId("vnfId");
+ vnfInstance.setOrchestrationStatus("orchestrationStatus");
+ vnfInstance.setNfNamingCode("nfNamingCode");
+ vnfInstance.setHeatStackId("heatStackId");
+ vnfInstance.setIsClosedLoopDisabled(true);
+ vnfInstance.setLicenseKey("licenseKey");
+ vnfInstance.setManagementV6Address("managementV6Address");
+
+ assertEquals("serviceId", vnfInstance.getServiceId());
+ assertEquals("modelCustomizationId", vnfInstance.getModelCustomizationId());
+ assertEquals("vnfType", vnfInstance.getVnfType());
+ assertEquals("ipv4Loopback0Address", vnfInstance.getIpv4Loopback0Address());
+ assertEquals("nfFunction", vnfInstance.getNfFunction());
+ assertEquals("modelInvariantId", vnfInstance.getModelInvariantId());
+ assertEquals("resourceVersion", vnfInstance.getResourceVersion());
+ assertEquals("vnfName2", vnfInstance.getVnfName2());
+ assertTrue(vnfInstance.getRelationshipList() instanceof RelationshipList);
+ assertEquals("nmLanV6Address", vnfInstance.getNmLanV6Address());
+ assertEquals("nfRole", vnfInstance.getNfRole());
+ assertEquals("nfType", vnfInstance.getNfType());
+ assertEquals("modelVersionId", vnfInstance.getModelVersionId());
+ assertEquals("ipv4OamAddress", vnfInstance.getIpv4OamAddress());
+ assertEquals("vnfName", vnfInstance.getVnfName());
+ assertTrue(vnfInstance.getInMaint());
+ assertEquals("msoCatalogKey", vnfInstance.getMsoCatalogKey());
+ assertEquals("ProvStatus", vnfInstance.getProvStatus());
+ assertTrue(vnfInstance.getVfModules() instanceof VfModules);
+ assertEquals("equipmentRole", vnfInstance.getEquipmentRole());
+ assertEquals("vnfId", vnfInstance.getVnfId());
+ assertEquals("orchestrationStatus", vnfInstance.getOrchestrationStatus());
+ assertEquals("nfNamingCode", vnfInstance.getNfNamingCode());
+ assertEquals("heatStackId", vnfInstance.getHeatStackId());
+ assertTrue(vnfInstance.getIsClosedLoopDisabled());
+ assertEquals("licenseKey", vnfInstance.getLicenseKey());
+ assertEquals("managementV6Address", vnfInstance.getManagementV6Address());
+
+ }
+
+ @Test
+ public void testVnfInstanceWithParameters() {
+ VnfInstance vnfInstance = new VnfInstance("vnfId",
+ "vnfName",
+ "vnfName2",
+ "vnfType",
+ "serviceId",
+ "provStatus",
+ "licenseKey",
+ "equipmentRole",
+ "orchestrationStatus",
+ "heatStackId",
+ "msoCatalogKey",
+ "ipv4OamAddress",
+ "ipv4Loopback0Address",
+ "nmLanV6Address",
+ "managementV6Address",
+ true,
+ true,
+ "resourceVersion",
+ "modelInvariantId",
+ "modelVersionId",
+ "modelCustomizationId",
+ "nfType",
+ "nfFunction",
+ "nfRole",
+ "nfNamingCode",
+ new RelationshipList(),
+ new VfModules());
+
+ assertEquals("serviceId", vnfInstance.getServiceId());
+ assertEquals("modelCustomizationId", vnfInstance.getModelCustomizationId());
+ assertEquals("vnfType", vnfInstance.getVnfType());
+ assertEquals("ipv4Loopback0Address", vnfInstance.getIpv4Loopback0Address());
+ assertEquals("nfFunction", vnfInstance.getNfFunction());
+ assertEquals("modelInvariantId", vnfInstance.getModelInvariantId());
+ assertEquals("resourceVersion", vnfInstance.getResourceVersion());
+ assertEquals("vnfName2", vnfInstance.getVnfName2());
+ assertTrue(vnfInstance.getRelationshipList() instanceof RelationshipList);
+ assertEquals("nmLanV6Address", vnfInstance.getNmLanV6Address());
+ assertEquals("nfRole", vnfInstance.getNfRole());
+ assertEquals("nfType", vnfInstance.getNfType());
+ assertEquals("modelVersionId", vnfInstance.getModelVersionId());
+ assertEquals("ipv4OamAddress", vnfInstance.getIpv4OamAddress());
+ assertEquals("vnfName", vnfInstance.getVnfName());
+ assertTrue(vnfInstance.getInMaint());
+ assertEquals("msoCatalogKey", vnfInstance.getMsoCatalogKey());
+ assertEquals("provStatus", vnfInstance.getProvStatus());
+ assertTrue(vnfInstance.getVfModules() instanceof VfModules);
+ assertEquals("equipmentRole", vnfInstance.getEquipmentRole());
+ assertEquals("vnfId", vnfInstance.getVnfId());
+ assertEquals("orchestrationStatus", vnfInstance.getOrchestrationStatus());
+ assertEquals("nfNamingCode", vnfInstance.getNfNamingCode());
+ assertEquals("heatStackId", vnfInstance.getHeatStackId());
+ assertTrue(vnfInstance.getIsClosedLoopDisabled());
+ assertEquals("licenseKey", vnfInstance.getLicenseKey());
+ assertEquals("managementV6Address", vnfInstance.getManagementV6Address());
+
+ String vnfInstanceString = vnfInstance.toString();
+ assertTrue(vnfInstanceString
+ .contains("[vnfId=vnfId,vnfName=vnfName,vnfName2=vnfName2,vnfType=vnfType,serviceId=serviceId,"
+ + "provStatus=provStatus,licenseKey=licenseKey,equipmentRole=equipmentRole,"
+ + "orchestrationStatus=orchestrationStatus,heatStackId=heatStackId,"
+ + "msoCatalogKey=msoCatalogKey,ipv4OamAddress=ipv4OamAddress,"
+ + "ipv4Loopback0Address=ipv4Loopback0Address,nmLanV6Address=nmLanV6Address,"
+ + "managementV6Address=managementV6Address,inMaint=true,isClosedLoopDisabled=true,"
+ + "resourceVersion=resourceVersion,modelInvariantId=modelInvariantId,"
+ + "modelVersionId=modelVersionId,modelCustomizationId=modelCustomizationId,nfType=nfType,"
+ + "nfFunction=nfFunction,nfRole=nfRole,nfNamingCode=nfNamingCode,"));
+ }
+
+ @Test
+ public void testVnfInstanceEquals() {
+ VnfInstance vnfInstance1 = new VnfInstance("vnfId1",
+ "vnfName1",
+ "vnfName2-1",
+ "vnfType1",
+ "serviceId1",
+ "ProvStatus1",
+ "licenseKey1",
+ "equipmentRole1",
+ "orchestrationStatus1",
+ "heatStackId1",
+ "msoCatalogKey1",
+ "ipv4OamAddress1",
+ "ipv4Loopback0Address1",
+ "nmLanV6Address1",
+ "managementV6Address1",
+ true,
+ true,
+ "resourceVersion1",
+ "modelInvariantId1",
+ "modelVersionId1",
+ "modelCustomizationId1",
+ "nfType1",
+ "nfFunction1",
+ "nfRole1",
+ "nfNamingCode1",
+ new RelationshipList(),
+ new VfModules());
+ VnfInstance vnfInstance2 = new VnfInstance("vnfId2",
+ "vnfName2",
+ "vnfName2-2",
+ "vnfType2",
+ "serviceId2",
+ "ProvStatus2",
+ "licenseKey2",
+ "equipmentRole2",
+ "orchestrationStatus2",
+ "heatStackId2",
+ "msoCatalogKey2",
+ "ipv4OamAddress2",
+ "ipv4Loopback0Address2",
+ "nmLanV6Address2",
+ "managementV6Address2",
+ true,
+ true,
+ "resourceVersion2",
+ "modelInvariantId2",
+ "modelVersionId2",
+ "modelCustomizationId2",
+ "nfType2",
+ "nfFunction2",
+ "nfRole2",
+ "nfNamingCode2",
+ new RelationshipList(),
+ new VfModules());
+ VnfInstance vnfInstance3 = new VnfInstance("vnfId1",
+ "vnfName1",
+ "vnfName2-1",
+ "vnfType1",
+ "serviceId1",
+ "ProvStatus1",
+ "licenseKey1",
+ "equipmentRole1",
+ "orchestrationStatus1",
+ "heatStackId1",
+ "msoCatalogKey1",
+ "ipv4OamAddress1",
+ "ipv4Loopback0Address1",
+ "nmLanV6Address1",
+ "managementV6Address1",
+ true,
+ true,
+ "resourceVersion1",
+ "modelInvariantId1",
+ "modelVersionId1",
+ "modelCustomizationId1",
+ "nfType1",
+ "nfFunction1",
+ "nfRole1",
+ "nfNamingCode1",
+ new RelationshipList(),
+ new VfModules());
+
+ assertTrue(vnfInstance1.equals(vnfInstance1));
+ assertTrue(!vnfInstance1.equals(vnfInstance2));
+ assertTrue(vnfInstance1.equals(vnfInstance3));
+ assertTrue(vnfInstance1.hashCode() == 677011731);
+
+ }
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfListTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfListTest.java
new file mode 100644
index 0000000..60bf199
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfListTest.java
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.Vnf;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfList;
+
+public class VnfListTest {
+ @Test
+ public void testVnfListWithParameters() {
+ VnfList vnfList = new VnfList(new ArrayList<Vnf>());
+ assertEquals(new ArrayList<Vnf>(), vnfList.getVnfList());
+ }
+
+ @Test
+ public void testVnfList() {
+ VnfList vnfList = new VnfList();
+ vnfList.setVnfList(new ArrayList<Vnf>());
+ assertEquals(new ArrayList<Vnf>(), vnfList.getVnfList());
+ String vnfListString = vnfList.toString();
+ assertTrue(vnfListString.contains("vnfList"));
+ }
+
+ @Test
+ public void testVnfListIsEqual() {
+ VnfList vnfList1 = new VnfList(new ArrayList<Vnf>());
+ assertTrue(vnfList1.equals(vnfList1));
+ assertTrue(vnfList1.hashCode() == 32);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfNetworkTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfNetworkTest.java
new file mode 100644
index 0000000..4028130
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfNetworkTest.java
@@ -0,0 +1,72 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfNetwork;
+
+public class VnfNetworkTest {
+ @Test
+ public void testVnfNetworkWithParameters() {
+ VnfNetwork vnfNetwork = new VnfNetwork("networkRole",
+ "contrailNetworkFqdn",
+ "networkName",
+ "networkId",
+ "neutronId");
+ assertEquals("networkRole", vnfNetwork.getNetworkRole());
+ assertEquals("contrailNetworkFqdn", vnfNetwork.getContrailNetworkFqdn());
+ assertEquals("networkName", vnfNetwork.getNetworkName());
+ assertEquals("networkId", vnfNetwork.getNetworkId());
+ assertEquals("neutronId", vnfNetwork.getNeutronId());
+ }
+
+ @Test
+ public void testVnfNetwork() {
+ VnfNetwork vnfNetwork = new VnfNetwork();
+ vnfNetwork.setNetworkRole("networkRole");
+ vnfNetwork.setContrailNetworkFqdn("contrailNetworkFqdn");
+ vnfNetwork.setNetworkName("networkName");
+ vnfNetwork.setNetworkId("networkId");
+ vnfNetwork.setNeutronId("neutronId");
+ assertEquals("networkRole", vnfNetwork.getNetworkRole());
+ assertEquals("contrailNetworkFqdn", vnfNetwork.getContrailNetworkFqdn());
+ assertEquals("networkName", vnfNetwork.getNetworkName());
+ assertEquals("networkId", vnfNetwork.getNetworkId());
+ assertEquals("neutronId", vnfNetwork.getNeutronId());
+ String vnfNetworkString = vnfNetwork.toString();
+ assertTrue(vnfNetworkString
+ .contains("[networkRole=networkRole,contrailNetworkFqdn=contrailNetworkFqdn,"
+ + "networkName=networkName,networkId=networkId,neutronId=neutronId]"));
+ }
+
+ @Test
+ public void testVnfNetworkIsEqual() {
+ VnfNetwork vnfNetwork1 = new VnfNetwork("networkRole1",
+ "contrailNetworkFqdn1",
+ "networkName1",
+ "networkId1",
+ "neutronId1");
+ assertTrue(vnfNetwork1.equals(vnfNetwork1));
+ assertTrue(vnfNetwork1.hashCode() == -1838617061);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfParameterTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfParameterTest.java
new file mode 100644
index 0000000..58a8399
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfParameterTest.java
@@ -0,0 +1,54 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfParameter;
+
+public class VnfParameterTest {
+ @Test
+ public void testVnfParameterWithParameters() {
+ VnfParameter vnfParamter = new VnfParameter("vnfParameterName", "vnfParameterValue");
+ assertEquals("vnfParameterName", vnfParamter.getVnfParameterName());
+ assertEquals("vnfParameterValue", vnfParamter.getVnfParameterValue());
+ }
+
+ @Test
+ public void testVnfParameter() {
+ VnfParameter vnfParamter = new VnfParameter();
+ vnfParamter.setVnfParameterName("vnfParameterName");
+ vnfParamter.setVnfParameterValue("vnfParameterValue");
+ assertEquals("vnfParameterName", vnfParamter.getVnfParameterName());
+ assertEquals("vnfParameterValue", vnfParamter.getVnfParameterValue());
+ String vnfParamterString = vnfParamter.toString();
+ assertTrue(vnfParamterString
+ .contains("[vnfParameterName=vnfParameterName,vnfParameterValue=vnfParameterValue]"));
+ }
+
+ @Test
+ public void testVnfParameterIsEqual() {
+ VnfParameter vnfParamter1 = new VnfParameter("vnfParameterName1", "vnfParameterValue1");
+ assertTrue(vnfParamter1.equals(vnfParamter1));
+ assertTrue(vnfParamter1.hashCode() == -1128531727);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfRequestInformationTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfRequestInformationTest.java
new file mode 100644
index 0000000..531a4b6
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfRequestInformationTest.java
@@ -0,0 +1,93 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfRequestInformation;
+
+public class VnfRequestInformationTest {
+ @Test
+ public void testVnfRequestInformationWithParameters() {
+ VnfRequestInformation vnfRequestInformation = new VnfRequestInformation("vnfName",
+ "tenant",
+ "aicCloudRegion",
+ "usePreload",
+ "vnfType",
+ "vnfId",
+ "genericVnfType",
+ "genericVnfName",
+ "genericVnfId");
+ assertEquals("vnfName", vnfRequestInformation.getVnfName());
+ assertEquals("tenant", vnfRequestInformation.getTenant());
+ assertEquals("aicCloudRegion", vnfRequestInformation.getAicCloudRegion());
+ assertEquals("usePreload", vnfRequestInformation.getUsePreload());
+ assertEquals("vnfType", vnfRequestInformation.getVnfType());
+ assertEquals("vnfId", vnfRequestInformation.getVnfId());
+ assertEquals("genericVnfType", vnfRequestInformation.getGenericVnfType());
+ assertEquals("genericVnfName", vnfRequestInformation.getGenericVnfName());
+ assertEquals("genericVnfId", vnfRequestInformation.getGenericVnfId());
+ }
+
+ @Test
+ public void testVnfRequestInformation() {
+ VnfRequestInformation vnfRequestInformation = new VnfRequestInformation();
+ vnfRequestInformation.setVnfName("vnfName");
+ vnfRequestInformation.setTenant("tenant");
+ vnfRequestInformation.setAicCloudRegion("aicCloudRegion");
+ vnfRequestInformation.setUsePreload("usePreload");
+ vnfRequestInformation.setVnfType("vnfType");
+ vnfRequestInformation.setVnfId("vnfId");
+ vnfRequestInformation.setGenericVnfType("genericVnfType");
+ vnfRequestInformation.setGenericVnfName("genericVnfName");
+ vnfRequestInformation.setGenericVnfId("genericVnfId");
+ assertEquals("vnfName", vnfRequestInformation.getVnfName());
+ assertEquals("tenant", vnfRequestInformation.getTenant());
+ assertEquals("aicCloudRegion", vnfRequestInformation.getAicCloudRegion());
+ assertEquals("usePreload", vnfRequestInformation.getUsePreload());
+ assertEquals("vnfType", vnfRequestInformation.getVnfType());
+ assertEquals("vnfId", vnfRequestInformation.getVnfId());
+ assertEquals("genericVnfType", vnfRequestInformation.getGenericVnfType());
+ assertEquals("genericVnfName", vnfRequestInformation.getGenericVnfName());
+ assertEquals("genericVnfId", vnfRequestInformation.getGenericVnfId());
+ String vnfRequestInformationString = vnfRequestInformation.toString();
+ assertTrue(vnfRequestInformationString
+ .contains("[vnfName=vnfName,tenant=tenant,aicCloudRegion=aicCloudRegion,usePreload=usePreload,"
+ + "vnfType=vnfType,vnfId=vnfId,genericVnfType=genericVnfType,"
+ + "genericVnfName=genericVnfName,genericVnfId=genericVnfId]"));
+ }
+
+ @Test
+ public void testVnfRequestInformationIsEqual() {
+ VnfRequestInformation vnfRequestInformation1 = new VnfRequestInformation("vnfName1",
+ "tenant1",
+ "aicCloudRegion1",
+ "usePreload1",
+ "vnfType1",
+ "vnfId1",
+ "genericVnfType1",
+ "genericVnfName1",
+ "genericVnfId1");
+ assertTrue(vnfRequestInformation1.equals(vnfRequestInformation1));
+ assertTrue(vnfRequestInformation1.hashCode() == 869221953);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTest.java
new file mode 100644
index 0000000..e64804a
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTest.java
@@ -0,0 +1,56 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.ServiceData;
+import org.onap.pomba.contextbuilder.sdnc.model.ServiceStatus;
+import org.onap.pomba.contextbuilder.sdnc.model.Vnf;
+
+public class VnfTest {
+ @Test
+ public void testVnfWithParameters() {
+ Vnf vnf = new Vnf("vnfId", new ServiceStatus(), new ServiceData());
+ assertEquals("vnfId", vnf.getVnfId());
+ }
+
+ @Test
+ public void testVnf() {
+ Vnf vnf = new Vnf();
+ vnf.setVnfId("vnfId");
+ vnf.setServiceStatus(new ServiceStatus());
+ vnf.setServiceData(new ServiceData());
+ assertEquals("vnfId", vnf.getVnfId());
+ assertEquals(new ServiceStatus(), vnf.getServiceStatus());
+ assertEquals(new ServiceData(), vnf.getServiceData());
+ String vnfString = vnf.toString();
+ assertTrue(vnfString.contains("vnfId"));
+ }
+
+ @Test
+ public void testVnfIsEqual() {
+ Vnf vnf1 = new Vnf("vnfId", new ServiceStatus(), new ServiceData());
+ assertTrue(vnf1.equals(vnf1));
+ assertTrue(vnf1.hashCode() == -1891585304);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyIdentifierTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyIdentifierTest.java
new file mode 100644
index 0000000..a4a36f3
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyIdentifierTest.java
@@ -0,0 +1,72 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfTopologyIdentifier;
+
+public class VnfTopologyIdentifierTest {
+ @Test
+ public void testVnfTopologyIdentifierWithParameters() {
+ VnfTopologyIdentifier vnfTopologyIdentifier = new VnfTopologyIdentifier("genericVnfType",
+ "serviceType",
+ "vnfName",
+ "genericVnfName",
+ "vnfType");
+ assertEquals("genericVnfType", vnfTopologyIdentifier.getGenericVnfType());
+ assertEquals("serviceType", vnfTopologyIdentifier.getServiceType());
+ assertEquals("vnfName", vnfTopologyIdentifier.getVnfName());
+ assertEquals("genericVnfName", vnfTopologyIdentifier.getGenericVnfName());
+ assertEquals("vnfType", vnfTopologyIdentifier.getVnfType());
+ }
+
+ @Test
+ public void testVnfTopologyIdentifier() {
+ VnfTopologyIdentifier vnfTopologyIdentifier = new VnfTopologyIdentifier();
+ vnfTopologyIdentifier.setGenericVnfType("genericVnfType");
+ vnfTopologyIdentifier.setServiceType("serviceType");
+ vnfTopologyIdentifier.setVnfName("vnfName");
+ vnfTopologyIdentifier.setGenericVnfName("genericVnfName");
+ vnfTopologyIdentifier.setVnfType("vnfType");
+ assertEquals("genericVnfType", vnfTopologyIdentifier.getGenericVnfType());
+ assertEquals("serviceType", vnfTopologyIdentifier.getServiceType());
+ assertEquals("vnfName", vnfTopologyIdentifier.getVnfName());
+ assertEquals("genericVnfName", vnfTopologyIdentifier.getGenericVnfName());
+ assertEquals("vnfType", vnfTopologyIdentifier.getVnfType());
+ String vnfTopologyIdentifierString = vnfTopologyIdentifier.toString();
+ assertTrue(vnfTopologyIdentifierString
+ .contains("[genericVnfType=genericVnfType,serviceType=serviceType,vnfName=vnfName,"
+ + "genericVnfName=genericVnfName,vnfType=vnfType]"));
+ }
+
+ @Test
+ public void testVnfTopologyIdentifierIsEqual() {
+ VnfTopologyIdentifier vnfTopologyIdentifier1 = new VnfTopologyIdentifier("genericVnfType1",
+ "serviceType1",
+ "vnfName1",
+ "genericVnfName1",
+ "vnfType1");
+ assertTrue(vnfTopologyIdentifier1.equals(vnfTopologyIdentifier1));
+ assertTrue(vnfTopologyIdentifier1.hashCode() == 1705030683);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyInformationTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyInformationTest.java
new file mode 100644
index 0000000..f33d5c4
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyInformationTest.java
@@ -0,0 +1,62 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfAssignments;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfParameter;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfTopologyIdentifier;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfTopologyInformation;
+
+public class VnfTopologyInformationTest {
+ @Test
+ public void testVnfTopologyInformationWithParameters() {
+ VnfTopologyInformation vnfTopologyInformation = new VnfTopologyInformation(new VnfTopologyIdentifier(),
+ new VnfAssignments(),
+ new ArrayList<VnfParameter>());
+ assertEquals(new VnfTopologyIdentifier(), vnfTopologyInformation.getVnfTopologyIdentifier());
+ assertEquals(new VnfAssignments(), vnfTopologyInformation.getVnfAssignments());
+ assertEquals(new ArrayList<VnfParameter>(), vnfTopologyInformation.getVnfParameters());
+ }
+
+ @Test
+ public void testVnfTopologyInformation() {
+ VnfTopologyInformation vnfTopologyInformation = new VnfTopologyInformation();
+ vnfTopologyInformation.setVnfTopologyIdentifier(new VnfTopologyIdentifier());
+ vnfTopologyInformation.setVnfAssignments(new VnfAssignments());
+ vnfTopologyInformation.setVnfParameters(new ArrayList<VnfParameter>());
+ assertEquals(new VnfTopologyIdentifier(), vnfTopologyInformation.getVnfTopologyIdentifier());
+ assertEquals(new VnfAssignments(), vnfTopologyInformation.getVnfAssignments());
+ assertEquals(new ArrayList<VnfParameter>(), vnfTopologyInformation.getVnfParameters());
+ }
+
+ @Test
+ public void testVnfTopologyInformationIsEqual() {
+ VnfTopologyInformation vnfTopologyInformation1 = new VnfTopologyInformation(new VnfTopologyIdentifier(),
+ new VnfAssignments(),
+ new ArrayList<VnfParameter>());
+ assertTrue(vnfTopologyInformation1.equals(vnfTopologyInformation1));
+ assertTrue(vnfTopologyInformation1.hashCode() == 917116897);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfVmTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfVmTest.java
new file mode 100644
index 0000000..f835a41
--- /dev/null
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfVmTest.java
@@ -0,0 +1,59 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================================
+ */
+
+package org.onap.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.VmName;
+import org.onap.pomba.contextbuilder.sdnc.model.VmNetwork;
+import org.onap.pomba.contextbuilder.sdnc.model.VnfVm;
+
+public class VnfVmTest {
+ @Test
+ public void testVnfVmWithParameters() {
+ VnfVm vnfVm = new VnfVm("vmType", new ArrayList<VmNetwork>(), 1, new ArrayList<VmName>());
+ assertEquals("vmType", vnfVm.getVmType());
+ }
+
+ @Test
+ public void testVnfVm() {
+ VnfVm vnfVm = new VnfVm();
+ vnfVm.setVmType("vmType");
+ vnfVm.setVmNetworks(new ArrayList<VmNetwork>());
+ vnfVm.setVmCount(1);
+ vnfVm.setVmNames(new ArrayList<VmName>());
+ assertEquals("vmType", vnfVm.getVmType());
+ assertEquals(new ArrayList<VmNetwork>(), vnfVm.getVmNetworks());
+ assertTrue(vnfVm.getVmCount() == 1);
+ assertEquals(new ArrayList<VmName>(), vnfVm.getVmNames());
+ String vnfVmString = vnfVm.toString();
+ assertTrue(vnfVmString.contains("vmType"));
+ }
+
+ @Test
+ public void testVnfVmIsEqual() {
+ VnfVm vnfVm1 = new VnfVm("vmType", new ArrayList<VmNetwork>(), 1, new ArrayList<VmName>());
+ assertTrue(vnfVm1.equals(vnfVm1));
+ assertTrue(vnfVm1.hashCode() == -1026070735);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/unittest/service/SdncContextBuilderTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/unittest/service/SdncContextBuilderTest.java
index 2095169..46c4eb5 100644
--- a/src/test/java/org/onap/pomba/contextbuilder/sdnc/unittest/service/SdncContextBuilderTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/unittest/service/SdncContextBuilderTest.java
@@ -29,10 +29,13 @@ import static org.mockito.Mockito.when;
import com.github.jknack.handlebars.internal.Files;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import java.io.File;
+import java.io.IOException;
import java.util.Collections;
+import java.util.UUID;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.junit.After;
@@ -40,6 +43,9 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.aai.restclient.client.RestClient;
+import org.onap.pomba.contextbuilder.sdnc.Application;
+import org.onap.pomba.contextbuilder.sdnc.model.ServiceEntity;
import org.onap.pomba.contextbuilder.sdnc.service.rs.RestService;
import org.onap.pomba.contextbuilder.sdnc.util.RestUtil;
import org.springframework.beans.factory.annotation.Autowired;
@@ -50,30 +56,37 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
-import org.onap.aai.restclient.client.RestClient;
-import org.onap.pomba.contextbuilder.sdnc.Application;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.UUID;
-import org.onap.pomba.contextbuilder.sdnc.model.ServiceEntity;
@RunWith(SpringJUnit4ClassRunner.class)
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
@WebAppConfiguration
@SpringBootTest (classes = Application.class)
-@TestPropertySource(properties = {"sdnc.host=localhost", "sdnc.port=30202",
- "aai.httpProtocol=http", "aai.serviceName=localhost", "aai.servicePort=9808"})
+@TestPropertySource(properties = {"sdnc.serviceName=localhost",
+ "sdnc.servicePort=30202",
+ "aai.httpProtocol=http",
+ "aai.serviceName=localhost",
+ "aai.servicePort=9808"})
+
public class SdncContextBuilderTest {
- private String serviceInstanceId = "7d518257-49bd-40ac-8d17-017a726ec12a"; //match to the test data in junit/queryNodeData-1.json
private String testRestHeaders = "testRestHeaders";
- private String customerId = "DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2"; // match to queryNodeData-1.json and customerData-1.json
- @Autowired
+ private String servicePath = "/service-subscriptions/service-subscription/vFW/service-instances/service-instance/";
+ private String genericVnfPath = "/aai/v11/network/generic-vnfs/generic-vnf/";
+ private String genericResourcePath = "/restconf/config/GENERIC-RESOURCE-API:services/service/";
+ private String vnfPath = "/restconf/config/VNF-API:vnfs/vnf-list/";
+ private String serviceInstanceIdVfw = "7d518257-49bd-40ac-8d17-017a726ec12a"; // customerData.json
+ private String serviceInstanceIdVcpe = "68352304-7bba-4609-8551-0d0b819376c3"; // queryNodeDataVcpe.json
+ private String customerIdVfw = "DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2"; // customerData.json
+ private String customerIdVcpe = "SDN-ETHERNET-INTERNET";
+ private String genericVnfId = "d94daff6-7d5b-4d2e-bc99-c9af0754b59d";
+ private String moduleId = "2c3f8902-f278-4ee3-93cf-9d2364cbafca";
+
+ HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
+
+ @Autowired
RestService service;
@Autowired
private String sdncCtxBuilderBasicAuthorization;
-
//AAI related
@Autowired
private String aaiBasicAuthorization;
@@ -108,7 +121,7 @@ public class SdncContextBuilderTest {
null, testRestHeaders, sdncCtxBuilderBasicAuthorization);
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = service.getContext(mockHttpHeaders, serviceInstanceId);
+ Response response = service.getContext(httpServletRequest, mockHttpHeaders, serviceInstanceIdVfw);
assertTrue(response.getEntity().toString().contains("Missing header parameter: " + RestUtil.FROM_APP_ID));
// Test with no Authorization
@@ -116,15 +129,15 @@ public class SdncContextBuilderTest {
"test2", testRestHeaders, null);
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl1);
- response = service.getContext(mockHttpHeaders, serviceInstanceId);
+ response = service.getContext(httpServletRequest, mockHttpHeaders, serviceInstanceIdVfw);
assertTrue(response.getEntity().toString().contains("Missing header parameter: " + RestUtil.AUTHORIZATION));
// Test with garbage Authorization
final MultivaluedMap<String, String> multivaluedMapImpl2 = buildHeaders(
- "test2", testRestHeaders, "garbage");
+ "test3", testRestHeaders, "garbage");
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl2);
- response = service.getContext(mockHttpHeaders, serviceInstanceId);
+ response = service.getContext(httpServletRequest, mockHttpHeaders, serviceInstanceIdVfw);
assertTrue(response.getEntity().toString().contains("Failed Basic " + RestUtil.AUTHORIZATION));
}
@@ -135,114 +148,150 @@ public class SdncContextBuilderTest {
"testRestParameterServiceInstanceId", "test1", sdncCtxBuilderBasicAuthorization);
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- Response response = service.getContext(mockHttpHeaders, null);
- assertTrue(response.getEntity().toString().contains("Invalid request URL, missing parameter: serviceInstanceId"));
+ Response response = service.getContext(httpServletRequest, mockHttpHeaders, null);
+ assertTrue(response
+ .getEntity()
+ .toString()
+ .contains("Invalid request URL, missing parameter: serviceInstanceId"));
}
- /*@Test
+ @Test
public void testVerifySdncContextBuilder() throws Exception {
- String urlStr = "/restconf/config/GENERIC-RESOURCE-API:services/service/" + serviceInstanceId;
- File file = new File(ClassLoader.getSystemResource("sdncResponse.json").getFile());
- String sdResonse = Files.read(file);
- this.sdncRule.stubFor(get(urlStr).willReturn(okJson(sdResonse)));
HttpHeaders mockHttpHeaders = mock( HttpHeaders.class);
final MultivaluedMap<String, String> multivaluedMapImpl = buildHeaders(
"testVerifyServiceDecomposition", "test1", sdncCtxBuilderBasicAuthorization);
-
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl);
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
- String customerUrl = aaiPathToCustomerQuery + customerId;
- addResponse(customerUrl, "junit/customerData-1.json", aaiEnricherRule);
+ // First try a vFW service instance
+
+ String queryNodeVfwUrl = aaiPathToSearchNodeQuery + serviceInstanceIdVfw;
+ addResponse(queryNodeVfwUrl, "junit/queryNodeDataVfw.json", aaiEnricherRule);
+
+ String customerVfwUrl = aaiPathToCustomerQuery + customerIdVfw;
+ addResponse(customerVfwUrl, "junit/customerData.json", aaiEnricherRule);
+
+ String serviceInstanceUrl = aaiPathToCustomerQuery
+ + customerIdVfw
+ + servicePath
+ + serviceInstanceIdVfw;
+ addResponse(serviceInstanceUrl, "junit/serviceInstance.json", aaiEnricherRule);
+
+ String vnfApiUrl = vnfPath + moduleId;
+ addResponse(vnfApiUrl, "junit/vnfApiResponse.json", sdncRule);
+
+ String genericVnfUrl = genericVnfPath + genericVnfId;
+ addResponse(genericVnfUrl, "junit/genericVnf.json", aaiEnricherRule);
+ Response response = this.service.getContext(httpServletRequest, mockHttpHeaders, serviceInstanceIdVfw);
+ assertEquals(Status.OK.getStatusCode(), response.getStatus());
+
+ // Now try a vCPE service instance
+
+ String queryNodeUrlVcpe = aaiPathToSearchNodeQuery + serviceInstanceIdVcpe;
+ addResponse(queryNodeUrlVcpe, "junit/queryNodeDataVcpe.json", aaiEnricherRule);
- Response response = this.service.getContext(mockHttpHeaders, serviceInstanceId);
+ String customerVcpeUrl = aaiPathToCustomerQuery + customerIdVcpe;
+ addResponse(customerVcpeUrl, "junit/customerData.json", aaiEnricherRule);
+
+
+ String urlStr = genericResourcePath + serviceInstanceIdVcpe;
+ addResponse(urlStr, "junit/sdncGenericResponse.json", sdncRule);
+
+ response = this.service.getContext(httpServletRequest, mockHttpHeaders, serviceInstanceIdVcpe);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
// Try again with no transcactionId
final MultivaluedMap<String, String> multivaluedMapImpl1 = buildHeaders(
"testVerifyServiceDecomposition", null, sdncCtxBuilderBasicAuthorization);
-
when(mockHttpHeaders.getRequestHeaders()).thenReturn(multivaluedMapImpl1);
- response = this.service.getContext(mockHttpHeaders, serviceInstanceId);
+ response = this.service.getContext(httpServletRequest, mockHttpHeaders, serviceInstanceIdVcpe);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
- }*/
-
- private static MultivaluedMap<String, String> buildHeaders(
- String partnerName, String transactionId, String authorization) {
-
- MultivaluedMap<String, String> headers = new MultivaluedHashMap<>();
- headers.put(RestUtil.FROM_APP_ID, Collections.singletonList(partnerName));
- headers.put(RestUtil.TRANSACTION_ID, Collections.singletonList(transactionId));
- if (null != authorization) {
- headers.put(RestUtil.AUTHORIZATION, Collections.singletonList(authorization));
- }
- return headers;
}
+
//AAI related
@Test
- public void testObtainResouceLinkBasedOnServiceInstanceFromAAI() throws Exception {
+ public void testObtainResouceLinkBasedOnServiceInstanceFromAai() throws Exception {
String transactionId = UUID.randomUUID().toString();
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
- String customerUrl = aaiPathToCustomerQuery + customerId;
- addResponse(customerUrl, "junit/customerData-1.json", aaiEnricherRule);
-
- ServiceEntity serviceEntity = RestUtil.getServiceEntity(aaiClient,aaiBaseUrl,aaiBasicAuthorization, aaiPathToSearchNodeQuery, aaiPathToCustomerQuery, serviceInstanceId, transactionId);
-
- assertEquals(serviceInstanceId, serviceEntity.getServiceInstanceId());
- assertEquals("vFW", serviceEntity.getServiceType()); // serviceType is hard-coded in queryNodeData-1.json
- assertEquals(customerId, serviceEntity.getCustomerId()); // customerId is hard-coded in queryNodeData-1.json
- assertEquals("DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2", serviceEntity.getCustomerName()); // customerName is hard-coded in queryNodeData-1.json
- assertEquals("CUST", serviceEntity.getCustomerType()); //customerType is hard-coded in customerData-1.json
+ String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceIdVfw;
+ addResponse(queryNodeUrl, "junit/queryNodeDataVfw.json", aaiEnricherRule);
+ String customerUrl = aaiPathToCustomerQuery + customerIdVfw;
+ addResponse(customerUrl, "junit/customerData.json", aaiEnricherRule);
+
+ ServiceEntity serviceEntity = RestUtil.getServiceEntity(aaiClient,
+ aaiBaseUrl,
+ aaiBasicAuthorization,
+ aaiPathToSearchNodeQuery,
+ aaiPathToCustomerQuery,
+ serviceInstanceIdVfw,
+ transactionId);
+
+ assertEquals(serviceInstanceIdVfw, serviceEntity.getServiceInstanceId());
+ assertEquals("vFW", serviceEntity.getServiceType()); // customerData.json
+ assertEquals(customerIdVfw, serviceEntity.getCustomerId()); // queryNodeData-1.json
+ assertEquals("DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2",
+ serviceEntity.getCustomerName()); // customerData.json
+ assertEquals("CUST", serviceEntity.getCustomerType()); // customerData.json
}
@Test
- public void testObtainResouceLinkBasedOnServiceInstanceFromAAI_nullResourceLink() throws Exception {
+ public void testObtainResouceLinkBasedOnServiceInstanceFromAaiNullResourceLink() throws Exception {
String transactionId = UUID.randomUUID().toString();
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- addResponse(queryNodeUrl, "junit/queryNodeData-nullResourceLink.json", aaiEnricherRule);
+ String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceIdVfw;
+ addResponse(queryNodeUrl, "junit/queryNodeDataNullResourceLink.json", aaiEnricherRule);
try {
- RestUtil.getServiceEntity(aaiClient,aaiBaseUrl,aaiBasicAuthorization, aaiPathToSearchNodeQuery, aaiPathToCustomerQuery, serviceInstanceId, transactionId);
+ RestUtil.getServiceEntity(aaiClient,
+ aaiBaseUrl,
+ aaiBasicAuthorization,
+ aaiPathToSearchNodeQuery,
+ aaiPathToCustomerQuery,
+ serviceInstanceIdVfw,
+ transactionId);
} catch (Exception e) {
assertTrue(e.getMessage().contains("JSONObject[\"resource-link\"] not found"));
}
}
@Test
- public void testObtainResouceLinkBasedOnServiceInstanceFromAAI_nullCustomerType() throws Exception {
+ public void testObtainResouceLinkBasedOnServiceInstanceFromAaiNullCustomerType() throws Exception {
String transactionId = UUID.randomUUID().toString();
- String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceId;
- addResponse(queryNodeUrl, "junit/queryNodeData-1.json", aaiEnricherRule);
- String customerUrl = aaiPathToCustomerQuery + customerId;
- addResponse(customerUrl, "junit/customerData-CustomerIdNotFound.json", aaiEnricherRule);
+ String queryNodeUrl = aaiPathToSearchNodeQuery + serviceInstanceIdVfw;
+ addResponse(queryNodeUrl, "junit/queryNodeDataVfw.json", aaiEnricherRule);
+ String customerUrl = aaiPathToCustomerQuery + customerIdVfw;
+ addResponse(customerUrl, "junit/customerDataCustomerIdNotFound.json", aaiEnricherRule);
try {
- RestUtil.getServiceEntity(aaiClient,aaiBaseUrl,aaiBasicAuthorization, aaiPathToSearchNodeQuery, aaiPathToCustomerQuery, serviceInstanceId, transactionId);
+ RestUtil.getServiceEntity(aaiClient,
+ aaiBaseUrl,
+ aaiBasicAuthorization,
+ aaiPathToSearchNodeQuery,
+ aaiPathToCustomerQuery,
+ serviceInstanceIdVfw,
+ transactionId);
} catch (Exception e) {
assertTrue(e.getMessage().contains("Customer ID cannot be found from AAI"));
}
}
- private void addResponse(String path, String classpathResource, WireMockRule thisMock) throws IOException {
- String payload = readFully(ClassLoader.getSystemResourceAsStream(classpathResource));
- thisMock.stubFor(get(path).willReturn(okJson(payload)));
+ private void addResponse(String url, String responseFile, WireMockRule thisMock) throws IOException {
+ File file = new File(ClassLoader.getSystemResource(responseFile).getFile());
+ String payload = Files.read(file);
+ thisMock.stubFor(get(url).willReturn(okJson(payload)));
}
- private String readFully(InputStream in) throws IOException {
- char[] cbuf = new char[1024];
- StringBuilder content = new StringBuilder();
- try (InputStreamReader reader = new InputStreamReader(in, "UTF-8")) {
- int count;
- while ((count = reader.read(cbuf)) >= 0) {
- content.append(cbuf, 0, count);
- }
+ private static MultivaluedMap<String, String> buildHeaders(
+ String partnerName, String transactionId, String authorization) {
+
+ MultivaluedMap<String, String> headers = new MultivaluedHashMap<>();
+ headers.put(RestUtil.FROM_APP_ID, Collections.singletonList(partnerName));
+ headers.put(RestUtil.TRANSACTION_ID, Collections.singletonList(transactionId));
+ if (null != authorization) {
+ headers.put(RestUtil.AUTHORIZATION, Collections.singletonList(authorization));
}
- return content.toString();
+ return headers;
}
+
}
diff --git a/src/test/resources/junit/aaiResourcesData-1.json b/src/test/resources/junit/aaiResourcesData-1.json
deleted file mode 100644
index 66563d5..0000000
--- a/src/test/resources/junit/aaiResourcesData-1.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "related-to": "vnfc",
- "related-link": "/aai/v11/network/vnfcs/vnfc/zrdm5aepdg01vmg003",
- "relationship-data": [
- { "relationship-key": "vnfc.vnfc-name",
- "relationship-value": "zrdm5aepdg01vmg003" }
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/junit/customerData-1.json b/src/test/resources/junit/customerData.json
index 31e6baa..31e6baa 100644
--- a/src/test/resources/junit/customerData-1.json
+++ b/src/test/resources/junit/customerData.json
diff --git a/src/test/resources/junit/customerData-CustomerIdNotFound.json b/src/test/resources/junit/customerDataCustomerIdNotFound.json
index e2f71c6..e2f71c6 100644
--- a/src/test/resources/junit/customerData-CustomerIdNotFound.json
+++ b/src/test/resources/junit/customerDataCustomerIdNotFound.json
diff --git a/src/test/resources/junit/genericVnf.json b/src/test/resources/junit/genericVnf.json
new file mode 100644
index 0000000..a731dbd
--- /dev/null
+++ b/src/test/resources/junit/genericVnf.json
@@ -0,0 +1,100 @@
+{
+ "vnf-id": "d94daff6-7d5b-4d2e-bc99-c9af0754b59d",
+ "vnf-name": "vcpe_vnf_vcpevsp_vgmux_0830_201809061919",
+ "vnf-type": "vcpesvc_vgmux/vcpevsp_vgmux_0830 0",
+ "service-id": "f9457e8c-4afd-45da-9389-46acd9bf5116",
+ "prov-status": "PROV",
+ "orchestration-status": "Active",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1536261950146",
+ "model-invariant-id": "17e561e9-d0c2-4959-a709-9335b2233966",
+ "model-version-id": "eaabc15d-c084-4e40-9d46-4d963a4c079b",
+ "model-customization-id": "71c4be60-c6a3-4874-a06e-8ebdc2f0f87b",
+ "nf-type": "",
+ "nf-function": "",
+ "nf-role": "",
+ "nf-naming-code": "",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "related-link": "/aai/v11/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/68352304-7bba-4609-8551-0d0b819376c3",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "SDN-ETHERNET-INTERNET"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "vCPE"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "68352304-7bba-4609-8551-0d0b819376c3"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "vcpe_svc_vcpesvc_vgmux_201809061919"
+ }
+ ]
+ },
+ {
+ "related-to": "platform",
+ "related-link": "/aai/v11/business/platforms/platform/Platform-Demonstration",
+ "relationship-data": [
+ {
+ "relationship-key": "platform.platform-name",
+ "relationship-value": "Platform-Demonstration"
+ }
+ ]
+ },
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/bc43d50ffcb84750bac0c1707a9a765b/vservers/vserver/0714ea3e-2126-4c31-b405-6796ffc955fb",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "RegionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "bc43d50ffcb84750bac0c1707a9a765b"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "0714ea3e-2126-4c31-b405-6796ffc955fb"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "zdcpe1cpe01mux01_201809061919"
+ }
+ ]
+ }
+ ]
+ },
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-id": "2c3f8902-f278-4ee3-93cf-9d2364cbafca",
+ "vf-module-name": "vcpe_vfmodule_vcpevspvgmux0830_201809061919",
+ "heat-stack-id": "vcpe_vfmodule_vcpevspvgmux0830_201809061919/f421ea6a-04e9-422a-8a8e-a6a01cbf87d2",
+ "orchestration-status": "active",
+ "is-base-vf-module": true,
+ "resource-version": "1536261945277",
+ "model-invariant-id": "ced468ed-46ec-4e18-9bb7-1a861c98087c",
+ "model-version-id": "d2f0ea48-d996-4d9e-893e-f649cbb969aa",
+ "model-customization-id": "52314e9a-e963-44d4-94b9-0de1ed2268c5",
+ "module-index": 0
+ }
+ ]
+ }
+}
diff --git a/src/test/resources/junit/queryNodeData-nullResourceLink.json b/src/test/resources/junit/queryNodeDataNullResourceLink.json
index 36eb667..36eb667 100644
--- a/src/test/resources/junit/queryNodeData-nullResourceLink.json
+++ b/src/test/resources/junit/queryNodeDataNullResourceLink.json
diff --git a/src/test/resources/junit/queryNodeDataVcpe.json b/src/test/resources/junit/queryNodeDataVcpe.json
new file mode 100644
index 0000000..593ba09
--- /dev/null
+++ b/src/test/resources/junit/queryNodeDataVcpe.json
@@ -0,0 +1,9 @@
+{
+ "result-data": [
+ {
+ "resource-type": "service-instance",
+ "resource-link": "/aai/v11/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/68352304-7bba-4609-8551-0d0b819376c3"
+ }
+ ]
+}
+
diff --git a/src/test/resources/junit/queryNodeData-1.json b/src/test/resources/junit/queryNodeDataVfw.json
index e827391..e827391 100644
--- a/src/test/resources/junit/queryNodeData-1.json
+++ b/src/test/resources/junit/queryNodeDataVfw.json
diff --git a/src/test/resources/sdncResponse.json b/src/test/resources/junit/sdncGenericResponse.json
index 27b791a..27b791a 100644
--- a/src/test/resources/sdncResponse.json
+++ b/src/test/resources/junit/sdncGenericResponse.json
diff --git a/src/test/resources/junit/serviceInstance.json b/src/test/resources/junit/serviceInstance.json
new file mode 100644
index 0000000..9415d84
--- /dev/null
+++ b/src/test/resources/junit/serviceInstance.json
@@ -0,0 +1,66 @@
+{
+ "service-instance-id": "68352304-7bba-4609-8551-0d0b819376c3",
+ "service-instance-name": "vcpe_svc_vcpesvc_vgmux_201809061919",
+ "environment-context": "General_Revenue-Bearing",
+ "workload-context": "Production",
+ "model-invariant-id": "58f20afd-6ed1-4451-a19d-4fbee4aefa08",
+ "model-version-id": "7b4beec3-04a6-4513-8341-959589d2bd01",
+ "resource-version": "1536261835931",
+ "orchestration-status": "Active",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "project",
+ "related-link": "/aai/v11/business/projects/project/Project-Demonstration",
+ "relationship-data": [
+ {
+ "relationship-key": "project.project-name",
+ "relationship-value": "Project-Demonstration"
+ }
+ ]
+ },
+ {
+ "related-to": "generic-vnf",
+ "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/d94daff6-7d5b-4d2e-bc99-c9af0754b59d",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "d94daff6-7d5b-4d2e-bc99-c9af0754b59d"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "vcpe_vnf_vcpevsp_vgmux_0830_201809061919"
+ }
+ ]
+ },
+ {
+ "related-to": "l3-network",
+ "related-link": "/aai/v11/network/l3-networks/l3-network/ca6f5cdc-cf66-4d03-b5c0-3604da0709a6",
+ "relationship-data": [
+ {
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "ca6f5cdc-cf66-4d03-b5c0-3604da0709a6"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "l3-network.network-name",
+ "property-value": "vcpe_net_mux_gw_201809061919"
+ }
+ ]
+ },
+ {
+ "related-to": "owning-entity",
+ "related-link": "/aai/v11/business/owning-entities/owning-entity/520cc603-a3c4-4ec2-9ef4-ca70facd79c0",
+ "relationship-data": [
+ {
+ "relationship-key": "owning-entity.owning-entity-id",
+ "relationship-value": "520cc603-a3c4-4ec2-9ef4-ca70facd79c0"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/src/test/resources/junit/vnfApiResponse.json b/src/test/resources/junit/vnfApiResponse.json
new file mode 100644
index 0000000..e3828a0
--- /dev/null
+++ b/src/test/resources/junit/vnfApiResponse.json
@@ -0,0 +1,187 @@
+{
+ "vnfs": {
+ "vnf-list": [
+ {
+ "vnf-id": "2c3f8902-f278-4ee3-93cf-9d2364cbafca",
+ "service-data": {
+ "vnf-request-information": {
+ "vnf-type": "VshakenIst09042018..base_alb..module-3",
+ "generic-vnf-name": "zdyh3bsflb0001v_01",
+ "vnf-id": "2c3f8902-f278-4ee3-93cf-9d2364cbafca",
+ "use-preload": "Y",
+ "generic-vnf-type": "vShaken_DNS_ns592n/vSHAKEN_IST_09042018 0",
+ "tenant": "f2e24e16c51244539b1f00123809cf4f",
+ "vnf-name": "zdyh3bsflb0001v_base_module_01",
+ "aic-cloud-region": "dyh3b",
+ "generic-vnf-id": "6bd2296e-d3e8-4eb8-ad65-a54d7bdb86d6"
+ },
+ "vnf-topology-information": {
+ "vnf-assignments": {
+ "vnf-networks": [
+ {
+ "network-role": "signaling",
+ "network-name": "vshaken_signal",
+ "ipv6-subnet-id": "936e0970-7403-48ef-9cf3-6374b42c5497",
+ "neutron-id": "5755dd95-b8f4-469a-931f-200727ed1933",
+ "network-id": "77747167-c41f-43e4-a5be-9a39b21949c8",
+ "contrail-network-fqdn": "default-domain:APP-C-24595-T-IST-05A:vshaken_signal",
+ "ipv6-subnet-name": "vshaken_signal_v6_s1"
+ },
+ {
+ "network-role": "management",
+ "subnet-name": "vshaken_mgmt_v4_s1",
+ "network-name": "vshaken_mgmt",
+ "subnet-id": "1bf746bc-aace-4575-b8e6-4c8f9ccddd42",
+ "neutron-id": "96f4178f-ef7a-4754-acd0-269e9c5f0fc4",
+ "network-id": "1dc87784-3359-4a47-a868-458c13545624",
+ "contrail-network-fqdn": "default-domain:APP-C-24595-T-IST-05A:vshaken_mgmt"
+ }
+ ],
+ "vnf-vms": [
+ {
+ "vm-type": "alb",
+ "vm-networks": [
+ {
+ "network-role": "management",
+ "network-ips": [
+ {
+ "ip-address": "135.50.172.132"
+ },
+ {
+ "ip-address": "135.50.172.133"
+ }
+ ],
+ "use-dhcp": "Y"
+ },
+ {
+ "network-role": "signaling",
+ "network-ips-v6": [
+ {
+ "ip-address-ipv6": "2001:1890:1001:2652::7:1"
+ },
+ {
+ "ip-address-ipv6": "2001:1890:1001:2652::7:2"
+ },
+ {
+ "ip-address-ipv6": "2001:1890:1001:2652::7:3"
+ },
+ {
+ "ip-address-ipv6": "2001:1890:1001:2652::7:4"
+ },
+ {
+ "ip-address-ipv6": "2001:1890:1001:2652::7:5"
+ },
+ {
+ "ip-address-ipv6": "2001:1890:1001:2652::7:6"
+ },
+ {
+ "ip-address-ipv6": "2001:1890:1001:2652::7:7"
+ },
+ {
+ "ip-address-ipv6": "2001:1890:1001:2652::7:8"
+ }
+ ],
+ "use-dhcp": "Y"
+ }
+ ],
+ "vm-names": [
+ {
+ "vm-name": "dyh3bsflb0001vm001"
+ },
+ {
+ "vm-name": "dyh3bsflb0001vm002"
+ }
+ ],
+ "vm-count": 2
+ }
+ ],
+ "availability-zones": [
+ {
+ "availability-zone": "dyh3b-kvm-az01"
+ },
+ {
+ "availability-zone": "dyh3b-kvm-az02"
+ }
+ ]
+ },
+ "vnf-parameters": [
+ {
+ "vnf-parameter-name": "license_server_ip",
+ "vnf-parameter-value": "135.69.241.53"
+ },
+ {
+ "vnf-parameter-name": "alb_admin_password",
+ "vnf-parameter-value": "foobar"
+ },
+ {
+ "vnf-parameter-name": "vf_module_id",
+ "vnf-parameter-value": "zdyh3bsflb0001v"
+ },
+ {
+ "vnf-parameter-name": "alb_root_password",
+ "vnf-parameter-value": "boofar"
+ },
+ {
+ "vnf-parameter-name": "vnf_id",
+ "vnf-parameter-value": "zdyh3bsflb0001v"
+ },
+ {
+ "vnf-parameter-name": "license_server_password",
+ "vnf-parameter-value": "root"
+ },
+ {
+ "vnf-parameter-name": "license_pool_name",
+ "vnf-parameter-value": "vshaken_pool"
+ },
+ {
+ "vnf-parameter-name": "signaling_netmask",
+ "vnf-parameter-value": "64"
+ },
+ {
+ "vnf-parameter-name": "alb_ssh_public_key",
+ "vnf-parameter-value": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpbEGYuDm2azRRqDHmaNeeN1w7in2TeK8y+8hTc7BtwQFjuoZBdZb7Hexf4JbYMzNc7QMaVvGa/paFS5GHoYl+gDWhci9CB3LoHHaCDB9YbBm4VaTf/04tWmur9OAl+h7EnoL+7ksRp1+7aLy3ictdimJlvlbIVgio4pINobXRqzOFr+QP+LWH92sjFGlGe61WjU/19QGyQSq0EOMU7vIxo5QaxZHpwkdQy8R1rJjoXdMj/rh3COiXWlVy3hZi3eGtK50M7vQbXn56azF4hPeN6kxkIwn2syFE0Jmw4J1aj2mnJDsix7tTlf6DL6wi54G8M21ZHHnobzKPiojjYLfh"
+ }
+ ],
+ "vnf-topology-identifier": {
+ "service-type": "SDN-MOBILITY",
+ "vnf-type": "VshakenIst09042018..base_alb..module-3",
+ "generic-vnf-name": "zdyh3bsflb0001v_01",
+ "generic-vnf-type": "vShaken_DNS_ns592n/vSHAKEN_IST_09042018 0",
+ "vnf-name": "zdyh3bsflb0001v_base_module_01"
+ }
+ },
+ "service-information": {
+ "service-id": "null",
+ "service-type": "null",
+ "service-instance-id": "ccce0f34-6603-419a-b916-acc741f4ceb4",
+ "subscriber-name": "notsurewecare"
+ },
+ "vnf-id": "2c3f8902-f278-4ee3-93cf-9d2364cbafca",
+ "sdnc-request-header": {
+ "svc-notification-url": "https://mso-sdnc-ist3.ecomp.idns.cip.att.com:30254/adapters/rest/SDNCNotify",
+ "svc-request-id": "906ece4b-d07f-4479-adbf-b7d476002808-1539182393957",
+ "svc-action": "assign"
+ },
+ "oper-status": {
+ "order-status": "PendingCreate"
+ },
+ "request-information": {
+ "source": "VID",
+ "request-action": "VNFActivateRequest",
+ "request-id": "906ece4b-d07f-4479-adbf-b7d476002808"
+ }
+ },
+ "service-status": {
+ "final-indicator": "Y",
+ "request-status": "synccomplete",
+ "response-code": "200",
+ "rpc-name": "vnf-topology-operation",
+ "vnfsdn-action": "VNFActivateRequest",
+ "rpc-action": "assign",
+ "response-timestamp": "2018-10-10T14:39:55.433Z"
+ }
+ }
+
+ ]
+ }
+} \ No newline at end of file