aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java112
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java26
-rw-r--r--so-simulator/src/main/resources/openstack/gr_api/CreateVserver.json87
-rw-r--r--so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json2
5 files changed, 173 insertions, 56 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
index 8829c702cf..e2fa89bf39 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
@@ -60,6 +60,7 @@ public class OpenstackClientFactoryImpl implements OpenstackClientFactory {
OSClientV3 client;
try {
+ OSFactory.enableHttpLoggingFilter(true);
client = OSFactory.builderV3().endpoint(osAccess.getUrl())
.credentials(osAccess.getUser(), osAccess.getPassword(), osAccess.getDomainNameIdentifier())
.scopeToProject(Identifier.byId(osAccess.getTenantId()), osAccess.getProjectNameIdentifier())
@@ -81,6 +82,7 @@ public class OpenstackClientFactoryImpl implements OpenstackClientFactory {
OSClientV2 client;
try {
+ OSFactory.enableHttpLoggingFilter(true);
client = OSFactory.builderV2().endpoint(osAccess.getUrl())
.credentials(osAccess.getUser(), osAccess.getPassword()).tenantId(osAccess.getTenantId())
.authenticate().useRegion(osAccess.getRegion());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 71e1abd564..99a825006e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -848,64 +848,66 @@ public class WorkflowAction {
private void traverseNetworkCollectionResourceCustomization(List<Resource> resourceList,
CollectionResourceCustomization collectionResourceCustomization) {
- if (collectionResourceCustomization != null) {
- resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
- collectionResourceCustomization.getModelCustomizationUUID(), false));
- logger.debug("Found a network collection");
- if (collectionResourceCustomization.getCollectionResource() != null) {
- if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) {
- String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup()
- .getToscaNodeType();
- if (toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION)) {
- int minNetworks = 0;
- org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
- collectionResourceCustomization.getCollectionResource().getInstanceGroup();
- CollectionResourceInstanceGroupCustomization collectionInstCust = null;
- if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
- for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
- .getCollectionInstanceGroupCustomizations()) {
- if (collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase(
- collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionInstCust = collectionInstanceGroupTemp;
- break;
- }
- }
- if (collectionInstCust != null
- && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
- minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
- }
- }
- logger.debug("minNetworks: {}", minNetworks);
- CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
- for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
- .getCollectionNetworkResourceCustomizations()) {
- if (collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID()
- .equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionNetworkResourceCust = collectionNetworkTemp;
- break;
- }
- }
- for (int i = 0; i < minNetworks; i++) {
- if (collectionNetworkResourceCust != null && collectionInstCust != null) {
- Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
- collectionNetworkResourceCust.getModelCustomizationUUID(), false);
- resource.setVirtualLinkKey(Integer.toString(i));
- resourceList.add(resource);
- }
- }
- } else {
- logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}",
- toscaNodeType);
- }
- } else {
- logger.debug("No Instance Group found for network collection.");
+ if (collectionResourceCustomization == null) {
+ logger.debug("No Network Collection Customization found");
+ return;
+ }
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ collectionResourceCustomization.getModelCustomizationUUID(), false));
+ logger.debug("Found a network collection");
+ if (collectionResourceCustomization.getCollectionResource() == null) {
+ logger.debug("No Network Collection found. collectionResource is null");
+ return;
+ }
+ if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() == null) {
+ logger.debug("No Instance Group found for network collection.");
+ return;
+ }
+ String toscaNodeType =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
+ if (!toscaNodeTypeHasNetworkCollection(toscaNodeType)) {
+ logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}", toscaNodeType);
+ return;
+ }
+ int minNetworks = 0;
+ org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup();
+ CollectionResourceInstanceGroupCustomization collectionInstCust = null;
+ if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
+ for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
+ .getCollectionInstanceGroupCustomizations()) {
+ if (collectionInstanceGroupTemp.getModelCustomizationUUID()
+ .equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionInstCust = collectionInstanceGroupTemp;
+ break;
}
- } else {
- logger.debug("No Network Collection found. collectionResource is null");
}
- } else {
- logger.debug("No Network Collection Customization found");
+ if (collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
+ minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
+ }
+ }
+ logger.debug("minNetworks: {}", minNetworks);
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
+ for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
+ .getCollectionNetworkResourceCustomizations()) {
+ if (collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID()
+ .equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionNetworkResourceCust = collectionNetworkTemp;
+ break;
+ }
}
+ for (int i = 0; i < minNetworks; i++) {
+ if (collectionNetworkResourceCust != null && collectionInstCust != null) {
+ Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
+ collectionNetworkResourceCust.getModelCustomizationUUID(), false);
+ resource.setVirtualLinkKey(Integer.toString(i));
+ resourceList.add(resource);
+ }
+ }
+ }
+
+ private boolean toscaNodeTypeHasNetworkCollection(String toscaNodeType) {
+ return toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION);
}
private void traverseNetworkCollectionCustomization(List<Resource> resourceList,
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
index f790d804ca..954ebdd013 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
@@ -1,12 +1,18 @@
package org.onap.so.simulator.actions.aai;
+import java.io.InputStream;
+import java.util.List;
import org.onap.aai.domain.yang.Vnfc;
+import org.onap.aai.domain.yang.Vserver;
+import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.Relationships;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.io.ClassPathResource;
import com.consol.citrus.actions.AbstractTestAction;
import com.consol.citrus.context.TestContext;
@@ -56,6 +62,26 @@ public class ProcessVnfc extends AbstractTestAction {
aaiResourceClient.connect(vnfcURI, vserverURI);
aaiResourceClient.connect(vserverURI, pserverURI);
aaiResourceClient.connect(vfModuleURI, vnfcURI);
+ } else if (context.getVariable("requestAction").equals("CreateVfModuleInstance")
+ && context.getVariable("serviceAction").equals("activate")) {
+ // For recreate after soft delete
+ AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, "zauk51bfrwl09oam001");
+ AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
+ context.getVariable("cloudOwner"), context.getVariable("cloudRegion"),
+ context.getVariable("tenant"), "d29f3151-592d-4011-9356-ad047794e236");
+
+ Relationships relationships = aaiResourceClient.get(vnfcURI).getRelationships().get();
+ List<AAIResourceUri> uris = relationships.getRelatedUris(AAIObjectType.VSERVER);
+ if (uris.isEmpty() || uris.size() == 0) {
+ if (!aaiResourceClient.exists(vserverURI)) {
+ AAICommonObjectMapperProvider aaiMapper = new AAICommonObjectMapperProvider();
+ InputStream vserverFile =
+ new ClassPathResource("openstack/gr_api/CreateVserver.json").getInputStream();
+ Vserver vserver = aaiMapper.getMapper().readValue(vserverFile, Vserver.class);
+ aaiResourceClient.create(vserverURI, vserver);
+ }
+ aaiResourceClient.connect(vnfcURI, vserverURI);
+ }
}
} catch (Exception e) {
logger.debug("Exception in ProcessVnfc.doExecute", e);
diff --git a/so-simulator/src/main/resources/openstack/gr_api/CreateVserver.json b/so-simulator/src/main/resources/openstack/gr_api/CreateVserver.json
new file mode 100644
index 0000000000..17bc9233d4
--- /dev/null
+++ b/so-simulator/src/main/resources/openstack/gr_api/CreateVserver.json
@@ -0,0 +1,87 @@
+{
+ "vserver-id": "d29f3151-592d-4011-9356-ad047794e236",
+ "vserver-name": "ssc_server_1",
+ "vserver-name2": "ssc_server_1",
+ "vserver-selflink": "https://test.com:8774/v2/0422ffb57ba042c0800a29dc85ca70f8/servers/92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "ssc_1_mgmt_port_0",
+ "selflink": "https://test.com:9696/v2.0/ports/07f5b14c-147a-4d14-8c94-a9e94dbc097b",
+ "interface-id": "e80bec21-4b4b-42b0-ae17-20e736b8a82b",
+ "macaddr": "02:07:f5:b1:4c:14",
+ "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR_OAMP_NSD_TSBC0_net_1",
+ "is-port-mirrored": false,
+ "in-maint": false,
+ "is-ip-unnumbered": false,
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "192.61.12.203",
+ "l3-interface-ipv4-prefix-length": 28,
+ "is-floating": false,
+ "neutron-network-id": "cae2ade2-9f44-40fa-b124-18b101ff9aa0",
+ "neutron-subnet-id": "1f954922-6e9c-4a64-9d78-62e869ba8c77"
+ }
+ ],
+ "vlans" : {
+ "vlan": [
+ {
+ "in-maint": false,
+ "is-ip-unnumbered": false,
+ "is-private": false,
+ "vlan-id-inner": 0,
+ "vlan-id-outer": 123,
+ "vlan-interface": "oamfw_oam_direct1_0_port141"
+ }
+ ]
+ }
+ },
+ {
+ "interface-name": "ssc_1_int_ha_port_0",
+ "selflink": "https://test.com:9696/v2.0/ports/0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "interface-id": "e80bec21-4b4b-42b0-ae17-20e736b8a82a",
+ "macaddr": "02:05:94:a2:f2:7e",
+ "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR-UNTR-ROLE1-PARNT_net_1",
+ "is-port-mirrored": false,
+ "in-maint": false,
+ "is-ip-unnumbered": false,
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "tsbc0005v_tsbc0005vm002_subint_untrusted_role1_81",
+ "interface-id": "2bbfa345-33bb-495a-94b2-fb514ee1cffc",
+ "macaddr": "02:05:94:a2:f2:7e",
+ "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR_UNTR_VSE_ROLE10_net_1",
+ "is-port-mirrored": false,
+ "in-maint": false,
+ "is-ip-unnumbered": false
+ }
+ ]
+ },
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "172.26.0.36",
+ "l3-interface-ipv4-prefix-length": 27,
+ "is-floating": false,
+ "neutron-network-id": "49bd2c8c-808d-4783-a1c5-5d9ae0c6a9fa",
+ "neutron-subnet-id": "8d073a94-b1b9-493a-8fc1-cf92abcba466"
+ }
+ ],
+ "vlans" : {
+ "vlan": [
+ {
+ "in-maint": false,
+ "is-ip-unnumbered": false,
+ "is-private": false,
+ "vlan-id-inner": 0,
+ "vlan-id-outer": 965,
+ "vlan-interface": "oamfw_oam_direct1_0_port141"
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
diff --git a/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json b/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json
index 622bf8e3ef..afc7b8e6db 100644
--- a/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json
+++ b/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json
@@ -66,7 +66,7 @@
"OS-SRV-USG:terminated_at": null,
"key_name": null,
"OS-EXT-SRV-ATTR:hypervisor_hostname": "test.com",
- "name": "zauk51bfrwl09oam001",
+ "name": "ssc_server_1",
"created": "2019-02-11T19:11:58Z",
"tenant_id": "872f331350c54e59991a8de2cbffb40c",
"os-extended-volumes:volumes_attached": [],