use of com.vmware.flowgate.common.model.IntegrationStatus in project flowgate by vmware.
the class FacilitySoftwareControllerTest method createFacilitySoftware.
FacilitySoftwareConfig createFacilitySoftware() throws Exception {
FacilitySoftwareConfig example = new FacilitySoftwareConfig();
example.setId(UUID.randomUUID().toString());
example.setName("Nlyte");
example.setUserName("administrator@vsphere.local");
example.setPassword("Admin!23");
example.setServerURL("https://10.160.30.134");
example.setType(FacilitySoftwareConfig.SoftwareType.Nlyte);
example.setUserId("1");
example.setVerifyCert(false);
example.setDescription("description");
HashMap advanceSetting = new HashMap<AdvanceSettingType, String>();
example.setAdvanceSetting(advanceSetting);
IntegrationStatus integrationStatus = new IntegrationStatus();
integrationStatus.setDetail("");
integrationStatus.setRetryCounter(0);
integrationStatus.setStatus(Status.ACTIVE);
example.setIntegrationStatus(integrationStatus);
return example;
}
use of com.vmware.flowgate.common.model.IntegrationStatus in project flowgate by vmware.
the class InfobloxServiceTest method getInfobloxFacilitySoftware.
private ResponseEntity<FacilitySoftwareConfig[]> getInfobloxFacilitySoftware() {
FacilitySoftwareConfig[] facilitySoftwareConfigs = new FacilitySoftwareConfig[1];
FacilitySoftwareConfig facilitySoftwareConfig = new FacilitySoftwareConfig();
facilitySoftwareConfig.setPassword("O75xginpkAD748w=Lc20CrTzd1lEpvDTdJqH5IXBZTb5gYp7P8awDAs19F0=");
facilitySoftwareConfig.setServerURL("https://10.161.71.133");
facilitySoftwareConfig.setName("infoblox-1");
facilitySoftwareConfig.setVerifyCert(false);
IntegrationStatus integrationStatus = new IntegrationStatus();
integrationStatus.setRetryCounter(0);
integrationStatus.setDetail("");
integrationStatus.setStatus(IntegrationStatus.Status.ACTIVE);
facilitySoftwareConfig.setIntegrationStatus(integrationStatus);
facilitySoftwareConfig.setUserName("admin");
facilitySoftwareConfig.setType(FacilitySoftwareConfig.SoftwareType.InfoBlox);
facilitySoftwareConfig.setUserId("e1edfv8953002379827896a1aaiqoose");
facilitySoftwareConfigs[0] = facilitySoftwareConfig;
return new ResponseEntity<>(facilitySoftwareConfigs, HttpStatus.OK);
}
use of com.vmware.flowgate.common.model.IntegrationStatus in project flowgate by vmware.
the class LabsdbService method checkAndUpdateIntegrationStatus.
public void checkAndUpdateIntegrationStatus(FacilitySoftwareConfig labsdb, String message) {
IntegrationStatus integrationStatus = labsdb.getIntegrationStatus();
if (integrationStatus == null) {
integrationStatus = new IntegrationStatus();
}
int timesOftry = integrationStatus.getRetryCounter();
timesOftry++;
if (timesOftry < FlowgateConstant.MAXNUMBEROFRETRIES) {
integrationStatus.setRetryCounter(timesOftry);
} else {
integrationStatus.setStatus(IntegrationStatus.Status.ERROR);
integrationStatus.setDetail(message);
integrationStatus.setRetryCounter(FlowgateConstant.DEFAULTNUMBEROFRETRIES);
logger.error("Failed to query data from Labsdb");
}
labsdb.setIntegrationStatus(integrationStatus);
updateIntegrationStatus(labsdb);
}
use of com.vmware.flowgate.common.model.IntegrationStatus in project flowgate by vmware.
the class NlyteDataService method getRealTimeDatas.
public List<RealTimeData> getRealTimeDatas(NlyteAPIClient nlyteAPIclient, FacilitySoftwareConfig facilitySoftwareConfig, Set<String> assetIds) {
List<RealTimeData> realTimeDatas = new ArrayList<RealTimeData>();
for (String assetId : assetIds) {
Asset asset = restClient.getAssetByID(assetId).getBody();
if (asset == null || !facilitySoftwareConfig.getId().equals(asset.getAssetSource())) {
continue;
}
RealTimeData realTimeData = null;
try {
realTimeData = generateRealTimeData(asset, nlyteAPIclient, getAdvanceSetting(facilitySoftwareConfig));
} catch (HttpClientErrorException e) {
logger.error("Failed to query data from Nlyte", e);
IntegrationStatus integrationStatus = facilitySoftwareConfig.getIntegrationStatus();
if (integrationStatus == null) {
integrationStatus = new IntegrationStatus();
}
integrationStatus.setStatus(IntegrationStatus.Status.ERROR);
integrationStatus.setDetail(e.getMessage());
integrationStatus.setRetryCounter(FlowgateConstant.DEFAULTNUMBEROFRETRIES);
updateIntegrationStatus(facilitySoftwareConfig);
break;
} catch (ResourceAccessException e1) {
if (e1.getCause().getCause() instanceof ConnectException) {
checkAndUpdateIntegrationStatus(facilitySoftwareConfig, e1.getMessage());
break;
}
}
if (realTimeData == null) {
continue;
}
realTimeDatas.add(realTimeData);
}
return realTimeDatas;
}
use of com.vmware.flowgate.common.model.IntegrationStatus in project flowgate by vmware.
the class InfoBloxService method checkAndUpdateIntegrationStatus.
private void checkAndUpdateIntegrationStatus(FacilitySoftwareConfig infoblox, String message) {
IntegrationStatus integrationStatus = infoblox.getIntegrationStatus();
if (integrationStatus == null) {
integrationStatus = new IntegrationStatus();
}
int timesOftry = integrationStatus.getRetryCounter();
timesOftry++;
if (timesOftry < FlowgateConstant.MAXNUMBEROFRETRIES) {
integrationStatus.setRetryCounter(timesOftry);
} else {
logger.error("Failed to query data from Infoblox");
integrationStatus.setStatus(IntegrationStatus.Status.ERROR);
integrationStatus.setDetail(message);
integrationStatus.setRetryCounter(FlowgateConstant.DEFAULTNUMBEROFRETRIES);
}
infoblox.setIntegrationStatus(integrationStatus);
updateIntegrationStatus(infoblox);
}
Aggregations