use of org.openkilda.model.LinkProps in project open-kilda by telstra.
the class SwitchController method updateLinkProps.
/**
* Get Link Props.
*
* @param keys the link properties
* @return the link properties string
*/
@RequestMapping(path = "/link/props", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public String updateLinkProps(@RequestBody final List<LinkProps> keys) {
LinkProps props = (keys != null && !keys.isEmpty()) ? keys.get(0) : null;
String key = props != null ? "Src_SW_" + props.getSrcSwitch() + "\nSrc_PORT_" + props.getSrcPort() + "\nDst_SW_" + props.getDstSwitch() + "\nDst_PORT_" + props.getDstPort() + "\nCost_" + props.getProperty("cost") : "";
activityLogger.log(ActivityType.ISL_UPDATE_COST, key);
return serviceSwitch.updateLinkProps(keys);
}
use of org.openkilda.model.LinkProps in project open-kilda by telstra.
the class SwitchService method getIslLinks.
/**
* Gets the isl links.
*
* @param srcSwitch the src switch
* @param srcPort the src port
* @param dstSwitch the dst switch
* @param dstPort the dst port
* @return the isl links
*/
public List<IslLinkInfo> getIslLinks(final String srcSwitch, final String srcPort, final String dstSwitch, final String dstPort) {
if (StringUtil.isAnyNullOrEmpty(srcSwitch, srcPort, dstPort, dstSwitch)) {
return switchIntegrationService.getIslLinks(null);
}
LinkProps keys = new LinkProps();
keys.setDstPort(dstPort);
keys.setDstSwitch(dstSwitch);
keys.setSrcPort(srcPort);
keys.setSrcSwitch(srcSwitch);
return switchIntegrationService.getIslLinks(keys);
}
use of org.openkilda.model.LinkProps in project open-kilda by telstra.
the class IslFsm method loadLinkProps.
private Optional<LinkProps> loadLinkProps(Endpoint source, Endpoint dest) {
Collection<LinkProps> storedProps = linkPropsRepository.findByEndpoints(source.getDatapath(), source.getPortNumber(), dest.getDatapath(), dest.getPortNumber());
Optional<LinkProps> result = Optional.empty();
for (LinkProps entry : storedProps) {
result = Optional.of(entry);
// We can/should put "break" here but it lead to warnings... Anyway only one match possible
// by such(full) query so we can avoid "break" here.
}
return result;
}
use of org.openkilda.model.LinkProps in project open-kilda by telstra.
the class FermaLinkPropsRepositoryTest method createLinkProps.
private LinkProps createLinkProps(int dstPort) {
LinkProps linkProps = LinkProps.builder().srcPort(1).srcSwitchId(TEST_SWITCH_A_ID).dstSwitchId(TEST_SWITCH_B_ID).dstPort(dstPort).build();
linkPropsRepository.add(linkProps);
return linkProps;
}
Aggregations