aboutsummaryrefslogtreecommitdiffstats
path: root/configbackuprestore/vnfconfigreportsservice
diff options
context:
space:
mode:
authorSoumendu Sekhar Acharya <SA00498080@techmahindra.com>2018-08-07 15:23:28 +0530
committerSoumendu Sekhar Acharya <SA00498080@techmahindra.com>2018-08-24 06:39:48 +0000
commitcc49cb7753ff820dada996ab1d56263243630395 (patch)
tree71d1df55fadeb4a82d6dfd2e2bfd0bfdf9ade94b /configbackuprestore/vnfconfigreportsservice
parentdb386c7a0e9807b042a675208a1e7802501bca27 (diff)
Epic-231 cbr reports
SDN-C to support reporting feature for automated operations e.g. backup, versioning, restoration and added jacoco plugin in parent configbackuprestore Change-Id: I355fdf0ed30a5446eb0447e3f90755dff54811cc Issue-ID: SDNC-263 Signed-off-by: Soumendu Sekhar Acharya <SA00498080@techmahindra.com> Former-commit-id: 3fc03f8bde09d63f0c91c25bc95bb3419c3a6c0d
Diffstat (limited to 'configbackuprestore/vnfconfigreportsservice')
-rw-r--r--configbackuprestore/vnfconfigreportsservice/README.md3
-rw-r--r--configbackuprestore/vnfconfigreportsservice/pom.xml112
-rw-r--r--configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/controller/VnfReportsServiceController.java44
-rw-r--r--configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/dao/VnfReportsServiceRepo.java20
-rw-r--r--configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/model/VnfConfigDetailsDB.java110
-rw-r--r--configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/service/VnfReportsServiceImpl.java48
-rw-r--r--configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/service/Vnfreportsservice.java11
7 files changed, 348 insertions, 0 deletions
diff --git a/configbackuprestore/vnfconfigreportsservice/README.md b/configbackuprestore/vnfconfigreportsservice/README.md
new file mode 100644
index 00000000..4462cbe8
--- /dev/null
+++ b/configbackuprestore/vnfconfigreportsservice/README.md
@@ -0,0 +1,3 @@
+vnfconfigreportsservice
+------------------------
+It will show all the information about backup vnf configuration details.
diff --git a/configbackuprestore/vnfconfigreportsservice/pom.xml b/configbackuprestore/vnfconfigreportsservice/pom.xml
new file mode 100644
index 00000000..1d83bd02
--- /dev/null
+++ b/configbackuprestore/vnfconfigreportsservice/pom.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>configbackuprestore</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <groupId>com.onap.sdnc.vnfbackup</groupId>
+ <artifactId>vnfconfigreportsservice</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>vnfconfigreportsservice</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <scope>provided</scope>
+</dependency>
+
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ <version>1.1.9</version>
+ </dependency>
+ <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <version>1.5.4.RELEASE</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>4.3.9.RELEASE</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-devtools</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ <version>1.5.3.RELEASE</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ </dependency>
+
+ <!-- Add Log4j2 Dependency -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20180130</version>
+ </dependency>
+ <!-- https://mvnrepository.com/artifact/com.fasterxml/jackson-xml-databind -->
+ <dependency>
+ <groupId>com.fasterxml</groupId>
+ <artifactId>jackson-xml-databind</artifactId>
+ <version>0.6.2</version>
+ </dependency>
+<dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+</dependency>
+ </dependencies>
+</project>
+
diff --git a/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/controller/VnfReportsServiceController.java b/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/controller/VnfReportsServiceController.java
new file mode 100644
index 00000000..4ef15366
--- /dev/null
+++ b/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/controller/VnfReportsServiceController.java
@@ -0,0 +1,44 @@
+package com.onap.sdnc.vnfreportsservice.controller;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
+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.RestController;
+
+import com.onap.sdnc.vnfreportsservice.model.VnfConfigDetailsDB;
+import com.onap.sdnc.vnfreportsservice.service.VnfReportsServiceImpl;
+
+@RestController
+public class VnfReportsServiceController {
+
+ private static final Logger logger = LogManager.getLogger(VnfReportsServiceController.class);
+
+ @Autowired
+ VnfReportsServiceImpl Vnfreportsservice;
+
+ @RequestMapping(value = "/getVnfDetBetDates/{startDate}/{endDate}", method = RequestMethod.GET, produces = "application/json")
+
+ public List<VnfConfigDetailsDB> getVnfConfigDetailsBetweenDates(
+ @PathVariable("startDate") @DateTimeFormat(pattern = "dd-MM-yyyy") Date startDate,
+ @PathVariable("endDate") @DateTimeFormat(pattern = "dd-MM-yyyy") Date endDate) {
+ logger.info("Get VNF Configuration Details Inbetween 2 Dates ");
+ return Vnfreportsservice.getVnfConfigDetailsBetweenDates(startDate, endDate);
+ }
+
+ @RequestMapping(value = "/getVnfDetByVnfidBetDates/{vnfid}/{startDate}/{endDate}", method = RequestMethod.GET, produces = "application/json")
+
+ public List<VnfConfigDetailsDB> getVnfConfigDetailsByVnfIdBetweenDates(@PathVariable("vnfid") String vnfId,
+ @PathVariable("startDate") @DateTimeFormat(pattern = "dd-MM-yyyy") Date startDate,
+ @PathVariable("endDate") @DateTimeFormat(pattern = "dd-MM-yyyy") Date endDate) {
+ logger.info("Get VNF Configuration Details Of a VnfID Inbetween 2 Dates ");
+ return Vnfreportsservice.getVnfIdDetailsBetweenDates(vnfId, startDate, endDate);
+ }
+
+}
diff --git a/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/dao/VnfReportsServiceRepo.java b/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/dao/VnfReportsServiceRepo.java
new file mode 100644
index 00000000..1834ebe0
--- /dev/null
+++ b/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/dao/VnfReportsServiceRepo.java
@@ -0,0 +1,20 @@
+package com.onap.sdnc.vnfreportsservice.dao;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import com.onap.sdnc.vnfreportsservice.controller.VnfReportsServiceController;
+import com.onap.sdnc.vnfreportsservice.model.VnfConfigDetailsDB;
+
+
+public interface VnfReportsServiceRepo extends JpaRepository<VnfConfigDetailsDB, Long> {
+
+ List<VnfConfigDetailsDB> findByLastupdatedBetween(Date startDate, Date endDate);
+ List<VnfConfigDetailsDB> findByVnfidAndLastupdatedBetween(String vnfid,Date startDate,Date endDate);
+
+}
+
+
diff --git a/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/model/VnfConfigDetailsDB.java b/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/model/VnfConfigDetailsDB.java
new file mode 100644
index 00000000..a2c08ef7
--- /dev/null
+++ b/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/model/VnfConfigDetailsDB.java
@@ -0,0 +1,110 @@
+package com.onap.sdnc.vnfreportsservice.model;
+
+import java.sql.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "vnfconfigdetails", schema = "testreports")
+public class VnfConfigDetailsDB {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue
+ private int id;
+
+ @Column(name = "vnfid")
+ private String vnfid;
+
+ @Column(name = "vnfversion")
+ private String vnfversion;
+
+ @Column(name = "vnfname")
+ private String vnfname;
+
+ @Column(name = "configinfo")
+ @Lob
+ private String configinfo;
+
+ @Column(name = "creationdate")
+ private Date creationdate;
+
+ @Column(name = "lastupdated")
+ private Date lastupdated;
+
+ @Column(name = "status")
+ private String status;
+
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getVnfid() {
+ return vnfid;
+ }
+
+ public void setVnfid(String vnfid) {
+ this.vnfid = vnfid;
+ }
+
+ public String getVnfversion() {
+ return vnfversion;
+ }
+
+ public void setVnfversion(String vnfversion) {
+ this.vnfversion = vnfversion;
+ }
+
+ public String getVnfname() {
+ return vnfname;
+ }
+
+ public void setVnfname(String vnfname) {
+ this.vnfname = vnfname;
+ }
+
+ public String getConfiginfo() {
+ return configinfo;
+ }
+
+ public void setConfiginfo(String configinfo) {
+ this.configinfo = configinfo;
+ }
+
+ public Date getCreationdate() {
+ return creationdate;
+ }
+
+ public void setCreationdate(Date creationdate) {
+ this.creationdate = creationdate;
+ }
+
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public Date getLastupdated() {
+ return lastupdated;
+ }
+
+ public void setLastupdated(Date lastupdated) {
+ this.lastupdated = lastupdated;
+ }
+
+}
+
diff --git a/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/service/VnfReportsServiceImpl.java b/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/service/VnfReportsServiceImpl.java
new file mode 100644
index 00000000..3b4a7f86
--- /dev/null
+++ b/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/service/VnfReportsServiceImpl.java
@@ -0,0 +1,48 @@
+package com.onap.sdnc.vnfreportsservice.service;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.onap.sdnc.vnfreportsservice.dao.VnfReportsServiceRepo;
+import com.onap.sdnc.vnfreportsservice.model.VnfConfigDetailsDB;
+@Service
+public class VnfReportsServiceImpl implements Vnfreportsservice {
+
+ private static final Logger logger = LogManager.getLogger(VnfReportsServiceImpl.class);
+
+ @Autowired
+ VnfReportsServiceRepo vnfRepo;
+
+ List<VnfConfigDetailsDB> config = null;
+
+ @Override
+ public List<VnfConfigDetailsDB> getVnfConfigDetailsBetweenDates(Date startDate, Date endDate) {
+
+ logger.info("Start Date" + startDate + "End Date" + endDate);
+ try {
+ config = vnfRepo.findByLastupdatedBetween(startDate, endDate);
+ } catch (Exception e) {
+ logger.error("Exception Occered Not able to get details from DB : " + e);
+ }
+
+ return config;
+ }
+
+ @Override
+ public List<VnfConfigDetailsDB> getVnfIdDetailsBetweenDates(String vnfid, Date startDate, Date endDate) {
+
+ logger.info("Vnf ID: " + vnfid + "Start Date: " + startDate + "End Date: " + endDate);
+ try {
+ config = vnfRepo.findByVnfidAndLastupdatedBetween(vnfid, startDate, endDate);
+ } catch (Exception e) {
+ logger.error("Exception Occered Not able to get details from DB : " + e);
+ }
+ return config;
+ }
+
+}
diff --git a/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/service/Vnfreportsservice.java b/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/service/Vnfreportsservice.java
new file mode 100644
index 00000000..3cbd2053
--- /dev/null
+++ b/configbackuprestore/vnfconfigreportsservice/src/main/java/com/onap/sdnc/vnfreportsservice/service/Vnfreportsservice.java
@@ -0,0 +1,11 @@
+package com.onap.sdnc.vnfreportsservice.service;
+
+import java.util.Date;
+import java.util.List;
+import com.onap.sdnc.vnfreportsservice.model.VnfConfigDetailsDB;
+
+public interface Vnfreportsservice {
+ public List<VnfConfigDetailsDB> getVnfConfigDetailsBetweenDates(Date startDate, Date endDate);
+ public List<VnfConfigDetailsDB> getVnfIdDetailsBetweenDates(String vnfId, Date startDate, Date endDate);
+
+}