use of org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam in project so by onap.
the class ServiceTopologyOperationMapper method reqMapper.
public GenericResourceApiServiceOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction, ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) {
String sdncReqId = UUID.randomUUID().toString();
String msoRequestId = UUID.randomUUID().toString();
if (requestContext != null && requestContext.getMsoRequestId() != null) {
msoRequestId = requestContext.getMsoRequestId();
}
GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation();
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, resourceAction);
GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput();
servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName());
servOpInput.setSdncRequestHeader(sdncRequestHeader);
servOpInput.setRequestInformation(reqInfo);
servOpInput.setServiceInformation(servInfo);
servOpInput.setServiceRequestInput(servReqInfo);
if (requestContext != null && requestContext.getUserParams() != null) {
for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput();
serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName());
GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName(entry.getKey());
paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
serviceInputParameters.addParamItem(paramItem);
serviceRequestInput.serviceInputParameters(serviceInputParameters);
servOpInput.setServiceRequestInput(serviceRequestInput);
}
}
return servOpInput;
}
use of org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam in project so by onap.
the class VfModuleTopologyOperationRequestMapper method buildVfModuleRequestInput.
private GenericResourceApiVfmodulerequestinputVfModuleRequestInput buildVfModuleRequestInput(VfModule vfModule, VolumeGroup volumeGroup, CloudRegion cloudRegion, RequestContext requestContext) {
GenericResourceApiVfmodulerequestinputVfModuleRequestInput vfModuleRequestInput = new GenericResourceApiVfmodulerequestinputVfModuleRequestInput();
if (cloudRegion != null) {
vfModuleRequestInput.setTenant(cloudRegion.getTenantId());
vfModuleRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId());
vfModuleRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
}
if (vfModule.getVfModuleName() != null && !vfModule.getVfModuleName().equals("")) {
vfModuleRequestInput.setVfModuleName(vfModule.getVfModuleName());
}
GenericResourceApiParam vfModuleInputParameters = new GenericResourceApiParam();
if (requestContext != null && requestContext.getUserParams() != null) {
for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName(entry.getKey());
paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
vfModuleInputParameters.addParamItem(paramItem);
}
}
if (vfModule.getCloudParams() != null) {
for (Map.Entry<String, String> entry : vfModule.getCloudParams().entrySet()) {
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName(entry.getKey());
paramItem.setValue(entry.getValue());
vfModuleInputParameters.addParamItem(paramItem);
}
}
if (volumeGroup != null) {
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName("volume-group-id");
paramItem.setValue(volumeGroup.getVolumeGroupId());
vfModuleInputParameters.addParamItem(paramItem);
}
vfModuleRequestInput.setVfModuleInputParameters(vfModuleInputParameters);
return vfModuleRequestInput;
}
use of org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam in project so by onap.
the class VnfAdapterObjectMapper method buildParamsMapFromSdncParams.
private void buildParamsMapFromSdncParams(Map<String, Object> volumeGroupParams, GenericResourceApiParam sdncParameters) {
if (sdncParameters != null) {
List<GenericResourceApiParamParam> sdncParametersList = sdncParameters.getParam();
if (sdncParametersList != null) {
for (int i = 0; i < sdncParametersList.size(); i++) {
GenericResourceApiParamParam param = sdncParametersList.get(i);
String parameterName = param.getName();
String parameterValue = param.getValue();
volumeGroupParams.put(parameterName, parameterValue);
}
}
}
}
use of org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam in project so by onap.
the class GeneralTopologyObjectMapperTest method buildGcRequestInformationTest_withInputParams.
@Test
public void buildGcRequestInformationTest_withInputParams() {
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("TestVnfId");
GenericResourceApiParam genericResourceApiParam = new GenericResourceApiParam();
genericResourceApiParam.addParamItem(new GenericResourceApiParamParam());
GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = genObjMapper.buildGcRequestInformation(vnf, genericResourceApiParam);
assertNotNull(gcRequestInput);
assertEquals(vnf.getVnfId(), gcRequestInput.getVnfId());
assertNotNull(gcRequestInput.getInputParameters());
}
use of org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam in project so by onap.
the class NetworkTopologyOperationRequestMapper method reqMapper.
public GenericResourceApiNetworkOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration reqAction, L3Network network, ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, CloudRegion cloudRegion) {
GenericResourceApiNetworkOperationInformation req = new GenericResourceApiNetworkOperationInformation();
String sdncReqId = UUID.randomUUID().toString();
String msoRequestId = UUID.randomUUID().toString();
if (requestContext != null && requestContext.getMsoRequestId() != null) {
msoRequestId = requestContext.getMsoRequestId();
}
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, reqAction);
GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
GenericResourceApiNetworkinformationNetworkInformation networkInformation = generalTopologyObjectMapper.buildNetworkInformation(network);
GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput = buildNetworkRequestInput(network, serviceInstance, cloudRegion);
req.setRequestInformation(requestInformation);
req.setSdncRequestHeader(sdncRequestHeader);
req.setServiceInformation(serviceInformation);
req.setNetworkInformation(networkInformation);
if (requestContext != null && requestContext.getUserParams() != null) {
for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
GenericResourceApiParam networkInputParameters = new GenericResourceApiParam();
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName(entry.getKey());
paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
networkInputParameters.addParamItem(paramItem);
networkRequestInput.setNetworkInputParameters(networkInputParameters);
}
}
req.setNetworkRequestInput(networkRequestInput);
return req;
}
Aggregations