16 package org.openkilda.testing.service.topology;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25 import org.springframework.beans.factory.annotation.Autowired;
26 import org.springframework.beans.factory.annotation.Qualifier;
27 import org.springframework.core.ParameterizedTypeReference;
28 import org.springframework.http.HttpMethod;
29 import org.springframework.http.HttpStatus;
30 import org.springframework.stereotype.Service;
31 import org.springframework.web.client.HttpClientErrorException;
32 import org.springframework.web.client.RestTemplate;
34 import java.util.Arrays;
35 import java.util.List;
43 @Qualifier(
"topologyEngineRestTemplate")
44 private RestTemplate restTemplate;
48 return restTemplate.getForObject(
"/api/v1/topology/links/bandwidth/{src_switch}/{src_port}", Integer.class,
54 Flow[] links = restTemplate.getForObject(
"/api/v1/topology/flows",
Flow[].
class);
55 return Arrays.asList(links);
61 return restTemplate.exchange(
"/api/v1/topology/flows/{flow_id}", HttpMethod.GET, null,
64 }
catch (HttpClientErrorException ex) {
65 if (ex.getStatusCode() != HttpStatus.NOT_FOUND) {
75 restTemplate.getForObject(
"/api/v1/flows/restore", String.class);
80 return restTemplate.getForObject(
"/api/v1/topology/clear", String.class);
86 .getForObject(
"/api/v1/topology/routes/src/{src_switch}/dst/{dst_switch}",
88 return Arrays.asList(paths);
ImmutablePair< Flow, Flow > getFlow(String flowId)
List< Flow > getAllFlows()
Integer getLinkBandwidth(SwitchId srcSwitch, SwitchId srcPort)
List< PathInfoData > getPaths(SwitchId srcSwitch, SwitchId dstSwitch)