* ============LICENSE_START=======================================================
* son-handler
* ================================================================================
- * Copyright (C) 2019 Wipro Limited.
+ * Copyright (C) 2019-2020 Wipro Limited.
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.Map;
import java.util.UUID;
-import org.onap.dcaegen2.services.sonhms.ConfigPolicy;
import org.onap.dcaegen2.services.sonhms.Configuration;
import org.onap.dcaegen2.services.sonhms.exceptions.OofNotFoundException;
import org.onap.dcaegen2.services.sonhms.model.AnrInput;
*/
public static String queryOof(int numSolutions, String transactionId, String requestType, List<String> cellIdList,
- String networkId, List<String> optimizers, List<AnrInput> anrInputList) throws OofNotFoundException {
+ String networkId, List<String> optimizers, List<AnrInput> anrInputList, List<String> fixedPciCells) throws OofNotFoundException {
log.debug("inside queryoof");
Configuration configuration = Configuration.getInstance();
Map<String, String> callbackHeader = new HashMap<>();
callbackHeader.put("Content-Type", "application/json");
requestInfo.setCallbackHeader(callbackHeader);
- ConfigPolicy config = ConfigPolicy.getInstance();
int timeout = 60;
- try {
- timeout = (int) config.getConfig().get("PCI_NEIGHBOR_CHANGE_CLUSTER_TIMEOUT_IN_SECS");
- } catch (NullPointerException e) {
- log.debug("No config policy available. Using default timeout 60 sec");
- }
requestInfo.setTimeout(timeout);
CellInfo cellInfo = new CellInfo();
if (!anrInputList.isEmpty()) {
cellInfo.setAnrInputList(anrInputList);
}
+ if(!fixedPciCells.isEmpty()) {
+ cellInfo.setFixedPCICells(fixedPciCells);
+ }
OofRequestBody oofRequestBody = new OofRequestBody();
oofRequestBody.setRequestInfo(requestInfo);
oofRequestBody.setCellInfo(cellInfo);
}
log.info("requestBody{}", requestBody);
- String requestUrl = configuration.getOofService() + "/api/oof/pci/v1";
- log.debug("requestUrl {}", requestUrl);
- ResponseEntity<String> response = null;
+ String requestUrl = configuration.getOofService() + configuration.getOofEndpoint();
+ log.info("requestUrl {}", requestUrl);
+ ResponseEntity<String> response = null;
response = SonHandlerRestTemplate.sendPostRequestToOof(requestUrl, requestBody,
new ParameterizedTypeReference<String>() {
});
+
if (response == null) {
throw new OofNotFoundException("Request to oof failed");
}
+ else if (response.getStatusCodeValue() != 202) {
+ throw new OofNotFoundException("Request to oof failed with status code" + response.getStatusCodeValue());
+ }
log.info("response {}", response);
return response.getBody();