diff options
11 files changed, 1201 insertions, 244 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java index 59c6becfbd..fa5c57f447 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java @@ -89,4 +89,23 @@ public final class AuthenticationMethodFactory { v3Auth.setScope(scope); return v3Auth; } + + public final com.woorea.openstack.keystone.v3.model.Authentication getAuthenticationForV3( + CloudIdentity cloudIdentity) { + Identity identity = new Identity(); + Password password = new Password(); + User user = new User(); + Domain userDomain = new Domain(); + userDomain.setName(cloudIdentity.getUserDomainName()); + user.setName(cloudIdentity.getMsoId()); + user.setPassword(CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass())); + user.setDomain(userDomain); + password.setUser(user); + identity.setPassword(password); + identity.setMethods(Collections.singletonList("password")); + com.woorea.openstack.keystone.v3.model.Authentication v3Auth = + new com.woorea.openstack.keystone.v3.model.Authentication(); + v3Auth.setIdentity(identity); + return v3Auth; + } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java index 16906957a7..3564b8f0a7 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java @@ -107,7 +107,7 @@ public class KeystoneV3Authentication { return policy; } - protected String findEndpointURL(List<Service> serviceCatalog, String type, String region, String facing) { + public String findEndpointURL(List<Service> serviceCatalog, String type, String region, String facing) { for (Service service : serviceCatalog) { if (type.equals(service.getType())) { for (Service.Endpoint endpoint : service.getEndpoints()) { diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java index 63bc235363..072ab5a8d0 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java @@ -21,15 +21,29 @@ package org.onap.so.openstack.utils; import java.util.Map; +import org.onap.so.cloud.authentication.AuthenticationMethodFactory; import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.utils.CryptoUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.woorea.openstack.keystone.v3.model.Token; +import com.woorea.openstack.base.client.OpenStackConnectException; +import com.woorea.openstack.base.client.OpenStackResponseException; +import com.woorea.openstack.keystone.v3.Keystone; +import com.woorea.openstack.keystone.v3.api.TokensResource.Authenticate; +import com.woorea.openstack.keystone.v3.model.Authentication; +import com.woorea.openstack.keystone.v3.model.Authentication.Identity; @Component public class MsoKeystoneV3Utils extends MsoTenantUtils { + @Autowired + private AuthenticationMethodFactory authenticationMethodFactory; + @Override public String createTenant(String tenantName, String cloudSiteId, Map<String, String> metadata, boolean backout) throws MsoException { @@ -57,4 +71,22 @@ public class MsoKeystoneV3Utils extends MsoTenantUtils { return cloudIdentity.getIdentityUrl(); } + public Token getKeystoneToken(CloudSite cloudSite) throws MsoException { + try { + CloudIdentity cloudIdentity = cloudSite.getIdentityService(); + + Keystone keystone = new Keystone(cloudIdentity.getIdentityUrl()); + + Authentication auth = authenticationMethodFactory.getAuthenticationForV3(cloudIdentity); + + Authenticate authenticate = keystone.tokens().authenticate(auth); + return executeAndRecordOpenstackRequest(authenticate); + + } catch (OpenStackResponseException e) { + throw keystoneErrorToMsoException(e, "TokenAuth"); + } catch (OpenStackConnectException e) { + throw keystoneErrorToMsoException(e, "TokenAuth"); + } + } + } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java index c5eeb34157..968e7864b3 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java @@ -49,4 +49,6 @@ public class NovaClient extends MsoCommonUtils { novaClient.token(keystone.getId()); return novaClient; } + + } diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml index ad41b0f050..eb6cba5510 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -298,7 +298,7 @@ <dependency> <groupId>commons-validator</groupId> <artifactId>commons-validator</artifactId> - <version>1.4.0</version> + <version>1.4.1</version> </dependency> <!-- added for unit testing --> diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index 45d91c26c4..10f39f717f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -49,6 +49,7 @@ import org.apache.commons.validator.routines.InetAddressValidator; import org.onap.aai.domain.yang.Flavor; import org.onap.aai.domain.yang.Image; import org.onap.aai.domain.yang.L3InterfaceIpv4AddressList; +import org.onap.aai.domain.yang.L3InterfaceIpv6AddressList; import org.onap.aai.domain.yang.L3Network; import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.PInterface; @@ -524,6 +525,20 @@ public class HeatBridgeImpl implements HeatBridgeApi { .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId()) .lInterface(lIf.getInterfaceName()).l3InterfaceIpv4AddressList(ipAddress)), Optional.of(lInterfaceIp)); + } else if (InetAddressValidator.getInstance().isValidInet6Address(ipAddress)) { + Subnet subnet = osClient.getSubnetById(ip.getSubnetId()); + IPAddressString cidr = new IPAddressString(subnet.getCidr()); + L3InterfaceIpv6AddressList ipv6 = new L3InterfaceIpv6AddressList(); + ipv6.setL3InterfaceIpv6Address(ipAddress); + ipv6.setNeutronNetworkId(port.getNetworkId()); + ipv6.setNeutronSubnetId(ip.getSubnetId()); + ipv6.setL3InterfaceIpv6PrefixLength(Long.parseLong(cidr.getNetworkPrefixLength().toString())); + + transaction.createIfNotExists( + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() + .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId()) + .lInterface(lIf.getInterfaceName()).l3InterfaceIpv6AddressList(ipAddress)), + Optional.of(ipv6)); } } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java index 8c21e3f7f7..03f6c737f3 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java @@ -423,6 +423,18 @@ public class HeatBridgeImplTest { when(port.getProfile()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_PCI_SLOT_KEY, pfPciId, HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY, "physical_network_id")); + IP ip = mock(IP.class); + + Set<IP> ipSet = new HashSet<>(); + ipSet.add(ip); + when(ip.getIpAddress()).thenReturn("2606:ae00:2e60:100::226"); + when(ip.getSubnetId()).thenReturn("testSubnetId"); + when(port.getFixedIps()).thenAnswer(x -> ipSet); + + Subnet subnet = mock(Subnet.class); + when(subnet.getCidr()).thenReturn("169.254.100.0/24"); + when(osClient.getSubnetById("testSubnetId")).thenReturn(subnet); + Network network = mock(Network.class); when(network.getId()).thenReturn("test-network-id"); when(network.getNetworkType()).thenReturn(NetworkType.VLAN); @@ -446,8 +458,9 @@ public class HeatBridgeImplTest { heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner"); // Assert - verify(transaction, times(15)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + verify(transaction, times(20)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); verify(osClient, times(5)).getPortById(anyString()); + verify(osClient, times(5)).getSubnetById("testSubnetId"); verify(osClient, times(10)).getNetworkById(anyString()); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy index 08c032fba3..146889351a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy @@ -64,208 +64,211 @@ import org.slf4j.LoggerFactory class SniroHomingV1 extends AbstractServiceTaskProcessor{ private static final Logger logger = LoggerFactory.getLogger( SniroHomingV1.class); - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - SniroUtils sniroUtils = new SniroUtils(this) - - /** - * This method validates the incoming variables. - * The method then prepares the sniro request - * and posts it to sniro's rest api. - * - * @param execution - * - * @author cb645j - */ - public void callSniro(DelegateExecution execution){ - execution.setVariable("prefix","HOME_") - logger.trace("Started Sniro Homing Call Sniro ") - try{ - execution.setVariable("rollbackData", null) - execution.setVariable("rolledBack", false) - - String requestId = execution.getVariable("msoRequestId") - logger.debug("Incoming Request Id is: " + requestId) - String serviceInstanceId = execution.getVariable("serviceInstanceId") - logger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - logger.debug("Incoming Service Decomposition is: " + serviceDecomposition) - String subscriberInfo = execution.getVariable("subscriberInfo") - logger.debug("Incoming Subscriber Information is: " + subscriberInfo) - - if(isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)){ - exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null") - }else{ - String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") - String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") - String subCommonSiteId = "" - if(jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")){ - subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") - } - Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId) - - String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used - String homingParameters = execution.getVariable("homingParameters") // (aka. request parameters) Should be json format. TODO confirm its json format - - //Authentication - String authHeader = UrnPropertiesReader.getVariable("sniro.manager.headers.auth", execution) - execution.setVariable("BasicAuthHeaderValue", authHeader) - - //Prepare Callback - String timeout = execution.getVariable("timeout") - if(isBlank(timeout)){ - timeout = UrnPropertiesReader.getVariable("sniro.manager.timeout", execution) - if(isBlank(timeout)) { - timeout = "PT30M"; - } - } - logger.debug("Async Callback Timeout will be: " + timeout) - - execution.setVariable("timeout", timeout); - execution.setVariable("correlator", requestId); - execution.setVariable("messageType", "SNIROResponse"); - - //Build Request & Call Sniro - String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters) - execution.setVariable("sniroRequest", sniroRequest) - logger.debug("SNIRO Request is: " + sniroRequest) - - String endpoint = UrnPropertiesReader.getVariable("sniro.manager.uri.v1", execution) - String host = UrnPropertiesReader.getVariable("sniro.manager.host", execution) - String urlString = host + endpoint - logger.debug("Sniro Url is: " + urlString) - - URL url = new URL(urlString); - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SNIRO) - httpClient.addAdditionalHeader("Authorization", authHeader) - Response httpResponse = httpClient.post(sniroRequest) - - int responseCode = httpResponse.getStatus() - - logger.debug("Sniro sync response code is: " + responseCode) - if(httpResponse.hasEntity()){ - logger.debug("Sniro sync response is: " + httpResponse.readEntity(String.class)) - } - - if(responseCode != 202){ - exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.") - } - - logger.trace("Completed Sniro Homing Call Sniro") - } - }catch(BpmnError b){ - throw b - }catch(Exception e){ - logger.debug("Error encountered within Homing CallSniro method: " + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage()) - } - } - - /** - * This method processes the callback response - * and the contained homing solution. It sets - * homing solution assignment and license - * information to the corresponding resources - * - * @param execution - * - * @author cb645j - */ - public void processHomingSolution(DelegateExecution execution){ - logger.trace("Started Sniro Homing Process Homing Solution") - try{ - String response = execution.getVariable("asyncCallbackResponse") - logger.debug("Sniro Async Callback Response is: " + response) - - sniroUtils.validateCallbackResponse(execution, response) - - ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") - List<Resource> resourceList = decomposition.getServiceResources() - - if(JsonUtils.jsonElementExist(response, "solutionInfo.placementInfo")){ - String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo") - JSONArray arr = new JSONArray(placements) - for(int i = 0; i < arr.length(); i++){ - JSONObject placement = arr.getJSONObject(i) - String jsonServiceResourceId = placement.getString("serviceResourceId") - for(Resource resource:resourceList){ - String serviceResourceId = resource.getResourceId() - if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){ - //match - String inventoryType = placement.getString("inventoryType") - resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) - resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId")) - resource.getHomingSolution().setRehome(placement.getBoolean("isRehome")) - JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") - Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue") - resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner")) - resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli")) - resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion")) - if(inventoryType.equalsIgnoreCase("service")){ - VnfResource vnf = new VnfResource() - vnf.setVnfHostname(assignmentMap.get("vnfHostName")) - resource.getHomingSolution().setVnf(vnf) - resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId")) - } - } - } - } - } - - if(JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")){ - String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo") - JSONArray licenseArr = new JSONArray(licenseInfo) - for(int l = 0; l < licenseArr.length(); l++){ - JSONObject license = licenseArr.getJSONObject(l) - String jsonServiceResourceId = license.getString("serviceResourceId") - for(Resource resource:resourceList){ - String serviceResourceId = resource.getResourceId() - if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){ - //match - String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList") - List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList) - resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList) - - String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList") - List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList) - resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList) - } - } - } - } - execution.setVariable("serviceDecomposition", decomposition) - - logger.trace("Completed Sniro Homing Process Homing Solution") - }catch(BpmnError b){ - throw b - }catch(Exception e){ - logger.debug("Error encountered within Homing ProcessHomingSolution method: " + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Process Solution") - } - } - - /** - * This method logs the start of DHVCreateService - * to make debugging easier. - * - * @param - execution - * @author cb645j - */ - public String logStart(DelegateExecution execution){ - String requestId = execution.getVariable("testReqId") - if(isBlank(requestId)){ - requestId = execution.getVariable("msoRequestId") - } - execution.setVariable("DHVCS_requestId", requestId) - logger.trace("STARTED Homing Subflow for request: " + requestId + " ") - logger.debug("****** Homing Subflow Global Debug Enabled: " + execution.getVariable("isDebugLogEnabled") + " *****") - logger.trace("STARTED Homing Subflow for request: " + requestId + " ") - } - - - /** - * Auto-generated method stub - */ - public void preProcessRequest(DelegateExecution execution){} + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + SniroUtils sniroUtils = new SniroUtils(this) + + /** + * This method validates the incoming variables. + * The method then prepares the sniro request + * and posts it to sniro's rest api. + * + * @param execution + * + * @author cb645j + */ + public void callSniro(DelegateExecution execution){ + execution.setVariable("prefix","HOME_") + logger.trace("Started Sniro Homing Call Sniro ") + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + + String requestId = execution.getVariable("msoRequestId") + logger.debug("Incoming Request Id is: " + requestId) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + logger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + logger.debug("Incoming Service Decomposition is: " + serviceDecomposition) + String subscriberInfo = execution.getVariable("subscriberInfo") + logger.debug("Incoming Subscriber Information is: " + subscriberInfo) + + if(isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)){ + exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null") + }else{ + String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") + String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") + String subCommonSiteId = "" + if(jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")){ + subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") + } + Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId) + + String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used + String homingParameters = execution.getVariable("homingParameters") // (aka. request parameters) Should be json format. TODO confirm its json format + + //Authentication + String authHeader = UrnPropertiesReader.getVariable("sniro.manager.headers.auth", execution) + execution.setVariable("BasicAuthHeaderValue", authHeader) + + //Prepare Callback + String timeout = execution.getVariable("timeout") + if(isBlank(timeout)){ + timeout = UrnPropertiesReader.getVariable("sniro.manager.timeout", execution) + if(isBlank(timeout)) { + timeout = "PT30M"; + } + } + logger.debug("Async Callback Timeout will be: " + timeout) + + execution.setVariable("timeout", timeout); + execution.setVariable("correlator", requestId); + execution.setVariable("messageType", "SNIROResponse"); + + //Build Request & Call Sniro + String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters) + execution.setVariable("sniroRequest", sniroRequest) + logger.debug("SNIRO Request is: " + sniroRequest) + + String endpoint = UrnPropertiesReader.getVariable("sniro.manager.uri.v1", execution) + String host = UrnPropertiesReader.getVariable("sniro.manager.host", execution) + String urlString = host + endpoint + logger.debug("Sniro Url is: " + urlString) + + URL url = new URL(urlString); + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SNIRO) + httpClient.addAdditionalHeader("Authorization", authHeader) + Response httpResponse = httpClient.post(sniroRequest) + + int responseCode = httpResponse.getStatus() + + logger.debug("Sniro sync response code is: " + responseCode) + if(httpResponse.hasEntity()){ + logger.debug("Sniro sync response is: " + httpResponse.readEntity(String.class)) + } + + if(responseCode != 202){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.") + } + + logger.trace("Completed Sniro Homing Call Sniro") + } + }catch(BpmnError b){ + throw b + }catch(Exception e){ + logger.debug("Error encountered within Homing CallSniro method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage()) + } + } + + /** + * This method processes the callback response + * and the contained homing solution. It sets + * homing solution assignment and license + * information to the corresponding resources + * + * @param execution + * + * @author cb645j + */ + public void processHomingSolution(DelegateExecution execution){ + logger.trace("Started Sniro Homing Process Homing Solution") + try{ + String response = execution.getVariable("asyncCallbackResponse") + logger.debug("Sniro Async Callback Response is: " + response) + + sniroUtils.validateCallbackResponse(execution, response) + + ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") + List<Resource> resourceList = decomposition.getServiceResources() + + if(JsonUtils.jsonElementExist(response, "solutionInfo.placementInfo")){ + String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo") + JSONArray arr = new JSONArray(placements) + for(int i = 0; i < arr.length(); i++){ + JSONObject placement = arr.getJSONObject(i) + String jsonServiceResourceId = placement.getString("serviceResourceId") + for(Resource resource:resourceList){ + String serviceResourceId = resource.getResourceId() + if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){ + //match + String inventoryType = placement.getString("inventoryType") + resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) + resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId")) + resource.getHomingSolution().setRehome(placement.getBoolean("isRehome")) + JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") + Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue") + resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner")) + resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli")) + resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion")) + if(inventoryType.equalsIgnoreCase("service")){ + VnfResource vnf = new VnfResource() + vnf.setVnfHostname(assignmentMap.get("vnfHostName")) + resource.getHomingSolution().setVnf(vnf) + resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId")) + } + if(placement.getBoolean("isRehome")) { + resource.getHomingSolution().setAllottedResourceId(assignmentMap.get("serviceResourceId")) + } + } + } + } + } + + if(JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")){ + String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo") + JSONArray licenseArr = new JSONArray(licenseInfo) + for(int l = 0; l < licenseArr.length(); l++){ + JSONObject license = licenseArr.getJSONObject(l) + String jsonServiceResourceId = license.getString("serviceResourceId") + for(Resource resource:resourceList){ + String serviceResourceId = resource.getResourceId() + if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){ + //match + String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList") + List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList) + resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList) + + String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList") + List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList) + resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList) + } + } + } + } + execution.setVariable("serviceDecomposition", decomposition) + + logger.trace("Completed Sniro Homing Process Homing Solution") + }catch(BpmnError b){ + throw b + }catch(Exception e){ + logger.debug("Error encountered within Homing ProcessHomingSolution method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Process Solution") + } + } + + /** + * This method logs the start of DHVCreateService + * to make debugging easier. + * + * @param - execution + * @author cb645j + */ + public String logStart(DelegateExecution execution){ + String requestId = execution.getVariable("testReqId") + if(isBlank(requestId)){ + requestId = execution.getVariable("msoRequestId") + } + execution.setVariable("DHVCS_requestId", requestId) + logger.trace("STARTED Homing Subflow for request: " + requestId + " ") + logger.debug("****** Homing Subflow Global Debug Enabled: " + execution.getVariable("isDebugLogEnabled") + " *****") + logger.trace("STARTED Homing Subflow for request: " + requestId + " ") + } + + + /** + * Auto-generated method stub + */ + public void preProcessRequest(DelegateExecution execution){} } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java index 309b053589..ddfb29e97e 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java @@ -37,6 +37,7 @@ public class HomingSolution extends JsonWrapper implements Serializable { private InventoryType inventoryType; private boolean isRehome; private String serviceInstanceId; // TODO should start using si object instead + private String allottedResourceId; private String cloudOwner; private String cloudRegionId; private String aicClli; @@ -74,6 +75,14 @@ public class HomingSolution extends JsonWrapper implements Serializable { this.serviceInstanceId = serviceInstanceId; } + public String getAllottedResourceId() { + return allottedResourceId; + } + + public void setAllottedResourceId(String allottedResourceId) { + this.allottedResourceId = allottedResourceId; + } + public String getCloudOwner() { return cloudOwner; } diff --git a/docs/api/swagger/swagger.html b/docs/api/swagger/swagger.html index 5d7c963a8a..514c2bdda2 100644 --- a/docs/api/swagger/swagger.html +++ b/docs/api/swagger/swagger.html @@ -843,11 +843,191 @@ margin-bottom: 20px; }, "description" : "This describes the subnet capabilities that can be queried" }; + defs["RetrievingWorkflowResponse"] = { + "type" : "object", + "properties" : { + "workflowSpecificationList" : { + "type" : "array", + "description" : "List of Workflow specification data", + "items" : { + "$ref" : "#/definitions/WorkflowSpecification" + } + } + }, + "description" : "Response body of fetching workflows using resource target" +}; + defs["ServiceLevelWorkflowExecution"] = { + "type" : "object", + "properties" : { + "requestInfo" : { + "$ref" : "#/definitions/ServiceLevelWorkflowExecution_requestInfo" + }, + "modelInfo" : { + "$ref" : "#/definitions/ServiceLevelWorkflowExecution_modelInfo" + }, + "requestParameters" : { + "$ref" : "#/definitions/ServiceLevelWorkflowExecution_requestParameters" + }, + "subscriberInfo" : { + "$ref" : "#/definitions/ServiceLevelWorkflowExecution_subscriberInfo" + }, + "project" : { + "$ref" : "#/definitions/ServiceLevelWorkflowExecution_project" + }, + "owningEntity" : { + "$ref" : "#/definitions/ServiceLevelWorkflowExecution_owningEntity" + } + }, + "description" : "This describes the request body of service level custom workflow execution" +}; + defs["ServiceLevelWorkflowExecution_modelInfo"] = { + "type" : "object", + "properties" : { + "modelType" : { + "type" : "string", + "description" : "Type of the model to be executed" + }, + "modelInvariantUuid" : { + "type" : "string", + "description" : "Model invariant id corresponding to the service" + }, + "modelUuid" : { + "type" : "string", + "description" : "Model uuid corresponding to the service" + }, + "modelVersionId" : { + "type" : "string", + "description" : "Model version of the service instance" + }, + "modelName" : { + "type" : "string", + "description" : "Name of the service" + }, + "modelVersion" : { + "type" : "string", + "description" : "Version of the service instance" + } + }, + "description" : "Parameters related to the service model" +}; + defs["ServiceLevelWorkflowExecution_owningEntity"] = { + "type" : "object", + "properties" : { + "owningEntityId" : { + "type" : "string", + "description" : "Id of the owning Entity" + }, + "owningEntityName" : { + "type" : "string", + "description" : "Name of the owning Entity" + } + }, + "description" : "Object describes the entity details" +}; + defs["ServiceLevelWorkflowExecution_project"] = { + "type" : "object", + "properties" : { + "projectName" : { + "type" : "string", + "description" : "Name of the target project" + } + }, + "description" : "Information about the target project name" +}; + defs["ServiceLevelWorkflowExecution_requestInfo"] = { + "type" : "object", + "properties" : { + "source" : { + "type" : "string", + "description" : "Name of the sender" + }, + "suppressRollback" : { + "type" : "boolean", + "description" : "Enable/disable rollback suppression" + }, + "requestorId" : { + "type" : "string", + "description" : "Id of the sender" + } + }, + "description" : "Request object contains source information" +}; + defs["ServiceLevelWorkflowExecution_requestParameters"] = { + "type" : "object", + "properties" : { + "subscriptionServiceType" : { + "type" : "string", + "description" : "Type of service subscription" + } + }, + "description" : "User parameter object" +}; + defs["ServiceLevelWorkflowExecution_subscriberInfo"] = { + "type" : "object", + "properties" : { + "globalSubscriberId" : { + "type" : "string", + "description" : "Id of the subscriber sending the request" + } + }, + "description" : "Subscriber id information" +}; defs["SubnetTypes"] = { "type" : "string", "description" : "This describes allowed subnet types", "enum" : [ "AN", "AN_NF", "CN", "TN_FH", "TN_MH", "TN_BH" ] }; + defs["WorkflowSpecification"] = { + "type" : "object", + "properties" : { + "artifactInfo" : { + "$ref" : "#/definitions/WorkflowSpecification_artifactInfo" + } + }, + "description" : "This describes workflow specification object" +}; + defs["WorkflowSpecification_artifactInfo"] = { + "type" : "object", + "properties" : { + "artifactType" : { + "type" : "string", + "description" : "Type of the artifact to be queried" + }, + "artifactUuid" : { + "type" : "string", + "description" : "UUID of the artifact" + }, + "artifactName" : { + "type" : "string", + "description" : "Name of the artifact" + }, + "artifactVersion" : { + "type" : "string", + "description" : "Artifact's Version" + }, + "artifactDescription" : { + "type" : "string", + "description" : "" + }, + "workflowName" : { + "type" : "string", + "description" : "Name of the workflow fetched for the resource type" + }, + "operationName" : { + "type" : "string", + "description" : "Mapped operation name of the corresponding workflow" + }, + "workflowSource" : { + "type" : "string", + "description" : "" + }, + "workflowResourceTarget" : { + "type" : "string", + "description" : "Type of Resource mapped against the workflow" + } + }, + "description" : "Attributes related to artifact information " +}; </script> <div class="container-fluid"> @@ -930,6 +1110,10 @@ margin-bottom: 20px; <li data-group="OnapsoinfracloudResourcesRequests" data-name="unlockOrchestrationRequestForReqId" class=""> <a href="#api-OnapsoinfracloudResourcesRequests-unlockOrchestrationRequestForReqId">unlockOrchestrationRequestForReqId</a> </li> + <li class="nav-header" data-group="OnapsoinfrainstanceManagement"><a href="#api-OnapsoinfrainstanceManagement">API Methods - OnapsoinfrainstanceManagement</a></li> + <li data-group="OnapsoinfrainstanceManagement" data-name="executeServiceLevelCustomWorkflow" class=""> + <a href="#api-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow">executeServiceLevelCustomWorkflow</a> + </li> <li class="nav-header" data-group="OnapsoinframodelDistributions"><a href="#api-OnapsoinframodelDistributions">API Methods - OnapsoinframodelDistributions</a></li> <li data-group="OnapsoinframodelDistributions" data-name="updateModelDistributionStatus" class=""> <a href="#api-OnapsoinframodelDistributions-updateModelDistributionStatus">updateModelDistributionStatus</a> @@ -1067,6 +1251,10 @@ margin-bottom: 20px; <li data-group="Onapsoinfratasks" data-name="queryFilters" class=""> <a href="#api-Onapsoinfratasks-queryFilters">queryFilters</a> </li> + <li class="nav-header" data-group="OnapsoinfraworkflowSpecifications"><a href="#api-OnapsoinfraworkflowSpecifications">API Methods - OnapsoinfraworkflowSpecifications</a></li> + <li data-group="OnapsoinfraworkflowSpecifications" data-name="queryWorkflowSpecifications" class=""> + <a href="#api-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications">queryWorkflowSpecifications</a> + </li> </ul> </nav> </div> @@ -1449,7 +1637,7 @@ $(document).ready(function() { <article id="api-E2eServiceInstances-compareModelwithTargetVersion-0" data-group="User" data-name="compareModelwithTargetVersion" data-version="0"> <div class="pull-left"> <h1>compareModelwithTargetVersion</h1> - <p>Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId </p> + <p>Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId</p> </div> <div class="pull-right"></div> <div class="clearfix"></div> @@ -1536,7 +1724,7 @@ String *body = body_example; // (optional) E2eServiceInstancesApi *apiInstance = [[E2eServiceInstancesApi alloc] init]; -// Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId +// Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId [apiInstance compareModelwithTargetVersionWith:serviceId version:version body:body @@ -1596,7 +1784,7 @@ namespace Example try { - // Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId + // Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId apiInstance.compareModelwithTargetVersion(serviceId, version, body); } catch (Exception e) @@ -1658,7 +1846,7 @@ version = version_example # String | body = body_example # String | (optional) try: - # Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId + # Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId api_instance.compare_modelwith_target_version(serviceId, version, body=body) except ApiException as e: print("Exception when calling E2eServiceInstancesApi->compareModelwithTargetVersion: %s\n" % e)</code></pre> @@ -7385,6 +7573,366 @@ $(document).ready(function() { </div> <hr> </section> + <section id="api-OnapsoinfrainstanceManagement"> + <h1>OnapsoinfrainstanceManagement</h1> + <div id="api-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow"> + <article id="api-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0" data-group="User" data-name="executeServiceLevelCustomWorkflow" data-version="0"> + <div class="pull-left"> + <h1>executeServiceLevelCustomWorkflow</h1> + <p>Executing service level custom workflow</p> + </div> + <div class="pull-right"></div> + <div class="clearfix"></div> + <p></p> + <p class="marked"></p> + <p></p> + <br /> + <pre class="prettyprint language-html prettyprinted" data-type="post"><code><span class="pln">/onap/so/infra/instanceManagement/{version}/serviceInstances/{serviceInstanceId}/workflows/{workflow_UUID}</span></code></pre> + <p> + <h3>Usage and SDK Samples</h3> + </p> + <ul class="nav nav-tabs nav-tabs-examples"> + <li class="active"><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-curl">Curl</a></li> + <li class=""><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-java">Java</a></li> + <li class=""><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-android">Android</a></li> + <!--<li class=""><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-groovy">Groovy</a></li>--> + <li class=""><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-objc">Obj-C</a></li> + <li class=""><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-javascript">JavaScript</a></li> + <!--<li class=""><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-angular">Angular</a></li>--> + <li class=""><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-csharp">C#</a></li> + <li class=""><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-php">PHP</a></li> + <li class=""><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-perl">Perl</a></li> + <li class=""><a href="#examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-python">Python</a></li> + </ul> + + <div class="tab-content"> + <div class="tab-pane active" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-curl"> + <pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost/onap/so/infra/instanceManagement/{version}/serviceInstances/{serviceInstanceId}/workflows/{workflow_UUID}"</code></pre> + </div> + <div class="tab-pane" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-java"> + <pre class="prettyprint"><code class="language-java">import io.swagger.client.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; +import io.swagger.client.api.OnapsoinfrainstanceManagementApi; + +import java.io.File; +import java.util.*; + +public class OnapsoinfrainstanceManagementApiExample { + + public static void main(String[] args) { + + OnapsoinfrainstanceManagementApi apiInstance = new OnapsoinfrainstanceManagementApi(); + String version = version_example; // String | + String serviceInstanceId = serviceInstanceId_example; // String | + String workflowUUID = workflowUUID_example; // String | + ServiceLevelWorkflowExecution body = ; // ServiceLevelWorkflowExecution | + try { + apiInstance.executeServiceLevelCustomWorkflow(version, serviceInstanceId, workflowUUID, body); + } catch (ApiException e) { + System.err.println("Exception when calling OnapsoinfrainstanceManagementApi#executeServiceLevelCustomWorkflow"); + e.printStackTrace(); + } + } +}</code></pre> + </div> + + <div class="tab-pane" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-android"> + <pre class="prettyprint"><code class="language-java">import io.swagger.client.api.OnapsoinfrainstanceManagementApi; + +public class OnapsoinfrainstanceManagementApiExample { + + public static void main(String[] args) { + OnapsoinfrainstanceManagementApi apiInstance = new OnapsoinfrainstanceManagementApi(); + String version = version_example; // String | + String serviceInstanceId = serviceInstanceId_example; // String | + String workflowUUID = workflowUUID_example; // String | + ServiceLevelWorkflowExecution body = ; // ServiceLevelWorkflowExecution | + try { + apiInstance.executeServiceLevelCustomWorkflow(version, serviceInstanceId, workflowUUID, body); + } catch (ApiException e) { + System.err.println("Exception when calling OnapsoinfrainstanceManagementApi#executeServiceLevelCustomWorkflow"); + e.printStackTrace(); + } + } +}</code></pre> + </div> + <!-- + <div class="tab-pane" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-groovy"> + <pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre> + </div> --> + <div class="tab-pane" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-objc"> + <pre class="prettyprint"><code class="language-cpp">String *version = version_example; // +String *serviceInstanceId = serviceInstanceId_example; // +String *workflowUUID = workflowUUID_example; // +ServiceLevelWorkflowExecution *body = ; // (optional) + +OnapsoinfrainstanceManagementApi *apiInstance = [[OnapsoinfrainstanceManagementApi alloc] init]; + +// Executing service level custom workflow +[apiInstance executeServiceLevelCustomWorkflowWith:version + serviceInstanceId:serviceInstanceId + workflowUUID:workflowUUID + body:body + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error: %@", error); + } + }]; +</code></pre> + </div> + + <div class="tab-pane" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-javascript"> + <pre class="prettyprint"><code class="language-js">var SoGuilinApIs = require('so_guilin_ap_is'); + +var api = new SoGuilinApIs.OnapsoinfrainstanceManagementApi() + +var version = version_example; // {String} + +var serviceInstanceId = serviceInstanceId_example; // {String} + +var workflowUUID = workflowUUID_example; // {String} + +var opts = { + 'body': // {ServiceLevelWorkflowExecution} +}; + +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully.'); + } +}; +api.executeServiceLevelCustomWorkflow(version, serviceInstanceId, workflowUUID, opts, callback); +</code></pre> + </div> + + <!--<div class="tab-pane" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-angular"> + <pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre> + </div>--> + <div class="tab-pane" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-csharp"> + <pre class="prettyprint"><code class="language-cs">using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class executeServiceLevelCustomWorkflowExample + { + public void main() + { + + var apiInstance = new OnapsoinfrainstanceManagementApi(); + var version = version_example; // String | + var serviceInstanceId = serviceInstanceId_example; // String | + var workflowUUID = workflowUUID_example; // String | + var body = new ServiceLevelWorkflowExecution(); // ServiceLevelWorkflowExecution | (optional) + + try + { + // Executing service level custom workflow + apiInstance.executeServiceLevelCustomWorkflow(version, serviceInstanceId, workflowUUID, body); + } + catch (Exception e) + { + Debug.Print("Exception when calling OnapsoinfrainstanceManagementApi.executeServiceLevelCustomWorkflow: " + e.Message ); + } + } + } +} +</code></pre> + </div> + + <div class="tab-pane" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-php"> + <pre class="prettyprint"><code class="language-php"><?php +require_once(__DIR__ . '/vendor/autoload.php'); + +$api_instance = new Swagger\Client\Api\OnapsoinfrainstanceManagementApi(); +$version = version_example; // String | +$serviceInstanceId = serviceInstanceId_example; // String | +$workflowUUID = workflowUUID_example; // String | +$body = ; // ServiceLevelWorkflowExecution | + +try { + $api_instance->executeServiceLevelCustomWorkflow($version, $serviceInstanceId, $workflowUUID, $body); +} catch (Exception $e) { + echo 'Exception when calling OnapsoinfrainstanceManagementApi->executeServiceLevelCustomWorkflow: ', $e->getMessage(), PHP_EOL; +} +?></code></pre> + </div> + + <div class="tab-pane" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-perl"> + <pre class="prettyprint"><code class="language-perl">use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::OnapsoinfrainstanceManagementApi; + +my $api_instance = WWW::SwaggerClient::OnapsoinfrainstanceManagementApi->new(); +my $version = version_example; # String | +my $serviceInstanceId = serviceInstanceId_example; # String | +my $workflowUUID = workflowUUID_example; # String | +my $body = WWW::SwaggerClient::Object::ServiceLevelWorkflowExecution->new(); # ServiceLevelWorkflowExecution | + +eval { + $api_instance->executeServiceLevelCustomWorkflow(version => $version, serviceInstanceId => $serviceInstanceId, workflowUUID => $workflowUUID, body => $body); +}; +if ($@) { + warn "Exception when calling OnapsoinfrainstanceManagementApi->executeServiceLevelCustomWorkflow: $@\n"; +}</code></pre> + </div> + + <div class="tab-pane" id="examples-OnapsoinfrainstanceManagement-executeServiceLevelCustomWorkflow-0-python"> + <pre class="prettyprint"><code class="language-python">from __future__ import print_statement +import time +import swagger_client +from swagger_client.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = swagger_client.OnapsoinfrainstanceManagementApi() +version = version_example # String | +serviceInstanceId = serviceInstanceId_example # String | +workflowUUID = workflowUUID_example # String | +body = # ServiceLevelWorkflowExecution | (optional) + +try: + # Executing service level custom workflow + api_instance.execute_service_level_custom_workflow(version, serviceInstanceId, workflowUUID, body=body) +except ApiException as e: + print("Exception when calling OnapsoinfrainstanceManagementApi->executeServiceLevelCustomWorkflow: %s\n" % e)</code></pre> + </div> + </div> + + <h2>Parameters</h2> + + <div class="methodsubtabletitle">Path parameters</div> + <table id="methodsubtable"> + <tr> + <th width="150px">Name</th> + <th>Description</th> + </tr> + <tr><td style="width:150px;">version*</td> +<td> + + + <div id="d2e199_executeServiceLevelCustomWorkflow_version"> + <div class="json-schema-view"> + <div class="primitive"> + <span class="type"> + String + </span> + + </div> + <div class="inner required"> + Required + </div> + </div> + </div> +</td> +</tr> + + <tr><td style="width:150px;">serviceInstanceId*</td> +<td> + + + <div id="d2e199_executeServiceLevelCustomWorkflow_serviceInstanceId"> + <div class="json-schema-view"> + <div class="primitive"> + <span class="type"> + String + </span> + + </div> + <div class="inner required"> + Required + </div> + </div> + </div> +</td> +</tr> + + <tr><td style="width:150px;">workflow_UUID*</td> +<td> + + + <div id="d2e199_executeServiceLevelCustomWorkflow_workflowUUID"> + <div class="json-schema-view"> + <div class="primitive"> + <span class="type"> + String + </span> + + </div> + <div class="inner required"> + Required + </div> + </div> + </div> +</td> +</tr> + + </table> + + + <div class="methodsubtabletitle">Body parameters</div> + <table id="methodsubtable"> + <tr> + <th width="150px">Name</th> + <th>Description</th> + </tr> + <tr><td style="width:150px;">body </td> +<td> + + +<script> +$(document).ready(function() { + var schemaWrapper = { + "in" : "body", + "name" : "body", + "required" : false, + "schema" : { + "$ref" : "#/definitions/ServiceLevelWorkflowExecution" + } +}; + var schema = schemaWrapper.schema; + if (schema.$ref != null) { + schema = defsParser.$refs.get(schema.$ref); + } else { + schemaWrapper.definitions = Object.assign({}, defs); + $RefParser.dereference(schemaWrapper).catch(function(err) { + console.log(err); + }); + } + + var view = new JSONSchemaView(schema,2,{isBodyParam: true}); + var result = $('#d2e199_executeServiceLevelCustomWorkflow_body'); + result.empty(); + result.append(view.render()); +}); +</script> +<div id="d2e199_executeServiceLevelCustomWorkflow_body"></div> +</td> +</tr> + + </table> + + + + <h2>Responses</h2> + <h3> Status: default - successful operation </h3> + + <ul class="nav nav-tabs nav-tabs-examples" > + </ul> + + <div class="tab-content" style='margin-bottom: 10px;'> + </div> + + </article> + </div> + <hr> + </section> <section id="api-OnapsoinframodelDistributions"> <h1>OnapsoinframodelDistributions</h1> <div id="api-OnapsoinframodelDistributions-updateModelDistributionStatus"> @@ -22297,6 +22845,333 @@ except ApiException as e: </div> <hr> </section> + <section id="api-OnapsoinfraworkflowSpecifications"> + <h1>OnapsoinfraworkflowSpecifications</h1> + <div id="api-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications"> + <article id="api-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0" data-group="User" data-name="queryWorkflowSpecifications" data-version="0"> + <div class="pull-left"> + <h1>queryWorkflowSpecifications</h1> + <p>Retrieve Workflow details based on the filter criteria</p> + </div> + <div class="pull-right"></div> + <div class="clearfix"></div> + <p></p> + <p class="marked"></p> + <p></p> + <br /> + <pre class="prettyprint language-html prettyprinted" data-type="get"><code><span class="pln">/onap/so/infra/workflowSpecifications/{version}/workflows</span></code></pre> + <p> + <h3>Usage and SDK Samples</h3> + </p> + <ul class="nav nav-tabs nav-tabs-examples"> + <li class="active"><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-curl">Curl</a></li> + <li class=""><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-java">Java</a></li> + <li class=""><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-android">Android</a></li> + <!--<li class=""><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-groovy">Groovy</a></li>--> + <li class=""><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-objc">Obj-C</a></li> + <li class=""><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-javascript">JavaScript</a></li> + <!--<li class=""><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-angular">Angular</a></li>--> + <li class=""><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-csharp">C#</a></li> + <li class=""><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-php">PHP</a></li> + <li class=""><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-perl">Perl</a></li> + <li class=""><a href="#examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-python">Python</a></li> + </ul> + + <div class="tab-content"> + <div class="tab-pane active" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-curl"> + <pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/onap/so/infra/workflowSpecifications/{version}/workflows?resourceTarget="</code></pre> + </div> + <div class="tab-pane" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-java"> + <pre class="prettyprint"><code class="language-java">import io.swagger.client.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; +import io.swagger.client.api.OnapsoinfraworkflowSpecificationsApi; + +import java.io.File; +import java.util.*; + +public class OnapsoinfraworkflowSpecificationsApiExample { + + public static void main(String[] args) { + + OnapsoinfraworkflowSpecificationsApi apiInstance = new OnapsoinfraworkflowSpecificationsApi(); + String version = version_example; // String | + String resourceTarget = resourceTarget_example; // String | + try { + RetrievingWorkflowResponse result = apiInstance.queryWorkflowSpecifications(version, resourceTarget); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OnapsoinfraworkflowSpecificationsApi#queryWorkflowSpecifications"); + e.printStackTrace(); + } + } +}</code></pre> + </div> + + <div class="tab-pane" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-android"> + <pre class="prettyprint"><code class="language-java">import io.swagger.client.api.OnapsoinfraworkflowSpecificationsApi; + +public class OnapsoinfraworkflowSpecificationsApiExample { + + public static void main(String[] args) { + OnapsoinfraworkflowSpecificationsApi apiInstance = new OnapsoinfraworkflowSpecificationsApi(); + String version = version_example; // String | + String resourceTarget = resourceTarget_example; // String | + try { + RetrievingWorkflowResponse result = apiInstance.queryWorkflowSpecifications(version, resourceTarget); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OnapsoinfraworkflowSpecificationsApi#queryWorkflowSpecifications"); + e.printStackTrace(); + } + } +}</code></pre> + </div> + <!-- + <div class="tab-pane" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-groovy"> + <pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre> + </div> --> + <div class="tab-pane" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-objc"> + <pre class="prettyprint"><code class="language-cpp">String *version = version_example; // +String *resourceTarget = resourceTarget_example; // (optional) + +OnapsoinfraworkflowSpecificationsApi *apiInstance = [[OnapsoinfraworkflowSpecificationsApi alloc] init]; + +// Retrieve Workflow details based on the filter criteria +[apiInstance queryWorkflowSpecificationsWith:version + resourceTarget:resourceTarget + completionHandler: ^(RetrievingWorkflowResponse output, NSError* error) { + if (output) { + NSLog(@"%@", output); + } + if (error) { + NSLog(@"Error: %@", error); + } + }]; +</code></pre> + </div> + + <div class="tab-pane" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-javascript"> + <pre class="prettyprint"><code class="language-js">var SoGuilinApIs = require('so_guilin_ap_is'); + +var api = new SoGuilinApIs.OnapsoinfraworkflowSpecificationsApi() + +var version = version_example; // {String} + +var opts = { + 'resourceTarget': resourceTarget_example // {String} +}; + +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}; +api.queryWorkflowSpecifications(version, opts, callback); +</code></pre> + </div> + + <!--<div class="tab-pane" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-angular"> + <pre class="prettyprint language-json prettyprinted" data-type="json"><code>Coming Soon!</code></pre> + </div>--> + <div class="tab-pane" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-csharp"> + <pre class="prettyprint"><code class="language-cs">using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class queryWorkflowSpecificationsExample + { + public void main() + { + + var apiInstance = new OnapsoinfraworkflowSpecificationsApi(); + var version = version_example; // String | + var resourceTarget = resourceTarget_example; // String | (optional) + + try + { + // Retrieve Workflow details based on the filter criteria + RetrievingWorkflowResponse result = apiInstance.queryWorkflowSpecifications(version, resourceTarget); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling OnapsoinfraworkflowSpecificationsApi.queryWorkflowSpecifications: " + e.Message ); + } + } + } +} +</code></pre> + </div> + + <div class="tab-pane" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-php"> + <pre class="prettyprint"><code class="language-php"><?php +require_once(__DIR__ . '/vendor/autoload.php'); + +$api_instance = new Swagger\Client\Api\OnapsoinfraworkflowSpecificationsApi(); +$version = version_example; // String | +$resourceTarget = resourceTarget_example; // String | + +try { + $result = $api_instance->queryWorkflowSpecifications($version, $resourceTarget); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OnapsoinfraworkflowSpecificationsApi->queryWorkflowSpecifications: ', $e->getMessage(), PHP_EOL; +} +?></code></pre> + </div> + + <div class="tab-pane" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-perl"> + <pre class="prettyprint"><code class="language-perl">use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::OnapsoinfraworkflowSpecificationsApi; + +my $api_instance = WWW::SwaggerClient::OnapsoinfraworkflowSpecificationsApi->new(); +my $version = version_example; # String | +my $resourceTarget = resourceTarget_example; # String | + +eval { + my $result = $api_instance->queryWorkflowSpecifications(version => $version, resourceTarget => $resourceTarget); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling OnapsoinfraworkflowSpecificationsApi->queryWorkflowSpecifications: $@\n"; +}</code></pre> + </div> + + <div class="tab-pane" id="examples-OnapsoinfraworkflowSpecifications-queryWorkflowSpecifications-0-python"> + <pre class="prettyprint"><code class="language-python">from __future__ import print_statement +import time +import swagger_client +from swagger_client.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = swagger_client.OnapsoinfraworkflowSpecificationsApi() +version = version_example # String | +resourceTarget = resourceTarget_example # String | (optional) + +try: + # Retrieve Workflow details based on the filter criteria + api_response = api_instance.query_workflow_specifications(version, resourceTarget=resourceTarget) + pprint(api_response) +except ApiException as e: + print("Exception when calling OnapsoinfraworkflowSpecificationsApi->queryWorkflowSpecifications: %s\n" % e)</code></pre> + </div> + </div> + + <h2>Parameters</h2> + + <div class="methodsubtabletitle">Path parameters</div> + <table id="methodsubtable"> + <tr> + <th width="150px">Name</th> + <th>Description</th> + </tr> + <tr><td style="width:150px;">version*</td> +<td> + + + <div id="d2e199_queryWorkflowSpecifications_version"> + <div class="json-schema-view"> + <div class="primitive"> + <span class="type"> + String + </span> + + </div> + <div class="inner required"> + Required + </div> + </div> + </div> +</td> +</tr> + + </table> + + + + + <div class="methodsubtabletitle">Query parameters</div> + <table id="methodsubtable"> + <tr> + <th width="150px">Name</th> + <th>Description</th> + </tr> + <tr><td style="width:150px;">resourceTarget</td> +<td> + + + <div id="d2e199_queryWorkflowSpecifications_resourceTarget"> + <div class="json-schema-view"> + <div class="primitive"> + <span class="type"> + String + </span> + + </div> + </div> + </div> +</td> +</tr> + + </table> + + <h2>Responses</h2> + <h3> Status: default - List of workflow specifications on successful operation </h3> + + <ul class="nav nav-tabs nav-tabs-examples" > + <li class="active"> + <a data-toggle="tab" href="#responses-queryWorkflowSpecifications-default-schema">Schema</a> + </li> + + </ul> + + <div class="tab-content" style='margin-bottom: 10px;'> + <div class="tab-pane active" id="responses-queryWorkflowSpecifications-default-schema"> + <div id='responses-queryWorkflowSpecifications-default-schema-default' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;"> + <script> + $(document).ready(function() { + var schemaWrapper = { + "description" : "List of workflow specifications on successful operation", + "schema" : { + "$ref" : "#/definitions/RetrievingWorkflowResponse" + } +}; + var schema = schemaWrapper.schema; + if (schema.$ref != null) { + schema = defsParser.$refs.get(schema.$ref); + } else { + schemaWrapper.definitions = defs; + $RefParser.dereference(schemaWrapper).catch(function(err) { + console.log(err); + }); + } + + //console.log(JSON.stringify(schema)); + var view = new JSONSchemaView(schema, 3); + $('#responses-queryWorkflowSpecifications-default-schema-data').val(stringify(schema)); + var result = $('#responses-queryWorkflowSpecifications-default-schema-default'); + result.empty(); + result.append(view.render()); + }); + </script> + </div> + <input id='responses-queryWorkflowSpecifications-default-schema-data' type='hidden' value=''></input> + </div> + </div> + + </article> + </div> + <hr> + </section> </div> <div id="footer"> <div id="api-_footer"> diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/src/main/resources/SOL005-NSLifecycleManagement-API.json b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/src/main/resources/SOL005-NSLifecycleManagement-API.json index 8257e6ba22..8a7eb9d006 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/src/main/resources/SOL005-NSLifecycleManagement-API.json +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/src/main/resources/SOL005-NSLifecycleManagement-API.json @@ -75,7 +75,8 @@ }, "retirementDate":{ "description":"Date-time stamp. Representation: String formatted according toas defined by the date-time production in IETF RFC 3339.\n", - "format":"date-time" + "format":"date-time", + "type":"string" } } } @@ -9667,7 +9668,8 @@ }, "startTime":{ "description":"Date-time stamp. Representation: String formatted according toas defined by the date-time production in IETF RFC 3339.\n", - "format":"date-time" + "format":"date-time", + "type":"string" }, "nsInstantiationLevelId":{ "description":"An identifier that is unique within a NS descriptor. Representation: string of variable length.\n", @@ -10745,7 +10747,8 @@ }, "scaleTime":{ "description":"Date-time stamp. Representation: String formatted according toas defined by the date-time production in IETF RFC 3339.\n", - "format":"date-time" + "format":"date-time", + "type":"string" } } }, @@ -13113,7 +13116,8 @@ }, "updateTime":{ "description":"Date-time stamp. Representation: String formatted according toas defined by the date-time production in IETF RFC 3339.\n", - "format":"date-time" + "format":"date-time", + "type":"string" } } }, @@ -15175,7 +15179,8 @@ }, "statusEnteredTime":{ "description":"Date-time stamp. Representation: String formatted according toas defined by the date-time production in IETF RFC 3339.\n", - "format":"date-time" + "format":"date-time", + "type":"string" }, "nsInstanceId":{ "description":"An identifier with the intention of being globally unique.\n", @@ -15194,7 +15199,8 @@ }, "startTime":{ "description":"Date-time stamp. Representation: String formatted according toas defined by the date-time production in IETF RFC 3339.\n", - "format":"date-time" + "format":"date-time", + "type":"string" }, "isAutomaticInvocation":{ "description":"Set to true if this NS LCM operation occurrence has been automatically triggered by the NFVO. This occurs in the case of auto-scaling, auto-healing and when a nested NS is modified as a result of an operation on its composite NS. Set to false otherwise.\n", @@ -15202,14 +15208,7 @@ }, "operationParams":{ "description":"Input parameters of the LCM operation. This attribute shall be formatted according to the request data type of the related LCM operation. The following mapping between lcmOperationType and the data type of this attribute shall apply: - INSTANTIATE: InstantiateNsRequest - SCALE: ScaleNsRequest - UPDATE: UpdateNsRequest - HEAL: HealNsRequest - TERMINATE: TerminateNsRequest This attribute shall be present if this data type is returned in a response to reading an individual resource, and may be present according to the chosen attribute selector parameter if this data type is returned in a response to a query of a container resource.\n", - "type":"string", - "enum":[ - "INSTANTIATE", - "SCALE", - "UPDATE", - "HEAL", - "TERMINATE" - ] + "type":"object" }, "isCancelPending":{ "description":"If the LCM operation occurrence is in \"PROCESSING\" or \"ROLLING_BACK\" state and the operation is being cancelled, this attribute shall be set to true. Otherwise, it shall be set to false.\n", @@ -16396,7 +16395,8 @@ }, "statusEnteredTime":{ "description":"Date-time stamp. Representation: String formatted according toas defined by the date-time production in IETF RFC 3339.\n", - "format":"date-time" + "format":"date-time", + "type":"string" }, "nsInstanceId":{ "description":"An identifier with the intention of being globally unique.\n", @@ -16415,7 +16415,8 @@ }, "startTime":{ "description":"Date-time stamp. Representation: String formatted according toas defined by the date-time production in IETF RFC 3339.\n", - "format":"date-time" + "format":"date-time", + "type":"string" }, "isAutomaticInvocation":{ "description":"Set to true if this NS LCM operation occurrence has been automatically triggered by the NFVO. This occurs in the case of auto-scaling, auto-healing and when a nested NS is modified as a result of an operation on its composite NS. Set to false otherwise.\n", @@ -16423,14 +16424,7 @@ }, "operationParams":{ "description":"Input parameters of the LCM operation. This attribute shall be formatted according to the request data type of the related LCM operation. The following mapping between lcmOperationType and the data type of this attribute shall apply: - INSTANTIATE: InstantiateNsRequest - SCALE: ScaleNsRequest - UPDATE: UpdateNsRequest - HEAL: HealNsRequest - TERMINATE: TerminateNsRequest This attribute shall be present if this data type is returned in a response to reading an individual resource, and may be present according to the chosen attribute selector parameter if this data type is returned in a response to a query of a container resource.\n", - "type":"string", - "enum":[ - "INSTANTIATE", - "SCALE", - "UPDATE", - "HEAL", - "TERMINATE" - ] + "type":"object" }, "isCancelPending":{ "description":"If the LCM operation occurrence is in \"PROCESSING\" or \"ROLLING_BACK\" state and the operation is being cancelled, this attribute shall be set to true. Otherwise, it shall be set to false.\n", @@ -19521,7 +19515,8 @@ }, "statusEnteredTime":{ "description":"Date-time stamp. Representation: String formatted according toas defined by the date-time production in IETF RFC 3339.\n", - "format":"date-time" + "format":"date-time", + "type":"string" }, "nsInstanceId":{ "description":"An identifier with the intention of being globally unique.\n", @@ -19540,7 +19535,8 @@ }, "startTime":{ "description":"Date-time stamp. Representation: String formatted according toas defined by the date-time production in IETF RFC 3339.\n", - "format":"date-time" + "format":"date-time", + "type":"string" }, "isAutomaticInvocation":{ "description":"Set to true if this NS LCM operation occurrence has been automatically triggered by the NFVO. This occurs in the case of auto-scaling, auto-healing and when a nested NS is modified as a result of an operation on its composite NS. Set to false otherwise.\n", @@ -19548,14 +19544,7 @@ }, "operationParams":{ "description":"Input parameters of the LCM operation. This attribute shall be formatted according to the request data type of the related LCM operation. The following mapping between lcmOperationType and the data type of this attribute shall apply: - INSTANTIATE: InstantiateNsRequest - SCALE: ScaleNsRequest - UPDATE: UpdateNsRequest - HEAL: HealNsRequest - TERMINATE: TerminateNsRequest This attribute shall be present if this data type is returned in a response to reading an individual resource, and may be present according to the chosen attribute selector parameter if this data type is returned in a response to a query of a container resource.\n", - "type":"string", - "enum":[ - "INSTANTIATE", - "SCALE", - "UPDATE", - "HEAL", - "TERMINATE" - ] + "type":"object" }, "isCancelPending":{ "description":"If the LCM operation occurrence is in \"PROCESSING\" or \"ROLLING_BACK\" state and the operation is being cancelled, this attribute shall be set to true. Otherwise, it shall be set to false.\n", |