Search in sources :

Example 1 with EndpointReport

use of org.openkilda.testing.service.traffexam.model.EndpointReport in project open-kilda by telstra.

the class TraffExamServiceImpl method fetchReport.

@Override
public ExamReport fetchReport(Exam exam) throws NoResultsFoundException, ExamNotFinishedException {
    ExamResources resources = retrieveExamResources(exam);
    EndpointReport producerReport = fetchEndpointReport(resources.getProducer());
    EndpointReport consumerReport;
    try {
        consumerReport = fetchEndpointReport(resources.getConsumer());
    } catch (ExamNotFinishedException e) {
        if (producerReport.getError() == null) {
            throw e;
        }
        consumerReport = new EndpointReport("Don't wait for consumer report due to error on producer side");
    }
    return new ExamReport(exam, producerReport, consumerReport);
}
Also used : ExamResources(org.openkilda.testing.service.traffexam.model.ExamResources) ExamReport(org.openkilda.testing.service.traffexam.model.ExamReport) EndpointReport(org.openkilda.testing.service.traffexam.model.EndpointReport)

Example 2 with EndpointReport

use of org.openkilda.testing.service.traffexam.model.EndpointReport in project open-kilda by telstra.

the class TraffExamServiceImpl method fetchEndpointReport.

private EndpointReport fetchEndpointReport(Endpoint endpoint) throws NoResultsFoundException, ExamNotFinishedException {
    checkHostRelation(endpoint, suppliedEndpoints);
    ReportResponse report = restTemplate.getForObject(makeHostUri(endpoint.getHost()).path("endpoint/").path(endpoint.getId().toString()).path("/report").build(), ReportResponse.class);
    if (report.getStatus() == null) {
        throw new ExamNotFinishedException();
    }
    return new EndpointReport(report);
}
Also used : ReportResponse(org.openkilda.testing.service.traffexam.model.ReportResponse) EndpointReport(org.openkilda.testing.service.traffexam.model.EndpointReport)

Aggregations

EndpointReport (org.openkilda.testing.service.traffexam.model.EndpointReport)2 ExamReport (org.openkilda.testing.service.traffexam.model.ExamReport)1 ExamResources (org.openkilda.testing.service.traffexam.model.ExamResources)1 ReportResponse (org.openkilda.testing.service.traffexam.model.ReportResponse)1