use of org.openkilda.store.model.AuthConfigDto in project open-kilda by telstra.
the class SwitchStoreService method getSwitch.
/**
* Gets the switch with params.
*
* @return the switch with params
*/
public InventorySwitch getSwitch(String switchId) {
try {
UrlDto urlDto = storeService.getUrl(StoreType.SWITCH_STORE, Url.GET_SWITCH);
Map<String, String> params = new HashMap<String, String>();
params.put(RequestParams.SWITCH_ID.getName(), switchId);
urlDto.setParams(params);
AuthConfigDto authDto = authService.getAuth(StoreType.SWITCH_STORE);
IAuthService authService = IAuthService.getService(authDto.getAuthType());
return authService.getResponse(urlDto, authDto, InventorySwitch.class);
} catch (Exception e) {
LOGGER.error("Error occurred while retriving switches. Switch Id: " + switchId, e);
throw new StoreIntegrationException(e);
}
}
use of org.openkilda.store.model.AuthConfigDto in project open-kilda by telstra.
the class SwitchStoreService method getSwitchPort.
/**
* Gets the switch port.
*
* @param switchId the switch id
* @return the switch port
*/
public List<Port> getSwitchPort(final String switchId) {
try {
UrlDto urlDto = storeService.getUrl(StoreType.SWITCH_STORE, Url.GET_SWITCH_PORTS);
AuthConfigDto authDto = authService.getAuth(StoreType.SWITCH_STORE);
Map<String, String> params = new HashMap<String, String>();
params.put(RequestParams.SWITCH_ID.getName(), switchId);
urlDto.setParams(params);
IAuthService authService = IAuthService.getService(authDto.getAuthType());
return authService.getResponseList(urlDto, authDto, Port.class);
} catch (Exception e) {
LOGGER.error("Error occurred while retriving switch ports. Switch Id: " + switchId, e);
throw new StoreIntegrationException(e);
}
}
use of org.openkilda.store.model.AuthConfigDto in project open-kilda by telstra.
the class SwitchStoreService method getSwitches.
/**
* Gets the switches with params.
*
* @return the switches with params
*/
public List<InventorySwitch> getSwitches() {
try {
UrlDto urlDto = storeService.getUrl(StoreType.SWITCH_STORE, Url.GET_ALL_SWITCHES);
AuthConfigDto authDto = authService.getAuth(StoreType.SWITCH_STORE);
IAuthService authService = IAuthService.getService(authDto.getAuthType());
return authService.getResponseList(urlDto, authDto, InventorySwitch.class);
} catch (Exception e) {
LOGGER.error("Error occurred while retriving switches", e);
throw new StoreIntegrationException(e);
}
}
use of org.openkilda.store.model.AuthConfigDto in project open-kilda by telstra.
the class FlowStoreService method getContracts.
/**
* Gets the all contracts.
*
* @param linkId
* the link id
* @return the all contracts
*/
public List<Contract> getContracts(final String linkId) {
try {
UrlDto urlDto = storeService.getUrl(StoreType.LINK_STORE, Url.GET_CONTRACT);
Map<String, String> params = new HashMap<String, String>();
params.put(RequestParams.LINK_ID.getName(), linkId);
urlDto.setParams(params);
AuthConfigDto authDto = authService.getAuth(StoreType.LINK_STORE);
IAuthService authService = IAuthService.getService(authDto.getAuthType());
return authService.getResponseList(urlDto, authDto, Contract.class);
} catch (Exception e) {
LOGGER.error("Error occurred while retriving contracts by link id: " + linkId, e);
throw new StoreIntegrationException(e);
}
}
use of org.openkilda.store.model.AuthConfigDto in project open-kilda by telstra.
the class FlowStoreService method deleteContract.
/**
* Delete contract.
*
* @param linkId
* the link id
* @param contractId
* the contract id
*/
public void deleteContract(final String linkId, final String contractId) {
try {
UrlDto urlDto = storeService.getUrl(StoreType.LINK_STORE, Url.DELETE_CONTRACT);
Map<String, String> params = new HashMap<String, String>();
params.put(RequestParams.LINK_ID.getName(), linkId);
params.put(RequestParams.CONTRACT_ID.getName(), contractId);
urlDto.setParams(params);
AuthConfigDto authDto = authService.getAuth(StoreType.LINK_STORE);
IAuthService authService = IAuthService.getService(authDto.getAuthType());
authService.getResponse(urlDto, authDto, null);
} catch (Exception e) {
LOGGER.error("Error occurred while deleting contract: " + contractId, e);
throw new StoreIntegrationException(e);
}
}
Aggregations