use of org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation 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.GenericResourceApiRequestinformationRequestInformation 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;
}
use of org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation in project so by onap.
the class VfModuleTopologyOperationRequestMapper method reqMapper.
public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, String sdncAssignResponse, URI callbackURL) throws MapperException {
GenericResourceApiVfModuleOperationInformation req = new GenericResourceApiVfModuleOperationInformation();
boolean includeModelInformation = false;
GenericResourceApiRequestActionEnumeration requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
GenericResourceApiSvcActionEnumeration genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ASSIGN;
if (svcAction.equals(SDNCSvcAction.ACTIVATE)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ACTIVATE;
requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
includeModelInformation = true;
} else if (svcAction.equals(SDNCSvcAction.ASSIGN)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ASSIGN;
requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
includeModelInformation = true;
} else if (svcAction.equals(SDNCSvcAction.DEACTIVATE)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.DEACTIVATE;
requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;
includeModelInformation = false;
} else if (svcAction.equals(SDNCSvcAction.DELETE)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.DELETE;
requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;
includeModelInformation = false;
} else if (svcAction.equals(SDNCSvcAction.UNASSIGN)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.UNASSIGN;
requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;
includeModelInformation = false;
} else if (svcAction.equals(SDNCSvcAction.CHANGE_ASSIGN)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.CHANGEASSIGN;
requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
includeModelInformation = true;
}
String sdncReqId = UUID.randomUUID().toString();
String msoRequestId = UUID.randomUUID().toString();
if (requestContext != null && requestContext.getMsoRequestId() != null) {
msoRequestId = requestContext.getMsoRequestId();
}
GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction);
GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, includeModelInformation);
GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, includeModelInformation);
GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = generalTopologyObjectMapper.buildVfModuleInformation(vfModule, vnf, serviceInstance, requestContext, includeModelInformation);
GenericResourceApiVfmodulerequestinputVfModuleRequestInput vfModuleRequestInput = buildVfModuleRequestInput(vfModule, volumeGroup, cloudRegion, requestContext);
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = buildVfModuleSdncRequestHeader(sdncReqId, genericResourceApiSvcAction, callbackURL);
req.setRequestInformation(requestInformation);
req.setSdncRequestHeader(sdncRequestHeader);
req.setServiceInformation(serviceInformation);
req.setVnfInformation(vnfInformation);
req.setVfModuleInformation(vfModuleInformation);
req.setVfModuleRequestInput(vfModuleRequestInput);
return req;
}
use of org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation in project so by onap.
the class VnfTopologyOperationRequestMapper method reqMapper.
/**
* This method is used for creating the vnf request.
*
* By these parameter it will get he detailas and prepare the request.
*
* @param svcOperation
* @param svcAction
* @param requestAction
* @param vnf
* @param serviceInstance
* @param customer
* @param cloudRegion
* @param requestContext
* @param homing
* @return request
*/
public GenericResourceApiVnfOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration requestAction, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing, URI callbackUrl) {
String sdncReqId = UUID.randomUUID().toString();
String msoRequestId = UUID.randomUUID().toString();
if (requestContext != null && requestContext.getMsoRequestId() != null) {
msoRequestId = requestContext.getMsoRequestId();
}
GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation();
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUrl.toString());
GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction);
GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, true);
GenericResourceApiVnfrequestinputVnfRequestInput vnfRequestInput = new GenericResourceApiVnfrequestinputVnfRequestInput();
vnfRequestInput.setTenant(cloudRegion.getTenantId());
vnfRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId());
vnfRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
if (StringUtils.isNotBlank(vnf.getVnfName())) {
vnfRequestInput.setVnfName(vnf.getVnfName());
}
req.setRequestInformation(requestInformation);
req.setSdncRequestHeader(sdncRequestHeader);
req.setServiceInformation(serviceInformation);
req.setVnfInformation(vnfInformation);
GenericResourceApiParam vnfInputParameters = 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()));
vnfInputParameters.addParamItem(paramItem);
vnfRequestInput.setVnfInputParameters(vnfInputParameters);
}
}
if (vnf.getCloudParams() != null) {
for (Map.Entry<String, String> entry : vnf.getCloudParams().entrySet()) {
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName(entry.getKey());
paramItem.setValue(entry.getValue());
vnfInputParameters.addParamItem(paramItem);
}
}
if (homing) {
License license = vnf.getLicense();
if (license != null) {
if (license.getEntitlementPoolUuids() != null && !license.getEntitlementPoolUuids().isEmpty()) {
String entitlementPoolUuid = license.getEntitlementPoolUuids().get(0);
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName("entitlement_assignment_group_uuid");
paramItem.setValue(entitlementPoolUuid);
vnfInputParameters.addParamItem(paramItem);
}
if (license.getLicenseKeyGroupUuids() != null && !license.getLicenseKeyGroupUuids().isEmpty()) {
String licenseKeyGroupUuid = license.getLicenseKeyGroupUuids().get(0);
GenericResourceApiParamParam paramItem2 = new GenericResourceApiParamParam();
paramItem2.setName("license_assignment_group_uuid");
paramItem2.setValue(licenseKeyGroupUuid);
vnfInputParameters.addParamItem(paramItem2);
}
}
}
List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
List<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds> networkInstanceGroupIdList = new ArrayList<>();
for (InstanceGroup instanceGroup : instanceGroups) {
if (ModelInfoInstanceGroup.TYPE_L3_NETWORK.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds instanceGroupId = new GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds();
instanceGroupId.setVnfNetworkInstanceGroupId(instanceGroup.getId());
networkInstanceGroupIdList.add(instanceGroupId);
}
}
vnfRequestInput.setVnfNetworkInstanceGroupIds(networkInstanceGroupIdList);
vnfRequestInput.setVnfInputParameters(vnfInputParameters);
req.setVnfRequestInput(vnfRequestInput);
return req;
}
use of org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation in project so by onap.
the class GCTopologyOperationRequestMapper method deactivateOrUnassignVnrReqMapper.
public GenericResourceApiGcTopologyOperationInformation deactivateOrUnassignVnrReqMapper(SDNCSvcAction svcAction, ServiceInstance serviceInstance, RequestContext requestContext, Configuration vnrConfiguration, String sdncReqId, URI callbackUri) {
String msoRequestId = null;
if (requestContext != null) {
msoRequestId = requestContext.getMsoRequestId();
}
GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUri.toString());
GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, GenericResourceApiRequestActionEnumeration.DELETEGENERICCONFIGURATIONINSTANCE);
GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation();
serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId());
GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = new GenericResourceApiConfigurationinformationConfigurationInformation();
configurationInformation.setConfigurationId(vnrConfiguration.getConfigurationId());
configurationInformation.setConfigurationType(vnrConfiguration.getConfigurationType());
req.setRequestInformation(requestInformation);
req.setSdncRequestHeader(sdncRequestHeader);
req.setServiceInformation(serviceInformation);
req.setConfigurationInformation(configurationInformation);
return req;
}
Aggregations