summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/pom.xml37
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java42
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java11
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java184
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java11
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/ServiceBean.java72
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/ServiceInstanceOperations.java158
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/bean/SortMaster.java129
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/constant/Constant.java18
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java138
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java6
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java43
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/OrchestratorController.java48
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java48
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java7
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java56
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java3
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java22
-rwxr-xr-xserver/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java4
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java18
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/OrchestratorService.java24
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java7
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java85
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIEsrNfvo.java68
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIOrchestratorRsp.java34
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIServiceSubscription.java10
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAISingleOrchestratorRsp.java67
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/EsrSystemInfo.java123
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/EsrSystemInfoList.java36
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java145
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultOrchestratorService.java78
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java22
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java29
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java69
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/DateProcessDataObject.java106
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java67
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java8
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java8
-rw-r--r--server/src/main/resources/application.properties12
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/bean/PerformanceHeaderTest.java7
-rwxr-xr-xserver/src/test/java/org/onap/usecaseui/server/controller/PerformanceControllerTest.java2
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/controller/lcm/OrchestratorControllerTest.java35
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java11
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceControllerTest.java51
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmControllerTest.java3
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIServiceSubscriptionTest.java2
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceTest.java2
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java12
50 files changed, 1903 insertions, 279 deletions
diff --git a/server/pom.xml b/server/pom.xml
index 6d575bba..d0d10aaf 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -35,7 +35,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<hibernate.version>5.3.6.Final</hibernate.version>
- <spring.version>4.3.15.RELEASE</spring.version>
+ <spring.version>4.3.4.RELEASE</spring.version>
<javax.persistence.version>1.0.2</javax.persistence.version>
<common.csv.version>1.4</common.csv.version>
<jackson.version>2.9.0</jackson.version>
@@ -72,6 +72,22 @@
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
+ <groupId>org.elasticsearch.client</groupId>
+ <artifactId>elasticsearch-rest-high-level-client</artifactId>
+ <version>6.6.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.elasticsearch</groupId>
+ <artifactId>elasticsearch</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.elasticsearch</groupId>
+ <artifactId>elasticsearch</artifactId>
+ <version>6.6.0</version>
+ </dependency>
+ <dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>
@@ -83,11 +99,18 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- <version>2.2.2</version>
- </dependency>
+ <!-- postgresql dependency-->
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>9.1-901-1.jdbc4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
@@ -326,4 +349,4 @@
</snapshots>
</pluginRepository>
</pluginRepositories>
-</project>
+</project> \ No newline at end of file
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
index 62ef39a7..0a077241 100644
--- a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsHeader.java
@@ -35,78 +35,78 @@ public class AlarmsHeader implements Serializable{
@Column(name = "version")
private String version;
- @Column(name = "eventName")
+ @Column(name = "event_name")
private String eventName;
@Column(name = "domain")
private String domain;
- @Column(name = "eventId")
+ @Column(name = "event_id")
private String eventId;
- @Column(name = "eventType")
+ @Column(name = "event_type")
private String eventType;
- @Column(name = "nfcNamingCode", nullable=false)
+ @Column(name = "nfc_naming_code", nullable=false)
private String nfcNamingCode;
- @Column(name = "nfNamingCode", nullable=false)
+ @Column(name = "nf_naming_code", nullable=false)
private String nfNamingCode;
- @Column(name = "sourceId")
+ @Column(name = "source_id")
private String sourceId;
- @Column(name = "sourceName")
+ @Column(name = "source_name")
private String sourceName;
- @Column(name = "reportingEntityId")
+ @Column(name = "reporting_entity_id")
private String reportingEntityId;
- @Column(name = "reportingEntityName")
+ @Column(name = "reporting_entity_name")
private String reportingEntityName;
@Column(name = "priority")
private String priority;
- @Column(name = "startEpochMicrosec")
+ @Column(name = "start_epoch_microsec")
private String startEpochMicrosec;
- @Column(name = "lastEpochMicroSec")
+ @Column(name = "last_epoch_microsec")
private String lastEpochMicroSec;
- @Column(name = "startEpochMicrosecCleared")
+ @Column(name = "start_epoch_microsec_cleared")
private String startEpochMicrosecCleared;
- @Column(name = "lastEpochMicroSecCleared")
+ @Column(name = "last_epoch_microsec_cleared")
private String lastEpochMicroSecCleared;
@Column(name = "sequence")
private String sequence;
- @Column(name = "faultFieldsVersion")
+ @Column(name = "fault_fields_version")
private String faultFieldsVersion;
- @Column(name = "eventServrity")
+ @Column(name = "event_servrity")
private String eventServrity;
- @Column(name = "eventSourceType")
+ @Column(name = "event_source_type")
private String eventSourceType;
- @Column(name = "eventCategory")
+ @Column(name = "event_category")
private String eventCategory;
- @Column(name = "alarmCondition")
+ @Column(name = "alarm_condition")
private String alarmCondition;
- @Column(name = "specificProblem")
+ @Column(name = "specific_problem")
private String specificProblem;
- @Column(name = "vfStatus")
+ @Column(name = "vf_status")
private String vfStatus;
- @Column(name = "alarmInterfaceA")
+ @Column(name = "alarm_interfacea")
private String alarmInterfaceA;
@Column(name = "status")
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java
index f39e3dd2..f11175ff 100644
--- a/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/AlarmsInformation.java
@@ -19,6 +19,8 @@ import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@@ -32,6 +34,7 @@ import javax.persistence.Table;
public class AlarmsInformation implements Serializable {
@Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@@ -41,16 +44,16 @@ public class AlarmsInformation implements Serializable {
@Column(name = "value")
private String value;
- @Column(name = "sourceId")
+ @Column(name = "source_id")
private String sourceId;
- @Column(name = "startEpochMicroSec")
+ @Column(name = "start_epoch_microsec")
private String startEpochMicroSec;
- @Column(name = "lastEpochMicroSec")
+ @Column(name = "last_epoch_microsec")
private String lastEpochMicroSec;
- @Column(name = "headerId")
+ @Column(name = "header_id")
private String headerId;
@Override
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java
index 36ad68b5..c6e63bbf 100755
--- a/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceHeader.java
@@ -35,54 +35,176 @@ public class PerformanceHeader implements Serializable {
@Column(name = "version")
private String version;
- @Column(name = "eventName")
+ @Column(name = "event_name")
private String eventName;
@Column(name = "domain")
private String domain;
- @Column(name = "eventId")
+ @Column(name = "event_id")
private String eventId;
- @Column(name = "eventType")
+ @Column(name = "event_type")
private String eventType;
- @Column(name = "nfcNamingCode", nullable=false)
+ @Column(name = "nfc_naming_code", nullable=false)
private String nfcNamingCode;
- @Column(name = "nfNamingCode", nullable=false)
+ @Column(name = "nf_naming_code", nullable=false)
private String nfNamingCode;
- @Column(name = "sourceId")
+ @Column(name = "source_id")
private String sourceId;
- @Column(name = "sourceName")
+ @Column(name = "source_name")
private String sourceName;
- @Column(name = "reportingEntityId")
+ @Column(name = "reporting_entity_id")
private String reportingEntityId;
- @Column(name = "reportingEntityName")
+ @Column(name = "reporting_entity_name")
private String reportingEntityName;
@Column(name = "priority")
private String priority;
- @Column(name = "startEpochMicrosec")
+ @Column(name = "start_epoch_microsec")
private String startEpochMicrosec;
- @Column(name = "lastEpochMicroSec")
+ @Column(name = "last_epoch_microsec")
private String lastEpochMicroSec;
@Column(name = "sequence")
private String sequence;
- @Column(name = "measurementsForVfScalingVersion")
+ @Column(name = "measurements_for_vf_scaling_version")
private String measurementsForVfScalingVersion;
- @Column(name = "measurementInterval")
+ @Column(name = "measurement_interval")
private String measurementInterval;
+
+ /** */
+ public static class PerformanceHeaderBuilder {
+ private String sourceId;
+ private String version;
+ private String eventName;
+ private String domain;
+ private String eventId;
+ private String eventType;
+ private String nfcNamingCode;
+ private String nfNamingCode;
+ private String sourceName;
+ private String reportingEntityId;
+ private String reportingEntityName;
+ private String priority;
+ private String startEpochMicrosec;
+ private String lastEpochMicroSec;
+ private String sequence;
+ private String measurementsForVfScalingVersion;
+ private String measurementInterval;
+ private Date createTime;
+ private Date updateTime;
+
+ public PerformanceHeaderBuilder setSourceId(String sourceId) {
+ this.sourceId = sourceId;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setVersion(String version) {
+ this.version = version;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setEventName(String eventName) {
+ this.eventName = eventName;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setDomain(String domain) {
+ this.domain = domain;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setEventId(String eventId) {
+ this.eventId = eventId;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setEventType(String eventType) {
+ this.eventType = eventType;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setNfcNamingCode(String nfcNamingCode) {
+ this.nfcNamingCode = nfcNamingCode;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setNfNamingCode(String nfNamingCode) {
+ this.nfNamingCode = nfNamingCode;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setSourceName(String sourceName) {
+ this.sourceName = sourceName;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setReportingEntityId(String reportingEntityId) {
+ this.reportingEntityId = reportingEntityId;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setReportingEntityName(String reportingEntityName) {
+ this.reportingEntityName = reportingEntityName;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setPriority(String priority) {
+ this.priority = priority;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setStartEpochMicrosec(String startEpochMicrosec) {
+ this.startEpochMicrosec = startEpochMicrosec;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setLastEpochMicroSec(String lastEpochMicroSec) {
+ this.lastEpochMicroSec = lastEpochMicroSec;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setSequence(String sequence) {
+ this.sequence = sequence;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setMeasurementsForVfScalingVersion(String measurementsForVfScalingVersion) {
+ this.measurementsForVfScalingVersion = measurementsForVfScalingVersion;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setMeasurementInterval(String measurementInterval) {
+ this.measurementInterval = measurementInterval;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ return this;
+ }
+
+ public PerformanceHeaderBuilder setUpdateTime(Date updateTime) {
+ this.updateTime = updateTime;
+ return this;
+ }
+
+ public PerformanceHeader createPerformanceHeader() {
+ return new PerformanceHeader(this);
+ }
+ }
public PerformanceHeader() {
}
@@ -91,24 +213,24 @@ public class PerformanceHeader implements Serializable {
this.sourceId = sourceId;
}
- public PerformanceHeader(String version, String eventName, String domain, String eventId, String eventType, String nfcNamingCode, String nfNamingCode, String sourceId, String sourceName, String reportingEntityId, String reportingEntityName, String priority, String startEpochMicrosec, String lastEpochMicroSec, String sequence, String measurementsForVfScalingVersion, String measurementInterval, Date createTime, Date updateTime) {
- this.version = version;
- this.eventName = eventName;
- this.domain = domain;
- this.eventId = eventId;
- this.eventType = eventType;
- this.nfcNamingCode = nfcNamingCode;
- this.nfNamingCode = nfNamingCode;
- this.sourceId = sourceId;
- this.sourceName = sourceName;
- this.reportingEntityId = reportingEntityId;
- this.reportingEntityName = reportingEntityName;
- this.priority = priority;
- this.startEpochMicrosec = startEpochMicrosec;
- this.lastEpochMicroSec = lastEpochMicroSec;
- this.sequence = sequence;
- this.measurementsForVfScalingVersion = measurementsForVfScalingVersion;
- this.measurementInterval = measurementInterval;
+ public PerformanceHeader(PerformanceHeaderBuilder builder) {
+ this.version = builder.version;
+ this.eventName = builder.eventName;
+ this.domain = builder.domain;
+ this.eventId = builder.eventId;
+ this.eventType = builder.eventType;
+ this.nfcNamingCode = builder.nfcNamingCode;
+ this.nfNamingCode = builder.nfNamingCode;
+ this.sourceId = builder.sourceId;
+ this.sourceName = builder.sourceName;
+ this.reportingEntityId = builder.reportingEntityId;
+ this.reportingEntityName = builder.reportingEntityName;
+ this.priority = builder.priority;
+ this.startEpochMicrosec = builder.startEpochMicrosec;
+ this.lastEpochMicroSec = builder.lastEpochMicroSec;
+ this.sequence = builder.sequence;
+ this.measurementsForVfScalingVersion = builder.measurementsForVfScalingVersion;
+ this.measurementInterval = builder.measurementInterval;
}
public String getVersion() {
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java
index 72626e68..e53202b9 100755
--- a/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/PerformanceInformation.java
@@ -20,6 +20,8 @@ import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@@ -29,6 +31,7 @@ import javax.persistence.Table;
public class PerformanceInformation implements Serializable {
@Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@@ -38,16 +41,16 @@ public class PerformanceInformation implements Serializable {
@Column(name = "value")
private String value;
- @Column(name = "sourceId")
+ @Column(name = "source_id")
private String sourceId;
- @Column(name = "startEpochMicrosec")
+ @Column(name = "start_epoch_microsec")
private String startEpochMicrosec;
- @Column(name = "lastEpochMicroSec")
+ @Column(name = "last_epoch_microSec")
private String lastEpochMicroSec;
- @Column(name="headerId")
+ @Column(name="header_id")
private String headerId;
public PerformanceInformation() {
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/ServiceBean.java b/server/src/main/java/org/onap/usecaseui/server/bean/ServiceBean.java
index af53ab25..34c756d2 100644
--- a/server/src/main/java/org/onap/usecaseui/server/bean/ServiceBean.java
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/ServiceBean.java
@@ -28,26 +28,41 @@ public class ServiceBean {
@Column(name = "id")
private String id;
- @Column(name = "serviceInstanceId")
+ @Column(name = "service_instance_id")
private String serviceInstanceId;
- @Column(name = "customerId")
+ @Column(name = "customer_id")
private String customerId;
- @Column(name = "serviceType")
+ @Column(name = "service_type")
private String serviceType;
- @Column(name = "serviceDomain")
+ @Column(name = "usecase_type")
private String serviceDomain;
- @Column(name = "operationId")
- private String operationId;
-
- @Column(name = "parentServiceInstanceId")
+ @Column(name = "parent_service_instance_id")
private String parentServiceInstanceId;
- @Column(name = "status")
- private String status;
+ @Column(name = "uuid")
+ private String uuid;
+
+ @Column(name = "invariant_uuid")
+ private String invariantUuuid;
+
+ public ServiceBean() {
+ }
+
+ public ServiceBean(String id, String serviceInstanceId, String customerId, String serviceType, String serviceDomain,
+ String parentServiceInstanceId, String uuid, String invariantUuuid) {
+ this.id = id;
+ this.serviceInstanceId = serviceInstanceId;
+ this.customerId = customerId;
+ this.serviceType = serviceType;
+ this.serviceDomain = serviceDomain;
+ this.parentServiceInstanceId = parentServiceInstanceId;
+ this.uuid = uuid;
+ this.invariantUuuid = invariantUuuid;
+ }
public String getId() {
return id;
@@ -89,14 +104,6 @@ public class ServiceBean {
this.serviceDomain = serviceDomain;
}
- public String getOperationId() {
- return operationId;
- }
-
- public void setOperationId(String operationId) {
- this.operationId = operationId;
- }
-
public String getParentServiceInstanceId() {
return parentServiceInstanceId;
}
@@ -105,34 +112,21 @@ public class ServiceBean {
this.parentServiceInstanceId = parentServiceInstanceId;
}
- public String getStatus() {
- return status;
+ public String getUuid() {
+ return uuid;
}
- public void setStatus(String status) {
- this.status = status;
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
}
- public ServiceBean() {
+ public String getInvariantUuuid() {
+ return invariantUuuid;
}
- public ServiceBean(String id, String serviceInstanceId, String customerId, String serviceType, String serviceDomain,
- String operationId, String parentServiceInstanceId, String status) {
- this.id = id;
- this.serviceInstanceId = serviceInstanceId;
- this.customerId = customerId;
- this.serviceType = serviceType;
- this.serviceDomain = serviceDomain;
- this.operationId = operationId;
- this.parentServiceInstanceId = parentServiceInstanceId;
- this.status = status;
+ public void setInvariantUuuid(String invariantUuuid) {
+ this.invariantUuuid = invariantUuuid;
}
- @Override
- public String toString() {
- return "ServiceBean [id=" + id + ", serviceInstanceId=" + serviceInstanceId + ", customerId=" + customerId
- + ", serviceType=" + serviceType + ", serviceDomain=" + serviceDomain + ", operationId=" + operationId
- + ", parentServiceInstanceId=" + parentServiceInstanceId + ", status=" + status + "]";
- }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/ServiceInstanceOperations.java b/server/src/main/java/org/onap/usecaseui/server/bean/ServiceInstanceOperations.java
new file mode 100644
index 00000000..313e2361
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/ServiceInstanceOperations.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2018 CMCC, Inc. and others. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.bean;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="service_instance_operations")
+public class ServiceInstanceOperations implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name = "service_instance_id")
+ private String serviceInstanceId;
+
+ @Id
+ @Column(name = "operation_id")
+ private String operationId;
+
+ @Column(name = "operation_type")
+ private String operationType;
+
+ @Column(name = "operation_progress")
+ private String operationProgress;
+
+ @Column(name = "operation_result")
+ private String operationResult;
+
+ @Column(name = "start_time")
+ private String startTime;
+
+ @Column(name = "end_time")
+ private String endTime;
+
+ public ServiceInstanceOperations() {
+ }
+
+ public ServiceInstanceOperations(String serviceInstanceId, String operationId, String operationType,
+ String operationProgress, String operationResult, String startTime, String endTime) {
+ super();
+ this.serviceInstanceId = serviceInstanceId;
+ this.operationId = operationId;
+ this.operationType = operationType;
+ this.operationProgress = operationProgress;
+ this.operationResult = operationResult;
+ this.startTime = startTime;
+ this.endTime = endTime;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+ public String getOperationType() {
+ return operationType;
+ }
+
+ public void setOperationType(String operationType) {
+ this.operationType = operationType;
+ }
+
+ public String getOperationProgress() {
+ return operationProgress;
+ }
+
+ public void setOperationProgress(String operationProgress) {
+ this.operationProgress = operationProgress;
+ }
+
+ public String getOperationResult() {
+ return operationResult;
+ }
+
+ public void setOperationResult(String operationResult) {
+ this.operationResult = operationResult;
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
+ public String getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(String endTime) {
+ this.endTime = endTime;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((operationId == null) ? 0 : operationId.hashCode());
+ result = prime * result + ((serviceInstanceId == null) ? 0 : serviceInstanceId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ServiceInstanceOperations other = (ServiceInstanceOperations) obj;
+ if (operationId == null) {
+ if (other.operationId != null)
+ return false;
+ } else if (!operationId.equals(other.operationId))
+ return false;
+ if (serviceInstanceId == null) {
+ if (other.serviceInstanceId != null)
+ return false;
+ } else if (!serviceInstanceId.equals(other.serviceInstanceId))
+ return false;
+ return true;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/SortMaster.java b/server/src/main/java/org/onap/usecaseui/server/bean/SortMaster.java
new file mode 100644
index 00000000..28a94e24
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/bean/SortMaster.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2018 CMCC, Inc. and others. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.bean;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="sort_master")
+public class SortMaster implements Serializable{
+
+ @Id
+ @Column(name = "sort_type")
+ private String sortType;
+
+ @Id
+ @Column(name = "sort_code")
+ private String sortCode;
+
+
+ @Column(name = "sort_value")
+ private String sortValue;
+
+ @Id
+ @Column(name = "language")
+ private String language;
+
+ public SortMaster() {
+ }
+
+ public SortMaster(String sortType, String sortCode, String sortValue, String language) {
+ this.sortType = sortType;
+ this.sortCode = sortCode;
+ this.sortValue = sortValue;
+ this.language = language;
+ }
+
+ public String getSortType() {
+ return sortType;
+ }
+
+ public void setSortType(String sortType) {
+ this.sortType = sortType;
+ }
+
+ public String getSortCode() {
+ return sortCode;
+ }
+
+ public void setSortCode(String sortCode) {
+ this.sortCode = sortCode;
+ }
+
+ public String getSortValue() {
+ return sortValue;
+ }
+
+ public void setSortValue(String sortValue) {
+ this.sortValue = sortValue;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+
+ @Override
+ public String toString() {
+ return "SortMaster [sortType=" + sortType + ", sortCode=" + sortCode + ", sortValue=" + sortValue
+ + ", language=" + language + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((language == null) ? 0 : language.hashCode());
+ result = prime * result + ((sortCode == null) ? 0 : sortCode.hashCode());
+ result = prime * result + ((sortType == null) ? 0 : sortType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SortMaster other = (SortMaster) obj;
+ if (language == null) {
+ if (other.language != null)
+ return false;
+ } else if (!language.equals(other.language))
+ return false;
+ if (sortCode == null) {
+ if (other.sortCode != null)
+ return false;
+ } else if (!sortCode.equals(other.sortCode))
+ return false;
+ if (sortType == null) {
+ if (other.sortType != null)
+ return false;
+ } else if (!sortType.equals(other.sortType))
+ return false;
+ return true;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java b/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java
index f1babd68..b384b80b 100755
--- a/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java
+++ b/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java
@@ -32,4 +32,22 @@ public final class Constant
public static final String CONSTANT_SUCCESS="{\"status\":\"SUCCESS\"}";
public static final String CONSTANT_FAILED="{\"status\":\"FAILED\"}";
+
+ public static final String CREATING_CODE="1001";
+
+ public static final String DELETING_CODE="1002";
+
+ public static final String SCALING_CODE="1003";
+
+ public static final String HEALING_CODE="1004";
+
+ public static final String SUCCESS_CODE="2001";
+
+ public static final String FAIL_CODE="2002";
+
+ public static final String IN_PROGRESS_CODE="2003";
+
+ public static final String ALARM_TOPIC="unauthenticated.SEC_FAULT_OUTPUT";
+
+ public static final String PERFORMANCE_TOPIC="unauthenticated.SEC_MEASUREMENT_OUTPUT";
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
index be72cc70..63bce433 100755
--- a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java
@@ -29,9 +29,11 @@ import javax.annotation.Resource;
import org.onap.usecaseui.server.bean.AlarmsHeader;
import org.onap.usecaseui.server.bean.AlarmsInformation;
+import org.onap.usecaseui.server.bean.SortMaster;
import org.onap.usecaseui.server.constant.Constant;
import org.onap.usecaseui.server.service.AlarmsHeaderService;
import org.onap.usecaseui.server.service.AlarmsInformationService;
+import org.onap.usecaseui.server.util.DateProcessDataObject;
import org.onap.usecaseui.server.util.DateUtils;
import org.onap.usecaseui.server.util.Page;
import org.onap.usecaseui.server.util.UuiCommonUtil;
@@ -98,26 +100,30 @@ public class AlarmController
* test commit
* @throws ParseException
*/
- @RequestMapping(value = {"/alarm/{currentPage}/{pageSize}"},
- method = RequestMethod.GET , produces = "application/json")
+ @RequestMapping(value = {"/alarm/{currentPage}/{pageSize}"}, method = RequestMethod.GET,
+ produces = "application/json")
public String getAlarmData(@RequestParam(required = false) String sourceName,
- @RequestParam(required = false) String priority,@RequestParam(required = false) String startTime,
- @RequestParam(required = false) String endTime,@RequestParam(required = false) String vfStatus,
- @PathVariable String currentPage, @PathVariable String pageSize) throws JsonProcessingException, ParseException {
- AlarmsHeader alarm = new AlarmsHeader();
- alarm.setSourceName(sourceName);
- alarm.setStatus(vfStatus);
- alarm.setStartEpochMicrosec(!UuiCommonUtil.isNotNullOrEmpty(startTime)?null:new SimpleDateFormat(Constant.DATE_FORMAT).parse(startTime).getTime()+"");
- alarm.setLastEpochMicroSec(!UuiCommonUtil.isNotNullOrEmpty(endTime)?null:new SimpleDateFormat(Constant.DATE_FORMAT).parse(endTime).getTime()+"");
- Page pa = alarmsHeaderService.queryAlarmsHeader(alarm,Integer.parseInt(currentPage),Integer.parseInt(pageSize));
+ @RequestParam(required = false) String priority, @RequestParam(required = false) String startTime,
+ @RequestParam(required = false) String endTime, @RequestParam(required = false) String vfStatus,
+ @PathVariable String currentPage, @PathVariable String pageSize)
+ throws JsonProcessingException, ParseException {
+ AlarmsHeader alarm = new AlarmsHeader();
+ alarm.setSourceName(sourceName);
+ alarm.setStatus(vfStatus);
+ alarm.setStartEpochMicrosec(!UuiCommonUtil.isNotNullOrEmpty(startTime) ? null
+ : new SimpleDateFormat(Constant.DATE_FORMAT).parse(startTime).getTime() + "");
+ alarm.setLastEpochMicroSec(!UuiCommonUtil.isNotNullOrEmpty(endTime) ? null
+ : new SimpleDateFormat(Constant.DATE_FORMAT).parse(endTime).getTime() + "");
+ Page pa =
+ alarmsHeaderService.queryAlarmsHeader(alarm, Integer.parseInt(currentPage), Integer.parseInt(pageSize));
try {
- Map<String,Object> map = new HashMap<>();
- map.put("alarms",pa.getList());
- map.put("totalRecords",pa.getTotalRecords());
+ Map<String, Object> map = new HashMap<>();
+ map.put("alarms", pa.getList());
+ map.put("totalRecords", pa.getTotalRecords());
omAlarm.setDateFormat(new SimpleDateFormat(Constant.DATE_FORMAT));
return omAlarm.writeValueAsString(map);
} catch (JsonProcessingException e) {
- logger.debug("JsonProcessingException :"+e.getMessage());
+ logger.debug("JsonProcessingException :" + e.getMessage());
return omAlarm.writeValueAsString("failed");
}
}
@@ -168,59 +174,75 @@ public class AlarmController
}
@RequestMapping(value = {"/alarm/diagram"},method = RequestMethod.GET,produces = "application/json")
- public String diagram(@RequestParam String sourceName, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam String format) {
+ public String diagram(@RequestParam String sourceName, @RequestParam(required = false) String startTime,
+ @RequestParam(required = false) String endTime, @RequestParam String format) {
long timeInterval = 0;
- try {
- if("month".equals(format)){//alarm day month year
- formatDate="yyyy-MM";
- int maxDay= DateUtils.MonthOfDay(startTime, formatDate);
- timeInterval =86400000L*maxDay;
- }else{
- formatDate="yyyy-MM-dd";
- timeInterval =86400000;
- }
- sdf = new SimpleDateFormat(formatDate);
+ try {
+ if ("month".equals(format)) {// alarm day month year
+ formatDate = "yyyy-MM";
+ int maxDay = DateUtils.MonthOfDay(startTime, formatDate);
+ timeInterval = 86400000L * maxDay;
+ } else {
+ formatDate = "yyyy-MM-dd";
+ timeInterval = 86400000;
+ }
+ sdf = new SimpleDateFormat(formatDate);
long startTimel = sdf.parse(startTime).getTime();
long endTimel = sdf.parse(endTime).getTime();
- return getDiagram(sourceName, startTimel, endTimel+timeInterval, timeInterval, 1, 1,format);
+ return getDiagram(sourceName, startTimel, endTimel + timeInterval, timeInterval, 1, 1, format);
} catch (Exception e) {
- logger.error("alarmController diagram occured exception:"+e.getMessage());
+ logger.error("alarmController diagram occured exception:" + e.getMessage());
e.printStackTrace();
}
return null;
}
@SuppressWarnings("rawtypes")
- private String getDiagram(String sourceName, long startTimeL, long endTimeL, long timeIteraPlusVal, long keyVal, long keyValIteraVal,String format) throws JsonProcessingException{
- Map<String,List> result = new HashMap<String,List>();
-
- Map<String,List> allMaps = dateProcess(sourceName, startTimeL, endTimeL, timeIteraPlusVal, keyVal, keyValIteraVal,format,"");
- Map<String,List> closedMaps = dateProcess(sourceName, startTimeL, endTimeL, timeIteraPlusVal, 1, 1,format,"closed");
- Map<String,List> activeMaps = dateProcess(sourceName, startTimeL, endTimeL, timeIteraPlusVal, 1, 1,format,"active");
- result.put("dateList", allMaps.get("dateTime"));
- result.put("allList", allMaps.get("dataList"));
- result.put("closedList",closedMaps.get("dataList"));
- result.put("ActiveList",activeMaps.get("dataList"));
- return omAlarm.writeValueAsString(result);
+ private String getDiagram(String sourceName, long startTimeL, long endTimeL, long timeIteraPlusVal, long keyVal,
+ long keyValIteraVal, String format) throws JsonProcessingException {
+ Map<String, List> result = new HashMap<String, List>();
+
+ Map<String, List> allMaps = dateProcess(new DateProcessDataObject().setSourceName(sourceName)
+ .setStartTimeL(startTimeL).setEndTimeL(endTimeL).setTimeIteraPlusVal(timeIteraPlusVal).setKeyVal(keyVal)
+ .setKeyValIteraVal(keyValIteraVal).setFormat(format).setLevel(""));
+
+ Map<String, List> closedMaps = dateProcess(new DateProcessDataObject().setSourceName(sourceName)
+ .setStartTimeL(startTimeL).setEndTimeL(endTimeL).setTimeIteraPlusVal(timeIteraPlusVal).setKeyVal(1)
+ .setKeyValIteraVal(1).setFormat(format).setLevel("closed"));
+
+ Map<String, List> activeMaps = dateProcess(new DateProcessDataObject().setSourceName(sourceName)
+ .setStartTimeL(startTimeL).setEndTimeL(endTimeL).setTimeIteraPlusVal(timeIteraPlusVal).setKeyVal(1)
+ .setKeyValIteraVal(1).setFormat(format).setLevel("active"));
+
+ result.put("dateList", allMaps.get("dateTime"));
+ result.put("allList", allMaps.get("dataList"));
+ result.put("closedList", closedMaps.get("dataList"));
+ result.put("ActiveList", activeMaps.get("dataList"));
+ return omAlarm.writeValueAsString(result);
}
- private Map<String,List> dateProcess(String sourceName, long startTimeL, long endTimeL, long timeIteraPlusVal, long keyVal, long keyValIteraVal,String format,String level) {
- Map<String,List> result = new HashMap<String,List>();
+
+ private Map<String, List> dateProcess(DateProcessDataObject dataObject) {
+ Map<String, List> result = new HashMap<String, List>();
List<String> dateList = new ArrayList<String>();
List<Integer> numList = new ArrayList<Integer>();
- long tmpEndTimeL = startTimeL + timeIteraPlusVal;
- while (endTimeL >= tmpEndTimeL) {
- int maxDay2 = 1;
- int maxDay = 1;
- int num = alarmsInformationService.queryDateBetween(sourceName,startTimeL+"",tmpEndTimeL+"",level);
- dateList.add(DateUtils.getResultDate(startTimeL, format));
- if("month".equals(format)){
- maxDay2 = DateUtils.MonthOfDay(sdf.format(new Date(tmpEndTimeL)), formatDate);
- maxDay = DateUtils.MonthOfDay(sdf.format(new Date(startTimeL)), formatDate);
+ long tmpEndTimeL = dataObject.getStartTimeL() + dataObject.getTimeIteraPlusVal();
+ while (dataObject.getEndTimeL() >= tmpEndTimeL) {
+ int maxDay2 = 1;
+ int maxDay = 1;
+ int num = alarmsInformationService.queryDateBetween(dataObject.getSourceName(),
+ dataObject.getStartTimeL() + "", tmpEndTimeL + "", dataObject.getLevel());
+ dateList.add(DateUtils.getResultDate(dataObject.getStartTimeL(), dataObject.getFormat()));
+ if ("month".equals(dataObject.getFormat())) {
+ maxDay2 = DateUtils.MonthOfDay(sdf.format(new Date(tmpEndTimeL)), formatDate);
+ maxDay = DateUtils.MonthOfDay(sdf.format(new Date(dataObject.getStartTimeL())), formatDate);
}
numList.add(num);
- startTimeL += 86400000L*maxDay;
- tmpEndTimeL += 86400000L*maxDay2;
- keyVal += keyValIteraVal;
+ long startTimeL1 = dataObject.getStartTimeL();
+ startTimeL1 += 86400000L * maxDay;
+ tmpEndTimeL += 86400000L * maxDay2;
+ long keyVal1 = dataObject.getKeyVal();
+ long keyValIteraVal1 = dataObject.getKeyValIteraVal();
+ keyVal1 += keyValIteraVal1;
}
result.put("dateTime", dateList);
result.put("dataList", numList);
@@ -253,4 +275,14 @@ public class AlarmController
String string =omAlarm.writeValueAsString(map);
return string;
}
+
+ @RequestMapping(value="/listSortMasters",method=RequestMethod.GET,produces = "application/json")
+ public String getSortMasterInfo() throws JsonProcessingException{
+ Map<String,List<SortMaster>> map = new HashMap<>();
+ List<SortMaster> operationTypes = alarmsHeaderService.listSortMasters("operationType");
+ List<SortMaster> operationResults = alarmsHeaderService.listSortMasters("operationResult");
+ map.put("operationTypes", operationTypes);
+ map.put("operationResults", operationResults);
+ return omAlarm.writeValueAsString(map);
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java b/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java
index 6b7eecca..0ef97ce0 100755
--- a/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java
@@ -78,7 +78,7 @@ public class PerformanceController {
@RequestParam(required = false) String sourceName,
@RequestParam(required = false) String startTime,@RequestParam(required = false) String endTime) throws JsonProcessingException, ParseException {
Page<PerformanceHeader> pa = new Page<PerformanceHeader>();
- PerformanceHeader performanceHeader = new PerformanceHeader();
+ PerformanceHeader performanceHeader = new PerformanceHeader.PerformanceHeaderBuilder().createPerformanceHeader();
performanceHeader.setSourceName(sourceName);
performanceHeader.setStartEpochMicrosec(!UuiCommonUtil.isNotNullOrEmpty(startTime)?null:new SimpleDateFormat(Constant.DATE_FORMAT).parse(startTime).getTime()+"");
performanceHeader.setLastEpochMicroSec(!UuiCommonUtil.isNotNullOrEmpty(endTime)?null:new SimpleDateFormat(Constant.DATE_FORMAT).parse(endTime).getTime()+"");
@@ -125,7 +125,7 @@ public class PerformanceController {
@RequestMapping(value = {"/performance/getSourceNames/{currentPage}/{pageSize}"},method = RequestMethod.GET, produces = "application/json")
public String getPerformanceSourceNames(@PathVariable String currentPage,@PathVariable String pageSize,
@RequestParam(required = false) String sourceName) throws JsonProcessingException{
- PerformanceHeader performanceHeader = new PerformanceHeader();
+ PerformanceHeader performanceHeader = new PerformanceHeader.PerformanceHeaderBuilder().createPerformanceHeader();
Page<PerformanceHeader> page = new Page<PerformanceHeader>();
Set<String> names = new HashSet<String>();
performanceHeader.setSourceName(sourceName);
@@ -133,7 +133,7 @@ public class PerformanceController {
if(!UuiCommonUtil.isNotNullOrEmpty(page)){
page = new Page<>();
List<PerformanceHeader> list = new ArrayList<>();
- performanceHeader = new PerformanceHeader();
+ performanceHeader = new PerformanceHeader.PerformanceHeaderBuilder().createPerformanceHeader();
list.add(performanceHeader);
page.setList(list);
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java
index 9d332e7b..22bda7e4 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java
@@ -23,9 +23,14 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
+import com.alibaba.fastjson.JSONObject;
+
import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
import java.util.List;
@Controller
@@ -45,10 +50,46 @@ public class CustomerController {
public List<AAICustomer> getCustomers(){
return customerService.listCustomer();
}
-
+
+ @ResponseBody
+ @RequestMapping(value={"/uui-lcm/customers/{customerId}"},method = RequestMethod.PUT,produces="application/json")
+ public JSONObject createOrUpdateCustomer(HttpServletRequest request,@PathVariable String customerId){
+ return customerService.createOrUpdateCustomer(request, customerId);
+ }
+
+ @ResponseBody
+ @RequestMapping(value={"/uui-lcm/customers/{customerId}"},method = RequestMethod.GET,produces="application/json")
+ public JSONObject getCustomerById(@PathVariable String customerId){
+ return customerService.getCustomerById(customerId);
+ }
+
+ @ResponseBody
+ @RequestMapping(value={"/uui-lcm/customers"},method = RequestMethod.DELETE,produces="application/json")
+ public JSONObject deleteCustomer(@RequestParam String customerId,@RequestParam String resourceVersion){
+ return customerService.deleteCustomer(customerId,resourceVersion);
+ }
+
@ResponseBody
@RequestMapping(value = {"/uui-lcm/customers/{customerId}/service-subscriptions"}, method = RequestMethod.GET , produces = "application/json")
public List<AAIServiceSubscription> getServiceSubscriptions(@PathVariable(value="customerId") String customerId){
return customerService.listServiceSubscriptions(customerId);
}
+
+ @ResponseBody
+ @RequestMapping(value={"/uui-lcm/customers/{customerId}/service-subscriptions/{serviceType}"},method = RequestMethod.PUT,produces="application/json")
+ public JSONObject createOrUpdateServiceType(HttpServletRequest request,@PathVariable String serviceType){
+ return customerService.createOrUpdateServiceType(request, serviceType);
+ }
+
+ @ResponseBody
+ @RequestMapping(value={"/uui-lcm/customers/{customerId}/service-subscriptions/{serviceType}"},method = RequestMethod.DELETE,produces="application/json")
+ public JSONObject deleteServiceType(@PathVariable String customerId,@PathVariable String serviceType,@RequestParam String resourceVersion){
+ return customerService.deleteServiceType(customerId,serviceType,resourceVersion);
+ }
+
+ @ResponseBody
+ @RequestMapping(value={"/uui-lcm/customers/{customerId}/service-subscriptions/{serviceType}"},method = RequestMethod.GET,produces="application/json")
+ public JSONObject getServiceTypeById(@PathVariable String customerId,@PathVariable String serviceType){
+ return customerService.getServiceTypeById(customerId,serviceType);
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/OrchestratorController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/OrchestratorController.java
new file mode 100644
index 00000000..46673ee6
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/OrchestratorController.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2019 Verizon. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.controller.lcm;
+
+import org.onap.usecaseui.server.service.lcm.OrchestratorService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIEsrNfvo;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Controller
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+public class OrchestratorController {
+
+ @Resource(name="OrchestratorService")
+ private OrchestratorService orchestratorService;
+
+ public void setOrchestratorService(OrchestratorService orchestratorService) {
+ this.orchestratorService = orchestratorService;
+ }
+
+ @ResponseBody
+ @RequestMapping(value = {"/uui-lcm/orchestrators"}, method = RequestMethod.GET , produces = "application/json")
+ public List<AAIEsrNfvo> getOrchestrators(){
+ return orchestratorService.listOrchestrator();
+ }
+
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java
index f9654d84..732291d0 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java
@@ -15,6 +15,7 @@
*/
package org.onap.usecaseui.server.controller.lcm;
+import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
@@ -22,7 +23,9 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.onap.usecaseui.server.bean.ServiceBean;
+import org.onap.usecaseui.server.bean.ServiceInstanceOperations;
import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo;
+import org.onap.usecaseui.server.constant.Constant;
import org.onap.usecaseui.server.service.lcm.PackageDistributionService;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
@@ -31,6 +34,7 @@ import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.Csar;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.DistributionResult;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.Job;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.JobStatus;
+import org.onap.usecaseui.server.util.DateUtils;
import org.onap.usecaseui.server.util.UuiCommonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -117,20 +121,20 @@ public class PackageDistributionController {
public JobStatus getNsLcmJobStatus(@PathVariable(value="jobId") String jobId, HttpServletRequest request){
String responseId = request.getParameter("responseId");
String serviceInstanceId = request.getParameter("serviceInstanceId");
- JobStatus jobStatus = packageDistributionService.getNsLcmJobStatus(jobId, responseId);
+ String operationType = request.getParameter("operationType");
+ JobStatus jobStatus = packageDistributionService.getNsLcmJobStatus(serviceInstanceId,jobId, responseId,operationType);
if(UuiCommonUtil.isNotNullOrEmpty(jobStatus)&&UuiCommonUtil.isNotNullOrEmpty(jobStatus.getResponseDescriptor())&&UuiCommonUtil.isNotNullOrEmpty(jobStatus.getResponseDescriptor().getProgress())){
String processNum = jobStatus.getResponseDescriptor().getProgress();
- String status="processing";
+ String operationResult = Constant.IN_PROGRESS_CODE;
if(Integer.parseInt(processNum)==100){
- status = "finished";
+ operationResult = Constant.SUCCESS_CODE;
}else if(Integer.parseInt(processNum)>100){
- status="error";
- }else{
- status="processing";
+ operationResult=Constant.FAIL_CODE;
}
- serviceLcmService.updateServiceInstanceStatusById(status,serviceInstanceId);
+ serviceLcmService.updateServiceInstanceOperation(serviceInstanceId,operationType,processNum,operationResult);
}
return jobStatus;
+
}
@ResponseBody
@@ -240,7 +244,7 @@ public class PackageDistributionController {
}
@RequestMapping(value = {"/uui-lcm/instantiateNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json")
- public String instantiateNetworkServiceInstance(HttpServletRequest request){
+ public String instantiateNetworkServiceInstance(HttpServletRequest request) throws ParseException{
String customerId = request.getParameter("customerId");
String serviceType = request.getParameter("serviceType");
String serviceDomain = request.getParameter("serviceDomain");
@@ -248,19 +252,37 @@ public class PackageDistributionController {
String object = packageDistributionService.instantiateNetworkServiceInstance(request,ns_instance_id);
JSONObject jobObject = JSONObject.parseObject(object);
String jobId = jobObject.getString("jobId");
- ServiceBean serviceBean = new ServiceBean(UuiCommonUtil.getUUID(),ns_instance_id,customerId,serviceType,serviceDomain,jobId,null,null);
+ ServiceBean serviceBean = new ServiceBean(UuiCommonUtil.getUUID(),ns_instance_id,customerId,serviceType,serviceDomain,null,null,null);
+ ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.CREATING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
+ serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
serviceLcmService.saveOrUpdateServiceBean(serviceBean);
return object;
}
@RequestMapping(value = {"/uui-lcm/terminateNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json")
- public String terminateNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id){
- return packageDistributionService.terminateNetworkServiceInstance(request,ns_instance_id);
+ public String terminateNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id) throws ParseException{
+ String result = packageDistributionService.terminateNetworkServiceInstance(request,ns_instance_id);
+ String jobId = "";
+ if(UuiCommonUtil.isNotNullOrEmpty(result)){
+ JSONObject jobIdObject = JSONObject.parseObject(result);
+ jobId = jobIdObject.getString("jobId");
+ }
+ ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.DELETING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
+ serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
+ return result;
}
@RequestMapping(value = {"/uui-lcm/healNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json")
- public String healNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id){
- return packageDistributionService.healNetworkServiceInstance(request,ns_instance_id);
+ public String healNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id) throws ParseException{
+ String result= packageDistributionService.healNetworkServiceInstance(request,ns_instance_id);
+ String jobId = "";
+ if(UuiCommonUtil.isNotNullOrEmpty(result)){
+ JSONObject jobIdObject = JSONObject.parseObject(result);
+ jobId = jobIdObject.getString("jobId");
+ }
+ ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.HEALING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
+ serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
+ return result;
}
@RequestMapping(value = {"/uui-lcm/scaleNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json")
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
index 79503873..7e6d94ae 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
@@ -102,6 +102,13 @@ public class ServiceInstanceController {
public String serviceNumByCustomer(HttpServletRequest request) throws JsonProcessingException{
return serviceInstanceService.serviceNumByCustomer();
}
+
+ @ResponseBody
+ @RequestMapping(value = {"/uui-lcm/serviceNumByServiceType/{customerId}"}, method = RequestMethod.GET , produces = "application/json")
+ public String serviceNumByServiceType(String customerId) throws JsonProcessingException{
+ return serviceInstanceService.serviceNumByServiceType(customerId);
+ }
+
@ResponseBody
@RequestMapping(value = {"/uui-lcm/getServiceInstanceById"}, method = RequestMethod.GET , produces = "application/json")
public String getServiceInstanceById(HttpServletRequest request){
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java
index 77c7ec55..6206ffbc 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java
@@ -16,11 +16,14 @@
package org.onap.usecaseui.server.controller.lcm;
import org.onap.usecaseui.server.bean.ServiceBean;
+import org.onap.usecaseui.server.bean.ServiceInstanceOperations;
+import org.onap.usecaseui.server.constant.Constant;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.SaveOrUpdateOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
+import org.onap.usecaseui.server.util.DateUtils;
import org.onap.usecaseui.server.util.UuiCommonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,6 +34,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
+import java.text.ParseException;
+
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -50,33 +55,50 @@ public class ServiceLcmController {
@ResponseBody
@RequestMapping(value = {"/uui-lcm/services"}, method = RequestMethod.POST , produces = "application/json")
- public ServiceOperation instantiateService(HttpServletRequest request){
+ public ServiceOperation instantiateService(HttpServletRequest request) throws ParseException{
String customerId = request.getParameter("customerId");
String serviceType = request.getParameter("serviceType");
String serviceDomain = request.getParameter("serviceDomain");
+ String uuid = request.getParameter("uuid");
+ String invariantUuuid = request.getParameter("invariantUuuid");
String parentServiceInstanceId = request.getParameter("parentServiceInstanceId");
- ServiceBean serviceBean = new ServiceBean(UuiCommonUtil.getUUID(),null,customerId,serviceType,serviceDomain,null,parentServiceInstanceId,null);
+ ServiceBean serviceBean = new ServiceBean(UuiCommonUtil.getUUID(),null,customerId,serviceType,serviceDomain,parentServiceInstanceId,uuid,invariantUuuid);
ServiceOperation serviceOperation = serviceLcmService.instantiateService(request);
- serviceBean.setServiceInstanceId(serviceOperation.getService().getServiceId());
- serviceBean.setOperationId(serviceOperation.getService().getOperationId());
+ String serviceId = serviceOperation.getService().getServiceId();
+ String operationId = serviceOperation.getService().getOperationId();
+ serviceBean.setServiceInstanceId(serviceId);
+ ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,operationId,Constant.CREATING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
serviceLcmService.saveOrUpdateServiceBean(serviceBean);
+ serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
return serviceOperation;
}
@ResponseBody
@RequestMapping(value = {"/uui-lcm/services/{serviceId}/operations/{operationId}"}, method = RequestMethod.GET , produces = "application/json")
- public OperationProgressInformation queryOperationProgress(@PathVariable(value="serviceId") String serviceId, @PathVariable(value="operationId") String operationId){
+ public OperationProgressInformation queryOperationProgress(HttpServletRequest request,@PathVariable(value="serviceId") String serviceId, @PathVariable(value="operationId") String operationId){
+ String operationType = request.getParameter("operationType");
+ String operationResult = Constant.IN_PROGRESS_CODE;
OperationProgressInformation operationProgressInformation =serviceLcmService.queryOperationProgress(serviceId, operationId);
- if(UuiCommonUtil.isNotNullOrEmpty(operationProgressInformation)&&UuiCommonUtil.isNotNullOrEmpty(operationProgressInformation.getOperationStatus())&&"CREATE".equals(operationProgressInformation.getOperationStatus().getOperation())){
- serviceLcmService.updateServiceInstanceStatusById(operationProgressInformation.getOperationStatus().getResult(), serviceId);
+ if(UuiCommonUtil.isNotNullOrEmpty(operationProgressInformation)&&UuiCommonUtil.isNotNullOrEmpty(operationProgressInformation.getOperationStatus())){
+ //serviceLcmService.updateServiceInstanceStatusById(operationProgressInformation.getOperationStatus().getResult(), serviceId);
+ int progress =operationProgressInformation.getOperationStatus().getProgress();
+ if(0<=progress&&progress<100){
+ operationResult=Constant.IN_PROGRESS_CODE;
+ }else if(progress==100){
+ operationResult=Constant.SUCCESS_CODE;
+ }
+ serviceLcmService.updateServiceInstanceOperation(serviceId,operationType,progress+"",operationResult);
}
return operationProgressInformation;
}
@ResponseBody
@RequestMapping(value = {"/uui-lcm/services/{serviceId}"}, method = RequestMethod.DELETE , produces = "application/json")
- public DeleteOperationRsp terminateService(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request){
- return serviceLcmService.terminateService(serviceId, request);
+ public DeleteOperationRsp terminateService(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request) throws ParseException{
+ DeleteOperationRsp deleteOperationRsp = serviceLcmService.terminateService(serviceId, request);
+ ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,deleteOperationRsp.getOperationId(),Constant.DELETING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
+ serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
+ return deleteOperationRsp;
}
/**
@@ -90,11 +112,15 @@ public class ServiceLcmController {
* @param serviceId
* @param request
* @return
+ * @throws ParseException
*/
@ResponseBody
@RequestMapping(value = {"/uui-lcm/services/scaleServices/{serviceId}"}, method = RequestMethod.POST , produces = "application/json")
- public SaveOrUpdateOperationRsp scaleServices(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request){
- return serviceLcmService.scaleService(serviceId, request);
+ public SaveOrUpdateOperationRsp scaleServices(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request) throws ParseException{
+ SaveOrUpdateOperationRsp saveOrUpdateOperationRsp =serviceLcmService.scaleService(serviceId, request);
+ ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,saveOrUpdateOperationRsp.getOperationId(),Constant.SCALING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
+ serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
+ return saveOrUpdateOperationRsp;
}
/**
@@ -108,10 +134,14 @@ public class ServiceLcmController {
* @param serviceId
* @param request
* @return
+ * @throws ParseException
*/
@ResponseBody
@RequestMapping(value = {"/uui-lcm/services/updateService/{serviceId}"}, method = RequestMethod.PUT , produces = "application/json")
- public SaveOrUpdateOperationRsp updateServices(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request){
- return serviceLcmService.updateService(serviceId, request);
+ public SaveOrUpdateOperationRsp updateServices(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request) throws ParseException{
+ SaveOrUpdateOperationRsp saveOrUpdateOperationRsp =serviceLcmService.scaleService(serviceId, request);
+ ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,saveOrUpdateOperationRsp.getOperationId(),"UPDATING","0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
+ serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
+ return saveOrUpdateOperationRsp;
}
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java b/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java
index 570a563f..363e8b31 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/AlarmsHeaderService.java
@@ -20,6 +20,7 @@ import java.sql.Timestamp;
import java.util.List;
import org.onap.usecaseui.server.bean.AlarmsHeader;
+import org.onap.usecaseui.server.bean.SortMaster;
import org.onap.usecaseui.server.util.Page;
public interface AlarmsHeaderService {
@@ -61,4 +62,6 @@ public interface AlarmsHeaderService {
* @return
*/
AlarmsHeader getAlarmsHeaderById(String id);
+
+ List<SortMaster> listSortMasters(String sortType);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
index 71a0faf7..0bcba4dd 100755
--- a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImpl.java
@@ -18,6 +18,8 @@ package org.onap.usecaseui.server.service.impl;
import java.sql.Timestamp;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import javax.transaction.Transactional;
@@ -27,6 +29,8 @@ import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.onap.usecaseui.server.bean.AlarmsHeader;
+import org.onap.usecaseui.server.bean.AlarmsInformation;
+import org.onap.usecaseui.server.bean.SortMaster;
import org.onap.usecaseui.server.service.AlarmsHeaderService;
import org.onap.usecaseui.server.util.Page;
import org.onap.usecaseui.server.util.UuiCommonUtil;
@@ -247,12 +251,26 @@ public class AlarmsHeaderServiceImpl implements AlarmsHeaderService {
Query q = session.createQuery(string);
q.setString("id",id);
AlarmsHeader alarmsHeader =(AlarmsHeader)q.uniqueResult();
- session.flush();
- return alarmsHeader;
+ return alarmsHeader;
}catch (Exception e){
logger.error("exception occurred while performing AlarmsHeaderServiceImpl getAlarmsHeaderDetail."+e.getMessage());
return null;
}
}
+
+ @Override
+ public List<SortMaster> listSortMasters(String sortType) {
+
+ try(Session session = getSession()){
+ StringBuffer hql =new StringBuffer("from SortMaster a where 1=1 and a.sortType=:sortType");
+ Query query = session.createQuery(hql.toString());
+ query.setString("sortType",sortType);
+ List<SortMaster> list= query.list();
+ return list;
+ } catch (Exception e) {
+ logger.error("exception occurred while performing AlarmsInformationServiceImpl listSortMasters. Details:" + e.getMessage());
+ return Collections.emptyList();
+ }
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
index b44a5c27..00c9a51c 100755
--- a/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/impl/AlarmsInformationServiceImpl.java
@@ -18,9 +18,7 @@ package org.onap.usecaseui.server.service.impl;
import java.util.ArrayList;
import java.util.List;
-
import javax.transaction.Transactional;
-
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
@@ -89,7 +87,7 @@ public class AlarmsInformationServiceImpl implements AlarmsInformationService {
public int getAllCount(AlarmsInformation alarmsInformation, int currentPage, int pageSize) {
try(Session session = getSession()){
- StringBuffer hql = new StringBuffer("select count(*) from AlarmsInformation a where 1=1");
+ StringBuilder hql = new StringBuilder("select count(*) from AlarmsInformation a where 1=1");
if (null == alarmsInformation) {
}else {
if(null!=alarmsInformation.getName()) {
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java
index 0bd3f323..2e906550 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/CustomerService.java
@@ -18,9 +18,27 @@ package org.onap.usecaseui.server.service.lcm;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscription;
+import com.alibaba.fastjson.JSONObject;
+
import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+
public interface CustomerService {
+
List<AAICustomer> listCustomer();
+
+ JSONObject createOrUpdateCustomer(HttpServletRequest request,String customerId);
+
+ JSONObject deleteCustomer(String customerId,String resourceVersion);
+
+ JSONObject getCustomerById(String customerId);
+
List<AAIServiceSubscription> listServiceSubscriptions(String customerId);
+
+ JSONObject createOrUpdateServiceType(HttpServletRequest request,String serviceType);
+
+ JSONObject deleteServiceType(String customerId,String serviceType,String resourceVersion);
+
+ JSONObject getServiceTypeById(String customerId,String serviceType);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/OrchestratorService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/OrchestratorService.java
new file mode 100644
index 00000000..b953eea4
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/OrchestratorService.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (C) 2019 Verizon. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm;
+
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIEsrNfvo;
+
+import java.util.List;
+
+public interface OrchestratorService {
+ List<AAIEsrNfvo> listOrchestrator();
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java
index 2c89dadd..a4497f16 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java
@@ -42,7 +42,7 @@ public interface PackageDistributionService {
JobStatus getJobStatus(String jobId, String responseId);
- JobStatus getNsLcmJobStatus(String jobId, String responseId);
+ JobStatus getNsLcmJobStatus(String serviceInstanceId,String jobId, String responseId,String operationType);
DistributionResult deleteNsPackage(String csarId);
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java
index 28bd9e06..7f5f430e 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceInstanceService.java
@@ -26,4 +26,6 @@ public interface ServiceInstanceService {
String getRelationShipData(String customerId, String serviceType,String serviceId );
String serviceNumByCustomer() throws JsonProcessingException;
+
+ String serviceNumByServiceType(String customerId) throws JsonProcessingException;
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java
index e9557cee..e4a0b014 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java
@@ -16,6 +16,7 @@
package org.onap.usecaseui.server.service.lcm;
import org.onap.usecaseui.server.bean.ServiceBean;
+import org.onap.usecaseui.server.bean.ServiceInstanceOperations;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.SaveOrUpdateOperationRsp;
@@ -44,4 +45,10 @@ public interface ServiceLcmService {
ServiceBean getServiceBeanByServiceInStanceId(String serviceInstanceId);
List<String> getServiceInstanceIdByParentId(String serviceInstanceId);
+
+ void saveOrUpdateServiceInstanceOperation(ServiceInstanceOperations serviceOperation);
+
+ void updateServiceInstanceOperation(String serviceInstanceId,String operationType,String progress,String operationResult);
+
+ ServiceInstanceOperations getServiceInstanceOperationById(String serviceId);
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
index e11e8bde..58ce2cb5 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java
@@ -16,7 +16,11 @@
package org.onap.usecaseui.server.service.lcm.domain.aai;
import org.onap.usecaseui.server.bean.sotn.PinterfaceRsp;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomerRsp;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIOrchestratorRsp;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscription;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAISingleOrchestratorRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCControllerRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstanceRsp;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceSubscriptionRsp;
@@ -42,9 +46,54 @@ public interface AAIService {
"Accept: application/json"
})
// @GET("/api/aai-business/v11/customers")
- @GET("/api/aai-business/v11/customers")
+ @GET("/api/aai-business/v13/customers")
Call<AAICustomerRsp> listCustomer();
-
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: Basic QUFJOkFBSQ==",
+ "Accept: application/json"
+ })
+ @GET("/api/aai-externalSystem/v16/esr-nfvo-list")
+ Call<AAIOrchestratorRsp> listOrchestrator();
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: Basic QUFJOkFBSQ==",
+ "Accept: application/json"
+ })
+ @GET("/api/aai-externalSystem/v16/esr-nfvo-list/esr-nfvo/{nfvo-id}?depth=all")
+ Call<AAISingleOrchestratorRsp> getOrchestrator(@Path("nfvo-id") String nfvoId);
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: Basic QUFJOkFBSQ==",
+ "Accept: application/json"
+ })
+ @PUT("/api/aai-business/v13/customers/customer/{global-customer-id}")
+ Call<ResponseBody> createOrUpdateCustomer(@Path("global-customer-id") String customerId,@Body RequestBody body);
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: Basic QUFJOkFBSQ==",
+ "Accept: application/json"
+ })
+ @DELETE("/api/aai-business/v13//customers/customer/{global-customer-id}")
+ Call<ResponseBody> deleteCustomer(@Path("global-customer-id") String customerId,@Query("resource-version") String resourceVersion);
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: Basic QUFJOkFBSQ==",
+ "Accept: application/json"
+ })
+ @GET("/api/aai-business/v13//customers/customer/{global-customer-id}")
+ Call<AAICustomer> getCustomerById(@Path("global-customer-id") String customerId);
+
@Headers({
"X-TransactionId: 7777",
"X-FromAppId: uui",
@@ -74,7 +123,37 @@ public interface AAIService {
// @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
@GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
Call<ServiceSubscriptionRsp> listServiceSubscriptions(@Path("global-customer-id") String customerId);
-
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: Basic QUFJOkFBSQ==",
+ "Accept: application/json"
+ })
+ //@GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
+ @PUT("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}")
+ Call<ResponseBody> createOrUpdateServiceType(@Path("global-customer-id") String customerId,@Path("service-type") String serviceType);
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: Basic QUFJOkFBSQ==",
+ "Accept: application/json"
+ })
+ //@GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
+ @PUT("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}")
+ Call<ResponseBody> deleteServiceType(@Path("global-customer-id") String customerId,@Path("service-type") String serviceType,@Query("resource-version") String resourceVersion);
+
+ @Headers({
+ "X-TransactionId: 7777",
+ "X-FromAppId: uui",
+ "Authorization: Basic QUFJOkFBSQ==",
+ "Accept: application/json"
+ })
+ //@GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions")
+ @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}")
+ Call<AAIServiceSubscription> getServiceTypeById(@Path("global-customer-id") String customerId,@Path("service-type") String serviceType);
+
@Headers({
"X-TransactionId: 7777",
"X-FromAppId: uui",
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIEsrNfvo.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIEsrNfvo.java
new file mode 100644
index 00000000..55ce3767
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIEsrNfvo.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (C) 2019 Verizon. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.aai.bean;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class AAIEsrNfvo {
+
+ private String nfvoId;
+
+ private String apiRoot;
+
+ private String resourceVersion;
+
+ private String name;
+
+ @JsonCreator
+ public AAIEsrNfvo(
+ @JsonProperty("nfvo-id") String nfvoId,
+ @JsonProperty("api-root") String apiRoot,
+ @JsonProperty("resource-version") String resourceVersion,
+ @JsonProperty("name") String name) {
+ this.nfvoId = nfvoId;
+ this.apiRoot = apiRoot;
+ this.resourceVersion = resourceVersion;
+ this.name = name;
+ }
+
+ @JsonProperty("nfvo-id")
+ public String getNfvoId() {
+ return nfvoId;
+ }
+
+ @JsonProperty("api-root")
+ public String getApiRoot() {
+ return apiRoot;
+ }
+
+ @JsonProperty("resource-version")
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIOrchestratorRsp.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIOrchestratorRsp.java
new file mode 100644
index 00000000..0181f8f0
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIOrchestratorRsp.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2019 Verizon. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.domain.aai.bean;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class AAIOrchestratorRsp {
+
+ @JsonProperty("esr-nfvo")
+ private List<AAIEsrNfvo> esrNfvo;
+
+ public List<AAIEsrNfvo> getEsrNfvo() {
+ return esrNfvo;
+ }
+
+ public void setEsrNfvo(@JsonProperty("esr-nfvo") List<AAIEsrNfvo> esrNfvo) {
+ this.esrNfvo = esrNfvo;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIServiceSubscription.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIServiceSubscription.java
index 2218cff3..8944816f 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIServiceSubscription.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIServiceSubscription.java
@@ -23,14 +23,22 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class AAIServiceSubscription {
private String serviceType;
+
+ private String resourceVersion;
@JsonCreator
- public AAIServiceSubscription(@JsonProperty("service-type") String serviceType) {
+ public AAIServiceSubscription(@JsonProperty("service-type") String serviceType,@JsonProperty("resource-version") String resourceVersion) {
this.serviceType = serviceType;
+ this.resourceVersion = resourceVersion;
}
@JsonProperty("service-type")
public String getServiceType() {
return serviceType;
}
+
+ @JsonProperty("resource-version")
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAISingleOrchestratorRsp.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAISingleOrchestratorRsp.java
new file mode 100644
index 00000000..a5dba407
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAISingleOrchestratorRsp.java
@@ -0,0 +1,67 @@
+/**
+ * Copyright (C) 2019 Verizon. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.usecaseui.server.service.lcm.domain.aai.bean;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+
+public class AAISingleOrchestratorRsp {
+
+ @JsonProperty("nfvo-id")
+ private String nfvoId;
+
+ @JsonProperty("resource-version")
+ private String resourceVersion;
+
+ @JsonProperty("api-root")
+ private String apiRoot;
+
+ @JsonProperty("esr-system-info-list")
+ private EsrSystemInfoList esrSystemInfoList;
+
+ public String getNfvoId() {
+ return nfvoId;
+ }
+
+ public void setNfvoId(String nfvoId) {
+ this.nfvoId = nfvoId;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public EsrSystemInfoList getEsrSystemInfoList() {
+ return esrSystemInfoList;
+ }
+
+ public void setEsrSystemInfo(EsrSystemInfoList esrSystemInfoList) {
+ this.esrSystemInfoList = esrSystemInfoList;
+ }
+
+ public String getApiRoot() {
+ return apiRoot;
+ }
+
+ public void setApiRoot(String apiRoot) {
+ this.apiRoot = apiRoot;
+ }
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/EsrSystemInfo.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/EsrSystemInfo.java
new file mode 100644
index 00000000..4ba05cf9
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/EsrSystemInfo.java
@@ -0,0 +1,123 @@
+/**
+ * Copyright (C) 2019 Verizon. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.usecaseui.server.service.lcm.domain.aai.bean;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.immutables.value.internal.$processor$.meta.$JacksonMirrors;
+
+public class EsrSystemInfo {
+
+ @JsonProperty("esr-system-info-id")
+ private String esrSystemInfoId;
+
+ @JsonProperty("system-name")
+ private String systemName;
+
+ @JsonProperty("vendor")
+ private String vendor;
+
+ @JsonProperty("version")
+ private String version;
+
+ @JsonProperty("service-url")
+ private String serviceUrl;
+
+ @JsonProperty("user-name")
+ private String userName;
+
+ @JsonProperty("password")
+ private String password;
+
+ @JsonProperty("system-type")
+ private String systemType;
+
+ @JsonProperty("resource-version")
+ private String resourceVersion;
+
+ public String getEsrSystemInfoId() {
+ return esrSystemInfoId;
+ }
+
+ public void setEsrSystemInfoId(String esrSystemInfoId) {
+ this.esrSystemInfoId = esrSystemInfoId;
+ }
+
+ public String getSystemName() {
+ return systemName;
+ }
+
+ public void setSystemName(String systemName) {
+ this.systemName = systemName;
+ }
+
+ public String getVendor() {
+ return vendor;
+ }
+
+ public void setVendor(String vendor) {
+ this.vendor = vendor;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getServiceUrl() {
+ return serviceUrl;
+ }
+
+ public void setServiceUrl(String serviceUrl) {
+ this.serviceUrl = serviceUrl;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getSystemType() {
+ return systemType;
+ }
+
+ public void setSystemType(String systemType) {
+ this.systemType = systemType;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/EsrSystemInfoList.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/EsrSystemInfoList.java
new file mode 100644
index 00000000..51ae5804
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/EsrSystemInfoList.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright (C) 2019 Verizon. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.usecaseui.server.service.lcm.domain.aai.bean;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class EsrSystemInfoList {
+
+ public List<EsrSystemInfo> getEsrSystemInfo() {
+ return esrSystemInfo;
+ }
+
+ public void setEsrSystemInfo(List<EsrSystemInfo> esrSystemInfo) {
+ this.esrSystemInfo = esrSystemInfo;
+ }
+
+ @JsonProperty("esr-system-info")
+ private List<EsrSystemInfo> esrSystemInfo;
+
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java
index 972dbedc..d75d101a 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java
@@ -27,12 +27,21 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson.JSONObject;
+
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
import retrofit2.Response;
+import static org.onap.usecaseui.server.util.RestfulServices.extractBody;
+
import java.io.IOException;
import java.util.Collections;
import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+
@Service("CustomerService")
@org.springframework.context.annotation.Configuration
@EnableAspectJAutoProxy
@@ -65,11 +74,76 @@ public class DefaultCustomerService implements CustomerService {
throw new AAIException("AAI is not available.", e);
}
}
-
+
+ @Override
+ public JSONObject createOrUpdateCustomer(HttpServletRequest request,String customerId){
+ JSONObject result = new JSONObject();
+ try {
+ logger.info("aai createOrUpdateCustomer is starting!");
+ RequestBody requestBody = extractBody(request);
+ Response<ResponseBody> response = this.aaiService.createOrUpdateCustomer(customerId,requestBody).execute();
+ logger.info("aai createOrUpdateCustomer is finished!");
+ if(response.isSuccessful()){
+ result.put("status", "SUCCESS");
+ }else{
+ result.put("status", "FAILED");
+ result.put("errorMessage",String.format("Can not get createOrUpdateCustomer[code=%s, message=%s]", response.code(), response.message()));
+ }
+ } catch (IOException e) {
+ result.put("status", "FAILED");
+ result.put("errorMessage","createOrUpdateCustomer occur exception:"+e.getMessage());
+ }
+ return result;
+ }
+
+ @Override
+ public JSONObject getCustomerById(String customerId){
+ JSONObject result = new JSONObject();
+ try {
+ logger.info("aai getCustomerById is starting!");
+ Response<AAICustomer> response = this.aaiService.getCustomerById(customerId).execute();
+ logger.info("aai getCustomerById is finished!");
+ if(response.isSuccessful()){
+ result.put("status", "SUCCESS");
+ result.put("result",response.body());
+ }else{
+ result.put("status", "FAILED");
+ result.put("errorMessage",String.format("Can not get getCustomerById[code=%s, message=%s]", response.code(), response.message()));
+ }
+ } catch (IOException e) {
+ result.put("status", "FAILED");
+ result.put("errorMessage","getCustomerById occur exception:"+e.getMessage());
+ }
+ return result;
+ }
+
@Override
- public List<AAIServiceSubscription> listServiceSubscriptions(String customerId) {
+ public JSONObject deleteCustomer(String customerId,String resourceVersion){
+ JSONObject result = new JSONObject();
+ try {
+ logger.info("aai deleteCustomer is starting!");
+ Response<ResponseBody> response = this.aaiService.deleteCustomer(customerId,resourceVersion).execute();
+ logger.info("aai deleteCustomer is finished!");
+ if(response.isSuccessful()){
+ result.put("status", "SUCCESS");
+ }else{
+ result.put("status", "FAILED");
+ result.put("errorMessage",String.format("Can not get deleteCustomer[code=%s, message=%s]", response.code(), response.message()));
+ }
+ } catch (IOException e) {
+ result.put("status", "FAILED");
+ if(e.getMessage().contains("204")){
+ result.put("status", "SUCCESS");
+ }
+ result.put("errorMessage","deleteCustomer occur exception:"+e.getMessage());
+ }
+ return result;
+ }
+
+ @Override
+ public List<AAIServiceSubscription> listServiceSubscriptions(String serviceType) {
try {
- Response<ServiceSubscriptionRsp> response = this.aaiService.listServiceSubscriptions(customerId).execute();
+ Response<ServiceSubscriptionRsp> response = this.aaiService.listServiceSubscriptions(serviceType).execute();
if (response.isSuccessful()) {
return response.body().getServiceSubscriptions();
} else {
@@ -81,4 +155,69 @@ public class DefaultCustomerService implements CustomerService {
throw new AAIException("AAI is not available.", e);
}
}
+
+ @Override
+ public JSONObject createOrUpdateServiceType(HttpServletRequest request,String serviceType){
+ JSONObject result = new JSONObject();
+ try {
+ logger.info("aai createOrUpdateServiceType is starting!");
+ RequestBody requestBody = extractBody(request);
+ Response<ResponseBody> response = this.aaiService.createOrUpdateCustomer(serviceType,requestBody).execute();
+ logger.info("aai createOrUpdateServiceType is finished!");
+ if(response.isSuccessful()){
+ result.put("status", "SUCCESS");
+ }else{
+ result.put("status", "FAILED");
+ result.put("errorMessage",String.format("Can not get createOrUpdateServiceType[code=%s, message=%s]", response.code(), response.message()));
+ }
+ } catch (IOException e) {
+ result.put("status", "FAILED");
+ result.put("errorMessage","createOrUpdateServiceType occur exception:"+e.getMessage());
+ }
+ return result;
+ }
+
+ @Override
+ public JSONObject deleteServiceType(String customerId,String serviceType,String resourceVersion){
+ JSONObject result = new JSONObject();
+ try {
+ logger.info("aai deleteServiceType is starting!");
+ Response<ResponseBody> response = this.aaiService.deleteServiceType(customerId,serviceType,resourceVersion).execute();
+ logger.info("aai deleteServiceType is finished!");
+ if(response.isSuccessful()){
+ result.put("status", "SUCCESS");
+ }else{
+ result.put("status", "FAILED");
+ result.put("errorMessage",String.format("Can not get deleteServiceType[code=%s, message=%s]", response.code(), response.message()));
+ }
+ } catch (IOException e) {
+ result.put("status", "FAILED");
+ if(e.getMessage().contains("204")){
+ result.put("status", "SUCCESS");
+ }
+ result.put("errorMessage","deleteServiceType occur exception:"+e.getMessage());
+ }
+ return result;
+ }
+
+ @Override
+ public JSONObject getServiceTypeById(String customerId,String serviceType){
+ JSONObject result = new JSONObject();
+ try {
+ logger.info("aai getServiceTypeById is starting!");
+ Response<AAIServiceSubscription> response = this.aaiService.getServiceTypeById(customerId,serviceType).execute();
+ logger.info("aai getServiceTypeById is finished!");
+ if(response.isSuccessful()){
+ result.put("status", "SUCCESS");
+ result.put("result",response.body());
+ }else{
+ result.put("status", "FAILED");
+ result.put("errorMessage",String.format("Can not get getServiceTypeById[code=%s, message=%s]", response.code(), response.message()));
+ }
+ } catch (IOException e) {
+ result.put("status", "FAILED");
+ result.put("errorMessage","getServiceTypeById occur exception:"+e.getMessage());
+ }
+ return result;
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultOrchestratorService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultOrchestratorService.java
new file mode 100644
index 00000000..32a7c32b
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultOrchestratorService.java
@@ -0,0 +1,78 @@
+/**
+ * Copyright (C) 2019 Verizon. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.service.lcm.impl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.onap.usecaseui.server.service.lcm.OrchestratorService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
+import org.onap.usecaseui.server.service.lcm.domain.aai.bean.*;
+import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException;
+import org.onap.usecaseui.server.util.RestfulServices;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.stereotype.Service;
+
+import retrofit2.Response;
+
+@Service("OrchestratorService")
+@org.springframework.context.annotation.Configuration
+@EnableAspectJAutoProxy
+public class DefaultOrchestratorService implements OrchestratorService {
+
+ private static final Logger logger = LoggerFactory.getLogger(DefaultOrchestratorService.class);
+
+ private AAIService aaiService;
+
+ public DefaultOrchestratorService() {
+ this(RestfulServices.create(AAIService.class));
+ }
+
+ public DefaultOrchestratorService(AAIService aaiService) {
+ this.aaiService = aaiService;
+ }
+
+ @Override
+ public List<AAIEsrNfvo> listOrchestrator() {
+ try {
+ Response<AAIOrchestratorRsp> response = this.aaiService.listOrchestrator().execute();
+ if (response.isSuccessful()) {
+ List<AAIEsrNfvo> nfvoList = response.body().getEsrNfvo();
+ for(AAIEsrNfvo nfvo: nfvoList){
+ String nfvoId = nfvo.getNfvoId();
+ Response<AAISingleOrchestratorRsp> response_orch =
+ this.aaiService.getOrchestrator(nfvoId).execute();
+ EsrSystemInfoList esrSystemInfoList = response_orch.body().getEsrSystemInfoList();
+ List<EsrSystemInfo> esrSystemInfo = esrSystemInfoList.getEsrSystemInfo();
+ nfvo.setName(esrSystemInfo.get(0).getSystemName());
+
+ }
+ return nfvoList;
+ } else {
+ logger.info(String.format("Can not get orchestrators[code=%s, message=%s]", response.code(), response.message()));
+ return Collections.emptyList();
+ }
+ } catch (IOException e) {
+ logger.error("list orchestrators occur exception");
+ throw new AAIException("AAI is not available.", e);
+ }
+ }
+
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java
index 14ca9ed6..b5350d29 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java
@@ -168,19 +168,17 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
}
@Override
- public JobStatus getNsLcmJobStatus(String jobId, String responseId) {
- try {
- Response<JobStatus> response = vfcService.getNsLcmJobStatus(jobId, responseId).execute();
- if (response.isSuccessful()) {
- return response.body();
- } else {
- logger.info(String.format("Can not get Job status[code=%s, message=%s]", response.code(), response.message()));
- throw new VfcException("VFC service getNsLcmJobStatus is not available!");
- }
- } catch (IOException e) {
- throw new VfcException("VFC service getNsLcmJobStatus is not available!", e);
+ public JobStatus getNsLcmJobStatus(String serviceInstanceId,String jobId, String responseId,String operationType) { try {
+ Response<JobStatus> response = vfcService.getNsLcmJobStatus(jobId, responseId).execute();
+ if (response.isSuccessful()) {
+ return response.body();
+ } else {
+ logger.info(String.format("Can not get Job status[code=%s, message=%s]", response.code(), response.message()));
+ throw new VfcException("VFC service getNsLcmJobStatus is not available!");
}
- }
+ } catch (IOException e) {
+ throw new VfcException("VFC service getNsLcmJobStatus is not available!", e);
+ }}
@Override
public DistributionResult deleteNsPackage(String csarId) {
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
index 04561302..92b2755e 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
@@ -25,6 +25,7 @@ import java.util.Map;
import javax.annotation.Resource;
import org.onap.usecaseui.server.bean.ServiceBean;
+import org.onap.usecaseui.server.bean.ServiceInstanceOperations;
import org.onap.usecaseui.server.service.lcm.CustomerService;
import org.onap.usecaseui.server.service.lcm.ServiceInstanceService;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
@@ -109,13 +110,15 @@ public class DefaultServiceInstanceService implements ServiceInstanceService {
JSONObject object = JSON.parseObject(serviceInstance+"");
String serviceInstanceId=object.get("service-instance-id").toString();
ServiceBean serviceBean = serviceLcmService.getServiceBeanByServiceInStanceId(serviceInstanceId);
+ ServiceInstanceOperations serviceInstanceOperations = serviceLcmService.getServiceInstanceOperationById(serviceInstanceId);
if(!UuiCommonUtil.isNotNullOrEmpty(serviceBean)){
continue;
}
String serviceDomain = serviceBean.getServiceDomain();
object.put("serviceDomain",serviceDomain);
- object.put("serviceStatus",serviceBean.getStatus());
- object.put("operationId",serviceBean.getOperationId());
+ object.put("operationResult",serviceInstanceOperations.getOperationResult());
+ object.put("operationId",serviceInstanceOperations.getOperationId());
+ object.put("operationType",serviceInstanceOperations.getOperationType());
if("SOTN".equals(serviceDomain)||"CCVPN".equals(serviceDomain)||"E2E Service".equals(serviceDomain)||"Network Service".equals(serviceDomain)){
List<String> parentIds = serviceLcmService.getServiceInstanceIdByParentId(serviceInstanceId);
List<String> parentServiceInstances = new ArrayList<>();
@@ -177,4 +180,26 @@ public class DefaultServiceInstanceService implements ServiceInstanceService {
result.put("customerServiceList", list);
return omAlarm.writeValueAsString(result);
}
+
+ @Override
+ public String serviceNumByServiceType(String customerId) throws JsonProcessingException{
+
+ List<AAIServiceSubscription> serviceTypes = customerService.listServiceSubscriptions(customerId);
+
+ List<Map<String,Object>> list = new ArrayList<>();
+
+ ObjectMapper omAlarm = new ObjectMapper();
+
+ for (AAIServiceSubscription aaiServiceSubscription : serviceTypes) {
+
+ Map<String,Object> serviceTypeMap = new HashMap<String,Object>();
+
+ List<String> serviceInstances =this.listServiceInstances(customerId, aaiServiceSubscription.getServiceType());
+
+ serviceTypeMap.put(aaiServiceSubscription.getServiceType(),serviceInstances.size());
+
+ list.add(serviceTypeMap);
+ }
+ return omAlarm.writeValueAsString(list);
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java
index f8243e5d..a66ea9f0 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java
@@ -28,8 +28,8 @@ import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
-import org.onap.usecaseui.server.bean.AlarmsHeader;
import org.onap.usecaseui.server.bean.ServiceBean;
+import org.onap.usecaseui.server.bean.ServiceInstanceOperations;
import org.onap.usecaseui.server.service.lcm.ServiceLcmService;
import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
@@ -37,19 +37,16 @@ import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInf
import org.onap.usecaseui.server.service.lcm.domain.so.bean.SaveOrUpdateOperationRsp;
import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException;
-import org.onap.usecaseui.server.util.UuiCommonUtil;
+import org.onap.usecaseui.server.util.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Service;
import okhttp3.RequestBody;
import retrofit2.Response;
@Service("ServiceLcmService")
-@org.springframework.context.annotation.Configuration
-@EnableAspectJAutoProxy
public class DefaultServiceLcmService implements ServiceLcmService {
private static final Logger logger = LoggerFactory.getLogger(DefaultServiceLcmService.class);
@@ -186,7 +183,7 @@ public class DefaultServiceLcmService implements ServiceLcmService {
session.flush();
}catch (Exception e){
- logger.error("exception occurred while performing DefaultServiceLcmService updateServiceInstanceStatusByIdDetail."+e.getMessage());
+ logger.error("exception occurred while performing DefaultServiceLcmService updateServiceInstanceStatusById.Detail."+e.getMessage());
}
}
@@ -204,7 +201,7 @@ public class DefaultServiceLcmService implements ServiceLcmService {
serviceBean = list.get(0);
}
}catch (Exception e){
- logger.error("exception occurred while performing DefaultServiceLcmService updateServiceInstanceStatusByIdDetail."+e.getMessage());
+ logger.error("exception occurred while performing DefaultServiceLcmService getServiceBeanByServiceInStanceId.Detail."+e.getMessage());
serviceBean = new ServiceBean();;
}
return serviceBean;
@@ -228,4 +225,62 @@ public class DefaultServiceLcmService implements ServiceLcmService {
return list;
}
+
+ @Override
+ public void saveOrUpdateServiceInstanceOperation(ServiceInstanceOperations serviceOperation) {
+ try(Session session = getSession()){
+ if (null == serviceOperation) {
+ logger.error("DefaultServiceLcmService saveOrUpdateServiceBean serviceOperation is null!");
+ }
+ session.saveOrUpdate(serviceOperation);
+ session.flush();
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("exception occurred while performing DefaultServiceLcmService saveOrUpdateServiceInstanceOperation. Details:" + e.getMessage());
+ }
+ }
+
+ @Override
+ public void updateServiceInstanceOperation(String serviceInstanceId, String operationType, String progress,
+ String operationResult) {
+ List<ServiceInstanceOperations> list = new ArrayList<>();
+ try(Session session = getSession()) {
+ String hql="select a.* from service_instance_operations a where service_instance_id =:serviceId and operation_type =:operationType and start_time = (select max(start_time) from service_instance_operations where service_instance_id=:serviceInstanceId )";
+ Query q = session.createSQLQuery(hql).addEntity(ServiceInstanceOperations.class);
+ q.setString("serviceId",serviceInstanceId);
+ q.setString("serviceInstanceId",serviceInstanceId);
+ q.setString("operationType",operationType);
+ list = q.list();
+ ServiceInstanceOperations serviceOperation =list.get(0);
+ serviceOperation.setOperationResult(operationResult);
+ serviceOperation.setOperationProgress(progress);
+ if("100".equals(progress)){
+ serviceOperation.setEndTime(DateUtils.dateToString(DateUtils.now()));
+ }
+ session.saveOrUpdate(serviceOperation);
+ session.flush();
+
+ }catch (Exception e){
+ logger.error("exception occurred while performing DefaultServiceLcmService updateServiceInstanceOperation.Detail."+e.getMessage());
+ }
+ }
+
+ @Override
+ public ServiceInstanceOperations getServiceInstanceOperationById(String serviceId) {
+ ServiceInstanceOperations serviceOperation = null;
+ List<ServiceInstanceOperations> list = new ArrayList<>();
+ try(Session session = getSession()) {
+ String hql="select a.* from service_instance_operations a where service_instance_id =:serviceId and start_time = (select max(start_time) from service_instance_operations where service_instance_id=:serviceInstanceId)";
+ Query q = session.createSQLQuery(hql).addEntity(ServiceInstanceOperations.class);
+ q.setString("serviceId",serviceId);
+ q.setString("serviceInstanceId",serviceId);
+ list = q.list();
+ serviceOperation =list.get(0);
+ session.flush();
+
+ }catch (Exception e){
+ logger.error("exception occurred while performing DefaultServiceLcmService getServiceInstanceOperationById."+e.getMessage());
+ }
+ return serviceOperation;
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/DateProcessDataObject.java b/server/src/main/java/org/onap/usecaseui/server/util/DateProcessDataObject.java
new file mode 100644
index 00000000..9ee0024b
--- /dev/null
+++ b/server/src/main/java/org/onap/usecaseui/server/util/DateProcessDataObject.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Samsung Electronics Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.usecaseui.server.util;
+
+public class DateProcessDataObject {
+ private String sourceName;
+ private long startTimeL;
+ private long endTimeL;
+ private long timeIteraPlusVal;
+ private long keyVal;
+ private long keyValIteraVal;
+ private String format;
+ private String level;
+
+
+ public String getSourceName() {
+ return sourceName;
+ }
+
+ public DateProcessDataObject setSourceName(String sourceName) {
+ this.sourceName = sourceName;
+ return this;
+ }
+
+ public long getStartTimeL() {
+ return startTimeL;
+ }
+
+ public DateProcessDataObject setStartTimeL(long startTimeL) {
+ this.startTimeL = startTimeL;
+ return this;
+ }
+
+ public long getEndTimeL() {
+ return endTimeL;
+ }
+
+ public DateProcessDataObject setEndTimeL(long endTimeL) {
+ this.endTimeL = endTimeL;
+ return this;
+ }
+
+ public long getTimeIteraPlusVal() {
+ return timeIteraPlusVal;
+ }
+
+ public DateProcessDataObject setTimeIteraPlusVal(long timeIteraPlusVal) {
+ this.timeIteraPlusVal = timeIteraPlusVal;
+ return this;
+ }
+
+ public long getKeyVal() {
+ return keyVal;
+ }
+
+ public DateProcessDataObject setKeyVal(long keyVal) {
+ this.keyVal = keyVal;
+ return this;
+ }
+
+ public long getKeyValIteraVal() {
+ return keyValIteraVal;
+ }
+
+ public DateProcessDataObject setKeyValIteraVal(long keyValIteraVal) {
+ this.keyValIteraVal = keyValIteraVal;
+ return this;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public DateProcessDataObject setFormat(String format) {
+ this.format = format;
+ return this;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public DateProcessDataObject setLevel(String level) {
+ this.level = level;
+ return this;
+ }
+
+
+}
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java
index 15ec0fe4..1d51e2e8 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java
@@ -31,10 +31,7 @@ import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.client.ClientConfig;
-import org.onap.usecaseui.server.bean.AlarmsHeader;
-import org.onap.usecaseui.server.bean.AlarmsInformation;
-import org.onap.usecaseui.server.bean.PerformanceHeader;
-import org.onap.usecaseui.server.bean.PerformanceInformation;
+import org.onap.usecaseui.server.bean.*;
import org.onap.usecaseui.server.constant.Constant;
import org.onap.usecaseui.server.service.AlarmsHeaderService;
import org.onap.usecaseui.server.service.AlarmsInformationService;
@@ -72,7 +69,7 @@ public class DmaapSubscriber implements Runnable {
@Resource(name = "PerformanceInformationService")
private PerformanceInformationService performanceInformationService;
- public void subscribe(String topic) {
+ public void subscribe(String topic) {
try {
List<String> respList = getDMaaPData(topic);
if (!UuiCommonUtil.isNotNullOrEmpty(respList)) {
@@ -82,7 +79,8 @@ public class DmaapSubscriber implements Runnable {
objMapper.setDateFormat(new SimpleDateFormat(Constant.DATE_FORMAT));
respList.forEach(rl -> {
try {
- Map<String, Object> eventMaps = (Map<String, Object>) objMapper.readValue(rl, Map.class).get("event");
+ Map<String, Object> eventMaps =
+ (Map<String, Object>) objMapper.readValue(rl, Map.class).get("event");
if (eventMaps.containsKey("measurementsForVfScalingFields")) {
performanceProcess(eventMaps);
} else if (eventMaps.containsKey("faultFields")) {
@@ -90,15 +88,17 @@ public class DmaapSubscriber implements Runnable {
}
} catch (IOException e) {
e.printStackTrace();
- logger.error("exception occurred while performing DmaapSubcriber performanceProcess or alarmProcess. Details:"+ e.getMessage());
- logger.error("exception from content:"+rl);
- logger.error("response content is :"+respList);
+ logger.error(
+ "exception occurred while performing DmaapSubcriber performanceProcess or alarmProcess. Details:{}",
+ e.getMessage());
+ logger.error("exception from content:{}", rl);
+ logger.error("response content is :{}", respList);
}
});
} catch (Exception e) {
e.printStackTrace();
- logger.error("getDMaaP Information failed :" + e.getMessage());
+ logger.error("getDMaaP Information failed :{}", e.getMessage());
}
}
@@ -115,14 +115,13 @@ public class DmaapSubscriber implements Runnable {
try {
p.load(inputStream);
this.url = p.getProperty("dmaap.url") + System.getenv("MR_ADDR");
- //this.url = p.getProperty("dmaap.url");
this.alarmTopic = p.getProperty("dmaap.alarmTopic");
this.performanceTopic = p.getProperty("dmaap.performanceTopic");
this.consumerGroup = p.getProperty("dmaap.consumerGroup");
this.consumer = p.getProperty("dmaap.consumer");
this.timeout = Integer.parseInt(p.getProperty("dmaap.timeout"));
} catch (IOException e1) {
- logger.error("get configuration file arise error :" + e1.getMessage());
+ logger.error("get configuration file arise error :{}",e1.getMessage());
}
}
@@ -134,7 +133,7 @@ public class DmaapSubscriber implements Runnable {
subscribe(performanceTopic);
*/}
} catch (Exception e) {
- logger.error("subscribe raise error :" + e.getCause());
+ logger.error("subscribe raise error :{}",e.getCause());
}
}
@@ -198,11 +197,14 @@ public class DmaapSubscriber implements Runnable {
try {
List<Map<String, Object>> m = (List<Map<String, Object>>) v3;
m.forEach(i -> {
- alarm_informations.add(new AlarmsInformation(i.get("name").toString(), i.get("value").toString(), alarm_header.getSourceId(),alarm_header.getStartEpochMicrosec(),alarm_header.getLastEpochMicroSec(),alarm_header.getId()));
+ alarm_informations
+ .add(new AlarmsInformation(i.get("name").toString(), i.get("value").toString(),
+ alarm_header.getSourceId(), alarm_header.getStartEpochMicrosec(),
+ alarm_header.getLastEpochMicroSec(), alarm_header.getId()));
});
} catch (Exception e) {
e.printStackTrace();
- logger.error("convert alarmAdditionalInformation error:" + e.getMessage());
+ logger.error("convert alarmAdditionalInformation error:{}",e.getMessage());
}
}
});
@@ -212,16 +214,17 @@ public class DmaapSubscriber implements Runnable {
Long l = System.currentTimeMillis();
Timestamp date_get = new Timestamp(l);
- if (alarm_header.getEventName().contains("Cleared")) {
- alarm_header.setStatus("close");
- alarmsHeaderService.updateAlarmsHeader2018("close", date_get, alarm_header.getStartEpochMicrosec(), alarm_header.getLastEpochMicroSec(), alarm_header.getEventName().replace("Cleared", ""), alarm_header.getReportingEntityName(), alarm_header.getSpecificProblem());
- alarm_informations.forEach(information ->
- alarmsInformationService.saveAlarmsInformation(information));
+ if (alarm_header.getEventName().contains("Cleared")) {
+ alarm_header.setStatus("close");
+ alarmsHeaderService.updateAlarmsHeader2018("close", date_get, alarm_header.getStartEpochMicrosec(),
+ alarm_header.getLastEpochMicroSec(), alarm_header.getEventName().replace("Cleared", ""),
+ alarm_header.getReportingEntityName(), alarm_header.getSpecificProblem());
+ alarm_informations.forEach(information -> alarmsInformationService.saveAlarmsInformation(information));
- } else {
+ } else {
alarm_header.setStatus("active");
alarmsHeaderService.saveAlarmsHeader(alarm_header);
- if(alarm_informations.size() > 0) {
+ if(alarm_informations.isEmpty()) {
alarm_informations.forEach(information ->
alarmsInformationService.saveAlarmsInformation(information));
}
@@ -230,7 +233,7 @@ public class DmaapSubscriber implements Runnable {
}
public void performanceProcess(Map<String, Object> maps) {
- PerformanceHeader performance_header = new PerformanceHeader();
+ PerformanceHeader performance_header = new PerformanceHeader.PerformanceHeaderBuilder().createPerformanceHeader();
performance_header.setId(UuiCommonUtil.getUUID());
List<PerformanceInformation> performance_informations = new ArrayList<>();
maps.forEach((ek1, ev1) -> {
@@ -278,17 +281,21 @@ public class DmaapSubscriber implements Runnable {
List<Map<String, Object>> m = (List<Map<String, Object>>) v3;
m.forEach(i -> {
i.forEach( (k,v) -> {
- if (k.equals("arrayOfFields")){
- List<Map<String,String>> arrayOfFields = (List<Map<String, String>>) v;
- arrayOfFields.forEach( fields -> {
- performance_informations.add(new PerformanceInformation(fields.get("name"), fields.get("value"), performance_header.getSourceId(), performance_header.getStartEpochMicrosec(),performance_header.getLastEpochMicroSec(),performance_header.getId()));
- } );
- }
+ if (k.equals("arrayOfFields")) {
+ List<Map<String, String>> arrayOfFields = (List<Map<String, String>>) v;
+ arrayOfFields.forEach(fields -> {
+ performance_informations.add(new PerformanceInformation(fields.get("name"),
+ fields.get("value"), performance_header.getSourceId(),
+ performance_header.getStartEpochMicrosec(),
+ performance_header.getLastEpochMicroSec(),
+ performance_header.getId()));
+ });
+ }
});
});
} catch (Exception e) {
e.printStackTrace();
- logger.error("convert performanceAdditionalInformation error:" + e.getMessage());
+ logger.error("convert performanceAdditionalInformation error:{}",e.getMessage());
}
}
});
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java
index 39a07956..9ac0afc8 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/HttpUtil.java
@@ -39,6 +39,10 @@ public class HttpUtil {
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return URL 所代表远程资源的响应结果
*/
+
+ private HttpUtil() {
+
+ }
public static String sendGet(String url, String param) {
String result = "";
BufferedReader in = null;
@@ -58,7 +62,7 @@ public class HttpUtil {
Map<String, List<String>> map = connection.getHeaderFields();
// 遍历所有的响应头字段
for (String key : map.keySet()) {
- logger.error(key + "--->" + map.get(key));
+ logger.error(key , "{} {}--->" , map.get(key));
}
// 定义 BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(
@@ -137,7 +141,7 @@ public class HttpUtil {
}
}
catch(IOException ex){
- ex.printStackTrace();
+ logger.error("{}",ex.getMessage());
}
}
return result;
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
index a1513fd4..5c8a13f2 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
@@ -27,6 +27,7 @@ import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -147,4 +148,11 @@ public class UuiCommonUtil {
File targetFile = new File(path);
return targetFile.exists();
}
+
+ public static String readJsonFile(String path) throws IOException{
+
+ File file = new File(path);
+ String content= FileUtils.readFileToString(file,"UTF-8");
+ return content;
+ }
}
diff --git a/server/src/main/resources/application.properties b/server/src/main/resources/application.properties
index 7402b510..48fb0e7b 100644
--- a/server/src/main/resources/application.properties
+++ b/server/src/main/resources/application.properties
@@ -14,17 +14,17 @@
## limitations under the License.
##
## General App Properties
-server.contextPath=/api/usecaseui/server/v1
+server.contextPath=/api/usecaseui-server/v1
server.port=8082
spring.http.multipart.max-file-size=128MB
spring.http.multipart.max-request-size=128MB
## App DB Properties
-spring.datasource.url=jdbc:mysql://localhost:3306/uui
-spring.datasource.username=root
-spring.datasource.password=root
-spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
-spring.database.driver.classname=org.mariadb.jdbc.Driver
+spring.datasource.url=jdbc:postgresql://localhost:5432/uui
+spring.datasource.username=uui
+spring.datasource.password=uui
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
+spring.database.driver.classname=org.postgresql.Driver
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.format_sql=false
diff --git a/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceHeaderTest.java b/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceHeaderTest.java
index 24d1242e..09ac14b3 100644
--- a/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceHeaderTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/bean/PerformanceHeaderTest.java
@@ -34,10 +34,7 @@ public class PerformanceHeaderTest implements Serializable {
@Test
public void testGetPerformanceHeader() throws Exception {
- PerformanceHeader ph = new PerformanceHeader("version", "eventName", "domain", "eventId", "eventType", "nfcNamingCode", "nfNamingCode",
- "sourceId", "sourceName", "reportingEntityId", "reportingEntityName", "priority",
- "startEpochMicrosec", "lastEpochMicroSec", "sequence", "measurementsForVfScalingVersion",
- "measurementInterval", DateUtils.now(), DateUtils.now());
+ PerformanceHeader ph = new PerformanceHeader.PerformanceHeaderBuilder().setVersion("version").setEventName("eventName").setDomain("domain").setEventId("eventId").setEventType("eventType").setNfcNamingCode("nfcNamingCode").setNfNamingCode("nfNamingCode").setSourceId("sourceId").setSourceName("sourceName").setReportingEntityId("reportingEntityId").setReportingEntityName("reportingEntityName").setPriority("priority").setStartEpochMicrosec("startEpochMicrosec").setLastEpochMicroSec("lastEpochMicroSec").setSequence("sequence").setMeasurementsForVfScalingVersion("measurementsForVfScalingVersion").setMeasurementInterval("measurementInterval").setCreateTime(DateUtils.now()).setUpdateTime(DateUtils.now()).createPerformanceHeader();
ph.getVersion();
ph.getEventName();
ph.getDomain();
@@ -60,7 +57,7 @@ public class PerformanceHeaderTest implements Serializable {
@Test
public void testSetPerformanceHeader() throws Exception {
- PerformanceHeader ph = new PerformanceHeader("sourceId");
+ PerformanceHeader ph = new PerformanceHeader.PerformanceHeaderBuilder().setSourceId("sourceId").createPerformanceHeader();
ph.setVersion("");
ph.setEventName("");
ph.setDomain("");
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/PerformanceControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/PerformanceControllerTest.java
index bccf73b1..1c62abcb 100755
--- a/server/src/test/java/org/onap/usecaseui/server/controller/PerformanceControllerTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/PerformanceControllerTest.java
@@ -60,7 +60,7 @@ public class PerformanceControllerTest {
String priority="Normal";
String startTime="1521678529000";
String endTime="1521680329000";
- PerformanceHeader header = new PerformanceHeader();
+ PerformanceHeader header = new PerformanceHeader.PerformanceHeaderBuilder().createPerformanceHeader();
controller.getPerformanceData(currentPage+"",pageSize+"",sourceName,startTime,endTime);
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/OrchestratorControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/OrchestratorControllerTest.java
new file mode 100644
index 00000000..d679a53f
--- /dev/null
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/OrchestratorControllerTest.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (C) 2019 Verizon. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.usecaseui.server.controller.lcm;
+
+import org.junit.Test;
+import org.onap.usecaseui.server.service.lcm.OrchestratorService;
+
+import static org.mockito.Mockito.*;
+
+public class OrchestratorControllerTest {
+
+ @Test
+ public void testGetOrchestrators() {
+ OrchestratorService orchestratorService = mock(OrchestratorService.class);
+ OrchestratorController controller = new OrchestratorController();
+ controller.setOrchestratorService(orchestratorService);
+
+ controller.getOrchestrators();
+
+ verify(orchestratorService, times(1)).listOrchestrator();
+ }
+}
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java
index 1f19216f..cfed3cc9 100644
--- a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java
@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
import static org.mockito.Mockito.*;
import java.io.IOException;
+import java.text.ParseException;
public class PackageDistributionControllerTest {
@@ -121,10 +122,12 @@ public class PackageDistributionControllerTest {
public void testGetNsLcmJobStatus() throws IOException {
String csarId = "1";
String responseId="1";
+ String operationType="1";
+ String jobId="1";
HttpServletRequest request = mockRequest();
controller.getNsLcmJobStatus(csarId,request);
- verify(service, times(1)).getNsLcmJobStatus(csarId,responseId);
+ verify(service, times(1)).getNsLcmJobStatus(csarId,responseId,operationType,jobId);
}
@Test
@@ -294,7 +297,7 @@ public class PackageDistributionControllerTest {
}
@Test
- public void testInstantiateNetworkServiceInstance() throws IOException {
+ public void testInstantiateNetworkServiceInstance() throws IOException, ParseException {
String ns_instance_id="1";
HttpServletRequest request = mockRequest();
controller.instantiateNetworkServiceInstance(request);
@@ -303,7 +306,7 @@ public class PackageDistributionControllerTest {
}
@Test
- public void testTerminateNetworkServiceInstance() throws IOException {
+ public void testTerminateNetworkServiceInstance() throws Exception {
String ns_instance_id="1";
HttpServletRequest request = mockRequest();
controller.terminateNetworkServiceInstance(request,ns_instance_id);
@@ -312,7 +315,7 @@ public class PackageDistributionControllerTest {
}
@Test
- public void testHealNetworkServiceInstance() throws IOException {
+ public void testHealNetworkServiceInstance() throws IOException, ParseException{
String ns_instance_id="1";
HttpServletRequest request = mockRequest();
controller.healNetworkServiceInstance(request,ns_instance_id);
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceControllerTest.java
index d82913a4..64e0979f 100644
--- a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceControllerTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceControllerTest.java
@@ -15,14 +15,43 @@
*/
package org.onap.usecaseui.server.controller.lcm;
+import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.onap.usecaseui.server.service.lcm.ServiceInstanceService;
-
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import javax.servlet.http.HttpServletRequest;
-
+import javax.ws.rs.core.MediaType;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {ServiceInstanceController.class })
+@WebAppConfiguration
+@EnableWebMvc
+
public class ServiceInstanceControllerTest {
+
+ private MockMvc mockMvc;
+
+ @Autowired
+ private WebApplicationContext wac;
+
+ @Before
+ public void setUp() {
+ mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
+ }
+
@Test
public void testListServiceInstances() throws Exception {
ServiceInstanceController controller = new ServiceInstanceController();
@@ -39,5 +68,23 @@ public class ServiceInstanceControllerTest {
verify(service, times(1)).listServiceInstances(customerId, serviceType);
}
+
+
+ @Test
+ public void testListNsOrServiceInstances() throws Exception {
+
+ ServiceInstanceController controller = new ServiceInstanceController();
+ ServiceInstanceService service = mock(ServiceInstanceService.class);
+ controller.setServiceInstanceService(service);
+
+ String uri = "/uui-lcm/service-ns-instances";
+ MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(uri)
+ .accept(MediaType.APPLICATION_JSON)).andReturn();
+
+ int status = mvcResult.getResponse().getStatus();
+ assertEquals(200, status);
+
+ }
+
} \ No newline at end of file
diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmControllerTest.java
index 0fc9e500..17e04b6d 100644
--- a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmControllerTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmControllerTest.java
@@ -47,7 +47,8 @@ public class ServiceLcmControllerTest {
public void testQueryOperationProgress() throws Exception {
String serviceId = "1";
String operationId = "1";
- controller.queryOperationProgress(serviceId, operationId);
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ controller.queryOperationProgress(request,serviceId, operationId);
verify(service, times(1)).queryOperationProgress(serviceId, operationId);
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIServiceSubscriptionTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIServiceSubscriptionTest.java
index 6082cba3..ff8bc240 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIServiceSubscriptionTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/aai/bean/AAIServiceSubscriptionTest.java
@@ -52,7 +52,7 @@ public class AAIServiceSubscriptionTest {
@Test
public void testAAIServiceSubscription() throws Exception {
- AAIServiceSubscription ass = new AAIServiceSubscription("serviceType");
+ AAIServiceSubscription ass = new AAIServiceSubscription("serviceType","resourceVersion");
ass.getServiceType();
}
}
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceTest.java
index 6ba2fa35..83c19fa0 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceTest.java
@@ -76,7 +76,7 @@ public class DefaultCustomerServiceTest {
@Test
public void itCanRetrieveServiceSubscriptionsFromAAI() {
- List<AAIServiceSubscription> serviceSubscriptions = singletonList(new AAIServiceSubscription("service type"));
+ List<AAIServiceSubscription> serviceSubscriptions = singletonList(new AAIServiceSubscription("service type","resourceVersion"));
AAIService aaiService = mock(AAIService.class);
ServiceSubscriptionRsp rsp = new ServiceSubscriptionRsp();
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java
index 2e378e64..5a5f2b6f 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java
@@ -250,11 +250,13 @@ public class DefaultPackageDistributionServiceTest {
VfcService vfcService = mock(VfcService.class);
String jobId = "1";
String responseId = "1";
+ String serviceId= "1";
+ String operationType= "1";
JobStatus jobStatus = new JobStatus();
when(vfcService.getNsLcmJobStatus(jobId, responseId)).thenReturn(successfulCall(jobStatus));
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
- Assert.assertSame(jobStatus, service.getNsLcmJobStatus(jobId, responseId));
+ Assert.assertSame(jobStatus, service.getNsLcmJobStatus(serviceId,jobId, responseId,operationType));
}
@Test(expected = VfcException.class)
@@ -262,9 +264,11 @@ public class DefaultPackageDistributionServiceTest {
VfcService vfcService = mock(VfcService.class);
String jobId = "1";
String responseId = "1";
+ String serviceId= "1";
+ String operationType= "1";
when(vfcService.getNsLcmJobStatus(jobId, responseId)).thenReturn(failedCall("VFC is not available!"));
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
- service.getNsLcmJobStatus(jobId, responseId);
+ service.getNsLcmJobStatus(serviceId,jobId, responseId,operationType);
}
@Test(expected = VfcException.class)
@@ -272,9 +276,11 @@ public class DefaultPackageDistributionServiceTest {
VfcService vfcService = mock(VfcService.class);
String jobId = "1";
String responseId = "1";
+ String serviceId= "1";
+ String operationType= "1";
when(vfcService.getNsLcmJobStatus(jobId, responseId)).thenReturn(emptyBodyCall());
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
- service.getNsLcmJobStatus(jobId, responseId);
+ service.getNsLcmJobStatus(serviceId,jobId, responseId,operationType);
}
@Test