summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java47
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java54
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java48
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java198
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql52
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java25
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java102
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java105
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/AVPNResourceGroupResponse.json79
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/GetResources.json84
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/MISResourceGroupResponse.json31
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/MISSubInterface1Resources.json70
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1ResourceGroupResponse.json79
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0.json (renamed from adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface0.json)8
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json (renamed from adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface0Resources.json)12
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1.json (renamed from adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface1.json)8
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json (renamed from adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface1Resources.json)12
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2.json (renamed from adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface2.json)8
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json (renamed from adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface2Resources.json)12
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service2ResourceGroupResponse.json31
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface0.json (renamed from adapters/mso-openstack-adapters/src/test/resources/MISSubInterface0.json)8
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface1Resources.json70
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.3__Add_Add_Column_To_WatchDog_Model_Id_Lookup.sql6
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java28
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java21
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java23
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java24
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java16
-rw-r--r--asdc-controller/src/test/resources/data.sql6
-rw-r--r--asdc-controller/src/test/resources/schema.sql2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java30
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml21
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java17
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java29
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn132
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn112
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java21
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java58
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java67
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn114
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java112
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java31
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java160
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java45
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java39
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java108
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java30
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json65
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClient.java21
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java27
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Status.java)32
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java56
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java323
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClient.java5
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java202
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java195
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java84
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/QueryStep.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoException.java)12
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java4
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java5
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java39
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java27
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java32
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java2
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java2
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java (renamed from common/src/main/java/org/onap/so/client/aai/EmptyStringToNullSerializer.java)2
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/Format.java1
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java)31
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java52
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java (renamed from common/src/main/java/org/onap/so/client/aai/AAIPatchConverter.java)10
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java73
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java306
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java (renamed from common/src/main/java/org/onap/so/client/aai/AAISubgraphType.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java240
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java10
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java76
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java71
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java)34
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java113
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java117
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/__.java59
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java7
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java20
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java8
-rw-r--r--common/src/main/resources/dmaap/default-consumer.properties1
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java7
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java19
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java45
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java33
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java3
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java28
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java34
-rw-r--r--common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java83
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java20
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java26
-rw-r--r--common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java20
-rw-r--r--common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java109
-rw-r--r--common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java8
-rw-r--r--common/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java (renamed from common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java)16
-rw-r--r--common/src/test/resources/dmaap.properties5
-rw-r--r--docs/developer_info/Working_with_SO_Docker.rst256
-rw-r--r--docs/release-notes.rst95
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Actions.java)0
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Constants.java54
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Messages.java56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ModelType.java32
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisherTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml11
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java40
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java19
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java8
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java237
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts154
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts220
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss140
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html102
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts60
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.constant.ts41
172 files changed, 5170 insertions, 2354 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index 14aee2f4f2..20498cb694 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -103,13 +103,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
protected static final String CREATE_STACK = "CreateStack";
- // Cache Heat Clients statically. Since there is just one MSO user, there is no
- // benefit to re-authentication on every request (or across different flows). The
- // token will be used until it expires.
- //
- // The cache key is "tenantId:cloudId"
- private static Map <String, HeatCacheEntry> heatClientCache = new HashMap <> ();
-
// Fetch cloud configuration each time (may be cached in CloudConfig class)
@Autowired
protected CloudConfig cloudConfig;
@@ -859,19 +852,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
String cloudId = cloudSite.getId();
// For DCP/LCP, the region should be the cloudId.
String region = cloudSite.getRegionId ();
-
- // Check first in the cache of previously authorized clients
- String cacheKey = cloudId + ":" + tenantId;
- if (heatClientCache.containsKey (cacheKey)) {
- if (!heatClientCache.get (cacheKey).isExpired ()) {
- LOGGER.debug ("Using Cached HEAT Client for " + cacheKey);
- return heatClientCache.get (cacheKey).getHeatClient ();
- } else {
- // Token is expired. Remove it from cache.
- heatClientCache.remove (cacheKey);
- LOGGER.debug ("Expired Cached HEAT Client for " + cacheKey);
- }
- }
// Obtain an MSO token for the tenant
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
@@ -946,38 +926,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// Catch-all
throw runtimeExceptionToMsoException (e, TOKEN_AUTH);
}
-
Heat heatClient = new Heat (heatUrl);
heatClient.token (tokenId);
-
- heatClientCache.put (cacheKey,
- new HeatCacheEntry (heatUrl,
- tokenId,
- expiration));
- LOGGER.debug ("Caching HEAT Client for " + cacheKey);
-
return heatClient;
}
- /**
- * Forcibly expire a HEAT client from the cache. This call is for use by
- * the KeystoneClient in case where a tenant is deleted. In that case,
- * all cached credentials must be purged so that fresh authentication is
- * done if a similarly named tenant is re-created.
- * <p>
- * Note: This is probably only applicable to dev/test environments where
- * the same Tenant Name is repeatedly used for creation/deletion.
- * <p>
- *
- */
- public void expireHeatClient (String tenantId, String cloudId) {
- String cacheKey = cloudId + ":" + tenantId;
- if (heatClientCache.containsKey (cacheKey)) {
- heatClientCache.remove (cacheKey);
- LOGGER.debug ("Deleted Cached HEAT Client for " + cacheKey);
- }
- }
-
/*
* Query for a Heat Stack. This function is needed in several places, so
* a common method is useful. This method takes an authenticated Heat Client
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
index 3936ae6496..0bd2a3931f 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
@@ -59,12 +59,6 @@ import com.woorea.openstack.keystone.utils.KeystoneUtils;
@Component
public class MsoKeystoneUtils extends MsoTenantUtils {
- // Cache the Keystone Clients statically. Since there is just one MSO user, there is no
- // benefit to re-authentication on every request (or across different flows). The
- // token will be used until it expires.
- //
- // The cache key is "cloudId"
- private static Map <String, KeystoneCacheEntry> adminClientCache = new HashMap<>();
private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoKeystoneUtils.class);
@@ -316,10 +310,6 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
OpenStackRequest <Void> request = keystoneAdminClient.tenants ().delete (tenant.getId ());
executeAndRecordOpenstackRequest (request);
LOGGER.debug ("Deleted Tenant " + tenant.getId () + " (" + tenant.getName () + ")");
-
- // Clear any cached clients. Not really needed, ID will not be reused.
- msoHeatUtils.expireHeatClient (tenant.getId (), cloudSiteId);
- msoNeutronUtils.expireNeutronClient (tenant.getId (), cloudSiteId);
} catch (OpenStackBaseException e) {
// Convert Keystone OpenStackResponseException to MsoOpenstackException
throw keystoneErrorToMsoException (e, "Delete Tenant");
@@ -369,9 +359,6 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
LOGGER.debug ("Deleted Tenant " + tenant.getId () + " (" + tenant.getName () + ")");
- // Clear any cached clients. Not really needed, ID will not be reused.
- msoHeatUtils.expireHeatClient (tenant.getId (), cloudSiteId);
- msoNeutronUtils.expireNeutronClient (tenant.getId (), cloudSiteId);
} catch (OpenStackBaseException e) {
// Note: It doesn't seem to matter if tenant doesn't exist, no exception is thrown.
// Convert Keystone OpenStackResponseException to MsoOpenstackException
@@ -407,16 +394,6 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
String adminTenantName = cloudIdentity.getAdminTenant ();
String region = cloudSite.getRegionId ();
- // Check first in the cache of previously authorized clients
- KeystoneCacheEntry entry = adminClientCache.get (cloudId);
- if (entry != null) {
- if (!entry.isExpired ()) {
- return entry.getKeystoneClient ();
- } else {
- // Token is expired. Remove it from cache.
- adminClientCache.remove (cloudId);
- }
- }
MsoTenantUtils tenantUtils = tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
final String keystoneUrl = tenantUtils.getKeystoneUrl(region, cloudIdentity);
Keystone keystone = new Keystone(keystoneUrl);
@@ -462,11 +439,6 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
// Note: this doesn't go back to Openstack, it's just a local object.
keystone = new Keystone (adminUrl);
keystone.token (token);
-
- // Cache to avoid re-authentication for every call.
- KeystoneCacheEntry cacheEntry = new KeystoneCacheEntry (adminUrl, token, access.getToken ().getExpires ());
- adminClientCache.put (cloudId, cacheEntry);
-
return keystone;
}
@@ -636,32 +608,6 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
return null;
}
- private static class KeystoneCacheEntry implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private String keystoneUrl;
- private String token;
- private Calendar expires;
-
- public KeystoneCacheEntry (String url, String token, Calendar expires) {
- this.keystoneUrl = url;
- this.token = token;
- this.expires = expires;
- }
-
- public Keystone getKeystoneClient () {
- Keystone keystone = new Keystone (keystoneUrl);
- keystone.token (token);
- return keystone;
- }
-
- public boolean isExpired () {
- // adding arbitrary guard timer of 5 minutes
- return expires == null || System.currentTimeMillis() > (expires.getTimeInMillis() - 1800000);
- }
- }
-
@Override
public String getKeystoneUrl(String regionId, CloudIdentity cloudIdentity) throws MsoException {
return cloudIdentity.getIdentityUrl();
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
index 7b82ad62ff..785e8606d3 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
@@ -67,12 +67,6 @@ import com.woorea.openstack.quantum.model.Segment;
@Component
public class MsoNeutronUtils extends MsoCommonUtils
{
- // Cache Neutron Clients statically. Since there is just one MSO user, there is no
- // benefit to re-authentication on every request (or across different flows). The
- // token will be used until it expires.
- //
- // The cache key is "tenantId:cloudId"
- private static Map<String,NeutronCacheEntry> neutronClientCache = new HashMap<>();
// Fetch cloud configuration each time (may be cached in CloudConfig class)
@Autowired
@@ -364,24 +358,8 @@ public class MsoNeutronUtils extends MsoCommonUtils
private Quantum getNeutronClient(CloudSite cloudSite, String tenantId) throws MsoException
{
String cloudId = cloudSite.getId();
- String region = cloudSite.getRegionId();
-
- // Check first in the cache of previously authorized clients
- String cacheKey = cloudId + ":" + tenantId;
- if (neutronClientCache.containsKey(cacheKey)) {
- if (! neutronClientCache.get(cacheKey).isExpired()) {
- LOGGER.debug ("Using Cached HEAT Client for " + cacheKey);
- NeutronCacheEntry cacheEntry = neutronClientCache.get(cacheKey);
- Quantum neutronClient = new Quantum(cacheEntry.getNeutronUrl());
- neutronClient.token(cacheEntry.getToken());
- return neutronClient;
- }
- else {
- // Token is expired. Remove it from cache.
- neutronClientCache.remove(cacheKey);
- LOGGER.debug ("Expired Cached Neutron Client for " + cacheKey);
- }
- }
+ String region = cloudSite.getRegionId();
+
// Obtain an MSO token for the tenant from the identity service
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
@@ -454,31 +432,9 @@ public class MsoNeutronUtils extends MsoCommonUtils
Quantum neutronClient = new Quantum(neutronUrl);
neutronClient.token(tokenId);
-
- neutronClientCache.put(cacheKey, new NeutronCacheEntry(neutronUrl, tokenId, expiration));
- LOGGER.debug ("Caching Neutron Client for " + cacheKey);
-
return neutronClient;
}
- /**
- * Forcibly expire a Neutron client from the cache. This call is for use by
- * the KeystoneClient in case where a tenant is deleted. In that case,
- * all cached credentials must be purged so that fresh authentication is
- * done on subsequent calls.
- * <p>
- * @param tenantName
- * @param cloudId
- */
- public void expireNeutronClient (String tenantId, String cloudId) {
- String cacheKey = cloudId + ":" + tenantId;
- if (neutronClientCache.containsKey(cacheKey)) {
- neutronClientCache.remove(cacheKey);
- LOGGER.debug ("Deleted Cached Neutron Client for " + cacheKey);
- }
- }
-
-
/*
* Find a tenant (or query its existence) by its Name or Id. Check first against the
* ID. If that fails, then try by name.
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
new file mode 100644
index 0000000000..aeee279002
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
@@ -0,0 +1,198 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClientPortChanger;
+import org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import org.springframework.beans.BeanUtils;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class CvnfcCatalogDbQueryTest {
+
+ @Autowired
+ private CvnfcCustomizationRepository cvnfcCustomizationRepository;
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CvnfcCatalogDbQueryTest.class);
+
+ @LocalServerPort
+ private int port;
+ boolean isInitialized;
+
+ @Autowired
+ CatalogDbClientPortChanger client;
+
+ @Before
+ public void initialize(){
+ client.wiremockPort= String.valueOf(port);
+ }
+
+ @Test
+ public void cVnfcTest() {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization("dadc2c8c-2bab-11e9-b210-d663bd873d93");
+
+ List<CvnfcCustomization> foundCvnfcCustomization = client.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671","cb82ffd8-252a-11e7-93ae-92361f002671");
+ assertNotNull(foundCvnfcCustomization);
+ assertTrue(foundCvnfcCustomization.size() > 0);
+ CvnfcCustomization found = foundCvnfcCustomization.get(0);
+
+ CvnfcCustomization templateCvnfcCustomization = new CvnfcCustomization();
+ BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization");
+
+ assertThat(cvnfcCustomization, sameBeanAs(templateCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+ }
+
+ @Test
+ public void getLinkedVnfVfmoduleCvnfcConfigurationCustomizationTest() {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization("0c042562-2bac-11e9-b210-d663bd873d93");
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setToscaNodeType("FabricConfiguration");
+ configurationResource.setModelInvariantUUID("modelInvariantUUID");
+ configurationResource.setModelUUID("modelUUID");
+ configurationResource.setModelName("modelName");
+ configurationResource.setModelVersion("modelVersion");
+ configurationResource.setDescription("description");
+ configurationResource.setToscaNodeType("toscaNodeTypeFC");
+
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setModelUUID("6f19c5fa-2b19-11e9-b210-d663bd873d93");
+ vnfResource.setModelVersion("modelVersion");
+ vnfResource.setOrchestrationMode("orchestrationMode");
+
+ VfModule vfModule = new VfModule();
+ vfModule.setModelUUID("98aa2a6e-2b18-11e9-b210-d663bd873d93");
+ vfModule.setModelInvariantUUID("9fe57860-2b18-11e9-b210-d663bd873d93");
+ vfModule.setIsBase(true);
+ vfModule.setModelName("modelName");
+ vfModule.setModelVersion("modelVersion");
+ vfModule.setVnfResources(vnfResource);
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("bdbf984a-2b16-11e9-b210-d663bd873d93");
+ vfModuleCustomization.setVfModule(vfModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("6912dd02-2b16-11e9-b210-d663bd873d93");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+ vnfResourceCustomization.setVnfResources(vnfResource);
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("configurationFunction");
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("64627fec-2b1b-11e9-b210-d663bd873d93");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
+ vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName");
+ vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(vfModuleCustomization);
+ vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
+ vnfVfmoduleCvnfcConfigurationCustomizationSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
+ cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet);
+
+ vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ List<CvnfcCustomization> foundCvnfcCustomization = client.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("6912dd02-2b16-11e9-b210-d663bd873d93","bdbf984a-2b16-11e9-b210-d663bd873d93");
+ assertNotNull(foundCvnfcCustomization);
+ assertTrue(foundCvnfcCustomization.size() > 0);
+ CvnfcCustomization found = foundCvnfcCustomization.get(0);
+
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = found.getVnfVfmoduleCvnfcConfigurationCustomization();
+ if (vnfVfmoduleCvnfcConfigurationCustomizations.size() > 0){
+ for(VnfVfmoduleCvnfcConfigurationCustomization customization : vnfVfmoduleCvnfcConfigurationCustomizations) {
+ Assert.assertTrue(customization.getConfigurationResource().getToscaNodeType().equalsIgnoreCase("toscaNodeTypeFC"));
+ }
+ } else {
+ Assert.fail("No linked VnfVfmoduleCvnfcConfigurationCustomization found for CvnfcCustomization");
+ }
+ }
+
+ protected CvnfcCustomization setUpCvnfcCustomization(String id){
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID(id);
+ cvnfcCustomization.setModelInstanceName("testModelInstanceName");
+ cvnfcCustomization.setModelUUID("b25735fe-9b37-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setModelInvariantUUID("ba7e6ef0-9b37-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setModelVersion("testModelVersion");
+ cvnfcCustomization.setModelName("testModelName");
+ cvnfcCustomization.setToscaNodeType("testToscaNodeType");
+ cvnfcCustomization.setDescription("testCvnfcCustomzationDescription");
+ cvnfcCustomization.setNfcFunction("testNfcFunction");
+ cvnfcCustomization.setNfcNamingCode("testNfcNamingCode");
+ return cvnfcCustomization;
+ }
+
+ protected VnfcCustomization setUpVnfcCustomization(){
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+ vnfcCustomization.setModelInstanceName("testVnfcCustomizationModelInstanceName");
+ vnfcCustomization.setModelUUID("321228a4-9f15-11e8-98d0-529269fb1459");
+ vnfcCustomization.setModelInvariantUUID("c0659136-9f15-11e8-98d0-529269fb1459");
+ vnfcCustomization.setModelVersion("testModelVersion");
+ vnfcCustomization.setModelName("testModelName");
+ vnfcCustomization.setToscaNodeType("testToscaModelType");
+ vnfcCustomization.setDescription("testVnfcCustomizationDescription");
+ return vnfcCustomization;
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 3e92b5d7ba..1223080e59 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -241,3 +241,55 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'my-custom-cloud-owner' and SERVICE_TYPE = 'TRANSPORT'));
+
+INSERT INTO `vnfc_customization`
+ (`model_customization_uuid`,
+ `model_instance_name`,
+ `model_uuid`,
+ `model_invariant_uuid`,
+ `model_version`,
+ `model_name`,
+ `tosca_node_type`,
+ `description`,
+ `creation_timestamp`)
+VALUES ( '9bcce658-9b37-11e8-98d0-529269fb1459',
+ 'testModelInstanceName',
+ 'b25735fe-9b37-11e8-98d0-529269fb1459',
+ 'ba7e6ef0-9b37-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'toscaNodeType',
+ 'testVnfcCustomizationDescription',
+ '2018-07-17 14:05:08');
+
+INSERT INTO `cvnfc_customization`
+ (`id`,
+ `model_customization_uuid`,
+ `model_instance_name`,
+ `model_uuid`,
+ `model_invariant_uuid`,
+ `model_version`,
+ `model_name`,
+ `tosca_node_type`,
+ `description`,
+ `nfc_function`,
+ `nfc_naming_code`,
+ `creation_timestamp`,
+ `vnf_resource_cust_model_customization_uuid`,
+ `vf_module_cust_model_customization_uuid`,
+ `vnfc_cust_model_customization_uuid`)
+VALUES ( '1',
+ 'dadc2c8c-2bab-11e9-b210-d663bd873d93',
+ 'testModelInstanceName',
+ 'b25735fe-9b37-11e8-98d0-529269fb1459',
+ 'ba7e6ef0-9b37-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'testToscaNodeType',
+ 'testCvnfcCustomzationDescription',
+ 'testNfcFunction',
+ 'testNfcNamingCode',
+ '2018-07-17 14:05:08',
+ '68dc9a92-214c-11e7-93ae-92361f002671',
+ 'cb82ffd8-252a-11e7-93ae-92361f002671',
+ '9bcce658-9b37-11e8-98d0-529269fb1459');
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
index 7bba136da2..dfe5912fbf 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
@@ -25,6 +25,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -162,7 +164,8 @@ public class HeatStackAudit {
auditVserver.setLInterfaces(new LInterfaces());
auditVserver.setVserverId(novaResource.getPhysicalResourceId());
Stream<Resource> filteredNeutronNetworks = resources.getList().stream()
- .filter(network -> network.getRequiredBy().contains(novaResource.getLogicalResourceId()));
+ .filter(resource -> resource.getRequiredBy().contains(novaResource.getLogicalResourceId()))
+ .filter(resource -> "OS::Neutron::Port".equals(resource.getType()));
filteredNeutronNetworks.forEach(network -> {
LInterface lInterface = new LInterface();
lInterface.setInterfaceId(network.getPhysicalResourceId());
@@ -173,11 +176,13 @@ public class HeatStackAudit {
return vserversToAudit;
}
- protected Optional<String> extractResourcePathFromHref(String href) {
- URI uri;
+ protected Optional<String> extractResourcePathFromHref(String href) {
try {
- uri = new URI(href);
- return Optional.of(uri.getPath().replaceFirst("/v\\d+", "")+RESOURCES);
+ Optional<String> stackPath = extractStackPathFromHref(href);
+ if (stackPath.isPresent()){
+ return Optional.of(stackPath.get()+RESOURCES);
+ }else
+ return Optional.empty();
} catch (Exception e) {
logger.error("Error parsing URI", e);
}
@@ -185,10 +190,14 @@ public class HeatStackAudit {
}
protected Optional<String> extractStackPathFromHref(String href) {
- URI uri;
try {
- uri = new URI(href);
- return Optional.of(uri.getPath().replaceFirst("/v\\d+", ""));
+ URI uri = new URI(href);
+ Pattern p = Pattern.compile("/stacks.*");
+ Matcher m = p.matcher(uri.getPath());
+ if (m.find()){
+ return Optional.of(m.group());
+ }else
+ return Optional.empty();
} catch (Exception e) {
logger.error("Error parsing URI", e);
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
index 11e54404f4..02557d8c20 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
@@ -79,7 +79,7 @@ public class AuditVServerTest extends AuditVServer {
private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c");
- private AAIResourceUri ssc_1_avpn_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
+ private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "1c56a24b-5f03-435a-850d-31cd4252de56");
private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
@@ -88,7 +88,7 @@ public class AuditVServerTest extends AuditVServer {
private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "80baec42-ffae-425f-ad8c-3f7b2c24bfff");
- private AAIResourceUri ssc_1_mis_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
+ private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "13eddf95-4cf3-45f2-823a-2d890a6549b4");
private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
@@ -103,13 +103,13 @@ public class AuditVServerTest extends AuditVServer {
- private AAIResourceUri mis_sub_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE,
+ private AAIResourceUri service2_sub_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE,
cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","interface-name").queryParam("interface-id", "f711be16-2654-4a09-b89d-0511fda20e81");
- private AAIResourceUri avpn_sub_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE,
+ private AAIResourceUri service1_sub_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE,
cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","interface-name").queryParam("interface-id", "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb");
- private AAIResourceUri avpn_sub_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE,
+ private AAIResourceUri service1_sub_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE,
cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","interface-name").queryParam("interface-id", "b7019dd0-2ee9-4447-bdef-ac25676b205a");
@@ -120,25 +120,25 @@ public class AuditVServerTest extends AuditVServer {
LInterface test_port_1 = new LInterface();
LInterface test_port_2 = new LInterface();
LInterface ssc_1_int_ha_port_0 = new LInterface();
- LInterface mis_sub_interface_1 = new LInterface();
- LInterface ssc_1_mis_port_0 = new LInterface();
+ LInterface service2_sub_interface_1 = new LInterface();
+ LInterface ssc_1_service2_port_0 = new LInterface();
LInterface ssc_1_mgmt_port_0 = new LInterface();
LInterface ssc_1_mgmt_port_1 = new LInterface();
- LInterface avpn_sub_interface_2 = new LInterface();
- LInterface avpn_sub_interface_1 = new LInterface();
- LInterface ssc_1_avpn_port_0 = new LInterface();
+ LInterface service1_sub_interface_2 = new LInterface();
+ LInterface service1_sub_interface_1 = new LInterface();
+ LInterface ssc_1_service1_port_0 = new LInterface();
LInterface ssc_1_trusted_port_0 = new LInterface();
LInterfaces test_port_1_plural = new LInterfaces();
LInterfaces test_port_2_plural = new LInterfaces();
LInterfaces ssc_1_int_ha_port_0_plural = new LInterfaces();
- LInterfaces mis_sub_interface_1_plural = new LInterfaces();
- LInterfaces ssc_1_mis_port_0_plural = new LInterfaces();
+ LInterfaces service2_sub_interface_1_plural = new LInterfaces();
+ LInterfaces ssc_1_service2_port_0_plural = new LInterfaces();
LInterfaces ssc_1_mgmt_port_0_plural = new LInterfaces();
LInterfaces ssc_1_mgmt_port_1_plural = new LInterfaces();
- LInterfaces avpn_sub_interface_2_plural = new LInterfaces();
- LInterfaces avpn_sub_interface_1_plural = new LInterfaces();
- LInterfaces ssc_1_avpn_port_0_plural = new LInterfaces();
+ LInterfaces service1_sub_interface_2_plural = new LInterfaces();
+ LInterfaces service1_sub_interface_1_plural = new LInterfaces();
+ LInterfaces ssc_1_service1_port_0_plural = new LInterfaces();
LInterfaces ssc_1_trusted_port_0_plural = new LInterfaces();
@@ -156,18 +156,18 @@ public class AuditVServerTest extends AuditVServer {
vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
- ssc_1_avpn_port_0.setInterfaceId("1c56a24b-5f03-435a-850d-31cd4252de56");
- ssc_1_avpn_port_0.setInterfaceName("interface-name");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_avpn_port_0);
- ssc_1_avpn_port_0.setLInterfaces(new LInterfaces());
+ ssc_1_service1_port_0.setInterfaceId("1c56a24b-5f03-435a-850d-31cd4252de56");
+ ssc_1_service1_port_0.setInterfaceName("interface-name");
+ vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0);
+ ssc_1_service1_port_0.setLInterfaces(new LInterfaces());
- avpn_sub_interface_1.setInterfaceId("0d9cd813-2ae1-46c0-9ebb-48081f6cffbb");
- ssc_1_avpn_port_0.getLInterfaces().getLInterface().add(avpn_sub_interface_1);
+ service1_sub_interface_1.setInterfaceId("0d9cd813-2ae1-46c0-9ebb-48081f6cffbb");
+ ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_1);
- avpn_sub_interface_2.setInterfaceId("b7019dd0-2ee9-4447-bdef-ac25676b205a");
- ssc_1_avpn_port_0.getLInterfaces().getLInterface().add(avpn_sub_interface_2);
+ service1_sub_interface_2.setInterfaceId("b7019dd0-2ee9-4447-bdef-ac25676b205a");
+ ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_2);
ssc_1_mgmt_port_1.setInterfaceId("12afcd28-929f-4d80-8a5a-0833bfd5e20b");
@@ -179,14 +179,14 @@ public class AuditVServerTest extends AuditVServer {
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0);
- ssc_1_mis_port_0.setLInterfaces(new LInterfaces());
- ssc_1_mis_port_0.setInterfaceId("13eddf95-4cf3-45f2-823a-2d890a6549b4");
- ssc_1_mis_port_0.setInterfaceName("interface-name");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_mis_port_0);
+ ssc_1_service2_port_0.setLInterfaces(new LInterfaces());
+ ssc_1_service2_port_0.setInterfaceId("13eddf95-4cf3-45f2-823a-2d890a6549b4");
+ ssc_1_service2_port_0.setInterfaceName("interface-name");
+ vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0);
- mis_sub_interface_1.setInterfaceId("f711be16-2654-4a09-b89d-0511fda20e81");
- ssc_1_mis_port_0.getLInterfaces().getLInterface().add(mis_sub_interface_1);
+ service2_sub_interface_1.setInterfaceId("f711be16-2654-4a09-b89d-0511fda20e81");
+ ssc_1_service2_port_0.getLInterfaces().getLInterface().add(service2_sub_interface_1);
ssc_1_int_ha_port_0.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adb8");
@@ -215,10 +215,10 @@ public class AuditVServerTest extends AuditVServer {
test_port_1_plural.getLInterface().add(test_port_1);
test_port_2_plural.getLInterface().add(test_port_2);
ssc_1_int_ha_port_0_plural.getLInterface().add(ssc_1_int_ha_port_0);
- ssc_1_mis_port_0_plural.getLInterface().add(ssc_1_mis_port_0);
+ ssc_1_service2_port_0_plural.getLInterface().add(ssc_1_service2_port_0);
ssc_1_mgmt_port_0_plural.getLInterface().add(ssc_1_mgmt_port_0);
ssc_1_mgmt_port_1_plural.getLInterface().add(ssc_1_mgmt_port_1);
- ssc_1_avpn_port_0_plural.getLInterface().add(ssc_1_avpn_port_0);
+ ssc_1_service1_port_0_plural.getLInterface().add(ssc_1_service1_port_0);
ssc_1_trusted_port_0_plural.getLInterface().add(ssc_1_trusted_port_0);
}
@@ -234,17 +234,17 @@ public class AuditVServerTest extends AuditVServer {
doReturn(true).when(aaiResourcesMock).exists(vserverURI);
doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_avpn_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_avpn_port_0_uri);
+ doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service1_port_0_uri);
doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_1_uri);
doReturn(Optional.of(ssc_1_mgmt_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_mis_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mis_port_0_uri);
+ doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service2_port_0_uri);
doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_int_ha_port_0_uri);
doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_1_uri);
doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_2_uri);
- doReturn(true).when(aaiResourcesMock).exists(mis_sub_1_uri);
- doReturn(true).when(aaiResourcesMock).exists(avpn_sub_0_uri);
- doReturn(true).when(aaiResourcesMock).exists(avpn_sub_1_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
assertEquals(true, exists);
@@ -256,17 +256,17 @@ public class AuditVServerTest extends AuditVServer {
doReturn(true).when(aaiResourcesMock).exists(vserverURI);
doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_avpn_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_avpn_port_0_uri);
+ doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service1_port_0_uri);
doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_1_uri);
doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_mis_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mis_port_0_uri);
+ doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service2_port_0_uri);
doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_int_ha_port_0_uri);
doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_1_uri);
doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_2_uri);
- doReturn(true).when(aaiResourcesMock).exists(mis_sub_1_uri);
- doReturn(true).when(aaiResourcesMock).exists(avpn_sub_0_uri);
- doReturn(true).when(aaiResourcesMock).exists(avpn_sub_1_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
assertEquals(false, exists);
@@ -278,16 +278,16 @@ public class AuditVServerTest extends AuditVServer {
doReturn(true).when(aaiResourcesMock).exists(vserverURI);
doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_avpn_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_avpn_port_0_uri);
+ doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service1_port_0_uri);
doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_1_uri);
doReturn(Optional.of(ssc_1_mgmt_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_mis_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mis_port_0_uri);
+ doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service2_port_0_uri);
doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_int_ha_port_0_uri);
doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri);
- doReturn(true).when(aaiResourcesMock).exists(mis_sub_1_uri);
- doReturn(true).when(aaiResourcesMock).exists(avpn_sub_0_uri);
- doReturn(true).when(aaiResourcesMock).exists(avpn_sub_1_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
assertEquals(false, exists);
}
@@ -314,16 +314,16 @@ public class AuditVServerTest extends AuditVServer {
public void audit_Vserver_Second_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
doReturn(true).when(aaiResourcesMock).exists(vserverURI);
doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_avpn_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_avpn_port_0_uri);
+ doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service1_port_0_uri);
doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_1_uri);
doReturn(Optional.of(ssc_1_mgmt_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_mis_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mis_port_0_uri);
+ doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service2_port_0_uri);
doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_int_ha_port_0_uri);
doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri);
- doReturn(true).when(aaiResourcesMock).exists(mis_sub_1_uri);
- doReturn(true).when(aaiResourcesMock).exists(avpn_sub_0_uri);
- doReturn(true).when(aaiResourcesMock).exists(avpn_sub_1_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
+ doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
doReturn(false).when(aaiResourcesMock).exists(vserverURI2);
boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
assertEquals(false, exists);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
index 5df5d8200f..b3cdd467bb 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
@@ -80,19 +80,19 @@ public class HeatStackAuditTest extends HeatStackAudit {
@Test
public void extract_proper_path_Test(){
- Optional<String> actualResult = extractStackPathFromHref("https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
- assertEquals("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81", actualResult.get());
+ Optional<String> actualResult = extractStackPathFromHref("https://orchestration.com:8004/v1/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
+ assertEquals("/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81", actualResult.get());
}
@Test
public void extract_proper_resources_path_Test(){
- Optional<String> actualResult = extractResourcePathFromHref("https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
- assertEquals("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81/resources", actualResult.get());
+ Optional<String> actualResult = extractResourcePathFromHref("https://orchestration.com:8004/v1/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
+ assertEquals("/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81/resources", actualResult.get());
}
@Test
public void extract_invalid_uri_Test(){
- Optional<String> actualResult = extractStackPathFromHref("orchestrn.com:8004/v18b44d60a6f94bdcb2738f9e/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
+ Optional<String> actualResult = extractStackPathFromHref("orchestrn.com:8004/v18b44d60a6f94bdcb2738f9e//stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
assertEquals(false, actualResult.isPresent());
}
@@ -124,67 +124,68 @@ public class HeatStackAuditTest extends HeatStackAudit {
ssc_1_mgmt_port_0.setInterfaceId("8d93f63e-e972-48c7-ad98-b2122da47315");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0);
- LInterface ssc_1_mis_port_0 = new LInterface();
- ssc_1_mis_port_0.setLInterfaces(new LInterfaces());
- ssc_1_mis_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_mis_port_0);
+ LInterface ssc_1_service2_port_0 = new LInterface();
+ ssc_1_service2_port_0.setLInterfaces(new LInterfaces());
+ ssc_1_service2_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca");
+ vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0);
- LInterface mis_sub_interface_1 = new LInterface();
- mis_sub_interface_1.setInterfaceId("2bbfa345-33bb-495a-94b2-fb514ee1cffc");
- ssc_1_mis_port_0.getLInterfaces().getLInterface().add(mis_sub_interface_1);
+ LInterface service2_sub_interface_1 = new LInterface();
+ service2_sub_interface_1.setInterfaceId("2bbfa345-33bb-495a-94b2-fb514ee1cffc");
+ ssc_1_service2_port_0.getLInterfaces().getLInterface().add(service2_sub_interface_1);
LInterface ssc_1_int_ha_port_0 = new LInterface();
ssc_1_int_ha_port_0.setInterfaceId("00bb8407-650e-48b5-b919-33b88d6f8fe3");
vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0);
- LInterface ssc_1_avpn_port_0 = new LInterface();
- ssc_1_avpn_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_avpn_port_0);
- ssc_1_avpn_port_0.setLInterfaces(new LInterfaces());
+ LInterface ssc_1_service1_port_0 = new LInterface();
+ ssc_1_service1_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3");
+ vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0);
+ ssc_1_service1_port_0.setLInterfaces(new LInterfaces());
- LInterface avpn_sub_interface_0 = new LInterface();
- avpn_sub_interface_0.setInterfaceId("d54dfd09-75c6-4e04-b204-909455b8f933");
- ssc_1_avpn_port_0.getLInterfaces().getLInterface().add(avpn_sub_interface_0);
+ LInterface service1_sub_interface_0 = new LInterface();
+ service1_sub_interface_0.setInterfaceId("d54dfd09-75c6-4e04-b204-909455b8f933");
+ ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_0);
- LInterface avpn_sub_interface_1 = new LInterface();
- avpn_sub_interface_1.setInterfaceId("f7a998c0-8939-4b07-bf4a-0862e9c325e1");
- ssc_1_avpn_port_0.getLInterfaces().getLInterface().add(avpn_sub_interface_1);
+ LInterface service1_sub_interface_1 = new LInterface();
+ service1_sub_interface_1.setInterfaceId("f7a998c0-8939-4b07-bf4a-0862e9c325e1");
+ ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_1);
- LInterface avpn_sub_interface_2 = new LInterface();
- avpn_sub_interface_2.setInterfaceId("621c1fea-60b8-44ee-aede-c01b8b1aaa70");
- ssc_1_avpn_port_0.getLInterfaces().getLInterface().add(avpn_sub_interface_2);
+ LInterface service1_sub_interface_2 = new LInterface();
+ service1_sub_interface_2.setInterfaceId("621c1fea-60b8-44ee-aede-c01b8b1aaa70");
+ ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_2);
expectedVservers.add(vServer1);
- Resources avpnQueryResponse = objectMapper.readValue(new File("src/test/resources/AVPNResourceGroupResponse.json"), Resources.class);
- doReturn(avpnQueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources", cloudRegion, tenantId, Resources.class);
- Resources misQueryResponse =objectMapper.readValue(new File("src/test/resources/MISResourceGroupResponse.json"), Resources.class);
- doReturn(misQueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c/resources", cloudRegion, tenantId, Resources.class);
+ Resources service1QueryResponse = objectMapper.readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class);
+ doReturn(service1QueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources", cloudRegion, tenantId, Resources.class);
+ Resources service2QueryResponse =objectMapper.readValue(new File("src/test/resources/Service2ResourceGroupResponse.json"), Resources.class);
+ doReturn(service2QueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c/resources", cloudRegion, tenantId, Resources.class);
- Stack misStackQuerySubInt = stackObjectMapper.readValue(new File("src/test/resources/MISSubInterface0.json"), Stack.class);
- doReturn(misStackQuerySubInt).when(msoHeatUtilsMock).executeHeatClientRequest("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", cloudRegion,tenantId, Stack.class);
- Resources misResourceQuerySubInt = objectMapper.readValue(new File("src/test/resources/MISSubInterface1Resources.json"), Resources.class);
- doReturn(misResourceQuerySubInt).when(msoHeatUtilsMock).executeHeatClientRequest("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources", cloudRegion,tenantId, Resources.class);
- Stack avpnStackQuerySubInt1 =stackObjectMapper.readValue(new File("src/test/resources/AVPNSubInterface0.json"), Stack.class);
- doReturn(avpnStackQuerySubInt1).when(msoHeatUtilsMock).executeHeatClientRequest("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", cloudRegion,tenantId, Stack.class);
- Resources avpnResourceQuerySubInt1 = objectMapper.readValue(new File("src/test/resources/AVPNSubInterface0Resources.json"), Resources.class);
- doReturn(avpnResourceQuerySubInt1).when(msoHeatUtilsMock).executeHeatClientRequest("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb/resources", cloudRegion,tenantId, Resources.class);
+ Stack service2StackQuerySubInt = stackObjectMapper.readValue(new File("src/test/resources/Service2SubInterface0.json"), Stack.class);
+ doReturn(service2StackQuerySubInt).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", cloudRegion,tenantId, Stack.class);
+ Resources service2ResourceQuerySubInt = objectMapper.readValue(new File("src/test/resources/Service2SubInterface1Resources.json"), Resources.class);
+ doReturn(service2ResourceQuerySubInt).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources", cloudRegion,tenantId, Resources.class);
+
+ Stack service1StackQuerySubInt1 =stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface0.json"), Stack.class);
+ doReturn(service1StackQuerySubInt1).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", cloudRegion,tenantId, Stack.class);
+ Resources service1ResourceQuerySubInt1 = objectMapper.readValue(new File("src/test/resources/Service1SubInterface0Resources.json"), Resources.class);
+ doReturn(service1ResourceQuerySubInt1).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb/resources", cloudRegion,tenantId, Resources.class);
- Stack avpnStackQuerySubInt2 =stackObjectMapper.readValue(new File("src/test/resources/AVPNSubInterface1.json"), Stack.class);
- doReturn(avpnStackQuerySubInt2).when(msoHeatUtilsMock).executeHeatClientRequest("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a", cloudRegion,tenantId, Stack.class);
- Resources avpnResourceQuerySubInt2 = objectMapper.readValue(new File("src/test/resources/AVPNSubInterface1Resources.json"), Resources.class);
- doReturn(avpnResourceQuerySubInt2).when(msoHeatUtilsMock).executeHeatClientRequest("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a/resources", cloudRegion,tenantId, Resources.class);
-
- Stack avpnStackQuerySubInt3 =stackObjectMapper.readValue(new File("src/test/resources/AVPNSubInterface2.json"), Stack.class);
- doReturn(avpnStackQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c", cloudRegion,tenantId, Stack.class);
- Resources avpnResourceQuerySubInt3 = objectMapper.readValue(new File("src/test/resources/AVPNSubInterface2Resources.json"), Resources.class);
- doReturn(avpnResourceQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest("/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c/resources", cloudRegion,tenantId, Resources.class);
+ Stack service1StackQuerySubInt2 =stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface1.json"), Stack.class);
+ doReturn(service1StackQuerySubInt2).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a", cloudRegion,tenantId, Stack.class);
+ Resources service1ResourceQuerySubInt2 = objectMapper.readValue(new File("src/test/resources/Service1SubInterface1Resources.json"), Resources.class);
+ doReturn(service1ResourceQuerySubInt2).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a/resources", cloudRegion,tenantId, Resources.class);
+
+ Stack service1StackQuerySubInt3 =stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface2.json"), Stack.class);
+ doReturn(service1StackQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c", cloudRegion,tenantId, Stack.class);
+ Resources service1ResourceQuerySubInt3 = objectMapper.readValue(new File("src/test/resources/Service1SubInterface2Resources.json"), Resources.class);
+ doReturn(service1ResourceQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c/resources", cloudRegion,tenantId, Resources.class);
Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources);
Set<Vserver> vserversWithSubInterfaces = heatStackAudit.processSubInterfaces(cloudRegion,tenantId,resourceGroups, vServersToAudit);
@@ -210,9 +211,9 @@ public class HeatStackAuditTest extends HeatStackAudit {
ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b");
vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
- LInterface ssc_1_avpn_port_0 = new LInterface();
- ssc_1_avpn_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_avpn_port_0);
+ LInterface ssc_1_service1_port_0 = new LInterface();
+ ssc_1_service1_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3");
+ vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0);
LInterface ssc_1_mgmt_port_1 = new LInterface();
ssc_1_mgmt_port_1.setInterfaceId("07f5b14c-147a-4d14-8c94-a9e94dbc097b");
@@ -222,9 +223,9 @@ public class HeatStackAuditTest extends HeatStackAudit {
ssc_1_mgmt_port_0.setInterfaceId("8d93f63e-e972-48c7-ad98-b2122da47315");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0);
- LInterface ssc_1_mis_port_0 = new LInterface();
- ssc_1_mis_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_mis_port_0);
+ LInterface ssc_1_service2_port_0 = new LInterface();
+ ssc_1_service2_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca");
+ vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0);
LInterface ssc_1_int_ha_port_0 = new LInterface();
ssc_1_int_ha_port_0.setInterfaceId("00bb8407-650e-48b5-b919-33b88d6f8fe3");
diff --git a/adapters/mso-openstack-adapters/src/test/resources/AVPNResourceGroupResponse.json b/adapters/mso-openstack-adapters/src/test/resources/AVPNResourceGroupResponse.json
deleted file mode 100644
index 27f971b698..0000000000
--- a/adapters/mso-openstack-adapters/src/test/resources/AVPNResourceGroupResponse.json
+++ /dev/null
@@ -1,79 +0,0 @@
-{
- "resources": [
- {
- "parent_resource": "ssc_1_subint_avpn_port_0_subinterfaces",
- "resource_name": "1",
- "links": [
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources/1",
- "rel": "self"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
- "rel": "stack"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
- "rel": "nested"
- }
- ],
- "logical_resource_id": "1",
- "resource_status_reason": "state changed",
- "updated_time": "2019-01-23T19:34:56Z",
- "required_by": [],
- "resource_status": "CREATE_COMPLETE",
- "physical_resource_id": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
- "resource_type": "vlan_subinterface_ssc_avpn.yaml"
- },
- {
- "parent_resource": "ssc_1_subint_avpn_port_0_subinterfaces",
- "resource_name": "0",
- "links": [
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources/0",
- "rel": "self"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
- "rel": "stack"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a",
- "rel": "nested"
- }
- ],
- "logical_resource_id": "0",
- "resource_status_reason": "state changed",
- "updated_time": "2019-01-23T19:34:56Z",
- "required_by": [],
- "resource_status": "CREATE_COMPLETE",
- "physical_resource_id": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
- "resource_type": "vlan_subinterface_ssc_avpn.yaml"
- },
- {
- "parent_resource": "ssc_1_subint_avpn_port_0_subinterfaces",
- "resource_name": "2",
- "links": [
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources/2",
- "rel": "self"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
- "rel": "stack"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c",
- "rel": "nested"
- }
- ],
- "logical_resource_id": "2",
- "resource_status_reason": "state changed",
- "updated_time": "2019-01-23T19:34:56Z",
- "required_by": [],
- "resource_status": "CREATE_COMPLETE",
- "physical_resource_id": "bd0fc728-cbde-4301-a581-db56f494675c",
- "resource_type": "vlan_subinterface_ssc_avpn.yaml"
- }
- ]
-} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
index 33e282caa7..22e66d41bb 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
@@ -1,14 +1,36 @@
{
"resources": [
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/99cecb7b19dc4690960761abd0fe2413/stacks/zdyh3brlba05_addon/03840be2-7ce6-4e38-a748-dbd59a798732/resources/vlbagent_eph_aff_id",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/99cecb7b19dc4690960761abd0fe2413/stacks/zdyh3brlba05_addon/03840be2-7ce6-4e38-a748-dbd59a798732",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "vlbagent_eph_aff_id",
+ "physical_resource_id": "zdyh3brlba05_addon-vlbagent_eph_aff_id-euhxoicxsgso",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "vlbagent_eph_aff_id",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Heat::RandomString",
+ "updated_time": "2019-02-07T22:56:12Z"
+ },
{
"resource_name": "ssc_1_trusted_port_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
"rel": "stack"
}
],
@@ -23,22 +45,22 @@
"resource_type": "OS::Neutron::Port"
},
{
- "resource_name": "ssc_1_avpn_port_0",
+ "resource_name": "ssc_1_service1_port_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_avpn_port_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_1_avpn_port_0",
+ "logical_resource_id": "ssc_1_service1_port_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:15Z",
"required_by": [
- "ssc_1_subint_avpn_port_0_subinterfaces",
+ "ssc_1_subint_service1_port_0_subinterfaces",
"ssc_server_1"
],
"resource_status_reason": "state changed",
@@ -46,22 +68,22 @@
"resource_type": "OS::Neutron::Port"
},
{
- "resource_name": "ssc_1_subint_mis_port_0_subinterfaces",
+ "resource_name": "ssc_1_subint_service2_port_0_subinterfaces",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_mis_port_0_subinterfaces",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
"rel": "stack"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
"rel": "nested"
}
],
- "logical_resource_id": "ssc_1_subint_mis_port_0_subinterfaces",
+ "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:15Z",
"required_by": [],
@@ -73,11 +95,11 @@
"resource_name": "ssc_1_mgmt_port_1",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
"rel": "stack"
}
],
@@ -95,11 +117,11 @@
"resource_name": "ssc_1_mgmt_port_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
"rel": "stack"
}
],
@@ -114,22 +136,22 @@
"resource_type": "OS::Neutron::Port"
},
{
- "resource_name": "ssc_1_mis_port_0",
+ "resource_name": "ssc_1_service2_port_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mis_port_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_1_mis_port_0",
+ "logical_resource_id": "ssc_1_service2_port_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:15Z",
"required_by": [
- "ssc_1_subint_mis_port_0_subinterfaces",
+ "ssc_1_subint_service2_port_0_subinterfaces",
"ssc_server_1"
],
"resource_status_reason": "state changed",
@@ -140,11 +162,11 @@
"resource_name": "ssc_1_int_ha_port_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
"rel": "stack"
}
],
@@ -162,11 +184,11 @@
"resource_name": "ssc_server_1",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
"rel": "stack"
}
],
@@ -179,22 +201,22 @@
"resource_type": "OS::Nova::Server"
},
{
- "resource_name": "ssc_1_subint_avpn_port_0_subinterfaces",
+ "resource_name": "ssc_1_subint_service1_port_0_subinterfaces",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_avpn_port_0_subinterfaces",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
"rel": "stack"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
"rel": "nested"
}
],
- "logical_resource_id": "ssc_1_subint_avpn_port_0_subinterfaces",
+ "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:15Z",
"required_by": [],
@@ -203,4 +225,4 @@
"resource_type": "OS::Heat::ResourceGroup"
}
]
-} \ No newline at end of file
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/MISResourceGroupResponse.json b/adapters/mso-openstack-adapters/src/test/resources/MISResourceGroupResponse.json
deleted file mode 100644
index 2350138076..0000000000
--- a/adapters/mso-openstack-adapters/src/test/resources/MISResourceGroupResponse.json
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-{
- "resources": [
- {
- "parent_resource": "ssc_1_subint_mis_port_0_subinterfaces",
- "resource_name": "0",
- "links": [
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c/resources/0",
- "rel": "self"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
- "rel": "stack"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
- "rel": "nested"
- }
- ],
- "logical_resource_id": "0",
- "resource_status_reason": "state changed",
- "updated_time": "2019-01-23T19:34:56Z",
- "required_by": [],
- "resource_status": "CREATE_COMPLETE",
- "physical_resource_id": "f711be16-2654-4a09-b89d-0511fda20e81",
- "resource_type": "vlan_subinterface_ssc_mis.yaml"
- }
- ]
-} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/MISSubInterface1Resources.json b/adapters/mso-openstack-adapters/src/test/resources/MISSubInterface1Resources.json
deleted file mode 100644
index 5fa2795462..0000000000
--- a/adapters/mso-openstack-adapters/src/test/resources/MISSubInterface1Resources.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "resources": [
- {
- "parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0",
- "links": [
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_subint_mis_vmi_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:56Z",
- "required_by": [
- "ssc_subint_mis_vmi_0_v6_ip_0",
- "ssc_subint_mis_vmi_0_ip_0"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "2bbfa345-33bb-495a-94b2-fb514ee1cffc",
- "resource_type": "OS::ContrailV2::VirtualMachineInterface"
- },
- {
- "parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0_v6_ip_0",
- "links": [
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_subint_mis_vmi_0_v6_ip_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:56Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "e7f25707-12fd-454f-95ac-6a05cd70806f",
- "resource_type": "OS::ContrailV2::InstanceIp"
- },
- {
- "parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0_ip_0",
- "links": [
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_subint_mis_vmi_0_ip_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:56Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "6d23f4d3-8f7b-42c5-bb9e-4aee5797d506",
- "resource_type": "OS::ContrailV2::InstanceIp"
- }
- ]
-} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1ResourceGroupResponse.json b/adapters/mso-openstack-adapters/src/test/resources/Service1ResourceGroupResponse.json
new file mode 100644
index 0000000000..e2e701233f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1ResourceGroupResponse.json
@@ -0,0 +1,79 @@
+{
+ "resources": [
+ {
+ "parent_resource": "ssc_1_subint_service1_port_0_subinterfaces",
+ "resource_name": "1",
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources/1",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
+ "rel": "stack"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "1",
+ "resource_status_reason": "state changed",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "resource_type": "vlan_subinterface_ssc_service1.yaml"
+ },
+ {
+ "parent_resource": "ssc_1_subint_service1_port_0_subinterfaces",
+ "resource_name": "0",
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources/0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
+ "rel": "stack"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "0",
+ "resource_status_reason": "state changed",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "resource_type": "vlan_subinterface_ssc_service1.yaml"
+ },
+ {
+ "parent_resource": "ssc_1_subint_service1_port_0_subinterfaces",
+ "resource_name": "2",
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources/2",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
+ "rel": "stack"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "2",
+ "resource_status_reason": "state changed",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "bd0fc728-cbde-4301-a581-db56f494675c",
+ "resource_type": "vlan_subinterface_ssc_service1.yaml"
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface0.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0.json
index e0a2404eaf..20121e6ff9 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface0.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0.json
@@ -5,12 +5,12 @@
"description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
"rel": "self"
}
],
"stack_status_reason": "Stack CREATE completed successfully",
- "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
+ "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
"stack_user_project_id": "dfffe8b2401b45368ca6e21f19796ce1",
"stack_owner": "m08699",
"creation_time": "2019-01-23T19:34:57Z",
@@ -23,10 +23,10 @@
"OS::project_id": "ea2d13cc98b44d60a6f94bdcb2738f9e",
"port_interface": "27391d94-33af-474a-927d-d409249e8fd3",
"OS::stack_id": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
- "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
+ "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
"vip_v6_address": "2001:1890:e005:1403::",
"network_id": "1bc1c5fe-896f-4629-b499-a5a36ece4253,c2f4ad4a-0089-41fa-aba7-a80963def29b,70bc637c-ea0f-4452-8aca-01e90c842ff1",
- "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_avpn",
+ "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1",
"counter": "0",
"mac_address": "02:27:39:1d:94:33",
"vip_address": "12.251.1.8",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface0Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json
index e0631db0b5..0f3f35418e 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface0Resources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json
@@ -7,11 +7,11 @@
"resource_name": "ssc_subint_mis_vmi_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
@@ -31,11 +31,11 @@
"resource_name": "ssc_subint_mis_vmi_0_v6_ip_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
@@ -52,11 +52,11 @@
"resource_name": "ssc_subint_mis_vmi_0_ip_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
diff --git a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface1.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1.json
index 009533b476..788757b24e 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface1.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1.json
@@ -7,12 +7,12 @@
"description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a",
"rel": "self"
}
],
"stack_status_reason": "Stack CREATE completed successfully",
- "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
+ "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
"stack_user_project_id": "dfffe8b2401b45368ca6e21f19796ce1",
"stack_owner": "m08699",
"creation_time": "2019-01-23T19:34:57Z",
@@ -25,10 +25,10 @@
"OS::project_id": "ea2d13cc98b44d60a6f94bdcb2738f9e",
"port_interface": "27391d94-33af-474a-927d-d409249e8fd3",
"OS::stack_id": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
- "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
+ "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
"vip_v6_address": "2001:1890:e005:1403::",
"network_id": "1bc1c5fe-896f-4629-b499-a5a36ece4253,c2f4ad4a-0089-41fa-aba7-a80963def29b,70bc637c-ea0f-4452-8aca-01e90c842ff1",
- "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_avpn",
+ "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1",
"counter": "0",
"mac_address": "02:27:39:1d:94:33",
"vip_address": "12.251.1.8",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface1Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json
index 1b10f16d6d..cfc4d7fed6 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface1Resources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json
@@ -7,11 +7,11 @@
"resource_name": "ssc_subint_mis_vmi_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
@@ -31,11 +31,11 @@
"resource_name": "ssc_subint_mis_vmi_0_v6_ip_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
@@ -52,11 +52,11 @@
"resource_name": "ssc_subint_mis_vmi_0_ip_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
diff --git a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface2.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2.json
index 7488ee2045..c8fab2ae80 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface2.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2.json
@@ -5,12 +5,12 @@
"description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbtsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675cc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbtsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675cc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c",
"rel": "self"
}
],
"stack_status_reason": "Stack CREATE completed successfully",
- "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv",
+ "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv",
"stack_user_project_id": "dfffe8b2401b45368ca6e21f19796ce1",
"stack_owner": "m08699",
"creation_time": "2019-01-23T19:34:57Z",
@@ -23,10 +23,10 @@
"OS::project_id": "ea2d13cc98b44d60a6f94bdcb2738f9e",
"port_interface": "27391d94-33af-474a-927d-d409249e8fd3",
"OS::stack_id": "bd0fc728-cbde-4301-a581-db56f494675c",
- "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_avpn_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv",
+ "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv",
"vip_v6_address": "2001:1890:e005:1403::",
"network_id": "1bc1c5fe-896f-4629-b499-a5a36ece4253,c2f4ad4a-0089-41fa-aba7-a80963def29b,70bc637c-ea0f-4452-8aca-01e90c842ff1",
- "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_avpn",
+ "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1",
"counter": "2",
"mac_address": "02:27:39:1d:94:33",
"vip_address": "12.251.1.8",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface2Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json
index 94c7c69de4..e8aa80eb6f 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/AVPNSubInterface2Resources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json
@@ -7,11 +7,11 @@
"resource_name": "ssc_subint_mis_vmi_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
@@ -31,11 +31,11 @@
"resource_name": "ssc_subint_mis_vmi_0_v6_ip_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
@@ -52,11 +52,11 @@
"resource_name": "ssc_subint_mis_vmi_0_ip_0",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service2ResourceGroupResponse.json b/adapters/mso-openstack-adapters/src/test/resources/Service2ResourceGroupResponse.json
new file mode 100644
index 0000000000..59f315a726
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service2ResourceGroupResponse.json
@@ -0,0 +1,31 @@
+
+
+{
+ "resources": [
+ {
+ "parent_resource": "ssc_1_subint_service2_port_0_subinterfaces",
+ "resource_name": "0",
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c/resources/0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
+ "rel": "stack"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "0",
+ "resource_status_reason": "state changed",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "resource_type": "vlan_subinterface_ssc_service2.yaml"
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/MISSubInterface0.json b/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface0.json
index d879b3be59..d10332b76e 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/MISSubInterface0.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface0.json
@@ -5,12 +5,12 @@
"description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n",
"links": [
{
- "href": "https://orchestration-aic.dyh3b.cci.att.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "self"
}
],
"stack_status_reason": "Stack CREATE completed successfully",
- "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y",
+ "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y",
"stack_user_project_id": "dfffe8b2401b45368ca6e21f19796ce1",
"stack_owner": "m08699",
"creation_time": "2019-01-23T19:34:56Z",
@@ -23,10 +23,10 @@
"OS::project_id": "ea2d13cc98b44d60a6f94bdcb2738f9e",
"port_interface": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
"OS::stack_id": "f711be16-2654-4a09-b89d-0511fda20e81",
- "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y",
+ "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y",
"vip_v6_address": "2001:1890:1001:4a32::3",
"network_id": "8be20e92-68d6-4aec-ae66-0fc0fc933546",
- "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_mis",
+ "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_service2",
"counter": "0",
"mac_address": "02:05:94:a2:f2:7e",
"vip_address": "32.68.12.91",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface1Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface1Resources.json
new file mode 100644
index 0000000000..84ae20f43e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface1Resources.json
@@ -0,0 +1,70 @@
+{
+ "resources": [
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_service2_vmi_0",
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service2_vmi_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_service2_vmi_0",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [
+ "ssc_subint_service2_vmi_0_v6_ip_0",
+ "ssc_subint_service2_vmi_0_ip_0"
+ ],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "2bbfa345-33bb-495a-94b2-fb514ee1cffc",
+ "resource_type": "OS::ContrailV2::VirtualMachineInterface"
+ },
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_service2_vmi_0_v6_ip_0",
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service2_vmi_0_v6_ip_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_service2_vmi_0_v6_ip_0",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "e7f25707-12fd-454f-95ac-6a05cd70806f",
+ "resource_type": "OS::ContrailV2::InstanceIp"
+ },
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_service2_vmi_0_ip_0",
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service2_vmi_0_ip_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_service2_vmi_0_ip_0",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "6d23f4d3-8f7b-42c5-bb9e-4aee5797d506",
+ "resource_type": "OS::ContrailV2::InstanceIp"
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.3__Add_Add_Column_To_WatchDog_Model_Id_Lookup.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.3__Add_Add_Column_To_WatchDog_Model_Id_Lookup.sql
new file mode 100644
index 0000000000..9a5bef6cc8
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.3__Add_Add_Column_To_WatchDog_Model_Id_Lookup.sql
@@ -0,0 +1,6 @@
+use requestdb;
+
+ALTER TABLE watchdog_service_mod_ver_id_lookup ADD DISTRIBUTION_NOTIFICATION LONGTEXT NULL AFTER SERVICE_MODEL_VERSION_ID;
+ALTER TABLE watchdog_service_mod_ver_id_lookup ADD CONSUMER_ID varchar(200) NULL AFTER DISTRIBUTION_NOTIFICATION;
+
+CREATE INDEX watchdog_service_mod_ver_id_lookup_serv_mod_ver_id_idx ON watchdog_service_mod_ver_id_lookup (SERVICE_MODEL_VERSION_ID ASC); \ No newline at end of file
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index ca1d0331fd..7a02f47d3f 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -28,6 +28,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.file.Paths;
import java.util.List;
+import java.util.Optional;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
@@ -55,11 +56,16 @@ import org.onap.so.asdc.util.ASDCNotificationLogging;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
import org.onap.so.logger.MessageEnum;
-
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
@Component
public class ASDCController {
@@ -555,6 +561,22 @@ public class ASDCController {
LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent Final notification to ASDC", "ASDC", null, null);
}
+ private Optional<String> getNotificationJson(INotificationData iNotif) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ mapper.setSerializationInclusion(Include.NON_EMPTY);
+ mapper.setSerializationInclusion(Include.NON_ABSENT);
+ mapper.enable(MapperFeature.USE_ANNOTATIONS);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ Optional<String> returnValue = Optional.empty();
+ try {
+ returnValue = Optional.of(mapper.writeValueAsString(iNotif));
+ } catch (JsonProcessingException e) {
+ LOGGER.error("Error converting incoming ASDC notification to JSON" , e);
+ }
+ return returnValue;
+ }
+
public void treatNotification (INotificationData iNotif) {
int noOfArtifacts = 0;
@@ -571,7 +593,9 @@ public class ASDCController {
LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, iNotif.getServiceUUID(), "ASDC", "treatNotification");
this.changeControllerStatus(ASDCControllerStatus.BUSY);
- toscaInstaller.processWatchdog(iNotif.getDistributionID(),iNotif.getServiceUUID());
+ Optional<String> notificationMessage = getNotificationJson(iNotif);
+ toscaInstaller.processWatchdog(iNotif.getDistributionID(), iNotif.getServiceUUID(), notificationMessage,
+ asdcConfig.getConsumerID());
// Process only the Resource artifacts in MSO
this.processResourceNotification(iNotif);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
index 7dab49f82a..ed97f5bdea 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
@@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.List;
import org.onap.sdc.api.notification.IArtifactInfo;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
public class ArtifactInfoImpl implements IArtifactInfo {
@@ -168,4 +170,23 @@ public class ArtifactInfoImpl implements IArtifactInfo {
public void setRelatedArtifacts(List<ArtifactInfoImpl> relatedArtifacts) {
this.relatedArtifactsImpl = relatedArtifacts;
}
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof ArtifactInfoImpl)) {
+ return false;
+ }
+ ArtifactInfoImpl castOther = (ArtifactInfoImpl) other;
+ return new EqualsBuilder().append(artifactUUID, castOther.artifactUUID)
+ .append(artifactVersion, castOther.artifactVersion).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(artifactName).append(artifactType).append(artifactURL)
+ .append(artifactChecksum).append(artifactDescription).append(artifactTimeout).append(artifactVersion)
+ .append(artifactUUID).append(generatedFromUUID).append(generatedArtifact).append(relatedArtifactsInfo)
+ .append(relatedArtifactsImpl).toHashCode();
+ }
+
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
index 294221352c..a1c660f75f 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
@@ -23,11 +23,15 @@ package org.onap.so.asdc.client.test.emulators;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
@Component
public class NotificationDataImpl implements INotificationData {
@@ -114,6 +118,7 @@ public class NotificationDataImpl implements INotificationData {
return ret;
}
+ @JsonIgnore
public List<ResourceInfoImpl> getResourcesImpl(){
return resources;
}
@@ -172,4 +177,22 @@ public class NotificationDataImpl implements INotificationData {
}
return ret;
}
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof NotificationDataImpl)) {
+ return false;
+ }
+ NotificationDataImpl castOther = (NotificationDataImpl) other;
+ return new EqualsBuilder().append(serviceUUID, castOther.serviceUUID)
+ .append(serviceVersion, castOther.serviceVersion).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(distributionID).append(serviceName).append(serviceVersion)
+ .append(serviceUUID).append(serviceDescription).append(serviceInvariantUUID).append(resources)
+ .append(serviceArtifacts).append(workloadContext).toHashCode();
+ }
+
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
index eb4764dec1..dad7e64931 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
@@ -23,9 +23,13 @@ package org.onap.so.asdc.client.test.emulators;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.IResourceInstance;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
public class ResourceInfoImpl implements IResourceInstance{
ResourceInfoImpl (){}
private String resourceInstanceName;
@@ -120,7 +124,8 @@ public class ResourceInfoImpl implements IResourceInstance{
this.artifacts = artifacts;
}
- public List<ArtifactInfoImpl> getArtifactsImpl(){
+ @JsonIgnore
+ public List<ArtifactInfoImpl> getArtifactsImpl() {
return artifacts;
}
@@ -155,4 +160,21 @@ public class ResourceInfoImpl implements IResourceInstance{
public void setSubcategory(String subcategory) {
this.subcategory = subcategory;
}
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof ResourceInfoImpl)) {
+ return false;
+ }
+ ResourceInfoImpl castOther = (ResourceInfoImpl) other;
+ return new EqualsBuilder().append(resourceUUID, castOther.resourceUUID)
+ .append(resourceVersion, castOther.resourceVersion).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(resourceInstanceName).append(resourceCustomizationUUID).append(resourceName)
+ .append(resourceVersion).append(resourceType).append(resourceUUID).append(resourceInvariantUUID)
+ .append(category).append(subcategory).append(artifacts).toHashCode();
+ }
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index ebc705ce30..90b705c019 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -554,8 +554,14 @@ public class ToscaResourceInstaller {
for (RequirementAssignment requirement : requirementsList) {
if (requirement.getNodeTemplateName().equals(spNode.getName())) {
ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, toscaResourceStruct, serviceProxy);
-
- configurationResourceList.add(configurationResource);
+
+ Optional<ConfigurationResourceCustomization> matchingObject = configurationResourceList.stream()
+ .filter(configurationResourceCustomization -> configNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID).equals(configurationResource.getModelCustomizationUUID()))
+ .findFirst();
+ if(!matchingObject.isPresent()){
+ configurationResourceList.add(configurationResource);
+ }
+
break;
}
}
@@ -689,8 +695,10 @@ public class ToscaResourceInstaller {
}
}
- public void processWatchdog(String distributionId, String servideUUID) {
- WatchdogServiceModVerIdLookup modVerIdLookup = new WatchdogServiceModVerIdLookup(distributionId,servideUUID);
+ public void processWatchdog(String distributionId, String servideUUID, Optional<String> distributionNotification,
+ String consumerId) {
+ WatchdogServiceModVerIdLookup modVerIdLookup = new WatchdogServiceModVerIdLookup(distributionId, servideUUID,
+ distributionNotification, consumerId);
watchdogModVerIdLookupRepository.saveAndFlush(modVerIdLookup);
WatchdogDistributionStatus distributionStatus = new WatchdogDistributionStatus(distributionId);
diff --git a/asdc-controller/src/test/resources/data.sql b/asdc-controller/src/test/resources/data.sql
index 681ee3bda7..70737abf5a 100644
--- a/asdc-controller/src/test/resources/data.sql
+++ b/asdc-controller/src/test/resources/data.sql
@@ -59,6 +59,6 @@ insert into requestdb.watchdog_per_component_distribution_status(DISTRIBUTION_ID
('testStatusExceptionTosca', 'AAI', 'COMPONENT_MALFORMED'),
('testStatusExceptionTosca', 'SDNC', 'COMPONENT_MALFORMED');
-insert into requestdb.watchdog_service_mod_ver_id_lookup(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID) values
-('watchdogTestStatusSuccess', '5df8b6de-2083-11e7-93ae-92361f002671'),
-('watchdogTestStatusNull', '00000000-0000-0000-0000-000000000000');
+insert into requestdb.watchdog_service_mod_ver_id_lookup(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID, DISTRIBUTION_NOTIFICATION, CONSUMER_ID) values
+('watchdogTestStatusSuccess', '5df8b6de-2083-11e7-93ae-92361f002671', NULL, NULL),
+('watchdogTestStatusNull', '00000000-0000-0000-0000-000000000000', NULL, NULL);
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index 17423f8434..010b36dcf1 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -1008,6 +1008,8 @@ CREATE TABLE `watchdog_per_component_distribution_status` (
CREATE TABLE `watchdog_service_mod_ver_id_lookup` (
`DISTRIBUTION_ID` varchar(45) NOT NULL,
`SERVICE_MODEL_VERSION_ID` varchar(45) NOT NULL,
+ `DISTRIBUTION_NOTIFICATION` LONGTEXT NULL,
+ `CONSUMER_ID` varchar(200) NULL,
`CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODIFY_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`DISTRIBUTION_ID`,`SERVICE_MODEL_VERSION_ID`)
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index 025b533dc0..750f25532c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -154,7 +156,7 @@ public class ResourceRequestBuilder {
}
}
- if (resourceInputStr != null || !resourceInputStr.equals("")) {
+ if (resourceInputStr != null && !resourceInputStr.isEmpty()) {
return getResourceInput(resourceInputStr, serviceInputs);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java
index 91cd2ad791..a727162415 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java
@@ -31,10 +31,10 @@ public class Candidate implements Serializable {
private static final long serialVersionUID = -3959572501582849328L;
- @JsonProperty("candidateType")
- private CandidateType candidateType;
- @JsonProperty("candidates")
- private List<String> candidates;
+ @JsonProperty("identifierType")
+ private CandidateType identifierType;
+ @JsonProperty("identifiers")
+ private List<String> identifiers;
@JsonProperty("cloudOwner")
private String cloudOwner;
@@ -42,32 +42,32 @@ public class Candidate implements Serializable {
* list of candidates
* i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc.
*/
- public List<String> getCandidates() {
- return candidates;
+ public List<String> getIdentifiers() {
+ return identifiers;
}
/**
* list of candidates
* i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc.
*/
- public void setCandidates(List<String> candidates) {
- this.candidates = candidates;
+ public void setIdentifiers(List<String> identifiers) {
+ this.identifiers = identifiers;
}
/**
* Way to identify the type of candidate
* i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc.
*/
- public CandidateType getCandidateType(){
- return candidateType;
+ public CandidateType getIdentifierType(){
+ return identifierType;
}
/**
* Way to identify the type of candidate
* i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc.
*/
- public void setCandidateType(CandidateType candidateType){
- this.candidateType = candidateType;
+ public void setIdentifierType(CandidateType identifierType){
+ this.identifierType = identifierType;
}
/**
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java
index f1534ab60f..6a4fa50020 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.servicedecomposition.homingobjects;
+import com.fasterxml.jackson.annotation.JsonValue;
+
public enum CandidateType{
@@ -35,11 +37,8 @@ public enum CandidateType{
}
@Override
+ @JsonValue
public String toString() {
return name;
}
-
- public String getName(){
- return name;
- }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index ca0a78a3f2..fbff0620a3 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -406,17 +406,16 @@ public class BBInputSetup implements JavaDelegate {
if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null
&& vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) {
vfModule = vfModuleTemp;
- String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId();
- modelInfo.setModelCustomizationId(vfModuleCustId);
- break;
}
+ String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModuleTemp.getVfModuleId()).getModelCustomizationId();
+ ModelInfo modelInfoVfModule = new ModelInfo();
+ modelInfoVfModule.setModelCustomizationId(vfModuleCustId);
+ mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, vnfModelCustomizationUUID);
}
if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) {
vfModule = createVfModule(lookupKeyMap,
resourceId, instanceName, instanceParams);
vnf.getVfModules().add(vfModule);
- }
- if(vfModule != null) {
mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID);
}
} else {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index b210b5ed2f..ee7999f995 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -55,6 +55,7 @@ public class ExecuteBuildingBlockRainyDay {
private Environment environment;
protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier";
protected String defaultCode = "mso.rainyDay.defaultCode";
+ protected String maxRetries = "mso.rainyDay.maxRetries";
public void setRetryTimer(DelegateExecution execution) {
try {
@@ -172,10 +173,17 @@ public class ExecuteBuildingBlockRainyDay {
msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode);
execution.setVariable(HANDLING_CODE, handlingCode);
} catch (Exception e) {
- msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = Abort", e);
String code = this.environment.getProperty(defaultCode);
+ msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = "+ code, e);
execution.setVariable(HANDLING_CODE, code);
}
+ try{
+ int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
+ execution.setVariable("maxRetries", envMaxRetries);
+ } catch (Exception ex) {
+ msoLogger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ execution.setVariable("maxRetries", 5);
+ }
}
public void setHandlingStatusSuccess(DelegateExecution execution) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java
index 382852886e..17b99e2741 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java
@@ -38,22 +38,21 @@ public class GlobalDmaapPublisher extends DmaapPublisher {
}
@Override
- public String getUserName() {
+ public String getAuth() {
- return UrnPropertiesReader.getVariable("mso.global.dmaap.username");
+ return UrnPropertiesReader.getVariable("mso.global.dmaap.auth");
}
@Override
- public String getPassword() {
+ public String getKey() {
- return UrnPropertiesReader.getVariable("mso.global.dmaap.password");
+ return UrnPropertiesReader.getVariable("mso.msoKey");
}
@Override
public String getTopic() {
-
return UrnPropertiesReader.getVariable("mso.global.dmaap.publisher.topic");
}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy
index 55f68f665e..dac038fab3 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy
@@ -97,7 +97,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{
@Test
void testCreateGenericVnf(){
when(mockExecution.getVariable("CAAIVfMod_vnfName")).thenReturn("vnfName")
- Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject())
+ Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject())
createAAIVfModule.createGenericVnf(mockExecution)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createGenericVnfResponseCode", 201)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createGenericVnfResponse","Vnf Created")
@@ -112,7 +112,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{
when(mockExecution.getVariable("CAAIVfMod_personaId")).thenReturn("model1")
when(mockExecution.getVariable("CAAIVfMod_moduleName")).thenReturn("vfModuleName")
- Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject())
+ Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject())
createAAIVfModule.createVfModule(mockExecution,false)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponseCode", 201)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponse","Vf Module Created")
@@ -173,7 +173,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{
Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnfVfModule.json");
when(mockExecution.getVariable("CAAIVfMod_queryGenericVnfResponse")).thenReturn(genericVnf.get())
when(mockExecution.getVariable("CAAIVfMod_moduleName")).thenReturn("vfModuleName")
- Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject())
+ Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject())
createAAIVfModule.createVfModule(mockExecution,true)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponseCode", 201)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponse","Vf Module Created")
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy
index 4b6f8aa918..2a872511e7 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy
@@ -92,7 +92,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{
void testDeleteGenericVnf() {
ExecutionEntity mockExecution = setupMock()
when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1")
- doNothing().when(client).delete(isA(AAIResourceUri.class))
+ doNothing().when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri)
deleteAAIVfModule.deleteGenericVnf(mockExecution)
Mockito.verify(mockExecution).setVariable(prefix + "deleteGenericVnfResponseCode", 200)
}
@@ -169,7 +169,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{
ExecutionEntity mockExecution = setupMock()
when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1")
try {
- doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class))
+ doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri)
deleteAAIVfModule.deleteGenericVnf(mockExecution)
} catch (Exception ex) {
println " Test End - Handle catch-throw BpmnError()! "
@@ -186,7 +186,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{
ExecutionEntity mockExecution = setupMock()
when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1")
when(mockExecution.getVariable("DAAIVfMod_vfModuleId")).thenReturn("vfModuleId1")
- doNothing().when(client).delete(isA(AAIResourceUri.class))
+ doNothing().when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri)
deleteAAIVfModule.deleteVfModule(mockExecution)
Mockito.verify(mockExecution).setVariable(prefix + "deleteVfModuleResponseCode", 200)
}
@@ -197,7 +197,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{
when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1")
when(mockExecution.getVariable("DAAIVfMod_vfModuleId")).thenReturn("vfModuleId1")
try {
- doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class))
+ doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri)
deleteAAIVfModule.deleteVfModule(mockExecution)
} catch (Exception ex) {
println " Test End - Handle catch-throw BpmnError()! "
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
index 2d2f58b415..72bcfcf359 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
@@ -111,7 +111,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
vfModule.setVfModuleId("supercool")
vfModule.setResourceVersion("12345")
when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule)
- doNothing().when(client).update(isA(AAIResourceUri.class), anyObject())
+ doNothing().when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject())
updateAAIVfModule.updateVfModule(mockExecution)
verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 200)
}
@@ -126,7 +126,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
vfModule.setVfModuleId("supercool")
vfModule.setResourceVersion("12345")
when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule)
- doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class), anyObject())
+ doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject())
thrown.expect(BpmnError.class)
updateAAIVfModule.updateVfModule(mockExecution)
verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 404)
@@ -143,7 +143,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
vfModule.setVfModuleId("supercool")
vfModule.setResourceVersion("12345")
when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule)
- doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class), anyObject())
+ doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject())
thrown.expect(BpmnError.class)
updateAAIVfModule.updateVfModule(mockExecution)
verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 500)
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
index e5e13268b2..ddca319708 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
@@ -405,4 +405,32 @@ public class ResourceRequestBuilderTest extends BaseTest {
assertEquals(resourceSequence.get(0), "res1");
assertEquals(resourceSequence.get(1), "res2");
}
-} \ No newline at end of file
+
+ @Test
+ public void getResourceInputWithEmptyServiceResourcesTest() throws Exception {
+
+ stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
+ .willReturn(ok("{ \"serviceResources\" : {\n" +
+ "\t\"modelInfo\" : {\n" +
+ "\t\t\"modelName\" : \"demoVFWCL\",\n" +
+ "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" +
+ "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" +
+ "\t\t\"modelVersion\" : \"1.0\"\n" +
+ "\t},\n" +
+ "\t\"serviceType\" : \"\",\n" +
+ "\t\"serviceRole\" : \"\",\n" +
+ "\t\"environmentContext\" : null,\n" +
+ "\t\"workloadContext\" : \"Production\",\n" +
+ "\t\"serviceVnfs\": [], \n" +
+ "\t\"serviceNetworks\": [],\n" +
+ "\t\"serviceAllottedResources\": []\n" +
+ "\t}}")));
+
+ HashMap serviceInput = new HashMap();
+ serviceInput.put("key1", "value");
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ assertEquals(0, stringObjectMap.size());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 35a7005751..56875d315b 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -2551,6 +2551,12 @@ public class BBInputSetupTest {
volumeGroup.setVolumeGroupId(volumeGroupId);
vnf.getVolumeGroups().add(volumeGroup);
serviceInstance.getVnfs().add(vnf);
+ VfModule vfModule1 = new VfModule();
+ vfModule1.setVfModuleId("vfModuleId1");
+ VfModule vfModule2 = new VfModule();
+ vfModule2.setVfModuleId("vfModuleId2");
+ vnf.getVfModules().add(vfModule1);
+ vnf.getVfModules().add(vfModule2);
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId);
String resourceId = vfModuleId;
@@ -2563,16 +2569,20 @@ public class BBInputSetupTest {
vnfAAI.setModelCustomizationId("vnfModelCustId");
org.onap.aai.domain.yang.VolumeGroup volumeGroupAAI = new org.onap.aai.domain.yang.VolumeGroup();
volumeGroupAAI.setModelCustomizationId(vfModuleCustomizationId);
+ org.onap.aai.domain.yang.VfModule vfModuleAAI = new org.onap.aai.domain.yang.VfModule();
+ vfModuleAAI.setModelCustomizationId(vfModuleCustomizationId);
doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
doReturn(volumeGroupAAI).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(CLOUD_OWNER,
cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ doReturn(vfModuleAAI).when(SPY_bbInputSetupUtils).getAAIVfModule(isA(String.class), isA(String.class));
doNothing().when(SPY_bbInputSetup).mapCatalogVnf(isA(GenericVnf.class), isA(ModelInfo.class), isA(Service.class));
doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class));
SPY_bbInputSetup.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration);
+ verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class));
assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID));
assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
index 868aabf6a9..6344a3f1a6 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
@@ -131,6 +131,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true);
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
+ assertEquals(5,delegateExecution.getVariable("maxRetries"));
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java
index 95b86524a3..c50a6db178 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java
@@ -75,7 +75,7 @@ public class DmaapPropertiesClientTest extends BaseTest{
@Test
public void testDmaapPublishRequest() throws JsonProcessingException, MapperException {
- stubFor(post(urlEqualTo("/events/com.att.mso.asyncStatusUpdate?timeout=20000"))
+ stubFor(post(urlEqualTo("/events/com.att.mso.asyncStatusUpdate?timeout=60000"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
dmaapPropertiesClient.dmaapPublishRequest(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope,
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
index 4d7c85efdb..fc69f812be 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
@@ -35,8 +35,8 @@ public class GlobalDmaapPublisherTest extends BaseTest{
@Test
public void testGetters() {
- assertEquals("dmaapUsername", globalDmaapPublisher.getUserName());
- assertEquals("ZG1hYXBQYXNzd29yZA==", globalDmaapPublisher.getPassword());
+ assertEquals("81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54", globalDmaapPublisher.getAuth());
+ assertEquals("07a7159d3bf51a0e53be7a8f89699be7", globalDmaapPublisher.getKey());
assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic());
assertEquals("http://localhost:" + wireMockPort, globalDmaapPublisher.getHost().get());
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
index 945972c9e2..afdb800ffe 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
+++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
@@ -146,6 +146,7 @@ mso:
host: http://localhost:${wiremock.server.port}
publisher:
topic: com.att.mso.asyncStatusUpdate
+ auth: 81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54
oof:
auth: test
timeout: PT10S
@@ -163,6 +164,16 @@ sdnc:
auth: Basic YWRtaW46YWRtaW4=
host: http://localhost:8446
path: /restconf/operations/GENERIC-RESOURCE-API
+sdno:
+ health-check:
+ dmaap:
+ password: alRyMzJ3NUNeakxl
+ publisher:
+ topic: com.att.sdno.test-health-diagnostic-v02
+ host: https://olsd004.wnsnet.attws.com:3905
+ subscriber:
+ topic: com.att.sdno.test-health-diagnostic-v02
+ auth: 81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54
sniro:
conductor:
enabled: true
@@ -178,7 +189,15 @@ sniro:
headers.patchVersion: 1
headers.minorVersion: 1
headers.latestVersion: 2
-
+ruby:
+ create-ticket-request:
+ dmaap:
+ username: m04768@mso.ecomp.att.com
+ password: alRyMzJ3NUNeakxl
+ publisher:
+ topic: com.att.pdas.exp.msoCMFallout-v1
+ host: https://olsd004.wnsnet.attws.com:3905
+ auth: 81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54
spring:
datasource:
jdbc-url: jdbc:mariadb://localhost:3307/camundabpmn
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
index 70d94052e1..4e0bf02685 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
@@ -20,12 +20,10 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-
import org.onap.aai.domain.yang.Pnf;
import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
import org.springframework.context.annotation.Primary;
@@ -39,9 +37,10 @@ public class AaiConnectionTestImpl implements AaiConnection {
public static final String ID_WITH_ENTRY = "idWithEntryNoIp";
private Map<String, Pnf> created = new HashMap<>();
+ private Map<String, String> serviceAndPnfRelationMap = new HashMap<>();
@Override
- public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ public Optional<Pnf> getEntryFor(String correlationId) {
if (Objects.equals(correlationId, ID_WITH_ENTRY)) {
return Optional.of(new Pnf());
} else {
@@ -50,15 +49,25 @@ public class AaiConnectionTestImpl implements AaiConnection {
}
@Override
- public void createEntry(String correlationId, Pnf entry) throws IOException {
+ public void createEntry(String correlationId, Pnf entry) {
created.put(correlationId, entry);
}
+ @Override
+ public void createRelation(String serviceInstanceId, String pnfName) {
+ serviceAndPnfRelationMap.put(serviceInstanceId, pnfName);
+ }
+
public Map<String, Pnf> getCreated() {
return created;
}
+ public Map<String, String> getServiceAndPnfRelationMap() {
+ return serviceAndPnfRelationMap;
+ }
+
public void reset() {
created.clear();
+ serviceAndPnfRelationMap.clear();
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index 2d0d4b51a9..db6cbe06ae 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -31,15 +31,19 @@ import java.util.Map;
import java.util.UUID;
import org.assertj.core.api.Assertions;
+import org.assertj.core.data.MapEntry;
import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Before;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.springframework.beans.factory.annotation.Autowired;
public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
- private static final String TIMEOUT_10_S = "PT10S";
private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString();
+ private static final String SERVICE_INSTANCE_ID = "serviceForInstance";
+
+ private Map<String, Object> variables;
@Autowired
private AaiConnectionTestImpl aaiConnection;
@@ -47,14 +51,18 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
@Autowired
private DmaapClientTestImpl dmaapClientTestImpl;
+ @Before
+ public void setup() {
+ aaiConnection.reset();
+ variables = new HashMap<>();
+ variables.put("serviceInstanceId", SERVICE_INSTANCE_ID);
+ variables.put(PNF_UUID, VALID_UUID);
+ }
+
@Test
public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
// given
- aaiConnection.reset();
- Map<String, Object> variables = new HashMap<>();
- variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITH_ENTRY);
- variables.put(PNF_UUID, VALID_UUID);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -70,19 +78,17 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
"AaiEntryExists",
"InformDmaapClient",
"WaitForDmaapPnfReadyNotification",
+ "CreateRelationId",
"AaiEntryUpdated"
);
+ Assertions.assertThat(aaiConnection.getServiceAndPnfRelationMap()).
+ containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID,AaiConnectionTestImpl.ID_WITH_ENTRY));
}
@Test
public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
// given
- aaiConnection.reset();
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITHOUT_ENTRY);
- variables.put(PNF_UUID, VALID_UUID);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -99,8 +105,11 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
"AaiEntryExists",
"InformDmaapClient",
"WaitForDmaapPnfReadyNotification",
+ "CreateRelationId",
"AaiEntryUpdated"
);
Assertions.assertThat(aaiConnection.getCreated()).containsOnlyKeys(AaiConnectionTestImpl.ID_WITHOUT_ENTRY);
+ Assertions.assertThat(aaiConnection.getServiceAndPnfRelationMap()).
+ containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID,AaiConnectionTestImpl.ID_WITHOUT_ENTRY));
}
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
index 08252f66b8..97fad57e7d 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
<bpmn:process id="CreateVfModuleBB" name="CreateVfModuleBB" isExecutable="true">
<bpmn:startEvent id="CreateVfModuleBB_Start">
<bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing>
@@ -23,13 +23,17 @@
<bpmn:outgoing>SequenceFlow_1s4rpyp</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_16g4dz0" sourceRef="CreateVfModule" targetRef="VnfAdapter" />
- <bpmn:sequenceFlow id="SequenceFlow_0ecr393" sourceRef="VnfAdapter" targetRef="UpdateVfModuleHeatStackId" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ecr393" sourceRef="VnfAdapter" targetRef="CreateNetworkPolicies" />
<bpmn:callActivity id="VnfAdapter" name="Vnf Adapter" calledElement="VnfAdapter">
<bpmn:extensionElements>
<camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="VNFREST_Request" target="VNFREST_Request" />
<camunda:out source="heatStackId" target="heatStackId" />
+ <camunda:out source="contrailServiceInstanceFqdn" target="contrailServiceInstanceFqdn" />
+ <camunda:out source="oamManagementV4Address" target="oamManagementV4Address" />
+ <camunda:out source="oamManagementV6Address" target="oamManagementV6Address" />
+ <camunda:out source="contrailNetworkPolicyFqdnList" target="contrailNetworkPolicyFqdnList" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_16g4dz0</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ecr393</bpmn:outgoing>
@@ -39,7 +43,7 @@
<bpmn:outgoing>SequenceFlow_1vbwdaw</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="UpdateVfModuleHeatStackId" name="&#10;AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_0ecr393</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_15do1tu</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0rds4rj</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:subProcess id="SubProcess_1getwnf" name="Error Handling&#10;&#10;" triggeredByEvent="true">
@@ -55,29 +59,49 @@
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0rds4rj" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleStatus" />
<bpmn:sequenceFlow id="SequenceFlow_1vbwdaw" sourceRef="UpdateVfModuleStatus" targetRef="CreateVfModuleBB_End" />
+ <bpmn:serviceTask id="CreateNetworkPolicies" name="AAI Create (network policies)" camunda:expression="${AAICreateTasks.createNetworkPolicies(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0ecr393</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xqhep5</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0xqhep5" sourceRef="CreateNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" />
+ <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name="AAI Update (VNF) " camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0xqhep5</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1yo6mvv</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1yo6mvv" sourceRef="UpdateVnfIpv4OamAddress" targetRef="UpdateVnfManagementV6Address" />
+ <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1yo6mvv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1i03uy2</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1i03uy2" sourceRef="UpdateVnfManagementV6Address" targetRef="UpdateVfModuleContrailServiceInstanceFqdn" />
+ <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name="AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1i03uy2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_15do1tu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_15do1tu" sourceRef="UpdateVfModuleContrailServiceInstanceFqdn" targetRef="UpdateVfModuleHeatStackId" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateVfModuleBB">
<bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="CreateVfModuleBB_Start">
- <dc:Bounds x="100" y="88" width="36" height="36" />
+ <dc:Bounds x="59" y="88" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="106" y="124" width="24" height="12" />
+ <dc:Bounds x="77" y="124" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="QueryVfModule">
<dc:Bounds x="416" y="66" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl">
- <di:waypoint xsi:type="dc:Point" x="136" y="106" />
+ <di:waypoint xsi:type="dc:Point" x="95" y="106" />
<di:waypoint xsi:type="dc:Point" x="216" y="106" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="131" y="91" width="90" height="0" />
+ <dc:Bounds x="156" y="91" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="CreateVfModuleBB_End">
- <dc:Bounds x="1299" y="88" width="36" height="36" />
+ <dc:Bounds x="1118" y="293" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1272" y="128" width="90" height="12" />
+ <dc:Bounds x="1136" y="333" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1dgenhy_di" bpmnElement="CreateVfModule">
@@ -102,61 +126,107 @@
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_16g4dz0_di" bpmnElement="SequenceFlow_16g4dz0">
<di:waypoint xsi:type="dc:Point" x="712" y="106" />
- <di:waypoint xsi:type="dc:Point" x="777" y="106" />
+ <di:waypoint xsi:type="dc:Point" x="790" y="106" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="700" y="85" width="90" height="12" />
+ <dc:Bounds x="751" y="91" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0ecr393_di" bpmnElement="SequenceFlow_0ecr393">
- <di:waypoint xsi:type="dc:Point" x="877" y="107" />
- <di:waypoint xsi:type="dc:Point" x="931" y="107" />
+ <di:waypoint xsi:type="dc:Point" x="890" y="107" />
+ <di:waypoint xsi:type="dc:Point" x="994" y="107" />
+ <di:waypoint xsi:type="dc:Point" x="994" y="209" />
+ <di:waypoint xsi:type="dc:Point" x="73" y="209" />
+ <di:waypoint xsi:type="dc:Point" x="73" y="306" />
+ <di:waypoint xsi:type="dc:Point" x="142" y="306" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="859" y="92" width="90" height="0" />
+ <dc:Bounds x="534" y="194" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_1i1pfzb_di" bpmnElement="VnfAdapter">
- <dc:Bounds x="777" y="66" width="100" height="80" />
+ <dc:Bounds x="790" y="66" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0fpfn71_di" bpmnElement="UpdateVfModuleStatus">
- <dc:Bounds x="1117" y="66" width="100" height="80" />
+ <dc:Bounds x="942" y="271" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_04k1b85_di" bpmnElement="UpdateVfModuleHeatStackId">
- <dc:Bounds x="931" y="68" width="100" height="80" />
+ <dc:Bounds x="777" y="271" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_1getwnf_di" bpmnElement="SubProcess_1getwnf" isExpanded="true">
- <dc:Bounds x="172" y="276" width="231" height="135" />
+ <dc:Bounds x="136" y="439" width="231" height="135" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_1c8o652_di" bpmnElement="StartEvent_1c8o652">
- <dc:Bounds x="211" y="334" width="36" height="36" />
+ <dc:Bounds x="175" y="497" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="184" y="370" width="0" height="12" />
+ <dc:Bounds x="148" y="533" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1emam1w_di" bpmnElement="EndEvent_1emam1w">
- <dc:Bounds x="348" y="334" width="36" height="36" />
+ <dc:Bounds x="312" y="497" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="321" y="370" width="0" height="12" />
+ <dc:Bounds x="285" y="533" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0gcots6_di" bpmnElement="SequenceFlow_0gcots6">
- <di:waypoint xsi:type="dc:Point" x="247" y="352" />
- <di:waypoint xsi:type="dc:Point" x="348" y="352" />
+ <di:waypoint xsi:type="dc:Point" x="211" y="515" />
+ <di:waypoint xsi:type="dc:Point" x="312" y="515" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="297.5" y="331" width="0" height="12" />
+ <dc:Bounds x="262" y="494" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0rds4rj_di" bpmnElement="SequenceFlow_0rds4rj">
- <di:waypoint xsi:type="dc:Point" x="1031" y="107" />
- <di:waypoint xsi:type="dc:Point" x="1117" y="107" />
+ <di:waypoint xsi:type="dc:Point" x="877" y="311" />
+ <di:waypoint xsi:type="dc:Point" x="942" y="311" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1074" y="85" width="0" height="13" />
+ <dc:Bounds x="910" y="296" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1vbwdaw_di" bpmnElement="SequenceFlow_1vbwdaw">
- <di:waypoint xsi:type="dc:Point" x="1217" y="106" />
- <di:waypoint xsi:type="dc:Point" x="1299" y="106" />
+ <di:waypoint xsi:type="dc:Point" x="1042" y="311" />
+ <di:waypoint xsi:type="dc:Point" x="1083" y="311" />
+ <di:waypoint xsi:type="dc:Point" x="1083" y="311" />
+ <di:waypoint xsi:type="dc:Point" x="1118" y="311" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1098" y="311" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1v8zx4s_di" bpmnElement="CreateNetworkPolicies">
+ <dc:Bounds x="142" y="271" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xqhep5_di" bpmnElement="SequenceFlow_0xqhep5">
+ <di:waypoint xsi:type="dc:Point" x="242" y="311" />
+ <di:waypoint xsi:type="dc:Point" x="295" y="311" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="269" y="296" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_015ayw5_di" bpmnElement="UpdateVnfIpv4OamAddress">
+ <dc:Bounds x="295" y="271" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1yo6mvv_di" bpmnElement="SequenceFlow_1yo6mvv">
+ <di:waypoint xsi:type="dc:Point" x="395" y="311" />
+ <di:waypoint xsi:type="dc:Point" x="464" y="311" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="430" y="296" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0mlfsc9_di" bpmnElement="UpdateVnfManagementV6Address">
+ <dc:Bounds x="464" y="271" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1i03uy2_di" bpmnElement="SequenceFlow_1i03uy2">
+ <di:waypoint xsi:type="dc:Point" x="564" y="311" />
+ <di:waypoint xsi:type="dc:Point" x="612" y="311" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="588" y="296" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0wctnhw_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn">
+ <dc:Bounds x="612" y="271" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15do1tu_di" bpmnElement="SequenceFlow_15do1tu">
+ <di:waypoint xsi:type="dc:Point" x="712" y="311" />
+ <di:waypoint xsi:type="dc:Point" x="777" y="311" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1258" y="84" width="0" height="13" />
+ <dc:Bounds x="745" y="286" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
index 5cf41b655b..804ae70c58 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
@@ -24,11 +24,15 @@
<camunda:in source="deleteVfModuleRequest" target="deleteVfModuleRequest" />
<camunda:in source="VNFREST_Request" target="VNFREST_Request" />
<camunda:out source="heatStackId" target="heatStackId" />
+ <camunda:out source="oamManagementV4Address" target="oamManagementV4Address" />
+ <camunda:out source="oamManagementV6Address" target="oamManagementV6Address" />
+ <camunda:out source="contrailNetworkPolicyFqdnList" target="contrailNetworkPolicyFqdnList" />
+ <camunda:out source="contrailServiceInstanceFqdn" target="contrailServiceInstanceFqdn" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="UpdateVfModuleHeatStackId" />
+ <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="DeleteNetworkPolicies" />
<bpmn:subProcess id="SubProcess_11p7mrh" name="Error Handling&#10;&#10;" triggeredByEvent="true">
<bpmn:startEvent id="StartEvent_1xp6ewt">
<bpmn:outgoing>SequenceFlow_0h607z0</bpmn:outgoing>
@@ -41,11 +45,31 @@
<bpmn:sequenceFlow id="SequenceFlow_0h607z0" sourceRef="StartEvent_1xp6ewt" targetRef="EndEvent_0guhjau" />
</bpmn:subProcess>
<bpmn:serviceTask id="UpdateVfModuleHeatStackId" name="&#10;AAI&#10;Update&#10; (vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0yuz21z</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_01vfwtp</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_01vfwtp" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleDeleteStatus" />
<bpmn:sequenceFlow id="SequenceFlow_09l7pcg" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" />
+ <bpmn:sequenceFlow id="SequenceFlow_0xyu3pk" sourceRef="DeleteNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" />
+ <bpmn:serviceTask id="DeleteNetworkPolicies" name="AAI Delete (network policies)" camunda:expression="${AAIDeleteTasks.deleteNetworkPolicies(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xyu3pk</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0jtem3b</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0khqfnc</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0jtem3b" sourceRef="UpdateVnfIpv4OamAddress" targetRef="UpdateVnfManagementV6Address" />
+ <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0xyu3pk</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0jtem3b</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0khqfnc" sourceRef="UpdateVnfManagementV6Address" targetRef="UpdateVfModuleContrailServiceInstanceFqdn" />
+ <bpmn:sequenceFlow id="SequenceFlow_0yuz21z" sourceRef="UpdateVfModuleContrailServiceInstanceFqdn" targetRef="UpdateVfModuleHeatStackId" />
+ <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name="AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0khqfnc</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0yuz21z</bpmn:outgoing>
+ </bpmn:serviceTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB">
@@ -66,7 +90,7 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus">
- <dc:Bounds x="762" y="80" width="100" height="80" />
+ <dc:Bounds x="758" y="243" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf">
<di:waypoint xsi:type="dc:Point" x="361" y="120" />
@@ -76,9 +100,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End">
- <dc:Bounds x="922" y="102" width="36" height="36" />
+ <dc:Bounds x="918" y="265" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="940" y="142" width="0" height="0" />
+ <dc:Bounds x="936" y="305" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter">
@@ -86,50 +110,94 @@
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_02lpx87_di" bpmnElement="SequenceFlow_02lpx87">
<di:waypoint xsi:type="dc:Point" x="527" y="120" />
- <di:waypoint xsi:type="dc:Point" x="604" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="591" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="566" y="105" width="0" height="0" />
+ <dc:Bounds x="559" y="105" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true">
- <dc:Bounds x="261" y="276" width="231" height="135" />
+ <dc:Bounds x="295" y="412" width="231" height="135" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_1xp6ewt_di" bpmnElement="StartEvent_1xp6ewt">
- <dc:Bounds x="304" y="338" width="36" height="36" />
+ <dc:Bounds x="338" y="474" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="277" y="374" width="0" height="12" />
+ <dc:Bounds x="311" y="510" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0guhjau_di" bpmnElement="EndEvent_0guhjau">
- <dc:Bounds x="433" y="338" width="36" height="36" />
+ <dc:Bounds x="467" y="474" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="406" y="374" width="0" height="12" />
+ <dc:Bounds x="440" y="510" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0h607z0_di" bpmnElement="SequenceFlow_0h607z0">
- <di:waypoint xsi:type="dc:Point" x="340" y="356" />
- <di:waypoint xsi:type="dc:Point" x="433" y="356" />
+ <di:waypoint xsi:type="dc:Point" x="374" y="492" />
+ <di:waypoint xsi:type="dc:Point" x="467" y="492" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="386.5" y="335" width="0" height="12" />
+ <dc:Bounds x="421" y="471" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId">
- <dc:Bounds x="604" y="80" width="100" height="80" />
+ <dc:Bounds x="591" y="243" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp">
- <di:waypoint xsi:type="dc:Point" x="704" y="120" />
- <di:waypoint xsi:type="dc:Point" x="762" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="691" y="283" />
+ <di:waypoint xsi:type="dc:Point" x="758" y="283" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="733" y="95" width="0" height="0" />
+ <dc:Bounds x="725" y="268" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg">
- <di:waypoint xsi:type="dc:Point" x="862" y="120" />
- <di:waypoint xsi:type="dc:Point" x="922" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="858" y="283" />
+ <di:waypoint xsi:type="dc:Point" x="918" y="283" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="888" y="258" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xyu3pk_di" bpmnElement="SequenceFlow_0xyu3pk">
+ <di:waypoint xsi:type="dc:Point" x="691" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="751" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="721" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0tty0ac_di" bpmnElement="DeleteNetworkPolicies">
+ <dc:Bounds x="591" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0lrrd16_di" bpmnElement="UpdateVnfManagementV6Address">
+ <dc:Bounds x="261" y="243" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0jtem3b_di" bpmnElement="SequenceFlow_0jtem3b">
+ <di:waypoint xsi:type="dc:Point" x="851" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="941" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="941" y="205" />
+ <di:waypoint xsi:type="dc:Point" x="182" y="205" />
+ <di:waypoint xsi:type="dc:Point" x="182" y="283" />
+ <di:waypoint xsi:type="dc:Point" x="261" y="283" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="892" y="95" width="0" height="0" />
+ <dc:Bounds x="562" y="190" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0w9805b_di" bpmnElement="UpdateVnfIpv4OamAddress">
+ <dc:Bounds x="751" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0khqfnc_di" bpmnElement="SequenceFlow_0khqfnc">
+ <di:waypoint xsi:type="dc:Point" x="361" y="283" />
+ <di:waypoint xsi:type="dc:Point" x="427" y="283" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="394" y="268" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0yuz21z_di" bpmnElement="SequenceFlow_0yuz21z">
+ <di:waypoint xsi:type="dc:Point" x="527" y="283" />
+ <di:waypoint xsi:type="dc:Point" x="591" y="283" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="559" y="268" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0v8naz9_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn">
+ <dc:Bounds x="427" y="243" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
index 943ce12a8a..5189f8b48a 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2">
<bpmn:process id="ExecuteBuildingBlock" name="ExecuteBuildingBlock" isExecutable="true">
<bpmn:startEvent id="Start_ExecuteBuildingBlock" name="start">
<bpmn:outgoing>SequenceFlow_0rq4c5r</bpmn:outgoing>
@@ -73,7 +73,7 @@
<bpmn:sequenceFlow id="SequenceFlow_0ndt8ft" sourceRef="Task_SetRetryTimer" targetRef="IntermediateCatchEvent_RetryTimer" />
<bpmn:sequenceFlow id="SequenceFlow_07a1ytc" sourceRef="IntermediateCatchEvent_RetryTimer" targetRef="EndEvent_1sez2lh" />
<bpmn:sequenceFlow id="SequenceFlow_1wbevp0" name="yes" sourceRef="ExclusiveGateway_0ey4zpt" targetRef="Task_SetRetryTimer">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("retryCount")<5}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("retryCount")<execution.getVariable("maxRetries")}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="EndEvent_0mvmk3i">
<bpmn:incoming>SequenceFlow_0h8v45y</bpmn:incoming>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java
index 0e4bb5a194..8c44309cca 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java
@@ -40,6 +40,10 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{
"QueryVfModule",
"CreateVfModule",
"VnfAdapter",
+ "CreateNetworkPolicies",
+ "UpdateVnfIpv4OamAddress",
+ "UpdateVnfManagementV6Address",
+ "UpdateVfModuleContrailServiceInstanceFqdn",
"UpdateVfModuleHeatStackId",
"UpdateVfModuleStatus",
"CreateVfModuleBB_End");
@@ -53,7 +57,9 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
.hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf")
- .hasNotPassed("QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End");
+ .hasNotPassed("QueryVfModule", "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress",
+ "UpdateVnfManagementV6Address","UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId",
+ "UpdateVfModuleStatus", "CreateVfModuleBB_End");
assertThat(pi).isEnded();
}
@@ -64,7 +70,8 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
.hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule")
- .hasNotPassed("CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End");
+ .hasNotPassed("CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
+ "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End");
assertThat(pi).isEnded();
}
@@ -75,7 +82,8 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
.hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule")
- .hasNotPassed("VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End");
+ .hasNotPassed("VnfAdapter", "CreateNetworkPolicies","UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
+ "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End");
assertThat(pi).isEnded();
}
@@ -87,7 +95,8 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{
ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables);
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
- .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId")
+ .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies",
+ "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId")
.hasNotPassed("UpdateVfModuleStatus", "CreateVfModuleBB_End");
assertThat(pi).isEnded();
@@ -100,7 +109,9 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{
ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables);
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
- .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus")
+ .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies",
+ "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId",
+ "UpdateVfModuleStatus")
.hasNotPassed("CreateVfModuleBB_End");
assertThat(pi).isEnded();
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java
index d9190b5e12..cedffb77d4 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java
@@ -38,6 +38,8 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest{
ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables);
assertThat(pi).isNotNull();
assertThat(pi).isStarted().hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter", "VnfAdapter",
+ "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
+ "UpdateVfModuleContrailServiceInstanceFqdn",
"UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End");
assertThat(pi).isEnded();
}
@@ -49,7 +51,9 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest{
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
.hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter")
- .hasNotPassed("VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End");
+ .hasNotPassed("VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
+ "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus",
+ "DeleteVfModuleBB_End");
assertThat(pi).isEnded();
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
index d57e48781d..1bf2a290cb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
@@ -23,7 +23,11 @@ package org.onap.so.bpmn.infrastructure.pnf.aai;
import java.util.Optional;
import org.onap.aai.domain.yang.Pnf;
import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.AAIRestClientImpl;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.springframework.stereotype.Component;
@Component
@@ -40,4 +44,12 @@ public class AaiConnectionImpl implements AaiConnection {
AAIRestClientImpl restClient = new AAIRestClientImpl();
restClient.createPnf(correlationId, entry);
}
+
+ @Override
+ public void createRelation(String serviceInstanceId, String pnfName) {
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstanceId);
+ AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfName);
+ new AAIResourcesClient().connect(serviceInstanceURI, pnfUri);
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
new file mode 100644
index 0000000000..21d43964f8
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.so.bpmn.common.scripts.ExceptionUtil;
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CreateRelation implements JavaDelegate {
+
+ private static final Logger logger = LoggerFactory.getLogger(CreateRelation.class);
+
+ private AaiConnection aaiConnectionImpl;
+
+ @Autowired
+ public CreateRelation(AaiConnection aaiConnectionImpl) {
+ this.aaiConnectionImpl = aaiConnectionImpl;
+ }
+
+ @Override
+ public void execute(DelegateExecution delegateExecution) {
+ String serviceInstanceId = (String) delegateExecution.getVariable("serviceInstanceId");
+ String pnfName = (String) delegateExecution.getVariable("correlationId");
+ try {
+ aaiConnectionImpl.createRelation(serviceInstanceId, pnfName);
+ } catch (Exception e) {
+ new ExceptionUtil().buildAndThrowWorkflowException(delegateExecution, 9999,
+ "An exception occurred when making service and pnf relation. Exception: " + e.getMessage());
+ }
+ logger.debug("The relation has been made between service with id: {} and pnf with name: {}",
+ serviceInstanceId, pnfName);
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java
index 5165912653..eaabb2bfbb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java
@@ -29,4 +29,6 @@ public interface AaiConnection {
Optional<Pnf> getEntryFor(String correlationId) throws IOException;
void createEntry(String correlationId, Pnf entry) throws IOException;
+
+ void createRelation(String serviceInstanceId, String pnfName) throws IOException;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
index 201e791a24..76b62a9cea 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
@@ -37,7 +37,7 @@ public class AaiConnectionTestImpl implements AaiConnection {
private Map<String, Pnf> created = new HashMap<>();
@Override
- public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ public Optional<Pnf> getEntryFor(String correlationId) {
if (Objects.equals(correlationId, ID_WITH_ENTRY)) {
return Optional.of(new Pnf());
} else {
@@ -50,6 +50,10 @@ public class AaiConnectionTestImpl implements AaiConnection {
created.put(correlationId, entry);
}
+ @Override
+ public void createRelation(String serviceInstanceId, String pnfName) {
+ }
+
public Map<String, Pnf> getCreated() {
return created;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
index 7df6757817..300d1e4c9b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
@@ -36,4 +36,10 @@ public class AaiConnectionThrowingException implements AaiConnection {
public void createEntry(String correlationId, Pnf entry) throws IOException {
throw new IOException();
}
+
+ @Override
+ public void createRelation(String serviceInstanceId, String pnfName) throws IOException {
+ throw new IOException();
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
new file mode 100644
index 0000000000..2dd3e23828
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import java.io.IOException;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.infrastructure.pnf.aai.AaiConnectionImpl;
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+
+public class CreateRelationTest {
+
+ private static final String SERVICE_INSTANCE_ID = "serviceTest";
+ private static final String PNF_NAME = "pnfNameTest";
+
+ private DelegateExecutionFake executionFake;
+
+ @Before
+ public void setUp() {
+ executionFake = new DelegateExecutionFake();
+ executionFake.setVariable("serviceInstanceId", SERVICE_INSTANCE_ID);
+ executionFake.setVariable("correlationId", PNF_NAME);
+ }
+
+ @Test
+ public void createRelationSuccessful() throws IOException {
+ // given
+ AaiConnection aaiConnectionMock = mock(AaiConnectionImpl.class);
+ CreateRelation testedObject = new CreateRelation(aaiConnectionMock);
+ // when
+ testedObject.execute(executionFake);
+ // then
+ verify(aaiConnectionMock).createRelation(SERVICE_INSTANCE_ID, PNF_NAME);
+ }
+
+ @Test
+ public void shouldThrowBpmnErrorWhenExceptionOccurred() {
+ CreateRelation testedObject = new CreateRelation(new AaiConnectionThrowingException());
+ executionFake.setVariable("testProcessKey", "testProcessKeyValue");
+
+ assertThatThrownBy(() -> testedObject.execute(executionFake)).isInstanceOf(BpmnError.class);
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
index d8079174c1..5defe2121b 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3">
<bpmn:collaboration id="Collaboration_1d0w8lf">
<bpmn:participant id="Participant_1egg397" name="SO&#10;Create and Activate Pnf Resource" processRef="CreateAndActivatePnfResource" />
<bpmn:participant id="Participant_0atuyq0" name="AAI" />
@@ -17,7 +17,7 @@
<bpmn:sequenceFlow id="SequenceFlow_0v5ffpe" name="No" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="CreatePnfEntryInAai">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="AaiEntryUpdated" />
+ <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="CreateRelationId" />
<bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="InformDmaapClient" />
<bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreatePnfEntryInAai" targetRef="AaiEntryExists" />
<bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" />
@@ -59,9 +59,6 @@
<bpmn:incoming>SequenceFlow_1miyzfe</bpmn:incoming>
<bpmn:errorEventDefinition errorRef="Error_1" />
</bpmn:endEvent>
- <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated">
- <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming>
- </bpmn:endEvent>
<bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo">
<bpmn:incoming>SequenceFlow_1o8od8e</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0p09qgm</bpmn:outgoing>
@@ -77,13 +74,20 @@
<bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing>
</bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0o6zhjk" sourceRef="CreateRelationId" targetRef="AaiEntryUpdated" />
+ <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated">
+ <bpmn:incoming>SequenceFlow_0o6zhjk</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="CreateRelationId" name="Create Relation" camunda:delegateExpression="${CreateRelation}">
+ <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0o6zhjk</bpmn:outgoing>
+ </bpmn:serviceTask>
<bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" />
<bpmn:textAnnotation id="TextAnnotation_1eyzes8">
- <bpmn:text>Inputs:
+ <bpmn:text><![CDATA[Inputs:
 - timeoutForPnfEntryNotification - String
- correlationId - String
- - uuid - String
-</bpmn:text>
+ - uuid - String]]></bpmn:text>
</bpmn:textAnnotation>
</bpmn:process>
<bpmn:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
@@ -100,9 +104,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0k52gr7_di" bpmnElement="AaiEntryUpdated">
- <dc:Bounds x="1312" y="189" width="36" height="36" />
+ <dc:Bounds x="1364" y="189" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1287" y="230" width="88" height="14" />
+ <dc:Bounds x="1339" y="230" width="89" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0j5ok9h_di" bpmnElement="CreateAndActivatePnf_StartEvent">
@@ -118,38 +122,38 @@
<dc:Bounds x="511" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1j4r3zt_di" bpmnElement="SequenceFlow_1j4r3zt">
- <di:waypoint x="319" y="207" />
- <di:waypoint x="390" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="319" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="390" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="309.5" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1l1t6ak_di" bpmnElement="SequenceFlow_1l1t6ak">
- <di:waypoint x="415" y="182" />
- <di:waypoint x="415" y="66" />
- <di:waypoint x="711" y="66" />
- <di:waypoint x="711" y="182" />
+ <di:waypoint xsi:type="dc:Point" x="415" y="182" />
+ <di:waypoint xsi:type="dc:Point" x="415" y="66" />
+ <di:waypoint xsi:type="dc:Point" x="711" y="66" />
+ <di:waypoint xsi:type="dc:Point" x="711" y="182" />
<bpmndi:BPMNLabel>
<dc:Bounds x="430" y="159" width="19" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0v5ffpe_di" bpmnElement="SequenceFlow_0v5ffpe">
- <di:waypoint x="440" y="207" />
- <di:waypoint x="511" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="440" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="511" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="448" y="210" width="14" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1qr6cmf_di" bpmnElement="SequenceFlow_1qr6cmf">
- <di:waypoint x="611" y="207" />
- <di:waypoint x="686" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="611" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="686" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="605" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0j5ksz1_di" bpmnElement="SequenceFlow_0j5ksz1">
- <di:waypoint x="-18" y="207" />
- <di:waypoint x="48" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="-18" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="48" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-30" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -158,22 +162,22 @@
<dc:Bounds x="123" y="523" width="502" height="60" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="MessageFlow_1h3xu88_di" bpmnElement="MessageFlow_1h3xu88">
- <di:waypoint x="561" y="247" />
- <di:waypoint x="561" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="247" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="531" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_09ibv5a_di" bpmnElement="MessageFlow_09ibv5a">
- <di:waypoint x="250" y="247" />
- <di:waypoint x="250" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="250" y="247" />
+ <di:waypoint xsi:type="dc:Point" x="250" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="220" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_0vjul4t_di" bpmnElement="MessageFlow_0vjul4t">
- <di:waypoint x="289" y="523" />
- <di:waypoint x="289" y="247" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="247" />
<bpmndi:BPMNLabel>
<dc:Bounds x="259" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -191,19 +195,19 @@
<dc:Bounds x="-37" y="70" width="243" height="82" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Association_0d7oxnz_di" bpmnElement="Association_0d7oxnz">
- <di:waypoint x="-36" y="189" />
- <di:waypoint x="-36" y="152" />
+ <di:waypoint xsi:type="dc:Point" x="-36" y="189" />
+ <di:waypoint xsi:type="dc:Point" x="-36" y="152" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d">
- <di:waypoint x="1060" y="523" />
- <di:waypoint x="1060" y="247" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="247" />
<bpmndi:BPMNLabel>
<dc:Bounds x="996" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_17s9025_di" bpmnElement="SequenceFlow_17s9025">
- <di:waypoint x="736" y="207" />
- <di:waypoint x="803" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="736" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="803" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="719" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -215,9 +219,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1kc34bc_di" bpmnElement="SequenceFlow_1kc34bc">
- <di:waypoint x="1092" y="265" />
- <di:waypoint x="1092" y="363" />
- <di:waypoint x="1145" y="363" />
+ <di:waypoint xsi:type="dc:Point" x="1092" y="265" />
+ <di:waypoint xsi:type="dc:Point" x="1092" y="363" />
+ <di:waypoint xsi:type="dc:Point" x="1145" y="363" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1028" y="309" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -226,22 +230,22 @@
<dc:Bounds x="1008" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0p09qgm_di" bpmnElement="SequenceFlow_0p09qgm">
- <di:waypoint x="1108" y="207" />
- <di:waypoint x="1312" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="1108" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="1195" y="207" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1148" y="187" width="90" height="10" />
+ <dc:Bounds x="1106.5" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1o8od8e_di" bpmnElement="SequenceFlow_1o8od8e">
- <di:waypoint x="903" y="207" />
- <di:waypoint x="1008" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="903" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="1008" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="893.5" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_0tg4hw9_di" bpmnElement="MessageFlow_0tg4hw9">
- <di:waypoint x="853" y="247" />
- <di:waypoint x="853" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="853" y="247" />
+ <di:waypoint xsi:type="dc:Point" x="853" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="823" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -250,15 +254,15 @@
<dc:Bounds x="803" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1miyzfe_di" bpmnElement="SequenceFlow_1miyzfe">
- <di:waypoint x="1245" y="363" />
- <di:waypoint x="1312" y="363" />
+ <di:waypoint xsi:type="dc:Point" x="1245" y="363" />
+ <di:waypoint xsi:type="dc:Point" x="1312" y="363" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1233.5" y="343" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_1py54jr_di" bpmnElement="MessageFlow_1py54jr">
- <di:waypoint x="1195" y="403" />
- <di:waypoint x="1195" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="1195" y="403" />
+ <di:waypoint xsi:type="dc:Point" x="1195" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1165" y="458" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -267,8 +271,8 @@
<dc:Bounds x="1145" y="323" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0967g8p_di" bpmnElement="SequenceFlow_0967g8p">
- <di:waypoint x="148" y="207" />
- <di:waypoint x="219" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="148" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="219" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="183.5" y="187" width="0" height="10" />
</bpmndi:BPMNLabel>
@@ -282,6 +286,16 @@
<dc:Bounds x="672" y="242" width="77" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0o6zhjk_di" bpmnElement="SequenceFlow_0o6zhjk">
+ <di:waypoint xsi:type="dc:Point" x="1295" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="1364" y="207" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1329.5" y="186" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0xn3ug6_di" bpmnElement="CreateRelationId">
+ <dc:Bounds x="1195" y="167" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index e83c27c400..cb893ce950 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -403,10 +403,8 @@ public class SniroHomingV2 {
List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
for(Candidate c:required){
org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType();
- type.setName(c.getCandidateType().getName());
- can.setCandidateType(type);
- can.setCandidates(c.getCandidates());
+ can.setIdentifierType(c.getIdentifierType());
+ can.setIdentifiers(c.getIdentifiers());
can.setCloudOwner(c.getCloudOwner());
cans.add(can);
}
@@ -416,10 +414,8 @@ public class SniroHomingV2 {
List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
for(Candidate c:excluded){
org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType();
- type.setName(c.getCandidateType().getName());
- can.setCandidateType(type);
- can.setCandidates(c.getCandidates());
+ can.setIdentifierType(c.getIdentifierType());
+ can.setIdentifiers(c.getIdentifiers());
can.setCloudOwner(c.getCloudOwner());
cans.add(can);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index 4a3cb01b74..f47781082d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -22,11 +22,13 @@ package org.onap.so.bpmn.infrastructure.aai.tasks;
import java.util.Arrays;
import java.util.List;
+import java.util.Optional;
+import java.util.TreeSet;
+import java.util.UUID;
import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -35,6 +37,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
@@ -44,6 +47,9 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
@@ -53,9 +59,10 @@ import org.onap.so.client.orchestration.AAIVfModuleResources;
import org.onap.so.client.orchestration.AAIVnfResources;
import org.onap.so.client.orchestration.AAIVolumeGroupResources;
import org.onap.so.client.orchestration.AAIVpnBindingResources;
-import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -64,8 +71,13 @@ import org.springframework.stereotype.Component;
public class AAICreateTasks {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAICreateTasks.class);
+ private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class.getName());
+
private static final String networkTypeProvider = "PROVIDER";
private static String NETWORK_COLLECTION_NAME = "networkCollectionName";
+ private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
+ private static String HEAT_STACK_ID = "heatStackId";
+ private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
@Autowired
private AAIServiceInstanceResources aaiSIResources;
@Autowired
@@ -233,6 +245,11 @@ public class AAICreateTasks {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ int moduleIndex = 0;
+ if (vfModule.getModelInfoVfModule() != null && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) {
+ moduleIndex = this.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, vfModule);
+ }
+ vfModule.setModuleIndex(moduleIndex);
aaiVfModuleResources.createVfModule(vfModule, vnf);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -432,4 +449,95 @@ public class AAICreateTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
+ public void createNetworkPolicies(BuildingBlockExecution execution) {
+ try{
+ String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
+ if (fqdns != null && !fqdns.isEmpty()) {
+ String fqdnList[] = fqdns.split(",");
+ int fqdnCount = fqdnList.length;
+ if (fqdnCount > 0) {
+ for (int i=0; i < fqdnCount; i++) {
+ String fqdn = fqdnList[i];
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
+ Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri);
+ if(!oNetPolicy.isPresent()) {
+ msoLogger.debug("This network policy FQDN is not in AAI yet: " + fqdn);
+ String networkPolicyId = UUID.randomUUID().toString();
+ msoLogger.debug("Adding network-policy with network-policy-id " + networkPolicyId);
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ networkPolicy.setNetworkPolicyId(networkPolicyId);
+ networkPolicy.setNetworkPolicyFqdn(fqdn);
+ networkPolicy.setHeatStackId(execution.getVariable(HEAT_STACK_ID));
+
+ aaiNetworkResources.createNetworkPolicy(networkPolicy);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Groups existing vf modules by the model uuid of our new vf module and returns the lowest unused index
+ *
+ * if we have a module type A, and there are 3 instances of those,
+ * and then module type B has 2 instances, if we are adding a new module type A,
+ * the vf-module-index should be 3 assuming contiguous indices (not 5, or 2)
+ *
+ */
+ protected int getLowestUnusedVfModuleIndexFromAAIVnfResponse(GenericVnf genericVnf, VfModule newVfModule) {
+
+ String newVfModuleModelInvariantUUID = null;
+ if (newVfModule.getModelInfoVfModule() != null) {
+ newVfModuleModelInvariantUUID = newVfModule.getModelInfoVfModule().getModelInvariantUUID();
+ }
+
+
+ if (genericVnf != null && genericVnf.getVfModules() != null && !genericVnf.getVfModules().isEmpty()) {
+ List<VfModule> modules = genericVnf.getVfModules().stream().filter(item -> !item.getVfModuleId().equals(newVfModule.getVfModuleId())).collect(Collectors.toList());
+ TreeSet<Integer> moduleIndices = new TreeSet<>();
+ int nullIndexFound = 0;
+ for (VfModule vfModule : modules) {
+ if (vfModule.getModelInfoVfModule() != null) {
+ if (vfModule.getModelInfoVfModule().getModelInvariantUUID().equals(newVfModuleModelInvariantUUID)) {
+ if (vfModule.getModuleIndex() != null) {
+ moduleIndices.add(vfModule.getModuleIndex());
+ } else {
+ nullIndexFound++;
+ logger.warn("Found null index for vf-module-id {} and model-invariant-uuid {}", vfModule.getVfModuleId(), vfModule.getModelInfoVfModule().getModelInvariantUUID());
+ }
+ }
+ }
+ }
+
+ return calculateUnusedIndex(moduleIndices, nullIndexFound);
+ } else {
+ return 0;
+ }
+ }
+
+ protected int calculateUnusedIndex(TreeSet<Integer> moduleIndices, int nullIndexFound) {
+ //pad array with nulls
+ Integer[] temp = new Integer[moduleIndices.size() + nullIndexFound];
+ Integer[] array = moduleIndices.toArray(temp);
+ int result = 0;
+ //when a null is found skip that potential value
+ //effectively creates something like, [0,1,3,null,null] -> [0,1,null(2),3,null(4)]
+ for (int i=0; i < array.length; i++, result++) {
+ if (Integer.valueOf(result) != array[i]) {
+ if (nullIndexFound > 0) {
+ nullIndexFound--;
+ i--;
+ } else {
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
index a00806a19c..8f0334e462 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
@@ -21,16 +21,23 @@
package org.onap.so.bpmn.infrastructure.aai.tasks;
+import java.util.Optional;
+import java.util.UUID;
+
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAINetworkResources;
@@ -38,11 +45,16 @@ import org.onap.so.client.orchestration.AAIServiceInstanceResources;
import org.onap.so.client.orchestration.AAIVfModuleResources;
import org.onap.so.client.orchestration.AAIVnfResources;
import org.onap.so.client.orchestration.AAIVolumeGroupResources;
+import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class AAIDeleteTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIDeleteTasks.class);
+
+ private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
+ private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
@Autowired
private ExceptionBuilder exceptionUtil;
@@ -145,4 +157,30 @@ public class AAIDeleteTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
+ public void deleteNetworkPolicies(BuildingBlockExecution execution) {
+ try{
+ String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
+ if (fqdns != null && !fqdns.isEmpty()) {
+ String fqdnList[] = fqdns.split(",");
+ int fqdnCount = fqdnList.length;
+ if (fqdnCount > 0) {
+ for (int i=0; i < fqdnCount; i++) {
+ String fqdn = fqdnList[i];
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
+ Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri);
+ if(oNetPolicy.isPresent()) {
+ String networkPolicyId = oNetPolicy.get().getNetworkPolicyId();
+ msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId);
+
+ aaiNetworkResources.deleteNetworkPolicy(networkPolicyId);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index ed6379a6a4..5176bee0d6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -449,4 +449,53 @@ public class AAIUpdateTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
+ public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) {
+ try {
+ String ipv4OamAddress = execution.getVariable("oamManagementV4Address");
+ if (ipv4OamAddress != null) {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+
+ genericVnf.setIpv4OamAddress(ipv4OamAddress);
+ copiedGenericVnf.setIpv4OamAddress(ipv4OamAddress);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ }
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateManagementV6AddressVnf(BuildingBlockExecution execution) {
+ try {
+ String managementV6Address = execution.getVariable("oamManagementV6Address");
+ if (managementV6Address != null) {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+
+ genericVnf.setManagementV6Address(managementV6Address);
+ copiedGenericVnf.setManagementV6Address(managementV6Address);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ }
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) {
+ try {
+ String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn");
+ if (contrailServiceInstanceFqdn != null) {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
+ aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index d919c53c9c..fec7e8456f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
import java.io.StringReader;
@@ -15,6 +35,9 @@ import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkError;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkError;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.NetworkAdapterResources;
import org.slf4j.Logger;
@@ -95,6 +118,14 @@ public class NetworkAdapterRestV1 {
DeleteNetworkResponse deleteNetworkResponse = (DeleteNetworkResponse) unmarshalXml(callback, DeleteNetworkResponse.class);
execution.setVariable("deleteNetworkResponse", deleteNetworkResponse);
}
+ } else if (networkAdapterRequest instanceof UpdateNetworkRequest) {
+ if (callback.contains("updateNetworkError")) {
+ UpdateNetworkError updateNetworkError = (UpdateNetworkError) unmarshalXml(callback, UpdateNetworkError.class);
+ throw new Exception(updateNetworkError.getMessage());
+ } else {
+ UpdateNetworkResponse updateNetworkResponse = (UpdateNetworkResponse) unmarshalXml(callback, UpdateNetworkResponse.class);
+ execution.setVariable("updateNetworkResponse", updateNetworkResponse);
+ }
}
}
} catch (Exception e) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
index f1a9e955b6..0851dc9d95 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -26,6 +26,7 @@ import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
@@ -47,10 +48,18 @@ import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXSource;
import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
@Component
public class VnfAdapterImpl {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateTasks.class);
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterImpl.class);
+ private static final String CONTRAIL_SERVICE_INSTANCE_FQDN = "contrailServiceInstanceFqdn";
+ private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address";
+ private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address";
+ private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
@Autowired
private ExtractPojosForBB extractPojosForBB;
@@ -65,6 +74,10 @@ public class VnfAdapterImpl {
execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
execution.setVariable("heatStackId", null);
+ execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null);
+ execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null);
+ execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null);
+ execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST, null);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -79,15 +92,36 @@ public class VnfAdapterImpl {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId();
if(!StringUtils.isEmpty(heatStackId)) {
- vfModule.setHeatStackId(heatStackId);
+ vfModule.setHeatStackId(heatStackId);
execution.setVariable("heatStackId", heatStackId);
}
+ Map<String,String> vfModuleOutputs = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
+ if (vfModuleOutputs != null) {
+ processVfModuleOutputs(execution, vfModuleOutputs);
+ }
} else if(vnfRestResponse instanceof DeleteVfModuleResponse) {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted();
if(null!= vfModuleDelete && vfModuleDelete) {
vfModule.setHeatStackId(null);
execution.setVariable("heatStackId", null);
+ Map<String,String> vfModuleOutputs = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
+ if (vfModuleOutputs != null) {
+ processVfModuleOutputs(execution, vfModuleOutputs);
+ if (execution.getVariable(OAM_MANAGEMENT_V4_ADDRESS) != null) {
+ genericVnf.setIpv4OamAddress("");
+ execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, "");
+ }
+ if (execution.getVariable(OAM_MANAGEMENT_V6_ADDRESS) != null) {
+ genericVnf.setManagementV6Address("");
+ execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, "");
+ }
+ if (execution.getVariable(CONTRAIL_SERVICE_INSTANCE_FQDN) != null) {
+ vfModule.setContrailServiceInstanceFqdn("");
+ execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, "");
+ }
+ }
}
} else if(vnfRestResponse instanceof CreateVolumeGroupResponse) {
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
@@ -108,7 +142,7 @@ public class VnfAdapterImpl {
}
}
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -133,4 +167,49 @@ public class VnfAdapterImpl {
throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e);
}
}
+
+ private void processVfModuleOutputs(BuildingBlockExecution execution, Map<String,String> vfModuleOutputs) {
+ if (vfModuleOutputs == null) {
+ return;
+ }
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>();
+ Iterator<String> keys = vfModuleOutputs.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ if (key.equals("contrail-service-instance-fqdn")) {
+ String contrailServiceInstanceFqdn = vfModuleOutputs.get(key);
+ msoLogger.debug("Obtained contrailServiceInstanceFqdn: " + contrailServiceInstanceFqdn);
+ vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
+ execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, contrailServiceInstanceFqdn);
+ }
+ else if (key.endsWith("contrail_network_policy_fqdn")) {
+ String contrailNetworkPolicyFqdn = vfModuleOutputs.get(key);
+ msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn);
+ contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn);
+ }
+ else if (key.equals("oam_management_v4_address")) {
+ String oamManagementV4Address = vfModuleOutputs.get(key);
+ msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address);
+ genericVnf.setIpv4OamAddress(oamManagementV4Address);
+ execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, oamManagementV4Address);
+ }
+ else if (key.equals("oam_management_v6_address")) {
+ String oamManagementV6Address = vfModuleOutputs.get(key);
+ msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address);
+ genericVnf.setManagementV6Address(oamManagementV6Address);
+ execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, oamManagementV6Address);
+ }
+
+ if (!contrailNetworkPolicyFqdnList.isEmpty()) {
+ execution.setVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST, String.join(",", contrailNetworkPolicyFqdnList));
+ }
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
index 32c852b0e1..f2fb37e182 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import org.onap.so.bpmn.common.BuildingBlockExecution;
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 0c0e1464b2..99bda80e4f 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -48,7 +50,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
-import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
@@ -58,16 +59,16 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
-import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.Networks;
+import org.onap.so.serviceinstancebeans.RelatedInstance;
+import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@@ -198,7 +199,7 @@ public class WorkflowAction {
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
}
- orchFlows = filterOrchFlows(orchFlows, resourceType, execution);
+ orchFlows = filterOrchFlows(sIRequest, orchFlows, resourceType, execution);
String key = "";
ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
if(modelInfo.getModelType().equals(ModelType.service)) {
@@ -437,8 +438,7 @@ public class WorkflowAction {
CollectionResourceCustomization networkCollection = null;
int count = 0;
for(CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()){
- if(catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCust.getModelCustomizationUUID())
- instanceof NetworkCollectionResourceCustomization) {
+ if(catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCust.getModelCustomizationUUID()) != null) {
networkCollection = collectionCust;
count++;
}
@@ -1103,10 +1103,22 @@ public class WorkflowAction {
return listToExecute;
}
- protected List<OrchestrationFlow> filterOrchFlows(List<OrchestrationFlow> orchFlows, WorkflowType resourceType, DelegateExecution execution) {
+ protected List<OrchestrationFlow> filterOrchFlows(ServiceInstancesRequest sIRequest, List<OrchestrationFlow> orchFlows, WorkflowType resourceType, DelegateExecution execution) {
List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
+ String vnfCustomizationUUID = "";
+ String vfModuleCustomizationUUID = sIRequest.getRequestDetails().getModelInfo().getModelCustomizationUuid();
+ RelatedInstanceList[] relatedInstanceList = sIRequest.getRequestDetails().getRelatedInstanceList();
+ if (relatedInstanceList != null) {
+ for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
+ if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
+ vnfCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid();
+ }
+ }
+ }
+
if (resourceType.equals(WorkflowType.VFMODULE)) {
- List<String> fabricCustomizations = traverseCatalogDbForConfiguration((String)execution.getVariable("vnfId"), (String)execution.getVariable("vfModuleId"));
+ List<String> fabricCustomizations = traverseCatalogDbForConfiguration(vnfCustomizationUUID, vfModuleCustomizationUUID);
if (fabricCustomizations.isEmpty()) {
result = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 78a84b1772..f6c9597de8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -41,6 +41,7 @@ import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -54,6 +55,7 @@ public class WorkflowActionBBTasks {
private static final String G_ALACARTE = "aLaCarte";
private static final String G_ACTION = "requestAction";
private static final String RETRY_COUNT = "retryCount";
+ protected String maxRetries = "mso.rainyDay.maxRetries";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
@Autowired
@@ -62,6 +64,8 @@ public class WorkflowActionBBTasks {
private WorkflowAction workflowAction;
@Autowired
private WorkflowActionBBFailure workflowActionBBFailure;
+ @Autowired
+ private Environment environment;
public void selectBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
@@ -215,17 +219,24 @@ public class WorkflowActionBBTasks {
String requestId = (String) execution.getVariable(G_REQUEST_ID);
String retryDuration = (String) execution.getVariable("RetryDuration");
int retryCount = (int) execution.getVariable(RETRY_COUNT);
+ int envMaxRetries;
+ try{
+ envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
+ } catch (Exception ex) {
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ envMaxRetries = 5;
+ }
int nextCount = retryCount +1;
if (handlingCode.equals("Retry")){
workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
try{
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- request.setRetryStatusMessage("Retry " + nextCount + "/5 will be started in " + retryDuration);
+ request.setRetryStatusMessage("Retry " + nextCount + "/" + envMaxRetries + " will be started in " + retryDuration);
requestDbclient.updateInfraActiveRequests(request);
} catch(Exception ex){
logger.warn("Failed to update Request Db Infra Active Requests with Retry Status",ex);
}
- if(retryCount<5){
+ if(retryCount<envMaxRetries){
int currSequence = (int) execution.getVariable("gCurrentSequence");
execution.setVariable("gCurrentSequence", currSequence-1);
execution.setVariable(RETRY_COUNT, nextCount);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index c895566ca5..c8eeaa7a2b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -302,4 +302,8 @@ public class AAIObjectMapper {
public org.onap.aai.domain.yang.Subnet mapSubnet (Subnet subnet){
return modelMapper.map(subnet,org.onap.aai.domain.yang.Subnet.class);
}
+
+ public org.onap.aai.domain.yang.NetworkPolicy mapNetworkPolicy (NetworkPolicy networkPolicy){
+ return modelMapper.map(networkPolicy,org.onap.aai.domain.yang.NetworkPolicy.class);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
index d2bf95a28e..4ca3f2a78d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
@@ -45,6 +45,7 @@ import org.springframework.stereotype.Component;
@Component
public class AAINetworkResources {
+
@Autowired
private InjectionHelper injectionHelper;
@@ -171,6 +172,16 @@ public class AAINetworkResources {
AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
injectionHelper.getAaiClient().delete(instanceGroupURI);
}
-
-
+
+ public void createNetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy networkPolicy) {
+ NetworkPolicy aaiNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy);
+ String networkPolicyId = networkPolicy.getNetworkPolicyId();
+ AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
+ injectionHelper.getAaiClient().create(netUri, aaiNetworkPolicy);
+ }
+
+ public void deleteNetworkPolicy(String networkPolicyId) {
+ AAIResourceUri networkPolicyURI = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
+ injectionHelper.getAaiClient().delete(networkPolicyURI);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
index a641d43ba3..ef61319eee 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
@@ -76,6 +76,15 @@ public class AAIVfModuleResources {
injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
}
+ public void updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) {
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ VfModule copiedVfModule = vfModule.shallowCopyId();
+
+ copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn());
+ org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
+ injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
+ }
+
public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) {
AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
index b42636b078..3b7e509752 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
@@ -23,34 +23,36 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.List;
+import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType;
+
import com.fasterxml.jackson.annotation.JsonProperty;
public class Candidate implements Serializable{
private static final long serialVersionUID = -5474502255533410907L;
- @JsonProperty("candidateType")
- private CandidateType candidateType;
- @JsonProperty("candidates")
- private List<String> candidates;
+ @JsonProperty("identifierType")
+ private CandidateType identifierType;
+ @JsonProperty("identifiers")
+ private List<String> identifiers;
@JsonProperty("cloudOwner")
private String cloudOwner;
- public CandidateType getCandidateType(){
- return candidateType;
+ public CandidateType getIdentifierType(){
+ return identifierType;
}
- public void setCandidateType(CandidateType candidateType){
- this.candidateType = candidateType;
+ public void setIdentifierType(CandidateType identifierType){
+ this.identifierType = identifierType;
}
- public List<String> getCandidates(){
- return candidates;
+ public List<String> getIdentifiers(){
+ return identifiers;
}
- public void setCandidates(List<String> candidates){
- this.candidates = candidates;
+ public void setIdentifiers(List<String> identifiers){
+ this.identifiers = identifiers;
}
public String getCloudOwner(){
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
index df1f0adcea..d8c7ebaff7 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
@@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
@@ -516,7 +517,7 @@ public class TestDataSetup{
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter);
vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter);
-
+ vfModule.setModuleIndex(0);
ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter);
modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter);
@@ -529,6 +530,10 @@ public class TestDataSetup{
}
public VfModule setVfModule() {
+ return setVfModule(true);
+ }
+
+ public VfModule setVfModule(boolean addToGenericVnf) {
VfModule vfModule = buildVfModule();
GenericVnf genericVnf = null;
@@ -539,7 +544,9 @@ public class TestDataSetup{
genericVnf = setGenericVnf();
}
- genericVnf.getVfModules().add(vfModule);
+ if (addToGenericVnf) {
+ genericVnf.getVfModules().add(vfModule);
+ }
lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId());
return vfModule;
@@ -702,4 +709,12 @@ public class TestDataSetup{
subnet.setNeutronSubnetId("testNeutronSubnetId");
return subnet;
}
+
+ public NetworkPolicy buildNetworkPolicy() {
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ networkPolicy.setNetworkPolicyId("testNetworkPolicyId");
+ networkPolicy.setNetworkPolicyFqdn("testNetworkPolicyFqdn");
+ networkPolicy.setHeatStackId("testHeatStackId");
+ return networkPolicy;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
index da7e727488..c48019af83 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -19,6 +19,7 @@
*/
package org.onap.so.bpmn.infrastructure.aai.tasks;
+import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
@@ -29,12 +30,18 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.util.Arrays;
+import java.util.Optional;
+import java.util.TreeSet;
+
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
+import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -43,12 +50,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
public class AAICreateTasksTest extends BaseTaskTest{
@@ -65,6 +76,9 @@ public class AAICreateTasksTest extends BaseTaskTest{
private Customer customer;
private Configuration configuration;
+ @Captor
+ ArgumentCaptor<NetworkPolicy> networkPolicyCaptor;
+
@Rule
public final ExpectedException exception = ExpectedException.none();
@@ -268,9 +282,17 @@ public class AAICreateTasksTest extends BaseTaskTest{
@Test
public void createVfModuleTest() throws Exception {
- doNothing().when(aaiVfModuleResources).createVfModule(vfModule, genericVnf);
+
+ VfModule newVfModule = setVfModule(false);
+ newVfModule.setModuleIndex(null);
+ newVfModule.getModelInfoVfModule().setModelInvariantUUID("testModelInvariantUUID1");
+ doNothing().when(aaiVfModuleResources).createVfModule(newVfModule, genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(newVfModule);
+
+ assertEquals(null, newVfModule.getModuleIndex());
aaiCreateTasks.createVfModule(execution);
- verify(aaiVfModuleResources, times(1)).createVfModule(vfModule, genericVnf);
+ assertEquals(1, newVfModule.getModuleIndex().intValue());
+ verify(aaiVfModuleResources, times(1)).createVfModule(newVfModule, genericVnf);
}
@Test
@@ -445,4 +467,138 @@ public class AAICreateTasksTest extends BaseTaskTest{
aaiCreateTasks.connectVnfToTenant(execution);
verify(aaiVnfResources, times(1)).connectVnfToTenant(genericVnf, gBBInput.getCloudRegion());
}
+ @Test
+ public void createNetworkPolicyNeedToCreateAllTest() throws Exception {
+ execution.setVariable("heatStackId", "testHeatStackId");
+ execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,ED456");
+ Optional<NetworkPolicy> networkPolicy = Optional.empty();
+ doReturn(networkPolicy).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+ doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class));
+ aaiCreateTasks.createNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(2)).createNetworkPolicy(networkPolicyCaptor.capture());
+ assertEquals("ABC123", networkPolicyCaptor.getAllValues().get(0).getNetworkPolicyFqdn());
+ assertEquals("ED456", networkPolicyCaptor.getAllValues().get(1).getNetworkPolicyFqdn());
+ assertEquals("testHeatStackId", networkPolicyCaptor.getAllValues().get(0).getHeatStackId());
+ assertEquals("testHeatStackId", networkPolicyCaptor.getAllValues().get(1).getHeatStackId());
+ }
+
+ @Test
+ public void createNetworkPolicyNeedToCreateNoneTest() throws Exception {
+ execution.setVariable("heatStackId", "testHeatStackId");
+ execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ doReturn(Optional.of(networkPolicy)).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+ doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class));
+ aaiCreateTasks.createNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class));
+ }
+
+ @Test
+ public void createNetworkPolicyNoNetworkPoliciesTest() throws Exception {
+ execution.setVariable("heatStackId", "testHeatStackId");
+ aaiCreateTasks.createNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class));
+ }
+
+ @Test
+ public void createVfModuleGetLowestIndexTest() throws Exception {
+ GenericVnf vnf = new GenericVnf();
+ ModelInfoGenericVnf vnfInfo = new ModelInfoGenericVnf();
+ vnf.setModelInfoGenericVnf(vnfInfo);
+ vnfInfo.setModelInvariantUuid("my-uuid");
+
+ ModelInfoVfModule infoA = new ModelInfoVfModule();
+ infoA.setIsBaseBoolean(false);
+ infoA.setModelInvariantUUID("A");
+
+ ModelInfoVfModule infoB = new ModelInfoVfModule();
+ infoB.setIsBaseBoolean(false);
+ infoB.setModelInvariantUUID("B");
+
+ ModelInfoVfModule infoC = new ModelInfoVfModule();
+ infoC.setIsBaseBoolean(false);
+ infoC.setModelInvariantUUID("C");
+
+ VfModule newVfModuleA = new VfModule();
+ newVfModuleA.setVfModuleId("a");
+ VfModule newVfModuleB = new VfModule();
+ newVfModuleB.setVfModuleId("b");
+ VfModule newVfModuleC = new VfModule();
+ newVfModuleC.setVfModuleId("c");
+
+ VfModule vfModule = new VfModule();
+ vnf.getVfModules().add(vfModule);
+ vfModule.setVfModuleId("1");
+
+ VfModule vfModule2 = new VfModule();
+ vnf.getVfModules().add(vfModule2);
+ vfModule2.setVfModuleId("2");
+
+ VfModule vfModule3 = new VfModule();
+ vnf.getVfModules().add(vfModule3);
+ vfModule3.setVfModuleId("3");
+
+ VfModule vfModule4 = new VfModule();
+ vnf.getVfModules().add(vfModule4);
+ vfModule4.setVfModuleId("4");
+
+ VfModule vfModule5 = new VfModule();
+ vnf.getVfModules().add(vfModule5);
+ vfModule5.setVfModuleId("5");
+
+ //modules are included in the vnf already
+ vnf.getVfModules().add(newVfModuleA);
+ vnf.getVfModules().add(newVfModuleB);
+ vnf.getVfModules().add(newVfModuleC);
+
+ //A
+ newVfModuleA.setModelInfoVfModule(infoA);
+ vfModule.setModelInfoVfModule(infoA);
+ vfModule2.setModelInfoVfModule(infoA);
+ vfModule3.setModelInfoVfModule(infoA);
+
+ //B
+
+ newVfModuleB.setModelInfoVfModule(infoB);
+ vfModule4.setModelInfoVfModule(infoB);
+ vfModule5.setModelInfoVfModule(infoB);
+
+ //C
+ newVfModuleC.setModelInfoVfModule(infoC);
+
+
+ //A
+ vfModule.setModuleIndex(2);
+ vfModule2.setModuleIndex(0);
+ vfModule3.setModuleIndex(3);
+
+ //B
+ vfModule4.setModuleIndex(null);
+ vfModule5.setModuleIndex(1);
+
+ assertEquals(1, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleA));
+
+ assertEquals(2, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleB));
+
+ assertEquals(0, aaiCreateTasks.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, newVfModuleC));
+
+ }
+
+ @Test
+ public void calculateUnusedIndexTest() {
+
+ TreeSet<Integer> a = new TreeSet<>(Arrays.asList(0,1,3));
+ TreeSet<Integer> b = new TreeSet<>(Arrays.asList(0,1,8));
+ TreeSet<Integer> c = new TreeSet<>(Arrays.asList(0,2,4));
+ assertEquals(2, aaiCreateTasks.calculateUnusedIndex(a, 0));
+ assertEquals(5, aaiCreateTasks.calculateUnusedIndex(a, 2));
+
+ assertEquals(4, aaiCreateTasks.calculateUnusedIndex(b, 2));
+ assertEquals(3, aaiCreateTasks.calculateUnusedIndex(b, 1));
+
+ assertEquals(5, aaiCreateTasks.calculateUnusedIndex(c, 2));
+ assertEquals(9, aaiCreateTasks.calculateUnusedIndex(c, 6));
+ assertEquals(1, aaiCreateTasks.calculateUnusedIndex(c, 0));
+
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
index 67f5d197de..5cb775180e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
@@ -20,22 +20,26 @@
package org.onap.so.bpmn.infrastructure.aai.tasks;
+import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
+import org.mockito.Captor;
import org.mockito.InjectMocks;
+import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -46,6 +50,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
@@ -62,6 +67,9 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
private CloudRegion cloudRegion;
private Configuration configuration;
+ @Captor
+ ArgumentCaptor<String> stringCaptor;
+
@Before
public void before() throws BBObjectNotFoundException {
serviceInstance = setServiceInstance();
@@ -179,4 +187,34 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
aaiDeleteTasks.deleteConfiguration(execution);
verify(aaiConfigurationResources, times(1)).deleteConfiguration(configuration);
}
+
+ @Test
+ public void deleteNetworkPolicyNeedToDeleteAllTest() throws Exception {
+ execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,DEF456");
+ NetworkPolicy networkPolicy0 = new NetworkPolicy();
+ networkPolicy0.setNetworkPolicyId("testNetworkPolicyId0");
+ NetworkPolicy networkPolicy1 = new NetworkPolicy();
+ networkPolicy1.setNetworkPolicyId("testNetworkPolicyId1");
+ doReturn(Optional.of(networkPolicy0),Optional.of(networkPolicy1)).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+ doNothing().when(aaiNetworkResources).deleteNetworkPolicy(any(String.class));
+ aaiDeleteTasks.deleteNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(2)).deleteNetworkPolicy(stringCaptor.capture());
+ assertEquals("testNetworkPolicyId0", stringCaptor.getAllValues().get(0));
+ assertEquals("testNetworkPolicyId1", stringCaptor.getAllValues().get(1));
+ }
+
+ @Test
+ public void deleteNetworkPolicyNeedToDeleteNoneTest() throws Exception {
+ execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
+ Optional<NetworkPolicy> networkPolicy = Optional.empty();
+ doReturn(networkPolicy).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+ aaiDeleteTasks.deleteNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
+ }
+
+ @Test
+ public void deleteNetworkPolicyNoNetworkPoliciesTest() throws Exception {
+ aaiDeleteTasks.deleteNetworkPolicies(execution);
+ verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index f97b137fb3..73d7257632 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -586,4 +586,49 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
}
+ @Test
+ public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception {
+ execution.setVariable("contrailServiceInstanceFqdn", "newContrailServiceInstanceFqdn");
+ doNothing().when(aaiVfModuleResources).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
+
+ aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution);
+
+ verify(aaiVfModuleResources, times(1)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
+ assertEquals("newContrailServiceInstanceFqdn", vfModule.getContrailServiceInstanceFqdn());
+ }
+ @Test
+ public void updateContrailServiceInstanceFqdnVfModuleNoUpdateTest() throws Exception {
+ aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution);
+ verify(aaiVfModuleResources, times(0)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf);
+ }
+ @Test
+ public void updateIpv4OamAddressVnfTest() throws Exception {
+ execution.setVariable("oamManagementV4Address", "newIpv4OamAddress");
+ doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf);
+
+ aaiUpdateTasks.updateIpv4OamAddressVnf(execution);
+
+ verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf);
+ assertEquals("newIpv4OamAddress", genericVnf.getIpv4OamAddress());
+ }
+ @Test
+ public void updateIpv4OamAddressVnfNoUpdateTest() throws Exception {
+ aaiUpdateTasks.updateIpv4OamAddressVnf(execution);
+ verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf);
+ }
+ @Test
+ public void updateManagementV6AddressVnfTest() throws Exception {
+ execution.setVariable("oamManagementV6Address", "newManagementV6Address");
+ doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf);
+
+ aaiUpdateTasks.updateManagementV6AddressVnf(execution);
+
+ verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf);
+ assertEquals("newManagementV6Address", genericVnf.getManagementV6Address());
+ }
+ @Test
+ public void updateManagementV6AddressVnfNoUpdateTest() throws Exception {
+ aaiUpdateTasks.updateManagementV6AddressVnf(execution);
+ verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index 2ba8cb4b57..516c9480ad 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -1,11 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertThat;
+
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.bind.JAXBException;
import org.junit.Test;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
public class NetworkAdapterRestV1Test {
@@ -16,4 +42,17 @@ public class NetworkAdapterRestV1Test {
String returnedXml = response.toXmlString();
System.out.println(returnedXml);
}
+
+ @Test
+ public void testUnmarshalXmlUpdate() throws IOException, JAXBException {
+ UpdateNetworkResponse expectedResponse = new UpdateNetworkResponse();
+ expectedResponse.setMessageId("ec100bcc-2659-4aa4-b4d8-3255715c2a51");
+ expectedResponse.setNetworkId("80de31e3-cc78-4111-a9d3-5b92bf0a39eb");
+ Map<String,String>subnetMap = new HashMap<String,String>();
+ subnetMap.put("95cd8437-25f1-4238-8720-cbfe7fa81476", "d8d16606-5d01-4822-b160-9a0d257303e0");
+ expectedResponse.setSubnetMap(subnetMap);
+ String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><updateNetworkResponse><messageId>ec100bcc-2659-4aa4-b4d8-3255715c2a51</messageId><networkId>80de31e3-cc78-4111-a9d3-5b92bf0a39eb</networkId><subnetMap><entry><key>95cd8437-25f1-4238-8720-cbfe7fa81476</key><value>d8d16606-5d01-4822-b160-9a0d257303e0</value></entry></subnetMap></updateNetworkResponse>";
+ UpdateNetworkResponse response = (UpdateNetworkResponse) new NetworkAdapterRestV1().unmarshalXml(xml, UpdateNetworkResponse.class);
+ assertThat(expectedResponse, sameBeanAs(response));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
index 4158f9cfae..33d0dbe130 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.adapter.vnf.tasks;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -35,6 +36,7 @@ import org.mockito.InjectMocks;
import org.onap.so.FileUtil;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
@@ -50,6 +52,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
private RequestContext requestContext;
private ServiceInstance serviceInstance;
+ private GenericVnf genericVnf;
private VfModule vfModule;
private VolumeGroup volumeGroup;
@@ -58,12 +61,17 @@ public class VnfAdapterImplTest extends BaseTaskTest {
private static final String VNF_ADAPTER_VOLUME_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml");
private static final String VNF_ADAPTER_VOLUME_DELETE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml");
private static final String TEST_VFMODULE_HEATSTACK_ID = "slowburn";
- private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1";
+ private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1";
+ private static final String TEST_CONTRAIL_SERVICE_INSTANCE_FQDN = "default-domain:MSOTest:MsoNW-RA";
+ private static final String TEST_OAM_MANAGEMENT_V4_ADDRESS = "127.0.0.1";
+ private static final String TEST_OAM_MANAGEMENT_V6_ADDRESS = "2000:abc:bce:1111";
+ private static final String TEST_CONTRAIL_NETWORK_POLICY_FQDNS = "MSOTest:DefaultPolicyFQDN2,MSOTest:DefaultPolicyFQDN1";
@Before
public void before() throws BBObjectNotFoundException {
requestContext = setRequestContext();
serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
vfModule = setVfModule();
volumeGroup = setVolumeGroup();
vfModule.setHeatStackId(null);
@@ -72,6 +80,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
}
@@ -86,8 +95,15 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateResponseTest() {
execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
- vnfAdapterImpl.postProcessVnfAdapter(execution);
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
+ assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, vfModule.getContrailServiceInstanceFqdn());
+ assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, execution.getVariable("contrailServiceInstanceFqdn"));
+ assertEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, genericVnf.getIpv4OamAddress());
+ assertEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, execution.getVariable("oamManagementV4Address"));
+ assertEquals(TEST_OAM_MANAGEMENT_V6_ADDRESS, genericVnf.getManagementV6Address());
+ assertEquals(TEST_OAM_MANAGEMENT_V6_ADDRESS, execution.getVariable("oamManagementV6Address"));
+ assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList"));
}
@@ -111,6 +127,20 @@ public class VnfAdapterImplTest extends BaseTaskTest {
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
+
+ @Test
+ public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleOutputs() {
+ execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ assertNull(vfModule.getContrailServiceInstanceFqdn());
+ assertNull(execution.getVariable("contrailServiceInstanceFqdn"));
+ assertNotEquals(TEST_OAM_MANAGEMENT_V4_ADDRESS, genericVnf.getIpv4OamAddress());
+ assertNull(execution.getVariable("oamManagementV4Address"));
+ assertNull(genericVnf.getManagementV6Address());
+ assertNull(execution.getVariable("oamManagementV6Address"));
+ assertNull(execution.getVariable("contrailNetworkPolicyFqdnList"));
+ }
@Test
public void postProcessVnfAdapter_DeleteResponseTest() {
@@ -118,6 +148,25 @@ public class VnfAdapterImplTest extends BaseTaskTest {
execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
+ assertEquals(vfModule.getContrailServiceInstanceFqdn(), "");
+ assertEquals(execution.getVariable("contrailServiceInstanceFqdn"), "");
+ assertEquals(genericVnf.getIpv4OamAddress(), "");
+ assertEquals(execution.getVariable("oamManagementV4Address"), "");
+ assertEquals(genericVnf.getManagementV6Address(), "");
+ assertEquals(execution.getVariable("oamManagementV6Address"), "");
+ assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList"));
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleOutputs() {
+ execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(vfModule.getHeatStackId());
+ assertNull(vfModule.getContrailServiceInstanceFqdn());
+ assertNull(execution.getVariable("contrailServiceInstanceFqdn"));
+ assertNull(execution.getVariable("oamManagementV4Address"));
+ assertNull(execution.getVariable("oamManagementV6Address"));
+ assertNull(execution.getVariable("contrailNetworkPolicyFqdnList"));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java
index 57e463c0f8..d1d167e561 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import static org.junit.Assert.*;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
index f0bb6a369c..59fad5cdd6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
@@ -84,7 +84,7 @@ public class SniroHomingV2IT extends BaseIntegrationTest{
requestContext.setMsoRequestId("testRequestId");
RequestParameters params = new RequestParameters();
params.setaLaCarte(false);
- params.setSubscriptionServiceType("iptollfree");
+ params.setSubscriptionServiceType("testSubscriptionServiceType");
requestContext.setRequestParameters(params);
}
@@ -94,10 +94,10 @@ public class SniroHomingV2IT extends BaseIntegrationTest{
bondingLink.getServiceProxies().add(setServiceProxy("1", "transport"));
ServiceProxy sp2 = setServiceProxy("2", "infrastructure");
Candidate requiredCandidate = new Candidate();
- requiredCandidate.setCandidateType(CandidateType.VNF_ID);
+ requiredCandidate.setIdentifierType(CandidateType.VNF_ID);
List<String> c = new ArrayList<String>();
c.add("testVnfId");
- requiredCandidate.setCandidates(c);
+ requiredCandidate.setIdentifiers(c);
sp2.addRequiredCandidates(requiredCandidate);
bondingLink.getServiceProxies().add(sp2);
serviceInstance.getVpnBondingLinks().add(bondingLink);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java
index 4ace2727be..03b39f57e5 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.hamcrest.CoreMatchers.equalTo;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index f3b094f645..2fc62978fb 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
+import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
@@ -46,6 +47,7 @@ import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.springframework.core.env.Environment;
public class WorkflowActionBBTasksTest extends BaseTaskTest {
@@ -64,6 +66,9 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
private DelegateExecution execution;
+ @Mock
+ protected Environment environment;
+
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -287,6 +292,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
String reqId = "reqId123";
execution.setVariable("mso-request-id", reqId);
doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+ doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
execution.setVariable("handlingCode","Retry");
execution.setVariable("retryCount", 1);
execution.setVariable("gCurrentSequence",1);
@@ -297,6 +303,25 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void checkRetryStatusTestExceededMaxRetries(){
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+ doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
+ execution.setVariable("handlingCode","Retry");
+ execution.setVariable("retryCount", 6);
+ execution.setVariable("gCurrentSequence",1);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ try{
+ workflowActionBBTasks.checkRetryStatus(execution);
+ } catch (BpmnError e) {
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals("Exceeded maximum retries. Ending flow with status Abort",exception.getErrorMessage());
+ }
+ }
+
+ @Test
public void checkRetryStatusNoRetryTest(){
String reqId = "reqId123";
execution.setVariable("mso-request-id", reqId);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 7b348c8cb3..c74f590e6b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -23,6 +25,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.anyObject;
@@ -31,16 +34,18 @@ import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.net.MalformedURLException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -70,6 +75,8 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.HeatTemplate;
import org.onap.so.db.catalog.beans.InstanceGroup;
@@ -77,6 +84,7 @@ import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -85,8 +93,6 @@ import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.SubscriberInfo;
import org.springframework.core.env.Environment;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
public class WorkflowActionTest extends BaseTaskTest {
@@ -854,6 +860,63 @@ public class WorkflowActionTest extends BaseTaskTest {
,"DeleteNetworkCollectionBB");
}
+ @Test
+ public void selectExecutionListALaCarteVfModuleNoFabricCreateTest() throws Exception{
+ String gAction = "createInstance";
+ String resource = "VfModule";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs,"AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB");
+ }
+
+ @Test
+ public void selectExecutionListALaCarteVfModuleFabricCreateTest() throws Exception{
+ String gAction = "createInstance";
+ String resource = "VfModule";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<CvnfcCustomization>();
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setToscaNodeType("FabricConfiguration");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> custSet = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
+ custSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
+ cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(custSet);
+ cvnfcCustomizations.add(cvnfcCustomization);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("fc25201d-36d6-43a3-8d39-fdae88e526ae", "9a6d01fd-19a7-490a-9800-460830a12e0b")).thenReturn(cvnfcCustomizations);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs,"AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
+ }
+
/**
* WorkflowActionBB Tests
*/
@@ -1228,7 +1291,44 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals("222",result.get(1).getResourceId());
assertEquals("111",result.get(2).getResourceId());
}
-
+
+ @Test
+ public void findCatalogNetworkCollectionTest() {
+ Service service = new Service();
+ NetworkCollectionResourceCustomization networkCustomization = new NetworkCollectionResourceCustomization();
+ networkCustomization.setModelCustomizationUUID("123");
+ service.getCollectionResourceCustomizations().add(networkCustomization);
+ doReturn(networkCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
+ CollectionResourceCustomization customization = workflowAction.findCatalogNetworkCollection(execution, service);
+ assertNotNull(customization);
+ }
+
+ @Test
+ public void findCatalogNetworkCollectionEmptyTest() {
+ Service service = new Service();
+ NetworkCollectionResourceCustomization networkCustomization = new NetworkCollectionResourceCustomization();
+ networkCustomization.setModelCustomizationUUID("123");
+ service.getCollectionResourceCustomizations().add(networkCustomization);
+ CollectionResourceCustomization customization = workflowAction.findCatalogNetworkCollection(execution, service);
+ assertNull(customization);
+ }
+
+ @Test
+ public void findCatalogNetworkCollectionMoreThanOneTest() {
+ Service service = new Service();
+ NetworkCollectionResourceCustomization networkCustomization1 = new NetworkCollectionResourceCustomization();
+ networkCustomization1.setModelCustomizationUUID("123");
+ NetworkCollectionResourceCustomization networkCustomization2 = new NetworkCollectionResourceCustomization();
+ networkCustomization2.setModelCustomizationUUID("321");
+ service.getCollectionResourceCustomizations().add(networkCustomization1);
+ service.getCollectionResourceCustomizations().add(networkCustomization2);
+ doReturn(networkCustomization1).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
+ doReturn(networkCustomization2).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("321");
+ workflowAction.findCatalogNetworkCollection(execution, service);
+ assertEquals("Found multiple Network Collections in the Service model, only one per Service is supported.",
+ execution.getVariable("WorkflowActionErrorMessage"));
+ }
+
private List<OrchestrationFlow> createFlowList (String... flowNames){
List<OrchestrationFlow> result = new ArrayList<>();
for(String flowName : flowNames){
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
index 297d75a104..2dd4033aa2 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
@@ -57,6 +57,10 @@ import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.RelatedInstance;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@RunWith(MockitoJUnitRunner.class)
public class WorkflowActionUnitTest {
@@ -87,9 +91,16 @@ public class WorkflowActionUnitTest {
"flow y",
"ActivateFabricConfigurationBB",
"flow z");
- doReturn(Arrays.asList("yes", "yes")).when(workflowAction).traverseCatalogDbForConfiguration(ArgumentMatchers.isNull(), ArgumentMatchers.isNull());
+ doReturn(Arrays.asList("yes", "yes")).when(workflowAction).traverseCatalogDbForConfiguration(ArgumentMatchers.any(String.class), ArgumentMatchers.isNull());
- List<OrchestrationFlow> result = workflowAction.filterOrchFlows(flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
+ ServiceInstancesRequest sIRequest = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ ModelInfo modelInfo = new ModelInfo();
+ requestDetails.setModelInfo(modelInfo);
+ RelatedInstance relatedInstance = new RelatedInstance();
+ sIRequest.setRequestDetails(requestDetails);
+
+ List<OrchestrationFlow> result = workflowAction.filterOrchFlows(sIRequest, flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
assertThat(result, is(flows));
}
@@ -103,7 +114,14 @@ public class WorkflowActionUnitTest {
"ActivateFabricConfigurationBB",
"flow z");
- List<OrchestrationFlow> result = workflowAction.filterOrchFlows(flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
+ ServiceInstancesRequest sIRequest = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationUuid("");
+ requestDetails.setModelInfo(modelInfo);
+ sIRequest.setRequestDetails(requestDetails);
+
+ List<OrchestrationFlow> result = workflowAction.filterOrchFlows(sIRequest, flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
List<OrchestrationFlow> expected = createFlowList(
"flow x",
"flow y",
@@ -147,7 +165,7 @@ public class WorkflowActionUnitTest {
doReturn(Arrays.asList(flow)).when(workflowAction).queryNorthBoundRequestCatalogDb(any(), any(), any(), anyBoolean(), any(), any());
workflowAction.selectExecutionList(execution);
- verify(workflowAction, times(1)).filterOrchFlows(eq(flows), any(), any());
+ verify(workflowAction, times(1)).filterOrchFlows(any(), eq(flows), any(), any());
flow = new OrchestrationFlow();
flow.setFlowName("flow y");
@@ -155,7 +173,7 @@ public class WorkflowActionUnitTest {
when(execution.getVariable(eq("aLaCarte"))).thenReturn(false);
workflowAction.selectExecutionList(execution);
- verify(workflowAction, never()).filterOrchFlows(eq(flows), any(), any());
+ verify(workflowAction, never()).filterOrchFlows(any(), eq(flows), any(), any());
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index db01399b82..a8e9a7e57e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -41,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget;
@@ -672,4 +673,21 @@ public class AAIObjectMapperTest {
assertThat(actualSubnet, sameBeanAs(expectedSubnet));
}
+
+ @Test
+ public void mapNetworkPolicyTest() {
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ networkPolicy.setNetworkPolicyId("testNetworkPolicyId");
+ networkPolicy.setNetworkPolicyFqdn("testNetworkPolicyFqdn");
+ networkPolicy.setHeatStackId("testHeatStackId");
+
+ org.onap.aai.domain.yang.NetworkPolicy expectedNetworkPolicy = new org.onap.aai.domain.yang.NetworkPolicy();
+ expectedNetworkPolicy.setNetworkPolicyId("testNetworkPolicyId");
+ expectedNetworkPolicy.setNetworkPolicyFqdn("testNetworkPolicyFqdn");
+ expectedNetworkPolicy.setHeatStackId("testHeatStackId");
+
+ org.onap.aai.domain.yang.NetworkPolicy actualNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy);
+
+ assertThat(actualNetworkPolicy, sameBeanAs(expectedNetworkPolicy));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
index 82ffdf9559..2e2cc5d974 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
@@ -45,7 +45,6 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.aai.domain.yang.RouteTableReference;
import org.onap.aai.domain.yang.VpnBinding;
import org.onap.so.bpmn.common.InjectionHelper;
@@ -54,6 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
import org.onap.so.client.aai.AAIObjectType;
@@ -77,6 +77,7 @@ public class AAINetworkResourcesTest extends TestDataSetup{
private ServiceInstance serviceInstance;
private CloudRegion cloudRegion;
private Subnet subnet;
+ private NetworkPolicy networkPolicy;
@Mock
protected AAIResourcesClient MOCK_aaiResourcesClient;
@@ -107,6 +108,8 @@ public class AAINetworkResourcesTest extends TestDataSetup{
subnet = buildSubnet();
+ networkPolicy = buildNetworkPolicy();
+
doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
}
@@ -175,16 +178,15 @@ public class AAINetworkResourcesTest extends TestDataSetup{
public void getNetworkPolicyTest() throws Exception {
final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicy.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
- Optional<NetworkPolicy> oNetPolicy = Optional.empty();
+ Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = Optional.empty();
AAIResourceUri netPolicyUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID");
doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri);
- verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
-
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
if (oNetPolicy.isPresent()) {
- NetworkPolicy networkPolicy = oNetPolicy.get();
- assertThat(aaiResultWrapper.asBean(NetworkPolicy.class).get(), sameBeanAs(networkPolicy));
+ org.onap.aai.domain.yang.NetworkPolicy networkPolicy = oNetPolicy.get();
+ assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicy.class).get(), sameBeanAs(networkPolicy));
}
}
@@ -357,4 +359,20 @@ public class AAINetworkResourcesTest extends TestDataSetup{
assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.Subnet.class).get(), sameBeanAs(subnet));
}
}
+
+ @Test
+ public void createNetworkPolicyTest() throws Exception {
+ doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.NetworkPolicy.class));
+ doReturn(new org.onap.aai.domain.yang.NetworkPolicy()).when(MOCK_aaiObjectMapper).mapNetworkPolicy(networkPolicy);
+ aaiNetworkResources.createNetworkPolicy(networkPolicy);
+ verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.NetworkPolicy.class));
+ }
+
+ @Test
+ public void deleteNetworkPolicyTest() throws Exception {
+ doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class));
+ aaiNetworkResources.deleteNetworkPolicy(networkPolicy.getNetworkPolicyId());
+ verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
index 0a8e7ce349..a8200caf79 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
@@ -138,4 +138,17 @@ public class AAIVfModuleResourcesTest extends TestDataSetup{
assertEquals("testHeatStackId", vfModule.getHeatStackId());
}
+
+ @Test
+ public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception {
+ vfModule.setContrailServiceInstanceFqdn("testContrailServiceInstanceFqdn");
+
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class));
+
+ aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class),ArgumentMatchers.isNull());
+
+ assertEquals("testContrailServiceInstanceFqdn", vfModule.getContrailServiceInstanceFqdn());
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
index b65203b24d..6713f80ad9 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
@@ -42,13 +42,11 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "candidateType" : {
- "name" : "vnfId"
- },
- "candidates" : [ "testVnfId" ]
+ "identifierType" : "vnfId",
+ "identifiers" : [ "testVnfId" ]
} ]
} ],
- "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false}
+ "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false}
},
"licenseInfo" : {
"licenseDemands" : [ ]
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json
index ac460c328a..740a05d1be 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json
@@ -51,7 +51,7 @@
"modelInvariantId" : "testAllottedModelInvariantUuid3"
}
} ],
- "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false}
+ "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false}
},
"licenseInfo" : {
"licenseDemands" : [ ]
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
index 6db2153691..14a89c90fc 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
@@ -42,10 +42,8 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "candidateType" : {
- "name" : "vnfId"
- },
- "candidates" : [ "testVnfId" ]
+ "identifierType" : "vnfId",
+ "identifiers" : [ "testVnfId" ]
} ]
}, {
"serviceResourceId" : "testProxyId1",
@@ -66,10 +64,8 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "candidateType" : {
- "name" : "vnfId"
- },
- "candidates" : [ "testVnfId" ]
+ "identifierType" : "vnfId",
+ "identifiers" : [ "testVnfId" ]
} ]
}, {
"serviceResourceId" : "testProxyId1",
@@ -90,13 +86,11 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "candidateType" : {
- "name" : "vnfId"
- },
- "candidates" : [ "testVnfId" ]
+ "identifierType" : "vnfId",
+ "identifiers" : [ "testVnfId" ]
} ]
} ],
- "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false}
+ "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false}
},
"licenseInfo" : {
"licenseDemands" : [ ]
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json
new file mode 100644
index 0000000000..332ad4500c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json
@@ -0,0 +1,65 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelCustomizationName": "model-cust-name",
+ "modelInvariantId": "db86e4a6-c027-452e-a559-3a23b3128367",
+ "modelType": "vfModule",
+ "modelName": "test-model-name",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9a6d01fd-19a7-490a-9800-460830a12e0b",
+ "modelVersionId": "14c8f313-fb0f-4cf6-8caf-c7cce8137b60",
+ "modelCustomizationId": "9a6d01fd-19a7-490a-9800-460830a12e0b",
+ "modelUuid": "14c8f313-fb0f-4cf6-8caf-c7cce8137b60",
+ "modelInvariantUuid": "db86e4a6-c027-452e-a559-3a23b3128367",
+ "modelInstanceName": "test-model-instance-name"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "instanceName": "instanceName",
+ "suppressRollback": false,
+ "requestorId": "user"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "f647e3ef-6d2e-4cd3-bff4-8df4634208de",
+ "modelInfo": {
+ "modelInvariantId": "86adb376-5303-441a-b50e-96c0cd643b0f",
+ "modelType": "service",
+ "modelName": "model-name",
+ "modelVersion": "1.0",
+ "modelVersionId": "599e21ed-803d-4d1f-83df-20005339b83f",
+ "modelUuid": "599e21ed-803d-4d1f-83df-20005339b83f",
+ "modelInvariantUuid": "86adb376-5303-441a-b50e-96c0cd643b0f"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d",
+ "modelInfo": {
+ "modelCustomizationName": "modle-cust-name",
+ "modelInvariantId": "5cca9285-4ed4-4e11-a609-921ed3344811",
+ "modelType": "vnf",
+ "modelName": "modle-name",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "fc25201d-36d6-43a3-8d39-fdae88e526ae",
+ "modelVersionId": "7cae703a-b20d-481a-863a-b862236c00f7",
+ "modelCustomizationId": "fc25201d-36d6-43a3-8d39-fdae88e526ae",
+ "modelUuid": "7cae703a-b20d-481a-863a-b862236c00f7",
+ "modelInvariantUuid": "5cca9285-4ed4-4e11-a609-921ed3344811",
+ "modelInstanceName": "model-inst-name"
+ }
+ }
+ }
+ ],
+ "cloudConfiguration": {
+ "tenantId": "872f331350c54e59991a8de2cbffb40c",
+ "cloudOwner": "my-custom-cloud-owner",
+ "lcpCloudRegionId": "cloud-region"
+ },
+ "requestParameters": {
+ "usePreload": true
+ }
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClient.java b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
index be553420ac..21bbc51f89 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
@@ -27,20 +27,24 @@ import javax.ws.rs.core.UriBuilder;
import org.onap.so.client.RestClient;
import org.onap.so.client.graphinventory.GraphInventoryClient;
+import org.onap.so.client.graphinventory.GraphInventoryVersion;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class AAIClient extends GraphInventoryClient {
+public class AAIClient extends GraphInventoryClient {
private static final String AAI_ROOT = "/aai";
protected static Logger logger = LoggerFactory.getLogger(AAIClient.class);
protected AAIVersion version;
- public AAIClient() {
+ protected AAIClient() {
+ super(AAIProperties.class);
+ }
+
+ protected AAIClient(AAIVersion version) {
super(AAIProperties.class);
}
-
@Override
protected URI constructPath(GraphInventoryUri uri) {
@@ -48,7 +52,7 @@ public abstract class AAIClient extends GraphInventoryClient {
}
@Override
- protected RestClient createClient(GraphInventoryUri uri) {
+ public RestClient createClient(GraphInventoryUri uri) {
try {
return new AAIRestClient(getRestProperties(), constructPath(uri));
} catch (GraphInventoryUriComputationException | NotFoundException e) {
@@ -57,11 +61,18 @@ public abstract class AAIClient extends GraphInventoryClient {
}
}
- protected AAIVersion getVersion() {
+ @Override
+ public AAIVersion getVersion() {
if (version == null) {
return this.<AAIProperties>getRestProperties().getDefaultVersion();
} else {
return this.version;
}
}
+
+
+ @Override
+ public String getGraphDBName() {
+ return "A&AI";
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java
index 33c9769400..9c8345d4b6 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java
@@ -20,16 +20,12 @@
package org.onap.so.client.aai;
-import com.fasterxml.jackson.databind.module.SimpleModule;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperPatchProvider;
-public class AAICommonObjectMapperPatchProvider extends AAICommonObjectMapperProvider {
+public class AAICommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperPatchProvider {
public AAICommonObjectMapperPatchProvider() {
super();
- EmptyStringToNullSerializer sp = new EmptyStringToNullSerializer();
- SimpleModule emptyStringModule = new SimpleModule();
- emptyStringModule.addSerializer(String.class, sp);
- mapper.registerModule(emptyStringModule);
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java
index 0e2071842f..15bc2ea8ef 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java
@@ -20,33 +20,12 @@
package org.onap.so.client.aai;
-import org.onap.so.client.policy.CommonObjectMapperProvider;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.AnnotationIntrospector;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
-
-public class AAICommonObjectMapperProvider extends CommonObjectMapperProvider {
+public class AAICommonObjectMapperProvider extends GraphInventoryCommonObjectMapperProvider {
public AAICommonObjectMapperProvider() {
- mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
- mapper.enable(MapperFeature.USE_ANNOTATIONS);
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
- AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector();
- // first Jaxb, second Jackson annotations
- mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson));
+ super();
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Status.java b/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java
index fe9764a2f2..e9b58b469d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Status.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java
@@ -18,19 +18,25 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.apihandlerinfra;
+package org.onap.so.client.aai;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.GraphInventoryQueryClient;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
-/*
- * Enum for Status values returned by API Handler to Tail-F
-*/
-public enum Status {
- PENDING,
- IN_PROGRESS,
- COMPLETE,
- COMPLETED,
- FAILED,
- TIMEOUT,
- UNLOCKED,
- PENDING_MANUAL_TASK
+public class AAIDSLQueryClient extends GraphInventoryQueryClient<AAIDSLQueryClient> {
+
+ public AAIDSLQueryClient() {
+ super(new AAIClient());
+ }
+
+ public AAIDSLQueryClient(AAIVersion version) {
+ super(new AAIClient(version));
+ }
+
+ @Override
+ protected GraphInventoryUri getQueryUri() {
+ return AAIUriFactory.createResourceUri(AAIObjectType.DSL);
+ }
+
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index 66ff59d94f..21e36cde6c 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -26,8 +26,7 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-
-import javax.annotation.Priority;
+import java.util.regex.Pattern;
import org.onap.aai.annotations.Metadata;
import org.onap.aai.domain.yang.AggregateRoute;
@@ -61,6 +60,7 @@ import org.onap.aai.domain.yang.RouteTableReference;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.ServiceSubscription;
import org.onap.aai.domain.yang.SpPartner;
+import org.onap.aai.domain.yang.SriovPf;
import org.onap.aai.domain.yang.Subnet;
import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.TunnelXconnect;
@@ -119,6 +119,7 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType MODEL_VER = new AAIObjectType(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", ModelVer.class);
public static final AAIObjectType TUNNEL_XCONNECT = new AAIObjectType(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), TunnelXconnect.class);
public static final AAIObjectType P_INTERFACE = new AAIObjectType(AAIObjectType.PSERVER.uriTemplate(), PInterface.class);
+ public static final AAIObjectType SRIOV_PF = new AAIObjectType(AAIObjectType.P_INTERFACE.uriTemplate(), SriovPf.class);
public static final AAIObjectType PHYSICAL_LINK = new AAIObjectType(AAINamespaceConstants.NETWORK, PhysicalLink.class);
public static final AAIObjectType INSTANCE_GROUP = new AAIObjectType(AAINamespaceConstants.NETWORK, InstanceGroup.class);
public static final AAIObjectType COLLECTION = new AAIObjectType(AAINamespaceConstants.NETWORK, Collection.class);
@@ -134,6 +135,7 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType AGGREGATE_ROUTE = new AAIObjectType(AAINamespaceConstants.NETWORK, AggregateRoute.class);
public static final AAIObjectType L_INTERFACE = new AAIObjectType(AAIObjectType.VSERVER.uriTemplate(), LInterface.class);
public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown");
+ public static final AAIObjectType DSL = new AAIObjectType("/dsl", "", "dsl");
private final String uriTemplate;
private final String parentUri;
@@ -217,6 +219,6 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
}
protected String removeParentUri(Class<?> aaiObjectClass, String parentUri) {
- return aaiObjectClass.getAnnotation(Metadata.class).uriTemplate().replace(parentUri, "");
+ return aaiObjectClass.getAnnotation(Metadata.class).uriTemplate().replaceFirst(Pattern.quote(parentUri), "");
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java b/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
index 184b4e5251..c3523e94c2 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
@@ -20,64 +20,28 @@
package org.onap.so.client.aai;
-import java.util.Optional;
-
-import org.onap.so.client.RestClient;
-import org.onap.so.client.aai.entities.CustomQuery;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.GraphInventoryQueryClient;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
-public class AAIQueryClient extends AAIClient {
+public class AAIQueryClient extends GraphInventoryQueryClient<AAIQueryClient> {
- private Optional<String> depth = Optional.empty();
- private boolean nodesOnly = false;
- private Optional<AAISubgraphType> subgraph = Optional.empty();
-
public AAIQueryClient() {
- super();
+ super(new AAIClient());
}
public AAIQueryClient(AAIVersion version) {
- super();
- this.version = version;
- }
-
- public String query(Format format, CustomQuery query) {
- return this.createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", format.toString()))
- .put(query, String.class);
- }
-
- public AAIQueryClient depth (String depth) {
- this.depth = Optional.of(depth);
- return this;
+ super(new AAIClient(version));
}
- public AAIQueryClient nodesOnly() {
- this.nodesOnly = true;
- return this;
- }
- public AAIQueryClient subgraph(AAISubgraphType type){
-
- subgraph = Optional.of(type);
- return this;
+ @Override
+ protected GraphInventoryUri getQueryUri() {
+ return AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY);
}
- protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) {
- GraphInventoryUri clone = uri.clone();
- if (this.depth.isPresent()) {
- clone.queryParam("depth", depth.get());
- }
- if (this.nodesOnly) {
- clone.queryParam("nodesOnly", "");
- }
- if (this.subgraph.isPresent()) {
- clone.queryParam("subgraph", this.subgraph.get().toString());
- }
- return clone;
- }
@Override
- protected RestClient createClient(GraphInventoryUri uri) {
- return super.createClient(setupQueryParams(uri));
+ protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) {
+ return super.setupQueryParams(uri);
}
+
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
index 87951d516b..ee1736feeb 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
@@ -20,321 +20,58 @@
package org.onap.so.client.aai;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
import java.util.Optional;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.core.GenericType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-
import org.onap.aai.domain.yang.Relationship;
-import org.onap.so.client.RestClient;
-import org.onap.so.client.RestProperties;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUri;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.GraphInventoryResourcesClient;
+import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
-public class AAIResourcesClient extends AAIClient {
-
- public AAIResourcesClient() {
- super();
- }
+public class AAIResourcesClient extends GraphInventoryResourcesClient<AAIResourcesClient, AAIResourceUri, AAIEdgeLabel, AAIResultWrapper, AAITransactionalClient, AAISingleTransactionClient> {
- public AAIResourcesClient(AAIVersion version) {
- super();
- this.version = version;
- }
-
- /**
- * creates a new object in A&AI
- *
- * @param obj - can be any object which will marshal into a valid A&AI payload
- * @param uri
- * @return
- */
- public void create(AAIResourceUri uri, Object obj) {
- RestClient aaiRC = this.createClient(uri);
- aaiRC.put(obj);
- return;
- }
-
- /**
- * creates a new object in A&AI with no payload body
- *
- * @param uri
- * @return
- */
- public void createEmpty(AAIResourceUri uri) {
- RestClient aaiRC = this.createClient(uri);
- aaiRC.put("");
- return;
- }
-
- /**
- * returns false if the object does not exist in A&AI
- *
- * @param uri
- * @return
- */
- public boolean exists(AAIResourceUri uri) {
- AAIUri forceMinimal = this.addParams(Optional.of(Depth.ZERO), true, uri);
- try {
- RestClient aaiRC = this.createClient(forceMinimal);
-
- return aaiRC.get().getStatus() == Status.OK.getStatusCode();
- } catch (NotFoundException e) {
- return false;
- }
- }
-
- /**
- * Adds a relationship between two objects in A&AI
- * @param uriA
- * @param uriB
- * @return
- */
- public void connect(AAIResourceUri uriA, AAIResourceUri uriB) {
- AAIResourceUri uriAClone = uriA.clone();
- RestClient aaiRC = this.createClient(uriAClone.relationshipAPI());
- aaiRC.put(this.buildRelationship(uriB));
- return;
- }
-
- /**
- * Adds a relationship between two objects in A&AI
- * with a given edge label
- * @param uriA
- * @param uriB
- * @param edge label
- * @return
- */
- public void connect(AAIResourceUri uriA, AAIResourceUri uriB, AAIEdgeLabel label) {
- AAIResourceUri uriAClone = uriA.clone();
- RestClient aaiRC = this.createClient(uriAClone.relationshipAPI());
- aaiRC.put(this.buildRelationship(uriB, label));
- return;
- }
-
- /**
- * Removes relationship from two objects in A&AI
- *
- * @param uriA
- * @param uriB
- * @return
- */
- public void disconnect(AAIResourceUri uriA, AAIResourceUri uriB) {
- AAIResourceUri uriAClone = uriA.clone();
- RestClient aaiRC = this.createClient(uriAClone.relationshipAPI());
- aaiRC.delete(this.buildRelationship(uriB));
- return;
- }
-
- /**
- * Deletes object from A&AI. Automatically handles resource-version.
- *
- * @param uri
- * @return
- */
- public void delete(AAIResourceUri uri) {
- AAIResourceUri clone = uri.clone();
- RestClient aaiRC = this.createClient(clone);
- Map<String, Object> result = aaiRC.get(new GenericType<Map<String, Object>>(){})
- .orElseThrow(() -> new NotFoundException(clone.build() + " does not exist in A&AI"));
- String resourceVersion = (String) result.get("resource-version");
- aaiRC = this.createClient(clone.resourceVersion(resourceVersion));
- aaiRC.delete();
- return;
- }
-
- /**
- * @param obj - can be any object which will marshal into a valid A&AI payload
- * @param uri
- * @return
- */
- public void update(AAIResourceUri uri, Object obj) {
- RestClient aaiRC = this.createClient(uri);
- aaiRC.patch(obj);
- return;
- }
-
- /**
- * Retrieves an object from A&AI and unmarshalls it into the Class specified
- * @param clazz
- * @param uri
- * @return
- */
- public <T> Optional<T> get(Class<T> clazz, AAIResourceUri uri) {
- try {
- return this.createClient(uri).get(clazz);
- } catch (NotFoundException e) {
- if (this.getRestProperties().mapNotFoundToEmpty()) {
- return Optional.empty();
- } else {
- throw e;
- }
- }
- }
-
- /**
- * Retrieves an object from A&AI and returns complete response
- * @param uri
- * @return
- */
- public Response getFullResponse(AAIResourceUri uri) {
- try {
- return this.createClient(uri).get();
- } catch (NotFoundException e) {
- if (this.getRestProperties().mapNotFoundToEmpty()) {
- return e.getResponse();
- } else {
- throw e;
- }
- }
- }
+ private AAIClient aaiClient;
- /**
- * Retrieves an object from A&AI and automatically unmarshalls it into a Map or List
- * @param resultClass
- * @param uri
- * @return
- */
- public <T> Optional<T> get(GenericType<T> resultClass, AAIResourceUri uri) {
- try {
- return this.createClient(uri).get(resultClass);
- } catch (NotFoundException e) {
- if (this.getRestProperties().mapNotFoundToEmpty()) {
- return Optional.empty();
- } else {
- throw e;
- }
- }
+ public AAIResourcesClient() {
+ super(new AAIClient());
+ aaiClient = (AAIClient) super.client;
}
- /**
- * Retrieves an object from A&AI wrapped in a helper class which offer additional features
- *
- * @param uri
- * @return
- */
- public AAIResultWrapper get(AAIResourceUri uri) {
- String json;
- try {
- json = this.createClient(uri).get(String.class).orElse(null);
- } catch (NotFoundException e) {
- if (this.getRestProperties().mapNotFoundToEmpty()) {
- json = null;
- } else {
- throw e;
- }
- }
- return new AAIResultWrapper(json);
+ public AAIResourcesClient(AAIVersion version) {
+ super(new AAIClient(version));
+ aaiClient = (AAIClient) super.client;
}
-
- /**
- * Retrieves an object from A&AI wrapped in a helper class which offer additional features
- * If the object cannot be found in A&AI the method will throw the runtime exception
- * included as an argument
- * @param uri
- * @return
- */
- public AAIResultWrapper get(AAIResourceUri uri, Class<? extends RuntimeException> c) {
- String json;
- try {
- json = this.createClient(uri).get(String.class)
- .orElseThrow(() -> createException(c, uri.build() + " not found in A&AI", Optional.empty()));
- } catch (NotFoundException e) {
- throw createException(c, "could not construct uri for use with A&AI", Optional.of(e));
- }
+ @Override
+ public AAIResultWrapper createWrapper(String json) {
return new AAIResultWrapper(json);
}
-
- private RuntimeException createException(Class<? extends RuntimeException> c, String message, Optional<Throwable> t) {
- RuntimeException e;
- try {
- if (t.isPresent()) {
- e = c.getConstructor(String.class, Throwable.class).newInstance(message, t.get());
- } else {
- e = c.getConstructor(String.class).newInstance(message);
- }
- } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | NoSuchMethodException | SecurityException e1) {
- throw new IllegalArgumentException("could not create instance for " + c.getName());
- }
-
- return e;
- }
-
- protected Relationship buildRelationship(AAIResourceUri uri) {
- return buildRelationship(uri, Optional.empty());
- }
-
- protected Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) {
- return buildRelationship(uri, Optional.of(label));
- }
- protected Relationship buildRelationship(AAIResourceUri uri, Optional<AAIEdgeLabel> label) {
- final Relationship result = new Relationship();
- result.setRelatedLink(uri.build().toString());
- if (label.isPresent()) {
- result.setRelationshipLabel(label.get().toString());
- }
- return result;
- }
-
- /**
- * Will automatically create the object if it does not exist
- *
- * @param obj - Optional object which serializes to a valid A&AI payload
- * @param uri
- * @return
- */
- public AAIResourcesClient createIfNotExists(AAIResourceUri uri, Optional<Object> obj) {
- if(!this.exists(uri)){
- if (obj.isPresent()) {
- this.create(uri, obj.get());
- } else {
- this.createEmpty(uri);
- }
-
- }
- return this;
- }
- /**
- * Starts a transaction which encloses multiple A&AI mutations
- *
- * @return
- */
+ @Override
public AAITransactionalClient beginTransaction() {
- return new AAITransactionalClient(this.getVersion());
+ return new AAITransactionalClient(this, aaiClient);
}
-
- /**
- * Starts a transaction groups multiple A&AI mutations
- *
- * @return
- */
+
+ @Override
public AAISingleTransactionClient beginSingleTransaction() {
- return new AAISingleTransactionClient(this.getVersion());
+ return new AAISingleTransactionClient(this, aaiClient);
}
- private AAIUri addParams(Optional<Depth> depth, boolean nodesOnly, AAIUri uri) {
- AAIUri clone = uri.clone();
- if (depth.isPresent()) {
- clone.depth(depth.get());
- }
- if (nodesOnly) {
- clone.nodesOnly(nodesOnly);
- }
-
- return clone;
+ @Override
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri) {
+ return super.buildRelationship(uri, Optional.empty());
+ }
+
+ @Override
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri, GraphInventoryEdgeLabel label) {
+ return super.buildRelationship(uri, Optional.of(label));
}
+
@Override
- public <T extends RestProperties> T getRestProperties() {
- return super.getRestProperties();
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
+ return super.buildRelationship(uri, label);
}
+
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
index 4f235c35f1..a2651195ee 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
@@ -28,6 +28,7 @@ import javax.ws.rs.core.Response;
import org.onap.so.client.ResponseExceptionMapper;
import org.onap.so.client.RestClientSSL;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import org.onap.so.client.policy.CommonObjectMapperProvider;
import org.onap.so.utils.TargetEntity;
@@ -36,7 +37,7 @@ public class AAIRestClient extends RestClientSSL {
private final AAIProperties aaiProperties;
private static final AAICommonObjectMapperProvider standardProvider = new AAICommonObjectMapperProvider();
- private final AAIPatchConverter patchConverter = new AAIPatchConverter();
+ private final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter();
protected AAIRestClient(AAIProperties props, URI uri) {
super(props, Optional.of(uri));
@@ -81,7 +82,7 @@ public class AAIRestClient extends RestClientSSL {
return super.patch(convertToPatchFormat(obj), resultClass);
}
- protected AAIPatchConverter getPatchConverter() {
+ protected GraphInventoryPatchConverter getPatchConverter() {
return this.patchConverter;
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
index 2ecdb7c480..ee15e10e01 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
@@ -22,178 +22,45 @@ package org.onap.so.client.aai;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
import java.util.Optional;
-import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.GenericType;
-import org.onap.aai.domain.yang.Relationship;
import org.onap.so.client.RestClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIError;
-import org.onap.so.client.aai.entities.bulkprocess.Transactions;
import org.onap.so.client.aai.entities.singletransaction.OperationBodyRequest;
import org.onap.so.client.aai.entities.singletransaction.OperationBodyResponse;
import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest;
import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
+import org.onap.so.client.graphinventory.GraphInventoryTransactionClient;
import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
-import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Joiner;
-public class AAISingleTransactionClient extends AAIClient {
+public class AAISingleTransactionClient extends GraphInventoryTransactionClient<AAISingleTransactionClient, AAIResourceUri, AAIEdgeLabel> {
private final SingleTransactionRequest request;
- private final AAIVersion version;
- private int actionCount = 0;
-
- private final AAIPatchConverter patchConverter = new AAIPatchConverter();
-
- protected AAISingleTransactionClient(AAIVersion version) {
+ private AAIResourcesClient resourcesClient;
+ private AAIClient aaiClient;
+ protected AAISingleTransactionClient(AAIResourcesClient resourcesClient, AAIClient aaiClient) {
super();
- this.version = version;
+ this.resourcesClient = resourcesClient;
+ this.aaiClient = aaiClient;
this.request = new SingleTransactionRequest();
}
-
- /**
- * creates a new object in A&AI
- *
- * @param obj - can be any object which will marshal into a valid A&AI payload
- * @param uri
- * @return
- */
- public AAISingleTransactionClient create(AAIResourceUri uri, Object obj) {
- request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri.build().toString()).withBody(obj));
- incrementActionAmount();
- return this;
- }
-
- /**
- * creates a new object in A&AI with no payload body
- *
- * @param uri
- * @return
- */
- public AAISingleTransactionClient createEmpty(AAIResourceUri uri) {
- request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri.build().toString()).withBody(new HashMap<String, String>()));
- incrementActionAmount();
- return this;
- }
-
- /**
- * Adds a relationship between two objects in A&AI
- * @param uriA
- * @param uriB
- * @return
- */
- public AAISingleTransactionClient connect(AAIResourceUri uriA, AAIResourceUri uriB) {
- AAIResourceUri uriAClone = uriA.clone();
- request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uriAClone.relationshipAPI().build().toString()).withBody(this.buildRelationship(uriB)));
- incrementActionAmount();
- return this;
- }
-
- /**
- * relationship between multiple objects in A&AI - connects A to all objects specified in list
- *
- * @param uriA
- * @param uris
- * @return
- */
- public AAISingleTransactionClient connect(AAIResourceUri uriA, List<AAIResourceUri> uris) {
- for (AAIResourceUri uri : uris) {
- this.connect(uriA, uri);
- }
- return this;
- }
-
- public AAISingleTransactionClient connect(AAIResourceUri uriA, AAIResourceUri uriB, AAIEdgeLabel label) {
- AAIResourceUri uriAClone = uriA.clone();
- RestClient aaiRC = this.createClient(uriAClone.relationshipAPI());
- aaiRC.put(this.buildRelationship(uriB, label));
- return this;
- }
- public AAISingleTransactionClient connect(AAIResourceUri uriA, List<AAIResourceUri> uris, AAIEdgeLabel label) {
- for (AAIResourceUri uri : uris) {
- this.connect(uriA, uri, label);
- }
- return this;
- }
-
- /**
- * Removes relationship from two objects in A&AI
- *
- * @param uriA
- * @param uriB
- * @return
- */
- public AAISingleTransactionClient disconnect(AAIResourceUri uriA, AAIResourceUri uriB) {
- AAIResourceUri uriAClone = uriA.clone();
- request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uriAClone.relationshipAPI().build().toString()).withBody(this.buildRelationship(uriB)));
- incrementActionAmount();
- return this;
- }
-
- /**
- * Removes relationship from multiple objects - disconnects A from all objects specified in list
- * @param uriA
- * @param uris
- * @return
- */
- public AAISingleTransactionClient disconnect(AAIResourceUri uriA, List<AAIResourceUri> uris) {
- for (AAIResourceUri uri : uris) {
- this.disconnect(uriA, uri);
- }
- return this;
- }
- /**
- * Deletes object from A&AI. Automatically handles resource-version.
- *
- * @param uri
- * @return
- */
- public AAISingleTransactionClient delete(AAIResourceUri uri) {
- AAIResourcesClient client = new AAIResourcesClient();
- AAIResourceUri clone = uri.clone();
- Map<String, Object> result = client.get(new GenericType<Map<String, Object>>(){}, clone)
- .orElseThrow(() -> new NotFoundException(clone.build() + " does not exist in A&AI"));
- String resourceVersion = (String) result.get("resource-version");
- request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(clone.resourceVersion(resourceVersion).build().toString()).withBody(""));
- incrementActionAmount();
- return this;
- }
-
- /**
- * @param obj - can be any object which will marshal into a valid A&AI payload
- * @param uri
- * @return
- */
- public AAISingleTransactionClient update(AAIResourceUri uri, Object obj) {
-
- final String payload = getPatchConverter().convertPatchFormat(obj);
- request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri.build().toString()).withBody(payload));
- incrementActionAmount();
- return this;
- }
-
- private void incrementActionAmount() {
- actionCount++;
- }
- /**
- * Executes all created transactions in A&AI
- * @throws BulkProcessFailed
+ /* (non-Javadoc)
+ * @see org.onap.so.client.aai.GraphInventoryTransactionClient#execute()
*/
+ @Override
public void execute() throws BulkProcessFailed {
- RestClient client = this.createClient(AAIUriFactory.createResourceUri(AAIObjectType.SINGLE_TRANSACTION));
+ RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.SINGLE_TRANSACTION));
try {
SingleTransactionResponse response = client.post(this.request, SingleTransactionResponse.class);
if (response != null) {
@@ -235,33 +102,44 @@ public class AAISingleTransactionClient extends AAIClient {
return Optional.empty();
}
}
+
- private Relationship buildRelationship(AAIResourceUri uri) {
- return buildRelationship(uri, Optional.empty());
+ protected SingleTransactionRequest getRequest() {
+ return this.request;
}
-
- private Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) {
- return buildRelationship(uri, Optional.of(label));
+
+ @Override
+ public void put(String uri, Object body) {
+ request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body));
}
- private Relationship buildRelationship(AAIResourceUri uri, Optional<AAIEdgeLabel> label) {
- final Relationship result = new Relationship();
- result.setRelatedLink(uri.build().toString());
- if (label.isPresent()) {
- result.setRelationshipLabel(label.toString());
- }
- return result;
+
+ @Override
+ public void delete(String uri, Object body) {
+ request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(body));
}
@Override
- protected AAIVersion getVersion() {
- return this.version;
+ public void patch(String uri, Object body) {
+ request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri).withBody(body));
+ }
+
+ @Override
+ protected <T> Optional<T> get(GenericType<T> genericType, AAIResourceUri clone) {
+ return resourcesClient.get(genericType, clone);
}
- protected SingleTransactionRequest getRequest() {
- return this.request;
+ @Override
+ protected boolean exists(AAIResourceUri uri) {
+ return resourcesClient.exists(uri);
+ }
+
+ @Override
+ protected String getGraphDBName() {
+ return aaiClient.getGraphDBName();
}
- protected AAIPatchConverter getPatchConverter() {
+ @Override
+ protected GraphInventoryPatchConverter getPatchConverter() {
return this.patchConverter;
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
index 118a3edf1c..474ae89ff9 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
@@ -20,17 +20,13 @@
package org.onap.so.client.aai;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-
import java.io.IOException;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
-import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
@@ -42,8 +38,9 @@ import org.onap.so.client.aai.entities.bulkprocess.OperationBody;
import org.onap.so.client.aai.entities.bulkprocess.Transaction;
import org.onap.so.client.aai.entities.bulkprocess.Transactions;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
+import org.onap.so.client.graphinventory.GraphInventoryTransactionClient;
import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
import org.onap.so.jsonpath.JsonPathUtil;
@@ -51,18 +48,17 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Joiner;
-public class AAITransactionalClient extends AAIClient {
+public class AAITransactionalClient extends GraphInventoryTransactionClient<AAITransactionalClient, AAIResourceUri, AAIEdgeLabel> {
private final Transactions transactions;
private Transaction currentTransaction;
- private final AAIVersion version;
- private int actionCount = 0;
-
- private final AAIPatchConverter patchConverter = new AAIPatchConverter();
- protected AAITransactionalClient(AAIVersion version) {
+ private AAIResourcesClient resourcesClient;
+ private AAIClient aaiClient;
+ protected AAITransactionalClient(AAIResourcesClient resourcesClient, AAIClient aaiClient) {
super();
- this.version = version;
+ this.resourcesClient = resourcesClient;
+ this.aaiClient = aaiClient;
this.transactions = new Transactions();
startTransaction();
}
@@ -73,146 +69,20 @@ public class AAITransactionalClient extends AAIClient {
currentTransaction = transaction;
}
- /**
- * adds an additional transaction and closes the previous transaction
- *
- * @return AAITransactionalClient
+ /* (non-Javadoc)
+ * @see org.onap.so.client.aai.GraphInventoryTransactionalClient#beginNewTransaction()
*/
public AAITransactionalClient beginNewTransaction() {
startTransaction();
return this;
}
- /**
- * creates a new object in A&AI
- *
- * @param obj - can be any object which will marshal into a valid A&AI payload
- * @param uri
- * @return
- */
- public AAITransactionalClient create(AAIResourceUri uri, Object obj) {
- currentTransaction.getPut().add(new OperationBody().withUri(uri.build().toString()).withBody(obj));
- incrementActionAmount();
- return this;
- }
-
- /**
- * creates a new object in A&AI with no payload body
- *
- * @param uri
- * @return
- */
- public AAITransactionalClient createEmpty(AAIResourceUri uri) {
- currentTransaction.getPut().add(new OperationBody().withUri(uri.build().toString()).withBody(new HashMap<String, String>()));
- incrementActionAmount();
- return this;
- }
-
- /**
- * Adds a relationship between two objects in A&AI
- * @param uriA
- * @param uriB
- * @return
- */
- public AAITransactionalClient connect(AAIResourceUri uriA, AAIResourceUri uriB) {
- AAIResourceUri uriAClone = uriA.clone();
- currentTransaction.getPut().add(new OperationBody().withUri(uriAClone.relationshipAPI().build().toString()).withBody(this.buildRelationship(uriB)));
- incrementActionAmount();
- return this;
- }
-
- /**
- * relationship between multiple objects in A&AI - connects A to all objects specified in list
- *
- * @param uriA
- * @param uris
- * @return
- */
- public AAITransactionalClient connect(AAIResourceUri uriA, List<AAIResourceUri> uris) {
- for (AAIResourceUri uri : uris) {
- this.connect(uriA, uri);
- }
- return this;
- }
-
- public AAITransactionalClient connect(AAIResourceUri uriA, AAIResourceUri uriB, AAIEdgeLabel label) {
- AAIResourceUri uriAClone = uriA.clone();
- RestClient aaiRC = this.createClient(uriAClone.relationshipAPI());
- aaiRC.put(this.buildRelationship(uriB, label));
- return this;
- }
-
- public AAITransactionalClient connect(AAIResourceUri uriA, List<AAIResourceUri> uris, AAIEdgeLabel label) {
- for (AAIResourceUri uri : uris) {
- this.connect(uriA, uri, label);
- }
- return this;
- }
-
- /**
- * Removes relationship from two objects in A&AI
- *
- * @param uriA
- * @param uriB
- * @return
- */
- public AAITransactionalClient disconnect(AAIResourceUri uriA, AAIResourceUri uriB) {
- AAIResourceUri uriAClone = uriA.clone();
- currentTransaction.getDelete().add(new OperationBody().withUri(uriAClone.relationshipAPI().build().toString()).withBody(this.buildRelationship(uriB)));
- incrementActionAmount();
- return this;
- }
-
- /**
- * Removes relationship from multiple objects - disconnects A from all objects specified in list
- * @param uriA
- * @param uris
- * @return
- */
- public AAITransactionalClient disconnect(AAIResourceUri uriA, List<AAIResourceUri> uris) {
- for (AAIResourceUri uri : uris) {
- this.disconnect(uriA, uri);
- }
- return this;
- }
- /**
- * Deletes object from A&AI. Automatically handles resource-version.
- *
- * @param uri
- * @return
- */
- public AAITransactionalClient delete(AAIResourceUri uri) {
- AAIResourcesClient client = new AAIResourcesClient();
- AAIResourceUri clone = uri.clone();
- Map<String, Object> result = client.get(new GenericType<Map<String, Object>>(){}, clone)
- .orElseThrow(() -> new NotFoundException(clone.build() + " does not exist in A&AI"));
- String resourceVersion = (String) result.get("resource-version");
- currentTransaction.getDelete().add(new OperationBody().withUri(clone.resourceVersion(resourceVersion).build().toString()).withBody(""));
- incrementActionAmount();
- return this;
- }
-
- /**
- * @param obj - can be any object which will marshal into a valid A&AI payload
- * @param uri
- * @return
- */
- public AAITransactionalClient update(AAIResourceUri uri, Object obj) {
- final String payload = getPatchConverter().convertPatchFormat(obj);
- currentTransaction.getPatch().add(new OperationBody().withUri(uri.build().toString()).withBody(payload));
- incrementActionAmount();
- return this;
- }
-
- private void incrementActionAmount() {
- actionCount++;
- }
- /**
- * Executes all created transactions in A&AI
- * @throws BulkProcessFailed
+ /* (non-Javadoc)
+ * @see org.onap.so.client.aai.GraphInventoryTransactionalClient#execute()
*/
+ @Override
public void execute() throws BulkProcessFailed {
- RestClient client = this.createClient(AAIUriFactory.createResourceUri(AAIObjectType.BULK_PROCESS));
+ RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.BULK_PROCESS));
try {
Response response = client.put(this.transactions);
if (response.hasEntity()) {
@@ -283,17 +153,44 @@ public class AAITransactionalClient extends AAIClient {
}
return result;
}
+
+ protected Transactions getTransactions() {
+ return this.transactions;
+ }
+
+ @Override
+ public void put(String uri, Object body) {
+ currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body));
+ }
+
+ @Override
+ public void delete(String uri, Object body) {
+ currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(body));
+
+ }
+
+ @Override
+ public void patch(String uri, Object body) {
+ currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body));
+ }
@Override
- protected AAIVersion getVersion() {
- return this.version;
+ protected <T> Optional<T> get(GenericType<T> genericType, AAIResourceUri clone) {
+ return resourcesClient.get(genericType, clone);
}
- protected Transactions getTransactions() {
- return this.transactions;
+ @Override
+ protected boolean exists(AAIResourceUri uri) {
+ return resourcesClient.exists(uri);
+ }
+
+ @Override
+ protected String getGraphDBName() {
+ return aaiClient.getGraphDBName();
}
- protected AAIPatchConverter getPatchConverter() {
+ @Override
+ protected GraphInventoryPatchConverter getPatchConverter() {
return this.patchConverter;
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
index 77ea9bcdfe..9b3f98baa4 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
@@ -20,96 +20,22 @@
package org.onap.so.client.aai.entities;
-import java.io.IOException;
import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-
-import org.onap.so.client.aai.AAICommonObjectMapperProvider;
-import org.onap.so.jsonpath.JsonPathUtil;
+import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class AAIResultWrapper implements Serializable {
+public class AAIResultWrapper extends GraphInventoryResultWrapper implements Serializable {
private static final long serialVersionUID = 5895841925807816737L;
- private final String jsonBody;
- private final ObjectMapper mapper;
- private final transient Logger logger = LoggerFactory.getLogger(AAIResultWrapper.class);
+ private final static transient Logger logger = LoggerFactory.getLogger(AAIResultWrapper.class);
public AAIResultWrapper(String json) {
- this.jsonBody = json;
- this.mapper = new AAICommonObjectMapperProvider().getMapper();
+ super(json, logger);
}
public AAIResultWrapper(Object aaiObject) {
- this.mapper = new AAICommonObjectMapperProvider().getMapper();
- this.jsonBody = mapObjectToString(aaiObject);
- }
-
- protected String mapObjectToString(Object aaiObject) {
- try {
- return mapper.writeValueAsString(aaiObject);
- } catch (JsonProcessingException e) {
- logger.warn("could not parse object into json - defaulting to {}");
- return "{}";
- }
+ super(aaiObject, logger);
}
- public Optional<Relationships> getRelationships() {
- final String path = "$.relationship-list";
- if (isEmpty()) {
- return Optional.empty();
- }
- Optional<String> result = JsonPathUtil.getInstance().locateResult(jsonBody, path);
- if (result.isPresent()) {
- return Optional.of(new Relationships(result.get()));
- } else {
- return Optional.empty();
- }
- }
-
- public String getJson() {
- if(jsonBody == null) {
- return "{}";
- } else {
- return jsonBody;
- }
- }
-
- public Map<String, Object> asMap() {
- if (isEmpty()) {
- return new HashMap<>();
- }
- try {
- return mapper.readValue(this.jsonBody, new TypeReference<Map<String, Object>>(){});
- } catch (IOException e) {
- return new HashMap<>();
- }
- }
-
- public <T> Optional<T> asBean(Class<T> clazz) {
- if (isEmpty()) {
- return Optional.empty();
- }
- try {
- return Optional.of(mapper.readValue(this.jsonBody, clazz));
- } catch (IOException e) {
- return Optional.empty();
- }
- }
-
- public boolean isEmpty() {
- return jsonBody == null;
- }
- @Override
- public String toString() {
- return this.getJson();
- }
-
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoException.java b/common/src/main/java/org/onap/so/client/aai/entities/QueryStep.java
index defc904b05..b056fd0e40 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoException.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/QueryStep.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.apihandlerinfra;
+package org.onap.so.client.aai.entities;
-public enum MsoException {
- ServiceException,
- PolicyException,
+@FunctionalInterface
+public interface QueryStep {
+
+
+ public String build();
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
index 76413c2594..7cb37d9c3a 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
@@ -59,6 +59,10 @@ public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
super(parentUri, childType, childValues);
}
+ protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+ super(parentUri, childType);
+ }
+
@Override
public AAISimpleUri relationshipAPI() {
return (AAISimpleUri) super.relationshipAPI();
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
index 77c61089a4..ac0aba3c36 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
@@ -85,6 +85,11 @@ public class AAIUriFactory {
return new AAISimpleUri(parentUri, childType, childValues);
}
+ public static AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+
+ return new AAISimpleUri(parentUri, childType);
+ }
+
/**
* Creates a uri for a plural type e.g. /cloud-infrastructure/pservers
*
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
index dde0b31c90..dea00dd08f 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
@@ -17,10 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.client.dmaap;
import java.io.IOException;
+import java.security.GeneralSecurityException;
import java.util.Base64;
import java.util.Map;
import java.util.Optional;
@@ -31,13 +32,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
-
+import org.onap.so.utils.CryptoUtils;
public abstract class DmaapClient {
-
+
protected static Logger logger = LoggerFactory.getLogger(DmaapClient.class);
protected final Map<String, String> msoProperties;
protected final Properties properties;
+
public DmaapClient(String filepath) throws IOException {
Resource resource = new ClassPathResource(filepath);
DmaapProperties dmaapProperties = DmaapPropertiesLoader.getInstance().getNewImpl();
@@ -48,27 +50,34 @@ public abstract class DmaapClient {
this.msoProperties = dmaapProperties.getProperties();
this.properties = new Properties();
this.properties.load(resource.getInputStream());
- this.properties.put("password", this.deobfuscatePassword(this.getPassword()));
- this.properties.put("username", this.getUserName());
+ try {
+ this.properties.put("auth", CryptoUtils.decrypt(this.getAuth(), this.getKey()).getBytes());
+ } catch (GeneralSecurityException e) {
+ logger.error(e.getMessage(), e);
+ }
+ this.properties.put("key", this.getKey());
this.properties.put("topic", this.getTopic());
Optional<String> host = this.getHost();
if (host.isPresent()) {
this.properties.put("host", host.get());
}
}
- protected String deobfuscatePassword(String password) {
-
+
+ protected String deobfuscatePassword(String decrypted_key) {
+
try {
- return new String(Base64.getDecoder().decode(password.getBytes()));
- } catch(IllegalArgumentException iae) {
- logger.error("llegal Arguments",iae);
- return password;
+ return new String(Base64.getDecoder().decode(decrypted_key.getBytes()));
+ } catch (IllegalArgumentException iae) {
+ logger.error("llegal Arguments", iae);
+ return decrypted_key;
}
}
-
-
- public abstract String getUserName();
- public abstract String getPassword();
+
+ public abstract String getKey();
+
+ public abstract String getAuth();
+
public abstract String getTopic();
+
public abstract Optional<String> getHost();
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
index 0438ff237a..9fd8c05cb5 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
@@ -17,34 +17,37 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.client.dmaap.rest;
import java.net.URL;
-import java.util.Base64;
import java.util.Map;
import org.onap.so.client.RestClient;
+import org.onap.so.utils.CryptoUtils;
import org.onap.so.utils.TargetEntity;
public class DMaaPRestClient extends RestClient {
- private final String username;
- private final String password;
- public DMaaPRestClient(URL url, String contentType, String username, String password) {
+ private final String auth;
+ private final String key;
+
+ public DMaaPRestClient(URL url, String contentType, String auth, String key) {
super(url, contentType);
- this.username = username;
- this.password = password;
+ this.auth = auth;
+ this.key = key;
}
- @Override
- public TargetEntity getTargetEntity(){
- return TargetEntity.DMAAP;
- }
+ @Override
+ public TargetEntity getTargetEntity() {
+ return TargetEntity.DMAAP;
+ }
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
- headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes()));
+ if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
+ addBasicAuthHeader(auth, key);
+ }
}
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java b/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java
index f43c65808a..18849217f8 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java
@@ -24,8 +24,8 @@ import java.util.Properties;
public class PropertiesBean {
- private String username;
- private String password;
+ private String auth;
+ private String key;
private String environment;
private String partition;
private String contentType;
@@ -35,8 +35,8 @@ public class PropertiesBean {
public PropertiesBean(Properties properties) {
- this.withUsername(properties.getProperty("username"))
- .withPassword(properties.getProperty("password"))
+ this.withAuth(properties.getProperty("auth"))
+ .withKey(properties.getProperty("key"))
.withTopic(properties.getProperty("topic"))
.withEnvironment(properties.getProperty("environment"))
.withHost(properties.getProperty("host"))
@@ -44,24 +44,24 @@ public class PropertiesBean {
.withPartition(properties.getProperty("partition"))
.withContentType(properties.getProperty("contentType", "application/json"));
}
- public String getUsername() {
- return username;
+ public String getAuth() {
+ return auth;
}
- public void setUsername(String username) {
- this.username = username;
+ public void setAuth(String auth) {
+ this.auth = auth;
}
- public PropertiesBean withUsername(String username) {
- this.username = username;
+ public PropertiesBean withAuth(String auth) {
+ this.auth = auth;
return this;
}
- public String getPassword() {
- return password;
+ public String getKey() {
+ return key;
}
- public void setPassword(String password) {
- this.password = password;
+ public void setKey(String key) {
+ this.key = key;
}
- public PropertiesBean withPassword(String password) {
- this.password = password;
+ public PropertiesBean withKey(String key) {
+ this.key = key;
return this;
}
public String getEnvironment() {
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java
index 39af15635a..bee5a0c2ca 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java
@@ -37,7 +37,7 @@ public class RestConsumer implements Consumer {
private final RestClient client;
public RestConsumer(Properties properties) {
PropertiesBean bean = new PropertiesBean(properties);
- client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getUsername(), bean.getPassword());
+ client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getAuth(), bean.getKey());
}
private URL createURL(PropertiesBean properties) {
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java b/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java
index 090e50543b..af660c2aa4 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java
@@ -35,7 +35,7 @@ public class RestPublisher implements Publisher {
public RestPublisher(Properties properties) {
PropertiesBean bean = new PropertiesBean(properties);
- client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getUsername(), bean.getPassword());
+ client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getAuth(), bean.getKey());
}
private URL createURL(PropertiesBean properties) {
diff --git a/common/src/main/java/org/onap/so/client/aai/EmptyStringToNullSerializer.java b/common/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java
index 1120ebe0b9..e21386f809 100644
--- a/common/src/main/java/org/onap/so/client/aai/EmptyStringToNullSerializer.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.aai;
+package org.onap.so.client.graphinventory;
import java.io.IOException;
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/Format.java b/common/src/main/java/org/onap/so/client/graphinventory/Format.java
index 5cbf1320c1..0a3e0b498c 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/Format.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/Format.java
@@ -23,6 +23,7 @@ package org.onap.so.client.graphinventory;
public enum Format {
RESOURCE("resource"),
+ RESOURCE_AND_URL("resource_and_url"),
SIMPLE("simple"),
RAW("raw"),
CONSOLE("console"),
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
index 0d10c21886..30e91dce03 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
@@ -37,12 +37,16 @@ public abstract class GraphInventoryClient {
}
protected abstract URI constructPath(GraphInventoryUri uri);
- protected abstract RestClient createClient(GraphInventoryUri uri);
+ public abstract RestClient createClient(GraphInventoryUri uri);
- protected <T extends RestProperties> T getRestProperties() {
+ public <T extends RestProperties> T getRestProperties() {
if (props == null) {
throw new IllegalStateException("No RestProperty implementation found on classpath");
}
return (T)props;
}
+
+ public abstract GraphInventoryVersion getVersion();
+
+ public abstract String getGraphDBName();
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java
index ed4e8c9305..47c9e77b84 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java
@@ -18,27 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.apihandler.beans.avpnbondingbeans;
+package org.onap.so.client.graphinventory;
-public enum AVPNServiceNames {
- AVPN_BONDING_TO_COLLABORATE("AVPNBondingToCollaborate"),
- AVPN_BONDING_TO_IP_FLEX_REACH("AVPNBondingToIPFlexReach"),
- AVPN_BONDING_TO_IP_TOLL_FREE("AVPNBondingToIPTollFree");
+import com.fasterxml.jackson.databind.module.SimpleModule;
- private String serviceName;
+public class GraphInventoryCommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperProvider {
- AVPNServiceNames(String serviceName){
- this.serviceName=serviceName;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- @Override
- public String toString() {
- return "AVPNServiceNames{" +
- "serviceName='" + serviceName + '\'' +
- '}';
- }
+
+ public GraphInventoryCommonObjectMapperPatchProvider() {
+ super();
+ EmptyStringToNullSerializer sp = new EmptyStringToNullSerializer();
+ SimpleModule emptyStringModule = new SimpleModule();
+ emptyStringModule.addSerializer(String.class, sp);
+ mapper.registerModule(emptyStringModule);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
new file mode 100644
index 0000000000..f9857424a2
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory;
+
+import org.onap.so.client.policy.CommonObjectMapperProvider;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.AnnotationIntrospector;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
+
+public class GraphInventoryCommonObjectMapperProvider extends CommonObjectMapperProvider {
+
+ public GraphInventoryCommonObjectMapperProvider() {
+ mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ mapper.enable(MapperFeature.USE_ANNOTATIONS);
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
+ AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector();
+ // first Jaxb, second Jackson annotations
+ mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson));
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIPatchConverter.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java
index 6ccb592409..00e597b189 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIPatchConverter.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java
@@ -18,29 +18,31 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.aai;
+package org.onap.so.client.graphinventory;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
+import org.onap.so.client.aai.AAICommonObjectMapperPatchProvider;
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
import org.onap.so.jsonpath.JsonPathUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
-public class AAIPatchConverter {
+public class GraphInventoryPatchConverter {
private static final AAICommonObjectMapperProvider standardProvider = new AAICommonObjectMapperProvider();
private static final AAICommonObjectMapperPatchProvider patchProvider = new AAICommonObjectMapperPatchProvider();
private static final Pattern LOCATE_COMPLEX_OBJECT = Pattern.compile("^((?!relationship-list).)+?\\['[^\\[\\]]+?'\\]$");
- protected String convertPatchFormat(Object obj) {
+ public String convertPatchFormat(Object obj) {
return validatePatchObject(marshallObjectToPatchFormat(obj));
}
- protected String validatePatchObject(String payload) {
+ public String validatePatchObject(String payload) {
if (hasComplexObject(payload)) {
throw new GraphInventoryPatchDepthExceededException(payload);
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java
new file mode 100644
index 0000000000..aa4842fe2a
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory;
+
+import java.util.Optional;
+
+import org.onap.so.client.aai.entities.CustomQuery;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
+
+public abstract class GraphInventoryQueryClient<S> {
+
+ private Optional<String> depth = Optional.empty();
+ private boolean nodesOnly = false;
+ private Optional<GraphInventorySubgraphType> subgraph = Optional.empty();
+ private GraphInventoryClient client;
+
+ public GraphInventoryQueryClient(GraphInventoryClient client) {
+ this.client = client;
+ }
+
+ protected abstract GraphInventoryUri getQueryUri();
+
+ public String query(Format format, CustomQuery query) {
+ return client.createClient(setupQueryParams(getQueryUri().queryParam("format", format.toString()))).put(query, String.class);
+ }
+
+ public S depth (String depth) {
+ this.depth = Optional.of(depth);
+ return (S) this;
+ }
+ public S nodesOnly() {
+ this.nodesOnly = true;
+ return (S) this;
+ }
+ public S subgraph(GraphInventorySubgraphType type){
+
+ subgraph = Optional.of(type);
+
+ return (S) this;
+ }
+
+ protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) {
+ GraphInventoryUri clone = uri.clone();
+ if (this.depth.isPresent()) {
+ clone.queryParam("depth", depth.get());
+ }
+ if (this.nodesOnly) {
+ clone.queryParam("nodesOnly", "");
+ }
+ if (this.subgraph.isPresent()) {
+ clone.queryParam("subgraph", this.subgraph.get().toString());
+ }
+ return clone;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
new file mode 100644
index 0000000000..39d2d01da9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
@@ -0,0 +1,306 @@
+package org.onap.so.client.graphinventory;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+import java.util.Optional;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.RestProperties;
+import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
+import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
+
+public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
+
+ protected GraphInventoryClient client;
+
+ protected GraphInventoryResourcesClient(GraphInventoryClient client) {
+ this.client = client;
+ }
+ /**
+ * creates a new object in GraphInventory
+ *
+ * @param obj - can be any object which will marshal into a valid GraphInventory payload
+ * @param uri
+ * @return
+ */
+ public void create(Uri uri, Object obj) {
+ RestClient giRC = client.createClient(uri);
+ giRC.put(obj);
+ }
+
+ /**
+ * creates a new object in GraphInventory with no payload body
+ *
+ * @param uri
+ * @return
+ */
+ public void createEmpty(Uri uri) {
+ RestClient giRC = client.createClient(uri);
+ giRC.put("");
+ }
+
+ /**
+ * returns false if the object does not exist in GraphInventory
+ *
+ * @param uri
+ * @return
+ */
+ public boolean exists(Uri uri) {
+ GraphInventoryUri forceMinimal = this.addParams(Optional.of(Depth.ZERO), true, uri);
+ try {
+ RestClient giRC = client.createClient(forceMinimal);
+
+ return giRC.get().getStatus() == Status.OK.getStatusCode();
+ } catch (NotFoundException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Adds a relationship between two objects in GraphInventory
+ * @param uriA
+ * @param uriB
+ * @return
+ */
+ public void connect(Uri uriA, Uri uriB) {
+ GraphInventoryResourceUri uriAClone = uriA.clone();
+ RestClient giRC = client.createClient(uriAClone.relationshipAPI());
+ giRC.put(this.buildRelationship(uriB));
+ }
+
+ /**
+ * Adds a relationship between two objects in GraphInventory
+ * with a given edge label
+ * @param uriA
+ * @param uriB
+ * @param edge label
+ * @return
+ */
+ public void connect(Uri uriA, Uri uriB, EdgeLabel label) {
+ GraphInventoryResourceUri uriAClone = uriA.clone();
+ RestClient giRC = client.createClient(uriAClone.relationshipAPI());
+ giRC.put(this.buildRelationship(uriB, label));
+ }
+
+ /**
+ * Removes relationship from two objects in GraphInventory
+ *
+ * @param uriA
+ * @param uriB
+ * @return
+ */
+ public void disconnect(Uri uriA, Uri uriB) {
+ GraphInventoryResourceUri uriAClone = uriA.clone();
+ RestClient giRC = client.createClient(uriAClone.relationshipAPI());
+ giRC.delete(this.buildRelationship(uriB));
+ }
+
+ /**
+ * Deletes object from GraphInventory. Automatically handles resource-version.
+ *
+ * @param uri
+ * @return
+ */
+ public void delete(Uri uri) {
+ GraphInventoryResourceUri clone = uri.clone();
+ RestClient giRC = client.createClient(clone);
+ Map<String, Object> result = giRC.get(new GenericType<Map<String, Object>>(){})
+ .orElseThrow(() -> new NotFoundException(clone.build() + " does not exist in " + client.getGraphDBName()));
+ String resourceVersion = (String) result.get("resource-version");
+ giRC = client.createClient(clone.resourceVersion(resourceVersion));
+ giRC.delete();
+ }
+
+ /**
+ * @param obj - can be any object which will marshal into a valid GraphInventory payload
+ * @param uri
+ * @return
+ */
+ public void update(Uri uri, Object obj) {
+ RestClient giRC = client.createClient(uri);
+ giRC.patch(obj);
+ }
+
+ /**
+ * Retrieves an object from GraphInventory and unmarshalls it into the Class specified
+ * @param clazz
+ * @param uri
+ * @return
+ */
+ public <T> Optional<T> get(Class<T> clazz, Uri uri) {
+ try {
+ return client.createClient(uri).get(clazz);
+ } catch (NotFoundException e) {
+ if (this.getRestProperties().mapNotFoundToEmpty()) {
+ return Optional.empty();
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ /**
+ * Retrieves an object from GraphInventory and returns complete response
+ * @param uri
+ * @return
+ */
+ public Response getFullResponse(Uri uri) {
+ try {
+ return client.createClient(uri).get();
+ } catch (NotFoundException e) {
+ if (this.getRestProperties().mapNotFoundToEmpty()) {
+ return e.getResponse();
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ /**
+ * Retrieves an object from GraphInventory and automatically unmarshalls it into a Map or List
+ * @param resultClass
+ * @param uri
+ * @return
+ */
+ public <T> Optional<T> get(GenericType<T> resultClass, Uri uri) {
+ try {
+ return client.createClient(uri).get(resultClass);
+ } catch (NotFoundException e) {
+ if (this.getRestProperties().mapNotFoundToEmpty()) {
+ return Optional.empty();
+ } else {
+ throw e;
+ }
+ }
+ }
+ /**
+ * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features
+ *
+ * @param uri
+ * @return
+ */
+ public Wrapper get(Uri uri) {
+ String json;
+ try {
+ json = client.createClient(uri).get(String.class).orElse(null);
+ } catch (NotFoundException e) {
+ if (this.getRestProperties().mapNotFoundToEmpty()) {
+ json = null;
+ } else {
+ throw e;
+ }
+ }
+ return this.createWrapper(json);
+ }
+
+ /**
+ * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features
+ * If the object cannot be found in GraphInventory the method will throw the runtime exception
+ * included as an argument
+ * @param uri
+ * @return
+ */
+ public Wrapper get(Uri uri, Class<? extends RuntimeException> c) {
+ String json;
+ try {
+ json = client.createClient(uri).get(String.class)
+ .orElseThrow(() -> createException(c, uri.build() + " not found in " + client.getGraphDBName(), Optional.empty()));
+ } catch (NotFoundException e) {
+ throw createException(c, "could not construct uri for use with " + client.getGraphDBName(), Optional.of(e));
+ }
+
+ return this.createWrapper(json);
+ }
+
+ private RuntimeException createException(Class<? extends RuntimeException> c, String message, Optional<Throwable> t) {
+ RuntimeException e;
+ try {
+ if (t.isPresent()) {
+ e = c.getConstructor(String.class, Throwable.class).newInstance(message, t.get());
+ } else {
+ e = c.getConstructor(String.class).newInstance(message);
+ }
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
+ | NoSuchMethodException | SecurityException e1) {
+ throw new IllegalArgumentException("could not create instance for " + c.getName());
+ }
+
+ return e;
+ }
+
+ /**
+ * Will automatically create the object if it does not exist
+ *
+ * @param obj - Optional object which serializes to a valid GraphInventory payload
+ * @param uri
+ * @return
+ */
+ public Self createIfNotExists(Uri uri, Optional<Object> obj) {
+ if(!this.exists(uri)){
+ if (obj.isPresent()) {
+ this.create(uri, obj.get());
+ } else {
+ this.createEmpty(uri);
+ }
+
+ }
+ return (Self)this;
+ }
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri) {
+ return buildRelationship(uri, Optional.empty());
+ }
+
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri, GraphInventoryEdgeLabel label) {
+ return buildRelationship(uri, Optional.of(label));
+ }
+ protected Relationship buildRelationship(GraphInventoryResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
+ final Relationship result = new Relationship();
+ result.setRelatedLink(uri.build().toString());
+ if (label.isPresent()) {
+ result.setRelationshipLabel(label.get().toString());
+ }
+ return result;
+ }
+
+ public abstract Wrapper createWrapper(String json);
+
+ /**
+ * Starts a transaction which encloses multiple GraphInventory mutations
+ *
+ * @return
+ */
+ public abstract TransactionalClient beginTransaction();
+
+ /**
+ * Starts a transaction groups multiple GraphInventory mutations
+ *
+ * @return
+ */
+ public abstract SingleTransactionClient beginSingleTransaction();
+
+ private GraphInventoryUri addParams(Optional<Depth> depth, boolean nodesOnly, GraphInventoryUri uri) {
+ GraphInventoryUri clone = uri.clone();
+ if (depth.isPresent()) {
+ clone.depth(depth.get());
+ }
+ if (nodesOnly) {
+ clone.nodesOnly(nodesOnly);
+ }
+
+ return clone;
+ }
+
+ public <T extends RestProperties> T getRestProperties() {
+ return client.getRestProperties();
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/client/aai/AAISubgraphType.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java
index e9beb143fd..4bbbe202cc 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAISubgraphType.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java
@@ -18,16 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.aai;
+package org.onap.so.client.graphinventory;
-public enum AAISubgraphType {
+public enum GraphInventorySubgraphType {
STAR("star"),
PRUNE("prune");
private final String name;
- private AAISubgraphType(String name) {
+ private GraphInventorySubgraphType(String name) {
this.name = name;
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
new file mode 100644
index 0000000000..8d1a945c1b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
@@ -0,0 +1,240 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.GenericType;
+
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.so.client.aai.AAIVersion;
+import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest;
+import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> implements TransactionBuilder {
+
+ protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class);
+
+ protected int actionCount = 0;
+
+ protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter();
+
+ protected GraphInventoryTransactionClient() {
+ }
+
+ /**
+ * creates a new object in A&AI
+ *
+ * @param obj - can be any object which will marshal into a valid A&AI payload
+ * @param uri
+ * @return
+ */
+ public Self create(Uri uri, Object obj) {
+ this.put(uri.build().toString(), obj);
+ incrementActionAmount();
+ return (Self)this;
+ }
+
+ /**
+ * creates a new object in A&AI with no payload body
+ *
+ * @param uri
+ * @return
+ */
+ public Self createEmpty(Uri uri) {
+ this.put(uri.build().toString(), new HashMap<String, String>());
+ incrementActionAmount();
+ return (Self)this;
+ }
+
+ /**
+ * Will automatically create the object if it does not exist
+ *
+ * @param obj - Optional object which serializes to a valid GraphInventory payload
+ * @param uri
+ * @return
+ */
+ public Self createIfNotExists(Uri uri, Optional<Object> obj) {
+ if(!this.exists(uri)){
+ if (obj.isPresent()) {
+ this.create(uri, obj.get());
+ incrementActionAmount();
+ } else {
+ this.createEmpty(uri);
+ incrementActionAmount();
+ }
+
+ }
+ return (Self)this;
+ }
+
+ /**
+ * Adds a relationship between two objects in A&AI
+ * @param uriA
+ * @param uriB
+ * @return
+ */
+ public Self connect(Uri uriA, Uri uriB) {
+ GraphInventoryResourceUri uriAClone = uriA.clone();
+ this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB));
+ incrementActionAmount();
+ return (Self)this;
+ }
+
+ /**
+ * relationship between multiple objects in A&AI - connects A to all objects specified in list
+ *
+ * @param uriA
+ * @param uris
+ * @return
+ */
+ public Self connect(Uri uriA, List<Uri> uris) {
+ for (Uri uri : uris) {
+ this.connect(uriA, uri);
+ }
+ return (Self)this;
+ }
+
+ /**
+ * relationship between multiple objects in A&AI - connects A to all objects specified in list
+ *
+ * @param uriA
+ * @param uris
+ * @return
+ */
+ public Self connect(Uri uriA, Uri uriB, EdgeLabel label) {
+ GraphInventoryResourceUri uriAClone = uriA.clone();
+ this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB, label));
+ return (Self)this;
+ }
+
+ /**
+ * relationship between multiple objects in A&AI - connects A to all objects specified in list
+ *
+ * @param uriA
+ * @param uris
+ * @return
+ */
+ public Self connect(Uri uriA, List<Uri> uris, EdgeLabel label) {
+ for (Uri uri : uris) {
+ this.connect(uriA, uri, label);
+ }
+ return (Self)this;
+ }
+
+ /**
+ * Removes relationship from two objects in A&AI
+ *
+ * @param uriA
+ * @param uriB
+ * @return
+ */
+ public Self disconnect(Uri uriA, Uri uriB) {
+ GraphInventoryResourceUri uriAClone = uriA.clone();
+ this.delete(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB));
+ incrementActionAmount();
+ return (Self)this;
+ }
+
+ /**
+ * Removes relationship from multiple objects - disconnects A from all objects specified in list
+ * @param uriA
+ * @param uris
+ * @return
+ */
+ public Self disconnect(Uri uriA, List<Uri> uris) {
+ for (Uri uri : uris) {
+ this.disconnect(uriA, uri);
+ }
+ return (Self)this;
+ }
+ /**
+ * Deletes object from A&AI. Automatically handles resource-version.
+ *
+ * @param uri
+ * @return
+ */
+ public Self delete(Uri uri) {
+ Map<String, Object> result = this.get(new GenericType<Map<String, Object>>(){}, (Uri)uri.clone())
+ .orElseThrow(() -> new NotFoundException(uri.build() + " does not exist in " + this.getGraphDBName()));
+ String resourceVersion = (String) result.get("resource-version");
+ this.delete(uri.resourceVersion(resourceVersion).build().toString(), "");
+ incrementActionAmount();
+ return (Self)this;
+ }
+
+ protected abstract <T> Optional<T> get(GenericType<T> genericType, Uri clone);
+
+ protected abstract boolean exists(Uri uri);
+
+ protected abstract String getGraphDBName();
+
+ /**
+ * @param obj - can be any object which will marshal into a valid A&AI payload
+ * @param uri
+ * @return
+ */
+ public Self update(Uri uri, Object obj) {
+
+ final String payload = getPatchConverter().convertPatchFormat(obj);
+ this.patch(uri.build().toString(), payload);
+ incrementActionAmount();
+ return (Self)this;
+ }
+
+ private void incrementActionAmount() {
+ actionCount++;
+ }
+ /**
+ * Executes all created transactions in A&AI
+ * @throws BulkProcessFailed
+ */
+ public abstract void execute() throws BulkProcessFailed;
+
+ private Relationship buildRelationship(Uri uri) {
+ return buildRelationship(uri, Optional.empty());
+ }
+
+ private Relationship buildRelationship(Uri uri, EdgeLabel label) {
+ return buildRelationship(uri, Optional.of(label));
+ }
+ private Relationship buildRelationship(Uri uri, Optional<EdgeLabel> label) {
+ final Relationship result = new Relationship();
+ result.setRelatedLink(uri.build().toString());
+ if (label.isPresent()) {
+ result.setRelationshipLabel(label.toString());
+ }
+ return result;
+ }
+
+ protected GraphInventoryPatchConverter getPatchConverter() {
+ return this.patchConverter;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java
new file mode 100644
index 0000000000..2cab4b5654
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java
@@ -0,0 +1,10 @@
+package org.onap.so.client.graphinventory;
+
+public interface TransactionBuilder {
+
+
+ void put(String uri, Object body);
+ void delete(String uri, Object body);
+ void patch(String uri,Object body);
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
new file mode 100644
index 0000000000..7da1408f2d
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory.entities;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.onap.so.client.aai.entities.QueryStep;
+import org.onap.so.client.graphinventory.GraphInventoryObjectName;
+
+public class DSLNode implements QueryStep {
+
+ private final String nodeName;
+ private final List<DSLNodeKey> nodeKeys;
+ private final StringBuilder query = new StringBuilder();
+ private boolean output = false;
+
+ public DSLNode() {
+ this.nodeName = "";
+ this.nodeKeys = new ArrayList<>();
+
+ }
+ public DSLNode(GraphInventoryObjectName name) {
+ this.nodeName = name.typeName();
+ this.nodeKeys = new ArrayList<>();
+ query.append(nodeName);
+ }
+ public DSLNode(GraphInventoryObjectName name, DSLNodeKey... key) {
+ this.nodeName = name.typeName();
+ this.nodeKeys = Arrays.asList(key);
+ query.append(nodeName);
+ }
+
+ public DSLNode output() {
+ this.output = true;
+
+ return this;
+ }
+
+ public DSLNode and(DSLNodeKey... key) {
+ this.nodeKeys.addAll(Arrays.asList(key));
+
+ return this;
+ }
+
+ @Override
+ public String build() {
+ if (output) {
+ query.append("*");
+ }
+ for (DSLNodeKey key : nodeKeys) {
+ query.append(key.build());
+ }
+
+ return query.toString();
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
new file mode 100644
index 0000000000..159bfb1c29
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory.entities;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.onap.so.client.aai.entities.QueryStep;
+
+import com.google.common.base.Joiner;
+
+
+public class DSLNodeKey implements QueryStep {
+
+ private boolean not = false;
+ private final StringBuilder query = new StringBuilder();
+ private final String keyName;
+ private final List<String> values;
+ public DSLNodeKey(String keyName, String... value) {
+
+ this.keyName = keyName;
+ this.values = Arrays.asList(value);
+ }
+
+ public DSLNodeKey not() {
+
+ this.not = true;
+ return this;
+ }
+
+ @Override
+ public String build() {
+
+ if (not) {
+ query.append(" !");
+ }
+ query.append("('").append(keyName).append("', ");
+ List<String> temp = new ArrayList<>();
+ for (String item : values) {
+ if (item.equals("null")) {
+ temp.add(String.format("' %s '", item));
+ } else if (item.equals("")){
+ temp.add("' '");
+ } else {
+ temp.add(String.format("'%s'", item));
+ }
+ }
+ query.append(Joiner.on(", ").join(temp)).append(")");
+
+ return query.toString();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java
index d8984c0b83..c8ab015b26 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java
@@ -18,26 +18,30 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sniro.beans;
+package org.onap.so.client.graphinventory.entities;
-import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class DSLQuery {
-public class CandidateType implements Serializable{
+ private String dsl;
- private static final long serialVersionUID = 2273215496314532173L;
-
- @JsonProperty("name")
- private String name;
-
-
- public String getName(){
- return name;
+ public DSLQuery() {
+
}
-
- public void setName(String name){
- this.name = name;
+
+ public DSLQuery(String dsl) {
+ this.dsl = dsl;
+ }
+
+ public String getDsl() {
+ return dsl;
}
+ public void setDsl(String dsl) {
+ this.dsl = dsl;
+ }
+
+
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
new file mode 100644
index 0000000000..73dccea8e6
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory.entities;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.onap.so.client.aai.entities.QueryStep;
+
+import com.google.common.base.Joiner;
+
+
+public class DSLQueryBuilder<S, E> implements QueryStep {
+
+ private List<QueryStep> steps = new ArrayList<>();
+
+
+ public DSLQueryBuilder() {
+
+ }
+ public DSLQueryBuilder(DSLNode node) {
+ steps.add(node);
+ }
+
+ public DSLQueryBuilder<S, DSLNode> node(DSLNode node) {
+ steps.add(node);
+
+ return (DSLQueryBuilder<S, DSLNode>) this;
+ }
+ public DSLQueryBuilder<S, E> output() {
+ if (steps.get(steps.size() -1) instanceof DSLNode) {
+ ((DSLNode)steps.get(steps.size() -1)).output();
+ }
+ return this;
+ }
+
+ public <E2> DSLQueryBuilder<S, E2> union(final DSLQueryBuilder<?, E2>... union) {
+
+ List<DSLQueryBuilder<?, ?>> unions = Arrays.asList(union);
+ steps.add(() -> {
+ StringBuilder query = new StringBuilder();
+
+ query.append("> [ ").append(
+ Joiner.on(", ").join(
+ unions.stream().map(item -> item.build()).collect(Collectors.toList())))
+ .append(" ]");
+ return query.toString();
+ });
+
+ return (DSLQueryBuilder<S, E2>) this;
+ }
+
+ public DSLQueryBuilder<S, E> where(DSLQueryBuilder<?, ?> where) {
+
+ steps.add(() -> {
+ StringBuilder query = new StringBuilder();
+ query.append(where.build()).append(")");
+ String result = query.toString();
+ if (!result.startsWith(">")) {
+ result = "> " + result;
+ }
+ return "(" + result;
+ });
+ return this;
+ }
+
+ public DSLQueryBuilder<S, E> to(DSLQueryBuilder<?, ?> to) {
+ steps.add(() -> {
+ StringBuilder query = new StringBuilder();
+
+ query.append("> ").append(to.build());
+ return query.toString();
+ });
+ return this;
+ }
+
+ public String limit(int limit) {
+ return compile() + " LIMIT " + limit;
+ }
+
+ @Override
+ public String build() {
+ return compile();
+ }
+
+ private String compile() {
+ return Joiner.on(" ").join(steps.stream().map(item -> item.build()).collect(Collectors.toList()));
+ }
+
+ protected QueryStep getFirst() {
+ return steps.get(0);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java
new file mode 100644
index 0000000000..cc1ce0063b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory.entities;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.jsonpath.JsonPathUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class GraphInventoryResultWrapper implements Serializable {
+
+ private static final long serialVersionUID = 5895841925807816727L;
+ protected final String jsonBody;
+ protected final ObjectMapper mapper;
+ private final transient Logger logger;
+
+ protected GraphInventoryResultWrapper(String json, Logger logger) {
+ this.jsonBody = json;
+ this.mapper = new AAICommonObjectMapperProvider().getMapper();
+ this.logger = logger;
+ }
+
+ protected GraphInventoryResultWrapper(Object aaiObject, Logger logger) {
+ this.mapper = new AAICommonObjectMapperProvider().getMapper();
+ this.jsonBody = mapObjectToString(aaiObject);
+ this.logger = logger;
+ }
+
+ protected String mapObjectToString(Object aaiObject) {
+ try {
+ return mapper.writeValueAsString(aaiObject);
+ } catch (JsonProcessingException e) {
+ logger.warn("could not parse object into json - defaulting to {}");
+ return "{}";
+ }
+ }
+ public Optional<Relationships> getRelationships() {
+ final String path = "$.relationship-list";
+ if (isEmpty()) {
+ return Optional.empty();
+ }
+ Optional<String> result = JsonPathUtil.getInstance().locateResult(jsonBody, path);
+ if (result.isPresent()) {
+ return Optional.of(new Relationships(result.get()));
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ public String getJson() {
+ if(jsonBody == null) {
+ return "{}";
+ } else {
+ return jsonBody;
+ }
+ }
+
+ public Map<String, Object> asMap() {
+ if (isEmpty()) {
+ return new HashMap<>();
+ }
+ try {
+ return mapper.readValue(this.jsonBody, new TypeReference<Map<String, Object>>(){});
+ } catch (IOException e) {
+ return new HashMap<>();
+ }
+ }
+
+ public <T> Optional<T> asBean(Class<T> clazz) {
+ if (isEmpty()) {
+ return Optional.empty();
+ }
+ try {
+ return Optional.of(mapper.readValue(this.jsonBody, clazz));
+ } catch (IOException e) {
+ return Optional.empty();
+ }
+ }
+
+ public boolean isEmpty() {
+ return jsonBody == null;
+ }
+ @Override
+ public String toString() {
+ return this.getJson();
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
new file mode 100644
index 0000000000..184f412adb
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory.entities;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectName;
+
+public class __ {
+
+ protected __() {
+
+ }
+
+ public static <A> DSLQueryBuilder<A, A> identity() {
+ return new DSLQueryBuilder<>();
+ }
+ public static <A> DSLQueryBuilder<A, A> start(DSLNode node) {
+ return new DSLQueryBuilder<>(node);
+ }
+ public static DSLQueryBuilder<DSLNode, DSLNode> node(GraphInventoryObjectName name) {
+
+ return __.<DSLNode>start(new DSLNode(name));
+ }
+
+ public static DSLQueryBuilder<DSLNode, DSLNode> node(GraphInventoryObjectName name, DSLNodeKey... key) {
+ return __.<DSLNode>start(new DSLNode(name, key));
+ }
+
+ public static DSLNodeKey key(String keyName, String... value) {
+ return new DSLNodeKey(keyName, value);
+ }
+
+ public static <A, B> DSLQueryBuilder<A, B> union(final DSLQueryBuilder<?, B>... traversal) {
+
+ return __.<A>identity().union(traversal);
+ }
+
+public static <A> DSLQueryBuilder<A, A> where(DSLQueryBuilder<A, A> traversal) {
+
+ return __.<A>identity().where(traversal);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
index 93de9139f9..dc4179a86f 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
@@ -98,6 +98,13 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
validateValuesSize(childType.partialUri(), values);
}
+ protected SimpleUri(GraphInventoryResourceUri parentUri, GraphInventoryObjectPlurals childType) {
+ this.type = null;
+ this.pluralType = childType;
+ this.internalURI = UriBuilder.fromUri(parentUri.build()).path(childType.partialUri());
+ this.values = new Object[0];
+ }
+
protected void setInternalURI(UriBuilder builder) {
this.internalURI = builder;
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java
index c94e561274..121708fc46 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.client.graphinventory.exceptions;
public class IncorrectNumberOfUriKeys extends RuntimeException {
diff --git a/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java b/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
index 1d4e014300..93a2d96c5e 100644
--- a/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
+++ b/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
@@ -32,13 +32,13 @@ public class RubyCreateTicketRequestPublisher extends DmaapPublisher{
}
@Override
- public String getUserName() {
- return msoProperties.get("ruby.create-ticket-request.dmaap.username");
+ public String getAuth() {
+ return msoProperties.get("ruby.create-ticket-request.dmaap.auth");
}
@Override
- public String getPassword() {
- return msoProperties.get("ruby.create-ticket-request.dmaap.password");
+ public String getKey() {
+ return msoProperties.get("mso.msoKey");
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
index 8154b9137d..a76c47c805 100644
--- a/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
@@ -42,13 +42,13 @@ public class SDNOHealthCheckDmaapConsumer extends DmaapConsumer {
}
@Override
- public String getUserName() {
- return msoProperties.get("sdno.health-check.dmaap.username");
+ public String getAuth() {
+ return msoProperties.get("sdno.health-check.dmaap.auth");
}
@Override
- public String getPassword() {
- return msoProperties.get("sdno.health-check.dmaap.password");
+ public String getKey() {
+ return msoProperties.get("mso.msoKey");
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
index 2556e67e3c..f4af2052ac 100644
--- a/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
+++ b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
@@ -33,13 +33,13 @@ public class SDNOHealthCheckDmaapPublisher extends DmaapPublisher {
}
@Override
- public String getUserName() {
- return msoProperties.get("sdno.health-check.dmaap.username");
+ public String getAuth() {
+ return msoProperties.get("sdno.health-check.dmaap.auth");
}
@Override
- public String getPassword() {
- return msoProperties.get("sdno.health-check.dmaap.password");
+ public String getKey() {
+ return msoProperties.get("sdno.health-check.dmaap.msoKey");
}
@Override
diff --git a/common/src/main/resources/dmaap/default-consumer.properties b/common/src/main/resources/dmaap/default-consumer.properties
index f19b64242d..3f492e1d33 100644
--- a/common/src/main/resources/dmaap/default-consumer.properties
+++ b/common/src/main/resources/dmaap/default-consumer.properties
@@ -16,6 +16,7 @@ maxBatchSize=100
maxAgeMs=250
group=MSO
id=dev
+timeout=60000
AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler
AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler
AFT_DME2_REQ_TRACE_ON=true
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
index d4eaf0873b..64a83f92ab 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
@@ -80,4 +80,11 @@ public class AAIObjectTypeTest {
assertEquals("/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}", type.uriTemplate());
assertEquals("/p-interfaces/p-interface/{interface-name}", type.partialUri());
}
+
+ @Test
+ public void networkPolicyObjectTypeTest() {
+ final String id = "test1";
+ AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, id);
+ assertEquals("/network/network-policies/network-policy/test1", aaiUri.build().toString());
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
index 43616ba0c2..84c3cad0f9 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
@@ -20,11 +20,8 @@
package org.onap.so.client.aai;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -36,9 +33,8 @@ import javax.ws.rs.core.Response;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.client.RestClient;
import org.onap.so.client.aai.entities.CustomQuery;
@@ -46,6 +42,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.GraphInventoryClient;
+import org.onap.so.client.graphinventory.GraphInventorySubgraphType;
@RunWith(MockitoJUnitRunner.class)
@@ -57,7 +55,10 @@ public class AAIQueryClientTest {
@Mock
RestClient restClient;
- @Spy
+ @Mock
+ GraphInventoryClient client;
+
+ @InjectMocks
AAIQueryClient aaiQueryClient = new AAIQueryClient();
@Test
@@ -67,16 +68,16 @@ public class AAIQueryClientTest {
Format format = Format.SIMPLE;
CustomQuery query = new CustomQuery(uris);
- doReturn(restClient).when(aaiQueryClient).createClient(isA(AAIUri.class));
+ doReturn(restClient).when(client).createClient(isA(AAIUri.class));
aaiQueryClient.query(format, query);
- verify(aaiQueryClient, times(1)).createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", format.toString()));
+ verify(client, times(1)).createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", format.toString()));
verify(restClient, times(1)).put(query, String.class);
}
@Test
public void testCreateClient() {
String depth = "testDepth";
- AAISubgraphType subgraph = AAISubgraphType.STAR;
+ GraphInventorySubgraphType subgraph = GraphInventorySubgraphType.STAR;
aaiQueryClient.depth(depth);
aaiQueryClient.nodesOnly();
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
index 32a9ca54a8..a55fbc9517 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
@@ -35,18 +35,26 @@ import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Relationship;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.onap.so.client.graphinventory.GraphInventoryClient;
import com.github.tomakehurst.wiremock.admin.NotFoundException;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+@RunWith(MockitoJUnitRunner.class)
public class AAIResourcesClientTest {
@@ -56,6 +64,18 @@ public class AAIResourcesClientTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
+
+ @Spy
+ public AAIClient client;
+
+ @InjectMocks
+ public AAIResourcesClient aaiClient = new AAIResourcesClient();
+
+ @Before
+ public void beforeTest() {
+ doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
+ }
+
@Test
public void verifyNotExists() {
AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
@@ -66,7 +86,7 @@ public class AAIResourcesClientTest {
.withHeader("Content-Type", "text/plain")
.withBody("hello")
.withStatus(404)));
- AAIResourcesClient client= createClient();
+ AAIResourcesClient client= aaiClient;
boolean result = client.exists(path);
assertEquals("path not found", false, result);
}
@@ -87,7 +107,7 @@ public class AAIResourcesClientTest {
.willReturn(
aResponse()
.withStatus(204)));
- AAIResourcesClient client= createClient();
+ AAIResourcesClient client= aaiClient;
client.delete(path);
}
@@ -102,7 +122,7 @@ public class AAIResourcesClientTest {
.withHeader("Content-Type", "application/json")
.withBodyFile("aai/resources/mockObject.json")
.withStatus(200)));
- AAIResourcesClient client= createClient();
+ AAIResourcesClient client= aaiClient;
client.get(path);
}
@@ -118,7 +138,7 @@ public class AAIResourcesClientTest {
.withStatus(200)));
AAIResourceUri pathClone = path.clone();
- AAIResourcesClient client= createClient();
+ AAIResourcesClient client= aaiClient;
client.connect(path, path2);
assertEquals("uri not modified", pathClone.build().toString(), path.build().toString());
}
@@ -135,7 +155,7 @@ public class AAIResourcesClientTest {
.withStatus(204)));
AAIResourceUri pathClone = path.clone();
- AAIResourcesClient client= createClient();
+ AAIResourcesClient client= aaiClient;
client.disconnect(path, path2);
assertEquals("uri not modified", pathClone.build().toString(), path.build().toString());
}
@@ -150,7 +170,7 @@ public class AAIResourcesClientTest {
aResponse()
.withStatus(200)));
- AAIResourcesClient client= createClient();
+ AAIResourcesClient client= aaiClient;
client.update(path, "{}");
}
@@ -165,7 +185,7 @@ public class AAIResourcesClientTest {
.withHeader("Content-Type", "text/plain")
.withBody("hello")
.withStatus(404)));
- AAIResourcesClient client= createClient();
+ AAIResourcesClient client= aaiClient;
AAIResultWrapper result = client.get(path);
assertEquals("is empty", true, result.isEmpty());
}
@@ -180,7 +200,7 @@ public class AAIResourcesClientTest {
.withHeader("Content-Type", "text/plain")
.withBody("hello")
.withStatus(404)));
- AAIResourcesClient client= createClient();
+ AAIResourcesClient client= aaiClient;
thrown.expect(NotFoundException.class);
thrown.expectMessage(containsString(path.build() + " not found in A&AI"));
AAIResultWrapper result = client.get(path, NotFoundException.class);
@@ -188,7 +208,7 @@ public class AAIResourcesClientTest {
@Test
public void buildRelationshipTest() {
- AAIResourcesClient client = createClient();
+ AAIResourcesClient client = aaiClient;
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
Relationship relationship = new Relationship();
relationship.setRelatedLink(uri.build().toString());
@@ -200,10 +220,5 @@ public class AAIResourcesClientTest {
assertThat("expect equal has label", actual, sameBeanAs(relationship));
}
-
- private AAIResourcesClient createClient() {
- AAIResourcesClient client = spy(new AAIResourcesClient());
- doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
- return client;
- }
+
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java
index 3d23213ff0..5493d6778e 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java
@@ -40,6 +40,10 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.entities.uri.ServiceInstanceUri;
@@ -47,6 +51,7 @@ import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
+@RunWith(MockitoJUnitRunner.class)
public class AAIResourcesClientWithServiceInstanceUriTest {
@Rule
@@ -55,9 +60,17 @@ public class AAIResourcesClientWithServiceInstanceUriTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
+ @Spy
+ public AAIClient client;
+
+ @InjectMocks
+ public AAIResourcesClient aaiClient = new AAIResourcesClient();
+
private ServiceInstanceUri uri;
@Before
public void setUp() {
+
+ doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
wireMockRule.stubFor(get(urlMatching("/aai/v[0-9]+/nodes.*"))
.willReturn(aResponse()
.withStatus(404)
@@ -65,12 +78,12 @@ public class AAIResourcesClientWithServiceInstanceUriTest {
.withHeader("Mock", "true")));
uri = spy((ServiceInstanceUri)AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "id"));
- doReturn(createClient()).when(uri).getResourcesClient();
+ doReturn(aaiClient).when(uri).getResourcesClient();
}
@Test
public void getWithClass() {
- AAIResourcesClient client = createClient();
+ AAIResourcesClient client = aaiClient;
Optional<String> result = client.get(String.class, uri);
assertThat(result.isPresent(), equalTo(false));
@@ -78,42 +91,38 @@ public class AAIResourcesClientWithServiceInstanceUriTest {
@Test
public void getFullResponse() {
- AAIResourcesClient client = createClient();
+ AAIResourcesClient client = aaiClient;
Response result = client.getFullResponse(uri);
assertThat(result.getStatus(), equalTo(Status.NOT_FOUND.getStatusCode()));
}
@Test
public void getWithGenericType() {
- AAIResourcesClient client = createClient();
+ AAIResourcesClient client = aaiClient;
Optional<List<String>> result = client.get(new GenericType<List<String>>() {}, uri);
assertThat(result.isPresent(), equalTo(false));
}
@Test
public void getAAIWrapper() {
- AAIResourcesClient client = createClient();
+ AAIResourcesClient client = aaiClient;
AAIResultWrapper result = client.get(uri);
assertThat(result.isEmpty(), equalTo(true));
}
@Test
public void getWithException() {
- AAIResourcesClient client = createClient();
+ AAIResourcesClient client = aaiClient;
this.thrown.expect(IllegalArgumentException.class);
AAIResultWrapper result = client.get(uri, IllegalArgumentException.class);
}
@Test
public void existsTest() {
- AAIResourcesClient client = createClient();
+ AAIResourcesClient client = aaiClient;
doReturn(uri).when(uri).clone();
boolean result = client.exists(uri);
assertThat(result, equalTo(false));
}
- private AAIResourcesClient createClient() {
- AAIResourcesClient client = spy(new AAIResourcesClient());
- doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
- return client;
- }
+
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
index ad15417b71..95b30f934b 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
@@ -41,6 +41,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.client.RestClientSSL;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -68,7 +69,7 @@ public class AAIRestClientTest {
public void verifyPatchValidation() throws URISyntaxException {
AAIRestClient client = new AAIRestClient(props, new URI(""));
AAIRestClient spy = spy(client);
- AAIPatchConverter patchValidatorMock = mock(AAIPatchConverter.class);
+ GraphInventoryPatchConverter patchValidatorMock = mock(GraphInventoryPatchConverter.class);
doReturn(patchValidatorMock).when(spy).getPatchConverter();
String payload = "{}";
doReturn(Response.ok().build()).when(spy).method(eq("PATCH"), any());
diff --git a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
index 428fa276db..d875f384b0 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
@@ -38,6 +38,10 @@ import java.util.Optional;
import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Pserver;
import org.onap.aai.domain.yang.v9.Complex;
import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest;
@@ -45,6 +49,7 @@ import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRespon
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.core.JsonParseException;
@@ -52,6 +57,7 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+@RunWith(MockitoJUnitRunner.class)
public class AAISingleTransactionClientTest {
private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/singletransaction/";
@@ -60,6 +66,10 @@ public class AAISingleTransactionClientTest {
ObjectMapper mapper;
+ public AAIClient client = new AAIClient();
+
+ public AAIResourcesClient aaiClient = new AAIResourcesClient();
+
@Before
public void before() throws JsonParseException, JsonMappingException, IOException {
mapper = new AAICommonObjectMapperProvider().getMapper();
@@ -68,7 +78,6 @@ public class AAISingleTransactionClientTest {
@Test
public void testRequest() throws JSONException,IOException {
- AAIResourcesClient client = createClient();
Pserver pserver = new Pserver();
pserver.setHostname("pserver-hostname");
pserver.setFqdn("pserver-bulk-process-single-transactions-multiple-actions-1-fqdn");
@@ -77,7 +86,7 @@ public class AAISingleTransactionClientTest {
Complex complex = new Complex();
complex.setCity("my-city");
AAISingleTransactionClient singleTransaction =
- client.beginSingleTransaction()
+ aaiClient.beginSingleTransaction()
.create(uriA, pserver)
.update(uriA, pserver2)
.create(uriB, complex);
@@ -92,8 +101,7 @@ public class AAISingleTransactionClientTest {
@Test
public void testFailure() throws IOException {
- AAIResourcesClient client = createClient();
- AAISingleTransactionClient singleTransaction = client.beginSingleTransaction();
+ AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction();
SingleTransactionResponse expected = mapper.readValue(this.getJson("sample-response-failure.json"), SingleTransactionResponse.class);
Optional<String> errorMessage = singleTransaction.locateErrorMessages(expected);
@@ -104,8 +112,7 @@ public class AAISingleTransactionClientTest {
@Test
public void testSuccessResponse() throws IOException {
- AAIResourcesClient client = createClient();
- AAISingleTransactionClient singleTransaction = client.beginSingleTransaction();
+ AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction();
SingleTransactionResponse expected = mapper.readValue(this.getJson("sample-response.json"), SingleTransactionResponse.class);
Optional<String> errorMessage = singleTransaction.locateErrorMessages(expected);
@@ -116,8 +123,8 @@ public class AAISingleTransactionClientTest {
@Test
public void confirmPatchFormat() {
- AAISingleTransactionClient singleTransaction = spy(new AAISingleTransactionClient(AAIVersion.LATEST));
- AAIPatchConverter mock = mock(AAIPatchConverter.class);
+ AAISingleTransactionClient singleTransaction = spy(new AAISingleTransactionClient(aaiClient, client));
+ GraphInventoryPatchConverter mock = mock(GraphInventoryPatchConverter.class);
doReturn(mock).when(singleTransaction).getPatchConverter();
singleTransaction.update(uriA, "{}");
verify(mock, times(1)).convertPatchFormat(any());
@@ -126,9 +133,4 @@ public class AAISingleTransactionClientTest {
return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename)));
}
- private AAIResourcesClient createClient() {
- AAIResourcesClient client = spy(new AAIResourcesClient());
- doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
- return client;
- }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
index 621375882b..3e2801c452 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
@@ -38,11 +38,15 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
-
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Relationship;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -50,6 +54,7 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+@RunWith(MockitoJUnitRunner.class)
public class AAITransactionalClientTest {
private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/bulkprocess/";
@@ -62,6 +67,10 @@ public class AAITransactionalClientTest {
ObjectMapper mapper;
+ public AAIClient client = new AAIClient();
+
+ public AAIResourcesClient aaiClient = new AAIResourcesClient();
+
@Before
public void before() throws JsonParseException, JsonMappingException, IOException {
mapper = new AAICommonObjectMapperProvider().getMapper();
@@ -73,7 +82,7 @@ public class AAITransactionalClientTest {
final Relationship body = new Relationship();
body.setRelatedLink(uriB.build().toString());
- AAITransactionalClient transactions = createClient().beginTransaction()
+ AAITransactionalClient transactions = aaiClient.beginTransaction()
.create(uriA.clone().relationshipAPI(), body);
String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
@@ -89,7 +98,7 @@ public class AAITransactionalClientTest {
uris.add(uriB);
AAIResourceUri uriAClone = uriA.clone();
- AAITransactionalClient transactions = createClient()
+ AAITransactionalClient transactions = aaiClient
.beginTransaction().connect(uriA, uris).connect(uriC, uriD)
.beginNewTransaction().connect(uriE, uriF);
@@ -106,7 +115,7 @@ public class AAITransactionalClientTest {
List<AAIResourceUri> uris = new ArrayList<AAIResourceUri>();
uris.add(uriB);
- AAITransactionalClient transactions = createClient().beginTransaction()
+ AAITransactionalClient transactions = aaiClient.beginTransaction()
.disconnect(uriA, uris);
String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
@@ -122,7 +131,7 @@ public class AAITransactionalClientTest {
body.setRelatedLink(uriB.build().toString());
AAIResourceUri uriAClone = uriA.clone().relationshipAPI();
- AAITransactionalClient transactions = createClient().beginTransaction().update(uriAClone, body);
+ AAITransactionalClient transactions = aaiClient.beginTransaction().update(uriAClone, body);
String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
Map<String, Object> actual = mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>(){});
@@ -133,7 +142,7 @@ public class AAITransactionalClientTest {
@Test
public void verifyResponse() throws IOException {
- AAITransactionalClient transactions = createClient()
+ AAITransactionalClient transactions = aaiClient
.beginTransaction();
assertEquals("success status", Optional.empty(), transactions.locateErrorMessages(getJson("response-success.json")));
@@ -142,10 +151,10 @@ public class AAITransactionalClientTest {
@Test
public void confirmPatchFormat() {
- AAITransactionalClient client = spy(new AAITransactionalClient(AAIVersion.LATEST));
- AAIPatchConverter mock = mock(AAIPatchConverter.class);
- doReturn(mock).when(client).getPatchConverter();
- client.update(uriA, "{}");
+ AAITransactionalClient transactionClient = spy(new AAITransactionalClient(aaiClient, client));
+ GraphInventoryPatchConverter mock = mock(GraphInventoryPatchConverter.class);
+ doReturn(mock).when(transactionClient).getPatchConverter();
+ transactionClient.update(uriA, "{}");
verify(mock, times(1)).convertPatchFormat(any());
}
@@ -153,9 +162,4 @@ public class AAITransactionalClientTest {
return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename)));
}
- private AAIResourcesClient createClient() {
- AAIResourcesClient client = spy(new AAIResourcesClient());
- doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
- return client;
- }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
new file mode 100644
index 0000000000..69d46de96a
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.aai;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.client.graphinventory.entities.DSLNode;
+import org.onap.so.client.graphinventory.entities.DSLQueryBuilder;
+import org.onap.so.client.graphinventory.entities.__;
+
+public class DSLQueryBuilderTest {
+
+
+ @Test
+ public void whereTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.CLOUD_REGION,
+ __.key("cloud-owner", "att-nc"),
+ __.key("cloud-region-id", "test")));
+
+ builder.to(__.node(AAIObjectType.VLAN_TAG)).where(
+ __.node(AAIObjectType.OWNING_ENTITY,
+ __.key("owning-entity-name", "name")
+ )
+ ).to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", "108")).output());
+
+ assertEquals("cloud-region('cloud-owner', 'att-nc')('cloud-region-id', 'test') > "
+ + "vlan-tag (> owning-entity('owning-entity-name', 'name')) > "
+ + "vlan-tag*('vlan-id-outer', '108')", builder.build());
+ }
+
+ @Test
+ public void unionTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF,
+ __.key("vnf-id", "vnfId")).output());
+
+ builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
+ __.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output())));
+
+ assertEquals("generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, "
+ + "vserver > pserver* > complex* ]", builder.build());
+ }
+
+ @Test
+ public void whereUnionTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF,
+ __.key("vnf-id", "vnfId")).output());
+
+ builder.where(
+ __.union(
+ __.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")),
+ __.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")))));
+
+ assertEquals("generic-vnf*('vnf-id', 'vnfId') (> [ pserver('hostname', 'hostname1'), "
+ + "vserver > pserver('hostname', 'hostname1') ])", builder.build());
+ }
+
+ @Test
+ public void notNullTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.CLOUD_REGION,
+ __.key("cloud-owner", "", "null").not()).output());
+
+ assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build());
+ }
+}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
index 729f0e50e9..e84326e95f 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.client.aai.entities.uri;
import static org.hamcrest.CoreMatchers.equalTo;
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
index 6059e7bd23..15c1c24ae2 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
@@ -26,7 +26,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
@@ -45,10 +44,16 @@ import java.util.Optional;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.UriBuilder;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.client.aai.AAIClient;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
@@ -58,6 +63,7 @@ import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundExc
import com.github.tomakehurst.wiremock.junit.WireMockRule;
+@RunWith(MockitoJUnitRunner.class)
public class ServiceInstanceUriTest {
private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/";
@@ -68,6 +74,16 @@ public class ServiceInstanceUriTest {
@Rule
public final ExpectedException exception = ExpectedException.none();
+ @Spy
+ public AAIClient client;
+
+ @InjectMocks
+ public AAIResourcesClient aaiClient = new AAIResourcesClient();
+
+ @Before
+ public void beforeTest() {
+ doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
+ }
@Test
public void found() throws IOException {
final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json")));
@@ -179,7 +195,7 @@ public class ServiceInstanceUriTest {
public void noVertexFound() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
ServiceInstanceUri instance = new ServiceInstanceUri("key3");
ServiceInstanceUri spy = spy(instance);
- AAIResourcesClient client = createClient();
+ AAIResourcesClient client = aaiClient;
doReturn(client).when(spy).getResourcesClient();
stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3"))
.willReturn(aResponse()
@@ -189,10 +205,4 @@ public class ServiceInstanceUriTest {
exception.expect(NotFoundException.class);
spy.build();
}
-
- private AAIResourcesClient createClient() {
- AAIResourcesClient client = spy(new AAIResourcesClient());
- doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
- return client;
- }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java b/common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java
index b964e905de..3979902962 100644
--- a/common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java
+++ b/common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.client.aai.objects;
import org.onap.so.client.aai.AAINamespaceConstants;
diff --git a/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java b/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java
new file mode 100644
index 0000000000..f4490faacc
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.adapter.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.entry;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.GeneralSecurityException;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.codec.binary.Base64;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.client.policy.JettisonStyleMapperProvider;
+import org.onap.so.utils.CryptoUtils;
+import org.onap.so.utils.TargetEntity;
+
+public class AdapterRestClientTest {
+
+ private static final String CRYPTO_KEY = "546573746F736973546573746F736973";
+ private static final String INVALID_CRYPTO_KEY = "1234";
+
+ private Map<String, String> headerMap;
+ private AdapterRestProperties adapterRestPropertiesMock;
+
+ @Before
+ public void setup() {
+ headerMap = new HashMap<>();
+ adapterRestPropertiesMock = mock(AdapterRestProperties.class);
+ }
+
+ @Test
+ public void initializeHeaderMap_success() throws URISyntaxException, GeneralSecurityException {
+ // given
+ String encyptedMessage = CryptoUtils.encrypt("testAdapter", CRYPTO_KEY);
+ when(adapterRestPropertiesMock.getAuth()).thenReturn(encyptedMessage);
+ when(adapterRestPropertiesMock.getKey()).thenReturn(CRYPTO_KEY);
+ AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI(""));
+ // when
+ testedObject.initializeHeaderMap(headerMap);
+ // then
+ assertThat(headerMap).containsOnly(entry("Authorization", getExpectedEncodedString(encyptedMessage)));
+ }
+
+ @Test
+ public void initializeHeaderMap_putNullToMapWhenAuthIsNull() throws URISyntaxException {
+ // given
+ AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI(""));
+ // when
+ testedObject.initializeHeaderMap(headerMap);
+ // then
+ assertThat(headerMap).containsOnly(entry("Authorization", null));
+ }
+
+ @Test
+ public void initializeHeaderMap_putNullToMapWhenExOccurs() throws URISyntaxException, GeneralSecurityException {
+ // given
+ String encyptedMessage = CryptoUtils.encrypt("testAdapter", CRYPTO_KEY);
+ when(adapterRestPropertiesMock.getAuth()).thenReturn(encyptedMessage);
+ when(adapterRestPropertiesMock.getKey()).thenReturn(INVALID_CRYPTO_KEY);
+ AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI(""),
+ "accept", "contentType");
+ // when
+ testedObject.initializeHeaderMap(headerMap);
+ // then
+ assertThat(headerMap).containsOnly(entry("Authorization", null));
+ }
+
+ @Test
+ public void getTargetEntity_success() throws URISyntaxException {
+ AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI(""));
+ assertThat(testedObject.getTargetEntity()).isEqualTo(TargetEntity.OPENSTACK_ADAPTER);
+ }
+
+ @Test
+ public void getCommonObjectMapperProvider_success() throws URISyntaxException {
+ AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI(""));
+ assertThat(testedObject.getCommonObjectMapperProvider()).isInstanceOf(JettisonStyleMapperProvider.class);
+ }
+
+ private String getExpectedEncodedString(String encryptedMessage) throws GeneralSecurityException {
+ String auth = CryptoUtils.decrypt(encryptedMessage, CRYPTO_KEY);
+ byte[] encoded = Base64.encodeBase64(auth.getBytes());
+ String encodedString = new String(encoded);
+ return "Basic " + encodedString;
+ }
+}
diff --git a/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java b/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java
index c0633c1cca..0836ed23eb 100644
--- a/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java
+++ b/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java
@@ -29,13 +29,13 @@ public class DmaapPublisherTest {
DmaapPublisher dmaapPublisher = new DmaapPublisher(120) {
@Override
- public String getUserName() {
- return "test";
+ public String getAuth() {
+ return "8F73A1691F6271E769329C176EE3EA48F52786AF12A3E16259007EED2A0F0CC3CB965F4AB5318483015723CCE1C0B48AB6C4DED6E251869393B01E4EC532FC88D4A128B92F4CDB34719B171923";
}
@Override
- public String getPassword() {
- return "test";
+ public String getKey() {
+ return "07a7159d3bf51a0e53be7a8f89699be7";
}
@Override
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java b/common/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java
index 0d4490f51d..d24b3ff147 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java
+++ b/common/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.aai;
+package org.onap.so.client.graphinventory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -35,6 +35,8 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -42,13 +44,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
-public class AAIPatchConverterTest {
+public class GraphInventoryPatchConverterTest {
private ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
@Test
public void convertObjectToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- AAIPatchConverter validator = new AAIPatchConverter();
+ GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
GenericVnf vnf = new GenericVnf();
vnf.setIpv4Loopback0Address("");
String result = validator.marshallObjectToPatchFormat(vnf);
@@ -60,7 +62,7 @@ public class AAIPatchConverterTest {
@Test
public void convertStringToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- AAIPatchConverter validator = new AAIPatchConverter();
+ GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
String payload = "{\"ipv4-loopback0-address\":\"\"}";
String result = validator.marshallObjectToPatchFormat(payload);
@@ -69,7 +71,7 @@ public class AAIPatchConverterTest {
@Test
public void convertStringToPatchFormatNull_Test() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- AAIPatchConverter validator = new AAIPatchConverter();
+ GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
String payload = "{\"ipv4-loopback0-address\": null}";
String result = validator.marshallObjectToPatchFormat(payload);
System.out.println(result);
@@ -78,7 +80,7 @@ public class AAIPatchConverterTest {
@Test
public void convertMapToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- AAIPatchConverter validator = new AAIPatchConverter();
+ GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
HashMap<String, String> map = new HashMap<>();
map.put("ipv4-loopback0-address", "");
map.put("ipv4-loopback1-address", "192.168.1.1");
@@ -89,7 +91,7 @@ public class AAIPatchConverterTest {
@Test
public void hasComplexObjectTest() {
- AAIPatchConverter validator = new AAIPatchConverter();
+ GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
String hasNesting = "{ \"hello\" : \"world\", \"nested\" : { \"key\" : \"value\" } }";
String noNesting = "{ \"hello\" : \"world\" }";
String arrayCase = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"nestedComplex\" : [{\"key\" : \"value\"}]}";
diff --git a/common/src/test/resources/dmaap.properties b/common/src/test/resources/dmaap.properties
index 7ce101996c..5593455da3 100644
--- a/common/src/test/resources/dmaap.properties
+++ b/common/src/test/resources/dmaap.properties
@@ -4,4 +4,7 @@ sdno.health-check.dmaap.subscriber.topic=com.att.sdno.test-health-diagnostic-v02
sdno.health-check.dmaap.publisher.topic=com.att.sdno.test-health-diagnostic-v02
ruby.create-ticket-request.dmaap.username=testuser
ruby.create-ticket-request.dmaap.password=eHQ1cUJrOUc
-ruby.create-ticket-request.publisher.topic=com.att.pdas.st1.msoCMFallout-v1 \ No newline at end of file
+ruby.create-ticket-request.publisher.topic=com.att.pdas.st1.msoCMFallout-v1
+ruby.create-ticket-request.dmaap.auth=81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54
+sdno.health-check.dmaap.auth=81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54
+mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7 \ No newline at end of file
diff --git a/docs/developer_info/Working_with_SO_Docker.rst b/docs/developer_info/Working_with_SO_Docker.rst
index ee958efa41..6e31d22ea8 100644
--- a/docs/developer_info/Working_with_SO_Docker.rst
+++ b/docs/developer_info/Working_with_SO_Docker.rst
@@ -10,177 +10,244 @@ Verify that docker images are built
.. code-block:: bash
- docker images openecomp/mso
+ docker images
*Example Output:*
- REPOSITORY TAG IMAGE ID CREATED SIZE
-
- openecomp/mso 1.1-SNAPSHOT-latest 419e9d8a17e8 3 minutes ago 1.62GB
-
- openecomp/mso 1.1.0-SNAPSHOT-STAGING-20170926T2015 419e9d8a17e8 3 minutes ago 1.62GB
-
- openecomp/mso latest 419e9d8a17e8 3 minutes ago 1.62GB
-
-Start the mariadb container
-----------------------------
+ REPOSITORY TAG IMAGE ID CREATED SIZE
+ onap/so/so-monitoring 1.3.0-SNAPSHOT bb8f368a3ddb 7 seconds ago 206MB
+ onap/so/so-monitoring 1.3.0-SNAPSHOT-20190213T0846 bb8f368a3ddb 7 seconds ago 206MB
+ onap/so/so-monitoring 1.3.0-SNAPSHOT-latest bb8f368a3ddb 7 seconds ago 206MB
+ onap/so/so-monitoring latest bb8f368a3ddb 7 seconds ago 206MB
+ onap/so/api-handler-infra 1.3.0-SNAPSHOT 2573165483e9 21 seconds ago 246MB
+ onap/so/api-handler-infra 1.3.0-SNAPSHOT-20190213T0846 2573165483e9 21 seconds ago 246MB
+ onap/so/api-handler-infra 1.3.0-SNAPSHOT-latest 2573165483e9 21 seconds ago 246MB
+ onap/so/api-handler-infra latest 2573165483e9 21 seconds ago 246MB
+ onap/so/bpmn-infra 1.3.0-SNAPSHOT 8b1487665f2e 38 seconds ago 324MB
+ onap/so/bpmn-infra 1.3.0-SNAPSHOT-20190213T0846 8b1487665f2e 38 seconds ago 324MB
+ onap/so/bpmn-infra 1.3.0-SNAPSHOT-latest 8b1487665f2e 38 seconds ago 324MB
+ onap/so/bpmn-infra latest 8b1487665f2e 38 seconds ago 324MB
+ onap/so/sdc-controller 1.3.0-SNAPSHOT c663bb7d7c0d About a minute ago 241MB
+ onap/so/sdc-controller 1.3.0-SNAPSHOT-20190213T0846 c663bb7d7c0d About a minute ago 241MB
+ onap/so/sdc-controller 1.3.0-SNAPSHOT-latest c663bb7d7c0d About a minute ago 241MB
+ onap/so/sdc-controller latest c663bb7d7c0d About a minute ago 241MB
+ onap/so/vfc-adapter 1.3.0-SNAPSHOT dee0005ef18b About a minute ago 212MB
+ onap/so/vfc-adapter 1.3.0-SNAPSHOT-20190213T0846 dee0005ef18b About a minute ago 212MB
+ onap/so/vfc-adapter 1.3.0-SNAPSHOT-latest dee0005ef18b About a minute ago 212MB
+ onap/so/vfc-adapter latest dee0005ef18b About a minute ago 212MB
+ onap/so/openstack-adapter 1.3.0-SNAPSHOT fe9103aa9f36 About a minute ago 235MB
+ onap/so/openstack-adapter 1.3.0-SNAPSHOT-20190213T0846 fe9103aa9f36 About a minute ago 235MB
+ onap/so/openstack-adapter 1.3.0-SNAPSHOT-latest fe9103aa9f36 About a minute ago 235MB
+ onap/so/openstack-adapter latest fe9103aa9f36 About a minute ago 235MB
+ onap/so/sdnc-adapter 1.3.0-SNAPSHOT d02d42d92b06 2 minutes ago 231MB
+ onap/so/sdnc-adapter 1.3.0-SNAPSHOT-20190213T0846 d02d42d92b06 2 minutes ago 231MB
+ onap/so/sdnc-adapter 1.3.0-SNAPSHOT-latest d02d42d92b06 2 minutes ago 231MB
+ onap/so/sdnc-adapter latest d02d42d92b06 2 minutes ago 231MB
+ onap/so/request-db-adapter 1.3.0-SNAPSHOT 5e0136f2201b 2 minutes ago 215MB
+ onap/so/request-db-adapter 1.3.0-SNAPSHOT-20190213T0846 5e0136f2201b 2 minutes ago 215MB
+ onap/so/request-db-adapter 1.3.0-SNAPSHOT-latest 5e0136f2201b 2 minutes ago 215MB
+ onap/so/request-db-adapter latest 5e0136f2201b 2 minutes ago 215MB
+ onap/so/catalog-db-adapter 1.3.0-SNAPSHOT bf1c2fe49acb 2 minutes ago 218MB
+ onap/so/catalog-db-adapter 1.3.0-SNAPSHOT-20190213T0846 bf1c2fe49acb 2 minutes ago 218MB
+ onap/so/catalog-db-adapter 1.3.0-SNAPSHOT-latest bf1c2fe49acb 2 minutes ago 218MB
+ onap/so/catalog-db-adapter latest bf1c2fe49acb 2 minutes ago 218MB
+ onap/so/base-image 1.0 1685bba9831d 3 minutes ago 108MB
+ openjdk 8-jdk-alpine 792ff45a2a17 7 days ago 105MB
+ nexus3.onap.org:10001/openjdk 8-jdk-alpine 792ff45a2a17 7 days ago 105MB
+
+Start the containers
+---------------------
.. code-block:: bash
cd $HOME/onap/workspace/SO/docker-config
- MTU=1500 docker-compose up mariadb
+ ./deploy.sh
+
+ This should also download & start the mariaDB docker.
*Example Output:*
.. code-block:: bash
- . . . many lines omitted . . .
- mariadb_1 | Version: '10.1.11-MariaDB-1~jessie-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
-
-Log into the mariadb container and run the mysql client program
----------------------------------------------------------------
+ Deploying with local images, not pulling them from Nexus.
+ docker command: local docker using unix socket
+ Removing network dockerconfig_default
+ Creating network "dockerconfig_default" with driver "bridge"
+ Pulling mariadb (mariadb:10.1.11)...
+ 10.1.11: Pulling from library/mariadb
+ 7268d8f794c4: Pull complete
+ a3ed95caeb02: Pull complete
+ e5a99361f38c: Pull complete
+ 20b20853e29d: Pull complete
+ 9dbc63cf121f: Pull complete
+ fdebb5c64c6c: Pull complete
+ 3154860d3699: Pull complete
+ 3cfa7ffec11c: Pull complete
+ 943211713cac: Pull complete
+ d65a44f4573e: Pull complete
+ Digest: sha256:3821f92155bf4311a59b7ec6219b79cbf9a42c75805000a7c8fe5d9f3ad28276
+ Status: Downloaded newer image for mariadb:10.1.11
+ Creating dockerconfig_mariadb_1
+ Waiting for 'dockerconfig_mariadb_1' deployment to finish ...
+ Waiting for 'dockerconfig_mariadb_1' deployment to finish ...
+ Waiting for 'dockerconfig_mariadb_1' deployment to finish ...
+ Waiting for 'dockerconfig_mariadb_1' deployment to finish ...
+ Waiting for 'dockerconfig_mariadb_1' deployment to finish ...
+ Waiting for 'dockerconfig_mariadb_1' deployment to finish ...
+ dockerconfig_mariadb_1 is up-to-date
+ Creating dockerconfig_catalog-db-adapter_1
+ Creating dockerconfig_request-db-adapter_1
+ Creating dockerconfig_sdc-controller_1
+ Creating dockerconfig_vfc-adapter_1
+ Creating dockerconfig_openstack-adapter_1
+ Creating dockerconfig_sdnc-adapter_1
+ Creating dockerconfig_api-handler-infra_1
+ Creating dockerconfig_so-monitoring_1
+ Creating dockerconfig_bpmn-infra_1
+
+Check containers are now up
+----------------------------
.. code-block:: bash
- docker exec -it dockerconfig_mariadb_1 /bin/bash
- mysql -uroot -ppassword
+ docker ps
-Start the mso container
------------------------
+ *Example Output:*
+ CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+ 324ce4636285 onap/so/bpmn-infra "/app/wait-for.sh ..." 5 minutes ago Up 5 minutes 0.0.0.0:8081->8081/tcp dockerconfig_bpmn-infra_1
+ 60986a742f6f onap/so/so-monitoring "/app/wait-for.sh ..." 5 minutes ago Up 5 minutes 0.0.0.0:8088->8088/tcp dockerconfig_so-monitoring_1
+ ea6e3e396166 onap/so/api-handler-infra "/app/wait-for.sh ..." 5 minutes ago Up 5 minutes 0.0.0.0:8080->8080/tcp dockerconfig_api-handler-infra_1
+ 473ca2dc852c onap/so/sdnc-adapter "/app/wait-for.sh ..." 5 minutes ago Up 5 minutes 0.0.0.0:8086->8086/tcp dockerconfig_sdnc-adapter_1
+ 7ae53b222a39 onap/so/vfc-adapter "/app/wait-for.sh ..." 5 minutes ago Up 5 minutes 0.0.0.0:8084->8084/tcp dockerconfig_vfc-adapter_1
+ 8844999c9fc8 onap/so/openstack-adapter "/app/wait-for.sh ..." 5 minutes ago Up 5 minutes 0.0.0.0:8087->8087/tcp dockerconfig_openstack-adapter_1
+ d500c33665b6 onap/so/sdc-controller "/app/wait-for.sh ..." 5 minutes ago Up 5 minutes 0.0.0.0:8085->8085/tcp dockerconfig_sdc-controller_1
+ 852483370df3 onap/so/request-db-adapter "/app/wait-for.sh ..." 5 minutes ago Up 5 minutes 0.0.0.0:8083->8083/tcp dockerconfig_request-db-adapter_1
+ cdfa29ee96cc onap/so/catalog-db-adapter "/app/wait-for.sh ..." 5 minutes ago Up 5 minutes 0.0.0.0:8082->8082/tcp dockerconfig_catalog-db-adapter_1
+ 7c7116026c07 mariadb:10.1.11 "/docker-entrypoin..." 5 minutes ago Up 5 minutes 0.0.0.0:32770->3306/tcp dockerconfig_mariadb_1
+
+Check SO health
+---------------
.. code-block:: bash
- cd $HOME/onap/workspace/SO/docker-config
-
- MTU=1500 docker-compose up mso
+ curl http://localhost:8080/manage/health
-*Example Output:*
-
-.. code-block:: bash
+ *Example Output:*
- . . . many lines omitted . . .
- mso_1 | 20:59:31,586 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.Final
- (WildFly Core 2.2.0.Final) started in 59937ms - Started 2422 of 2747 services (604 services are lazy, passive or
- on-demand)
+ {"status":"UP"}
Log into the mso container
--------------------------
.. code-block:: bash
- docker exec -it dockerconfig_mso_1 /bin/bash
+ docker exec -it dockerconfig_api-handler-infra_1 sh
Inspect a docker image
----------------------
-This command shows interesting information about the structure of the mso image. Note that an image is NOT a running container. It is the template that a container is created from.
+This command shows interesting information about the structure of the mso image. Note that an image is NOT a running container.
+It is the template that a container is created from.
.. code-block:: bash
- docker inspect openecomp/mso
+ docker inspect onap/so/api-handler-infra
Example Output:
[
{
- "Id": "sha256:419e9d8a17e8d7e876dfc36c1f3ed946bccbb29aa6faa6cd8e32fbc77c0ef6e5",
+ "Id": "sha256:2573165483e9ac87826da9c08984a9d0e1d93a90c681b22d9b4f90ed579350dc",
"RepoTags": [
- "openecomp/mso:1.1-SNAPSHOT-latest",
- "openecomp/mso:1.1.0-SNAPSHOT-STAGING-20170926T2015",
- "openecomp/mso:latest"
+ "onap/so/api-handler-infra:1.3.0-SNAPSHOT",
+ "onap/so/api-handler-infra:1.3.0-SNAPSHOT-20190213T0846",
+ "onap/so/api-handler-infra:1.3.0-SNAPSHOT-latest",
+ "onap/so/api-handler-infra:latest"
],
"RepoDigests": [],
- "Parent": "sha256:70f1ba3d6289411fce96ba78755a3fd6055a370d33464553d72c753889b12693",
+ "Parent": "sha256:66b508441811ab4ed9968f8702a0d0a697f517bbc10d8d9076e5b98ae4437344",
"Comment": "",
- "Created": "2017-09-26T20:40:10.179358574Z",
- "Container": "284aa05909390a3c0ffc1ec6d0f6e2071799d56b08369707505897bc73d2ea30",
+ "Created": "2019-02-13T09:37:33.770342225Z",
+ "Container": "8be46c735d21935631130f9017c3747779aab26eab54a9149b1edde122f7576d",
"ContainerConfig": {
- "Hostname": "6397aa10f0c4",
+ "Hostname": "ac4a12e21390",
"Domainname": "",
- "User": "root",
+ "User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
- "ExposedPorts": {
- "8080/tcp": {}
- },
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin",
+ "LANG=C.UTF-8",
+ "JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk",
+ "JAVA_VERSION=8u191",
+ "JAVA_ALPINE_VERSION=8.191.12-r0",
"HTTP_PROXY=",
"HTTPS_PROXY=",
"http_proxy=",
- "https_proxy=",
- "JBOSS_HOME=/opt/jboss",
- "CHEF_REPO_NAME=chef-repo",
- "CHEF_CONFIG_NAME=mso-config"
+ "https_proxy="
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
- "CMD [\"/opt/mso/scripts/start-jboss-server.sh\"]"
+ "CMD [\"/app/start-app.sh\"]"
],
"ArgsEscaped": true,
- "Image": "sha256:70f1ba3d6289411fce96ba78755a3fd6055a370d33464553d72c753889b12693",
+ "Image": "sha256:66b508441811ab4ed9968f8702a0d0a697f517bbc10d8d9076e5b98ae4437344",
"Volumes": {
- "/shared": {}
+ "/app/ca-certificates": {},
+ "/app/config": {}
},
- "WorkingDir": "",
+ "WorkingDir": "/app",
"Entrypoint": null,
"OnBuild": [],
- "Labels": {
- "Description": "This image contains the ONAP SO",
- "Version": "1.0"
- }
+ "Labels": {}
},
"DockerVersion": "17.05.0-ce",
- "Author": "\"The ONAP Team\"",
+ "Author": "",
"Config": {
- "Hostname": "6397aa10f0c4",
+ "Hostname": "ac4a12e21390",
"Domainname": "",
- "User": "root",
+ "User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
- "ExposedPorts": {
- "8080/tcp": {}
- },
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin",
+ "LANG=C.UTF-8",
+ "JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk",
+ "JAVA_VERSION=8u191",
+ "JAVA_ALPINE_VERSION=8.191.12-r0",
"HTTP_PROXY=",
"HTTPS_PROXY=",
"http_proxy=",
- "https_proxy=",
- "JBOSS_HOME=/opt/jboss",
- "CHEF_REPO_NAME=chef-repo",
- "CHEF_CONFIG_NAME=mso-config"
+ "https_proxy="
],
"Cmd": [
- "/opt/mso/scripts/start-jboss-server.sh"
+ "/app/start-app.sh"
],
"ArgsEscaped": true,
- "Image": "sha256:70f1ba3d6289411fce96ba78755a3fd6055a370d33464553d72c753889b12693",
+ "Image": "sha256:66b508441811ab4ed9968f8702a0d0a697f517bbc10d8d9076e5b98ae4437344",
"Volumes": {
- "/shared": {}
+ "/app/ca-certificates": {},
+ "/app/config": {}
},
- "WorkingDir": "",
+ "WorkingDir": "/app",
"Entrypoint": null,
"OnBuild": [],
- "Labels": {
- "Description": "This image contains the ONAP SO",
- "Version": "1.0"
- }
+ "Labels": {}
},
"Architecture": "amd64",
"Os": "linux",
- "Size": 1616881263,
- "VirtualSize": 1616881263,
+ "Size": 245926705,
+ "VirtualSize": 245926705,
"GraphDriver": {
"Data": null,
"Name": "aufs"
@@ -188,21 +255,20 @@ This command shows interesting information about the structure of the mso image.
"RootFS": {
"Type": "layers",
"Layers": [
- "sha256:a2022691bf950a72f9d2d84d557183cb9eee07c065a76485f1695784855c5193",
- "sha256:ae620432889d2553535199dbdd8ba5a264ce85fcdcd5a430974d81fc27c02b45",
- . . . many lines omitted . . .
- "sha256:0f9e9dacce9191617e979f05e32ee782b1632e07130fd7fee19b0b2d635aa006",
- "sha256:84572c6389f8ae41150e14a8f1a28a70720de91ab1032f8755b5449dc04449c9"
+ "sha256:503e53e365f34399c4d58d8f4e23c161106cfbce4400e3d0a0357967bad69390",
+ "sha256:744b4cd8cf79c70508aace3697b6c3b46bee2c14f1c14b6ff09fd0ba5735c6d4",
+ "sha256:4c6899b75fdbea2f44efe5a2f8d9f5319c1cf7e87151de0de1014aba6ce71244",
+ "sha256:2e076d24f6d1277456e33e58fc8adcfd69dfd9c025f61aa7b98d500e7195beb2",
+ "sha256:bb67f2d5f8196c22137a9e98dd4190339a65c839822d16954070eeb0b2a17aa2",
+ "sha256:afbbd0cc43999d5c5b0ff54dfd82365a3feb826e5c857d9b4a7cf378001cd4b3",
+ "sha256:1920a7ca0f8ae38a79a1339ce742aaf3d7a095922d96e37074df67cf031d5035",
+ "sha256:1261fbaef67c5be677dae1c0f50394587832ea9d8c7dc105df2f3db6dfb92a3a",
+ "sha256:a33d8ee5c18908807458ffe643184228c21d3c5d5c5df1251f0f7dfce512f7e8",
+ "sha256:80704fca12eddb4cc638cee105637266e04ab5706b4e285d4fc6cac990e96d63",
+ "sha256:55abe39073a47f29aedba790a92c351501f21b3628414fa49a073c010ee747d1",
+ "sha256:cc4136c2c52ad522bd492545d4dd18265676ca690aa755994adf64943b119b28",
+ "sha256:2163a1f989859fdb3af6e253b74094e92a0fc1ee59f5eb959971f94eb1f98094"
]
}
}
-]
-
-Log into the mso image
------------------------
-
-This command allows you to inspect the files inside the mso image. Note that an image is NOT a running container. It is the template that a container is created from.
-
-.. code-block:: bash
-
- docker run -it --entrypoint=/bin/bash openecomp/mso -i
+ ]
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
index 979619b2b6..89e12e35c2 100644
--- a/docs/release-notes.rst
+++ b/docs/release-notes.rst
@@ -8,10 +8,101 @@ Service Orchestrator Release Notes
The SO provides the highest level of service orchestration in the ONAP architecture.
-Version: 1.4.0
+Version: 1.3.7
--------------
-:Release Date: 2018-11-30
+:Release Date: 2019-01-31
+
+This is the official release package that released for the Casablanca Maintenance.
+
+Casablanca Release branch
+
+**New Features**
+
+This release is supporting the features of Casablanca and their defect fixes.
+- `SO-1400 <https://jira.onap.org/browse/SO-1336>`_
+- `SO-1408 <https://jira.onap.org/browse/SO-1408>`_
+- `SO-1416 <https://jira.onap.org/browse/SO-1416>`_
+- `SO-1417 <https://jira.onap.org/browse/SO-1417>`_
+
+**Docker Images**
+
+Dockers released for SO:
+
+ - onap/so/api-handler-infra,1.3.7
+ - onap/so/bpmn-infra,1.3.7
+ - onap/so/catalog-db-adapter,1.3.7
+ - onap/so/openstack-adapter,1.3.7
+ - onap/so/request-db-adapter,1.3.7
+ - onap/so/sdc-controller,1.3.7
+ - onap/so/sdnc-adapter,1.3.7
+ - onap/so/so-monitoring,1.3.7
+ - onap/so/vfc-adapter,1.3.7
+
+**Known Issues**
+
+- `SO-1419 <https://jira.onap.org/browse/SO-1419>`_ - is a stretch goal that is under examination.
+
+- `SDC-1955 <https://jira.onap.org/browse/SDC-1955>`_ - tested with a workaround to avoid this scenario. To be tested further with updated dockers of SDC, UUI and SO.
+
+**Security Notes**
+
+ SO code has been formally scanned during build time using NexusIQ and all Critical vulnerabilities have been addressed, items that remain open have been assessed for risk and determined to be false positive. The SO open Critical security vulnerabilities and their risk assessment have been documented as part of the `project <https://wiki.onap.org/pages/viewpage.action?pageId=43385708>`_.
+
+ Quick Links:
+
+ - `SO project page <https://wiki.onap.org/display/DW/Service+Orchestrator+Project>`_
+ - `Passing Badge information for SO <https://bestpractices.coreinfrastructure.org/en/projects/1702>`_
+ - `Project Vulnerability Review Table for SO <https://wiki.onap.org/pages/viewpage.action?pageId=43385708>`_
+
+
+Version: 1.3.6
+--------------
+
+:Release Date: 2019-01-10
+
+This is the official release package that released for the Casablanca Maintenance.
+
+Casablanca Release branch
+
+**New Features**
+
+This release is supporting the features of Casablanca and their defect fixes.
+- `SO-1336 <https://jira.onap.org/browse/SO-1336>`_
+- `SO-1249 <https://jira.onap.org/browse/SO-1249>`_
+- `SO-1257 <https://jira.onap.org/browse/SO-1257>`_
+- `SO-1258 <https://jira.onap.org/browse/SO-1258>`_
+- `SO-1256 <https://jira.onap.org/browse/SO-1256>`_
+- `SO-1194 <https://jira.onap.org/browse/SO-1256>`_
+- `SO-1248 <https://jira.onap.org/browse/SO-1248>`_
+- `SO-1184 <https://jira.onap.org/browse/SO-1184>`_
+
+**Docker Images**
+
+Dockers released for SO:
+
+ - onap/so/api-handler-infra,1.3.6
+ - onap/so/bpmn-infra,1.3.6
+ - onap/so/catalog-db-adapter,1.3.6
+ - onap/so/openstack-adapter,1.3.6
+ - onap/so/request-db-adapter,1.3.6
+ - onap/so/sdc-controller,1.3.6
+ - onap/so/sdnc-adapter,1.3.6
+ - onap/so/so-monitoring,1.3.6
+ - onap/so/vfc-adapter,1.3.6
+
+**Known Issues**
+
+
+**Security Notes**
+
+ SO code has been formally scanned during build time using NexusIQ and all Critical vulnerabilities have been addressed, items that remain open have been assessed for risk and determined to be false positive. The SO open Critical security vulnerabilities and their risk assessment have been documented as part of the `project <https://wiki.onap.org/pages/viewpage.action?pageId=43385708>`_.
+
+ Quick Links:
+
+ - `SO project page <https://wiki.onap.org/display/DW/Service+Orchestrator+Project>`_
+ - `Passing Badge information for SO <https://bestpractices.coreinfrastructure.org/en/projects/1702>`_
+ - `Project Vulnerability Review Table for SO <https://wiki.onap.org/pages/viewpage.action?pageId=43385708>`_
New release over master branch for Dublin development
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
index 03d68f88e8..897e2a5fc8 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
@@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra;
/*
* Enum for Status values returned by API Handler to Tail-F
*/
-public enum Action {
+public enum Action implements Actions{
createInstance,
updateInstance,
deleteInstance,
@@ -44,7 +44,7 @@ public enum Action {
scaleInstance,
deactivateAndCloudDelete,
scaleOut,
- recreateInstance,
+ recreateInstance,
addMembers,
removeMembers
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Actions.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java
index 5dbe44f58b..5dbe44f58b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Actions.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
index fe105a7637..d824696147 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
@@ -49,4 +49,6 @@ public class Constants {
public final static String VNF_REQUEST_SCOPE = "vnf";
public final static String SERVICE_INSTANCE_PATH = "/serviceInstances";
public final static String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation";
+ public final static String ORCHESTRATION_REQUESTS_PATH = "/orchestrationRequests";
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Constants.java
deleted file mode 100644
index d824696147..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Constants.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.apihandlerinfra;
-
-
-public class Constants {
-
- private Constants() {
- }
-
- public static final String REQUEST_ID_PATH = "/{request-id}";
-
- public static final String STATUS_SUCCESS = "SUCCESS";
-
- public static final String MODIFIED_BY_APIHANDLER = "APIH";
-
- public static final long PROGRESS_REQUEST_COMPLETED = 100L;
- public static final long PROGRESS_REQUEST_RECEIVED = 0L;
- public static final long PROGRESS_REQUEST_IN_PROGRESS = 20L;
-
- public static final String VNF_TYPE_WILDCARD = "*";
-
- public static final String VOLUME_GROUP_COMPONENT_TYPE = "VOLUME_GROUP";
-
- public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9._-]*$";
-
- public static final String A_LA_CARTE = "aLaCarte";
-
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-
- public final static String VNF_REQUEST_SCOPE = "vnf";
- public final static String SERVICE_INSTANCE_PATH = "/serviceInstances";
- public final static String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation";
- public final static String ORCHESTRATION_REQUESTS_PATH = "/orchestrationRequests";
-
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Messages.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Messages.java
deleted file mode 100644
index 555c536efb..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Messages.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.apihandlerinfra;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.onap.so.apihandler.common.ErrorNumbers;
-
-public class Messages {
-
- protected static final Map<String,String> errors = new HashMap<>();
- static {
- errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service", "Service request FAILED schema validation. %s");
- errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature", "Feature request FAILED schema validation. %s");
- errors.put(ErrorNumbers.RECIPE_DOES_NOT_EXIST, "Recipe for %s-type and action specified does not exist in catalog %s");
- errors.put(ErrorNumbers.SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION, "Service specific parameters passed in request FAILED schema validation. %s");
-
- errors.put(ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS, "%s-name (%s) is locked (status = %s) because already working on a CREATE request with same %s-name.");
- errors.put(ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID, "%s-id (%s) is locked (status = %s) because already working on a request with same action (%s) for this %s-id.");
- errors.put(ErrorNumbers.REQUEST_TIMED_OUT, "Service request timed out before completing");
- errors.put(ErrorNumbers.ERROR_FROM_BPEL, "BPEL returned an error: %s");
- errors.put(ErrorNumbers.NO_COMMUNICATION_TO_BPEL, "Could not communicate with BPEL %s");
- errors.put(ErrorNumbers.NO_RESPONSE_FROM_BPEL, "No response from BPEL %s");
- errors.put(ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, "Could not insert or update record in MSO_REQUESTS DB %s");
- errors.put(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, "Could not communicate with MSO_REQUESTS DB %s");
- errors.put(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, "Could not communicate with MSO_CATALOG DB %s");
- errors.put(ErrorNumbers.ERROR_FROM_CATALOG_DB, "Received error from MSO_CATALOG DB %s");
- }
-
- private Messages(){
- }
-
- public static Map<String,String> getErrors() {
- return errors;
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ModelType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ModelType.java
deleted file mode 100644
index 7b3ea3a181..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ModelType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.apihandlerinfra;
-
-/*
- * Enum for Status values returned by API Handler to Tail-F
-*/
-public enum ModelType {
- service,
- vnf,
- vfModule,
- volumeGroup,
- network
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java
index 813299c370..8409d9c300 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapPropertiesImpl.java
@@ -31,8 +31,8 @@ public class DmaapPropertiesImpl implements DmaapProperties {
private final Map<String, String> props = new HashMap<>();
private static final String[] propertyNames = {
- "mso.so.operational-environment.dmaap.username",
- "mso.so.operational-environment.dmaap.password",
+ "mso.so.operational-environment.dmaap.auth",
+ "mso.msoKey",
"mso.so.operational-environment.publisher.topic",
"mso.so.operational-environment.dmaap.host"
};
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java
index 52c395e1d1..31bc6fcb4f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisher.java
@@ -37,15 +37,15 @@ public class OperationalEnvironmentPublisher extends DmaapPublisher {
}
@Override
- public String getUserName() {
+ public String getAuth() {
- return this.msoProperties.get("mso.so.operational-environment.dmaap.username");
+ return this.msoProperties.get("mso.so.operational-environment.dmaap.auth");
}
@Override
- public String getPassword() {
+ public String getKey() {
- return this.msoProperties.get("mso.so.operational-environment.dmaap.password");
+ return this.msoProperties.get("mso.msoKey");
}
@Override
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisherTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisherTest.java
index 59df7ae960..7329f313a5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisherTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/OperationalEnvironmentPublisherTest.java
@@ -43,8 +43,8 @@ public class OperationalEnvironmentPublisherTest extends BaseTest {
@Test
public void getProperties() throws FileNotFoundException, IOException {
- assertEquals("testuser", publisher.getUserName());
- assertEquals("VjR5NDcxSzA=", publisher.getPassword());
+ assertEquals("B3705D6C2D521257CC2422ACCF03B001811ACC49F564DDB3A2CF2A1378B6D35A23CDCB696F2E1EDFBE6758DFE7C74B94F4A7DF84A0E2BB904935AC4D900D5597DF981ADE6CE1FF3AF993BED0", publisher.getAuth());
+ assertEquals("07a7159d3bf51a0e53be7a8f89699be7", publisher.getKey());
assertEquals("test.operationalEnvironmentEvent", publisher.getTopic());
assertEquals("http://localhost:" + env.getProperty("wiremock.server.port"), publisher.getHost().get());
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
index 63eb0534ea..4826c8756f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
@@ -1,10 +1,10 @@
# will be used as entry in DB to say SITE OFF/ON for healthcheck
-server:
- port: 8080
- tomcat:
- max-threads: 50
-ssl-enable: false
+server:
+ port: 8080
+ tomcat:
+ max-threads: 50
+
mso:
health:
@@ -77,6 +77,7 @@ mso:
username: testuser
password: VjR5NDcxSzA=
host: http://localhost:${wiremock.server.port}
+ auth: B3705D6C2D521257CC2422ACCF03B001811ACC49F564DDB3A2CF2A1378B6D35A23CDCB696F2E1EDFBE6758DFE7C74B94F4A7DF84A0E2BB904935AC4D900D5597DF981ADE6CE1FF3AF993BED0
publisher:
topic: test.operationalEnvironmentEvent
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java
index 77089cbbdc..25f5802413 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogServiceModVerIdLookup.java
@@ -22,6 +22,8 @@ package org.onap.so.db.request.beans;
import java.io.Serializable;
import java.util.Date;
+import java.util.Objects;
+import java.util.Optional;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -31,7 +33,7 @@ import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import java.util.Objects;
+
import org.apache.commons.lang3.builder.ToStringBuilder;
@IdClass(WatchdogServiceModVerIdLookupId.class)
@@ -50,6 +52,10 @@ public class WatchdogServiceModVerIdLookup implements Serializable {
@Id
@Column(name = "SERVICE_MODEL_VERSION_ID", length=45)
private String serviceModelVersionId;
+ @Column(name = "DISTRIBUTION_NOTIFICATION")
+ private String distributionNotification;
+ @Column(name = "CONSUMER_ID", length=200)
+ private String consumerId;
@Column(name = "CREATE_TIME", updatable=false)
@Temporal(TemporalType.TIMESTAMP)
private Date createTime;
@@ -57,9 +63,19 @@ public class WatchdogServiceModVerIdLookup implements Serializable {
public WatchdogServiceModVerIdLookup() {
}
- public WatchdogServiceModVerIdLookup(String distributionId, String serviceModelVersionId) {
+ /**
+ *
+ * @param distributionId - Distribution ID
+ * @param serviceModelVersionId -- service UUID
+ * @param distributionNotification -- Notification content from ASDC
+ * @param consumerId -- Consumer ID associated with subscription.
+ */
+ public WatchdogServiceModVerIdLookup(String distributionId, String serviceModelVersionId,
+ Optional<String> distributionNotification, String consumerId) {
this.distributionId = distributionId;
this.serviceModelVersionId = serviceModelVersionId;
+ this.distributionNotification= distributionNotification.orElse(null);
+ this.consumerId = consumerId;
}
public String getDistributionId() {
@@ -104,8 +120,24 @@ public class WatchdogServiceModVerIdLookup implements Serializable {
}
@Override
public String toString() {
- return new ToStringBuilder(this).append("distributionId", getDistributionId())
- .append("serviceModelVersionId", getServiceModelVersionId()).append("createTime", getCreateTime())
+ return new ToStringBuilder(this)
+ .append("distributionId", getDistributionId())
+ .append("serviceModelVersionId", getServiceModelVersionId())
+ .append("createTime", getCreateTime())
+ .append("distributionNotification", getDistributionNotification())
+ .append("consumerId", getConsumerId())
.toString();
}
+ public String getDistributionNotification() {
+ return distributionNotification;
+ }
+ public void setDistributionNotification(String distributionNotification) {
+ this.distributionNotification = distributionNotification;
+ }
+ public String getConsumerId() {
+ return consumerId;
+ }
+ public void setConsumerId(String consumerId) {
+ this.consumerId = consumerId;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
index c02b1e3030..b1ad0de5ca 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
@@ -107,7 +107,7 @@ public class CvnfcCustomization implements Serializable {
@JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID")
private VnfResourceCustomization vnfResourceCustomization;
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvnfcCustomization")
private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization;
@Override
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
index 8ef797f8fa..f5e9b5f560 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
@@ -44,6 +44,8 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.openpojo.business.annotation.BusinessKey;
+import uk.co.blackpepper.bowman.annotation.LinkedResource;
+
@Entity
@Table(name = "vnf_vfmodule_cvnfc_configuration_customization")
public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable {
@@ -202,6 +204,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable
this.created = created;
}
+ @LinkedResource
public ConfigurationResource getConfigurationResource() {
return configurationResource;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 828b2ff920..ac123b280d 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -223,7 +223,7 @@ public class CatalogDbClient {
private final Client<CloudifyManager> cloudifyManagerClient;
- private Client<CvnfcCustomization> cvnfcCustomizationClient;
+ private final Client<CvnfcCustomization> cvnfcCustomizationClient;
private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
@@ -695,18 +695,11 @@ public class CatalogDbClient {
}
public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(String vnfCustomizationUUID, String vfModuleCustomizationUUID){
- return this.getMultipleVnfcCustomizations(
- UriBuilder.fromUri(endpoint + "/vnfcCustomization/search/findByVnfCustomizationUUIDAndVfModuleCustomizationUUID")
- .queryParam("VNF_CUSTOMIZATION_UUID", vnfCustomizationUUID)
- .queryParam("VFMODULE_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build());
- }
-
- private List<CvnfcCustomization> getMultipleVnfcCustomizations(URI uri) {
- Iterable<CvnfcCustomization> vnfcIterator = cvnfcCustomizationClient.getAll(uri);
- List<CvnfcCustomization> vnfcList = new ArrayList<>();
- Iterator<CvnfcCustomization> it = vnfcIterator.iterator();
- it.forEachRemaining(vnfcList::add);
- return vnfcList;
+
+ return this.getMultipleResources(cvnfcCustomizationClient,getUri(UriBuilder
+ .fromUri(endpoint + "/cvnfcCustomization/search/findByVnfResourceCustomizationAndVfModuleCustomization")
+ .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUUID)
+ .queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString()));
}
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
index 0c82b84c0f..059d0da498 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
@@ -24,13 +24,15 @@ import java.util.List;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "cvnfcCustomization", path = "cvnfcCustomization")
-public interface CvnfcCustomizationRepository extends JpaRepository<CvnfcCustomization, String> {
+public interface CvnfcCustomizationRepository extends JpaRepository<CvnfcCustomization, Integer> {
CvnfcCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid);
List<CvnfcCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
- List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization,
- @Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization);
+
+ @Query(value = "SELECT * FROM cvnfc_customization WHERE VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID = ?1 AND VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID = ?2", nativeQuery = true)
+ List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization,@Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
index ae3c49ec7d..8de5366ff3 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
@@ -24,16 +24,20 @@ import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcCustomization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@@ -51,7 +55,7 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
@Test
@Transactional
- public void createAndGetTest() throws Exception {
+ public void createAndGetAllTest() throws Exception {
CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
@@ -100,4 +104,235 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
}
Assert.assertTrue(matchFound);
}
+
+ @Test
+ @Transactional
+ public void createAndGetCvnfcCustomizationListTest() throws Exception {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModule vFModule = setUpVfModule();
+ VnfResource vnfResource = setUpVnfResource();
+
+ vFModule.setVnfResources(vnfResource);
+ vfModuleCustomization.setVfModule(vFModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ vnfResourceCustomizations.add(vnfResourceCustomization);
+ vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findByModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ boolean matchFound = false;
+ for (CvnfcCustomization foundCvnfcCustomization : cvnfcCustomizationList) {
+ if (foundCvnfcCustomization.getDescription().equalsIgnoreCase(cvnfcCustomization.getDescription())) {
+
+ assertThat(cvnfcCustomization, sameBeanAs(foundCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+
+ matchFound = true;
+ break;
+ }
+ }
+ Assert.assertTrue(matchFound);
+ }
+
+
+ @Test
+ @Transactional
+ public void createAndGetCvnfcCustomizationTest() throws Exception {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModule vFModule = setUpVfModule();
+ VnfResource vnfResource = setUpVnfResource();
+
+ vFModule.setVnfResources(vnfResource);
+ vfModuleCustomization.setVfModule(vFModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ vnfResourceCustomizations.add(vnfResourceCustomization);
+ vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ CvnfcCustomization cvnfcCustomizationList = cvnfcCustomizationRepository.findOneByModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ assertThat(cvnfcCustomization, sameBeanAs(cvnfcCustomizationList)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+
+ }
+
+ @Test
+ @Transactional
+ public void createAndGetCvnfcCustomizationsTest() throws Exception {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModule vFModule = setUpVfModule();
+ VnfResource vnfResource = setUpVnfResource();
+
+ vFModule.setVnfResources(vnfResource);
+ vfModuleCustomization.setVfModule(vFModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ vnfResourceCustomizations.add(vnfResourceCustomization);
+ vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findByVnfResourceCustomizationAndVfModuleCustomization("cf9f6efc-9f14-11e8-98d0-529269fb1459","cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ boolean matchFound = false;
+ for (CvnfcCustomization foundCvnfcCustomization : cvnfcCustomizationList) {
+ if (foundCvnfcCustomization.getDescription().equalsIgnoreCase(cvnfcCustomization.getDescription())) {
+
+ assertThat(cvnfcCustomization, sameBeanAs(foundCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+
+ matchFound = true;
+ break;
+ }
+ }
+ Assert.assertTrue(matchFound);
+ }
+
+ @Test
+ @Transactional
+ public void createAndGetCvnfcCustomizationsExtractToscaModelTest() throws Exception {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModule vFModule = setUpVfModule();
+ VnfResource vnfResource = setUpVnfResource();
+
+ vFModule.setVnfResources(vnfResource);
+ vfModuleCustomization.setVfModule(vFModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ vnfResourceCustomizations.add(vnfResourceCustomization);
+ vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setToscaNodeType("FabricConfiguration");
+ configurationResource.setModelInvariantUUID("modelInvariantUUID");
+ configurationResource.setModelUUID("modelUUID");
+ configurationResource.setModelName("modelName");
+ configurationResource.setModelVersion("modelVersion");
+ configurationResource.setDescription("description");
+ configurationResource.setToscaNodeType("toscaNodeType");
+
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("configurationFunction");
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("modelCustomizationUUID");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
+ vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName");
+ vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(vfModuleCustomization);
+ vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
+ vnfVfmoduleCvnfcConfigurationCustomizationSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
+ cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet);
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findByVnfResourceCustomizationAndVfModuleCustomization("cf9f6efc-9f14-11e8-98d0-529269fb1459","cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ boolean matchFound = false;
+ for (CvnfcCustomization foundCvnfcCustomization : cvnfcCustomizationList) {
+ if (foundCvnfcCustomization.getDescription().equalsIgnoreCase(cvnfcCustomization.getDescription())) {
+
+ assertThat(cvnfcCustomization, sameBeanAs(foundCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+
+ matchFound = true;
+
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = foundCvnfcCustomization.getVnfVfmoduleCvnfcConfigurationCustomization();
+ for(VnfVfmoduleCvnfcConfigurationCustomization customization : vnfVfmoduleCvnfcConfigurationCustomizations) {
+ Assert.assertTrue(customization.getConfigurationResource().getToscaNodeType().equalsIgnoreCase("toscaNodeType"));
+ }
+ break;
+ }
+ }
+ Assert.assertTrue(matchFound);
+
+ }
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
index 3d736edb95..23308639b6 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
@@ -1,79 +1,75 @@
-/**
-============LICENSE_START=======================================================
- Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
- limitations under the License.
-
-SPDX-License-Identifier: Apache-2.0
-============LICENSE_END=========================================================
-
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
-*/
-
-import { BrowserModule } from '@angular/platform-browser';
-import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
-
-import { AppRoutingModule } from './app-routing.module';
-import { AppComponent } from './app.component';
-import { SidebarComponent } from './sidebar/sidebar.component';
-import { TopbarComponent } from './topbar/topbar.component';
-import { HomeComponent } from './home/home.component';
-import { HttpClientModule } from '@angular/common/http';
-import { FormsModule, ReactiveFormsModule } from '@angular/forms';
-import { MatTableModule } from '@angular/material';
-import { DetailsComponent } from './details/details.component';
-import { ToastrNotificationService } from './toastr-notification-service.service';
-import { MatTabsModule } from '@angular/material/tabs';
-import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-import { MatSelectModule } from '@angular/material/select';
-import { MatFormFieldModule, MatInputModule } from '@angular/material';
-import { MatDatepickerModule } from '@angular/material/datepicker';
-import { MatNativeDateModule } from '@angular/material';
-import { MatCardModule } from '@angular/material/card';
-import { NgxSpinnerModule } from 'ngx-spinner';
-import { RouterModule, Routes } from '@angular/router';
-import { APP_BASE_HREF } from '@angular/common';
-
-@NgModule({
- declarations: [
- AppComponent,
- SidebarComponent,
- TopbarComponent,
- HomeComponent,
- DetailsComponent
- ],
- imports: [
- BrowserModule,
- AppRoutingModule,
- HttpClientModule,
- FormsModule,
- MatTableModule,
- MatTabsModule,
- BrowserAnimationsModule,
- MatSelectModule,
- MatFormFieldModule,
- MatInputModule,
- MatDatepickerModule,
- MatNativeDateModule,
- MatCardModule,
- NgxSpinnerModule,
- RouterModule,
- RouterModule.forRoot([])
- ],
- schemas: [
- CUSTOM_ELEMENTS_SCHEMA
- ],
- providers: [ToastrNotificationService],
- bootstrap: [AppComponent]
-})
-export class AppModule { }
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+ limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+*/
+
+import { BrowserModule } from '@angular/platform-browser';
+import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+
+import { AppRoutingModule } from './app-routing.module';
+import { AppComponent } from './app.component';
+import { SidebarComponent } from './sidebar/sidebar.component';
+import { TopbarComponent } from './topbar/topbar.component';
+import { HomeComponent } from './home/home.component';
+import { HttpClientModule } from '@angular/common/http';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { DetailsComponent } from './details/details.component';
+import { ToastrNotificationService } from './toastr-notification-service.service';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { MatFormFieldModule, MatInputModule, MatTableModule, MatTabsModule, MatSelectModule, MatNativeDateModule, MatDatepickerModule, MatCardModule, MatPaginatorModule, MatSortModule } from '@angular/material';
+import { NgxSpinnerModule } from 'ngx-spinner';
+import { RouterModule, Routes } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+
+@NgModule({
+ declarations: [
+ AppComponent,
+ SidebarComponent,
+ TopbarComponent,
+ HomeComponent,
+ DetailsComponent
+ ],
+ imports: [
+ BrowserModule,
+ AppRoutingModule,
+ HttpClientModule,
+ FormsModule,
+ MatTableModule,
+ MatTabsModule,
+ BrowserAnimationsModule,
+ MatSelectModule,
+ MatFormFieldModule,
+ MatInputModule,
+ MatDatepickerModule,
+ MatNativeDateModule,
+ MatCardModule,
+ NgxSpinnerModule,
+ RouterModule,
+ MatPaginatorModule,
+ MatSortModule,
+ RouterModule.forRoot([])
+ ],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ],
+ providers: [ToastrNotificationService],
+ bootstrap: [AppComponent]
+})
+export class AppModule { }
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
index 834b8c34ea..0438aa3419 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
@@ -1,110 +1,110 @@
-/**
-============LICENSE_START=======================================================
- Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
- limitations under the License.
-
-SPDX-License-Identifier: Apache-2.0
-============LICENSE_END=========================================================
-
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
-*/
-
-import { TestBed, inject } from '@angular/core/testing';
-
-import { DataService } from './data.service';
-import { HttpClient } from '@angular/common/http';
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
-import { async } from '@angular/core/testing';
-import { HttpClientModule } from '@angular/common/http';
-import { ToastrNotificationService } from './toastr-notification-service.service';
-import { environment } from '../environments/environment';
-
-class StubbedToastrNotificationService extends ToastrNotificationService {
- toastrSettings() {
- }
-}
-
-describe('DataService', () => {
- beforeEach(() => {
- TestBed.configureTestingModule({
- providers: [DataService, { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
- imports: [HttpClientTestingModule]
- });
- });
-
- // Ensure creation of DataService component
- it('component should be created', async(inject([HttpTestingController, DataService, ToastrNotificationService],
- (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
- expect(service).toBeTruthy();
- })));
-
- // Test retrieveInstance function making POST call
- it('test retrieveInstance POST request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
- (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
- service.retrieveInstance({}, 1, 2).subscribe(data => { });
- var url = environment.soMonitoringBackendURL + 'v1/search?from=1&to=2';
- const mockReq = httpClient.expectOne(url);
- expect(mockReq.request.method).toEqual('POST');
- mockReq.flush({});
- })));
-
- // Test getProcessInstanceId function making GET request to retrieve processInstanceID
- it('test getProcessInstanceId GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
- (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
- service.getProcessInstanceId("").subscribe(data => { });
- var url = environment.soMonitoringBackendURL + 'process-instance-id/' + "";
- const mockReq = httpClient.expectOne(url);
- expect(mockReq.request.method).toEqual('GET');
- mockReq.flush({});
- })));
-
- // Test getActivityInstance function making GET request to retrieve activityInstance
- it('test getActivityInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
- (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
- service.getActivityInstance("").subscribe(data => { });
- var url = environment.soMonitoringBackendURL + 'activity-instance/' + "";
- const mockReq = httpClient.expectOne(url);
- expect(mockReq.request.method).toEqual('GET');
- mockReq.flush({});
- })));
-
- // Test getProcessInstance function making GET request to retrieve processInstance
- it('test getProcessInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
- (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
- service.getProcessInstance("");
- var url = environment.soMonitoringBackendURL + 'process-instance/' + "";
- const mockReq = httpClient.expectOne(url);
- expect(mockReq.request.method).toEqual('GET');
- })));
-
- // Test getProcessDefinition function making GET request to retrieve processDefinition
- it('test getProcessDefinition GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
- (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
- service.getProcessDefinition("").subscribe(data => { });
- var url = environment.soMonitoringBackendURL + 'process-definition/' + "";
- const mockReq = httpClient.expectOne(url);
- expect(mockReq.request.method).toEqual('GET');
- mockReq.flush({});
- })));
-
- // Test getVariableInstance function making GET request to retrieve variableInstance
- it('test getVariableInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
- (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
- service.getVariableInstance("").subscribe(data => { });
- var url = environment.soMonitoringBackendURL + 'variable-instance/' + "";
- const mockReq = httpClient.expectOne(url);
- expect(mockReq.request.method).toEqual('GET');
- mockReq.flush({});
- })));
-});
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+ limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+*/
+
+import { TestBed, inject } from '@angular/core/testing';
+
+import { DataService } from './data.service';
+import { HttpClient } from '@angular/common/http';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { async } from '@angular/core/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { ToastrNotificationService } from './toastr-notification-service.service';
+import { environment } from '../environments/environment';
+
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {
+ }
+}
+
+describe('DataService', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [DataService, { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
+ imports: [HttpClientTestingModule]
+ });
+ });
+
+ // Ensure creation of DataService component
+ it('component should be created', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ expect(service).toBeTruthy();
+ })));
+
+ // Test retrieveInstance function making POST call
+ it('test retrieveInstance POST request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.retrieveInstance({}, 1, 2).subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'v1/search?from=1&to=2';
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('POST');
+ mockReq.flush({});
+ })));
+
+ // Test getProcessInstanceId function making GET request to retrieve processInstanceID
+ it('test getProcessInstanceId GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getProcessInstanceId("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'process-instance-id/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
+
+ // Test getActivityInstance function making GET request to retrieve activityInstance
+ it('test getActivityInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getActivityInstance("").then(data => { });
+ var url = environment.soMonitoringBackendURL + 'activity-instance/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
+
+ // Test getProcessInstance function making GET request to retrieve processInstance
+ it('test getProcessInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getProcessInstance("");
+ var url = environment.soMonitoringBackendURL + 'process-instance/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ })));
+
+ // Test getProcessDefinition function making GET request to retrieve processDefinition
+ it('test getProcessDefinition GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getProcessDefinition("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'process-definition/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
+
+ // Test getVariableInstance function making GET request to retrieve variableInstance
+ it('test getVariableInstance GET request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ (httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
+ service.getVariableInstance("").subscribe(data => { });
+ var url = environment.soMonitoringBackendURL + 'variable-instance/' + "";
+ const mockReq = httpClient.expectOne(url);
+ expect(mockReq.request.method).toEqual('GET');
+ mockReq.flush({});
+ })));
+});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss
index 52ace2f328..2789723964 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss
@@ -1,68 +1,72 @@
-/**
-============LICENSE_START=======================================================
- Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
- limitations under the License.
-
-SPDX-License-Identifier: Apache-2.0
-============LICENSE_END=========================================================
-
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
-*/
-
-#canvas {
- background: white;
- padding: 0;
- margin: 0;
- width: 70%;
- height: 470px;
- margin-top: 0;
- box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
-}
-
-#besideCanvas {
- background: white;
- padding-left: 20px;
- margin: 0;
- width: 28%;
- height: 470px;
- margin-top: 0;
- box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
- font-family: 'Montserrat', sans-serif;
- font-size: 17px;
-}
-
-.topCanvas {
- display: flex;
- justify-content: space-between;
-}
-
-.mat-column-durationInMillis {
- flex: 0 0 8%;
-}
-
-.mat-column-name {
- flex: 0 0 40%;
-}
-
-.mat-column-type {
- flex: 0 0 8%;
-}
-
-.mat-column-value {
- flex: 0 0 52%;
-}
-
-.highlight:not(.djs-connection) .djs-visual > :nth-child(1) {
- fill: cyan !important; /* color elements as green */
- }
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+ limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+*/
+#canvas {
+ background: white;
+ padding: 0;
+ margin: 0;
+ width: 70%;
+ height: 470px;
+ margin-top: 0;
+ box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
+}
+
+#besideCanvas {
+ background: white;
+ padding-left: 20px;
+ margin: 0;
+ width: 28%;
+ height: 470px;
+ margin-top: 0;
+ box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
+ font-family: 'Montserrat', sans-serif;
+ font-size: 17px;
+}
+
+.topCanvas {
+ display: flex;
+ justify-content: space-between;
+}
+
+.mat-column-durationInMillis {
+ flex: 0 0 8%;
+}
+
+.mat-column-name {
+ flex: 0 0 40%;
+}
+
+.mat-column-type {
+ flex: 0 0 8%;
+}
+
+.mat-column-value {
+ flex: 0 0 52%;
+}
+
+.highlight:not(.djs-connection) .djs-visual > :nth-child(1) {
+ fill: cyan !important;
+ /* color elements as green */
+}
+
+.tab-group {
+ word-break: break-all;
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html
index e4556ca840..0c0e1c04c3 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html
@@ -17,7 +17,7 @@ limitations under the License.
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com, andrei.barcovschi@ericsson.com
-->
<base href="/">
@@ -50,26 +50,26 @@ SPDX-License-Identifier: Apache-2.0
<input matInput #searchValueRI type="text" [(ngModel)]="searchData.requestId" placeholder="Request Id">
</mat-form-field>
- <!-- Angular Start Date Picker -->
- <mat-form-field class="startDate">
- <input matInput #startDate [matDatepicker]="picker" [(ngModel)]="searchData.startDate" placeholder="Choose a start date">
- <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
- <mat-datepicker #picker></mat-datepicker>
- </mat-form-field>
-
- <!-- Dropdown box for Start Hour selection -->
- <mat-form-field class="selectHour">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartHour" name="hourFrom" placeholder="Select Hour">
- <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
- </mat-select>
- </mat-form-field>
-
- <!-- Dropdown box for Start Minute selection -->
- <mat-form-field class="selectMinute">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartMinute" name="minuteFrom" placeholder="Select Minute">
- <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
- </mat-select>
- </mat-form-field>
+ <!-- Angular Start Date Picker -->
+ <mat-form-field class="startDate">
+ <input matInput #startDate [matDatepicker]="picker" [(ngModel)]="searchData.startDate" placeholder="Choose a start date">
+ <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
+ <mat-datepicker #picker></mat-datepicker>
+ </mat-form-field>
+
+ <!-- Dropdown box for Start Hour selection -->
+ <mat-form-field class="selectHour">
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartHour" name="hourFrom" placeholder="Select Hour">
+ <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
+ </mat-select>
+ </mat-form-field>
+
+ <!-- Dropdown box for Start Minute selection -->
+ <mat-form-field class="selectMinute">
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartMinute" name="minuteFrom" placeholder="Select Minute">
+ <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
+ </mat-select>
+ </mat-form-field>
</div>
<!-- Dropdown Filter and TextBox for Service Name -->
@@ -83,26 +83,26 @@ SPDX-License-Identifier: Apache-2.0
<input matInput #searchValueSN type="text" [(ngModel)]="searchData.serviceInstanceName" placeholder="Service Name">
</mat-form-field>
- <!-- Angular End Date Picker -->
- <mat-form-field class="endDate">
- <input matInput #endDate [matDatepicker]="endpicker" [(ngModel)]="searchData.endDate" placeholder="Choose an end date">
- <mat-datepicker-toggle matSuffix [for]="endpicker"></mat-datepicker-toggle>
- <mat-datepicker #endpicker></mat-datepicker>
- </mat-form-field>
-
- <!-- Dropdown box for End Hour selection -->
- <mat-form-field class="selectHour">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndHour" name="hourTo" placeholder="Select Hour">
- <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
- </mat-select>
- </mat-form-field>
-
- <!-- Dropdown box for End Minute selection -->
- <mat-form-field class="selectMinute">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndMinute" name="minuteTo" placeholder="Select Minute">
- <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
- </mat-select>
- </mat-form-field>
+ <!-- Angular End Date Picker -->
+ <mat-form-field class="endDate">
+ <input matInput #endDate [matDatepicker]="endpicker" [(ngModel)]="searchData.endDate" placeholder="Choose an end date">
+ <mat-datepicker-toggle matSuffix [for]="endpicker"></mat-datepicker-toggle>
+ <mat-datepicker #endpicker></mat-datepicker>
+ </mat-form-field>
+
+ <!-- Dropdown box for End Hour selection -->
+ <mat-form-field class="selectHour">
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndHour" name="hourTo" placeholder="Select Hour">
+ <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
+ </mat-select>
+ </mat-form-field>
+
+ <!-- Dropdown box for End Minute selection -->
+ <mat-form-field class="selectMinute">
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndMinute" name="minuteTo" placeholder="Select Minute">
+ <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
+ </mat-select>
+ </mat-form-field>
</div>
<!-- Dropdown Filter for Status -->
@@ -125,42 +125,44 @@ SPDX-License-Identifier: Apache-2.0
<div class="example-container mat-elevation-z8">
<mat-tab-group class="tab-group">
<mat-tab label="Service Instances">
- <mat-table [dataSource]="processData">
+ <mat-table [dataSource]="processData" matSort>
<ng-container matColumnDef="requestId">
- <mat-header-cell *matHeaderCellDef> Request Id </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> Request Id </mat-header-cell>
<mat-cell *matCellDef="let process"><a routerLink="" (click)="getProcessIsntanceId(process.requestId)">{{ process.requestId }}</a></mat-cell>
</ng-container>
<ng-container matColumnDef="serviceInstanceId">
- <mat-header-cell *matHeaderCellDef> Instance Id </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> Instance Id </mat-header-cell>
<mat-cell *matCellDef="let process"> {{ process.serviceInstanceId }} </mat-cell>
</ng-container>
<ng-container matColumnDef="serviceIstanceName">
- <mat-header-cell *matHeaderCellDef> Instance Name </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> Instance Name </mat-header-cell>
<mat-cell *matCellDef="let process"> {{ process.serviceIstanceName }} </mat-cell>
</ng-container>
<ng-container matColumnDef="networkId">
- <mat-header-cell *matHeaderCellDef> Network Id </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> Network Id </mat-header-cell>
<mat-cell *matCellDef="let process"> {{ process.networkId }} </mat-cell>
</ng-container>
<ng-container matColumnDef="requestStatus">
- <mat-header-cell *matHeaderCellDef> Request Status </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> Request Status </mat-header-cell>
<mat-cell *matCellDef="let process"> {{ process.requestStatus }} </mat-cell>
</ng-container>
<ng-container matColumnDef="serviceType">
- <mat-header-cell *matHeaderCellDef> Service Type </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> Service Type </mat-header-cell>
<mat-cell *matCellDef="let process"> {{ process.serviceType }} </mat-cell>
</ng-container>
<ng-container matColumnDef="startTime">
- <mat-header-cell *matHeaderCellDef> Start Time </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> Start Time </mat-header-cell>
<mat-cell *matCellDef="let process"> {{ (process.startTime | date:'yyyy-MM-dd HH:mm:sss Z') }} </mat-cell>
</ng-container>
<ng-container matColumnDef="endTime">
- <mat-header-cell *matHeaderCellDef> End Time </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> End Time </mat-header-cell>
<mat-cell *matCellDef="let process"> {{ (process.endTime | date:'yyyy-MM-dd HH:mm:sss Z') }} </mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
+ <mat-paginator [pageSizeOptions]="pageSizeOptions" showFirstLastButtons>
+ </mat-paginator>
</mat-tab>
<mat-tab label="Service Statistics">
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts
index b8fac61adf..25b75d707d 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts
@@ -17,27 +17,23 @@ See the License for the specific language governing permissions and
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com, andrei.barcovschi@ericsson.com
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, ViewChild, ElementRef, Input, ViewEncapsulation } from '@angular/core';
import { DataService } from '../data.service';
import { ActivatedRoute, Router } from "@angular/router";
import { Process } from '../model/process.model';
-
import { ProcessInstanceId } from '../model/processInstanceId.model';
import { ToastrNotificationService } from '../toastr-notification-service.service';
import { MatSelectModule } from '@angular/material/select';
-import { ViewEncapsulation } from '@angular/core';
-import { FormsModule } from '@angular/forms';
-import { MatFormFieldModule, MatInputModule } from '@angular/material';
+import { FormsModule, FormControl } from '@angular/forms';
import { SearchData } from '../model/searchData.model';
import { MatDatepickerModule } from '@angular/material/datepicker';
-import { FormControl } from '@angular/forms';
import { SearchRequest } from '../model/SearchRequest.model';
-import { ElementRef } from '@angular/core';
-import { Input } from '@angular/core';
import { NgxSpinnerService } from 'ngx-spinner';
+import { MatFormFieldModule, MatInputModule, MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
+import { Constants } from './home.constant';
@Component({
selector: 'app-home',
@@ -60,24 +56,19 @@ export class HomeComponent implements OnInit {
percentagePending = 0;
percentageUnlocked = 0;
- options = [{ name: "EQUAL", value: "EQ" }, { name: "NOT EQUAL", value: "NEQ" }, { name: "LIKE", value: "LIKE" }];
- statusOptions = [{ name: "ALL", value: "ALL" }, { name: "COMPLETE", value: "COMPLETE" }, { name: "IN_PROGRESS", value: "IN_PROGRESS" },
- { name: "FAILED", value: "FAILED" }, { name: "PENDING", value: "PENDING" }, { name: "UNLOCKED", value: "UNLOCKED" }];
-
- hourOptions = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11",
- "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"];
+ options = Constants.OPTIONS;
+ statusOptions = Constants.STATUS_OPTIONS;
+ hourOptions = Constants.HOUR_OPTIONS;
+ minuteOptions = Constants.MINUTE_OPTIONS;
+ displayedColumns = Constants.DISPLAYED_COLUMNS;
+ pageSizeOptions = Constants.DEFAULT_PAGE_SIZE_OPTIONS;
- minuteOptions = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15",
- "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35",
- "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55",
- "56", "57", "58", "59"];
-
- processData: Process[];
searchData: SearchData;
-
startingDate: Date;
+ processData: MatTableDataSource<Process>;
- displayedColumns = ['requestId', 'serviceInstanceId', 'serviceIstanceName', 'networkId', 'requestStatus', 'serviceType', 'startTime', 'endTime'];
+ @ViewChild(MatPaginator) paginator: MatPaginator;
+ @ViewChild(MatSort) sort: MatSort;
constructor(private route: ActivatedRoute, private data: DataService,
private router: Router, private popup: ToastrNotificationService,
@@ -93,16 +84,21 @@ export class HomeComponent implements OnInit {
this.data.retrieveInstance(result.getFilters(), result.getStartTimeInMilliseconds(), result.getEndTimeInMilliseconds())
.subscribe((data: Process[]) => {
this.spinner.hide();
- this.processData = data;
+ var processData: Process[] = data;
+ this.processData = new MatTableDataSource<Process>(processData);
+ this.processData.sort = this.sort;
+ this.processData.paginator = this.paginator;
+ this.processData.paginator.firstPage();
+
this.popup.info("Number of records found: " + data.length)
// Calculate Statistics for Service Statistics tab
- this.completeVal = this.processData.filter(i => i.requestStatus === "COMPLETE").length;
- this.inProgressVal = this.processData.filter(i => i.requestStatus === "IN_PROGRESS").length;
- this.failedVal = this.processData.filter(i => i.requestStatus === "FAILED").length;
- this.pendingVal = this.processData.filter(i => i.requestStatus === "PENDING").length;
- this.unlockedVal = this.processData.filter(i => i.requestStatus === "UNLOCKED").length;
- this.totalVal = this.processData.length;
+ this.completeVal = processData.filter(i => i.requestStatus === "COMPLETE").length;
+ this.inProgressVal = processData.filter(i => i.requestStatus === "IN_PROGRESS").length;
+ this.failedVal = processData.filter(i => i.requestStatus === "FAILED").length;
+ this.pendingVal = processData.filter(i => i.requestStatus === "PENDING").length;
+ this.unlockedVal = processData.filter(i => i.requestStatus === "UNLOCKED").length;
+ this.totalVal = processData.length;
// Calculate percentages to 2 decimal places and compare to 0 to avoid NaN error
if (this.totalVal != 0) {
@@ -142,7 +138,5 @@ export class HomeComponent implements OnInit {
});
}
- ngOnInit() {
-
- }
+ ngOnInit() { }
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.constant.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.constant.ts
new file mode 100644
index 0000000000..23ef63ff1e
--- /dev/null
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.constant.ts
@@ -0,0 +1,41 @@
+
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2019 Ericsson. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+ limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: andrei.barcovschi@ericsson.com, waqas.ikram@ericsson.com
+*/
+
+export class Constants {
+ public static OPTIONS = [{ name: "EQUAL", value: "EQ" }, { name: "NOT EQUAL", value: "NEQ" }, { name: "LIKE", value: "LIKE" }];
+
+ public static STATUS_OPTIONS = [{ name: "ALL", value: "ALL" }, { name: "COMPLETE", value: "COMPLETE" }, { name: "IN_PROGRESS", value: "IN_PROGRESS" },
+ { name: "FAILED", value: "FAILED" }, { name: "PENDING", value: "PENDING" }, { name: "UNLOCKED", value: "UNLOCKED" }];
+
+ public static HOUR_OPTIONS = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11",
+ "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"];
+
+ public static MINUTE_OPTIONS = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15",
+ "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35",
+ "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55",
+ "56", "57", "58", "59"];
+
+ public static DISPLAYED_COLUMNS = ['requestId', 'serviceInstanceId', 'serviceIstanceName', 'networkId', 'requestStatus', 'serviceType', 'startTime', 'endTime'];
+
+ public static DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100];
+}