diff options
author | Soumendu Sekhar Acharya <sa00498080@techmahindra.com> | 2018-08-01 17:21:15 +0530 |
---|---|---|
committer | Soumendu Sekhar Acharya <SA00498080@techmahindra.com> | 2018-08-24 12:55:16 +0000 |
commit | 929c1f13697f338245571694beb73adbd39a5b78 (patch) | |
tree | 4ece0941e34c012407565aa01b34235be93688ad /SdncReports/SdncReportsDao/src | |
parent | cc49cb7753ff820dada996ab1d56263243630395 (diff) |
SDN-C support&provide network layer tests Using IP
SDNC-252,SDNC-253,SDNC-264,SDNC-266 are added as part of this story
Change-Id: Ic65ca32c4786fac1be9269dbc6a2162b433f0630
Issue-ID: SDNC-264
Signed-off-by: Soumendu Sekhar Acharya <sa00498080@techmahindra.com>
Former-commit-id: d90280efcad173fd2250b8e2e98cb8f480007657
Diffstat (limited to 'SdncReports/SdncReportsDao/src')
19 files changed, 1088 insertions, 0 deletions
diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/CertificationInputs.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/CertificationInputs.java new file mode 100644 index 00000000..d8952fc4 --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/CertificationInputs.java @@ -0,0 +1,35 @@ +/* +* ============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 CertificationInputs { + + private Input input; + + public Input getInput () + { + return input; + } + + public void setInput (Input input) + { + this.input = input; + } +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/DeviceConfig.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/DeviceConfig.java new file mode 100644 index 00000000..2a999e2e --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/DeviceConfig.java @@ -0,0 +1,92 @@ +/* +* ============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.OneToMany; +import javax.persistence.Table; + +@Entity +@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 = "deviceIP") + private String deviceIP; + + @Column(name = "createdon") + private String createdon; + + @OneToMany(mappedBy="device") + private Set<PreTestConfig> preTestConfig; + + public DeviceConfig() { + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getCreationDate() { + return createdon; + } + + public void setCreationDate(String creationDate) { + this.createdon = creationDate; + } + + public Set<PreTestConfig> getPreTestConfig() { + return preTestConfig; + } + + public void setPreTestConfig(Set<PreTestConfig> preTestConfig) { + this.preTestConfig = preTestConfig; + } + + public String getDeviceIP() { + return deviceIP; + } + + public void setDeviceIP(String deviceIP) { + this.deviceIP = deviceIP; + } + + @Override + public String toString() { + return "DeviceConfig [id=" + id + ", deviceName=" + ", createdon=" + createdon + + ", deviceIP=" + deviceIP + "]"; + } +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Input.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Input.java new file mode 100644 index 00000000..7a49034e --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Input.java @@ -0,0 +1,53 @@ +/* +* ============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 Input { + + private String ipaddress; + private String hostname; + private String network; + + public String getHostname() { + return hostname; + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } + + public String getIpaddress () + { + return ipaddress; + } + + public void setIpaddress (String ipaddress) + { + this.ipaddress = ipaddress; + } + + public String getNetwork() { + return network; + } + + public void setNetwork(String network) { + this.network = network; + } +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/ODLClientResponse.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/ODLClientResponse.java new file mode 100644 index 00000000..999059df --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/ODLClientResponse.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.model; + +public class ODLClientResponse { + private Output output; + + public Output getOutput () + { + return output; + } + + public void setOutput (Output output) + { + this.output = output; + } +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Output.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Output.java new file mode 100644 index 00000000..3cc09324 --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Output.java @@ -0,0 +1,101 @@ +/* +* ============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 Output { + + private String status; + + private String testresult; + + private String hostname; + + private String ipaddress; + + private String statistics; + + private String avgTime; + + private String reason; + + public String getStatus () + { + return status; + } + + public String getStatistics() { + return statistics; + } + + public void setStatistics(String statistics) { + this.statistics = statistics; + } + + public void setStatus (String status) + { + this.status = status; + } + + public String getTestresult () + { + return testresult; + } + + public void setTestresult (String testresult) + { + this.testresult = testresult; + } + + public String getHostname () + { + return hostname; + } + + public void setHostname (String hostname) + { + this.hostname = hostname; + } + + public String getIpaddress () + { + return ipaddress; + } + + public void setIpaddress (String ipaddress) + { + this.ipaddress = ipaddress; + } + + public String getAvgTime() { + return avgTime; + } + + public void setAvgTime(String avgTime) { + this.avgTime = avgTime; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/PreTestConfig.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/PreTestConfig.java new file mode 100644 index 00000000..672a6f2b --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/PreTestConfig.java @@ -0,0 +1,120 @@ +/* +* ============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 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; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@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() + { + } + + 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/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/PreTestResponse.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/PreTestResponse.java new file mode 100644 index 00000000..a2349e7d --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/PreTestResponse.java @@ -0,0 +1,85 @@ +/* +* ============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 com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PreTestResponse { + + private String ipaddress; + private String status; + private String testtype; + private String statistics; + private String avgTime; + private String hostname; + + public PreTestResponse() { + + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getIpaddress() { + return ipaddress; + } + + public void setIpaddress(String ipaddress) { + this.ipaddress = ipaddress; + } + + public String getTesttype() { + return testtype; + } + + public void setTesttype(String testtype) { + this.testtype = testtype; + } + + public String getStatistics() { + return statistics; + } + + public void setStatistics(String statistics) { + this.statistics = statistics; + } + + public String getAvgTime() { + return avgTime; + } + + public void setAvgTime(String avgTime) { + this.avgTime = avgTime; + } + + public String getHostname() { + return hostname; + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Request.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Request.java new file mode 100644 index 00000000..e934a4c9 --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Request.java @@ -0,0 +1,43 @@ +/* +* ============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 Request { + + private VnfList[] vnfList; + + private ValidationTestType[] validationTestType; + + public VnfList[] getVnfList() { + return vnfList; + } + + public void setVnfList(VnfList[] vnfList) { + this.vnfList = vnfList; + } + + public ValidationTestType[] getValidationTestType() { + return validationTestType; + } + + public void setValidationTestType(ValidationTestType[] validationTestType) { + this.validationTestType = validationTestType; + } +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Response.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Response.java new file mode 100644 index 00000000..e773212e --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Response.java @@ -0,0 +1,39 @@ +/* +* ============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.List; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Response { + + private List<PreTestResponse> preTestResponse; + + public List<PreTestResponse> getPreTestResponse() { + return preTestResponse; + } + + public void setPreTestResponse(List<PreTestResponse> preTestResponse) { + this.preTestResponse = preTestResponse; + } + +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/ValidationTestType.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/ValidationTestType.java new file mode 100644 index 00000000..9d6c987b --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/ValidationTestType.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.model; + +public class ValidationTestType +{ + private String validationType; + + private String typeId; + + public String getValidationType () + { + return validationType; + } + + public void setValidationType (String validationType) + { + this.validationType = validationType; + } + + public String getTypeId () + { + return typeId; + } + + public void setTypeId (String typeId) + { + this.typeId = typeId; + } +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Vnf.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Vnf.java new file mode 100644 index 00000000..b7eb4566 --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/Vnf.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.model; + +public class Vnf { + + private VnfList[] vnfList; + + private ValidationTestType[] validationTestType; + + public VnfList[] getVnfList () + { + return vnfList; + } + + public void setVnfList (VnfList[] vnfList) + { + this.vnfList = vnfList; + } + + public ValidationTestType[] getValidationTestType () + { + return validationTestType; + } + + public void setValidationTestType (ValidationTestType[] validationTestType) + { + this.validationTestType = validationTestType; + } +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/VnfList.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/VnfList.java new file mode 100644 index 00000000..09bf2eb2 --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/model/VnfList.java @@ -0,0 +1,54 @@ +/* +* ============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 VnfList<List> { + + private String portNo; + + private String ipAddress; + + private String hostName; + + public String getPortNo() { + return portNo; + } + + public void setPortNo(String portNo) { + this.portNo = portNo; + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + public String getHostName() { + return hostName; + } + + public void setHostName(String hostName) { + this.hostName = hostName; + } + +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/repository/DeviceRepository.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/repository/DeviceRepository.java new file mode 100644 index 00000000..9a33bad3 --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/repository/DeviceRepository.java @@ -0,0 +1,43 @@ +/* +* ============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.repository; + +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.DeviceConfig; + + +@Repository +public interface DeviceRepository extends JpaRepository<DeviceConfig, Long> { + + @Query(value= "from DeviceConfig where deviceIP = :deviceIP" ) + DeviceConfig findDeviceIP(@Param("deviceIP") String deviceIP); + + @Modifying + @Query(value = "insert into DeviceConfig (deviceIP,createdOn) VALUES (:deviceIP,:createdOn)", nativeQuery = true) + @Transactional + void logDeviceName(@Param("deviceIP") String deviceIP, @Param("createdOn") String createdOn); +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.java new file mode 100644 index 00000000..7c860429 --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/repository/PreTestConfigRepository.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.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.jpa.repository.config.EnableJpaRepositories; +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<PreTestConfig, Long> { + + @Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate and device.deviceIP = :deviceIP" ) + List<PreTestConfig> findReportByDeviceIP(@Param("startDate") Date startDate, @Param("endDate")Date endDate, @Param("deviceIP")String deviceIP); + + @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/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/rest/model/ConfigDetailsRestModel.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/rest/model/ConfigDetailsRestModel.java new file mode 100644 index 00000000..143e7263 --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/rest/model/ConfigDetailsRestModel.java @@ -0,0 +1,51 @@ +/* +* ============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 com.fasterxml.jackson.annotation.JsonProperty; + +public class ConfigDetailsRestModel { + + @JsonProperty(value = JSONTags.TAG_ROUTER) + String router; + + @JsonProperty(value = JSONTags.TAG_DATE) + String date; + + 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; + } + +} diff --git a/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/rest/model/JSONTags.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/rest/model/JSONTags.java new file mode 100644 index 00000000..54b5c0f0 --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/rest/model/JSONTags.java @@ -0,0 +1,55 @@ +/* +* ============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/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/rest/model/PreTestModel.java b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/rest/model/PreTestModel.java new file mode 100644 index 00000000..0a58121c --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/java/com/onap/sdnc/reports/rest/model/PreTestModel.java @@ -0,0 +1,113 @@ +/* +* ============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 deviceIP,execuationDetails,result; + + private Date timeStamp; + + public PreTestModel(long testid, long deviceid, String testName, String deviceIP, String execuationDetails, + String result, Date timeStamp) { + super(); + this.testid = testid; + this.deviceid = deviceid; + this.testName = testName; + this.deviceIP = deviceIP; + this.execuationDetails = execuationDetails; + this.result = result; + this.timeStamp = timeStamp; + } + + @Override + public String toString() { + return "PreTestModel [testid=" + testid + ", deviceid=" + deviceid + ", testName=" + testName + ", deviceName=" + + deviceIP + ", 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 getDeviceIP() { + return deviceIP; + } + + public void setDeviceName(String deviceName) { + this.deviceIP = 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/SdncReports/SdncReportsDao/src/main/resources/application.properties b/SdncReports/SdncReportsDao/src/main/resources/application.properties new file mode 100644 index 00000000..71ead1b4 --- /dev/null +++ b/SdncReports/SdncReportsDao/src/main/resources/application.properties @@ -0,0 +1,11 @@ +spring.jpa.generate-ddl=true +spring.datasource.url=jdbc:mariadb://localhost:3306/testreports +spring.datasource.username=root +spring.datasource.password=12345 +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect + +spring.datasource.testWhileIdle=true + +#spring.jpa.hibernate.ddl-auto=update + diff --git a/SdncReports/SdncReportsDao/src/test/resources/application.properties b/SdncReports/SdncReportsDao/src/test/resources/application.properties new file mode 100644 index 00000000..bf76714f --- /dev/null +++ b/SdncReports/SdncReportsDao/src/test/resources/application.properties @@ -0,0 +1,17 @@ +# H2 DB Details +spring.jpa.hibernate.ddl-auto = update +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 + +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 + + |