use of org.openkilda.integration.exception.StoreIntegrationException in project open-kilda by telstra.
the class FlowStoreService method getAllStatus.
/**
* Gets the all status list.
*
* @return the all status list
*/
public List<String> getAllStatus() {
try {
UrlDto urlDto = storeService.getUrl(StoreType.LINK_STORE, Url.GET_STATUS_LIST);
AuthConfigDto authDto = authService.getAuth(StoreType.LINK_STORE);
IAuthService authService = IAuthService.getService(authDto.getAuthType());
return authService.getResponseList(urlDto, authDto, String.class);
} catch (Exception e) {
LOGGER.error("Error occurred while retriving status list", e);
throw new StoreIntegrationException(e);
}
}
use of org.openkilda.integration.exception.StoreIntegrationException in project open-kilda by telstra.
the class FlowStoreService method getFlowsWithParams.
/**
* Gets the flows with params.
*
* @param status the status
* @return the flows with params
*/
public List<InventoryFlow> getFlowsWithParams(final String status) {
try {
UrlDto urlDto = storeService.getUrl(StoreType.LINK_STORE, Url.GET_LINKS_WITH_PARAMS);
Map<String, String> params = new HashMap<String, String>();
params.put(RequestParams.STATUS.getName(), status);
urlDto.setParams(params);
AuthConfigDto authDto = authService.getAuth(StoreType.LINK_STORE);
IAuthService authService = IAuthService.getService(authDto.getAuthType());
return authService.getResponseList(urlDto, authDto, InventoryFlow.class);
} catch (Exception e) {
LOGGER.error("Error occurred while retriving flows with status: " + status, e);
throw new StoreIntegrationException(e);
}
}
use of org.openkilda.integration.exception.StoreIntegrationException in project open-kilda by telstra.
the class SwitchService method getSwitch.
/**
* get All SwitchList.
*
* @return SwitchRelationData the switch info
* @throws IntegrationException the integration exception
*/
public SwitchInfo getSwitch(final String switchId, boolean controller) throws IntegrationException {
SwitchInfo switchInfo = null;
try {
switchInfo = switchIntegrationService.getSwitchesById(switchId);
} catch (InvalidResponseException ex) {
LOGGER.error("Error occurred while retrieving switches from controller", ex);
}
if (!controller) {
try {
UserInfo userInfo = userService.getLoggedInUserInfo();
if (userInfo.getPermissions().contains(IConstants.Permission.SW_SWITCH_INVENTORY)) {
if (storeService.getSwitchStoreConfig().getUrls().size() > 0) {
InventorySwitch inventorySwitch = switchStoreService.getSwitch(switchId);
if (inventorySwitch.getSwitchId() != null) {
switchInfo = processInventorySwitch(switchInfo, inventorySwitch);
} else {
SwitchDiscrepancy discrepancy = new SwitchDiscrepancy();
discrepancy.setControllerDiscrepancy(false);
discrepancy.setStatus(true);
discrepancy.setInventoryDiscrepancy(true);
SwitchStatus switchState = new SwitchStatus();
switchState.setControllerStatus(switchInfo.getState());
discrepancy.setStatusValue(switchState);
switchInfo.setDiscrepancy(discrepancy);
}
}
}
} catch (Exception ex) {
LOGGER.error("Error occurred while retrieving switches from store", ex);
throw new StoreIntegrationException("Error occurred while retrieving switches from store");
}
}
return switchInfo;
}
use of org.openkilda.integration.exception.StoreIntegrationException in project open-kilda by telstra.
the class FlowStoreService method getFlowById.
/**
* Gets the flow by id.
*
* @param flowId the flow id
* @return the flow by id
*/
public InventoryFlow getFlowById(final String flowId) {
try {
UrlDto urlDto = storeService.getUrl(StoreType.LINK_STORE, Url.GET_LINK);
Map<String, String> params = new HashMap<String, String>();
params.put(RequestParams.LINK_ID.getName(), flowId);
urlDto.setParams(params);
AuthConfigDto authDto = authService.getAuth(StoreType.LINK_STORE);
IAuthService authService = IAuthService.getService(authDto.getAuthType());
return authService.getResponse(urlDto, authDto, InventoryFlow.class);
} catch (Exception e) {
LOGGER.error("Error occurred while retriving flow by id: " + flowId, e);
throw new StoreIntegrationException(e);
}
}
use of org.openkilda.integration.exception.StoreIntegrationException in project open-kilda by telstra.
the class SwitchStoreService method getPortFlows.
/**
* Gets the customer flows.
*
* @return the customer with flows
*/
public List<Customer> getPortFlows(String switchId, String port) {
try {
UrlDto urlDto = storeService.getUrl(StoreType.SWITCH_STORE, Url.GET_SWITCH_PORT_FLOWS);
Map<String, String> params = new HashMap<String, String>();
params.put(RequestParams.SWITCH_ID.getName(), switchId);
params.put(RequestParams.PORT_NUMBER.getName(), port);
urlDto.setParams(params);
AuthConfigDto authDto = authService.getAuth(StoreType.SWITCH_STORE);
IAuthService authService = IAuthService.getService(authDto.getAuthType());
return authService.getResponseList(urlDto, authDto, Customer.class);
} catch (Exception e) {
LOGGER.error("Error occurred while retriving switch port flows. Switch Id: " + switchId + ", Port: " + port, e);
throw new StoreIntegrationException(e);
}
}
Aggregations