Search in sources :

Example 11 with LinkProps

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);
}
Also used : LinkProps(org.openkilda.model.LinkProps) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 12 with LinkProps

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);
}
Also used : LinkProps(org.openkilda.model.LinkProps)

Example 13 with LinkProps

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;
}
Also used : LinkProps(org.openkilda.model.LinkProps)

Example 14 with LinkProps

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;
}
Also used : LinkProps(org.openkilda.model.LinkProps)

Aggregations

LinkProps (org.openkilda.model.LinkProps)14 LinkPropsException (org.openkilda.wfm.error.LinkPropsException)3 InvalidResponseException (org.openkilda.integration.exception.InvalidResponseException)2 MessageException (org.openkilda.messaging.error.MessageException)2 LinkPropsResponse (org.openkilda.messaging.nbtopology.response.LinkPropsResponse)2 Isl (org.openkilda.model.Isl)2 IllegalIslStateException (org.openkilda.wfm.error.IllegalIslStateException)2 IslNotFoundException (org.openkilda.wfm.error.IslNotFoundException)2 HttpResponse (org.apache.http.HttpResponse)1 Test (org.junit.Test)1 SwitchId (org.openkilda.model.SwitchId)1 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)1 UriComponentsBuilder (org.springframework.web.util.UriComponentsBuilder)1