From 8d3e732c7592327398c1df491880e9b7ba8ccc73 Mon Sep 17 00:00:00 2001 From: Vishal Varvate Date: Tue, 20 Mar 2018 15:35:48 +0530 Subject: SDNC-253 Historical Report Part I UI Update sdnc_reports_api Provides GUI for viewing historical reports, . Issue-ID: SDNC-253 Change-Id: Ia55adc2bd730b747896cba4dd628140d2e5a3155 Signed-off-by: vvarvate --- .project | 17 ++ .settings/org.eclipse.core.resources.prefs | 2 + .settings/org.eclipse.m2e.core.prefs | 4 + desktop.ini | 4 + pom.xml | 20 +- sdnc_report_api_sdnc_253_story/.project | 17 ++ .../.settings/org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.m2e.core.prefs | 4 + sdnc_report_api_sdnc_253_story/README.md | 1 + sdnc_report_api_sdnc_253_story/pom.xml | 19 ++ .../sdnc_reports_api/.classpath | 36 +++ .../sdnc_reports_api/.project | 35 +++ .../.settings/org.eclipse.core.resources.prefs | 6 + .../.settings/org.eclipse.jdt.core.prefs | 13 + .../.settings/org.eclipse.m2e.core.prefs | 4 + .../org.eclipse.wst.common.project.facet.core.xml | 4 + .../sdnc_reports_api/logs/sdnc_report_api.log | 0 .../sdnc_reports_api/pom.xml | 163 ++++++++++++ .../java/com/onap/sdnc/reports/Application.java | 48 ++++ .../com/onap/sdnc/reports/ServletInitializer.java | 34 +++ .../sdnc/reports/config/JpaApplicationConfig.java | 61 +++++ .../sdnc/reports/controller/ReportController.java | 104 ++++++++ .../sdnc/reports/controller/WebController.java | 36 +++ .../onap/sdnc/reports/service/IReportService.java | 47 ++++ .../sdnc/reports/service/ReportServiceImpl.java | 115 +++++++++ .../src/main/resources/application.properties | 51 ++++ .../sdnc_reports_api/src/main/resources/log4j2.xml | 38 +++ .../main/resources/static/form-validationTest.html | 141 +++++++++++ .../src/main/resources/static/form-viewReport.html | 140 ++++++++++ .../src/main/resources/static/images/FailImage.png | Bin 0 -> 2950 bytes .../src/main/resources/static/images/download.png | Bin 0 -> 1066 bytes .../main/resources/static/images/downloadImage.png | Bin 0 -> 3524 bytes .../src/main/resources/static/images/error.png | Bin 0 -> 5610 bytes .../src/main/resources/static/images/fail.png | Bin 0 -> 1850 bytes .../src/main/resources/static/images/images.png | Bin 0 -> 3716 bytes .../main/resources/static/images/networklayer.png | Bin 0 -> 4580 bytes .../src/main/resources/static/images/protocaol.png | Bin 0 -> 2625 bytes .../src/main/resources/static/images/protocol.png | Bin 0 -> 10646 bytes .../src/main/resources/static/images/reachable.png | Bin 0 -> 1219 bytes .../src/main/resources/static/images/router.jpg | Bin 0 -> 3142 bytes .../src/main/resources/static/images/router.png | Bin 0 -> 5693 bytes .../src/main/resources/static/images/search.png | Bin 0 -> 3284 bytes .../src/main/resources/static/images/success.png | Bin 0 -> 4416 bytes .../main/resources/static/images/validation.png | Bin 0 -> 5110 bytes .../src/main/resources/static/images/waning.png | Bin 0 -> 6481 bytes .../resources/static/sdnc-stubs/getAllDevices.json | 17 ++ .../resources/static/sdnc-stubs/getAllReports.json | 75 ++++++ .../resources/static/sdnc-stubs/getAllTest.json | 17 ++ .../resources/static/sdnc-stubs/getAllVNF.json | 29 +++ .../resources/static/sdnc-stubs/getTestResult.json | 42 +++ .../src/main/resources/static/style/sdnc-style.css | 216 ++++++++++++++++ .../src/main/resources/static/style/w3.css | 231 +++++++++++++++++ .../src/main/webapp/WEB-INF/views/index.jsp | 69 +++++ .../sdnc_reports_api/src/main/webapp/js/app.js | 47 ++++ .../sdnc-validationTest-controller.js | 243 ++++++++++++++++++ .../sdnc-controller/sdnc-viewreport-controller.js | 171 +++++++++++++ .../sdnc-services/sdnc-validationTest-service.js | 78 ++++++ .../js/sdnc-services/sdnc-viewReport-service.js | 78 ++++++ .../sdnc_reports_api/src/main/webapp/package.json | 32 +++ .../reports/controller/ReportControllerTest.java | 107 ++++++++ .../repository/PreTestConfigRepositoryTest.java | 145 +++++++++++ .../reports/service/ReportServiceImplTest.java | 204 +++++++++++++++ .../src/test/resources/application.properties | 56 ++++ .../sdnc_reports_dao/.classpath | 91 +++++++ .../sdnc_reports_dao/.project | 27 ++ .../.settings/org.eclipse.core.resources.prefs | 6 + .../.settings/org.eclipse.jdt.core.prefs | 13 + .../.settings/org.eclipse.m2e.core.prefs | 4 + .../org.eclipse.wst.common.project.facet.core.xml | 4 + .../sdnc_reports_dao/pom.xml | 66 +++++ .../com/onap/sdnc/reports/model/DeviceConfig.java | 109 ++++++++ .../com/onap/sdnc/reports/model/PreTestConfig.java | 127 ++++++++++ .../onap/sdnc/reports/model/ProtocolConfig.java | 198 +++++++++++++++ .../java/com/onap/sdnc/reports/model/Report.java | 94 +++++++ .../java/com/onap/sdnc/reports/model/Response.java | 50 ++++ .../sdnc/reports/model/RouterConfigDetails.java | 281 +++++++++++++++++++++ .../sdnc/reports/repository/DeviceRepository.java | 31 +++ .../repository/PreTestConfigRepository.java | 34 +++ .../reports/rest/model/ConfigDetailsRestModel.java | 73 ++++++ .../com/onap/sdnc/reports/rest/model/JSONTags.java | 56 ++++ .../onap/sdnc/reports/rest/model/PreTestModel.java | 116 +++++++++ .../sdnc/reports/rest/model/ProtocolModel.java | 207 +++++++++++++++ .../src/main/resources/application.properties | 29 +++ .../src/test/resources/application.properties | 56 ++++ 84 files changed, 4694 insertions(+), 1 deletion(-) create mode 100644 .project create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.m2e.core.prefs create mode 100644 desktop.ini create mode 100644 sdnc_report_api_sdnc_253_story/.project create mode 100644 sdnc_report_api_sdnc_253_story/.settings/org.eclipse.core.resources.prefs create mode 100644 sdnc_report_api_sdnc_253_story/.settings/org.eclipse.m2e.core.prefs create mode 100644 sdnc_report_api_sdnc_253_story/README.md create mode 100644 sdnc_report_api_sdnc_253_story/pom.xml create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/.classpath create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/.project create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.core.resources.prefs create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.jdt.core.prefs create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.m2e.core.prefs create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.wst.common.project.facet.core.xml create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/logs/sdnc_report_api.log create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/pom.xml create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/Application.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/ServletInitializer.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/config/JpaApplicationConfig.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/ReportController.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/WebController.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/IReportService.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/ReportServiceImpl.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/application.properties create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/log4j2.xml create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/form-validationTest.html create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/form-viewReport.html create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/FailImage.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/download.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/downloadImage.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/error.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/fail.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/images.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/networklayer.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/protocaol.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/protocol.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/reachable.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/router.jpg create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/router.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/search.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/success.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/validation.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/waning.png create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllDevices.json create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllReports.json create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllTest.json create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllVNF.json create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getTestResult.json create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/style/sdnc-style.css create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/style/w3.css create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/WEB-INF/views/index.jsp create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/app.js create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-controller/sdnc-validationTest-controller.js create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-controller/sdnc-viewreport-controller.js create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-services/sdnc-validationTest-service.js create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-services/sdnc-viewReport-service.js create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/package.json create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/controller/ReportControllerTest.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/repository/PreTestConfigRepositoryTest.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/service/ReportServiceImplTest.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/resources/application.properties create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.classpath create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.project create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.core.resources.prefs create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.jdt.core.prefs create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.m2e.core.prefs create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.wst.common.project.facet.core.xml create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/pom.xml create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/DeviceConfig.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/PreTestConfig.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/ProtocolConfig.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Report.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Response.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/RouterConfigDetails.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/DeviceRepository.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ConfigDetailsRestModel.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/JSONTags.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/PreTestModel.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ProtocolModel.java create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/resources/application.properties create mode 100644 sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/test/resources/application.properties diff --git a/.project b/.project new file mode 100644 index 0000000..9d8b615 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + sdnc-features + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/desktop.ini b/desktop.ini new file mode 100644 index 0000000..d957fd1 --- /dev/null +++ b/desktop.ini @@ -0,0 +1,4 @@ +[ViewState] +Mode= +Vid= +FolderType=Generic diff --git a/pom.xml b/pom.xml index 97ea1a5..738714d 100644 --- a/pom.xml +++ b/pom.xml @@ -8,12 +8,30 @@ 1.0.1-SNAPSHOT - + org.onap.sdnc.features sdnc-features 1.3.1-SNAPSHOT pom + + sdnc-features The SDN-C features repository contains code for karaf features that are used by the SDN controller https://wiki.onap.org diff --git a/sdnc_report_api_sdnc_253_story/.project b/sdnc_report_api_sdnc_253_story/.project new file mode 100644 index 0000000..03bfd1e --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/.project @@ -0,0 +1,17 @@ + + + sdnc_reports + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.core.resources.prefs b/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.m2e.core.prefs b/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/sdnc_report_api_sdnc_253_story/README.md b/sdnc_report_api_sdnc_253_story/README.md new file mode 100644 index 0000000..c8b02ab --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/README.md @@ -0,0 +1 @@ +# SDNCReports \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/pom.xml b/sdnc_report_api_sdnc_253_story/pom.xml new file mode 100644 index 0000000..187589b --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + com.sdnc.reports + sdnc_reports + 0.0.1-SNAPSHOT + pom + + + org.springframework.boot + spring-boot-starter-parent + 1.5.4.RELEASE + + + + + sdnc_reports_dao + sdnc_reports_api + + \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.classpath b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.classpath new file mode 100644 index 0000000..7e4ca5c --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.project b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.project new file mode 100644 index 0000000..9073075 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.project @@ -0,0 +1,35 @@ + + + sdnc_reports_api + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.core.resources.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.jdt.core.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..13b3428 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.m2e.core.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.wst.common.project.facet.core.xml b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..d858295 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/logs/sdnc_report_api.log b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/logs/sdnc_report_api.log new file mode 100644 index 0000000..e69de29 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/pom.xml b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/pom.xml new file mode 100644 index 0000000..06503ac --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/pom.xml @@ -0,0 +1,163 @@ + + 4.0.0 + jar + sdnc_reports_api + + com.sdnc.reports + sdnc_reports + 0.0.1-SNAPSHOT + + + + + UTF-8 + UTF-8 + 1.8 + + + + + + com.h2database + h2 + test + 1.4.194 + + + + com.sdnc.reports + sdnc_reports_dao + 0.0.1-SNAPSHOT + + + + org.mariadb.jdbc + mariadb-java-client + 1.1.9 + + + + org.springframework.boot + spring-boot-starter-web + 1.5.4.RELEASE + + + + org.springframework.boot + spring-boot-starter-test + test + 1.5.3.RELEASE + + + + + org.springframework + spring-context + 4.3.9.RELEASE + + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + org.apache.tomcat.embed + tomcat-embed-jasper + provided + + + + + org.springframework.boot + spring-boot-devtools + true + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + + + org.springframework.boot + spring-boot-starter-log4j2 + + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + org.jacoco + jacoco-maven-plugin + 0.7.5.201505241946 + + + + pre-unit-test + + prepare-agent + + + + ${project.build.directory}/coverage-reports/jacoco-ut.exec + + surefireArgLine + + + + + post-unit-test + test + + report + + + + ${project.build.directory}/coverage-reports/jacoco-ut.exec + + ${project.reporting.outputDirectory}/jacoco-ut + + + + + + + + + + \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/Application.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/Application.java new file mode 100644 index 0000000..f6a5355 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/Application.java @@ -0,0 +1,48 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +package com.onap.sdnc.reports; + + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@SpringBootApplication +//@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class}) +@EnableJpaRepositories("com.onap.sdnc.reports.repository") +@EnableAutoConfiguration +@EntityScan("com.onap.sdnc.reports.*") +public class Application { + private static final Logger logger = LogManager.getLogger(Application.class); + public static void main(String[] args) { + + SpringApplication.run(Application.class, args); + logger.info("SDNC REPORTS API Has Started.."); + } +} + + diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/ServletInitializer.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/ServletInitializer.java new file mode 100644 index 0000000..45ab303 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/ServletInitializer.java @@ -0,0 +1,34 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.support.SpringBootServletInitializer; + + + +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(Application.class); + } + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/config/JpaApplicationConfig.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/config/JpaApplicationConfig.java new file mode 100644 index 0000000..cdd2916 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/config/JpaApplicationConfig.java @@ -0,0 +1,61 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.dao.support.PersistenceExceptionTranslator; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.OpenJpaDialect; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +//@Configuration +//@EnableJpaRepositories("com.onap.sdnc.reports.repository") +//@EnableTransactionManagement +public class JpaApplicationConfig { + + /*@Bean + public AbstractEntityManagerFactoryBean entityManagerFactory() + { + LocalContainerEntityManagerFactoryBean factory=new LocalContainerEntityManagerFactoryBean(); + factory.setPackagesToScan("com.onap.sdnc.reports.repository"); + //factory.setPersistenceUnitName("name"); + //factory.setPersistenceUnitName("transactions-optional"); + return factory; + } + + @Bean + public PlatformTransactionManager transactionManager() + { + JpaTransactionManager jpaTransactionManager=new JpaTransactionManager(); + jpaTransactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); + return jpaTransactionManager; + } + + @Bean + public PersistenceExceptionTranslator persistenceExceptionTranslator() + { + return new OpenJpaDialect(); + }*/ +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/ReportController.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/ReportController.java new file mode 100644 index 0000000..0106031 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/ReportController.java @@ -0,0 +1,104 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.controller; + +import java.util.Date; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.hibernate.engine.internal.Collections; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +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.RestController; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.onap.sdnc.reports.Application; +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.model.Report; +import com.onap.sdnc.reports.model.Response; +import com.onap.sdnc.reports.repository.DeviceRepository; +import com.onap.sdnc.reports.rest.model.PreTestModel; +import com.onap.sdnc.reports.service.IReportService; + +@RestController +public class ReportController { + + private static final Logger logger = LogManager.getLogger(ReportController.class); + + @Autowired + IReportService reportService; + + /*@RequestMapping(value = "/saveReport", method = RequestMethod.POST,consumes=MediaType.APPLICATION_JSON_VALUE) + public void saveReport(@RequestBody Report Report) { + + //repository.save(new Report(Report.getFirstName(), Report.getLastName())); + } + + @RequestMapping(value="/findAllReports/{startDate}/{endDate}",produces=MediaType.APPLICATION_JSON_VALUE) + public Response findAllReports(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate) { + + return reportService.findAllReports(startDate,endDate); + } + + // produces = "application/json" + @RequestMapping(value="/findReportByTestName/{startDate}/{endDate}/{testName}",produces=MediaType.APPLICATION_JSON_VALUE) + public Response findReportByTestName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("testName") String testName) { + + return reportService.findReportByTestName(startDate,endDate,testName); + }*/ + + @RequestMapping(value="/findReportByDeviceName/{startDate}/{endDate}/{deviceName}", produces = "application/json",method=RequestMethod.GET) + public List findReportByDeviceName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("deviceName") String deviceName) { + + try{ + logger.info("findReportByDeviceName Started Working.."); + logger.info("Received StartDate : "+startDate+" ,EndDate : "+endDate+" ,DeviceName : "+deviceName); + /*ObjectMapper mapper=new ObjectMapper(); + String jsonVal=""; + try { + jsonVal = mapper.writeValueAsString(reportService.findReportByDeviceName(startDate,endDate,deviceName)); + logger.info("JSON "+jsonVal); + } catch (JsonProcessingException e) { + + }*/ + logger.info("findReportByDeviceName Finished Working.."); + return reportService.findReportByDeviceName(startDate,endDate,deviceName.trim()); + } + catch(Exception ex) + { + logger.info("Exception Occured : "+ex.getLocalizedMessage()); + return java.util.Collections.EMPTY_LIST; + } + + } + + /*@RequestMapping(value="/findReportsByDeviceNamdAndTestName/{startDate}/{endDate}",produces=MediaType.APPLICATION_JSON_VALUE) + public Response findReportsByDeviceNamdAndTestName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("deviceName") String deviceName,@PathVariable("testName") String testName) { + + return reportService.findReportsByDeviceNamdAndTestName(startDate,endDate,deviceName,testName); + }*/ +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/WebController.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/WebController.java new file mode 100644 index 0000000..a2311fe --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/controller/WebController.java @@ -0,0 +1,36 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +@Controller +public class WebController { + + @RequestMapping("/") + ModelAndView home(ModelAndView modelAndView) { + + modelAndView.setViewName("index"); + + return modelAndView; + } +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/IReportService.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/IReportService.java new file mode 100644 index 0000000..b4afaf6 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/IReportService.java @@ -0,0 +1,47 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.service; + +import java.util.Date; +import java.util.List; + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.model.Report; +import com.onap.sdnc.reports.model.Response; +import com.onap.sdnc.reports.rest.model.PreTestModel; + +public interface IReportService { + +/* public void saveReport(@RequestBody Report Report); + + public Response findAllReports(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate); + + + public Response findReportByTestName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("testName") String testName); + + public Response findReportsByDeviceNamdAndTestName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("deviceName") String deviceName,@PathVariable("testName") String testName); +*/ + public List findReportByDeviceName(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@RequestParam("deviceName") String deviceName) throws Exception; + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/ReportServiceImpl.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/ReportServiceImpl.java new file mode 100644 index 0000000..73d040e --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/java/com/onap/sdnc/reports/service/ReportServiceImpl.java @@ -0,0 +1,115 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.service; + +import java.util.ArrayList; +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.reports.controller.ReportController; +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.model.Report; +import com.onap.sdnc.reports.model.Response; +import com.onap.sdnc.reports.repository.DeviceRepository; +import com.onap.sdnc.reports.repository.PreTestConfigRepository; +import com.onap.sdnc.reports.rest.model.PreTestModel; + +@Service +public class ReportServiceImpl implements IReportService { + + private static final Logger logger = LogManager.getLogger(ReportServiceImpl.class); + + @Autowired + DeviceRepository deviceRepository; + + @Autowired + PreTestConfigRepository preTestConfigRepository; + + /*@Override + public void saveReport(Report Report) { + // TODO Auto-generated method stub + + } + + @Override + public Response findAllReports(Date startDate, Date endDate) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Response findReportByTestName(Date startDate, Date endDate, String testName) { + // TODO Auto-generated method stub + return null; + }*/ + + @Override + public List findReportByDeviceName(Date startDate, Date endDate, String deviceName) throws Exception{ + + try{ + + List resultSet= preTestConfigRepository.findReportByDeviceName(startDate, endDate, deviceName); + logger.info("Received Output From Repository Is: "+resultSet); + + List preTestList=new ArrayList(); + for(PreTestConfig config : resultSet) + { + try{ + long deviceid=config.getDevice().getId(); + long testid=config.getTestId(); + String testName=config.getTestName(); + String deviName=config.getDevice().getDeviceName(); + String execuationDetails=config.getExecuationDetails(); + String result=config.getResult(); + Date timeStamp=config.getTimestamp(); + + PreTestModel model=new PreTestModel(testid, deviceid, testName, deviName, execuationDetails, result, timeStamp); + preTestList.add(model); + } + catch(Exception ex) + { + logger.info("Exception Occured : "+ex.getLocalizedMessage()); + } + } + logger.info("Final PreTestConfig List Size : "+preTestList.size()); + Response r=new Response("Pass", resultSet); + return preTestList; + } + catch(Exception ex) + { + logger.info("Exception Occured : "+ex.getLocalizedMessage()); + throw new Exception(ex); + } + + } + + /*@Override + public Response findReportsByDeviceNamdAndTestName(Date startDate, Date endDate, String deviceName, + String testName) { + // TODO Auto-generated method stub + return null; + }*/ + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/application.properties b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/application.properties new file mode 100644 index 0000000..e9b1c47 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/application.properties @@ -0,0 +1,51 @@ +server.port = 9002 + +spring.jackson.serialization.fail-on-empty-beans=false + +server.tomcat.uri-encoding=utf-8 + +server.error.whitelabel.enabled=false +spring.mvc.view.prefix = /WEB-INF/views/ +spring.mvc.view.suffix = .jsp + + +spring.datasource.url=jdbc:mariadb://localhost:3307/testreports +spring.datasource.username=root +spring.datasource.password=root +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +# Keep the connection alive if idle for a long time (needed in production) +spring.datasource.testWhileIdle=true +#spring.datasource.validationQuery=SELECT 1 + + +#spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect +#spring.datasource.url=jdbc:mysql://localhost:3306/mysql?useSSL=false +#spring.datasource.driver-class-name=com.mysql.jdbc.Driver +#spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + +#spring.datasource.name=mysql +#spring.jpa.database=mysql + + + + +#spring.jpa.generate-ddl=true + +spring.datasource.tomcat.max-wait=20000 +spring.datasource.tomcat.max-active=50 +spring.datasource.tomcat.max-idle=20 +spring.datasource.tomcat.min-idle=15 + +spring.jpa.show-sql=true +#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardIm + + +#spring.jpa.hibernate.ddl-auto=create +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.id.new_generator_mappings = false +#spring.jpa.properties.hibernate.format_sql = true + +#logging.level.org.hibernate.SQL=DEBUG +#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/log4j2.xml b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/log4j2.xml new file mode 100644 index 0000000..e443b52 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/log4j2.xml @@ -0,0 +1,38 @@ + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${hostName} --- [%15.15t] %-40.40c{1.} : %m%n%ex + + + + + + + + + + ${LOG_PATTERN} + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/form-validationTest.html b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/form-validationTest.html new file mode 100644 index 0000000..88f0e96 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/form-validationTest.html @@ -0,0 +1,141 @@ + +
+
  Pre-test/Certification
+
+
+ + + + +
+ +
+
+ +
+
+ +
+ Required! +
+
+ Not a valid IPAddress! +
+
+ Not a valid IPAddress! +
+
+
+
+
+ +
+
+ +
+ Required! +
+
+ Not a valid HostName! +
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + +
SNo. + TestName + Device IP + Status + Statistics (%Loss)Average Time (ms)Result +
{{$index+1}} + {{test.testtype}} + {{test.ipaddress}} + {{test.status | uppercase}} + +
+
{{test.statistics}}% Loss +
+
No Statistics Recorded +
+
+
+ + → + +
+
+
+
{{test.avgTime}} ms
+
No AvgTime Recorded +
+
+
+
+
+
+ +    + +    + +    + + +
+
+
\ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/form-viewReport.html b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/form-viewReport.html new file mode 100644 index 0000000..7528adb --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/form-viewReport.html @@ -0,0 +1,140 @@ + +
+
  Search For Historical Test Reports
+
+
+
+ + + +
+
+ + +
+ + Required! + + Not a valid date! +
+
+
+ + +
+ + Required! + + Not a valid date! +
+
+
+
+
+ + +
+ + Required! + + Not a valid date! +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
SNo. + TestName + DeviceIP + Timestamp + Status + Statistics (%Loss)Average Time (ms)Result +
{{$index+1}} + {{test.testname}} + {{test.deviceName}} + {{test.timeStamp}} + {{test.executionDetails.status | uppercase}} + +
+
{{test.executionDetails.statistics}}% Loss +
+
+
+ + + +
+
+
+
{{test.executionDetails.avgTime}} ms
+
+
{{test.result}} +
+
+
+ + +
+
+ +    + + +
+
+
+ + +
+
+ + \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/FailImage.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/FailImage.png new file mode 100644 index 0000000..22c44f7 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/FailImage.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/download.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/download.png new file mode 100644 index 0000000..0b1f949 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/download.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/downloadImage.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/downloadImage.png new file mode 100644 index 0000000..e72e128 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/downloadImage.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/error.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/error.png new file mode 100644 index 0000000..3f44964 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/error.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/fail.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/fail.png new file mode 100644 index 0000000..898fa26 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/fail.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/images.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/images.png new file mode 100644 index 0000000..3bce573 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/images.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/networklayer.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/networklayer.png new file mode 100644 index 0000000..c8e8008 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/networklayer.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/protocaol.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/protocaol.png new file mode 100644 index 0000000..2c6f8fa Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/protocaol.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/protocol.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/protocol.png new file mode 100644 index 0000000..aea9c7c Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/protocol.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/reachable.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/reachable.png new file mode 100644 index 0000000..bb771b3 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/reachable.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/router.jpg b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/router.jpg new file mode 100644 index 0000000..cb4c50e Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/router.jpg differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/router.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/router.png new file mode 100644 index 0000000..94de9f5 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/router.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/search.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/search.png new file mode 100644 index 0000000..a8b4b35 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/search.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/success.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/success.png new file mode 100644 index 0000000..76689fe Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/success.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/validation.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/validation.png new file mode 100644 index 0000000..77c53ff Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/validation.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/waning.png b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/waning.png new file mode 100644 index 0000000..2ae2987 Binary files /dev/null and b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/images/waning.png differ diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllDevices.json b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllDevices.json new file mode 100644 index 0000000..d7faef5 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllDevices.json @@ -0,0 +1,17 @@ + +{ + "deviceList":[ + { + "deviceId":"1", + "deviceName":"Device1" + }, + { + "deviceId":"2", + "deviceName":"Device2" + }, + { + "deviceId":"3", + "deviceName":"Device3" + } + ] +} \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllReports.json b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllReports.json new file mode 100644 index 0000000..cd0723f --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllReports.json @@ -0,0 +1,75 @@ + +{ + "data":[ + { + "testid":1, + "deviceid":1, + "testName":"Network Layer", + "deviceName":"Router", + "execuationDetails":{"output": {"hostname": "google.com","testresult": "pass", "status": "reachable","statistics": "0% loss","ipaddress": "10.53.122.44","avgTime": "Minimum = 70ms"}}, + "result":"Pass", + "timeStamp":"2018-03-16" + }, + { + "testid":2, + "deviceid":1, + "testName":"Network Layer", + "deviceName":"Router", + "execuationDetails":{"output": {"hostname": "google.com","testresult": "fail", "status": "unreachable","statistics": "100% loss","ipaddress": "10.53.122.44","avgTime": "Minimum = 33ms"}}, + "result":"Pass", + "timeStamp":"2018-03-16" + }, + { + "testid":4, + "deviceid":1, + "testName":"Protocol Layer", + "deviceName":"Router", + "execuationDetails":{"output": {"status": "unreachable"}}, + "result":"Fail", + "timeStamp":"2018-03-08" + }, + { + "testid":5, + "deviceid":1, + "testName":"Protocol Layer", + "deviceName":"Router", + "execuationDetails":{"output": {"status": "reachable"}}, + "result":"Pass", + "timeStamp":"2018-03-15" + }, + { + "testid":6, + "deviceid":1, + "testName":"Network Layer", + "deviceName":"Router", + "execuationDetails":{"output": {"hostname": "google.com","testresult": "fail", "status": "unreachable","statistics": "100% loss","ipaddress": "10.53.122.44","avgTime": "Minimum = 33ms"}}, + "result":"Fail", + "timeStamp":"2018-03-15" + }, + { + "testid":7, + "deviceid":1, + "testName":"Network Layer", + "deviceName":"Router", + "execuationDetails":{"output": {"hostname": "google.com","testresult": "fail", "status": "unreachable","statistics": "100% loss","ipaddress": "10.53.122.44","avgTime": "Minimum = 50ms"}}, + "result":"Fail", + "timeStamp":"2018-03-15" + } + ], + "status":200, + "config":{ + "method":"GET", + "transformRequest":[ + null + ], + "transformResponse":[ + null + ], + "params":"", + "headers":{ + "Accept":"application/json" + }, + "url":"/findReportByDeviceName/Thu Mar 15 2018 00:00:00 GMT+0530 (India Standard Time)/Fri Mar 16 2018 00:00:00 GMT+0530 (India Standard Time)/Router" + }, + "statusText":"" +} \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllTest.json b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllTest.json new file mode 100644 index 0000000..fc9b290 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllTest.json @@ -0,0 +1,17 @@ + +{ + "testList":[ + { + "testId":"1", + "testName":"Test1" + }, + { + "testId":"2", + "testName":"Test2" + }, + { + "testId":"3", + "testName":"Test3" + } + ] +} \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllVNF.json b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllVNF.json new file mode 100644 index 0000000..4ebf951 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getAllVNF.json @@ -0,0 +1,29 @@ + +{ + "vnfList":[ + { + "IpAddress":"1.160.10.240", + "HostName":"Host1", + "Selected":false, + "PortNo":"8282" + }, + { + "IpAddress":"1.160.10.241", + "HostName":"Host2", + "Selected":false, + "PortNo":"8080" + }, + { + "IpAddress":"1.160.10.242", + "HostName":"Host3", + "Selected":false, + "PortNo":"8285" + }, + { + "IpAddress":"1.160.10.243", + "HostName":"Host4", + "Selected":false, + "PortNo":"8286" + } + ] +} \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getTestResult.json b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getTestResult.json new file mode 100644 index 0000000..581c8b0 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/sdnc-stubs/getTestResult.json @@ -0,0 +1,42 @@ + +{ + "preTestResponse":[ + { + "ipaddress":"1.160.10.240", + "status":"unreachable", + "testtype":"Network Layer", + "statistics":null, + "avgTime":null + }, + { + "ipaddress":"1.160.10.240", + "status":"unreachable", + "testtype":"Protocol Layer", + "statistics":null, + "avgTime":null + }, + { + "ipaddress":"1.160.10.240", + "status":"reachable", + "testtype":"Network Layer", + "statistics":"0% loss", + "avgTime":"Minimum = 70ms" + } + ], + "status":200, + "config":{ + "method":"GET", + "transformRequest":[ + null + ], + "transformResponse":[ + null + ], + "params":"", + "headers":{ + "Accept":"application/json" + }, + "url":"/findReportByDeviceName/Thu Mar 15 2018 00:00:00 GMT+0530 (India Standard Time)/Fri Mar 16 2018 00:00:00 GMT+0530 (India Standard Time)/Router" + }, + "statusText":"" +} \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/style/sdnc-style.css b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/style/sdnc-style.css new file mode 100644 index 0000000..9e627dc --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/style/sdnc-style.css @@ -0,0 +1,216 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + + body{ + padding-top:20px; + overflow-y:scroll; + } + +/* form styling */ +#form-container{ + margin-bottom:20px; + border-radius:5px; +} +#form-container .page-header{ + margin:0; padding:30px; + border-top-left-radius:5px; border-top-right-radius:5px; + } + + table.tableDisplay{ + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + border-collapse: collapse; + width: 100%; + table-layout: auto; +} + table.tableDisplay tr:nth-child(even){ + background-color: #C0C0C0; +} + table.tableDisplay th{ + padding-top: 12px; + padding-bottom: 12px; + text-align: left; + background: linear-gradient(to top, #f8f8f8 0%, #cce5ff 83%); + color: black; +} + table.tableDisplay td,table.tableDisplay th { + border: 1px solid #ddd; + padding: 8px; + width:30px; + +} + table.tableDisplay tr:{ + text-align: left; +} + table.tableDisplay tr:hover { + background-color:#cce5ff; +} + .first_row{ + background-color: #cce5ff; + color: black; + text-align:left; +} + .column { + float: left; + width: 32.2%; + padding: 10px; + margin-left:20px; + height: 60px; + /* Should be removed. Only for demonstration */ +} +/* Clear floats after the columns */ + .row:after { + content: ""; + display: table; + clear: both; +} + #btnSubmit{ + background-color: #cce5ff; + margin-top:20px; + margin-left:20px; + margin-bottom:10px; + width:100px; + height:30px; + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + border-collapse: collapse; + border: 1px solid #ddd; + font-weight:700; +} + .btndownload{ + background-color: #cce5ff; + margin-top:20px; + margin-bottom:10px; + margin-left:20px; + width:130px; + height:30px; + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + border-collapse: collapse; + border: 1px solid #ddd; + font-weight:700; +} + #exampleInput{ + margin-left:25px; + width:160px; +} + #exampleEndInput{ + margin-left:10px; +} + .error{ + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + color:Red; + font-size: 14px; + margin-bottom:10px; +} + .labeltext{ + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; +} + .sort-icon { + font-size: 9px; + margin-left: 5px; +} + th { + cursor:pointer; +} + .heading{ + margin-top:30px; + width:1100px; + height:45px; + margin-bottom:20px; + font-family:Trebuchet MS, Arial, Helvetica, sans-serif; + margin-right: -15px; + margin-left: 5px; + font-size: 20px; + background: linear-gradient(to top, #f8f8f8 0%, #cce5ff 83%); + padding-top:15px; + +} +form_validationBody{ + width:900px; + margin-left:15px; + margin-top:60px; + margin-bottom:20px; +} +button:hover { + position: relative; +} +button[title]:hover:after { + padding: 4px 8px; + position: absolute; + left: 0; + top: 100%; + white-space: nowrap; + z-index: 20px; + background:red; +} +.arrowRed { +font-size: 30px; +color: red; +} +.arrowGreen { +font-size: 30px; +color: green; +} +.ng-invalid { border: 1px solid red; } +.testMain{ + width:1100px; + margin-left:15px; + margin-top:60px; + margin-bottom:20px; +} +.testNotification{ + padding:0px; +} +.testImgIcon{ + margin-left:5px; + margin-right:10px; + padding-right:10px; +} +.testCol{ + background-color:#f2f2f2; + width:25%; + margin-left:35px; +} +.check{ + margin-left:10px; + margin-right:10px; +} +.btnRunTest{ + background-color:#f2f2f2; + width:75%; + height:75px; + margin-left:35px; + margin-bottom:35px; +} +.ReportMain{ + width:1100px; + margin-left:15px; + margin-top:60px; +} +.ReportNotification{ + padding:0px; + margin-right:10px; + text-align:center; +} +.ReportImgIcon{ + margin-left:5px; + margin-right:10px; +} +input[type=checkbox] { + padding-right: 3px;!important; + } diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/style/w3.css b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/style/w3.css new file mode 100644 index 0000000..e73d269 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/resources/static/style/w3.css @@ -0,0 +1,231 @@ +/* W3.CSS 4.10 February 2018 by Jan Egil and Borge Refsnes */ +html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit} +/* Extract from normalize.css by Nicolas Gallagher and Jonathan Neal git.io/normalize */ +html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0} +article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block} +audio,canvas,progress,video{display:inline-block}progress{vertical-align:baseline} +audio:not([controls]){display:none;height:0}[hidden],template{display:none} +a{background-color:transparent;-webkit-text-decoration-skip:objects} +a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted} +dfn{font-style:italic}mark{background:#ff0;color:#000} +small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} +sub{bottom:-0.25em}sup{top:-0.5em}figure{margin:1em 40px}img{border-style:none}svg:not(:root){overflow:hidden} +code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}hr{box-sizing:content-box;height:0;overflow:visible} +button,input,select,textarea{font:inherit;margin:0}optgroup{font-weight:bold} +button,input{overflow:visible}button,select{text-transform:none} +button,html [type=button],[type=reset],[type=submit]{-webkit-appearance:button} +button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner{border-style:none;padding:0} +button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring{outline:1px dotted ButtonText} +fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em} +legend{color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto} +[type=checkbox],[type=radio]{padding:0} +[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto} +[type=search]{-webkit-appearance:textfield;outline-offset:-2px} +[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none} +::-webkit-input-placeholder{color:inherit;opacity:0.54} +::-webkit-file-upload-button{-webkit-appearance:button;font:inherit} +/* End extract */ +html,body{font-family:Verdana,sans-serif;font-size:15px;line-height:1.5}html{overflow-x:hidden} +h1{font-size:36px}h2{font-size:30px}h3{font-size:24px}h4{font-size:20px}h5{font-size:18px}h6{font-size:16px}.w3-serif{font-family:serif} +h1,h2,h3,h4,h5,h6{font-family:"Segoe UI",Arial,sans-serif;font-weight:400;margin:10px 0}.w3-wide{letter-spacing:4px} +hr{border:0;border-top:1px solid #eee;margin:20px 0} +.w3-image{max-width:100%;height:auto}img{vertical-align:middle}a{color:inherit} +.w3-table,.w3-table-all{border-collapse:collapse;border-spacing:0;width:100%;display:table}.w3-table-all{border:1px solid #ccc} +.w3-bordered tr,.w3-table-all tr{border-bottom:1px solid #ddd}.w3-striped tbody tr:nth-child(even){background-color:#f1f1f1} +.w3-table-all tr:nth-child(odd){background-color:#fff}.w3-table-all tr:nth-child(even){background-color:#f1f1f1} +.w3-hoverable tbody tr:hover,.w3-ul.w3-hoverable li:hover{background-color:#ccc}.w3-centered tr th,.w3-centered tr td{text-align:center} +.w3-table td,.w3-table th,.w3-table-all td,.w3-table-all th{padding:8px 8px;display:table-cell;text-align:left;vertical-align:top} +.w3-table th:first-child,.w3-table td:first-child,.w3-table-all th:first-child,.w3-table-all td:first-child{padding-left:16px} +.w3-btn,.w3-button{border:none;display:inline-block;padding:8px 16px;vertical-align:middle;overflow:hidden;text-decoration:none;color:inherit;background-color:inherit;text-align:center;cursor:pointer;white-space:nowrap} +.w3-btn:hover{box-shadow:0 8px 16px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19)} +.w3-btn,.w3-button{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} +.w3-disabled,.w3-btn:disabled,.w3-button:disabled{cursor:not-allowed;opacity:0.3}.w3-disabled *,:disabled *{pointer-events:none} +.w3-btn.w3-disabled:hover,.w3-btn:disabled:hover{box-shadow:none} +.w3-badge,.w3-tag{background-color:#000;color:#fff;display:inline-block;padding-left:8px;padding-right:8px;text-align:center}.w3-badge{border-radius:50%} +.w3-ul{list-style-type:none;padding:0;margin:0}.w3-ul li{padding:8px 16px;border-bottom:1px solid #ddd}.w3-ul li:last-child{border-bottom:none} +.w3-tooltip,.w3-display-container{position:relative}.w3-tooltip .w3-text{display:none}.w3-tooltip:hover .w3-text{display:inline-block} +.w3-ripple:active{opacity:0.5}.w3-ripple{transition:opacity 0s} +.w3-input{padding:8px;display:block;border:none;border-bottom:1px solid #ccc;width:100%} +.w3-select{padding:9px 0;width:100%;border:none;border-bottom:1px solid #ccc} +.w3-dropdown-click,.w3-dropdown-hover{position:relative;display:inline-block;cursor:pointer} +.w3-dropdown-hover:hover .w3-dropdown-content{display:block} +.w3-dropdown-hover:first-child,.w3-dropdown-click:hover{background-color:#ccc;color:#000} +.w3-dropdown-hover:hover > .w3-button:first-child,.w3-dropdown-click:hover > .w3-button:first-child{background-color:#ccc;color:#000} +.w3-dropdown-content{cursor:auto;color:#000;background-color:#fff;display:none;position:absolute;min-width:160px;margin:0;padding:0;z-index:1} +.w3-check,.w3-radio{width:24px;height:24px;position:relative;top:6px} +.w3-sidebar{height:100%;width:200px;background-color:#fff;position:fixed!important;z-index:1;overflow:auto} +.w3-bar-block .w3-dropdown-hover,.w3-bar-block .w3-dropdown-click{width:100%} +.w3-bar-block .w3-dropdown-hover .w3-dropdown-content,.w3-bar-block .w3-dropdown-click .w3-dropdown-content{min-width:100%} +.w3-bar-block .w3-dropdown-hover .w3-button,.w3-bar-block .w3-dropdown-click .w3-button{width:100%;text-align:left;padding:8px 16px} +.w3-main,#main{transition:margin-left .4s} +.w3-modal{z-index:3;display:none;padding-top:100px;position:fixed;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4)} +.w3-modal-content{margin:auto;background-color:#fff;position:relative;padding:0;outline:0;width:600px} +.w3-bar{width:100%;overflow:hidden}.w3-center .w3-bar{display:inline-block;width:auto} +.w3-bar .w3-bar-item{padding:8px 16px;float:left;width:auto;border:none;display:block;outline:0} +.w3-bar .w3-dropdown-hover,.w3-bar .w3-dropdown-click{position:static;float:left} +.w3-bar .w3-button{white-space:normal} +.w3-bar-block .w3-bar-item{width:100%;display:block;padding:8px 16px;text-align:left;border:none;white-space:normal;float:none;outline:0} +.w3-bar-block.w3-center .w3-bar-item{text-align:center}.w3-block{display:block;width:100%} +.w3-responsive{display:block;overflow-x:auto} +.w3-container:after,.w3-container:before,.w3-panel:after,.w3-panel:before,.w3-row:after,.w3-row:before,.w3-row-padding:after,.w3-row-padding:before, +.w3-cell-row:before,.w3-cell-row:after,.w3-clear:after,.w3-clear:before,.w3-bar:before,.w3-bar:after{content:"";display:table;clear:both} +.w3-col,.w3-half,.w3-third,.w3-twothird,.w3-threequarter,.w3-quarter{float:left;width:100%} +.w3-col.s1{width:8.33333%}.w3-col.s2{width:16.66666%}.w3-col.s3{width:24.99999%}.w3-col.s4{width:33.33333%} +.w3-col.s5{width:41.66666%}.w3-col.s6{width:49.99999%}.w3-col.s7{width:58.33333%}.w3-col.s8{width:66.66666%} +.w3-col.s9{width:74.99999%}.w3-col.s10{width:83.33333%}.w3-col.s11{width:91.66666%}.w3-col.s12{width:99.99999%} +@media (min-width:601px){.w3-col.m1{width:8.33333%}.w3-col.m2{width:16.66666%}.w3-col.m3,.w3-quarter{width:24.99999%}.w3-col.m4,.w3-third{width:33.33333%} +.w3-col.m5{width:41.66666%}.w3-col.m6,.w3-half{width:49.99999%}.w3-col.m7{width:58.33333%}.w3-col.m8,.w3-twothird{width:66.66666%} +.w3-col.m9,.w3-threequarter{width:74.99999%}.w3-col.m10{width:83.33333%}.w3-col.m11{width:91.66666%}.w3-col.m12{width:99.99999%}} +@media (min-width:993px){.w3-col.l1{width:8.33333%}.w3-col.l2{width:16.66666%}.w3-col.l3{width:24.99999%}.w3-col.l4{width:33.33333%} +.w3-col.l5{width:41.66666%}.w3-col.l6{width:49.99999%}.w3-col.l7{width:58.33333%}.w3-col.l8{width:66.66666%} +.w3-col.l9{width:74.99999%}.w3-col.l10{width:83.33333%}.w3-col.l11{width:91.66666%}.w3-col.l12{width:99.99999%}} +.w3-content{max-width:980px;margin:auto}.w3-rest{overflow:hidden} +.w3-cell-row{display:table;width:100%}.w3-cell{display:table-cell} +.w3-cell-top{vertical-align:top}.w3-cell-middle{vertical-align:middle}.w3-cell-bottom{vertical-align:bottom} +.w3-hide{display:none!important}.w3-show-block,.w3-show{display:block!important}.w3-show-inline-block{display:inline-block!important} +@media (max-width:600px){.w3-modal-content{margin:0 10px;width:auto!important}.w3-modal{padding-top:30px} +.w3-dropdown-hover.w3-mobile .w3-dropdown-content,.w3-dropdown-click.w3-mobile .w3-dropdown-content{position:relative} +.w3-hide-small{display:none!important}.w3-mobile{display:block;width:100%!important}.w3-bar-item.w3-mobile,.w3-dropdown-hover.w3-mobile,.w3-dropdown-click.w3-mobile{text-align:center} +.w3-dropdown-hover.w3-mobile,.w3-dropdown-hover.w3-mobile .w3-btn,.w3-dropdown-hover.w3-mobile .w3-button,.w3-dropdown-click.w3-mobile,.w3-dropdown-click.w3-mobile .w3-btn,.w3-dropdown-click.w3-mobile .w3-button{width:100%}} +@media (max-width:768px){.w3-modal-content{width:500px}.w3-modal{padding-top:50px}} +@media (min-width:993px){.w3-modal-content{width:900px}.w3-hide-large{display:none!important}.w3-sidebar.w3-collapse{display:block!important}} +@media (max-width:992px) and (min-width:601px){.w3-hide-medium{display:none!important}} +@media (max-width:992px){.w3-sidebar.w3-collapse{display:none}.w3-main{margin-left:0!important;margin-right:0!important}} +.w3-top,.w3-bottom{position:fixed;width:100%;z-index:1}.w3-top{top:0}.w3-bottom{bottom:0} +.w3-overlay{position:fixed;display:none;width:100%;height:100%;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.5);z-index:2} +.w3-display-topleft{position:absolute;left:0;top:0}.w3-display-topright{position:absolute;right:0;top:0} +.w3-display-bottomleft{position:absolute;left:0;bottom:0}.w3-display-bottomright{position:absolute;right:0;bottom:0} +.w3-display-middle{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%)} +.w3-display-left{position:absolute;top:50%;left:0%;transform:translate(0%,-50%);-ms-transform:translate(-0%,-50%)} +.w3-display-right{position:absolute;top:50%;right:0%;transform:translate(0%,-50%);-ms-transform:translate(0%,-50%)} +.w3-display-topmiddle{position:absolute;left:50%;top:0;transform:translate(-50%,0%);-ms-transform:translate(-50%,0%)} +.w3-display-bottommiddle{position:absolute;left:50%;bottom:0;transform:translate(-50%,0%);-ms-transform:translate(-50%,0%)} +.w3-display-container:hover .w3-display-hover{display:block}.w3-display-container:hover span.w3-display-hover{display:inline-block}.w3-display-hover{display:none} +.w3-display-position{position:absolute} +.w3-circle{border-radius:50%} +.w3-round-small{border-radius:2px}.w3-round,.w3-round-medium{border-radius:4px}.w3-round-large{border-radius:8px}.w3-round-xlarge{border-radius:16px}.w3-round-xxlarge{border-radius:32px} +.w3-row-padding,.w3-row-padding>.w3-half,.w3-row-padding>.w3-third,.w3-row-padding>.w3-twothird,.w3-row-padding>.w3-threequarter,.w3-row-padding>.w3-quarter,.w3-row-padding>.w3-col{padding:0 8px} +.w3-container,.w3-panel{padding:0.01em 16px}.w3-panel{margin-top:16px;margin-bottom:16px} +.w3-code,.w3-codespan{font-family:Consolas,"courier new";font-size:16px} +.w3-code{width:auto;background-color:#fff;padding:8px 12px;border-left:4px solid #4CAF50;word-wrap:break-word} +.w3-codespan{color:crimson;background-color:#f1f1f1;padding-left:4px;padding-right:4px;font-size:110%} +.w3-card,.w3-card-2{box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12)} +.w3-card-4,.w3-hover-shadow:hover{box-shadow:0 4px 10px 0 rgba(0,0,0,0.2),0 4px 20px 0 rgba(0,0,0,0.19)} +.w3-spin{animation:w3-spin 2s infinite linear}@keyframes w3-spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}} +.w3-animate-fading{animation:fading 10s infinite}@keyframes fading{0%{opacity:0}50%{opacity:1}100%{opacity:0}} +.w3-animate-opacity{animation:opac 0.8s}@keyframes opac{from{opacity:0} to{opacity:1}} +.w3-animate-top{position:relative;animation:animatetop 0.4s}@keyframes animatetop{from{top:-300px;opacity:0} to{top:0;opacity:1}} +.w3-animate-left{position:relative;animation:animateleft 0.4s}@keyframes animateleft{from{left:-300px;opacity:0} to{left:0;opacity:1}} +.w3-animate-right{position:relative;animation:animateright 0.4s}@keyframes animateright{from{right:-300px;opacity:0} to{right:0;opacity:1}} +.w3-animate-bottom{position:relative;animation:animatebottom 0.4s}@keyframes animatebottom{from{bottom:-300px;opacity:0} to{bottom:0;opacity:1}} +.w3-animate-zoom {animation:animatezoom 0.6s}@keyframes animatezoom{from{transform:scale(0)} to{transform:scale(1)}} +.w3-animate-input{transition:width 0.4s ease-in-out}.w3-animate-input:focus{width:100%!important} +.w3-opacity,.w3-hover-opacity:hover{opacity:0.60}.w3-opacity-off,.w3-hover-opacity-off:hover{opacity:1} +.w3-opacity-max{opacity:0.25}.w3-opacity-min{opacity:0.75} +.w3-greyscale-max,.w3-grayscale-max,.w3-hover-greyscale:hover,.w3-hover-grayscale:hover{filter:grayscale(100%)} +.w3-greyscale,.w3-grayscale{filter:grayscale(75%)}.w3-greyscale-min,.w3-grayscale-min{filter:grayscale(50%)} +.w3-sepia{filter:sepia(75%)}.w3-sepia-max,.w3-hover-sepia:hover{filter:sepia(100%)}.w3-sepia-min{filter:sepia(50%)} +.w3-tiny{font-size:10px!important}.w3-small{font-size:12px!important}.w3-medium{font-size:15px!important}.w3-large{font-size:18px!important} +.w3-xlarge{font-size:24px!important}.w3-xxlarge{font-size:36px!important}.w3-xxxlarge{font-size:48px!important}.w3-jumbo{font-size:64px!important} +.w3-left-align{text-align:left!important}.w3-right-align{text-align:right!important}.w3-justify{text-align:justify!important}.w3-center{text-align:center!important} +.w3-border-0{border:0!important}.w3-border{border:1px solid #ccc!important} +.w3-border-top{border-top:1px solid #ccc!important}.w3-border-bottom{border-bottom:1px solid #ccc!important} +.w3-border-left{border-left:1px solid #ccc!important}.w3-border-right{border-right:1px solid #ccc!important} +.w3-topbar{border-top:6px solid #ccc!important}.w3-bottombar{border-bottom:6px solid #ccc!important} +.w3-leftbar{border-left:6px solid #ccc!important}.w3-rightbar{border-right:6px solid #ccc!important} +.w3-section,.w3-code{margin-top:16px!important;margin-bottom:16px!important} +.w3-margin{margin:16px!important}.w3-margin-top{margin-top:16px!important}.w3-margin-bottom{margin-bottom:16px!important} +.w3-margin-left{margin-left:16px!important}.w3-margin-right{margin-right:16px!important} +.w3-padding-small{padding:4px 8px!important}.w3-padding{padding:8px 16px!important}.w3-padding-large{padding:12px 24px!important} +.w3-padding-16{padding-top:16px!important;padding-bottom:16px!important}.w3-padding-24{padding-top:24px!important;padding-bottom:24px!important} +.w3-padding-32{padding-top:32px!important;padding-bottom:32px!important}.w3-padding-48{padding-top:48px!important;padding-bottom:48px!important} +.w3-padding-64{padding-top:64px!important;padding-bottom:64px!important} +.w3-left{float:left!important}.w3-right{float:right!important} +.w3-button:hover{color:#000!important;background-color:#ccc!important} +.w3-transparent,.w3-hover-none:hover{background-color:transparent!important} +.w3-hover-none:hover{box-shadow:none!important} +/* Colors */ +.w3-amber,.w3-hover-amber:hover{color:#000!important;background-color:#ffc107!important} +.w3-aqua,.w3-hover-aqua:hover{color:#000!important;background-color:#00ffff!important} +.w3-blue,.w3-hover-blue:hover{color:#fff!important;background-color:#2196F3!important} +.w3-light-blue,.w3-hover-light-blue:hover{color:#000!important;background-color:#87CEEB!important} +.w3-brown,.w3-hover-brown:hover{color:#fff!important;background-color:#795548!important} +.w3-cyan,.w3-hover-cyan:hover{color:#000!important;background-color:#00bcd4!important} +.w3-blue-grey,.w3-hover-blue-grey:hover,.w3-blue-gray,.w3-hover-blue-gray:hover{color:#fff!important;background-color:#607d8b!important} +.w3-green,.w3-hover-green:hover{color:#fff!important;background-color:#4CAF50!important} +.w3-light-green,.w3-hover-light-green:hover{color:#000!important;background-color:#8bc34a!important} +.w3-indigo,.w3-hover-indigo:hover{color:#fff!important;background-color:#3f51b5!important} +.w3-khaki,.w3-hover-khaki:hover{color:#000!important;background-color:#f0e68c!important} +.w3-lime,.w3-hover-lime:hover{color:#000!important;background-color:#cddc39!important} +.w3-orange,.w3-hover-orange:hover{color:#000!important;background-color:#ff9800!important} +.w3-deep-orange,.w3-hover-deep-orange:hover{color:#fff!important;background-color:#ff5722!important} +.w3-pink,.w3-hover-pink:hover{color:#fff!important;background-color:#e91e63!important} +.w3-purple,.w3-hover-purple:hover{color:#fff!important;background-color:#9c27b0!important} +.w3-deep-purple,.w3-hover-deep-purple:hover{color:#fff!important;background-color:#673ab7!important} +.w3-red,.w3-hover-red:hover{color:#fff!important;background-color:#f44336!important} +.w3-sand,.w3-hover-sand:hover{color:#000!important;background-color:#fdf5e6!important} +.w3-teal,.w3-hover-teal:hover{color:#fff!important;background-color:#009688!important} +.w3-yellow,.w3-hover-yellow:hover{color:#000!important;background-color:#ffeb3b!important} +.w3-white,.w3-hover-white:hover{color:#000!important;background-color:#fff!important} +.w3-black,.w3-hover-black:hover{color:#fff!important;background-color:#000!important} +.w3-grey,.w3-hover-grey:hover,.w3-gray,.w3-hover-gray:hover{color:#000!important;background-color:#9e9e9e!important} +.w3-light-grey,.w3-hover-light-grey:hover,.w3-light-gray,.w3-hover-light-gray:hover{color:#000!important;background-color:#f1f1f1!important} +.w3-dark-grey,.w3-hover-dark-grey:hover,.w3-dark-gray,.w3-hover-dark-gray:hover{color:#fff!important;background-color:#616161!important} +.w3-pale-red,.w3-hover-pale-red:hover{color:#000!important;background-color:#ffdddd!important} +.w3-pale-green,.w3-hover-pale-green:hover{color:#000!important;background-color:#ddffdd!important} +.w3-pale-yellow,.w3-hover-pale-yellow:hover{color:#000!important;background-color:#ffffcc!important} +.w3-pale-blue,.w3-hover-pale-blue:hover{color:#000!important;background-color:#ddffff!important} +.w3-text-amber,.w3-hover-text-amber:hover{color:#ffc107!important} +.w3-text-aqua,.w3-hover-text-aqua:hover{color:#00ffff!important} +.w3-text-blue,.w3-hover-text-blue:hover{color:#2196F3!important} +.w3-text-light-blue,.w3-hover-text-light-blue:hover{color:#87CEEB!important} +.w3-text-brown,.w3-hover-text-brown:hover{color:#795548!important} +.w3-text-cyan,.w3-hover-text-cyan:hover{color:#00bcd4!important} +.w3-text-blue-grey,.w3-hover-text-blue-grey:hover,.w3-text-blue-gray,.w3-hover-text-blue-gray:hover{color:#607d8b!important} +.w3-text-green,.w3-hover-text-green:hover{color:#4CAF50!important} +.w3-text-light-green,.w3-hover-text-light-green:hover{color:#8bc34a!important} +.w3-text-indigo,.w3-hover-text-indigo:hover{color:#3f51b5!important} +.w3-text-khaki,.w3-hover-text-khaki:hover{color:#b4aa50!important} +.w3-text-lime,.w3-hover-text-lime:hover{color:#cddc39!important} +.w3-text-orange,.w3-hover-text-orange:hover{color:#ff9800!important} +.w3-text-deep-orange,.w3-hover-text-deep-orange:hover{color:#ff5722!important} +.w3-text-pink,.w3-hover-text-pink:hover{color:#e91e63!important} +.w3-text-purple,.w3-hover-text-purple:hover{color:#9c27b0!important} +.w3-text-deep-purple,.w3-hover-text-deep-purple:hover{color:#673ab7!important} +.w3-text-red,.w3-hover-text-red:hover{color:#f44336!important} +.w3-text-sand,.w3-hover-text-sand:hover{color:#fdf5e6!important} +.w3-text-teal,.w3-hover-text-teal:hover{color:#009688!important} +.w3-text-yellow,.w3-hover-text-yellow:hover{color:#d2be0e!important} +.w3-text-white,.w3-hover-text-white:hover{color:#fff!important} +.w3-text-black,.w3-hover-text-black:hover{color:#000!important} +.w3-text-grey,.w3-hover-text-grey:hover,.w3-text-gray,.w3-hover-text-gray:hover{color:#757575!important} +.w3-text-light-grey,.w3-hover-text-light-grey:hover,.w3-text-light-gray,.w3-hover-text-light-gray:hover{color:#f1f1f1!important} +.w3-text-dark-grey,.w3-hover-text-dark-grey:hover,.w3-text-dark-gray,.w3-hover-text-dark-gray:hover{color:#3a3a3a!important} +.w3-border-amber,.w3-hover-border-amber:hover{border-color:#ffc107!important} +.w3-border-aqua,.w3-hover-border-aqua:hover{border-color:#00ffff!important} +.w3-border-blue,.w3-hover-border-blue:hover{border-color:#2196F3!important} +.w3-border-light-blue,.w3-hover-border-light-blue:hover{border-color:#87CEEB!important} +.w3-border-brown,.w3-hover-border-brown:hover{border-color:#795548!important} +.w3-border-cyan,.w3-hover-border-cyan:hover{border-color:#00bcd4!important} +.w3-border-blue-grey,.w3-hover-border-blue-grey:hover,.w3-border-blue-gray,.w3-hover-border-blue-gray:hover{border-color:#607d8b!important} +.w3-border-green,.w3-hover-border-green:hover{border-color:#4CAF50!important} +.w3-border-light-green,.w3-hover-border-light-green:hover{border-color:#8bc34a!important} +.w3-border-indigo,.w3-hover-border-indigo:hover{border-color:#3f51b5!important} +.w3-border-khaki,.w3-hover-border-khaki:hover{border-color:#f0e68c!important} +.w3-border-lime,.w3-hover-border-lime:hover{border-color:#cddc39!important} +.w3-border-orange,.w3-hover-border-orange:hover{border-color:#ff9800!important} +.w3-border-deep-orange,.w3-hover-border-deep-orange:hover{border-color:#ff5722!important} +.w3-border-pink,.w3-hover-border-pink:hover{border-color:#e91e63!important} +.w3-border-purple,.w3-hover-border-purple:hover{border-color:#9c27b0!important} +.w3-border-deep-purple,.w3-hover-border-deep-purple:hover{border-color:#673ab7!important} +.w3-border-red,.w3-hover-border-red:hover{border-color:#f44336!important} +.w3-border-sand,.w3-hover-border-sand:hover{border-color:#fdf5e6!important} +.w3-border-teal,.w3-hover-border-teal:hover{border-color:#009688!important} +.w3-border-yellow,.w3-hover-border-yellow:hover{border-color:#ffeb3b!important} +.w3-border-white,.w3-hover-border-white:hover{border-color:#fff!important} +.w3-border-black,.w3-hover-border-black:hover{border-color:#000!important} +.w3-border-grey,.w3-hover-border-grey:hover,.w3-border-gray,.w3-hover-border-gray:hover{border-color:#9e9e9e!important} +.w3-border-light-grey,.w3-hover-border-light-grey:hover,.w3-border-light-gray,.w3-hover-border-light-gray:hover{border-color:#f1f1f1!important} +.w3-border-dark-grey,.w3-hover-border-dark-grey:hover,.w3-border-dark-gray,.w3-hover-border-dark-gray:hover{border-color:#616161!important} +.w3-border-pale-red,.w3-hover-border-pale-red:hover{border-color:#ffe7e7!important}.w3-border-pale-green,.w3-hover-border-pale-green:hover{border-color:#e7ffe7!important} +.w3-border-pale-yellow,.w3-hover-border-pale-yellow:hover{border-color:#ffffcc!important}.w3-border-pale-blue,.w3-hover-border-pale-blue:hover{border-color:#e7ffff!important} \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/WEB-INF/views/index.jsp b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/WEB-INF/views/index.jsp new file mode 100644 index 0000000..f479ff9 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/WEB-INF/views/index.jsp @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/app.js b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/app.js new file mode 100644 index 0000000..82fac46 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/app.js @@ -0,0 +1,47 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +// app.js This is first entry point for the application +// ============================================================================= +var myApp = angular.module('myApp', ['ngRoute', 'ngSanitize', 'ngCsv', 'angularUtils.directives.dirPagination', 'angular-growl','ng-ip-address']); + +// configuring our routes +// ============================================================================= +myApp.config(['$routeProvider', function($routeProvider) { + + //Called when user select pre validation test from the UI + $routeProvider. + when('/testValidation', { + templateUrl: 'form-validationTest.html', + controller: 'TestController' + }). + when('/', { + templateUrl: 'form-validationTest.html', + controller: 'TestController' + }). + //Called when user select view test report from the UI + when('/testReports', { + templateUrl: 'form-viewReport.html', + controller: 'ReportController' + }). + otherwise({ + redirectTo: 'form-validationTest.html' + }); +}]); \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-controller/sdnc-validationTest-controller.js b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-controller/sdnc-validationTest-controller.js new file mode 100644 index 0000000..9d3f253 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-controller/sdnc-validationTest-controller.js @@ -0,0 +1,243 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +myApp.controller('TestController', ['$scope', '$http', 'growl', 'viewReportService', 'validationTestService', function($scope, $http, growl, viewReportService, validationTestService) { + + $scope.showTestReport = false; + + //Input data for validation test dropdwon + var validationTestList = [{ + "typeId": 1, + "validationType": "Network Layer", + "Selected": false + }, + { + "typeId": 2, + "validationType": "Protocol Layer", + "Selected": false + } + ]; + + $scope.validationTestList = validationTestList; + + + $scope.getselectval = function() { + $scope.selectedvalues = 'Name: ' + $scope.selitem.validationType + ' Id: ' + $scope.selitem.typeId; + } + + $scope.showError = false; + $scope.errorMessage = ""; + $scope.showSuccess = false; + $scope.successMessage = ""; + $scope.showWarning = false; + $scope.warningMessage = ""; + $scope.showInfo = false; + $scope.infoMessage = ""; + $scope.ShowResult = false; + $scope.allowTestSelection = false; + $scope.hostNamePattern = /([a-z0-9](.[a-z0-9-]*[a-z0-9]))/; + + + //service call to fetch the all the test name + $scope.getAllVNF = function() { + + validationTestService.getAllVNF().then(function(data) { + if (data != null) { + console.log(data); + $scope.objvnfList = data.vnfList; + console.log("--TestController:getAllVNF called--" + $scope.objvnfList); + $scope.allowTestSelection = true; + } else { + $scope.showWarninf = true; + $scope.warningMessage = "No VNF is eligible for confirgruation!!!"; + growl.error($scope.warningMessage, { + title: 'Warning!' + }); + } + }); + }; + $scope.getAllVNF(); + + //Called when user selects a test type + $scope.updateSelection = function(position, items, valType) { + angular.forEach(items, function(val, index) { + if (position != index) + val.checked = false; + $scope.selectedTest = valType; + console.log("--TestController::updateSelection--", $scope.selectedTest); + }); + + if ($scope.IPAddress != null && $scope.HostName != null && valType != null) { + $scope.showError = false; + } + } + + + //Called when user clicks on runtest + $scope.runTest = function() { + + $scope.showError = false; + $scope.vnfSelected = []; + $scope.testSelected = []; + + var message = ""; + for (var i = 0; i < $scope.validationTestList.length; i++) { + if ($scope.validationTestList[i].Selected) { + var typeId = $scope.validationTestList[i].typeId; + var validationType = $scope.validationTestList[i].validationType; + message += "typeId: " + typeId + " validationType: " + validationType + "\n"; + console.log("--TestController::Runtest--", message); + var testDetails = {}; + testDetails.typeId = typeId; + testDetails.validationType = validationType; + $scope.testSelected.push(testDetails); + } + } + console.log("--TestController::Runtest--", JSON.stringify($scope.testSelected)); + + var vnfDetails = {}; + if ($scope.IPAddress != null && $scope.HostName != null && $scope.testSelected.length >= 1) { + vnfDetails.IpAddress = $scope.IPAddress; + vnfDetails.HostName = $scope.HostName; + $scope.vnfSelected.push(vnfDetails); + console.log("--TestController::Runtest--", JSON.stringify($scope.vnfSelected)); + + //Call the validation test service with json file and testType as the parameter + + validationTestService.runPretest($scope.vnfSelected, $scope.testSelected).then(function(response) { + console.log("--TestController::runTest--", JSON.stringify(response)); + //in case of success, build the model object to store the service output here + if (response.status === 200) { + if (response.preTestResponse != null && response.preTestResponse.length >= 1) { + $scope.ShowResult = true; + $scope.createTestModel(response.preTestResponse); + $scope.showMessage(response.preTestResponse); + + } else { + console.log(response); + $scope.showError = true; + $scope.errorMessage = "Something went wrong!!!"; + growl.error($scope.errorMessage, { + title: 'Error!' + }); + } + } else { + console.log(response); + $scope.showError = true; + $scope.errorMessage = "Pre test validation failed!!! Check the report for more details"; + growl.error($scope.errorMessage, { + title: 'Error!' + }); + } + }, + function(response) { + console.log("--TestController--", response); + }); + } else { + $scope.showError = true; + $scope.errorMessage = "Please provide the inputs for VNF and test to be performed!!"; + growl.error($scope.errorMessage, { + title: 'Error!' + }); + } + + }; + + $scope.showMessage=function(data){ + + if(angular.isDefined(data) && data.length>=1){ + + angular.forEach(data, function(value, key){ + if(value.status == "unreachable"){ + console.log("--TestController::showMessage--",value.status); + $scope.showError = true; + $scope.errorMessage = "PreTest validation Failed, Please check logs for further details!!!"; + growl.error($scope.errorMessage, { + title: 'Error!' + }); + } + else + { + $scope.showSuccess = true; + $scope.successMessage = "Pre test validation completed!!"; + growl.success($scope.successMessage, { + title: 'Success!' + }); + } + + }); + + } + } + + //Function to build the UI model to be shown + $scope.createTestModel = function(result) { + + $scope.showError = false; + $scope.showWarning = false; + $scope.objPreTestModel = result; + $scope.objPreTest = []; + + + if ($scope.objPreTestModel.length > 1) { + for (var i = 0; i < $scope.objPreTestModel.length; i++) { + var objTestReport = {}; + objTestReport.ipaddress = $scope.objPreTestModel[i].ipaddress; + objTestReport.status = $scope.objPreTestModel[i].status; + objTestReport.testtype = $scope.objPreTestModel[i].testtype; + objTestReport.statistics = $scope.objPreTestModel[i].statistics; + objTestReport.avgTime = $scope.objPreTestModel[i].avgTime; + + + if ($scope.objPreTestModel[i].testtype === "Network Layer") { + if (objTestReport.statistics != null) { + //fetching the statistics to show in progress bar + var statistics = objTestReport.statistics; + statistics = statistics.split("%"); + objTestReport.statistics = statistics[0]; + if (objTestReport.statistics == 0) { + objTestReport.statisticPer = parseInt(objTestReport.statistics) + 50; + } else + objTestReport.statisticPer = objTestReport.statistics; + } + + //fetching the avg time to show in progress bar + if (objTestReport.avgTime != null) { + var avgTime = objTestReport.avgTime; + avgTime = avgTime.split("="); + var Testtime = avgTime[1]; + objTestReport.avgTime = Testtime.slice(0, -2).trim(); + console.log("--TestController::createTestModel--", objTestReport.avgTime); + if (objTestReport.avgTime < 50) { + objTestReport.avgTimePer = parseInt(objTestReport.avgTime) + 10; + } else + objTestReport.avgTimePer = objTestReport.avgTime; + + } + } + $scope.objPreTest.push(objTestReport); + console.log("--TestController::createTestModel--", JSON.stringify($scope.objPreTest)); + } + } + console.log("--TestController::createTestModel::final PreTestModel--" + JSON.stringify($scope.objPreTest)); + + } + +}]); \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-controller/sdnc-viewreport-controller.js b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-controller/sdnc-viewreport-controller.js new file mode 100644 index 0000000..a3eae18 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-controller/sdnc-viewreport-controller.js @@ -0,0 +1,171 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +myApp.controller('ReportController', ['$scope', '$http', 'viewReportService', 'growl', function($scope, $http, viewReportService, growl) { + $scope.isDisabled = true; + $scope.pagination = false; + $scope.selectedDevice; + $scope.ShowResult = false; + $scope.dateValidation = false; + $scope.NoSearchResult = false; + $scope.showError = false; + $scope.errorMessage = ""; + $scope.showSuccess = false; + $scope.successMessage = ""; + $scope.showWarning = false; + $scope.warningMessage = ""; + $scope.showExecutionDetails = true; + + //THIS FUNCTION WILL BE CALLED WHEN USER CLICK SUBMIT FROM UI + $scope.getReports = function(deviceName, startdate, enddate) { + + $scope.ShowResult = false; + if (new Date(startdate) > new Date(enddate)) { + $scope.dateValidation = true; + $scope.showError = true; + $scope.errorMessage = "Start date cannot be greated than End date"; + growl.error($scope.errorMessage, { + title: 'Error!' + }); + return false; + } + var date = new Date(startdate); + if (angular.isDefined(deviceName)) { + $scope.DeviceName = deviceName; + } + if (angular.isDefined(startdate)) { + $scope.startDate = startdate; + } + if (angular.isDefined(enddate)) { + $scope.endDate = enddate; + } + + //to generate the dynamic file name while downloading the report + //var date = new Date(); + // $scope.fileName = $scope.TestName + " " + $scope.TestName + date.csv; + // console.log("FileName", $scope.fileName); + + if (deviceName != null && startdate != null && enddate != null) { + + //service call to fetch the reports start date,end date,test name + viewReportService.getData($scope.startDate, $scope.endDate, $scope.DeviceName).then(function(result) { + console.log("--ReportController::getdata called from controler--", JSON.stringify(result.data)); + if (result.status == 200) { + if (result.data != null && result.data.length >= 1) { + //in case of success, build the model object to store the service output here + $scope.createTestReportModel(result.data); + } else { + $scope.ShowResult = false; + $scope.showWarning = true; + $scope.warningMessage = "No result found for specified Device name !!"; + growl.warning($scope.warningMessage, { + title: 'Warning!' + }); + } + } else { + $scope.ShowResult = false; + $scope.showWarning = true; + $scope.warningMessage = "No result found for specified Device name !!"; + growl.warning($scope.warningMessage, { + title: 'Warning!' + }); + } + }, + function(response) { + console.log("--ReportController::getdata::Error--", response); + }); + } + } + + + //FUNCTION WILL BE CALLED WHEN USER CLICK DOWNLOAD FROM UI + $scope.exportToExcel = function(tableId) { // ex: '#my-table' + var exportHref = Excel.tableToExcel(tableId, 'export'); + $timeout(function() { + location.href = exportHref; + }, 100); // trigger download + + console.log("--ReportController::exportToexcel--"); + } + + $scope.createTestReportModel = function(result) { + + $scope.showError = false; + $scope.showWarning = false; + $scope.objTestReportModel = result; + $scope.objTestModel = []; + + + if ($scope.objTestReportModel.length >= 1) { + for (var i = 0; i < $scope.objTestReportModel.length; i++) { + var objTestReport = {}; + objTestReport.testid = $scope.objTestReportModel[i].testid; + objTestReport.deviceid = $scope.objTestReportModel[i].deviceid; + objTestReport.deviceName = $scope.objTestReportModel[i].deviceName; + objTestReport.result = $scope.objTestReportModel[i].result; + objTestReport.timeStamp = $scope.objTestReportModel[i].timeStamp; + objTestReport.testname = $scope.objTestReportModel[i].testName; + + var executionDetails = {}; + $scope.tmp = angular.fromJson($scope.objTestReportModel[i].execuationDetails); + executionDetails = $scope.tmp.output;//$scope.objTestReportModel[i].execuationDetails.output; + + if ($scope.objTestReportModel[i].testName === "Network Layer") { + //fetching the statistics to show in progress bar + var statistics = executionDetails.statistics; + objTestReport.status = executionDetails.status; + objTestReport.statistics = executionDetails.statistics; + statistics = statistics.split("%"); + executionDetails.statistics = statistics[0]; + if (executionDetails.statistics == 0) { + executionDetails.statisticPer = parseInt(executionDetails.statistics) + 50; + } else + executionDetails.statisticPer = executionDetails.statistics; + + console.log("--ReportController::CreateTestReportModel--", executionDetails.statistics); + + //fetching the avg time to show in progress bar + var avgTime = executionDetails.avgTime; + objTestReport.avgTime = executionDetails.avgTime; + avgTime = avgTime.split("="); + var Testtime = avgTime[1]; + executionDetails.avgTime = Testtime.slice(0, -2).trim(); + console.log("--ReportController::CreateTestReportModel--", executionDetails.avgTime); + if (executionDetails.avgTime < 50) { + executionDetails.avgTimePer = parseInt(executionDetails.avgTime) + 10; + } else + executionDetails.avgTimePer = executionDetails.avgTime; + + } + + + objTestReport.executionDetails = executionDetails; + $scope.objTestModel.push(objTestReport); + console.log("--ReportController::CreateTestReportModel--", JSON.stringify($scope.objTestModel)); + + } + $scope.ShowResult = true; + $scope.pagination = true; + } + console.log("--ReportController::createTestReportModel::final TestReportModel--" + JSON.stringify($scope.objTestModel)); + $scope.csvOrder = ['testname', 'deviceName', 'timeStamp', 'status', 'statistics', 'avgTime', 'result']; + + } +}]); \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-services/sdnc-validationTest-service.js b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-services/sdnc-validationTest-service.js new file mode 100644 index 0000000..c82dc92 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-services/sdnc-validationTest-service.js @@ -0,0 +1,78 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +myApp.service('validationTestService', ['$http', function($http) { + + + this.getAllVNF = function() { + var testlist = {}; + return $http.get('./sdnc-stubs/getAllVNF.json') + .then(function(response) { + console.log("---validationTestService::getAllVNF::TestResponse---" + JSON.stringify(response)); + vnflist = response.data; + return vnflist; + }, + function(response) { + console.log("validationTestService::getAllVNF::Status Code", response.status); + return response; + }); + + }; + + this.runPretest = function(vnfList, validationTestType) { + + + var data = {}; + data.vnfList = vnfList; + data.validationTestType = validationTestType; + + var config = { + params: data, + headers: { + 'Accept': 'application/json' + } + }; + + console.log("validationTestService::runPretest::config", JSON.stringify(config)); + + // Call the pre validation service + var request = { + method: 'POST', + url: '/runtest', + data: data, + headers: { + 'Content-Type': undefined + } + }; + + // // SEND VNF FOR VALIDATION + return $http(request) + .then(function(response) { + console.log("---validationTestService::uploadFile::Response---" + JSON.stringify(response)); + return response.data; + }, + function(response) { + console.log("--validationTestService::Status Code--", response.status); + return response; + }); + + + } + +}]); \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-services/sdnc-viewReport-service.js b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-services/sdnc-viewReport-service.js new file mode 100644 index 0000000..3b49fca --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/js/sdnc-services/sdnc-viewReport-service.js @@ -0,0 +1,78 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +myApp.service('viewReportService', ['$http', function($http) { + this.getData = function(startDate, endDate, deviceName) { + + var data = {}; + if (startDate != null && endDate != null && deviceName != null) { + + data.startdate = startDate; + data.enddate = endDate; + data.devicename = deviceName; + + } + var config = { + params: '', + headers: { + 'Accept': 'application/json' + } + }; + + var sdate = new Date(startDate); + var edate = new Date(endDate); + + var objTestList = {}; + // return $http.get('sdnc-stubs/getAllReports.json', config) + return $http.get('/findReportByDeviceName/'+sdate+'/'+edate+'/'+deviceName,config) + .then(function(result) { + console.log("--viewReportService::getdata::Testresponse--", JSON.stringify(result)); + objTestList = result.data; + console.log("--viewReportService::getdata::Testresponse--", +JSON.stringify(objTestList)); + return result; + }); + + }; + + + this.getAllDevices = function() { + var deviceResponse = {}; + return $http.get('sdnc-stubs/getAllDevices.json') + .then(function(response) { + console.log("--getAlldevices" + JSON.stringify(response)); + deviceResponse = response.data; + console.log("----viewReportService::getAlldevices::deviceResponse--" + JSON.stringify(deviceResponse)); + return deviceResponse; + }); + + }; + + + this.getAllTest = function() { + var testlist = {}; + return $http.get('sdnc-stubs/getAllTest.json') + .then(function(response) { + console.log("---viewReportService::getAllTest::TestResponse---" + JSON.stringify(response)); + testlist = response.data; + return testlist; + }); + + }; +}]); \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/package.json b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/package.json new file mode 100644 index 0000000..ffb9715 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/main/webapp/package.json @@ -0,0 +1,32 @@ +{ + "name": "myapp", + "version": "1.0.0", + "description": "list of node modules for myapp", + "main": "app.js", + "scripts": { + "test": "standard" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/NMSVishal/SDNCReports.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/NMSVishal/SDNCReports/issues" + }, + "homepage": "https://github.com/NMSVishal/SDNCReports#readme", + "dependencies": { + "angular": "^1.6.9", + "angular-growl": "^0.1.0", + "angular-mocks": "^1.6.9", + "angular-route": "^1.6.9", + "angular-sanitize": "^1.6.9", + "angular-utils-pagination": "^0.11.1", + "angularjs-datetime-picker": "^0.1.16", + "bootstrap": "^4.0.0", + "jquery": "^3.3.1", + "ng-csv": "^0.3.6", + "ng-ip-address": "^1.1.12" + } +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/controller/ReportControllerTest.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/controller/ReportControllerTest.java new file mode 100644 index 0000000..8b407cc --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/controller/ReportControllerTest.java @@ -0,0 +1,107 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.controller; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.onap.sdnc.reports.Application; +import com.onap.sdnc.reports.controller.ReportController; +import com.onap.sdnc.reports.model.DeviceConfig; +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.rest.model.PreTestModel; +import com.onap.sdnc.reports.service.IReportService; + +import static org.mockito.Mockito.when; +import org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestDatabase; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; + +//@RunWith(SpringRunner.class) +//@ContextConfiguration(classes=Application.class) +//@WebMvcTest(ReportController.class) +//@Transactional +//@DataJpaTest +//@AutoConfigureTestDatabase(replace=AutoConfigureTestDatabase.Replace.NONE) +public class ReportControllerTest { + +/* @Autowired + private MockMvc mvc; + + @MockBean + private IReportService reportService; + + private Date startDate,endDate; + + @Test + public void whenFindReportByDeviceName_thenReturnThis() + throws Exception { + Calendar calendar=Calendar.getInstance(); + + calendar.add(Calendar.DATE, -7); + calendar.add(Calendar.HOUR_OF_DAY, 00); + calendar.add(Calendar.MINUTE, 00); + calendar.add(Calendar.SECOND, 00); + calendar.add(Calendar.MILLISECOND, 00); + startDate=calendar.getTime(); + + Calendar endDateCalendar=Calendar.getInstance(); + + endDateCalendar.add(Calendar.HOUR_OF_DAY, 23); + endDateCalendar.add(Calendar.MINUTE, 59); + calendar.add(Calendar.SECOND, 00); + endDateCalendar.add(Calendar.MILLISECOND, 00); + endDate=endDateCalendar.getTime(); + + PreTestModel preTestModel=new PreTestModel(1, 1, "NetWorkTest", "Router", "Ping Got Successful", "Pass",endDate); + + List allTests = Arrays.asList(preTestModel); + + //given(reportService.findReportByDeviceName(startDate,endDate,"Router")).willReturn(allTests); + + when(reportService.findReportByDeviceName(startDate,endDate,"Router")).thenReturn(allTests); + + mvc.perform(get("/findReportByDeviceName/{startDate}/{endDate}/{deviceName",startDate,endDate,"Router") + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()); + }*/ +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/repository/PreTestConfigRepositoryTest.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/repository/PreTestConfigRepositoryTest.java new file mode 100644 index 0000000..e70b04b --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/repository/PreTestConfigRepositoryTest.java @@ -0,0 +1,145 @@ +package com.onap.sdnc.reports.repository; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.transaction.Transactional; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.onap.sdnc.reports.Application; +//import com.onap.sdnc.reports.model.DeviceConfig; +//import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.model.DeviceConfig; +import com.onap.sdnc.reports.model.PreTestConfig; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +//@AutoConfigureTestDatabase(replace=AutoConfigureTestDatabase.Replace.NONE) +@DataJpaTest +@Transactional +public class PreTestConfigRepositoryTest { + + private static final Logger logger = LogManager.getLogger(Application.class); + + @Autowired + private PreTestConfigRepository preTestRepository; + + @Autowired + private TestEntityManager entityManager; + + + @Test + public void whenFindByDeviceName_thenReturnRouter() { + // given + + + DeviceConfig deviceConfig=new DeviceConfig(); + //deviceConfig.setId(3); + deviceConfig.setDeviceName("Router"); + deviceConfig.setPreTestConfig(null); + deviceConfig.setProtocolConfig(null); + deviceConfig.setCreationDate(new Date().toLocaleString()); + + entityManager.persist(deviceConfig); + entityManager.flush(); + + PreTestConfig obj=new PreTestConfig(); + obj.setDevice(deviceConfig); + obj.setExecuationDetails("Ping Successful"); + obj.setResult("Pass"); + //obj.setTestId(8); + obj.setTestName("Network Layer"); + obj.setTimestamp(new Date()); + + Set set=new HashSet<>(); + set.add(obj); + deviceConfig.setPreTestConfig( set); + entityManager.persistAndFlush(deviceConfig); + + entityManager.persist(obj); + entityManager.flush(); + + Calendar calendar=Calendar.getInstance(); + + calendar.add(Calendar.DATE, -7); + Date startDate=calendar.getTime(); + Date endDate=new Date(); + // when + List preTestList = preTestRepository.findReportByDeviceName(startDate,endDate,"Router"); + + assertThat(preTestList.get(0).getTestId()) + .isEqualTo(obj.getTestId()); + + System.out.println("Status : "+(preTestList.get(0).getTestId()==obj.getTestId())); + } + + /*@Test + public void whenFindByDeviceName_thenReturnRouter() { + // given + + PreTestConfigRepository preTestRepository= mock(PreTestConfigRepository.class); + DeviceConfig deviceConfig=new DeviceConfig(); + //deviceConfig.setId(3); + deviceConfig.setDeviceName("Router"); + deviceConfig.setPreTestConfig(null); + deviceConfig.setProtocolConfig(null); + deviceConfig.setCreationDate(new Date().toLocaleString()); + + + + PreTestConfig obj=new PreTestConfig(); + obj.setDevice(deviceConfig); + obj.setExecuationDetails("Ping Successful"); + obj.setResult("Pass"); + //obj.setTestId(8); + obj.setTestName("Network Layer"); + obj.setTimestamp(new Date()); + + Set set=new HashSet<>(); + set.add(obj); + deviceConfig.setPreTestConfig( set); + + List dummyInput=new ArrayList<>(); + dummyInput.add(obj); + + Calendar calendar=Calendar.getInstance(); + + calendar.add(Calendar.DATE, -7); + Date startDate=calendar.getTime(); + Date endDate=new Date(); + // when + + when(preTestRepository.findReportByDeviceName(startDate,endDate,"Router")).thenReturn(dummyInput); + + List preTestList = preTestRepository.findReportByDeviceName(startDate,endDate,"Router"); + + assertThat(preTestList.get(0).getTestId()) + .isEqualTo(obj.getTestId()); + + logger.info("Status : "+(preTestList.get(0).getTestId()==obj.getTestId())); + }*/ + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/service/ReportServiceImplTest.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/service/ReportServiceImplTest.java new file mode 100644 index 0000000..b688f58 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/java/com/onap/sdnc/reports/service/ReportServiceImplTest.java @@ -0,0 +1,204 @@ +package com.onap.sdnc.reports.service; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Bean; +import org.springframework.test.context.junit4.SpringRunner; + +import com.onap.sdnc.reports.Application; +import com.onap.sdnc.reports.model.DeviceConfig; +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.repository.PreTestConfigRepository; +import com.onap.sdnc.reports.rest.model.PreTestModel; + +import org.mockito.InjectMocks; +import org.mockito.Mock; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +@DataJpaTest +@Transactional +public class ReportServiceImplTest { + + private static final Logger logger = LogManager.getLogger(Application.class); + + private Date startDate,endDate; + +/* @TestConfiguration + static class ReportServiceImplTestContextConfiguration + { + @Bean + public IReportService reportService() + { + return new ReportServiceImpl(); + } + } + + @Autowired + private IReportService reportService; + + @MockBean + private PreTestConfigRepository preTestConfigRepository; + + @Before + public void setUp() + { + DeviceConfig deviceConfig=new DeviceConfig(); + deviceConfig.setDeviceName("Router"); + deviceConfig.setPreTestConfig(null); + deviceConfig.setProtocolConfig(null); + deviceConfig.setCreationDate(new Date().toLocaleString()); + + PreTestConfig obj=new PreTestConfig(); + obj.setDevice(deviceConfig); + obj.setExecuationDetails("Ping Successful"); + obj.setResult("Pass"); + + obj.setTestName("Network Layer"); + obj.setTimestamp(new Date()); + + + Calendar calendar=Calendar.getInstance(); + + calendar.add(Calendar.DATE, -7); + calendar.add(Calendar.HOUR_OF_DAY, 00); + calendar.add(Calendar.MINUTE, 00); + calendar.add(Calendar.SECOND, 00); + calendar.add(Calendar.MILLISECOND, 00); + startDate=calendar.getTime(); + + Calendar endDateCalendar=Calendar.getInstance(); + + endDateCalendar.add(Calendar.HOUR_OF_DAY, 23); + endDateCalendar.add(Calendar.MINUTE, 59); + calendar.add(Calendar.SECOND, 00); + endDateCalendar.add(Calendar.MILLISECOND, 00); + endDate=endDateCalendar.getTime(); + + System.out.println("Before Call : startDate "+startDate.toLocaleString() +" endDate : "+endDate.toLocaleString()); + List configList=new ArrayList<>(); + configList.add(obj); + Mockito.when(preTestConfigRepository.findReportByDeviceName(startDate,endDate,"Router")) + .thenReturn(configList); + } + + + @Test + public void whenFindByDeviceName_thenReturPreTest() + { + int expectedTestId=0; + System.out.println("Test Call : startDate "+startDate.toLocaleString() +" endDate : "+endDate.toLocaleString()); + + List testList; + try { + testList = reportService.findReportByDeviceName(startDate,endDate,"Router"); + assertThat(testList.get(0).getTestid()) + .isEqualTo(expectedTestId); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + } + */ + /* @InjectMocks + private IReportService reportService; + + @Mock + private PreTestConfigRepository preTestConfigRepository;*/ + + List configList; + + List dummyList; + @Before + public void setUp() + { + DeviceConfig deviceConfig=new DeviceConfig(); + deviceConfig.setDeviceName("Router"); + deviceConfig.setPreTestConfig(null); + deviceConfig.setProtocolConfig(null); + deviceConfig.setCreationDate(new Date().toLocaleString()); + + PreTestConfig obj=new PreTestConfig(); + obj.setDevice(deviceConfig); + obj.setExecuationDetails("Ping Successful"); + obj.setResult("Pass"); + + obj.setTestName("Network Layer"); + obj.setTimestamp(new Date()); + + PreTestModel model=new PreTestModel(1, 1, "Protocol Layer", "Router", "{\"output\": {\"testresult\": \"pass\", \"status\": \"unreachable\"}}", "Pass", new Date()); + Calendar calendar=Calendar.getInstance(); + + calendar.add(Calendar.DATE, -7); + calendar.add(Calendar.HOUR_OF_DAY, 00); + calendar.add(Calendar.MINUTE, 00); + calendar.add(Calendar.SECOND, 00); + calendar.add(Calendar.MILLISECOND, 00); + startDate=calendar.getTime(); + + Calendar endDateCalendar=Calendar.getInstance(); + + endDateCalendar.add(Calendar.HOUR_OF_DAY, 23); + endDateCalendar.add(Calendar.MINUTE, 59); + calendar.add(Calendar.SECOND, 00); + endDateCalendar.add(Calendar.MILLISECOND, 00); + endDate=endDateCalendar.getTime(); + + System.out.println("Before Call : startDate "+startDate.toLocaleString() +" endDate : "+endDate.toLocaleString()); + configList=new ArrayList<>(); + configList.add(obj); + + dummyList=new ArrayList<>(); + dummyList.add(model); + + } + + @Test + public void whenFindByDeviceName_thenReturPreTest() + { + IReportService reportService= mock(IReportService.class); + try { + when(reportService.findReportByDeviceName(startDate,endDate,"Router")).thenReturn(dummyList); + } catch (Exception e1) { + + e1.printStackTrace(); + } + + int expectedTestId=1; + + List testList; + try { + testList = reportService.findReportByDeviceName(startDate,endDate,"Router"); + assertThat(testList.get(0).getTestid()) + .isEqualTo(expectedTestId); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/resources/application.properties b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/resources/application.properties new file mode 100644 index 0000000..b48a921 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_api/src/test/resources/application.properties @@ -0,0 +1,56 @@ +#server.port = 9001 + + + +# H2 DB Details +spring.jpa.hibernate.ddl-auto = create-drop +spring.jpa.database = HSQL +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.HSQLDialect +spring.datasource.driverClassName = org.hsqldb.jdbcDriver +spring.datasource.url: jdbc:hsqldb:mem:scratchdb +spring.datasource.username =sa +spring.datasource.password =sa + + +# maria db details + +#spring.jackson.serialization.fail-on-empty-beans=false +#server.tomcat.uri-encoding=utf-8 +#spring.datasource.continue-on-error=true +#server.error.whitelabel.enabled=false +#spring.mvc.view.prefix = /WEB-INF/views/ +#spring.mvc.view.suffix = .jsp + +#spring.datasource.url=jdbc:mysql://localhost:3306/dummyreports?useSSL=false +#spring.datasource.url=jdbc:mariadb://localhost:3307/dummyReports +#spring.datasource.driver-class-name=com.mysql.jdbc.Driver +#spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +#spring.datasource.name=mysql +#spring.jpa.database=mysql + +#spring.jpa.hibernate.ddl-auto=create +#spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + +#spring.datasource.username=root +#spring.datasource.password=root +#spring.jpa.generate-ddl=true + +spring.datasource.tomcat.max-wait=20000 +spring.datasource.tomcat.max-active=50 +spring.datasource.tomcat.max-idle=20 +spring.datasource.tomcat.min-idle=15 + +spring.jpa.show-sql=true + + + +# mysql db Details + +#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardIm +#spring.jpa.hibernate.ddl-auto=create +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.id.new_generator_mappings = false +#spring.jpa.properties.hibernate.format_sql = true + +#logging.level.org.hibernate.SQL=DEBUG +#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.classpath b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.classpath new file mode 100644 index 0000000..01a9d42 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.classpath @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.project b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.project new file mode 100644 index 0000000..95fb91b --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.project @@ -0,0 +1,27 @@ + + + sdnc_reports_dao + Parent pom providing dependency and plugin management for applications + built with Maven. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.wst.common.project.facet.core.builder + + + org.eclipse.jdt.core.javabuilder + + + org.springframework.ide.eclipse.core.springbuilder + + + org.eclipse.m2e.core.maven2Builder + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.core.resources.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.jdt.core.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..5ce4518 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.m2e.core.prefs b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.wst.common.project.facet.core.xml b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..d858295 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/pom.xml b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/pom.xml new file mode 100644 index 0000000..0134b37 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/pom.xml @@ -0,0 +1,66 @@ + + 4.0.0 + sdnc_reports_dao + jar + + + com.sdnc.reports + sdnc_reports + 0.0.1-SNAPSHOT + + + + + + org.springframework + spring-context + + + + org.springframework.boot + spring-boot-starter-test + test + 1.5.3.RELEASE + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.hibernate + hibernate-entitymanager + + + + + + + mysql + mysql-connector-java + runtime + + + + + + com.fasterxml.jackson.core + jackson-annotations + + + + + org.mariadb.jdbc + mariadb-java-client + 1.1.7 + + + \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/DeviceConfig.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/DeviceConfig.java new file mode 100644 index 0000000..2979de3 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/DeviceConfig.java @@ -0,0 +1,109 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.model; + +import java.io.Serializable; +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +//@Table(name = "deviceconfig",schema="testreports") +@Table(name = "deviceconfig") +public class DeviceConfig implements Serializable +{ + private static final long serialVersionUID = -3009157732242241606L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "deviceid") + private long id; + + @Column(name = "devicename") + private String deviceName; + + @Column(name = "createdon") + private String createdon; + + @OneToMany(mappedBy="device") + private Set protocolConfig; + + @OneToMany(mappedBy="device") + private Set preTestConfig; + + public DeviceConfig() { + // TODO Auto-generated constructor stub + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getCreationDate() { + return createdon; + } + + public void setCreationDate(String creationDate) { + this.createdon = creationDate; + } + + public Set getProtocolConfig() { + return protocolConfig; + } + + public void setProtocolConfig(Set protocolConfig) { + this.protocolConfig = protocolConfig; + } + + public Set getPreTestConfig() { + return preTestConfig; + } + + public void setPreTestConfig(Set preTestConfig) { + this.preTestConfig = preTestConfig; + } + + @Override + public String toString() { + return "DeviceConfig [id=" + id + ", deviceName=" + deviceName + ", createdon=" + createdon + + "]"; + } + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/PreTestConfig.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/PreTestConfig.java new file mode 100644 index 0000000..fe9ee2a --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/PreTestConfig.java @@ -0,0 +1,127 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.model; + +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +//@Table(name = "pretestconfig",schema="testreports") +@Table(name = "pretestconfig") +public class PreTestConfig implements Serializable{ + + private static final long serialVersionUID = -3009157732242241606L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "testid") + private long testId ; + + @Column(name = "testname") + private String testName; + + + @Column(name = "result") + private String result; + + @Column(name = "execuationdetails") + private String execuationDetails; + + @Column(name = "timestamp") + @Temporal(TemporalType.DATE) + private Date timestamp; + + @ManyToOne + @JoinColumn(name="deviceid",nullable=false) + private DeviceConfig device; + + public PreTestConfig() + { + // TODO Auto-generated constructor stub + } + + public long getTestId() { + return testId; + } + + public void setTestId(long testId) { + this.testId = testId; + } + + public String getTestName() { + return testName; + } + + public void setTestName(String testName) { + this.testName = testName; + } + + public DeviceConfig getDevice() { + return device; + } + + public void setDevice(DeviceConfig device) { + this.device = device; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public String getExecuationDetails() { + return execuationDetails; + } + + public void setExecuationDetails(String execuationDetails) { + this.execuationDetails = execuationDetails; + } + + public Date getTimestamp() { + return timestamp; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + @Override + public String toString() { + return "PreTestConfig [testId=" + testId + ", testName=" + testName + ", result=" + result + + ", execuationDetails=" + execuationDetails + ", timestamp=" + timestamp + ", device=" + device + "]"; + } + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/ProtocolConfig.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/ProtocolConfig.java new file mode 100644 index 0000000..3ad2fbf --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/ProtocolConfig.java @@ -0,0 +1,198 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.model; + +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.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "protocolconfig",schema="testreports") +public class ProtocolConfig implements Serializable{ + + private static final long serialVersionUID = -3009157732242241606L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "protocolid") + private long protocolId; + + @Column(name = "protocolname") + private String protocolname; + + @Column(name = "process_id") + private String process_id; + + @Column(name = "networks") + private String networks; + + @Column(name = "as_number") + private String as_number; + + @Column(name = "neighbors") + private String neighbors; + + @Column(name = "cos_entry_number") + private String cos_entry_number; + + @Column(name = "destination_address") + private String destination_address; + + @Column(name = "source_address") + private String source_address; + + @Column(name = "customer_name") + private String customer_name; + + @Column(name = "version") + private String version; + + //@Column(name = "creationDate") + //private String creationDate; + + @ManyToOne + @JoinColumn(name="deviceid",nullable=false) + private DeviceConfig device; + + public ProtocolConfig() { + // TODO Auto-generated constructor stub + } + + public long getProtocolId() { + return protocolId; + } + + public void setProtocolId(long protocolId) { + this.protocolId = protocolId; + } + + public String getProtocolName() { + return protocolname; + } + + public void setProtocolName(String protocolName) { + this.protocolname = protocolName; + } + + public String getProcess_id() { + return process_id; + } + + public void setProcess_id(String process_id) { + this.process_id = process_id; + } + + public String getNetworks() { + return networks; + } + + public void setNetworks(String networks) { + this.networks = networks; + } + + public String getAs_number() { + return as_number; + } + + public void setAs_number(String as_number) { + this.as_number = as_number; + } + + public String getNeighbors() { + return neighbors; + } + + public void setNeighbors(String neighbors) { + this.neighbors = neighbors; + } + + public String getCos_entry_number() { + return cos_entry_number; + } + + public void setCos_entry_number(String cos_entry_number) { + this.cos_entry_number = cos_entry_number; + } + + public String getDestination_address() { + return destination_address; + } + + public void setDestination_address(String destination_address) { + this.destination_address = destination_address; + } + + public String getSource_address() { + return source_address; + } + + public void setSource_address(String source_address) { + this.source_address = source_address; + } + + public String getCustomer_name() { + return customer_name; + } + + public void setCustomer_name(String customer_name) { + this.customer_name = customer_name; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /*public String getCreationDate() { + return creationDate; + } + + public void setCreationDate(String creationDate) { + this.creationDate = creationDate; + }*/ + + public DeviceConfig getDevice() { + return device; + } + + public void setDevice(DeviceConfig device) { + this.device = device; + } + + /*@Override + public String toString() { + return "ProtocolConfig [protocolId=" + protocolId + ", protocolname=" + protocolname + ", process_id=" + + process_id + ", networks=" + networks + ", as_number=" + as_number + ", neighbors=" + neighbors + + ", cos_entry_number=" + cos_entry_number + ", destination_address=" + destination_address + + ", source_address=" + source_address + ", customer_name=" + customer_name + ", version=" + version + + ", device=" + device + "]"; + }*/ + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Report.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Report.java new file mode 100644 index 0000000..53373b3 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Report.java @@ -0,0 +1,94 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.model; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + + +//@Entity +//@Table(name = "report") +public class Report implements Serializable { +/* + + private static final long serialVersionUID = -3009157732242241606L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + + @Column(name = "router_name") + private String router_name; + + protected Report() { + } + + List routerConfigDetailsObj; + + + + public long getRouter_id() { + return id; + } + + + + public void setRouter_id(long router_id) { + this.id = router_id; + } + + + + public String getRouter_name() { + return router_name; + } + + + + public void setRouter_name(String router_name) { + this.router_name = router_name; + } + + + + public List getRouterConfigDetailsObj() { + return routerConfigDetailsObj; + } + + + + public void setRouterConfigDetailsObj(List routerConfigDetailsObj) { + this.routerConfigDetailsObj = routerConfigDetailsObj; + } + + + @Override + public String toString() { + return "Router [router_id=" + id + ", router_name=" + router_name+"]"; + } + + +*/} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Response.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Response.java new file mode 100644 index 0000000..3203931 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/Response.java @@ -0,0 +1,50 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.model; + +public class Response { + private String status; + private Object data; + + public Response() { + + } + + public Response(String status, Object data) { + this.status = status; + this.data = data; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/RouterConfigDetails.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/RouterConfigDetails.java new file mode 100644 index 0000000..96bf38b --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/model/RouterConfigDetails.java @@ -0,0 +1,281 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import org.springframework.data.annotation.Id; + +import com.onap.sdnc.reports.rest.model.ConfigDetailsRestModel; +import com.onap.sdnc.reports.rest.model.ProtocolModel; + +public class RouterConfigDetails implements Comparable{ + + @Override + public int compareTo(RouterConfigDetails o) { + // TODO Auto-generated method stub + return 0; + } + +/* + @Id + String router_config_details_id; + + Date date; + String version_id; + String protocol; + String cos_entry_number; + String destination_address; + String source_address; + String customer_name; + + String process_id; + String subnet_ip; + String area_id; + String as_number; + String router_id; + String peer_ip; + + HashMap neighbors; + HashMap networks; + + List networkList; + + public static List fromEntityToModel(List entityList) { + List modelList= new ArrayList(); + ConfigDetailsRestModel configmodel= new ConfigDetailsRestModel(); + List protocolmodelList= new ArrayList(); + + for (RouterConfigDetails entity : entityList) { + ProtocolModel model = new ProtocolModel(); + // + model.setDate(entity.getDate().toString()); + if ("ipsla".equals(entity.getProtocol())) { + model.setVersion_id(entity.getVersion_id()); + model.setProtocol_name(entity.getProtocol()); + model.setCos_entry_number(entity.getCos_entry_number()); + model.setCustomer_name(entity.getCustomer_name()); + model.setDestination_address(entity.getDestination_address()); + model.setSource_address(entity.getSource_address()); + // routerConfigDetails.setRouter_config_details_id(String.valueOf(seqDao.getRouterConfigDetailsNextSequenceId(ROUTER_CONFIG_VERSION))); + protocolmodelList.add(model); + } + if ("bgp".equals(entity.getProtocol())) { + model.setVersion_id(entity.getVersion_id()); + model.setProtocol_name(entity.getProtocol()); + HashMap neighbor = entity.getNeighbors(); + HashMap neighbormap = new HashMap(); + model.setAs_number(entity.getAs_number()); + model.setRouter_id(entity.getRouter_id()); + + String as_number = neighbor.get("as_number").toString(); + String peer_ip = neighbor.get("peer_ip").toString(); + + neighbormap.put("as_number", as_number); + neighbormap.put("peer_ip", peer_ip); + + model.setNeighbors(neighbormap); + protocolmodelList.add(model); + } + if ("ospf".equals(entity.getProtocol())) { + model.setVersion_id(entity.getVersion_id()); + model.setProtocol_name(entity.getProtocol()); + HashMap networks = entity.getNetworks(); + HashMap networksmap = new HashMap(); + String network_subnet_ip = networks.get("subnet_ip").toString(); + String network_area_id = networks.get("area_id").toString(); + + + networksmap.put("subnet_ip", network_subnet_ip); + networksmap.put("area_id", network_subnet_ip); + + model.setNetworks(networksmap); + model.setProcess_id(entity.getProcess_id()); + protocolmodelList.add(model); + } + } + configmodel.setProtocol(protocolmodelList); + modelList.add(configmodel); + return modelList; + } + + public String getRouter_config_details_id() { + return router_config_details_id; + } + + public void setRouter_config_details_id(String router_config_details_id) { + this.router_config_details_id = router_config_details_id; + } + + public String getCos_entry_number() { + return cos_entry_number; + } + + public void setCos_entry_number(String cos_entry_number) { + this.cos_entry_number = cos_entry_number; + } + + public String getDestination_address() { + return destination_address; + } + + public void setDestination_address(String destination_address) { + this.destination_address = destination_address; + } + + public String getSource_address() { + return source_address; + } + + public void setSource_address(String source_address) { + this.source_address = source_address; + } + + public String getCustomer_name() { + return customer_name; + } + + public void setCustomer_name(String customer_name) { + this.customer_name = customer_name; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + + * public String getVersion() { return version; } + * + * public void setVersion(String version) { this.version = version; } + + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public String getProcess_id() { + return process_id; + } + + public void setProcess_id(String process_id) { + this.process_id = process_id; + } + + public String getSubnet_ip() { + return subnet_ip; + } + + public void setSubnet_ip(String subnet_ip) { + this.subnet_ip = subnet_ip; + } + + public String getArea_id() { + return area_id; + } + + public void setArea_id(String area_id) { + this.area_id = area_id; + } + + public String getAs_number() { + return as_number; + } + + public void setAs_number(String as_number) { + this.as_number = as_number; + } + + public String getRouter_id() { + return router_id; + } + + public void setRouter_id(String router_id) { + this.router_id = router_id; + } + + public String getPeer_ip() { + return peer_ip; + } + + public void setPeer_ip(String peer_ip) { + this.peer_ip = peer_ip; + } + + public HashMap getNeighbors() { + return neighbors; + } + + public void setNeighbors(HashMap neighbormap) { + this.neighbors = neighbormap; + } + + public HashMap getNetworks() { + return networks; + } + + public void setNetworks(HashMap networks) { + this.networks = networks; + } + + public List getNetworkList() { + return networkList; + } + + public void setNetworkList(List networkList) { + this.networkList = networkList; + } + + @Override + public String toString() { + return "RouterConfigDetails [router_config_details_id=" + router_config_details_id + ",date=" + date + + ",protocol=" + protocol + ", cos_entry_number=" + cos_entry_number + ", destination_address=" + + destination_address + ", source_address=" + source_address + ", customer_name=" + customer_name + "]"; + } + + //@Override + public int compareTo(RouterConfigDetails o) { + if (this.date.before(o.getDate())) + return 1; + else if (this.date.equals(o.getDate())) + return 0; + else + return -1; + } + + public String getVersion_id() { + return version_id; + } + + public void setVersion_id(String version_id) { + this.version_id = version_id; + } +*/ +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/DeviceRepository.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/DeviceRepository.java new file mode 100644 index 0000000..3864a35 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/DeviceRepository.java @@ -0,0 +1,31 @@ + +package com.onap.sdnc.reports.repository; + +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.onap.sdnc.reports.model.DeviceConfig; +import com.onap.sdnc.reports.model.PreTestConfig; +import com.onap.sdnc.reports.model.Report; + +@Repository +public interface DeviceRepository extends JpaRepository { +//public interface DeviceRepository extends CrudRepository { + //List findByLastName(String lastName); + /*@Query(value= "from DeviceConfig where deviceName = :deviceName" ) + DeviceConfig findDeviceName(@Param("deviceName") String deviceName); + + @Modifying + @Query(value = "insert into DeviceConfig (deviceName,createdOn) VALUES (:deviceName,:createdOn)", nativeQuery = true) + @Transactional + void logDeviceName(@Param("deviceName") String deviceName, @Param("createdOn") String createdOn);*/ +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java new file mode 100644 index 0000000..e399bfd --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java @@ -0,0 +1,34 @@ + +package com.onap.sdnc.reports.repository; + +import java.util.Date; +import java.util.List; + +import javax.transaction.Transactional; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.onap.sdnc.reports.model.PreTestConfig; + +@Repository +public interface PreTestConfigRepository extends JpaRepository { + + /*@Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate" ) + List findPreTestConfigByTimeStamp(@Param("startDate") Date startDate, @Param("endDate")Date endDate); + + + @Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate and testName = :testName" ) + List findReportByTestName(@Param("startDate") Date startDate, @Param("endDate")Date endDate, @Param("testName")String testName); + */ + @Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate and device.deviceName = :deviceName" ) + List findReportByDeviceName(@Param("startDate") Date startDate, @Param("endDate")Date endDate, @Param("deviceName")String deviceName); + + @Modifying + @Query(value = "insert into PreTestConfig (testName,result,execuationDetails,timestamp,deviceId) VALUES (:testName,:result,:execuationDetails,:timestamp,:deviceId)", nativeQuery = true) + @Transactional + void logPreTestReport(@Param("testName") String testName,@Param("result") String result, @Param("execuationDetails") String execuationDetails,@Param("timestamp") String timestamp,@Param("deviceId") long deviceId); +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ConfigDetailsRestModel.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ConfigDetailsRestModel.java new file mode 100644 index 0000000..5794459 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ConfigDetailsRestModel.java @@ -0,0 +1,73 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.rest.model; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ConfigDetailsRestModel { + + @JsonProperty(value = JSONTags.TAG_ROUTER) + String router; + + @JsonProperty(value = JSONTags.TAG_DATE) + String date; + + List protocol; + + + public ConfigDetailsRestModel() { + super(); + } + + + public String getRouter() { + return router; + } + + + public void setRouter(String router) { + this.router = router; + } + + + public String getDate() { + return date; + } + + + public void setDate(String date) { + this.date = date; + } + + + public List getProtocol() { + return protocol; + } + + + public void setProtocol(List protocol) { + this.protocol = protocol; + } + + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/JSONTags.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/JSONTags.java new file mode 100644 index 0000000..90ff570 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/JSONTags.java @@ -0,0 +1,56 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.rest.model; + +public class JSONTags { + + public static final String TAG_REQUEST_FNAME = "first_name"; + public static final String TAG_REQUEST_MNAME = "middle_name"; + public static final String TAG_STATUS_SUCCESS = "success"; + public static final String TAG_RESPONSE_STATUS = "status"; + public static final String TAG_REQUEST_FROM = "request_from"; + public static final String TAG_REQUEST_ID = "request_id"; + public static final String TAG_RESPONSE_DETAIL = "response_detail"; + public static final String TAG_RESPONSE_BODY = "response_body"; + public static final String TAG_REQUEST_BODY = "request_body"; + public static final String TAG_RESPONSE_MESSAGE = "request"; + public static final String TAG_ERROR_CODE = "error_code"; + public static final String TAG_ERROR_CODE_SUCCESS = "100"; + + + public static final String TAG_ROUTER = "router"; + public static final String TAG_IPSLA = "ipsla"; + public static final String TAG_OSPF = "ospf"; + public static final String TAG_DATE = "date"; + public static final String TAG_COS_ENTRY_NUMBER = "cos-entry-number"; + public static final String TAG_DESTINATION_ADDRESS = "destination-address"; + public static final String TAG_SOURCE_ADDRESS = "source-address"; + public static final String TAG_CUSTOMER_NAME = "customer-name"; + public static final String TAG_PROTOCOL_NAME = "protocol-name"; + + + public static final String TAG_AS_NUMBER = "as-number"; + public static final String TAG_ROUTER_ID = "router-id"; + public static final String TAG_PEER_IP = "peer-ip"; + + public static final String TAG_PROCESS_ID = "process-id"; + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/PreTestModel.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/PreTestModel.java new file mode 100644 index 0000000..4f73e02 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/PreTestModel.java @@ -0,0 +1,116 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.rest.model; + +import java.io.Serializable; +import java.util.Date; + +public class PreTestModel implements Serializable{ + + private static final long serialVersionUID = -3009157732242241606L; + + private long testid; + + private long deviceid; + + private String testName; + + private String deviceName,execuationDetails,result; + + private Date timeStamp; + + public PreTestModel(long testid, long deviceid, String testName, String deviceName, String execuationDetails, + String result, Date timeStamp) { + super(); + this.testid = testid; + this.deviceid = deviceid; + this.testName = testName; + this.deviceName = deviceName; + this.execuationDetails = execuationDetails; + this.result = result; + this.timeStamp = timeStamp; + } + + @Override + public String toString() { + return "PreTestModel [testid=" + testid + ", deviceid=" + deviceid + ", testName=" + testName + ", deviceName=" + + deviceName + ", execuationDetails=" + execuationDetails + ", result=" + result + ", timeStamp=" + + timeStamp + "]"; + } + + public long getTestid() { + return testid; + } + + public void setTestid(long testid) { + this.testid = testid; + } + + public long getDeviceid() { + return deviceid; + } + + public void setDeviceid(long deviceid) { + this.deviceid = deviceid; + } + + public String getTestName() { + return testName; + } + + public void setTestName(String testName) { + this.testName = testName; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getExecuationDetails() { + return execuationDetails; + } + + public void setExecuationDetails(String execuationDetails) { + this.execuationDetails = execuationDetails; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public Date getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(Date timeStamp) { + this.timeStamp = timeStamp; + } + + + +} diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ProtocolModel.java b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ProtocolModel.java new file mode 100644 index 0000000..d90584d --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/java/com/onap/sdnc/reports/rest/model/ProtocolModel.java @@ -0,0 +1,207 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SDNC-FEATURES +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +package com.onap.sdnc.reports.rest.model; + +import java.util.HashMap; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ProtocolModel { + + + + @JsonProperty(value = JSONTags.TAG_COS_ENTRY_NUMBER) + String cos_entry_number; + @JsonProperty(value = JSONTags.TAG_DESTINATION_ADDRESS) + String destination_address; + @JsonProperty(value = JSONTags.TAG_SOURCE_ADDRESS) + String source_address; + @JsonProperty(value = JSONTags.TAG_CUSTOMER_NAME) + String customer_name; + + + String date; + + String version_id; + + String protocol_name; + + // added by bhawna + + String process_id; + String subnet_ip; + String area_id; + @JsonProperty(value = JSONTags.TAG_AS_NUMBER) + String as_number; + @JsonProperty(value = JSONTags.TAG_ROUTER_ID) + String router_id; + @JsonProperty(value = JSONTags.TAG_PEER_IP) + String peer_ip; + + HashMap neighbors; + HashMap networks; + + List networkList; + + public ProtocolModel() { + super(); + } + + /* + * @Override public String toString() { return + * "RouterConfigDetailsRestModel [cos_entry_number=" + cos_entry_number + + * ", destination_address=" + destination_address + ", source_address=" + + * source_address + ", customer_name=" + customer_name + "]"; } + */ + public String getProtocol_name() { + return protocol_name; + } + + + public void setProtocol_name(String protocol_name) { + this.protocol_name = protocol_name; + } + + public String getCos_entry_number() { + return cos_entry_number; + } + + public void setCos_entry_number(String cos_entry_number) { + this.cos_entry_number = cos_entry_number; + } + + public String getDestination_address() { + return destination_address; + } + + public void setDestination_address(String destination_address) { + this.destination_address = destination_address; + } + + public String getSource_address() { + return source_address; + } + + public void setSource_address(String source_address) { + this.source_address = source_address; + } + + public String getCustomer_name() { + return customer_name; + } + + public void setCustomer_name(String customer_name) { + this.customer_name = customer_name; + } + + + public String getProcess_id() { + return process_id; + } + + public void setProcess_id(String process_id) { + this.process_id = process_id; + } + + public String getSubnet_ip() { + return subnet_ip; + } + + public void setSubnet_ip(String subnet_ip) { + this.subnet_ip = subnet_ip; + } + + public String getArea_id() { + return area_id; + } + + public void setArea_id(String area_id) { + this.area_id = area_id; + } + + public String getAs_number() { + return as_number; + } + + public void setAs_number(String as_number) { + this.as_number = as_number; + } + + public String getRouter_id() { + return router_id; + } + + public void setRouter_id(String router_id) { + this.router_id = router_id; + } + + public String getPeer_ip() { + return peer_ip; + } + + public void setPeer_ip(String peer_ip) { + this.peer_ip = peer_ip; + } + + public HashMap getNeighbors() { + return neighbors; + } + + public void setNeighbors(HashMap neighbors) { + this.neighbors = neighbors; + } + + public HashMap getNetworks() { + return networks; + } + + public void setNetworks(HashMap networks) { + this.networks = networks; + } + + public List getNetworkList() { + return networkList; + } + + public void setNetworkList(List networkList) { + this.networkList = networkList; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getVersion_id() { + return version_id; + } + + public void setVersion_id(String version_id) { + this.version_id = version_id; + } + + + +} + diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/resources/application.properties b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/resources/application.properties new file mode 100644 index 0000000..e79c8b2 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/main/resources/application.properties @@ -0,0 +1,29 @@ +#spring.datasource.url=jdbc:mysql://localhost:3306/mysql?useSSL=false +#spring.datasource.driver-class-name=com.mysql.jdbc.Driver +#spring.datasource.name=mysql +#spring.jpa.database=mysql +#spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + +spring.jpa.generate-ddl=true +spring.datasource.url=jdbc:mariadb://localhost:3306/testreports +spring.datasource.username=root +spring.datasource.password=root +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +# Keep the connection alive if idle for a long time (needed in production) +spring.datasource.testWhileIdle=true + +#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardIm + +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.id.new_generator_mappings = false +#spring.jpa.properties.hibernate.format_sql = true +#spring.jpa.hibernate.ddl-auto=create + + +#logging.level.org.hibernate.SQL=DEBUG +#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE + +# Naming strategy +#spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy \ No newline at end of file diff --git a/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/test/resources/application.properties b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/test/resources/application.properties new file mode 100644 index 0000000..b48a921 --- /dev/null +++ b/sdnc_report_api_sdnc_253_story/sdnc_reports_dao/src/test/resources/application.properties @@ -0,0 +1,56 @@ +#server.port = 9001 + + + +# H2 DB Details +spring.jpa.hibernate.ddl-auto = create-drop +spring.jpa.database = HSQL +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.HSQLDialect +spring.datasource.driverClassName = org.hsqldb.jdbcDriver +spring.datasource.url: jdbc:hsqldb:mem:scratchdb +spring.datasource.username =sa +spring.datasource.password =sa + + +# maria db details + +#spring.jackson.serialization.fail-on-empty-beans=false +#server.tomcat.uri-encoding=utf-8 +#spring.datasource.continue-on-error=true +#server.error.whitelabel.enabled=false +#spring.mvc.view.prefix = /WEB-INF/views/ +#spring.mvc.view.suffix = .jsp + +#spring.datasource.url=jdbc:mysql://localhost:3306/dummyreports?useSSL=false +#spring.datasource.url=jdbc:mariadb://localhost:3307/dummyReports +#spring.datasource.driver-class-name=com.mysql.jdbc.Driver +#spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +#spring.datasource.name=mysql +#spring.jpa.database=mysql + +#spring.jpa.hibernate.ddl-auto=create +#spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + +#spring.datasource.username=root +#spring.datasource.password=root +#spring.jpa.generate-ddl=true + +spring.datasource.tomcat.max-wait=20000 +spring.datasource.tomcat.max-active=50 +spring.datasource.tomcat.max-idle=20 +spring.datasource.tomcat.min-idle=15 + +spring.jpa.show-sql=true + + + +# mysql db Details + +#spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardIm +#spring.jpa.hibernate.ddl-auto=create +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect +#spring.jpa.properties.hibernate.id.new_generator_mappings = false +#spring.jpa.properties.hibernate.format_sql = true + +#logging.level.org.hibernate.SQL=DEBUG +#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE \ No newline at end of file -- cgit 1.2.3-korg