16 package org.openkilda.testing.service.floodlight;
18 import static java.lang.String.format;
28 import org.slf4j.Logger;
29 import org.slf4j.LoggerFactory;
30 import org.springframework.beans.factory.annotation.Autowired;
31 import org.springframework.beans.factory.annotation.Qualifier;
32 import org.springframework.http.HttpStatus;
33 import org.springframework.stereotype.Service;
34 import org.springframework.web.client.HttpServerErrorException;
35 import org.springframework.web.client.RestTemplate;
37 import java.util.Arrays;
38 import java.util.List;
46 @Qualifier(
"floodlightRestTemplate")
47 private RestTemplate restTemplate;
51 return restTemplate.postForObject(
"/wm/staticentrypusher/json", flow, String.class);
56 return restTemplate.getForObject(
"/wm/core/controller/summary/json", String.class);
61 CoreFlowEntry[] coreFlows = restTemplate.getForObject(
"/wm/core/switch/{dp_id}/flow/json",
63 return Arrays.asList(coreFlows);
68 return restTemplate.getForObject(
"/wm/staticentrypusher/list/{dp_id}/json",
75 return Arrays.asList(
result);
80 return restTemplate.getForObject(
"/wm/kilda/flows/switch_id/{switch_id}",
FlowEntriesMap.class, dpid);
86 return restTemplate.getForObject(
"/wm/kilda/meters/switch_id/{switch_id}",
MetersEntriesMap.class, dpid);
87 }
catch (HttpServerErrorException ex) {
88 if (ex.getStatusCode() == HttpStatus.NOT_IMPLEMENTED) {
90 new UnsupportedOperationException(
91 format(
"Switch %s doesn't support dumping of meters.", dpid),
FlowEntriesMap getFlows(SwitchId dpid)
MetersEntriesMap getMeters(SwitchId dpid)
List< SwitchEntry > getSwitches()
DpIdEntriesList getStaticEntries(SwitchId dpId)
String addStaticFlow(StaticFlowEntry flow)
List< CoreFlowEntry > getCoreFlows(SwitchId dpId)