aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-03-14 02:07:32 -0400
committerRob Daugherty <rd472p@att.com>2018-03-14 04:08:41 -0400
commit38f720752af4d4aad8c4e467a288d9048659f688 (patch)
treee81066a8b5c77272e30fb57a64999573c4db4d86 /common
parentaee3d223f92a6f250f43e17558a2dfd576ff7294 (diff)
AT&T 1712 and 1802 release code
This is code from AT&T's 1712 and 1802 releases. Change-Id: Ie1e85851e94bc66c4d9514a0226c221939531a04 Issue-ID: SO-425 Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'common')
-rw-r--r--common/pom.xml97
-rw-r--r--common/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java35
-rw-r--r--common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java94
-rw-r--r--common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java44
-rw-r--r--common/src/main/java/org/openecomp/mso/client/RestProperties.java30
-rw-r--r--common/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java73
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java69
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java61
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java62
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIConfigurationClient.java74
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIErrorFormatter.java57
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAINamespaceConstants.java31
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIObjectName.java29
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIObjectPlurals.java65
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIObjectType.java98
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriPartial.java26
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriTemplate.java26
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java28
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIQueryClient.java93
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java44
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesClient.java244
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java35
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java67
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientI.java44
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java165
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAISubgraphType.java38
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAITransactionalClient.java263
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java31
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java49
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java32
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java71
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIVersion.java41
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/Format.java43
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java25
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntityObject.java29
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java46
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/AAIResultWrapper.java78
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/Configuration.java162
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java82
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/Relationships.java140
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java46
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/Results.java51
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java75
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/OperationBody.java69
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transaction.java95
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transactions.java54
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIResourceUri.java36
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUri.java58
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactory.java73
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/uri/Depth.java45
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/uri/NodesUri.java44
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUri.java129
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/uri/SimpleUri.java187
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParser.java29
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImpl.java68
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadException.java40
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriComputationException.java34
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriNotFoundException.java29
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/exceptions/BulkProcessFailed.java28
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironment.java159
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java67
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java55
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/objects/AAIServiceInstance.java135
-rw-r--r--common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java68
-rw-r--r--common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultDmaapPropertiesImpl.java49
-rw-r--r--common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java80
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java26
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java73
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java131
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java32
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java62
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java51
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java26
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java34
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java34
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java58
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java131
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java60
-rw-r--r--common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java56
-rw-r--r--common/src/main/java/org/openecomp/mso/client/exceptions/SDNOException.java39
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/GRMAction.java37
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/GRMClient.java83
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/GRMDefaultPropertiesImpl.java63
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/GRMProperties.java30
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/GRMPropertiesLoader.java48
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/GRMRestClient.java61
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/GRMRestInvoker.java73
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/beans/OperationalInfo.java82
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/beans/Property.java58
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPoint.java247
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointList.java48
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookup.java61
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookupRequest.java63
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointRequest.java63
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/beans/Status.java82
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/beans/Version.java69
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/beans/VersionLookup.java49
-rw-r--r--common/src/main/java/org/openecomp/mso/client/grm/exceptions/GRMClientCallFailed.java32
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java49
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java93
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java49
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java157
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java33
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java94
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java57
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java57
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java66
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java35
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/RestClient.java227
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java99
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java105
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java87
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java94
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java105
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java56
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java53
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java69
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java58
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java58
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java48
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java87
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java88
-rw-r--r--common/src/main/java/org/openecomp/mso/client/ruby/RubyClient.java90
-rw-r--r--common/src/main/java/org/openecomp/mso/client/ruby/beans/Event.java67
-rw-r--r--common/src/main/java/org/openecomp/mso/client/ruby/beans/MsoRequest.java207
-rw-r--r--common/src/main/java/org/openecomp/mso/client/ruby/beans/Ruby.java68
-rw-r--r--common/src/main/java/org/openecomp/mso/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java56
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClient.java158
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java38
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java111
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/beans/AAIParamList.java87
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java77
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java91
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHdCustom.java170
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java185
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java116
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java131
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java161
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java55
-rw-r--r--common/src/main/java/org/openecomp/mso/jsonpath/JsonPathUtil.java82
-rw-r--r--common/src/main/java/org/openecomp/mso/logger/MessageEnum.java1
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java46
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/CloudConfiguration.java106
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/ExceptionType.java156
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationListResponse.java41
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationResponse.java40
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceDirection.java35
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceReferences.java110
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/LineOfBusiness.java44
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelInfo.java154
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelType.java35
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/OwningEntity.java60
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/Platform.java44
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/PolicyException.java59
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/Project.java45
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstance.java70
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstanceList.java53
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/Request.java83
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestDetails.java280
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestError.java118
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestInfo.java239
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestList.java38
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestParameters.java141
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestReferences.java43
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestStatus.java59
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceException.java59
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java112
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesResponse.java36
-rw-r--r--common/src/main/java/org/openecomp/mso/serviceinstancebeans/SubscriberInfo.java94
-rw-r--r--common/src/main/resources/ASDC.properties5
-rw-r--r--common/src/main/resources/dmaap/default-consumer.properties28
-rw-r--r--common/src/main/resources/dmaap/default-publisher.properties28
-rw-r--r--common/src/main/resources/dmaap/empty.txt0
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java334
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java75
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAIExceptionMapperTest.java63
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAIObjectTypeTest.java39
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java57
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java96
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.java83
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAIURITest.java44
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java98
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/entities/RelationshipsTest.java61
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactoryTest.java40
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUriTest.java194
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriFromUriTest.java59
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriTest.java69
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImplTest.java47
-rw-r--r--common/src/test/java/org/openecomp/mso/client/dmaap/DmaapClientTest.java41
-rw-r--r--common/src/test/java/org/openecomp/mso/client/grm/GRMBeansTest.java59
-rw-r--r--common/src/test/java/org/openecomp/mso/client/grm/GRMClientTest.java185
-rw-r--r--common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointListTest.java75
-rw-r--r--common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointRequestTest.java90
-rw-r--r--common/src/test/java/org/openecomp/mso/client/policy/PolicyClientImplTest.java75
-rw-r--r--common/src/test/java/org/openecomp/mso/client/ruby/RubyCheckClientTest.java106
-rw-r--r--common/src/test/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClientTest.java94
-rw-r--r--common/src/test/java/org/openecomp/mso/client/sdno/SDNOValidatorTest.java116
-rw-r--r--common/src/test/java/org/openecomp/mso/jsonpath/JsonPathUtilTest.java49
-rw-r--r--common/src/test/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequestTest.java44
-rw-r--r--common/src/test/resources/__files/Policy/policyAbortResponse.json1
-rw-r--r--common/src/test/resources/__files/Policy/policySkipResponse.json1
-rw-r--r--common/src/test/resources/__files/aai/bulkprocess/response-failure.json32
-rw-r--r--common/src/test/resources/__files/aai/bulkprocess/response-success.json32
-rw-r--r--common/src/test/resources/__files/aai/bulkprocess/test-request.json22
-rw-r--r--common/src/test/resources/__files/aai/pserver.json14
-rw-r--r--common/src/test/resources/__files/aai/resources/e2e-complex.json660
-rw-r--r--common/src/test/resources/__files/aai/resources/empty-query-result.json3
-rw-r--r--common/src/test/resources/__files/aai/resources/mockObject.json10
-rw-r--r--common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json8
-rw-r--r--common/src/test/resources/__files/grm/endpoints.json145
-rw-r--r--common/src/test/resources/aai.properties1
-rw-r--r--common/src/test/resources/dmaap.properties7
-rw-r--r--common/src/test/resources/mso-bad.json20
-rw-r--r--common/src/test/resources/mso2.json59
-rw-r--r--common/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json15
-rw-r--r--common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json26
-rw-r--r--common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json26
-rw-r--r--common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json22
-rw-r--r--common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json22
-rw-r--r--common/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json25
-rw-r--r--common/src/test/resources/org/openecomp/mso/client/sdno/output-success.json22
-rw-r--r--common/src/test/resources/org/openecomp/mso/client/sdno/response.json17
-rw-r--r--common/src/test/resources/policy.properties4
223 files changed, 16237 insertions, 272 deletions
diff --git a/common/pom.xml b/common/pom.xml
index c83f7d344a..4d2d66a6bf 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -6,11 +6,12 @@
<artifactId>so</artifactId>
<version>1.2.0-SNAPSHOT</version>
</parent>
-
<artifactId>common</artifactId>
<name>MSO Common classes</name>
<description>MSO Common classes:- Logger</description>
-
+ <properties>
+ <spring.version>4.3.2.RELEASE</spring.version>
+ </properties>
<dependencies>
<dependency>
<groupId>com.att.eelf</groupId>
@@ -51,38 +52,12 @@
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-jaxb-annotations</artifactId>
- <version>2.4.0</version>
- </dependency>
<dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-client</artifactId>
- <version>3.0.19.Final</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
</dependency>
-<dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-jackson2-provider</artifactId>
- <version>3.0.11.Final</version>
- </dependency>
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.2_spec</artifactId>
@@ -100,14 +75,16 @@
<artifactId>spring-aspects</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
-
-
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>com.openpojo</groupId>
+ <artifactId>openpojo</artifactId>
+ <version>0.8.6</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.jsonpath</groupId>
+ <artifactId>json-path</artifactId>
+ <version>2.2.0</version>
+ </dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
@@ -149,6 +126,46 @@
<artifactId>swagger-annotations_2.9.1</artifactId>
<version>1.3.0</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.appc.client</groupId>
+ <artifactId>client-kit</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.appc.client</groupId>
+ <artifactId>client-lib</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aai.aai-common</groupId>
+ <artifactId>aai-schema</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.modelmapper</groupId>
+ <artifactId>modelmapper</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>22.0</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.17</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.4</version>
+ </dependency>
<!--for yang decoder-->
<!--<dependency>
<groupId>org.opendaylight.yangtools</groupId>
diff --git a/common/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java b/common/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java
new file mode 100644
index 0000000000..df28baac74
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java
@@ -0,0 +1,35 @@
+/*-
+ * ============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.openecomp.mso.client;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+public class PreconditionFailedException extends WebApplicationException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public PreconditionFailedException(String message) {
+ super(message, Response.Status.PRECONDITION_FAILED);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java b/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java
new file mode 100644
index 0000000000..19c178496c
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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.openecomp.mso.client;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Optional;
+
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.ForbiddenException;
+import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.NotAcceptableException;
+import javax.ws.rs.NotAllowedException;
+import javax.ws.rs.NotAuthorizedException;
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.NotSupportedException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.core.Response;
+
+public abstract class ResponseExceptionMapper implements ClientResponseFilter {
+
+ @Override
+ public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
+ if (responseContext.getStatus() >= 300) {
+ String message = "empty message";
+ if (responseContext.hasEntity()) {
+ Optional<String> result = this.extractMessage(responseContext.getEntityStream());
+ if (result.isPresent()) {
+ message = result.get();
+ }
+ }
+ Response.Status status = Response.Status.fromStatusCode(responseContext.getStatus());
+ WebApplicationException webAppException;
+ switch (status) {
+ case BAD_REQUEST:
+ webAppException = new BadRequestException(message);
+ break;
+ case UNAUTHORIZED:
+ webAppException = new NotAuthorizedException(message);
+ break;
+ case FORBIDDEN:
+ webAppException = new ForbiddenException(message);
+ break;
+ case NOT_FOUND:
+ webAppException = new NotFoundException(message);
+ break;
+ case METHOD_NOT_ALLOWED:
+ webAppException = new NotAllowedException(message);
+ break;
+ case NOT_ACCEPTABLE:
+ webAppException = new NotAcceptableException(message);
+ break;
+ case PRECONDITION_FAILED:
+ webAppException = new PreconditionFailedException(message);
+ break;
+ case UNSUPPORTED_MEDIA_TYPE:
+ webAppException = new NotSupportedException(message);
+ break;
+ case INTERNAL_SERVER_ERROR:
+ webAppException = new InternalServerErrorException(message);
+ break;
+ case SERVICE_UNAVAILABLE:
+ webAppException = new WebApplicationException(message);
+ break;
+ default:
+ webAppException = new WebApplicationException(message);
+ }
+ throw webAppException;
+ }
+ }
+
+ public abstract Optional<String> extractMessage(InputStream stream) throws IOException;
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java b/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java
new file mode 100644
index 0000000000..7841d7accd
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java
@@ -0,0 +1,44 @@
+/*-
+ * ============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.openecomp.mso.client;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Optional;
+
+import javax.annotation.Priority;
+import javax.ws.rs.ext.Provider;
+
+import org.apache.commons.io.IOUtils;
+
+@Provider
+@Priority(Integer.MIN_VALUE)
+public class ResponseExceptionMapperImpl extends ResponseExceptionMapper {
+
+ @Override
+ public Optional<String> extractMessage(InputStream stream) throws IOException {
+ final String input = IOUtils.toString(stream, "UTF-8");
+ IOUtils.closeQuietly(stream);
+ return Optional.of(input);
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/RestProperties.java b/common/src/main/java/org/openecomp/mso/client/RestProperties.java
new file mode 100644
index 0000000000..ae8862de5e
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/RestProperties.java
@@ -0,0 +1,30 @@
+/*-
+ * ============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.openecomp.mso.client;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public interface RestProperties {
+
+ public URL getEndpoint() throws MalformedURLException;
+ public String getSystemName();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java b/common/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java
new file mode 100644
index 0000000000..647acdfcf4
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.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.openecomp.mso.client;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+public class RestPropertiesLoader {
+
+ private final ServiceLoader<RestProperties> services;
+ private RestPropertiesLoader() {
+ services = ServiceLoader.load(RestProperties.class);
+ }
+
+ private static class Helper {
+ private static final RestPropertiesLoader INSTANCE = new RestPropertiesLoader();
+ }
+
+ public static RestPropertiesLoader getInstance() {
+ return Helper.INSTANCE;
+ }
+
+ public <T> T getNewImpl(Class<? extends RestProperties> clazz) {
+ return this.getImpl(clazz, true);
+ }
+ public <T> T getImpl(Class<? extends RestProperties> clazz) {
+ return this.getImpl(clazz, false);
+ }
+
+ private <T> T getImpl(Class<? extends RestProperties> clazz, boolean forceNewInstance) {
+ T result = null;
+ Iterator<RestProperties> propertyImpls = services.iterator();
+ RestProperties item;
+ while (propertyImpls.hasNext()) {
+ item = propertyImpls.next();
+ if (clazz.isAssignableFrom(item.getClass())) {
+ try {
+ if (forceNewInstance) {
+ result = (T)item.getClass().newInstance();
+ } else {
+ result = (T)item;
+ }
+ } catch (InstantiationException | IllegalAccessException e) {
+ /* all spi implementations must provide a public
+ * no argument constructor
+ */
+
+ }
+ //break;
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java
new file mode 100644
index 0000000000..9150dcab15
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java
@@ -0,0 +1,69 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import java.net.URI;
+import java.util.UUID;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.openecomp.mso.client.RestPropertiesLoader;
+import org.openecomp.mso.client.aai.entities.uri.AAIUri;
+import org.openecomp.mso.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.openecomp.mso.client.policy.RestClient;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public abstract class AAIClient {
+
+ protected final AAIVersion defaultVersion;
+ private static final String AAI_ROOT = "/aai";
+ protected final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+ private final AAIProperties properties;
+ protected final UUID requestId;
+ public AAIClient(UUID requestId) {
+ AAIProperties props = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
+ if (props == null) {
+ metricsLogger.error("No RestProperty.AAIProperties implementation found on classpath");
+ props = new DefaultAAIPropertiesImpl();
+ }
+ this.properties = props;
+ this.defaultVersion = props.getDefaultVersion();
+ this.requestId = requestId;
+ }
+ protected URI constructPath(AAIUri uri) {
+
+ return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.build().toString()).build();
+ }
+
+ protected RestClient createClient(AAIUri uri) {
+ return new AAIRestClient(properties, this.getRequestId(), constructPath(uri)).addRequestId(this.getRequestId());
+
+ }
+
+ protected UUID getRequestId() {
+ return this.requestId;
+ }
+ protected AAIVersion getVersion() {
+ return defaultVersion;
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java
new file mode 100644
index 0000000000..657b4c5a2c
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Optional;
+import java.util.UUID;
+
+import javax.annotation.Priority;
+import javax.ws.rs.ext.Provider;
+
+import org.openecomp.mso.client.ResponseExceptionMapper;
+import org.openecomp.mso.client.aai.entities.AAIError;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Provider
+@Priority(Integer.MIN_VALUE)
+public class AAIClientResponseExceptionMapper extends ResponseExceptionMapper {
+
+ private final UUID requestId;
+ public AAIClientResponseExceptionMapper(UUID requestId) {
+ this.requestId = requestId;
+ }
+ @Override
+ public Optional<String> extractMessage(InputStream stream) throws IOException {
+
+ String errorString = "Error calling A&AI. Request-Id=" + this.getRequestId() + " ";
+ try {
+ AAIError error = new ObjectMapper().readValue(stream, AAIError.class);
+ AAIErrorFormatter formatter = new AAIErrorFormatter(error);
+ return Optional.of(errorString + formatter.getMessage());
+ } catch (JsonParseException e) {
+ return Optional.of(errorString);
+ }
+ }
+
+ protected UUID getRequestId() {
+ return this.requestId;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java b/common/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java
new file mode 100644
index 0000000000..cbee903835
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import javax.ws.rs.ext.ContextResolver;
+
+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 implements ContextResolver<ObjectMapper> {
+
+ final ObjectMapper mapper;
+
+ 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));
+ }
+
+ @Override
+ public ObjectMapper getContext(Class<?> type) {
+ return mapper;
+ }
+
+ public ObjectMapper getMapper() {
+ return mapper;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIConfigurationClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIConfigurationClient.java
new file mode 100644
index 0000000000..fdeb975ad1
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIConfigurationClient.java
@@ -0,0 +1,74 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import org.openecomp.mso.client.aai.entities.Configuration;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.openecomp.mso.serviceinstancebeans.RequestDetails;
+
+public class AAIConfigurationClient {
+
+ private AAIResourcesClient aaiClient;
+
+ private static final String ORCHESTRATION_STATUS = "PendingCreate";
+
+ public AAIConfigurationClient() {
+ aaiClient = new AAIResourcesClient();
+ }
+
+ public void createConfiguration(RequestDetails requestDetails, String configurationId, String configurationType,
+ String configurationSubType) {
+ Configuration payload = new Configuration();
+ payload.setConfigurationId(configurationId);
+ payload.setConfigurationType(configurationType);
+ payload.setConfigurationSubType(configurationSubType);
+ payload.setModelInvariantId(requestDetails.getModelInfo().getModelInvariantId());
+ payload.setModelVersionId(requestDetails.getModelInfo().getModelVersionId());
+ payload.setOrchestrationStatus(ORCHESTRATION_STATUS);
+ payload.setOperationalStatus("");
+ AAIResourceUri uri = getConfigurationURI(payload.getConfigurationId());
+ payload.setConfigurationSelflink(uri.build().getPath());
+ payload.setModelCustomizationId(requestDetails.getModelInfo().getModelCustomizationId());
+
+ aaiClient.create(uri, payload);
+ }
+
+ public void deleteConfiguration(String uuid) {
+ aaiClient.delete(getConfigurationURI(uuid));
+ }
+
+ public void updateOrchestrationStatus(String uuid, String payload) {
+ aaiClient.update(getConfigurationURI(uuid), payload);
+ }
+
+ public Configuration getConfiguration(String uuid) {
+ return aaiClient.get(Configuration.class, getConfigurationURI(uuid));
+ }
+
+ public boolean configurationExists(String uuid) {
+ return aaiClient.exists(getConfigurationURI(uuid));
+ }
+
+ public AAIResourceUri getConfigurationURI(String uuid) {
+ return AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, uuid);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIErrorFormatter.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIErrorFormatter.java
new file mode 100644
index 0000000000..dd56e9712f
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIErrorFormatter.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import java.util.List;
+import java.util.Optional;
+
+import org.openecomp.mso.client.aai.entities.AAIError;
+import org.openecomp.mso.client.aai.entities.ServiceException;
+
+public class AAIErrorFormatter {
+
+ private final AAIError error;
+ public AAIErrorFormatter(AAIError error) {
+ this.error = error;
+ }
+
+ public String getMessage() {
+ if (error.getRequestError() != null &&
+ error.getRequestError().getServiceException() != null) {
+ ServiceException serviceException = error.getRequestError().getServiceException();
+ return this.fillInTemplate(serviceException.getText(), serviceException.getVariables());
+ }
+
+ return "no parsable error message found";
+ }
+
+ protected String fillInTemplate(String text, List<String> variables) {
+ for (int i = 0; i < variables.size(); i++) {
+ variables.set(i, this.format(variables.get(i), variables));
+ }
+
+ return format(text, variables);
+ }
+
+ protected String format(String s, List<String> variables) {
+ return String.format(s.replaceAll("%(\\d+)", "%$1\\$s"), variables.toArray());
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAINamespaceConstants.java b/common/src/main/java/org/openecomp/mso/client/aai/AAINamespaceConstants.java
new file mode 100644
index 0000000000..4bdfc4d793
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAINamespaceConstants.java
@@ -0,0 +1,31 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+public class AAINamespaceConstants {
+
+ protected static final String CLOUD_INFRASTRUCTURE = "/cloud-infrastructure";
+ protected static final String NETWORK = "/network";
+ protected static final String BUSINESS = "/business";
+ protected static final String SERVICE_DESIGN_AND_CREATION = "/service-design-and-creation";
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectName.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectName.java
new file mode 100644
index 0000000000..c7459d31b5
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectName.java
@@ -0,0 +1,29 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import com.google.common.base.CaseFormat;
+
+public interface AAIObjectName {
+
+ public String typeName();
+ public String typeName(CaseFormat format);
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectPlurals.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectPlurals.java
new file mode 100644
index 0000000000..dc2831c1ed
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectPlurals.java
@@ -0,0 +1,65 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import com.google.common.base.CaseFormat;
+
+public enum AAIObjectPlurals implements AAIObjectName, AAIObjectUriTemplate, AAIObjectUriPartial {
+
+ GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs"),
+ PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers");
+
+ private final String uriTemplate;
+ private final String partialUri;
+ private AAIObjectPlurals(String parentUri, String partialUri) {
+ this.uriTemplate = parentUri + partialUri;
+ this.partialUri = partialUri;
+ }
+
+ @Override
+ public String toString() {
+ return this.uriTemplate();
+ }
+
+ @Override
+ public String uriTemplate() {
+ return this.uriTemplate;
+ }
+
+ @Override
+ public String partialUri() {
+ return this.partialUri;
+ }
+
+ @Override
+ public String typeName() {
+ return this.typeName(CaseFormat.LOWER_HYPHEN);
+ }
+ @Override
+ public String typeName(CaseFormat format) {
+ String enumName = this.name();
+ if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
+ enumName = enumName.replace("DEFAULT_", "");
+ }
+
+ return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectType.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectType.java
new file mode 100644
index 0000000000..9026c29522
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectType.java
@@ -0,0 +1,98 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import com.google.common.base.CaseFormat;
+
+public enum AAIObjectType implements AAIObjectName, AAIObjectUriTemplate, AAIObjectUriPartial {
+
+ DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/att-aic/{cloud-region-id}"),
+ CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers/customer/{global-customer-id}"),
+ GENERIC_QUERY("/search", "/generic-query"),
+ BULK_PROCESS("/bulkprocess", ""),
+ GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs/generic-vnf/{vnf-id}"),
+ VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules/vf-module/{vf-module-id}"),
+ L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks/l3-network/{network-id}"),
+ NETWORK_POLICY(AAINamespaceConstants.NETWORK, "/network-policies/network-policy/{network-policy-id}"),
+ NODES_QUERY("/search", "/nodes-query"),
+ CUSTOM_QUERY("/query", ""),
+ ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, "/route-table-references/route-table-reference/{route-table-reference-id}"),
+ DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/att-aic/AAIAIC25", "/tenants/tenant/{tenant-id}"),
+ VCE(AAINamespaceConstants.NETWORK, "/vces/vce/{vnf-id}"),
+ VPN_BINDING(AAINamespaceConstants.NETWORK, "/vpn-bindings/vpn-binding/{vpn-id}"),
+ CONFIGURATION(AAINamespaceConstants.NETWORK, "/configurations/configuration/{configuration-id}"),
+ PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers/pserver/{hostname}"),
+ SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions/service-subscription/{service-type}"),
+ SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances/service-instance/{service-instance-id}"),
+ PROJECT(AAINamespaceConstants.BUSINESS, "/projects/project/{id}"),
+ LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, "/lines-of-business/line-of-business/{id}"),
+ PLATFORM(AAINamespaceConstants.BUSINESS, "/platforms/platform/{id}"),
+ OWNING_ENTITY(AAINamespaceConstants.BUSINESS, "/owning-entities/owning-entity/{id}"),
+ ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources/allotted-resource/{id}"),
+ PNF(AAINamespaceConstants.NETWORK, "/pnfs/pnf/{pnf-name}"),
+ OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/operational-environments/operational-environment/{operational-environment-id}"),
+ CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/{cloud-owner-id}/{cloud-region-id}"),
+ TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), "/tenants/tenant/{tenant-id}"),
+ VSERVER(AAIObjectType.TENANT.uriTemplate(), "/vservers/vserver/{vserver-id}"),
+ MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", "/model-vers/model-ver/{model-version-id}"),
+ TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), "/tunnel-xconnects/tunnel-xconnect/{id}"),
+ P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces/p-interface/{interface-name}"),
+ PHYSICAL_LINK(AAINamespaceConstants.NETWORK, "/physical-links/physical-link/{link-name}"),
+ UNKNOWN("", "");
+
+ private final String uriTemplate;
+ private final String parentUri;
+ private final String partialUri;
+ private AAIObjectType(String parentUri, String partialUri) {
+ this.parentUri = parentUri;
+ this.partialUri = partialUri;
+ this.uriTemplate = parentUri + partialUri;
+ }
+
+ @Override
+ public String toString() {
+ return this.uriTemplate();
+ }
+
+ @Override
+ public String typeName() {
+ return this.typeName(CaseFormat.LOWER_HYPHEN);
+ }
+ @Override
+ public String typeName(CaseFormat format) {
+ String enumName = this.name();
+ if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
+ enumName = enumName.replace("DEFAULT_", "");
+ }
+
+ return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
+ }
+
+ @Override
+ public String uriTemplate() {
+ return this.uriTemplate;
+ }
+
+ @Override
+ public String partialUri() {
+ return this.partialUri;
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriPartial.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriPartial.java
new file mode 100644
index 0000000000..3fb867d6fa
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriPartial.java
@@ -0,0 +1,26 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+public interface AAIObjectUriPartial {
+
+ public String partialUri();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriTemplate.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriTemplate.java
new file mode 100644
index 0000000000..397b66d547
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriTemplate.java
@@ -0,0 +1,26 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+public interface AAIObjectUriTemplate {
+
+ public String uriTemplate();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java
new file mode 100644
index 0000000000..358bbbbbec
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import org.openecomp.mso.client.RestProperties;
+
+public interface AAIProperties extends RestProperties {
+
+ public AAIVersion getDefaultVersion();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryClient.java
new file mode 100644
index 0000000000..f8707dec3e
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryClient.java
@@ -0,0 +1,93 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import java.util.Optional;
+import java.util.UUID;
+
+import org.openecomp.mso.client.aai.entities.CustomQuery;
+import org.openecomp.mso.client.aai.entities.uri.AAIUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.openecomp.mso.client.policy.RestClient;
+import org.openecomp.mso.client.aai.AAIVersion;
+
+public class AAIQueryClient extends AAIClient {
+
+
+ private final AAIVersion version;
+ private Optional<String> depth = Optional.empty();
+ private boolean nodesOnly = false;
+ private Optional<AAISubgraphType> subgraph = Optional.empty();
+
+ public AAIQueryClient() {
+ super(UUID.randomUUID());
+ this.version = super.getVersion();
+ }
+
+ public AAIQueryClient(AAIVersion version, UUID requestId) {
+ super(requestId);
+ this.version = version;
+ }
+
+ public AAIQueryClient(AAIVersion version) {
+ this(version, UUID.randomUUID());
+ }
+
+ public String query(Format format, CustomQuery query) {
+ return this.createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", format.toString()))
+ .addRequestId(requestId).put(query, String.class);
+ }
+
+ @Override
+ protected AAIVersion getVersion() {
+ return this.version;
+ }
+
+ public AAIQueryClient depth (String depth) {
+ this.depth = Optional.of(depth);
+ return this;
+ }
+ public AAIQueryClient nodesOnly() {
+ this.nodesOnly = true;
+ return this;
+ }
+ public AAIQueryClient subgraph(AAISubgraphType type){
+
+ subgraph = Optional.of(type);
+
+ return this;
+ }
+
+ @Override
+ public RestClient createClient(AAIUri uri) {
+ AAIUri 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 super.createClient(clone);
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java
new file mode 100644
index 0000000000..425d9ce60b
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java
@@ -0,0 +1,44 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import com.fasterxml.jackson.databind.AnnotationIntrospector;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
+
+public class AAIQueryObjectMapperProvider extends AAICommonObjectMapperProvider {
+
+ public AAIQueryObjectMapperProvider() {
+ super();
+ AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
+ AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector();
+ // first Jaxb, second Jackson annotations
+ mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson));
+
+ }
+
+ @Override
+ public ObjectMapper getContext(Class<?> type) {
+ return mapper;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesClient.java
new file mode 100644
index 0000000000..32c61f7fd7
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesClient.java
@@ -0,0 +1,244 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.core.GenericType;
+
+import org.onap.aai.domain.yang.Relationship;
+import org.openecomp.mso.client.aai.entities.AAIResultWrapper;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUri;
+import org.openecomp.mso.client.aai.entities.uri.Depth;
+import org.openecomp.mso.client.policy.RestClient;
+
+public class AAIResourcesClient extends AAIClient {
+
+ private final AAIVersion version;
+
+ public AAIResourcesClient() {
+ super(UUID.randomUUID());
+ this.version = super.getVersion();
+ }
+
+ public AAIResourcesClient(AAIVersion version) {
+ super(UUID.randomUUID());
+ this.version = version;
+ }
+
+ public AAIResourcesClient(AAIVersion version, UUID requestId) {
+ super(requestId);
+ 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);
+ RestClient aaiRC = this.createClient(forceMinimal);
+ try{
+ aaiRC.get();
+ } catch(ResponseProcessingException e) {
+ if (e.getCause() instanceof NotFoundException) {
+ return false;
+ } else {
+ throw e;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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>>(){});
+ 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> T get(Class<T> clazz, AAIResourceUri uri) {
+ return this.createClient(uri).get(clazz);
+ }
+
+ /**
+ * Retrieves an object from A&AI and automatically unmarshalls it into a Map or List
+ * @param resultClass
+ * @param uri
+ * @return
+ */
+ public <T> T get(GenericType<T> resultClass, AAIResourceUri uri) {
+ return this.createClient(uri).get(resultClass);
+ }
+
+ /**
+ * 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 = this.createClient(uri).get(String.class);
+
+ return new AAIResultWrapper(json);
+
+ }
+ private Relationship buildRelationship(AAIResourceUri uri) {
+ final Relationship result = new Relationship();
+ result.setRelatedLink(uri.build().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
+ */
+ public AAITransactionalClient beginTransaction() {
+ return new AAITransactionalClient(this.version, this.requestId);
+ }
+
+ @Override
+ protected AAIVersion getVersion() {
+ return this.version;
+ }
+
+ @Override
+ protected RestClient createClient(AAIUri uri) {
+ return super.createClient(uri);
+ }
+
+ 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;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java
new file mode 100644
index 0000000000..ada1939951
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java
@@ -0,0 +1,35 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvider {
+
+ public AAIResourcesObjectMapperProvider() {
+ super();
+ }
+
+ @Override
+ public ObjectMapper getContext(Class<?> type) {
+ return mapper;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java
new file mode 100644
index 0000000000..9348beb02a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java
@@ -0,0 +1,67 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.ext.ContextResolver;
+
+import org.openecomp.mso.client.RestProperties;
+import org.openecomp.mso.client.policy.RestClient;
+import org.openecomp.mso.client.policy.RestClientSSL;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class AAIRestClient extends RestClientSSL {
+
+ protected AAIRestClient(RestProperties props, UUID requestId, URI uri) {
+ super(props, requestId, Optional.of(uri));
+ headerMap.put("X-TransactionId", requestId.toString());
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("X-FromAppId", "MSO");
+ }
+
+ @Override
+ protected Optional<ClientResponseFilter> addResponseFilter() {
+
+ return Optional.of(new AAIClientResponseExceptionMapper(this.getRequestId()));
+ }
+
+ @Override
+ public RestClient addRequestId(UUID requestId) {
+ headerMap.put("X-TransactionId", requestId.toString());
+ this.requestId = requestId;
+ return this;
+ }
+
+ @Override
+ protected ContextResolver<ObjectMapper> getMapper() {
+ return new AAICommonObjectMapperProvider();
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientI.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientI.java
new file mode 100644
index 0000000000..801c0f91d4
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientI.java
@@ -0,0 +1,44 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Pserver;
+import org.onap.aai.domain.yang.Pservers;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+public interface AAIRestClientI {
+
+ Pservers getPhysicalServers(String hostName, String uuid);
+
+ List<Pserver> getPhysicalServerByVnfId(String vnfId, String transactionLoggingUuid) throws UnsupportedEncodingException, JsonParseException, JsonMappingException, IOException;
+
+ void updateMaintenceFlag(String vnfId,boolean inMaint, String transactionLoggingUuid) throws Exception;
+
+ void updateMaintenceFlagVnfId(String vnfId, boolean inMaint, String transactionLoggingUuid) throws Exception;
+
+ GenericVnf getVnfByName(String vnfId, String transactionLoggingUuid) throws Exception;
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java
new file mode 100644
index 0000000000..e27075d9dd
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java
@@ -0,0 +1,165 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
+import org.onap.aai.domain.yang.Pserver;
+import org.onap.aai.domain.yang.Pservers;
+import org.openecomp.mso.client.aai.entities.CustomQuery;
+import org.openecomp.mso.client.aai.entities.Results;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.springframework.stereotype.Service;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+@Service
+public class AAIRestClientImpl implements AAIRestClientI {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getMetricsLogger();
+ private static final AAIVersion ENDPOINT_VERSION = AAIVersion.V10;
+ private static final String ENDPOINT_GET_ALL = ENDPOINT_VERSION + "/cloud-infrastructure/pservers";
+ private static final String ENDPOINT_GET_ALL_VNFS = ENDPOINT_VERSION + "/network/generic-vnfs";
+ private static final String ENDPOINT_CUSTOM_QUERY = ENDPOINT_VERSION + "/query";
+ private static final String PSERVER_VNF_QUERY = "pservers-fromVnf";
+ private static final String GENERIC_VNF_PATH = ENDPOINT_VERSION + "/network/generic-vnfs/generic-vnf";
+ private static final String SERVICE_TOPOLOGY_BY_SERVICE_INSTANCE_ID = "store(‘x’).union(__.in(‘subscribesTo’).has(‘aai-node-type’,’customer’).store(‘x’),__.out(‘uses’).has(‘aai-node-type’,’allotted-resource’).store(‘x’),__.in(‘hasInstance’).has(‘aai-node-type’,’generic-vnf’).store(‘x’).union("
+ + ".out(‘has’).has(‘aai-node-type’,’vf-module’).store(‘x’),out(‘uses’).has(‘aai-node-type’,’volume-group’).store(‘x’),"
+ + ".out(‘hasLInterface’).has(‘aai-node-type’,’l-interface’).union("
+ + ".out(‘hasIpAddress’).has(‘aai-node-type’,’l3-interface-ipv4-address’).store(‘x’).out(‘isMemberOf’).has(‘aai-node-type’,’l3-network’).store(‘x’),"
+ + ".out(‘hasIpAddress’).has(‘aai-node-type’,’l3-interface-ipv6-address’).store(‘x’).out(‘isMemberOf’).has(‘aai-node-type’,’l3-network’).store(‘x’)"
+ + ")," + ".out(‘runsOnVserver’).has(‘aai-node-type’,’vserver’).store(‘x’).union("
+ + ".in(‘owns’).has(‘aai-node-type’,’tenant’).store(‘x’).in(‘has’).has(‘aai-node-type’,’cloud-region’).store(‘x’),"
+ + ".out(‘runsOnPserver’).has(‘aai-node-type’,’pserver’).store(‘x’),"
+ + ".out(‘hasLInterface’).has(‘aai-node-type’,’l-interface’).union("
+ + ".out(‘hasIpAddress’).has(‘aai-node-type’,’l3-interface-ipv4-address’).store(‘x’).out(‘isMemberOf’).has(‘aai-node-type’,’l3-network’).store(‘x’),"
+ + ".out(‘hasIpAddress’).has(‘aai-node-type’,’l3-interface-ipv6-address’).store(‘x’).out(‘isMemberOf’).has(‘aai-node-type’,’l3-network’).store(‘x’)"
+ + ")" + ")" + ")" + ").cap(‘x’).unfold().dedup()";
+
+ public AAIRestClientImpl() {
+
+
+ }
+
+ public AAIRestClientImpl(final String host) {
+
+
+ }
+
+ @Override
+ public Pservers getPhysicalServers(String hostName, String uuid) {
+ UUID requestId;
+ try {
+ requestId = UUID.fromString(uuid);
+ } catch (IllegalArgumentException e) {
+ logger.warn("could not parse uuid: " + uuid + " creating valid uuid automatically");
+ requestId = UUID.randomUUID();
+ }
+ return new AAIResourcesClient(ENDPOINT_VERSION, requestId).get(Pservers.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.PSERVER));
+ }
+
+ @Override
+ public List<Pserver> getPhysicalServerByVnfId(String vnfId, String transactionLoggingUuid)
+ throws JsonParseException, JsonMappingException, IOException {
+ UUID requestId;
+ try {
+ requestId = UUID.fromString(transactionLoggingUuid);
+ } catch (IllegalArgumentException e) {
+ logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically");
+ requestId = UUID.randomUUID();
+ }
+ List<AAIResourceUri> startNodes = new ArrayList<>();
+ startNodes.add(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ String jsonInput = new AAIQueryClient(ENDPOINT_VERSION, requestId).query(Format.RESOURCE, new CustomQuery(startNodes,PSERVER_VNF_QUERY));
+
+ return this.getListOfPservers(jsonInput);
+
+ }
+
+ protected List<Pserver> getListOfPservers(String jsonInput) throws JsonParseException, JsonMappingException, IOException {
+ ObjectMapper mapper = new AAICommonObjectMapperProvider().getContext(Object.class);
+ Results<Map<String, Pserver>> resultsFromJson = mapper.readValue(jsonInput,
+ new TypeReference<Results<Map<String, Pserver>>>() {
+ });
+ List<Pserver> results = new ArrayList<>();
+ for (Map<String, Pserver> m : resultsFromJson.getResult()) {
+ results.add(m.get("pserver"));
+ }
+ return results;
+ }
+ @Override
+ public void updateMaintenceFlag(String vnfName, boolean inMaint, String transactionLoggingUuid) throws JsonParseException, JsonMappingException, IOException {
+ UUID requestId;
+ try {
+ requestId = UUID.fromString(transactionLoggingUuid);
+ } catch (IllegalArgumentException e) {
+ logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically");
+ requestId = UUID.randomUUID();
+ }
+ GenericVnfs genericVnfs = new AAIResourcesClient(ENDPOINT_VERSION, requestId).get(GenericVnfs.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName));
+ if(genericVnfs.getGenericVnf().size() > 1)
+ throw new IndexOutOfBoundsException("Multiple Generic Vnfs Returned");
+
+ GenericVnf genericVnf = genericVnfs.getGenericVnf().get(0);
+ updateMaintenceFlagVnfId(genericVnf.getVnfId(), inMaint, transactionLoggingUuid);
+ }
+
+ @Override
+ public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint, String transactionLoggingUuid) throws JsonParseException, JsonMappingException, IOException {
+ UUID requestId;
+ try {
+ requestId = UUID.fromString(transactionLoggingUuid);
+ } catch (IllegalArgumentException e) {
+ logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically");
+ requestId = UUID.randomUUID();
+ }
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setInMaint(inMaint);
+ new AAIResourcesClient(ENDPOINT_VERSION, requestId).update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf);
+
+ }
+
+ @Override
+ public GenericVnf getVnfByName(String vnfId, String transactionLoggingUuid) throws JsonParseException, JsonMappingException, IOException {
+ UUID requestId;
+ try {
+ requestId = UUID.fromString(transactionLoggingUuid);
+ } catch (IllegalArgumentException e) {
+ logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically");
+ requestId = UUID.randomUUID();
+ }
+ return new AAIResourcesClient(ENDPOINT_VERSION, requestId).get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAISubgraphType.java b/common/src/main/java/org/openecomp/mso/client/aai/AAISubgraphType.java
new file mode 100644
index 0000000000..917949967f
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAISubgraphType.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+
+public enum AAISubgraphType {
+ STAR("star"),
+ PRUNE("prune");
+
+ private final String name;
+
+ private AAISubgraphType(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAITransactionalClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAITransactionalClient.java
new file mode 100644
index 0000000000..547862708a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAITransactionalClient.java
@@ -0,0 +1,263 @@
+/*-
+ * ============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.openecomp.mso.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 java.util.UUID;
+
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.Response;
+
+import org.onap.aai.domain.yang.Relationship;
+import org.openecomp.mso.client.aai.entities.AAIError;
+import org.openecomp.mso.client.aai.entities.bulkprocess.OperationBody;
+import org.openecomp.mso.client.aai.entities.bulkprocess.Transaction;
+import org.openecomp.mso.client.aai.entities.bulkprocess.Transactions;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.openecomp.mso.client.aai.exceptions.BulkProcessFailed;
+import org.openecomp.mso.client.policy.RestClient;
+import org.openecomp.mso.jsonpath.JsonPathUtil;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Joiner;
+
+public class AAITransactionalClient extends AAIClient {
+
+ private final Transactions transactions;
+ private Transaction currentTransaction;
+ private final AAIVersion version;
+ private int actionCount = 0;
+ protected AAITransactionalClient(AAIVersion version, UUID requestId) {
+ super(requestId);
+ this.version = version;
+ this.transactions = new Transactions();
+ startTransaction();
+ }
+
+ private void startTransaction() {
+ Transaction transaction = new Transaction();
+ transactions.getTransactions().add(transaction);
+ currentTransaction = transaction;
+ }
+
+ /**
+ * adds an additional transaction and closes the previous transaction
+ *
+ * @return AAITransactionalClient
+ */
+ 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;
+ }
+
+ /**
+ * 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);
+ 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) {
+ currentTransaction.getPatch().add(new OperationBody().withUri(uri.build().toString()).withBody(obj));
+ incrementActionAmount();
+ return this;
+ }
+
+ private void incrementActionAmount() {
+ actionCount++;
+ }
+ /**
+ * Executes all created transactions in A&AI
+ * @throws BulkProcessFailed
+ */
+ public void execute() throws BulkProcessFailed {
+ RestClient client = this.createClient(AAIUriFactory.createResourceUri(AAIObjectType.BULK_PROCESS));
+ try {
+ Response response = client.put(this.transactions);
+ if (response.hasEntity()) {
+ final Optional<String> errorMessage = this.locateErrorMessages(response.readEntity(String.class));
+ if (errorMessage.isPresent()) {
+ throw new BulkProcessFailed("One or more transactions failed in A&AI. Request-id=" + this.getRequestId() + ". Check logs for payloads.\nMessages:\n" + errorMessage.get());
+ }
+ } else {
+ throw new BulkProcessFailed("Transactions acccepted by A&AI, but there was no response. Unsure of result.");
+ }
+ } finally {
+ this.transactions.getTransactions().clear();
+ this.currentTransaction = null;
+ this.actionCount = 0;
+ }
+ }
+
+ protected Optional<String> locateErrorMessages(String response) {
+ final List<String> errorMessages = new ArrayList<>();
+ final List<String> results = JsonPathUtil.getInstance().locateResultList(response, "$..body");
+ final ObjectMapper mapper = new ObjectMapper();
+ if (!results.isEmpty()) {
+ List<Map<String, Object>> parsed = new ArrayList<>();
+ try {
+ for (String result : results) {
+ parsed.add(mapper.readValue(result, new TypeReference<Map<String, Object>>(){}));
+ }
+ } catch (IOException e) {
+ metricsLogger.error("could not map json", e);
+ }
+ for (Map<String, Object> map : parsed) {
+ for (Entry<String, Object> entry : map.entrySet()) {
+ if (!entry.getKey().matches("2\\d\\d")) {
+ AAIError error;
+ try {
+ error = mapper.readValue(entry.getValue().toString(), AAIError.class);
+ } catch (IOException e) {
+ metricsLogger.error("could not parse error object from A&AI", e);
+ error = new AAIError();
+ }
+ AAIErrorFormatter formatter = new AAIErrorFormatter(error);
+ String outputMessage = formatter.getMessage();
+ metricsLogger.error("part of a bulk action failed in A&AI: " + entry.getValue());
+ errorMessages.add(outputMessage);
+ }
+ }
+ }
+ }
+
+ if (!errorMessages.isEmpty()) {
+ return Optional.of(Joiner.on("\n").join(errorMessages));
+ } else {
+ return Optional.empty();
+ }
+ }
+ private Relationship buildRelationship(AAIUri uri) {
+ final Relationship result = new Relationship();
+ result.setRelatedLink(uri.build().toString());
+ return result;
+ }
+
+ @Override
+ protected AAIVersion getVersion() {
+ return this.version;
+ }
+
+ protected Transactions getTransactions() {
+ return this.transactions;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java
new file mode 100644
index 0000000000..3bdcdc56a3
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java
@@ -0,0 +1,31 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import java.io.IOException;
+
+public interface AAIUpdator {
+
+ void updateVnfToLocked(String vnfName, String uuid) throws IOException, Exception;
+
+ void updateVnfToUnLocked(String vnfName, String uuid) throws IOException, Exception;
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java
new file mode 100644
index 0000000000..c808761040
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AAIUpdatorImpl implements AAIUpdator {
+
+ @Autowired
+ protected AAIRestClientI client;
+
+ public AAIRestClientI getClient() {
+ return client;
+ }
+
+
+ public void setClient(AAIRestClientI client) {
+ this.client = client;
+ }
+
+ @Override
+ public void updateVnfToLocked(String vnfId, String uuid) throws Exception {
+ client.updateMaintenceFlagVnfId(vnfId, true, uuid);
+ }
+
+ @Override
+ public void updateVnfToUnLocked(String vnfId, String uuid) throws Exception {
+ client.updateMaintenceFlagVnfId(vnfId, false, uuid);
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java
new file mode 100644
index 0000000000..117ec42a36
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java
@@ -0,0 +1,32 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import java.io.IOException;
+
+public interface AAIValidator {
+
+ boolean isPhysicalServerLocked(String hostName, String transactionLoggingUuid) throws IOException;
+
+ boolean isVNFLocked(String vnfId, String transactionLoggingUuid) throws IOException, Exception;
+
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java
new file mode 100644
index 0000000000..c84d2f41bd
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java
@@ -0,0 +1,71 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Pserver;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+
+@Service
+public class AAIValidatorImpl implements AAIValidator {
+
+
+ @Autowired
+ protected AAIRestClientI client;
+
+ public AAIRestClientI getClient() {
+ return client;
+ }
+
+
+ public void setClient(AAIRestClientI client) {
+ this.client = client;
+ }
+
+ @Override
+ public boolean isPhysicalServerLocked(String vnfId, String transactionLoggingUuid) throws IOException {
+ List<Pserver> pservers;
+ boolean isLocked = false;
+ pservers = client.getPhysicalServerByVnfId(vnfId, transactionLoggingUuid);
+ for (Pserver pserver : pservers)
+ if (pserver.isInMaint())
+ isLocked = true;
+
+ return isLocked;
+ }
+
+ @Override
+ public boolean isVNFLocked(String vnfId, String transactionLoggingUuid) throws Exception {
+ boolean isLocked = false;
+ GenericVnf genericVnf = client.getVnfByName(vnfId, transactionLoggingUuid);
+ if (genericVnf.isInMaint())
+ isLocked = true;
+
+ return isLocked;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIVersion.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIVersion.java
new file mode 100644
index 0000000000..20117fb98b
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIVersion.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+public enum AAIVersion {
+ V8("v8"),
+ V9("v9"),
+ V10("v10"),
+ V11("v11"),
+ V12("v12");
+
+ public final static AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
+ private final String value;
+ private AAIVersion(String value){
+ this.value = value;
+ }
+ @Override
+ public String toString(){
+ return this.value;
+ }
+}
+
+
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/Format.java b/common/src/main/java/org/openecomp/mso/client/aai/Format.java
new file mode 100644
index 0000000000..e4008151ef
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/Format.java
@@ -0,0 +1,43 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+public enum Format {
+
+ RESOURCE("resource"),
+ SIMPLE("simple"),
+ RAW("raw"),
+ CONSOLE("console"),
+ PATHED("pathed"),
+ GRAPHSON("graphson"),
+ ID("id");
+
+ private final String name;
+
+ private Format(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java
new file mode 100644
index 0000000000..3f0c4f3439
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java
@@ -0,0 +1,25 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+public class AAIEntity{
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntityObject.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntityObject.java
new file mode 100644
index 0000000000..e4a64c4161
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntityObject.java
@@ -0,0 +1,29 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+
+public interface AAIEntityObject {
+
+ public AAIResourceUri getUri();
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java
new file mode 100644
index 0000000000..5f895ef862
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java
@@ -0,0 +1,46 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "requestError"
+})
+public class AAIError {
+
+ @JsonProperty("requestError")
+ private RequestError requestError;
+
+ @JsonProperty("requestError")
+ public RequestError getRequestError() {
+ return requestError;
+ }
+
+ @JsonProperty("requestError")
+ public void setRequestError(RequestError requestError) {
+ this.requestError = requestError;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIResultWrapper.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIResultWrapper.java
new file mode 100644
index 0000000000..9898f04844
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIResultWrapper.java
@@ -0,0 +1,78 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+import org.openecomp.mso.client.aai.AAICommonObjectMapperProvider;
+import org.openecomp.mso.jsonpath.JsonPathUtil;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class AAIResultWrapper {
+
+ private final String jsonBody;
+ private final ObjectMapper mapper;
+ public AAIResultWrapper(String json) {
+ this.jsonBody = json;
+ this.mapper = new AAICommonObjectMapperProvider().getMapper();
+ }
+
+ public Optional<Relationships> getRelationships() {
+ final String path = "$.relationship-list";
+ 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() {
+ return jsonBody;
+ }
+
+ public Map<String, Object> asMap() {
+ 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) {
+ try {
+ return Optional.of(mapper.readValue(this.jsonBody, clazz));
+ } catch (IOException e) {
+ return Optional.empty();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return this.getJson();
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/Configuration.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/Configuration.java
new file mode 100644
index 0000000000..a2d0fb3604
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/Configuration.java
@@ -0,0 +1,162 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "configuration-id",
+ "configuration-type",
+ "configuration-sub-type",
+ "model-invariant-id",
+ "model-version-id",
+ "orchestration-status",
+ "operational-status",
+ "configuration-selflink",
+ "model-customization-id"
+})
+public class Configuration {
+
+ @JsonProperty("configuration-id")
+ private String configurationId;
+ @JsonProperty("configuration-name")
+ private String configurationName;
+ @JsonProperty("configuration-type")
+ private String configurationType;
+ @JsonProperty("configuration-sub-type")
+ private String configurationSubType;
+ @JsonProperty("model-invariant-id")
+ private String modelInvariantId;
+ @JsonProperty("model-version-id")
+ private String modelVersionId;
+ @JsonProperty("orchestration-status")
+ private String orchestrationStatus;
+ @JsonProperty("operational-status")
+ private String operationalStatus;
+ @JsonProperty("configuration-selflink")
+ private String configurationSelflink;
+ @JsonProperty("model-customization-id")
+ private String modelCustomizationId;
+
+ @JsonProperty("configuration-id")
+ public String getConfigurationId() {
+ return configurationId;
+ }
+
+ @JsonProperty("configuration-id")
+ public void setConfigurationId(String configurationId) {
+ this.configurationId = configurationId;
+ }
+
+ @JsonProperty("configuration-name")
+ public String getConfigurationName() {
+ return configurationName;
+ }
+
+ @JsonProperty("configuration-name")
+ public void setConfigurationName(String configurationName) {
+ this.configurationName = configurationName;
+ }
+
+ @JsonProperty("configuration-type")
+ public String getConfigurationType() {
+ return configurationType;
+ }
+
+ @JsonProperty("configuration-type")
+ public void setConfigurationType(String configurationType) {
+ this.configurationType = configurationType;
+ }
+
+ @JsonProperty("configuration-sub-type")
+ public String getConfigurationSubType() {
+ return configurationSubType;
+ }
+
+ @JsonProperty("configuration-sub-type")
+ public void setConfigurationSubType(String configurationSubType) {
+ this.configurationSubType = configurationSubType;
+ }
+
+ @JsonProperty("model-invariant-id")
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ @JsonProperty("model-invariant-id")
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ @JsonProperty("model-version-id")
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ @JsonProperty("model-version-id")
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ @JsonProperty("orchestration-status")
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ @JsonProperty("orchestration-status")
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ @JsonProperty("operational-status")
+ public String getOperationalStatus() {
+ return operationalStatus;
+ }
+
+ @JsonProperty("operational-status")
+ public void setOperationalStatus(String operationalStatus) {
+ this.operationalStatus = operationalStatus;
+ }
+
+ @JsonProperty("model-customization-id")
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ @JsonProperty("model-customization-id")
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ @JsonProperty("configuration-selflink")
+ public String getConfigurationSelflink() {
+ return configurationSelflink;
+ }
+
+ @JsonProperty("configuration-selflink")
+ public void setConfigurationSelflink(String configurationSelflink) {
+ this.configurationSelflink = configurationSelflink;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java
new file mode 100644
index 0000000000..3d014b8f67
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java
@@ -0,0 +1,82 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class CustomQuery {
+
+ private List<String> start;
+ private String query;
+ private String gremlin;
+
+ public String getGremlin() {
+ return gremlin;
+ }
+
+ public void setGremlin(String gremlin) {
+ this.gremlin = gremlin;
+ }
+
+
+ public CustomQuery(List<AAIResourceUri> start){
+ this.setStart(start);
+ }
+
+ public CustomQuery(List<AAIResourceUri> start, String query){
+ this.setStart(start);
+ this.query= "query/" + query;
+ }
+
+ public CustomQuery(String gremlin) throws UnsupportedEncodingException{
+ this.gremlin=gremlin;
+ }
+
+ public List<String> getStart() {
+ return start;
+ }
+
+ public void setStart(List<AAIResourceUri> start) {
+ this.start = this.mapUris(start);
+ }
+
+ public String getQuery() {
+ return query;
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+
+ private List<String> mapUris(List<AAIResourceUri> uris) {
+ final List<String> result = new ArrayList<>();
+ uris.stream().map(item -> item.build().toString()).forEach(result::add);
+ return result;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/Relationships.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/Relationships.java
new file mode 100644
index 0000000000..cca2fb3744
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/Relationships.java
@@ -0,0 +1,140 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Predicate;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.openecomp.mso.client.aai.AAICommonObjectMapperProvider;
+import org.openecomp.mso.client.aai.AAIObjectName;
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.AAIResourcesClient;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.openecomp.mso.jsonpath.JsonPathUtil;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.CaseFormat;
+
+public class Relationships {
+
+ private final ObjectMapper mapper;
+ private Map<String, Object> map;
+ private final String jsonBody;
+ public Relationships(String json) {
+ this.jsonBody = json;
+ this.mapper = new AAICommonObjectMapperProvider().getMapper();
+ try {
+ this.map = mapper.readValue(json, new TypeReference<Map<String, Object>>() {});
+ } catch (IOException e) {
+ this.map = new HashMap<>();
+ }
+ }
+
+ public List<AAIResultWrapper> getByType(AAIObjectName type) {
+
+ return this.getAll(Optional.of(type));
+ }
+
+ public List<AAIResultWrapper> getAll() {
+
+ return this.getAll(Optional.empty());
+ }
+
+
+ public List<String> getRelatedLinks() {
+ return this.getRelatedLinks(Optional.empty());
+ }
+
+ public List<String> getRelatedLinks(AAIObjectName type) {
+ return this.getRelatedLinks(Optional.of(type));
+ }
+
+ public List<AAIResourceUri> getRelatedAAIUris() {
+ return this.getRelatedAAIUris(x -> true);
+ }
+
+ public List<AAIResourceUri> getRelatedAAIUris(AAIObjectName type) {
+ return this.getRelatedAAIUris(x -> type.typeName().equals(x));
+ }
+ protected List<AAIResourceUri> getRelatedAAIUris(Predicate<String> p) {
+ List<AAIResourceUri> result = new ArrayList<>();
+ if (map.containsKey("relationship")) {
+ List<Map<String, Object>> relationships = (List<Map<String, Object>>)map.get("relationship");
+ for (Map<String, Object> relationship : relationships) {
+ final String relatedTo = (String)relationship.get("related-to");
+ if (p.test(relatedTo)) {
+ AAIObjectType type;
+ try {
+ type = AAIObjectType.valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, relatedTo));
+ } catch (IllegalArgumentException e) {
+ type = AAIObjectType.UNKNOWN;
+ }
+ final String relatedLink = (String)relationship.get("related-link");
+
+ result.add(AAIUriFactory.createResourceFromExistingURI(type, UriBuilder.fromPath(relatedLink).build()));
+ }
+ }
+ }
+ return result;
+ }
+
+
+
+ protected List<AAIResultWrapper> getAll(final Optional<AAIObjectName> type) {
+ List<AAIResourceUri> relatedLinks;
+ if (type.isPresent()) {
+ relatedLinks = this.getRelatedAAIUris(type.get());
+ } else {
+ relatedLinks = this.getRelatedAAIUris();
+ }
+ ArrayList<AAIResultWrapper> result = new ArrayList<>();
+ for (AAIResourceUri link : relatedLinks) {
+ result.add(this.get(link));
+ }
+ return result;
+ }
+
+ protected AAIResultWrapper get(AAIResourceUri uri) {
+ return new AAIResourcesClient().get(uri);
+
+ }
+
+ protected List<String> getRelatedLinks(Optional<AAIObjectName> type) {
+ String matcher = "";
+ if (type.isPresent()) {
+ matcher = "[?(@.related-to=='" + type.get() + "')]";
+ }
+ return JsonPathUtil.getInstance().locateResultList(this.jsonBody, String.format("$.relationship%s.related-link", matcher));
+ }
+
+ public String getJson() {
+ return this.jsonBody;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java
new file mode 100644
index 0000000000..2fd3572401
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java
@@ -0,0 +1,46 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "serviceException"
+})
+public class RequestError {
+
+ @JsonProperty("serviceException")
+ private ServiceException serviceException;
+
+ @JsonProperty("serviceException")
+ public ServiceException getServiceException() {
+ return serviceException;
+ }
+
+ @JsonProperty("serviceException")
+ public void setServiceException(ServiceException serviceException) {
+ this.serviceException = serviceException;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/Results.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/Results.java
new file mode 100644
index 0000000000..e91823a348
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/Results.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"results"
+})
+public class Results<T> {
+ @JsonProperty("results")
+ protected List<T> results;
+
+ @JsonProperty("results")
+ public List<T> getResult() {
+ if (results == null) {
+ results = new ArrayList<>();
+ }
+ return this.results;
+ }
+ @JsonProperty("results")
+ public void setResult(List<T> results) {
+ this.results=results;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java
new file mode 100644
index 0000000000..66ca10d06b
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java
@@ -0,0 +1,75 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "messageId",
+ "text",
+ "variables"
+})
+public class ServiceException {
+
+ @JsonProperty("messageId")
+ private String messageId;
+ @JsonProperty("text")
+ private String text;
+ @JsonProperty("variables")
+ private List<String> variables = new ArrayList<>();
+
+ @JsonProperty("messageId")
+ public String getMessageId() {
+ return messageId;
+ }
+
+ @JsonProperty("messageId")
+ public void setMessageId(String messageId) {
+ this.messageId = messageId;
+ }
+
+ @JsonProperty("text")
+ public String getText() {
+ return text;
+ }
+
+ @JsonProperty("text")
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ @JsonProperty("variables")
+ public List<String> getVariables() {
+ return variables;
+ }
+
+ @JsonProperty("variables")
+ public void setVariables(List<String> variables) {
+ this.variables = variables;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/OperationBody.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/OperationBody.java
new file mode 100644
index 0000000000..ddd9a454f8
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/OperationBody.java
@@ -0,0 +1,69 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.bulkprocess;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"uri",
+"body"
+})
+public class OperationBody {
+
+@JsonProperty("uri")
+private String uri;
+@JsonProperty("body")
+private Object body;
+
+@JsonProperty("uri")
+public String getUri() {
+return uri;
+}
+
+@JsonProperty("uri")
+public void setUri(String uri) {
+this.uri = uri;
+}
+
+public OperationBody withUri(String uri) {
+this.uri = uri;
+return this;
+}
+
+@JsonProperty("body")
+public Object getBody() {
+return body;
+}
+
+@JsonProperty("body")
+public void setBody(Object body) {
+this.body = body;
+}
+
+public OperationBody withBody(Object body) {
+this.body = body;
+return this;
+}
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transaction.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transaction.java
new file mode 100644
index 0000000000..8c4d54dc16
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transaction.java
@@ -0,0 +1,95 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.bulkprocess;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"patch",
+"patch",
+"delete"
+})
+public class Transaction {
+
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+@JsonProperty("put")
+private List<OperationBody> put = new ArrayList<>();
+
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+@JsonProperty("patch")
+private List<OperationBody> patch = new ArrayList<>();
+
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+@JsonProperty("delete")
+private List<OperationBody> delete = new ArrayList<>();
+
+@JsonProperty("put")
+public List<OperationBody> getPut() {
+return put;
+}
+
+@JsonProperty("put")
+public void setPut(List<OperationBody> put) {
+this.put = put;
+}
+
+public Transaction withPut(List<OperationBody> put) {
+this.put = put;
+return this;
+}
+
+@JsonProperty("patch")
+public List<OperationBody> getPatch() {
+return patch;
+}
+
+@JsonProperty("patch")
+public void setPatch(List<OperationBody> patch) {
+this.patch = patch;
+}
+
+public Transaction withPatch(List<OperationBody> patch) {
+this.patch = patch;
+return this;
+}
+
+@JsonProperty("delete")
+public List<OperationBody> getDelete() {
+return delete;
+}
+
+@JsonProperty("delete")
+public void setDelete(List<OperationBody> delete) {
+this.delete = delete;
+}
+
+public Transaction withDelete(List<OperationBody> delete) {
+this.delete = delete;
+return this;
+}
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transactions.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transactions.java
new file mode 100644
index 0000000000..f6ce3c5d2c
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transactions.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.bulkprocess;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"transactions"
+})
+public class Transactions {
+
+@JsonProperty("transactions")
+private List<Transaction> transactions = new ArrayList<>();
+
+@JsonProperty("transactions")
+public List<Transaction> getTransactions() {
+return transactions;
+}
+
+@JsonProperty("transactions")
+public void setTransactions(List<Transaction> transactions) {
+this.transactions = transactions;
+}
+
+public Transactions withTransactions(List<Transaction> transactions) {
+this.transactions = transactions;
+return this;
+}
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIResourceUri.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIResourceUri.java
new file mode 100644
index 0000000000..36e3d008ae
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIResourceUri.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri;
+
+import org.openecomp.mso.client.aai.AAIObjectPlurals;
+import org.openecomp.mso.client.aai.AAIObjectType;
+
+public interface AAIResourceUri extends AAIUri {
+
+ public AAIResourceUri relationshipAPI();
+ public AAIResourceUri relatedTo(AAIObjectPlurals plural);
+ public AAIResourceUri relatedTo(AAIObjectType type, String... values);
+ public AAIResourceUri resourceVersion(String version);
+ public AAIResourceUri depth(Depth depth);
+ public AAIResourceUri nodesOnly(boolean nodesOnly);
+ public AAIResourceUri queryParam(String name, String... values);
+ public AAIResourceUri clone();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUri.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUri.java
new file mode 100644
index 0000000000..1617bcddea
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUri.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.openecomp.mso.client.aai.AAIObjectPlurals;
+import org.openecomp.mso.client.aai.AAIObjectType;
+
+public interface AAIUri {
+
+ public URI build();
+ /**
+ * By default A&AI enforces a depth of 1. Some objects can be told to retrieve objects
+ * nested beneath them by increasing this number.
+ *
+ * You can use 0 to restrict the returned information to only the object you requested
+ * You can use all to retrieve all nested objects (this should only be used if you really need a massive amount of information and are caching the retrieval)
+ * @param depth
+ * @return
+ */
+ public AAIUri depth(Depth depth);
+ /**
+ * Makes client only return object fields, no relationships
+ *
+ * @return
+ */
+ public AAIUri nodesOnly(boolean nodesOnly);
+ public AAIUri queryParam(String name, String... values);
+ public AAIUri clone();
+
+ /**
+ * returns all key values of the URI as a map. Key names can be found in {@link AAIObjectType}
+ * @return
+ */
+ public Map<String, String> getURIKeys();
+ public AAIObjectType getObjectType();
+ public boolean equals(Object o);
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactory.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactory.java
new file mode 100644
index 0000000000..cb33435c69
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactory.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.openecomp.mso.client.aai.entities.uri;
+
+import java.net.URI;
+
+import org.openecomp.mso.client.aai.AAIObjectPlurals;
+import org.openecomp.mso.client.aai.AAIObjectType;
+
+
+public class AAIUriFactory {
+
+ /**
+ * values are filled into the URI template specified in {@link AAIObjectType} in order
+ *
+ * @param type
+ * @param values
+ * @return
+ */
+ public static AAIResourceUri createResourceUri(AAIObjectType type, Object... values) {
+ if (AAIObjectType.SERVICE_INSTANCE.equals(type)) {
+ return new ServiceInstanceUri(values);
+ } else {
+ return new SimpleUri(type, values);
+ }
+ }
+
+ public static AAIResourceUri createNodesUri(AAIObjectType type, Object... values) {
+ return new NodesUri(type, values);
+
+ }
+
+ /**
+ * This method should only be used to wrap a URI retrieved from A&AI contained within an object response
+ *
+ * @param type
+ * @param uri
+ * @return
+ */
+ public static AAIResourceUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
+ return new SimpleUri(type, uri);
+ }
+
+ /**
+ * Creates a uri for a plural type e.g. /cloud-infrastructure/pservers
+ *
+ * @param type
+ * @return
+ */
+ public static AAIResourceUri createResourceUri(AAIObjectPlurals type) {
+
+ return new SimpleUri(type);
+
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/Depth.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/Depth.java
new file mode 100644
index 0000000000..7522ea33d1
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/Depth.java
@@ -0,0 +1,45 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri;
+
+public enum Depth {
+ ZERO("0"),
+ ONE("1"),
+ TWO("2"),
+ THREE("3"),
+ FOUR("4"),
+ FIVE("5"),
+ SIX("6"),
+ ALL("all");
+
+ private final String depth;
+ private Depth(String s) {
+
+ this.depth = s;
+ }
+
+
+ @Override
+ public String toString() {
+ return this.depth;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/NodesUri.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/NodesUri.java
new file mode 100644
index 0000000000..407e0ecc9e
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/NodesUri.java
@@ -0,0 +1,44 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.openecomp.mso.client.aai.AAIObjectPlurals;
+import org.openecomp.mso.client.aai.AAIObjectType;
+
+public class NodesUri extends SimpleUri {
+
+ protected NodesUri(AAIObjectType type, Object... values) {
+ super(type, values);
+ }
+
+
+ @Override
+ protected String getTemplate(AAIObjectType type) {
+ return "/nodes" + type.partialUri();
+ }
+
+ @Override
+ protected String getTemplate(AAIObjectPlurals type) {
+ return "/nodes" + type.partialUri();
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUri.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUri.java
new file mode 100644
index 0000000000..cdaecedfa9
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUri.java
@@ -0,0 +1,129 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Optional;
+
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.core.UriBuilder;
+
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.AAIQueryClient;
+import org.openecomp.mso.client.aai.Format;
+import org.openecomp.mso.client.aai.entities.CustomQuery;
+import org.openecomp.mso.client.aai.entities.Results;
+import org.openecomp.mso.client.aai.exceptions.AAIPayloadException;
+import org.openecomp.mso.client.aai.exceptions.AAIUriComputationException;
+import org.openecomp.mso.client.aai.exceptions.AAIUriNotFoundException;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ServiceInstanceUri extends SimpleUri {
+
+ private Optional<String> cachedValue = Optional.empty();
+
+ protected ServiceInstanceUri(Object... values) {
+ super(AAIObjectType.SERVICE_INSTANCE, values);
+ }
+ protected ServiceInstanceUri(UriBuilder builder, Optional<String> cachedValue, Object... values) {
+ super(AAIObjectType.SERVICE_INSTANCE, builder, values);
+ this.cachedValue = cachedValue;
+ }
+ protected String getSerivceInstance(Object id) throws AAIUriNotFoundException, AAIPayloadException {
+ if (!this.getCachedValue().isPresent()) {
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, id);
+ CustomQuery query = new CustomQuery(Collections.singletonList(serviceInstanceUri));
+ String resultJson;
+ try {
+ resultJson = this.getQueryClient().query(Format.PATHED, query);
+ } catch (ResponseProcessingException e) {
+ if (e.getCause() instanceof BadRequestException) {
+ throw new AAIUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
+ } else {
+ throw e;
+ }
+ }
+ try {
+ cachedValue = extractRelatedLink(resultJson);
+ if (!cachedValue.isPresent()) {
+ throw new AAIUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
+ }
+ } catch (IOException e) {
+ throw new AAIPayloadException("could not map payload: " + resultJson, e);
+ }
+
+ }
+
+ return this.getCachedValue().get();
+ }
+
+ protected Optional<String> extractRelatedLink(String jsonString) throws IOException {
+ Optional<String> result;
+ ObjectMapper mapper = new ObjectMapper();
+
+ Results<Map<String, String>> results = mapper.readValue(jsonString, new TypeReference<Results<Map<String, String>>>(){});
+ if (results.getResult().size() == 1) {
+ String uriString = results.getResult().get(0).get("resource-link");
+ URI uri = UriBuilder.fromUri(uriString).build();
+ String rawPath = uri.getRawPath();
+ result = Optional.of(rawPath.replaceAll("/aai/v\\d+", ""));
+ } else if (results.getResult().isEmpty()) {
+ result = Optional.empty();
+ } else {
+ throw new IllegalStateException("more than one result returned");
+ }
+
+ return result;
+ }
+
+ protected Optional<String> getCachedValue() {
+ return this.cachedValue;
+ }
+
+ @Override
+ public URI build() {
+ try {
+ if (this.values.length == 1) {
+ String uri = getSerivceInstance(this.values[0]);
+ Map<String, String> map = getURIKeys(uri);
+ return super.build(map.values().toArray(values));
+ }
+ } catch (AAIUriNotFoundException | AAIPayloadException e) {
+ throw new AAIUriComputationException(e);
+ }
+ return super.build();
+ }
+
+ @Override
+ public ServiceInstanceUri clone() {
+ return new ServiceInstanceUri(this.internalURI.clone(), this.getCachedValue(), values);
+ }
+
+ protected AAIQueryClient getQueryClient() {
+ return new AAIQueryClient();
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/SimpleUri.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/SimpleUri.java
new file mode 100644
index 0000000000..f3e6fad48b
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/SimpleUri.java
@@ -0,0 +1,187 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.openecomp.mso.client.aai.AAIObjectPlurals;
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.entities.uri.parsers.UriParser;
+import org.openecomp.mso.client.aai.entities.uri.parsers.UriParserSpringImpl;
+import org.springframework.web.util.UriUtils;
+
+public class SimpleUri implements AAIResourceUri {
+
+ protected UriBuilder internalURI;
+ protected final static String relationshipAPI = "/relationship-list/relationship";
+ protected final static String relatedTo = "/related-to";
+ protected final Object[] values;
+ protected final AAIObjectType type;
+ protected final AAIObjectPlurals pluralType;
+ protected SimpleUri(AAIObjectType type, Object... values) {
+ this.type = type;
+ this.pluralType = null;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values = values;
+ }
+ protected SimpleUri(AAIObjectType type, URI uri) {
+ this.type = type;
+ this.pluralType = null;
+ this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll("/aai/v\\d+", ""));
+ this.values = new Object[0];
+ }
+ protected SimpleUri(AAIObjectType type, UriBuilder builder, Object... values) {
+ this.internalURI = builder;
+ this.values = values;
+ this.type = type;
+ this.pluralType = null;
+ }
+ protected SimpleUri(AAIObjectPlurals type, UriBuilder builder, Object... values) {
+ this.internalURI = builder;
+ this.values = values;
+ this.type = null;
+ this.pluralType = type;
+ }
+ protected SimpleUri(AAIObjectPlurals type) {
+ this.type = null;
+ this.pluralType = type;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values = new Object[0];
+ }
+
+ @Override
+ public SimpleUri relationshipAPI() {
+ this.internalURI = internalURI.path(relationshipAPI);
+ return this;
+ }
+
+ @Override
+ public SimpleUri relatedTo(AAIObjectPlurals plural) {
+
+ this.internalURI = internalURI.path(relatedTo).path(plural.partialUri());
+ return this;
+ }
+ @Override
+ public SimpleUri relatedTo(AAIObjectType type, String... values) {
+ this.internalURI = internalURI.path(relatedTo).path(UriBuilder.fromPath(type.partialUri()).build(values).toString());
+ return this;
+ }
+
+ @Override
+ public SimpleUri resourceVersion(String version) {
+ this.internalURI = internalURI.queryParam("resource-version", version);
+ return this;
+ }
+
+ @Override
+ public SimpleUri queryParam(String name, String... values) {
+ this.internalURI = internalURI.queryParam(name, values);
+ return this;
+ }
+
+ @Override
+ public URI build() {
+ return build(this.values);
+ }
+
+ protected URI build(Object... values) {
+ //This is a workaround because resteasy does not encode URIs correctly
+ final String[] encoded = new String[values.length];
+ for (int i = 0; i < values.length; i++) {
+ try {
+ encoded[i] = UriUtils.encode(values[i].toString(), StandardCharsets.UTF_8.toString());
+ } catch (UnsupportedEncodingException e) {
+ encoded[i] = values[i].toString();
+ }
+ }
+ return internalURI.buildFromEncoded(encoded);
+ }
+
+ @Override
+ public Map<String, String> getURIKeys() {
+ return this.getURIKeys(this.build().toString());
+ }
+
+ protected Map<String, String> getURIKeys(String uri) {
+ UriParser parser;
+ if (this.type != null) {
+ if (!("".equals(this.getTemplate(type)))) {
+ parser = new UriParserSpringImpl(this.getTemplate(type));
+ } else {
+ return new HashMap<>();
+ }
+ } else {
+ parser = new UriParserSpringImpl(this.getTemplate(pluralType));
+ }
+
+
+ return parser.parse(uri);
+ }
+
+ @Override
+ public SimpleUri clone() {
+ if (this.type != null) {
+ return new SimpleUri(this.type, this.internalURI.clone(), values);
+ } else {
+ return new SimpleUri(this.pluralType, this.internalURI.clone(), values);
+ }
+ }
+
+ @Override
+ public AAIObjectType getObjectType() {
+ return this.type;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof AAIUri) {
+ return this.build().equals(((AAIUri)o).build());
+ }
+ return false;
+ }
+ @Override
+ public SimpleUri depth(Depth depth) {
+ this.internalURI.queryParam("depth", depth.toString());
+ return this;
+ }
+ @Override
+ public SimpleUri nodesOnly(boolean nodesOnly) {
+ if (nodesOnly) {
+ this.internalURI.queryParam("nodes-only", "");
+ }
+ return this;
+ }
+
+ protected String getTemplate(AAIObjectType type) {
+ return type.uriTemplate();
+ }
+
+ protected String getTemplate(AAIObjectPlurals type) {
+ return type.uriTemplate();
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParser.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParser.java
new file mode 100644
index 0000000000..8e37d595b0
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParser.java
@@ -0,0 +1,29 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri.parsers;
+
+import java.util.Map;
+import java.util.Set;
+
+public interface UriParser {
+ public Set<String> getVariables();
+ public Map<String, String> parse(final String uri);
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImpl.java b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImpl.java
new file mode 100644
index 0000000000..75f9005125
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImpl.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri.parsers;
+import java.io.UnsupportedEncodingException;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.springframework.web.util.UriTemplate;
+import org.springframework.web.util.UriUtils;
+
+public class UriParserSpringImpl implements UriParser {
+
+ private final UriTemplate uriTemplate;
+
+ public UriParserSpringImpl(final String template) {
+ this.uriTemplate = new UriTemplate(template);
+ }
+
+ @Override
+ public Map<String, String> parse(final String uri) {
+ final boolean match = this.uriTemplate.matches(uri);
+ if (!match) {
+ return new LinkedHashMap<>();
+ }
+ return Collections.unmodifiableMap(decodeParams(this.uriTemplate.match(uri)));
+ }
+
+ @Override
+ public Set<String> getVariables() {
+ return Collections.unmodifiableSet(new LinkedHashSet<String>(this.uriTemplate.getVariableNames()));
+ }
+
+ protected Map<String, String> decodeParams(Map<String, String> map) {
+ final Map<String, String> result = new LinkedHashMap<>();
+
+ for (Entry<String, String> entry : map.entrySet()) {
+ try {
+ result.put(entry.getKey(), UriUtils.decode(entry.getValue(), "UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ result.put(entry.getKey(), "");
+ }
+ }
+
+ return result;
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadException.java b/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadException.java
new file mode 100644
index 0000000000..35842204ac
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadException.java
@@ -0,0 +1,40 @@
+/*-
+ * ============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.openecomp.mso.client.aai.exceptions;
+
+public class AAIPayloadException extends Exception {
+
+ private static final long serialVersionUID = -5712783905947711065L;
+
+ public AAIPayloadException(Throwable t) {
+ super(t);
+ }
+
+ public AAIPayloadException(String s, Throwable t) {
+ super(s, t);
+ }
+
+ public AAIPayloadException(String s) {
+ super(s);
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriComputationException.java b/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriComputationException.java
new file mode 100644
index 0000000000..4d9f320cc8
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriComputationException.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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.openecomp.mso.client.aai.exceptions;
+
+public class AAIUriComputationException extends RuntimeException {
+
+ private static final long serialVersionUID = 5187931752227522034L;
+
+ public AAIUriComputationException(String s) {
+ super(s);
+ }
+
+ public AAIUriComputationException(Throwable t) {
+ super(t);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriNotFoundException.java b/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriNotFoundException.java
new file mode 100644
index 0000000000..3e373946ce
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriNotFoundException.java
@@ -0,0 +1,29 @@
+/*-
+ * ============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.openecomp.mso.client.aai.exceptions;
+
+public class AAIUriNotFoundException extends Exception {
+ private static final long serialVersionUID = 2789643165122257833L;
+
+ public AAIUriNotFoundException(String message) {
+ super(message);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/BulkProcessFailed.java b/common/src/main/java/org/openecomp/mso/client/aai/exceptions/BulkProcessFailed.java
new file mode 100644
index 0000000000..ea64f54c33
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/exceptions/BulkProcessFailed.java
@@ -0,0 +1,28 @@
+/*-
+ * ============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.openecomp.mso.client.aai.exceptions;
+
+public class BulkProcessFailed extends Exception {
+
+ public BulkProcessFailed(String message) {
+ super(message);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironment.java b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironment.java
new file mode 100644
index 0000000000..f044e2a237
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironment.java
@@ -0,0 +1,159 @@
+/*-
+ * ============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.openecomp.mso.client.aai.objects;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"operational-environment-id",
+"operational-environment-name",
+"operational-environment-type",
+"operational-environment-status",
+"tenant-context",
+"workload-context",
+"resource-version"
+})
+public class AAIOperationalEnvironment {
+
+@JsonProperty("operational-environment-id")
+private String operationalEnvironmentId;
+@JsonProperty("operational-environment-name")
+private String operationalEnvironmentName;
+@JsonProperty("operational-environment-type")
+private String operationalEnvironmentType;
+@JsonProperty("operational-environment-status")
+private String operationalEnvironmentStatus;
+@JsonProperty("tenant-context")
+private String tenantContext;
+@JsonProperty("workload-context")
+private String workloadContext;
+@JsonProperty("resource-version")
+private String resourceVersion;
+
+@JsonProperty("operational-environment-id")
+public String getOperationalEnvironmentId() {
+return operationalEnvironmentId;
+ }
+
+@JsonProperty("operational-environment-id")
+public void setOperationalEnvironmentId(String operationalEnvironmentId) {
+this.operationalEnvironmentId = operationalEnvironmentId;
+ }
+
+public AAIOperationalEnvironment withOperationalEnvironmentId(String operationalEnvironmentId) {
+this.operationalEnvironmentId = operationalEnvironmentId;
+return this;
+ }
+
+@JsonProperty("operational-environment-name")
+public String getOperationalEnvironmentName() {
+return operationalEnvironmentName;
+ }
+
+@JsonProperty("operational-environment-name")
+public void setOperationalEnvironmentName(String operationalEnvironmentName) {
+this.operationalEnvironmentName = operationalEnvironmentName;
+ }
+
+public AAIOperationalEnvironment withOperationalEnvironmentName(String operationalEnvironmentName) {
+this.operationalEnvironmentName = operationalEnvironmentName;
+return this;
+ }
+
+@JsonProperty("operational-environment-type")
+public String getOperationalEnvironmentType() {
+return operationalEnvironmentType;
+ }
+
+@JsonProperty("operational-environment-type")
+public void setOperationalEnvironmentType(String operationalEnvironmentType) {
+this.operationalEnvironmentType = operationalEnvironmentType;
+ }
+
+public AAIOperationalEnvironment withOperationalEnvironmentType(String operationalEnvironmentType) {
+this.operationalEnvironmentType = operationalEnvironmentType;
+return this;
+ }
+
+@JsonProperty("operational-environment-status")
+public String getOperationalEnvironmentStatus() {
+return operationalEnvironmentStatus;
+ }
+
+@JsonProperty("operational-environment-status")
+public void setOperationalEnvironmentStatus(String operationalEnvironmentStatus) {
+this.operationalEnvironmentStatus = operationalEnvironmentStatus;
+ }
+
+public AAIOperationalEnvironment withOperationalEnvironmentStatus(String operationalEnvironmentStatus) {
+this.operationalEnvironmentStatus = operationalEnvironmentStatus;
+return this;
+ }
+
+@JsonProperty("tenant-context")
+public String getTenantContext() {
+return tenantContext;
+ }
+
+@JsonProperty("tenant-context")
+public void setTenantContext(String tenantContext) {
+this.tenantContext = tenantContext;
+ }
+
+public AAIOperationalEnvironment withTenantContext(String tenantContext) {
+this.tenantContext = tenantContext;
+return this;
+ }
+
+@JsonProperty("workload-context")
+public String getWorkloadContext() {
+return workloadContext;
+ }
+
+@JsonProperty("workload-context")
+public void setWorkloadContext(String workloadContext) {
+this.workloadContext = workloadContext;
+ }
+
+public AAIOperationalEnvironment withWorkloadContext(String workloadContext) {
+this.workloadContext = workloadContext;
+return this;
+ }
+
+@JsonProperty("resource-version")
+public String getResourceVersion() {
+return resourceVersion;
+ }
+
+@JsonProperty("resource-version")
+public void setResourceVersion(String resourceVersion) {
+this.resourceVersion = resourceVersion;
+ }
+
+public AAIOperationalEnvironment withResourceVersion(String resourceVersion) {
+this.resourceVersion = resourceVersion;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java
new file mode 100644
index 0000000000..b0b3d06669
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java
@@ -0,0 +1,67 @@
+/*-
+ * ============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.openecomp.mso.client.aai.objects;
+
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.entities.AAIEntityObject;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AAIOwningEntity implements AAIEntityObject {
+
+ @JsonProperty("owning-entity-name")
+ private String owningEntityName;
+
+ @JsonProperty("owning-entity-id")
+ private String owningEntityId;
+
+ public String getOwningEntityName() {
+ return owningEntityName;
+ }
+
+ public void setOwningEntityName(String owningEntityName) {
+ this.owningEntityName = owningEntityName;
+ }
+
+ public String getOwningEntityId() {
+ return owningEntityId;
+ }
+
+ public void setOwningEntityId(String owningEntityId) {
+ this.owningEntityId = owningEntityId;
+ }
+
+ public AAIOwningEntity withOwningEntity(String owningEntityName, String owningEntityId) {
+ this.setOwningEntityName(owningEntityName);
+ this.setOwningEntityId(owningEntityId);
+ return this;
+ }
+
+ @Override
+ public AAIResourceUri getUri() {
+ final AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, this.owningEntityId);
+ return uri;
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java
new file mode 100644
index 0000000000..34f715d98a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.openecomp.mso.client.aai.objects;
+
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.entities.AAIEntityObject;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AAIProject implements AAIEntityObject {
+
+ @JsonProperty("project-name")
+ private String projectName;
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+
+ public AAIProject withProjectName(String projectName) {
+ this.setProjectName(projectName);
+ return this;
+ }
+
+ @Override
+ public AAIResourceUri getUri() {
+ final AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, this.projectName);
+ return uri;
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIServiceInstance.java b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIServiceInstance.java
new file mode 100644
index 0000000000..dbb34fcd44
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIServiceInstance.java
@@ -0,0 +1,135 @@
+/*-
+ * ============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.openecomp.mso.client.aai.objects;
+
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.entities.AAIEntityObject;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AAIServiceInstance implements AAIEntityObject {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+ @JsonProperty("service-instance-name")
+ private String serviceInstanceName;
+ @JsonProperty("service-type")
+ private String serviceType;
+ @JsonProperty("service-role")
+ private String serviceRole;
+ @JsonProperty("orchestration-status")
+ private String oStatus;
+ @JsonProperty("model-invariant-id")
+ private String modelInvariantUuid;
+ @JsonProperty("model-version-id")
+ private String modelUuid;
+ @JsonProperty("environment-context")
+ private String environmentContext;
+ @JsonProperty("workload-context")
+ private String workloadContext;
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ public String getoStatus() {
+ return oStatus;
+ }
+
+ public void setoStatus(String oStatus) {
+ this.oStatus = oStatus;
+ }
+
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+
+ public String getModelUuid() {
+ return modelUuid;
+ }
+
+ public void setModelUuid(String modelUuid) {
+ this.modelUuid = modelUuid;
+ }
+
+ public String getEnvironmentContext() {
+ return environmentContext;
+ }
+
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public AAIServiceInstance withServiceInstance(String serviceInstanceId) {
+ this.setServiceInstanceId(serviceInstanceId);
+ return this;
+ }
+
+ @Override
+ public AAIResourceUri getUri() {
+ final AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, this.serviceInstanceId);
+ return uri;
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java b/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java
new file mode 100644
index 0000000000..354d47af06
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.openecomp.mso.client.defaultproperties;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.openecomp.mso.client.aai.AAIProperties;
+import org.openecomp.mso.client.aai.AAIVersion;
+
+public class DefaultAAIPropertiesImpl implements AAIProperties {
+
+
+ final Map<Object, Object> props;
+ public DefaultAAIPropertiesImpl() {
+ File initialFile = new File("src/test/resources/aai.properties");
+ Map<Object, Object> temp;
+ try {
+ InputStream targetStream = new FileInputStream(initialFile);
+ Properties properties = new Properties();
+ properties.load(targetStream);
+ temp = properties;
+ } catch (IOException e) {
+ temp = new HashMap<>();
+ }
+ this.props = temp;
+
+ }
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(props.get("aai.endpoint").toString());
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+ @Override
+ public AAIVersion getDefaultVersion() {
+ return AAIVersion.LATEST;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultDmaapPropertiesImpl.java b/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultDmaapPropertiesImpl.java
new file mode 100644
index 0000000000..1345286d9c
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultDmaapPropertiesImpl.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.openecomp.mso.client.defaultproperties;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.openecomp.mso.client.dmaap.DmaapProperties;
+
+public class DefaultDmaapPropertiesImpl implements DmaapProperties {
+
+ private final Map<String, String> properties;
+ public DefaultDmaapPropertiesImpl() throws IOException {
+ File initialFile = new File("src/test/resources/dmaap.properties");
+ InputStream targetStream = new FileInputStream(initialFile);
+ Properties properties = new Properties();
+ properties.load(targetStream);
+ this.properties = new HashMap<>();
+ properties.forEach((key, value) -> this.properties.put((String)key, (String)value));
+ }
+ @Override
+ public Map<String, String> getProperties() {
+ return this.properties;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java b/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java
new file mode 100644
index 0000000000..77d67d70fc
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java
@@ -0,0 +1,80 @@
+/*-
+ * ============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.openecomp.mso.client.defaultproperties;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.openecomp.mso.client.policy.PolicyRestProperties;
+
+public class PolicyRestPropertiesImpl implements PolicyRestProperties {
+
+
+ final Map<Object, Object> props;
+ public PolicyRestPropertiesImpl() {
+ File initialFile = new File("src/test/resources/policy.properties");
+ InputStream targetStream;
+ Map<Object, Object> temp;
+ try {
+ targetStream = new FileInputStream(initialFile);
+ Properties properties = new Properties();
+ properties.load(targetStream);
+ temp = properties;
+ } catch (IOException e) {
+ temp = new HashMap<>();
+ }
+ this.props = temp;
+
+ }
+ @Override
+ public URL getEndpoint() {
+ try {
+ return new URL((String)props.getOrDefault("policy.endpoint", ""));
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+
+ public String getClientAuth() {
+ return (String)props.get("policy.client.auth");
+ }
+
+ public String getAuth() {
+ return (String)props.get("policy.auth");
+ }
+
+ public String getEnvironment() {
+ return (String)props.get("policy.environment");
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java b/common/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java
new file mode 100644
index 0000000000..0e00ae5da8
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java
@@ -0,0 +1,26 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap;
+
+public interface Consumer {
+
+ public Iterable<String> fetch();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java
new file mode 100644
index 0000000000..aabeb8aabf
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.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.openecomp.mso.client.dmaap;
+
+import java.io.IOException;
+import java.util.Base64;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Properties;
+
+import org.openecomp.mso.client.defaultproperties.DefaultDmaapPropertiesImpl;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public abstract class DmaapClient {
+
+ protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+ 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();
+ if (dmaapProperties == null) {
+ auditLogger.error("No RestProperty implementation found on classpath, loading default");
+ dmaapProperties = new DefaultDmaapPropertiesImpl();
+ }
+ 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());
+ this.properties.put("topic", this.getTopic());
+ if (this.getHost().isPresent()) {
+ this.properties.put("host", this.getHost().get());
+ }
+ }
+ protected String deobfuscatePassword(String password) {
+
+ try {
+ return new String(Base64.getDecoder().decode(password.getBytes()));
+ } catch(IllegalArgumentException iae) {
+
+ return password;
+ }
+ }
+
+
+ public abstract String getUserName();
+ public abstract String getPassword();
+ public abstract String getTopic();
+ public abstract Optional<String> getHost();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java
new file mode 100644
index 0000000000..033951612d
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java
@@ -0,0 +1,131 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+import org.openecomp.mso.client.dmaap.exceptions.DMaaPConsumerFailure;
+import org.openecomp.mso.client.dmaap.exceptions.ExceededMaximumPollingTime;
+import org.openecomp.mso.client.dmaap.rest.RestConsumer;
+
+import com.google.common.base.Stopwatch;
+
+public abstract class DmaapConsumer extends DmaapClient {
+
+ public DmaapConsumer() throws FileNotFoundException, IOException {
+ super("dmaap/default-consumer.properties");
+ }
+
+ public Consumer getConsumer() throws FileNotFoundException, IOException {
+ return new RestConsumer(this.properties);
+ }
+ public boolean consume() throws Exception {
+
+ Consumer mrConsumer = this.getConsumer();
+ int iterations = 0;
+ boolean accepted = false;
+ Stopwatch stopwatch = Stopwatch.createUnstarted();
+ try {
+ while (this.continuePolling()) {
+ if (stopwatch.elapsed(TimeUnit.MILLISECONDS) >= this.getMaximumElapsedTime()) {
+ final String message = "exceeded maximum retries on " + this.getRequestId() + " on " + this.getTopic();
+ auditLogger.error(message);
+ throw new ExceededMaximumPollingTime(message);
+ }
+ stopwatch.start();
+ Iterable<String> itr = mrConsumer.fetch();
+ stopwatch.stop();
+ for (String message : itr) {
+ if (!accepted && this.isAccepted(message)) {
+ auditLogger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
+ accepted = true;
+ }
+ if (accepted) {
+ if (this.isFailure(message)) {
+ this.stopProcessingMessages();
+ auditLogger.info("received dmaap message: " + message);
+ final String errorMsg = "failure received from dmaap topic " + this.getTopic();
+ auditLogger.error(errorMsg);
+ throw new DMaaPConsumerFailure(errorMsg);
+ } else {
+ auditLogger.info("received dmaap message: " + message);
+ this.processMessage(message);
+ }
+ }
+ }
+ iterations++;
+ }
+ return true;
+ } catch (Exception e ) {
+ throw e;
+ } finally {
+ if (stopwatch.isRunning()) {
+ stopwatch.stop();
+ }
+ }
+ }
+
+ /**
+ * Should this consumer continue to consume messages from the topic?
+ * @return
+ */
+ public abstract boolean continuePolling();
+ /**
+ * Process a message from a DMaaP topic
+ *
+ * @param message
+ * @throws Exception
+ */
+ public abstract void processMessage(String message) throws Exception;
+ /**
+ * Has the request been accepted by the receiving system?
+ * Should the consumer move to processing messages?
+ *
+ * @param message
+ * @return
+ */
+ public abstract boolean isAccepted(String message);
+ /**
+ * has the request failed?
+ *
+ * @param message
+ * @return
+ */
+ public abstract boolean isFailure(String message);
+ /**
+ * The request id to filter messages on
+ * @return
+ */
+ public abstract String getRequestId();
+ /**
+ * Logic that defines when the consumer should stop processing messages
+ */
+ public abstract void stopProcessingMessages();
+
+ /**
+ * time in milliseconds
+ */
+ public int getMaximumElapsedTime() {
+ return 180000;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java
new file mode 100644
index 0000000000..7bdd7dfe40
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java
@@ -0,0 +1,32 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap;
+
+import java.util.Map;
+
+public interface DmaapProperties {
+
+ /**
+ * A map of strings which contains the properties for a dmaap client
+ * @return
+ */
+ public Map<String, String> getProperties();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java
new file mode 100644
index 0000000000..3c861991f6
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap;
+
+import java.util.ServiceLoader;
+
+public class DmaapPropertiesLoader {
+
+ private final ServiceLoader<DmaapProperties> services;
+ private DmaapPropertiesLoader() {
+ services = ServiceLoader.load(DmaapProperties.class);
+ }
+
+ private static class Helper {
+ private static final DmaapPropertiesLoader INSTANCE = new DmaapPropertiesLoader();
+ }
+
+ public static DmaapPropertiesLoader getInstance() {
+ return Helper.INSTANCE;
+ }
+ public DmaapProperties getImpl() {
+ return this.getImpl(false);
+ }
+ public DmaapProperties getNewImpl() {
+ return this.getImpl(true);
+ }
+ private DmaapProperties getImpl(boolean forceNewInstance) {
+ for (DmaapProperties service : services) {
+ if (forceNewInstance) {
+ try {
+ return service.getClass().newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ /* all spi implementations must provide a public
+ * no argument constructor
+ */
+ }
+ } else {
+ return service;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java
new file mode 100644
index 0000000000..d2752c531b
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.openecomp.mso.client.dmaap.rest.RestPublisher;
+
+public abstract class DmaapPublisher extends DmaapClient {
+
+ private long seconds;
+ private final Publisher publisher;
+ public DmaapPublisher() throws FileNotFoundException, IOException {
+ super("dmaap/default-consumer.properties");
+ this.publisher = new RestPublisher(properties);
+ this.seconds = 20;
+
+ }
+
+ public DmaapPublisher(long seconds) throws FileNotFoundException, IOException {
+ this();
+ this.seconds = seconds;
+ }
+
+ public void send(String json) throws IOException, InterruptedException {
+ auditLogger.info("publishing message to dmaap topic " + this.getTopic() + ": " + json);
+ publisher.send(json);
+ //publisher.close(seconds, TimeUnit.SECONDS);
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java b/common/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java
new file mode 100644
index 0000000000..ed1b3f3796
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java
@@ -0,0 +1,26 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap;
+
+public interface Publisher {
+
+ public void send(String json);
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java b/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java
new file mode 100644
index 0000000000..b1ae2b7e89
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap.exceptions;
+
+public class DMaaPConsumerFailure extends Exception {
+
+ private static final long serialVersionUID = 2499229901897110362L;
+
+ public DMaaPConsumerFailure() {
+ super();
+ }
+
+ public DMaaPConsumerFailure(String message) {
+ super(message);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java b/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java
new file mode 100644
index 0000000000..c0cda6b0ed
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap.exceptions;
+
+public class ExceededMaximumPollingTime extends RuntimeException {
+
+ private static final long serialVersionUID = 2331207691092906423L;
+
+ public ExceededMaximumPollingTime() {
+ super();
+ }
+
+ public ExceededMaximumPollingTime(String message) {
+ super(message);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
new file mode 100644
index 0000000000..ad744ad31b
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap.rest;
+
+import java.net.URL;
+import java.util.Base64;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+
+import javax.ws.rs.client.ClientResponseFilter;
+
+import org.openecomp.mso.client.ResponseExceptionMapperImpl;
+import org.openecomp.mso.client.policy.RestClient;
+
+public class DMaaPRestClient extends RestClient {
+
+ private final String username;
+ private final String password;
+ public DMaaPRestClient(URL url, String contentType, String username, String password) {
+ super(url, UUID.randomUUID(), contentType);
+ this.username = username;
+ this.password = password;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes()));
+ }
+
+ @Override
+ protected Optional<ClientResponseFilter> addResponseFilter() {
+ return Optional.of(new ResponseExceptionMapperImpl());
+ }
+
+ @Override
+ public RestClient addRequestId(UUID requestId) {
+ return this;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java b/common/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java
new file mode 100644
index 0000000000..e661dd87bd
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java
@@ -0,0 +1,131 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap.rest;
+
+import java.util.Properties;
+
+public class PropertiesBean {
+
+ private String username;
+ private String password;
+ private String environment;
+ private String partition;
+ private String contentType;
+ private String host;
+ private String topic;
+ private String timeout;
+
+
+ public PropertiesBean(Properties properties) {
+ this.withUsername(properties.getProperty("username"))
+ .withPassword(properties.getProperty("password"))
+ .withTopic(properties.getProperty("topic"))
+ .withEnvironment(properties.getProperty("environment"))
+ .withHost(properties.getProperty("host"))
+ .withTimeout(properties.getProperty("timeout", "20000"))
+ .withPartition(properties.getProperty("partition"))
+ .withContentType(properties.getProperty("contentType", "application/json"));
+ }
+ public String getUsername() {
+ return username;
+ }
+ public void setUsername(String username) {
+ this.username = username;
+ }
+ public PropertiesBean withUsername(String username) {
+ this.username = username;
+ return this;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ public PropertiesBean withPassword(String password) {
+ this.password = password;
+ return this;
+ }
+ public String getEnvironment() {
+ return environment;
+ }
+ public void setEnvironment(String environment) {
+ this.environment = environment;
+ }
+ public PropertiesBean withEnvironment(String environment) {
+ this.environment = environment;
+ return this;
+ }
+ public String getPartition() {
+ return partition;
+ }
+ public void setPartition(String partition) {
+ this.partition = partition;
+ }
+ public PropertiesBean withPartition(String partition) {
+ this.partition = partition;
+ return this;
+ }
+ public String getContentType() {
+ return contentType;
+ }
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+ public PropertiesBean withContentType(String contentType) {
+ this.contentType = contentType;
+ return this;
+ }
+ public String getHost() {
+ return host;
+ }
+ public void setHost(String host) {
+ this.host = host;
+ }
+ public PropertiesBean withHost(String host) {
+ this.host = host;
+ return this;
+ }
+ public String getTopic() {
+ return topic;
+ }
+ public void setTopic(String topic) {
+ this.topic = topic;
+ }
+ public PropertiesBean withTopic(String topic) {
+ this.topic = topic;
+ return this;
+ }
+ public String getTimeout() {
+ return timeout;
+ }
+ public void setTimeout(String timeout) {
+ this.timeout = timeout;
+ }
+ public PropertiesBean withTimeout(String timeout) {
+ this.timeout = timeout;
+ return this;
+ }
+
+
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java b/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java
new file mode 100644
index 0000000000..c2fb6f676f
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap.rest;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.UriBuilder;
+
+import org.openecomp.mso.client.dmaap.Consumer;
+import org.openecomp.mso.client.policy.RestClient;
+
+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());
+ }
+
+ private URL createURL(PropertiesBean properties) {
+ try {
+ return UriBuilder.fromUri(properties.getHost())
+ .path("events").path(properties.getTopic())
+ .path(properties.getPartition())
+ .path("consumer1")
+ .queryParam("timeout", properties.getTimeout()).build().toURL();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public Iterable<String> fetch() {
+
+ return client.get(new GenericType<List<String>>() {});
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java b/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java
new file mode 100644
index 0000000000..3dab12f559
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap.rest;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriBuilderException;
+
+import org.openecomp.mso.client.dmaap.Publisher;
+import org.openecomp.mso.client.policy.RestClient;
+
+public class RestPublisher implements Publisher {
+
+ private final RestClient client;
+
+ public RestPublisher(Properties properties) {
+ PropertiesBean bean = new PropertiesBean(properties);
+ client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getUsername(), bean.getPassword());
+ }
+
+ private URL createURL(PropertiesBean properties) {
+ try {
+ return UriBuilder.fromUri(properties.getHost())
+ .path("events").path(properties.getTopic())
+ .queryParam("timeout", properties.getTimeout()).build().toURL();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void send(String json) {
+ client.post(json);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/exceptions/SDNOException.java b/common/src/main/java/org/openecomp/mso/client/exceptions/SDNOException.java
new file mode 100644
index 0000000000..d55f962662
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/exceptions/SDNOException.java
@@ -0,0 +1,39 @@
+/*-
+ * ============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.openecomp.mso.client.exceptions;
+
+
+public class SDNOException extends Exception {
+
+ private static final long serialVersionUID = 6189163383568887383L;
+
+ public SDNOException() {
+ super();
+ }
+
+ public SDNOException(String string) {
+ super("SDN-O exception: " + string);
+ }
+
+ public SDNOException(Exception e) {
+ super(e);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMAction.java b/common/src/main/java/org/openecomp/mso/client/grm/GRMAction.java
new file mode 100644
index 0000000000..50544bab70
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/GRMAction.java
@@ -0,0 +1,37 @@
+/*-
+ * ============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.openecomp.mso.client.grm;
+
+public enum GRMAction {
+
+ FIND_RUNNING("findRunning"),
+ ADD("add");
+
+ private final String action;
+
+ GRMAction(String action) {
+ this.action = action;
+ }
+
+ public String getAction() {
+ return action;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMClient.java b/common/src/main/java/org/openecomp/mso/client/grm/GRMClient.java
new file mode 100644
index 0000000000..5b5f269731
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/GRMClient.java
@@ -0,0 +1,83 @@
+/*-
+ * ============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.openecomp.mso.client.grm;
+
+import org.openecomp.mso.client.grm.beans.ServiceEndPointList;
+import org.openecomp.mso.client.grm.beans.ServiceEndPointLookup;
+import org.openecomp.mso.client.grm.beans.ServiceEndPointLookupRequest;
+import org.openecomp.mso.client.grm.beans.ServiceEndPointRequest;
+import org.openecomp.mso.client.grm.beans.VersionLookup;
+import org.openecomp.mso.client.grm.exceptions.GRMClientCallFailed;
+
+public class GRMClient {
+
+ public String findRunningServicesAsString(String name, int majorVersion, String env) throws Exception {
+
+ ServiceEndPointLookupRequest request = buildServiceEndPointlookupRequest(name, majorVersion, env);
+ try {
+ GRMRestInvoker invoker = this.getInvoker(GRMAction.FIND_RUNNING);
+ return invoker.post(request, String.class);
+ }
+ catch(Exception e) {
+ throw new GRMClientCallFailed("Call to GRM findRunning failed: " + e.getMessage(), e);
+ }
+ }
+
+ public ServiceEndPointList findRunningServices(String name, int majorVersion, String env) throws Exception {
+
+ ServiceEndPointLookupRequest request = buildServiceEndPointlookupRequest(name, majorVersion, env);
+ try {
+ GRMRestInvoker invoker = this.getInvoker(GRMAction.FIND_RUNNING);
+ return invoker.post(request, ServiceEndPointList.class);
+ }
+ catch(Exception e) {
+ throw new GRMClientCallFailed("Call to GRM findRunning failed: " + e.getMessage(), e);
+ }
+ }
+
+ protected ServiceEndPointLookupRequest buildServiceEndPointlookupRequest(String name, int majorVersion, String env) {
+ VersionLookup version = new VersionLookup();
+ version.setMajor(majorVersion);
+
+ ServiceEndPointLookup endpoint = new ServiceEndPointLookup();
+ endpoint.setName(name);
+ endpoint.setVersion(version);
+
+ ServiceEndPointLookupRequest request = new ServiceEndPointLookupRequest();
+ request.setServiceEndPoint(endpoint);
+ request.setEnv(env);
+ return request;
+ }
+
+ public void addServiceEndPoint(ServiceEndPointRequest request) throws Exception {
+ try {
+ GRMRestInvoker invoker = this.getInvoker(GRMAction.ADD);
+ invoker.post(request);
+ }
+ catch(Exception e) {
+ throw new GRMClientCallFailed("Call to GRM addServiceEndPoint failed: " + e.getMessage(), e);
+ }
+ }
+
+ protected GRMRestInvoker getInvoker(GRMAction action) {
+ return new GRMRestInvoker(action);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMDefaultPropertiesImpl.java b/common/src/main/java/org/openecomp/mso/client/grm/GRMDefaultPropertiesImpl.java
new file mode 100644
index 0000000000..3bdc769321
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/GRMDefaultPropertiesImpl.java
@@ -0,0 +1,63 @@
+/*-
+ * ============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.openecomp.mso.client.grm;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.ws.rs.core.MediaType;
+
+public class GRMDefaultPropertiesImpl implements GRMProperties {
+
+ public GRMDefaultPropertiesImpl() {
+ }
+
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL("http://localhost:28090");
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+
+ @Override
+ public String getDefaultVersion() {
+ return "v1";
+ }
+
+ @Override
+ public String getUsername() {
+ return "gmruser";
+ }
+
+ @Override
+ public String getPassword() {
+ return "cGFzc3dvcmQ=";
+ }
+
+ @Override
+ public String getContentType() {
+ return MediaType.APPLICATION_JSON;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMProperties.java b/common/src/main/java/org/openecomp/mso/client/grm/GRMProperties.java
new file mode 100644
index 0000000000..6fbbb21a8a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/GRMProperties.java
@@ -0,0 +1,30 @@
+/*-
+ * ============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.openecomp.mso.client.grm;
+
+import org.openecomp.mso.client.RestProperties;
+
+public interface GRMProperties extends RestProperties {
+ public String getDefaultVersion();
+ public String getUsername();
+ public String getPassword();
+ public String getContentType();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMPropertiesLoader.java b/common/src/main/java/org/openecomp/mso/client/grm/GRMPropertiesLoader.java
new file mode 100644
index 0000000000..9323e22065
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/GRMPropertiesLoader.java
@@ -0,0 +1,48 @@
+/*-
+ * ============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.openecomp.mso.client.grm;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+public class GRMPropertiesLoader {
+
+ private final ServiceLoader<GRMProperties> services;
+ private GRMPropertiesLoader() {
+ services = ServiceLoader.load(GRMProperties.class);
+ }
+
+ private static class Helper {
+ private static final GRMPropertiesLoader INSTANCE = new GRMPropertiesLoader();
+ }
+
+ public static GRMPropertiesLoader getInstance() {
+ return Helper.INSTANCE;
+ }
+
+ public GRMProperties getImpl() {
+ Iterator<GRMProperties> propertyImpls = services.iterator();
+ while (propertyImpls.hasNext()) {
+ return propertyImpls.next();
+ }
+ return null;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMRestClient.java b/common/src/main/java/org/openecomp/mso/client/grm/GRMRestClient.java
new file mode 100644
index 0000000000..7a81d7e7ec
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/GRMRestClient.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.openecomp.mso.client.grm;
+
+
+import java.net.URI;
+import java.util.Base64;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+
+import javax.ws.rs.client.ClientResponseFilter;
+
+import org.openecomp.mso.client.ResponseExceptionMapperImpl;
+import org.openecomp.mso.client.RestProperties;
+import org.openecomp.mso.client.policy.RestClient;
+
+public class GRMRestClient extends RestClient {
+
+ private final String username;
+ private final String password;
+
+ public GRMRestClient(RestProperties props, URI path, String username, String password) {
+ super(props, UUID.randomUUID(), Optional.of(path));
+ this.username = username;
+ this.password = password;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(new String(username + ":" + password).getBytes()));
+ }
+
+ @Override
+ protected Optional<ClientResponseFilter> addResponseFilter() {
+ return Optional.of(new ResponseExceptionMapperImpl());
+ }
+
+ @Override
+ public RestClient addRequestId(UUID requestId) {
+ return this;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMRestInvoker.java b/common/src/main/java/org/openecomp/mso/client/grm/GRMRestInvoker.java
new file mode 100644
index 0000000000..d706be3f16
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/GRMRestInvoker.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.openecomp.mso.client.grm;
+
+import java.net.URI;
+import java.util.Base64;
+
+import javax.ws.rs.core.UriBuilder;
+import org.openecomp.mso.client.RestPropertiesLoader;
+import org.openecomp.mso.client.policy.RestClient;
+
+public class GRMRestInvoker {
+
+ private final RestClient client;
+ private final GRMProperties properties;
+
+ public GRMRestInvoker(GRMAction action) {
+ GRMProperties props = GRMPropertiesLoader.getInstance().getImpl();
+ if (props == null) {
+ props = new GRMDefaultPropertiesImpl();
+ }
+ this.properties = props;
+ this.client = new GRMRestClient(this.properties, this.createURI(action), this.properties.getUsername(), this.decode(this.properties.getPassword()));
+ }
+
+ private URI createURI(GRMAction action) {
+ return UriBuilder.fromUri("/GRMLWPService")
+ .path(this.properties.getDefaultVersion())
+ .path("serviceEndPoint")
+ .path(action.getAction())
+ .build();
+ }
+
+ private String decode(String cred) {
+ try {
+ return new String(Base64.getDecoder().decode(cred.getBytes()));
+ }
+ catch(IllegalArgumentException iae) {
+ return cred;
+ }
+ }
+
+ private RestClient getClient() {
+ return this.client;
+ }
+
+ public void post(Object obj) {
+ getClient().post(obj);
+ }
+
+ public <T> T post(Object obj, Class<T> resultClass) {
+ return getClient().post(obj, resultClass);
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/OperationalInfo.java b/common/src/main/java/org/openecomp/mso/client/grm/beans/OperationalInfo.java
new file mode 100644
index 0000000000..c5f5a7a7af
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/beans/OperationalInfo.java
@@ -0,0 +1,82 @@
+/*-
+ * ============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.openecomp.mso.client.grm.beans;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({ "createdBy", "updatedBy", "createdTimestamp", "updatedTimestamp" })
+public class OperationalInfo {
+
+ @JsonProperty("createdBy")
+ private String createdBy;
+ @JsonProperty("updatedBy")
+ private String updatedBy;
+ @JsonProperty("createdTimestamp")
+ private String createdTimestamp;
+ @JsonProperty("updatedTimestamp")
+ private String updatedTimestamp;
+
+ @JsonProperty("createdBy")
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ @JsonProperty("createdBy")
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ @JsonProperty("updatedBy")
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ @JsonProperty("updatedBy")
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+ @JsonProperty("createdTimestamp")
+ public String getCreatedTimestamp() {
+ return createdTimestamp;
+ }
+
+ @JsonProperty("createdTimestamp")
+ public void setCreatedTimestamp(String createdTimestamp) {
+ this.createdTimestamp = createdTimestamp;
+ }
+
+ @JsonProperty("updatedTimestamp")
+ public String getUpdatedTimestamp() {
+ return updatedTimestamp;
+ }
+
+ @JsonProperty("updatedTimestamp")
+ public void setUpdatedTimestamp(String updatedTimestamp) {
+ this.updatedTimestamp = updatedTimestamp;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/Property.java b/common/src/main/java/org/openecomp/mso/client/grm/beans/Property.java
new file mode 100644
index 0000000000..eff1659102
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/beans/Property.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.openecomp.mso.client.grm.beans;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({ "name", "value" })
+public class Property {
+
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("value")
+ private String value;
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("value")
+ public String getValue() {
+ return value;
+ }
+
+ @JsonProperty("value")
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPoint.java b/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPoint.java
new file mode 100644
index 0000000000..a753afbe90
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPoint.java
@@ -0,0 +1,247 @@
+/*-
+ * ============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.openecomp.mso.client.grm.beans;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "serviceEndPoint")
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({ "name", "version", "hostAddress", "listenPort", "latitude", "longitude", "registrationTime",
+ "expirationTime", "contextPath", "routeOffer", "statusInfo", "eventStatusInfo", "validatorStatusInfo",
+ "operationalInfo", "protocol", "properties", "disableType" })
+public class ServiceEndPoint implements Serializable {
+
+ private static final long serialVersionUID = -1594441352549128491L;
+
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("version")
+ private Version version;
+ @JsonProperty("hostAddress")
+ private String hostAddress;
+ @JsonProperty("listenPort")
+ private String listenPort;
+ @JsonProperty("latitude")
+ private String latitude;
+ @JsonProperty("longitude")
+ private String longitude;
+ @JsonProperty("registrationTime")
+ private String registrationTime;
+ @JsonProperty("expirationTime")
+ private String expirationTime;
+ @JsonProperty("contextPath")
+ private String contextPath;
+ @JsonProperty("routeOffer")
+ private String routeOffer;
+ @JsonProperty("statusInfo")
+ private Status statusInfo;
+ @JsonProperty("eventStatusInfo")
+ private Status eventStatusInfo;
+ @JsonProperty("validatorStatusInfo")
+ private Status validatorStatusInfo;
+ @JsonProperty("operationalInfo")
+ private OperationalInfo operationalInfo;
+ @JsonProperty("protocol")
+ private String protocol;
+ @JsonProperty("properties")
+ private List<Property> properties = null;
+ @JsonProperty("disableType")
+ private List<Object> disableType = null;
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("version")
+ public Version getVersion() {
+ return version;
+ }
+
+ @JsonProperty("version")
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ @JsonProperty("hostAddress")
+ public String getHostAddress() {
+ return hostAddress;
+ }
+
+ @JsonProperty("hostAddress")
+ public void setHostAddress(String hostAddress) {
+ this.hostAddress = hostAddress;
+ }
+
+ @JsonProperty("listenPort")
+ public String getListenPort() {
+ return listenPort;
+ }
+
+ @JsonProperty("listenPort")
+ public void setListenPort(String listenPort) {
+ this.listenPort = listenPort;
+ }
+
+ @JsonProperty("latitude")
+ public String getLatitude() {
+ return latitude;
+ }
+
+ @JsonProperty("latitude")
+ public void setLatitude(String latitude) {
+ this.latitude = latitude;
+ }
+
+ @JsonProperty("longitude")
+ public String getLongitude() {
+ return longitude;
+ }
+
+ @JsonProperty("longitude")
+ public void setLongitude(String longitude) {
+ this.longitude = longitude;
+ }
+
+ @JsonProperty("registrationTime")
+ public String getRegistrationTime() {
+ return registrationTime;
+ }
+
+ @JsonProperty("registrationTime")
+ public void setRegistrationTime(String registrationTime) {
+ this.registrationTime = registrationTime;
+ }
+
+ @JsonProperty("expirationTime")
+ public String getExpirationTime() {
+ return expirationTime;
+ }
+
+ @JsonProperty("expirationTime")
+ public void setExpirationTime(String expirationTime) {
+ this.expirationTime = expirationTime;
+ }
+
+ @JsonProperty("contextPath")
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ @JsonProperty("contextPath")
+ public void setContextPath(String contextPath) {
+ this.contextPath = contextPath;
+ }
+
+ @JsonProperty("routeOffer")
+ public String getRouteOffer() {
+ return routeOffer;
+ }
+
+ @JsonProperty("routeOffer")
+ public void setRouteOffer(String routeOffer) {
+ this.routeOffer = routeOffer;
+ }
+
+ @JsonProperty("statusInfo")
+ public Status getStatusInfo() {
+ return statusInfo;
+ }
+
+ @JsonProperty("statusInfo")
+ public void setStatusInfo(Status statusInfo) {
+ this.statusInfo = statusInfo;
+ }
+
+ @JsonProperty("eventStatusInfo")
+ public Status getEventStatusInfo() {
+ return eventStatusInfo;
+ }
+
+ @JsonProperty("eventStatusInfo")
+ public void setEventStatusInfo(Status eventStatusInfo) {
+ this.eventStatusInfo = eventStatusInfo;
+ }
+
+ @JsonProperty("validatorStatusInfo")
+ public Status getValidatorStatusInfo() {
+ return validatorStatusInfo;
+ }
+
+ @JsonProperty("validatorStatusInfo")
+ public void setValidatorStatusInfo(Status validatorStatusInfo) {
+ this.validatorStatusInfo = validatorStatusInfo;
+ }
+
+ @JsonProperty("operationalInfo")
+ public OperationalInfo getOperationalInfo() {
+ return operationalInfo;
+ }
+
+ @JsonProperty("operationalInfo")
+ public void setOperationalInfo(OperationalInfo operationalInfo) {
+ this.operationalInfo = operationalInfo;
+ }
+
+ @JsonProperty("protocol")
+ public String getProtocol() {
+ return protocol;
+ }
+
+ @JsonProperty("protocol")
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ @JsonProperty("properties")
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ @JsonProperty("properties")
+ public void setProperties(List<Property> properties) {
+ this.properties = properties;
+ }
+
+ @JsonProperty("disableType")
+ public List<Object> getDisableType() {
+ return disableType;
+ }
+
+ @JsonProperty("disableType")
+ public void setDisableType(List<Object> disableType) {
+ this.disableType = disableType;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointList.java b/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointList.java
new file mode 100644
index 0000000000..0faf1fb826
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointList.java
@@ -0,0 +1,48 @@
+/*-
+ * ============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.openecomp.mso.client.grm.beans;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({ "serviceEndPointList" })
+public class ServiceEndPointList {
+
+ @JsonProperty("serviceEndPointList")
+ private List<ServiceEndPoint> serviceEndPointList = null;
+
+ @JsonProperty("serviceEndPointList")
+ public List<ServiceEndPoint> getServiceEndPointList() {
+ return serviceEndPointList;
+ }
+
+ @JsonProperty("serviceEndPointList")
+ public void setServiceEndPointList(List<ServiceEndPoint> serviceEndPointList) {
+ this.serviceEndPointList = serviceEndPointList;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookup.java b/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookup.java
new file mode 100644
index 0000000000..37e23795e9
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookup.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.openecomp.mso.client.grm.beans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "serviceEndPoint")
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({ "name", "version"})
+public class ServiceEndPointLookup implements Serializable {
+
+ private static final long serialVersionUID = 8867758152519088615L;
+
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("version")
+ private VersionLookup version;
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("version")
+ public VersionLookup getVersion() {
+ return version;
+ }
+
+ @JsonProperty("version")
+ public void setVersion(VersionLookup version) {
+ this.version = version;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookupRequest.java b/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookupRequest.java
new file mode 100644
index 0000000000..fc1992c763
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookupRequest.java
@@ -0,0 +1,63 @@
+/*-
+ * ============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.openecomp.mso.client.grm.beans;
+
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({ "serviceEndPoint", "env" })
+public class ServiceEndPointLookupRequest {
+
+ @JsonProperty("serviceEndPoint")
+ private ServiceEndPointLookup serviceEndPoint;
+ @JsonProperty("env")
+ private String env;
+
+ @JsonProperty("serviceEndPoint")
+ public ServiceEndPointLookup getServiceEndPoint() {
+ return serviceEndPoint;
+ }
+
+ @JsonProperty("serviceEndPoint")
+ public void setServiceEndPoint(ServiceEndPointLookup serviceEndPoint) {
+ this.serviceEndPoint = serviceEndPoint;
+ }
+
+ @JsonProperty("env")
+ public String getEnv() {
+ return env;
+ }
+
+ @JsonProperty("env")
+ public void setEnv(String env) {
+ this.env = env;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointRequest.java b/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointRequest.java
new file mode 100644
index 0000000000..324fe9f32a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointRequest.java
@@ -0,0 +1,63 @@
+/*-
+ * ============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.openecomp.mso.client.grm.beans;
+
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({ "serviceEndPoint", "env" })
+public class ServiceEndPointRequest {
+
+ @JsonProperty("serviceEndPoint")
+ private ServiceEndPoint serviceEndPoint;
+ @JsonProperty("env")
+ private String env;
+
+ @JsonProperty("serviceEndPoint")
+ public ServiceEndPoint getServiceEndPoint() {
+ return serviceEndPoint;
+ }
+
+ @JsonProperty("serviceEndPoint")
+ public void setServiceEndPoint(ServiceEndPoint serviceEndPoint) {
+ this.serviceEndPoint = serviceEndPoint;
+ }
+
+ @JsonProperty("env")
+ public String getEnv() {
+ return env;
+ }
+
+ @JsonProperty("env")
+ public void setEnv(String env) {
+ this.env = env;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/Status.java b/common/src/main/java/org/openecomp/mso/client/grm/beans/Status.java
new file mode 100644
index 0000000000..3c66c50a5c
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/beans/Status.java
@@ -0,0 +1,82 @@
+/*-
+ * ============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.openecomp.mso.client.grm.beans;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({ "status", "statusReasonCode", "statusReasonDescription", "statusCheckTime" })
+public class Status {
+
+ @JsonProperty("status")
+ private String status;
+ @JsonProperty("statusReasonCode")
+ private String statusReasonCode;
+ @JsonProperty("statusReasonDescription")
+ private String statusReasonDescription;
+ @JsonProperty("statusCheckTime")
+ private String statusCheckTime;
+
+ @JsonProperty("status")
+ public String getStatus() {
+ return status;
+ }
+
+ @JsonProperty("status")
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ @JsonProperty("statusReasonCode")
+ public String getStatusReasonCode() {
+ return statusReasonCode;
+ }
+
+ @JsonProperty("statusReasonCode")
+ public void setStatusReasonCode(String statusReasonCode) {
+ this.statusReasonCode = statusReasonCode;
+ }
+
+ @JsonProperty("statusReasonDescription")
+ public String getStatusReasonDescription() {
+ return statusReasonDescription;
+ }
+
+ @JsonProperty("statusReasonDescription")
+ public void setStatusReasonDescription(String statusReasonDescription) {
+ this.statusReasonDescription = statusReasonDescription;
+ }
+
+ @JsonProperty("statusCheckTime")
+ public String getStatusCheckTime() {
+ return statusCheckTime;
+ }
+
+ @JsonProperty("statusCheckTime")
+ public void setStatusCheckTime(String statusCheckTime) {
+ this.statusCheckTime = statusCheckTime;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/Version.java b/common/src/main/java/org/openecomp/mso/client/grm/beans/Version.java
new file mode 100644
index 0000000000..1d4d959f02
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/beans/Version.java
@@ -0,0 +1,69 @@
+/*-
+ * ============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.openecomp.mso.client.grm.beans;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({ "major", "minor", "patch" })
+public class Version {
+
+ @JsonProperty("major")
+ private Integer major;
+ @JsonProperty("minor")
+ private Integer minor;
+ @JsonProperty("patch")
+ private String patch;
+
+ @JsonProperty("major")
+ public Integer getMajor() {
+ return major;
+ }
+
+ @JsonProperty("major")
+ public void setMajor(Integer major) {
+ this.major = major;
+ }
+
+ @JsonProperty("minor")
+ public Integer getMinor() {
+ return minor;
+ }
+
+ @JsonProperty("minor")
+ public void setMinor(Integer minor) {
+ this.minor = minor;
+ }
+
+ @JsonProperty("patch")
+ public String getPatch() {
+ return patch;
+ }
+
+ @JsonProperty("patch")
+ public void setPatch(String patch) {
+ this.patch = patch;
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/VersionLookup.java b/common/src/main/java/org/openecomp/mso/client/grm/beans/VersionLookup.java
new file mode 100644
index 0000000000..b9d5a63450
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/beans/VersionLookup.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.openecomp.mso.client.grm.beans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({ "major" })
+public class VersionLookup implements Serializable {
+
+ private static final long serialVersionUID = 3802602253627725770L;
+
+ @JsonProperty("major")
+ private Integer major;
+
+ @JsonProperty("major")
+ public Integer getMajor() {
+ return major;
+ }
+
+ @JsonProperty("major")
+ public void setMajor(Integer major) {
+ this.major = major;
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/exceptions/GRMClientCallFailed.java b/common/src/main/java/org/openecomp/mso/client/grm/exceptions/GRMClientCallFailed.java
new file mode 100644
index 0000000000..60de57286d
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/grm/exceptions/GRMClientCallFailed.java
@@ -0,0 +1,32 @@
+/*-
+ * ============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.openecomp.mso.client.grm.exceptions;
+
+public class GRMClientCallFailed extends Exception {
+
+ private static final long serialVersionUID = -8714110346844078779L;
+
+ public GRMClientCallFailed(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java b/common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java
new file mode 100644
index 0000000000..4f41b6441e
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+import javax.ws.rs.ext.ContextResolver;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+public class CommonObjectMapperProvider implements ContextResolver<ObjectMapper> {
+
+ final ObjectMapper mapper;
+
+ public CommonObjectMapperProvider() {
+
+ mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ 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);
+ }
+
+ @Override
+ public ObjectMapper getContext(Class<?> type) {
+ return mapper;
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java b/common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java
new file mode 100644
index 0000000000..7b765ebb5f
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java
@@ -0,0 +1,93 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({ "ServiceType", "VNFType", "BB_ID", "WorkStep", "ErrorCode" })
+public class DecisionAttributes {
+
+ @JsonProperty("ServiceType")
+ private String serviceType;
+ @JsonProperty("VNFType")
+ private String vNFType;
+ @JsonProperty("BB_ID")
+ private String bbID;
+ @JsonProperty("WorkStep")
+ private String workStep;
+ @JsonProperty("ErrorCode")
+ private String errorCode;
+
+ @JsonProperty("ServiceType")
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ @JsonProperty("ServiceType")
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @JsonProperty("VNFType")
+ public String getVNFType() {
+ return vNFType;
+ }
+
+ @JsonProperty("VNFType")
+ public void setVNFType(String vNFType) {
+ this.vNFType = vNFType;
+ }
+
+ @JsonProperty("BB_ID")
+ public String getBBID() {
+ return bbID;
+ }
+
+ @JsonProperty("BB_ID")
+ public void setBBID(String bBID) {
+ this.bbID = bBID;
+ }
+
+ @JsonProperty("WorkStep")
+ public String getWorkStep() {
+ return workStep;
+ }
+
+ @JsonProperty("WorkStep")
+ public void setWorkStep(String workStep) {
+ this.workStep = workStep;
+ }
+
+ @JsonProperty("ErrorCode")
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ @JsonProperty("ErrorCode")
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java b/common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java
new file mode 100644
index 0000000000..19579e810b
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+import javax.ws.rs.ext.ContextResolver;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+public class JettisonStyleMapperProvider implements ContextResolver<ObjectMapper> {
+
+ final ObjectMapper mapper;
+
+ public JettisonStyleMapperProvider() {
+
+ mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ mapper.enable(MapperFeature.USE_ANNOTATIONS);
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ }
+
+ @Override
+ public ObjectMapper getContext(Class<?> type) {
+ return mapper;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java b/common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java
new file mode 100644
index 0000000000..b04069697e
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java
@@ -0,0 +1,157 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+
+import javax.annotation.Priority;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.WriterInterceptor;
+import javax.ws.rs.ext.WriterInterceptorContext;
+
+import org.openecomp.mso.logger.MsoLogger;
+
+
+@Provider
+@Priority(0)
+public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {
+
+ private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";
+ private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
+ private final int maxEntitySize;
+
+ public LoggingFilter() {
+ maxEntitySize = 1024 * 1024;
+ }
+
+ public LoggingFilter(int maxPayloadSize) {
+ this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024);
+ }
+
+ private void log(StringBuilder sb) {
+ logger.debug(sb.toString());
+ }
+
+ protected InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)
+ throws IOException {
+ if (!stream.markSupported()) {
+ stream = new BufferedInputStream(stream);
+ }
+ stream.mark(maxEntitySize + 1);
+ final byte[] entity = new byte[maxEntitySize + 1];
+ final int entitySize = stream.read(entity);
+ if (entitySize != -1) {
+ b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
+ }
+ if (entitySize > maxEntitySize) {
+ b.append("...more...");
+ }
+ b.append('\n');
+ stream.reset();
+ return stream;
+ }
+
+ @Override
+ public void filter(ClientRequestContext requestContext) throws IOException {
+ if (requestContext.hasEntity()) {
+ final OutputStream stream = new LoggingStream(requestContext.getEntityStream());
+ requestContext.setEntityStream(stream);
+ requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream);
+ }
+ String method = formatMethod(requestContext);
+ log(new StringBuilder("Making " + method + " request to: " + requestContext.getUri() + "\nRequest Headers: " + requestContext.getHeaders().toString()));
+
+ }
+
+ @Override
+ public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
+ final StringBuilder sb = new StringBuilder();
+ if (responseContext.hasEntity()) {
+ responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET));
+ String method = formatMethod(requestContext);
+ log(sb.insert(0, "Response from " + method + ": " + requestContext.getUri() + "\nResponse Headers: " + responseContext.getHeaders().toString()));
+ }
+ }
+
+ @Override
+ public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
+ final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY);
+ context.proceed();
+ if (stream != null) {
+ log(stream.getStringBuilder(DEFAULT_CHARSET));
+ }
+ }
+
+ private class LoggingStream extends FilterOutputStream {
+
+ private final StringBuilder sb = new StringBuilder();
+ private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ LoggingStream(OutputStream out) {
+ super(out);
+ }
+
+ StringBuilder getStringBuilder(Charset charset) {
+ // write entity to the builder
+ final byte[] entity = baos.toByteArray();
+
+ sb.append(new String(entity, 0, entity.length, charset));
+ if (entity.length > maxEntitySize) {
+ sb.append("...more...");
+ }
+ sb.append('\n');
+
+ return sb;
+ }
+
+ @Override
+ public void write(final int i) throws IOException {
+ if (baos.size() <= maxEntitySize) {
+ baos.write(i);
+ }
+ out.write(i);
+ }
+ }
+
+ private String formatMethod(ClientRequestContext requestContext) {
+ String method = requestContext.getHeaderString("X-HTTP-Method-Override");
+ if (method == null) {
+ method = requestContext.getMethod();
+ } else {
+ method = requestContext.getMethod() + " (overridden to " + method + ")";
+ }
+
+ return method;
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java
new file mode 100644
index 0000000000..defd11bc99
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java
@@ -0,0 +1,33 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+import org.openecomp.mso.client.policy.entities.AllowedTreatments;
+import org.openecomp.mso.client.policy.entities.DictionaryData;
+import org.openecomp.mso.client.policy.entities.PolicyDecision;
+
+public interface PolicyClient {
+
+ public PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep,
+ String errorCode);
+
+ public DictionaryData getAllowedTreatments(String bbID, String workStep);
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java
new file mode 100644
index 0000000000..dc24b7ce16
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+import org.openecomp.mso.client.RestPropertiesLoader;
+import org.openecomp.mso.client.defaultproperties.PolicyRestPropertiesImpl;
+import org.openecomp.mso.client.policy.entities.AllowedTreatments;
+import org.openecomp.mso.client.policy.entities.Bbid;
+import org.openecomp.mso.client.policy.entities.DecisionAttributes;
+import org.openecomp.mso.client.policy.entities.DictionaryData;
+import org.openecomp.mso.client.policy.entities.DictionaryItemsRequest;
+import org.openecomp.mso.client.policy.entities.DictionaryJson;
+import org.openecomp.mso.client.policy.entities.PolicyDecision;
+import org.openecomp.mso.client.policy.entities.PolicyDecisionRequest;
+import org.openecomp.mso.client.policy.entities.PolicyServiceType;
+import org.openecomp.mso.client.policy.entities.Workstep;
+
+import java.util.List;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class PolicyClientImpl implements PolicyClient {
+
+ protected final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+ private PolicyRestProperties props;
+ public PolicyClientImpl() {
+ props = RestPropertiesLoader.getInstance().getNewImpl(PolicyRestProperties.class);
+ if (props == null) {
+ metricsLogger.error("No RestProperty.PolicyRestProperties implementation found on classpath");
+ props = new PolicyRestPropertiesImpl();
+ }
+ }
+ public PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep,
+ String errorCode) {
+ DecisionAttributes decisionAttributes = new DecisionAttributes();
+ decisionAttributes.setServiceType(serviceType);
+ decisionAttributes.setVNFType(vnfType);
+ decisionAttributes.setBBID(bbID);
+ decisionAttributes.setWorkStep(workStep);
+ decisionAttributes.setErrorCode(errorCode);
+
+ return this.getDecision(decisionAttributes);
+ }
+
+ private PolicyDecision getDecision(DecisionAttributes decisionAttributes) {
+ PolicyRestClient client = new PolicyRestClient(this.props, PolicyServiceType.GET_DECISION);
+ PolicyDecisionRequest decisionRequest = new PolicyDecisionRequest();
+ decisionRequest.setDecisionAttributes(decisionAttributes);
+ decisionRequest.setEcompcomponentName(RestClient.ECOMP_COMPONENT_NAME);
+
+ return client.post(decisionRequest, PolicyDecision.class);
+ }
+
+ public DictionaryData getAllowedTreatments(String bbID, String workStep)
+ {
+ PolicyRestClient client = new PolicyRestClient(this.props, PolicyServiceType.GET_DICTIONARY_ITEMS);
+ DictionaryItemsRequest dictionaryItemsRequest = new DictionaryItemsRequest();
+ dictionaryItemsRequest.setDictionaryType("Decision");
+ dictionaryItemsRequest.setDictionary("RainyDayTreatments");
+ final AllowedTreatments response = client.post(dictionaryItemsRequest, AllowedTreatments.class);
+ final DictionaryJson dictionaryJson = response.getDictionaryJson();
+ final List<DictionaryData> dictionaryDataList = dictionaryJson.getDictionaryDatas();
+ for(DictionaryData dictData : dictionaryDataList){
+ Bbid bBid = dictData.getBbid();
+ Workstep workstep = dictData.getWorkstep();
+ String bBidString = bBid.getString();
+ String workstepString = workstep.getString();
+ if(bbID.equals(bBidString) && workStep.equals(workstepString)){
+ return dictData;
+ }
+ }
+ metricsLogger.error("There is no AllowedTreatments with that specified parameter set");
+ return null;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java
new file mode 100644
index 0000000000..98c7e1558d
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({ "decision", "details" })
+public class PolicyDecision {
+
+ @JsonProperty("decision")
+ private String decision;
+ @JsonProperty("details")
+ private String details;
+
+ @JsonProperty("decision")
+ public String getDecision() {
+ return decision;
+ }
+
+ @JsonProperty("decision")
+ public void setDecision(String decision) {
+ this.decision = decision;
+ }
+
+ @JsonProperty("details")
+ public String getDetails() {
+ return details;
+ }
+
+ @JsonProperty("details")
+ public void setDetails(String details) {
+ this.details = details;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java
new file mode 100644
index 0000000000..c83fb19e34
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({ "decisionAttributes", "ecompcomponentName" })
+public class PolicyDecisionRequest {
+
+ @JsonProperty("decisionAttributes")
+ private DecisionAttributes decisionAttributes;
+ @JsonProperty("ecompcomponentName")
+ private String ecompcomponentName;
+
+ @JsonProperty("decisionAttributes")
+ public DecisionAttributes getDecisionAttributes() {
+ return decisionAttributes;
+ }
+
+ @JsonProperty("decisionAttributes")
+ public void setDecisionAttributes(DecisionAttributes decisionAttributes) {
+ this.decisionAttributes = decisionAttributes;
+ }
+
+ @JsonProperty("ecompcomponentName")
+ public String getEcompcomponentName() {
+ return ecompcomponentName;
+ }
+
+ @JsonProperty("ecompcomponentName")
+ public void setEcompcomponentName(String ecompcomponentName) {
+ this.ecompcomponentName = ecompcomponentName;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java
new file mode 100644
index 0000000000..77fec34de6
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java
@@ -0,0 +1,66 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+import java.net.MalformedURLException;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriBuilderException;
+
+import org.openecomp.mso.client.ResponseExceptionMapperImpl;
+import org.openecomp.mso.client.RestProperties;
+import org.openecomp.mso.client.policy.entities.PolicyServiceType;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PolicyRestClient extends RestClient {
+
+ private static final UUID X_ECOMP_REQUESTID = UUID.randomUUID();
+ private final PolicyRestProperties properties;
+ public PolicyRestClient(PolicyRestProperties props, PolicyServiceType serviceType) {
+ super(props, UUID.randomUUID(), Optional.of(UriBuilder.fromPath(serviceType.toString()).build()));
+ this.properties = props;
+ this.getClient();
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("ClientAuth", properties.getClientAuth());
+ headerMap.put("Authorization", properties.getAuth());
+ headerMap.put("Environment", properties.getEnvironment());
+ this.addRequestId(X_ECOMP_REQUESTID);
+ }
+
+ @Override
+ protected Optional<ClientResponseFilter> addResponseFilter() {
+ return Optional.of(new ResponseExceptionMapperImpl());
+ }
+
+ @Override
+ public RestClient addRequestId(UUID requestId) {
+ this.headerMap.put("X-ECOMP-RequestID", requestId.toString());
+ return this;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java
new file mode 100644
index 0000000000..d89bd54f66
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java
@@ -0,0 +1,35 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+
+import org.openecomp.mso.client.RestProperties;
+
+public interface PolicyRestProperties extends RestProperties {
+
+ public String getClientAuth();
+ public String getAuth();
+ public String getEnvironment();
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java b/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java
new file mode 100644
index 0000000000..4e6ffd1c6a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java
@@ -0,0 +1,227 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.UUID;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation.Builder;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.ext.ContextResolver;
+
+import org.apache.log4j.Logger;
+import org.openecomp.mso.client.RestProperties;
+import org.openecomp.mso.logger.MsoLogger;
+import org.springframework.stereotype.Service;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Service
+public abstract class RestClient {
+ protected static final String ECOMP_COMPONENT_NAME = "MSO";
+
+ private static final int MAX_PAYLOAD_SIZE = 1024 * 1024;
+ private WebTarget webTarget;
+
+ protected final Map<String, String> headerMap;
+ protected final MsoLogger msoLogger;
+ protected URL host;
+ protected Optional<URI> path;
+ protected Logger logger;
+ protected String accept;
+ protected String contentType;
+ protected UUID requestId;
+
+ protected RestClient(RestProperties props, UUID requestId, Optional<URI> path) {
+ logger = Logger.getLogger(getClass().getName());
+ msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
+ this.requestId = requestId;
+ headerMap = new HashMap<>();
+ try {
+ host = props.getEndpoint();
+ } catch (MalformedURLException e) {
+ logger.error("url not valid", e);
+ throw new RuntimeException(e);
+ }
+
+ this.path = path;
+ initializeClient(getClient());
+ }
+
+ protected RestClient(RestProperties props, UUID requestId, Optional<URI> path, String accept, String contentType) {
+ this(props, requestId, path);
+ this.accept = accept;
+ this.contentType = contentType;
+ this.requestId = requestId;
+
+ }
+
+ protected RestClient(URL host, UUID requestId, String contentType) {
+ headerMap = new HashMap<>();
+ logger = Logger.getLogger(getClass().getName());
+ msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
+ this.path = Optional.empty();
+ this.host = host;
+ this.contentType = contentType;
+ this.requestId = requestId;
+ initializeClient(getClient());
+ }
+
+ /**
+ * Override method to return false to disable logging.
+ *
+ * @return true - to enable logging, false otherwise
+ */
+ protected boolean enableLogging() {
+ return true;
+ }
+
+ /**
+ * Override method to return custom value for max payload size.
+ *
+ * @return Default value for MAX_PAYLOAD_SIZE = 1024 * 1024
+ */
+ protected int getMaxPayloadSize()
+ {
+ return MAX_PAYLOAD_SIZE;
+ }
+
+ protected Builder getBuilder() {
+
+ Builder builder = webTarget.request();
+ initializeHeaderMap(headerMap);
+
+ for (Entry<String, String> entry : headerMap.entrySet()) {
+ builder.header(entry.getKey(), entry.getValue());
+ }
+ return builder;
+ }
+
+ protected abstract void initializeHeaderMap(Map<String, String> headerMap);
+
+ protected abstract Optional<ClientResponseFilter> addResponseFilter();
+
+ public abstract RestClient addRequestId(UUID requestId);
+
+ protected ContextResolver<ObjectMapper> getMapper() {
+ return new CommonObjectMapperProvider();
+ }
+
+ protected String getAccept() {
+ return accept;
+ }
+
+ protected String getContentType() {
+ return contentType;
+ }
+
+ protected String getMergeContentType() {
+ return "application/merge-patch+json";
+ }
+
+ protected Client getClient() {
+ return ClientBuilder.newBuilder().build();
+ }
+
+ protected UUID getRequestId() {
+ return this.requestId;
+ }
+ protected void initializeClient(Client client) {
+ if (this.enableLogging()) {
+ client.register(logger).register(new LoggingFilter(this.getMaxPayloadSize()));
+ }
+ client.register(this.getMapper());
+ Optional<ClientResponseFilter> responseFilter = this.addResponseFilter();
+ responseFilter.ifPresent(clientResponseFilter -> client.register(clientResponseFilter));
+ webTarget = path.<WebTarget>map(uri -> client.target(UriBuilder.fromUri(host + uri.toString())))
+ .orElseGet(() -> client.target(host.toString()));
+ this.accept = MediaType.APPLICATION_JSON;
+ this.contentType = MediaType.APPLICATION_JSON;
+ }
+
+ public Response get() {
+ return this.getBuilder().accept(this.getAccept()).get();
+ }
+
+ public Response post(Object obj) {
+ return this.getBuilder().accept(this.getAccept()).post(Entity.entity(obj, this.getContentType()));
+ }
+
+ public Response patch(Object obj) {
+ return this.getBuilder().header("X-HTTP-Method-Override", "PATCH").accept(this.getAccept())
+ .post(Entity.entity(obj, this.getMergeContentType()));
+ }
+
+ public Response put(Object obj) {
+ return this.getBuilder().accept(this.getAccept()).put(Entity.entity(obj, this.getContentType()));
+ }
+
+ public Response delete() {
+ return this.getBuilder().accept(this.getAccept()).delete();
+ }
+
+ public Response delete(Object obj) {
+ return this.getBuilder().header("X-HTTP-Method-Override", "DELETE").accept(this.getAccept())
+ .put(Entity.entity(obj, this.getContentType()));
+ }
+
+ public <T> T get(Class<T> resultClass) {
+ return this.get().readEntity(resultClass);
+ }
+
+ public <T> T get(GenericType<T> resultClass) {
+ return this.get().readEntity(resultClass);
+ }
+
+ public <T> T post(Object obj, Class<T> resultClass) {
+ return this.post(obj).readEntity(resultClass);
+ }
+
+ public <T> T patch(Object obj, Class<T> resultClass) {
+ return this.patch(obj).readEntity(resultClass);
+ }
+
+ public <T> T put(Object obj, Class<T> resultClass) {
+ return this.put(obj).readEntity(resultClass);
+ }
+
+ public <T> T delete(Class<T> resultClass) {
+ return this.delete().readEntity(resultClass);
+ }
+
+ public <T> T delete(Object obj, Class<T> resultClass) {
+ return this.delete(obj).readEntity(resultClass);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java b/common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java
new file mode 100644
index 0000000000..921664588a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java
@@ -0,0 +1,99 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+import java.io.FileInputStream;
+import java.net.URI;
+import java.security.NoSuchAlgorithmException;
+import java.security.KeyStore;
+import java.util.Optional;
+import java.util.UUID;
+
+import javax.net.ssl.SSLContext;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+
+import org.openecomp.mso.client.RestProperties;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+
+public abstract class RestClientSSL extends RestClient {
+
+ public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore";
+ public static final String SSL_KEY_STORE_PASSWORD_KEY = "javax.net.ssl.keyStorePassword";
+ public static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore";
+
+
+ protected RestClientSSL(RestProperties props, UUID requestId, Optional<URI> path) {
+ super(props, requestId, path);
+ }
+
+ protected RestClientSSL(RestProperties props, UUID requestId, Optional<URI> path, String accept, String contentType) {
+ super(props, requestId, path, accept, contentType);
+ }
+
+ @Override
+ protected Client getClient() {
+
+ Client client = null;
+ try {
+ String loadSSLKeyStore = System.getProperty(RestClientSSL.MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY);
+ if(loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase("true")) {
+ KeyStore ks = getKeyStore();
+ if(ks != null) {
+ client = ClientBuilder.newBuilder().keyStore(ks, System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY)).build();
+ this.msoLogger.debug("RestClientSSL not using default SSL context - setting keystore here.");
+ return client;
+ }
+ }
+ //Use default SSL context
+ client = ClientBuilder.newBuilder().sslContext(SSLContext.getDefault()).build();
+ this.msoLogger.debug("RestClientSSL using default SSL context!");
+ } catch (NoSuchAlgorithmException e) {
+ this.msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "AAI", "Client init", MsoLogger.ErrorCode.UnknownError, "could not create SSL client", e);
+ throw new RuntimeException(e);
+ }
+ return client;
+ }
+
+ private KeyStore getKeyStore() {
+ KeyStore ks = null;
+ char[] password = System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY).toCharArray();
+ FileInputStream fis = null;
+ try {
+ ks = KeyStore.getInstance(KeyStore.getDefaultType());
+ fis = new FileInputStream(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY));
+ ks.load(fis, password);
+ }
+ catch(Exception e) {
+ return null;
+ }
+ finally {
+ if (fis != null) {
+ try {
+ fis.close();
+ }
+ catch(Exception e) {}
+ }
+ }
+ return ks;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java
new file mode 100644
index 0000000000..50db843416
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java
@@ -0,0 +1,105 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"dictionaryJson",
+"dictionaryData",
+"responseCode",
+"responseMessage"
+})
+public class AllowedTreatments{
+
+@JsonProperty("dictionaryJson")
+private DictionaryJson dictionaryJson;
+@JsonProperty("dictionaryData")
+private Object dictionaryData;
+@JsonProperty("responseCode")
+private Integer responseCode;
+@JsonProperty("responseMessage")
+private String responseMessage;
+
+@JsonProperty("dictionaryJson")
+public DictionaryJson getDictionaryJson() {
+return dictionaryJson;
+ }
+
+@JsonProperty("dictionaryJson")
+public void setDictionaryJson(DictionaryJson dictionaryJson) {
+this.dictionaryJson = dictionaryJson;
+ }
+
+public AllowedTreatments withDictionaryJson(DictionaryJson dictionaryJson) {
+this.dictionaryJson = dictionaryJson;
+return this;
+ }
+
+@JsonProperty("dictionaryData")
+public Object getDictionaryData() {
+return dictionaryData;
+ }
+
+@JsonProperty("dictionaryData")
+public void setDictionaryData(Object dictionaryData) {
+this.dictionaryData = dictionaryData;
+ }
+
+public AllowedTreatments withDictionaryData(Object dictionaryData) {
+this.dictionaryData = dictionaryData;
+return this;
+ }
+
+@JsonProperty("responseCode")
+public Integer getResponseCode() {
+return responseCode;
+ }
+
+@JsonProperty("responseCode")
+public void setResponseCode(Integer responseCode) {
+this.responseCode = responseCode;
+ }
+
+public AllowedTreatments withResponseCode(Integer responseCode) {
+this.responseCode = responseCode;
+return this;
+ }
+
+@JsonProperty("responseMessage")
+public String getResponseMessage() {
+return responseMessage;
+ }
+
+@JsonProperty("responseMessage")
+public void setResponseMessage(String responseMessage) {
+this.responseMessage = responseMessage;
+ }
+
+public AllowedTreatments withResponseMessage(String responseMessage) {
+this.responseMessage = responseMessage;
+return this;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java
new file mode 100644
index 0000000000..382b27a04b
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java
@@ -0,0 +1,87 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"valueType",
+"string",
+"chars"
+})
+public class Bbid {
+
+@JsonProperty("valueType")
+private String valueType;
+@JsonProperty("string")
+private String string;
+@JsonProperty("chars")
+private String chars;
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Bbid withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+@JsonProperty("string")
+public String getString() {
+return string;
+ }
+
+@JsonProperty("string")
+public void setString(String string) {
+this.string = string;
+ }
+
+public Bbid withString(String string) {
+this.string = string;
+return this;
+ }
+
+@JsonProperty("chars")
+public String getChars() {
+return chars;
+ }
+
+@JsonProperty("chars")
+public void setChars(String chars) {
+this.chars = chars;
+ }
+
+public Bbid withChars(String chars) {
+this.chars = chars;
+return this;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java
new file mode 100644
index 0000000000..9f40639e68
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({ "ServiceType", "VNFType", "BB_ID", "WorkStep", "ErrorCode" })
+public class DecisionAttributes {
+
+ @JsonProperty("ServiceType")
+ private String serviceType;
+ @JsonProperty("VNFType")
+ private String vNFType;
+ @JsonProperty("BB_ID")
+ private String bbID;
+ @JsonProperty("WorkStep")
+ private String workStep;
+ @JsonProperty("ErrorCode")
+ private String errorCode;
+
+ @JsonProperty("ServiceType")
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ @JsonProperty("ServiceType")
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @JsonProperty("VNFType")
+ public String getVNFType() {
+ return vNFType;
+ }
+
+ @JsonProperty("VNFType")
+ public void setVNFType(String vNFType) {
+ this.vNFType = vNFType;
+ }
+
+ @JsonProperty("BB_ID")
+ public String getBBID() {
+ return bbID;
+ }
+
+ @JsonProperty("BB_ID")
+ public void setBBID(String bBID) {
+ this.bbID = bBID;
+ }
+
+ @JsonProperty("WorkStep")
+ public String getWorkStep() {
+ return workStep;
+ }
+
+ @JsonProperty("WorkStep")
+ public void setWorkStep(String workStep) {
+ this.workStep = workStep;
+ }
+
+ @JsonProperty("ErrorCode")
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ @JsonProperty("ErrorCode")
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java
new file mode 100644
index 0000000000..1ecf3366c7
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java
@@ -0,0 +1,105 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"id",
+"bbid",
+"workstep",
+"treatments"
+})
+public class DictionaryData {
+
+@JsonProperty("id")
+private Id id;
+@JsonProperty("bbid")
+private Bbid bbid;
+@JsonProperty("workstep")
+private Workstep workstep;
+@JsonProperty("treatments")
+private Treatments treatments;
+
+@JsonProperty("id")
+public Id getId() {
+return id;
+ }
+
+@JsonProperty("id")
+public void setId(Id id) {
+this.id = id;
+ }
+
+public DictionaryData withId(Id id) {
+this.id = id;
+return this;
+ }
+
+@JsonProperty("bbid")
+public Bbid getBbid() {
+return bbid;
+ }
+
+@JsonProperty("bbid")
+public void setBbid(Bbid bbid) {
+this.bbid = bbid;
+ }
+
+public DictionaryData withBbid(Bbid bbid) {
+this.bbid = bbid;
+return this;
+ }
+
+@JsonProperty("workstep")
+public Workstep getWorkstep() {
+return workstep;
+ }
+
+@JsonProperty("workstep")
+public void setWorkstep(Workstep workstep) {
+this.workstep = workstep;
+ }
+
+public DictionaryData withWorkstep(Workstep workstep) {
+this.workstep = workstep;
+return this;
+ }
+
+@JsonProperty("treatments")
+public Treatments getTreatments() {
+return treatments;
+ }
+
+@JsonProperty("treatments")
+public void setTreatments(Treatments treatments) {
+this.treatments = treatments;
+ }
+
+public DictionaryData withTreatments(Treatments treatments) {
+this.treatments = treatments;
+return this;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java
new file mode 100644
index 0000000000..d37d0c6f13
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({ "dictionaryType", "dictionary" })
+public class DictionaryItemsRequest {
+
+ @JsonProperty("dictionary")
+ private String dictionary;
+ @JsonProperty("dictionaryType")
+ private String dictionaryType;
+
+ @JsonProperty("dictionary")
+ public String getDictionary() {
+ return dictionary;
+ }
+
+ @JsonProperty("dictionary")
+ public void setDictionary(String dictionary) {
+ this.dictionary = dictionary;
+ }
+
+ @JsonProperty("dictionaryType")
+ public String getDictionaryType() {
+ return dictionaryType;
+ }
+
+ @JsonProperty("dictionaryType")
+ public void setDictionaryType(String dictionaryType) {
+ this.dictionaryType = dictionaryType;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java
new file mode 100644
index 0000000000..b6a95ae12a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java
@@ -0,0 +1,53 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"DictionaryDatas"
+})
+public class DictionaryJson {
+
+@JsonProperty("DictionaryDatas")
+private List<DictionaryData> dictionaryDatas = new ArrayList<DictionaryData>();
+
+@JsonProperty("DictionaryDatas")
+public List<DictionaryData> getDictionaryDatas() {
+return dictionaryDatas;
+ }
+
+@JsonProperty("DictionaryDatas")
+public void setDictionaryDatas(List<DictionaryData> dictionaryDatas) {
+this.dictionaryDatas = dictionaryDatas;
+ }
+
+public DictionaryJson withDictionaryDatas(List<DictionaryData> dictionaryDatas) {
+this.dictionaryDatas = dictionaryDatas;
+return this;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java
new file mode 100644
index 0000000000..728381a60b
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java
@@ -0,0 +1,69 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"integral",
+"valueType"
+})
+public class Id {
+
+@JsonProperty("integral")
+private Boolean integral;
+@JsonProperty("valueType")
+private String valueType;
+
+@JsonProperty("integral")
+public Boolean getIntegral() {
+return integral;
+ }
+
+@JsonProperty("integral")
+public void setIntegral(Boolean integral) {
+this.integral = integral;
+ }
+
+public Id withIntegral(Boolean integral) {
+this.integral = integral;
+return this;
+ }
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Id withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java
new file mode 100644
index 0000000000..fbc8e23151
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({ "decision", "details" })
+public class PolicyDecision {
+
+ @JsonProperty("decision")
+ private String decision;
+ @JsonProperty("details")
+ private String details;
+
+ @JsonProperty("decision")
+ public String getDecision() {
+ return decision;
+ }
+
+ @JsonProperty("decision")
+ public void setDecision(String decision) {
+ this.decision = decision;
+ }
+
+ @JsonProperty("details")
+ public String getDetails() {
+ return details;
+ }
+
+ @JsonProperty("details")
+ public void setDetails(String details) {
+ this.details = details;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java
new file mode 100644
index 0000000000..bc20b9c143
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({ "decisionAttributes", "ecompcomponentName" })
+public class PolicyDecisionRequest {
+
+ @JsonProperty("decisionAttributes")
+ private DecisionAttributes decisionAttributes;
+ @JsonProperty("ecompcomponentName")
+ private String ecompcomponentName;
+
+ @JsonProperty("decisionAttributes")
+ public DecisionAttributes getDecisionAttributes() {
+ return decisionAttributes;
+ }
+
+ @JsonProperty("decisionAttributes")
+ public void setDecisionAttributes(DecisionAttributes decisionAttributes) {
+ this.decisionAttributes = decisionAttributes;
+ }
+
+ @JsonProperty("ecompcomponentName")
+ public String getEcompcomponentName() {
+ return ecompcomponentName;
+ }
+
+ @JsonProperty("ecompcomponentName")
+ public void setEcompcomponentName(String ecompcomponentName) {
+ this.ecompcomponentName = ecompcomponentName;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java
new file mode 100644
index 0000000000..01f6738947
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java
@@ -0,0 +1,48 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+public enum PolicyServiceType {
+ GET_CONFIG("getConfig"),
+ SEND_EVENT("sendEvent"),
+ PUSH_POLICY("pushPolicy"),
+ CREATE_POLICY("createPolicy"),
+ UPDATE_POLICY("updatePolicy"),
+ GET_DECISION("getDecision"),
+ GET_METRICS("getMetrics"),
+ DELETE_POLICY("deletePolicy"),
+ LIST_CONFIG("listConfig"),
+ CREATE_DICTIONARY_ITEM("createDictionaryItem"),
+ UPDATE_DICTIONARY_ITEM("updateDictionaryItem"),
+ GET_DICTIONARY_ITEMS("getDictionaryItems");
+
+ private final String name;
+
+ PolicyServiceType(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java
new file mode 100644
index 0000000000..13af8932aa
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java
@@ -0,0 +1,87 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"valueType",
+"string",
+"chars"
+})
+public class Treatments {
+
+@JsonProperty("valueType")
+private String valueType;
+@JsonProperty("string")
+private String string;
+@JsonProperty("chars")
+private String chars;
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Treatments withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+@JsonProperty("string")
+public String getString() {
+return string;
+ }
+
+@JsonProperty("string")
+public void setString(String string) {
+this.string = string;
+ }
+
+public Treatments withString(String string) {
+this.string = string;
+return this;
+ }
+
+@JsonProperty("chars")
+public String getChars() {
+return chars;
+ }
+
+@JsonProperty("chars")
+public void setChars(String chars) {
+this.chars = chars;
+ }
+
+public Treatments withChars(String chars) {
+this.chars = chars;
+return this;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java
new file mode 100644
index 0000000000..9d2adfe2c0
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java
@@ -0,0 +1,88 @@
+/*-
+ * ============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.openecomp.mso.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"valueType",
+"string",
+"chars"
+})
+public class Workstep {
+
+@JsonProperty("valueType")
+private String valueType;
+@JsonProperty("string")
+private String string;
+@JsonProperty("chars")
+private String chars;
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Workstep withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+@JsonProperty("string")
+public String getString() {
+return string;
+ }
+
+@JsonProperty("string")
+public void setString(String string) {
+this.string = string;
+ }
+
+public Workstep withString(String string) {
+this.string = string;
+return this;
+ }
+
+@JsonProperty("chars")
+public String getChars() {
+return chars;
+ }
+
+@JsonProperty("chars")
+public void setChars(String chars) {
+this.chars = chars;
+ }
+
+public Workstep withChars(String chars) {
+this.chars = chars;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/RubyClient.java b/common/src/main/java/org/openecomp/mso/client/ruby/RubyClient.java
new file mode 100644
index 0000000000..a4adcb23f7
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/ruby/RubyClient.java
@@ -0,0 +1,90 @@
+/*-
+ * ============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.openecomp.mso.client.ruby;
+
+import java.io.IOException;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+
+import org.openecomp.mso.client.dmaap.DmaapPublisher;
+import org.openecomp.mso.client.ruby.beans.Event;
+import org.openecomp.mso.client.ruby.beans.MsoRequest;
+import org.openecomp.mso.client.ruby.beans.Ruby;
+import org.openecomp.mso.client.ruby.dmaap.RubyCreateTicketRequestPublisher;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+public class RubyClient {
+
+ private static final String REQUEST_CLIENT_NAME = "MSO";
+ private static final String ACTION = "Create Ticket";
+
+ protected String buildRequest(String requestId, String sourceName, String reason, String workflowId, String notification) throws JsonProcessingException {
+ final MsoRequest request = new MsoRequest();
+ request.withRequestClientName(REQUEST_CLIENT_NAME)
+ .withRequestId(requestId)
+ .withSourceName(sourceName)
+ .withWorkflowId(workflowId)
+ .withAction(ACTION);
+
+ request.withRequestTime(this.getTime());
+
+ if(reason.length() <= 255){
+ request.withReason(reason);
+ } else {
+ throw new IllegalArgumentException("reason exceeds 255 characters");
+ }
+ if(notification.length() <= 1024){
+ request.withNotification(notification);
+ } else {
+ throw new IllegalArgumentException("notification exceeds 1024 characters");
+ }
+ final Event event = new Event();
+ event.setMsoRequest(request);
+ final Ruby ruby = new Ruby();
+ ruby.setEvent(event);
+ return this.getJson(ruby);
+ }
+
+ protected String getJson(Ruby obj) throws JsonProcessingException {
+ final ObjectMapper mapper = new ObjectMapper();
+ return mapper.writeValueAsString(obj);
+ }
+
+ protected DmaapPublisher getPublisher() throws IOException {
+ return new RubyCreateTicketRequestPublisher();
+ }
+
+ protected String getTime() {
+ final ZonedDateTime currentDateTime = ZonedDateTime.now(ZoneOffset.UTC);
+ final DateTimeFormatter format = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss Z");
+ return currentDateTime.format(format);
+ }
+
+ public void rubyCreateTicketCheckRequest(String requestId, String sourceName, String reason, String workflowId, String notification) throws Exception {
+ String request = this.buildRequest(requestId, sourceName, reason, workflowId, notification);
+ final DmaapPublisher publisher = this.getPublisher();
+ publisher.send(request);
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/beans/Event.java b/common/src/main/java/org/openecomp/mso/client/ruby/beans/Event.java
new file mode 100644
index 0000000000..b9263596be
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/ruby/beans/Event.java
@@ -0,0 +1,67 @@
+/*-
+ * ============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.openecomp.mso.client.ruby.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"msoRequest"
+})
+public class Event {
+
+@JsonProperty("msoRequest")
+private MsoRequest msoRequest;
+
+/**
+* No args constructor for use in serialization
+*
+*/
+public Event() {
+ }
+
+/**
+*
+* @param msoRequest
+*/
+public Event(MsoRequest msoRequest) {
+super();
+this.msoRequest = msoRequest;
+ }
+
+@JsonProperty("msoRequest")
+public MsoRequest getMsoRequest() {
+return msoRequest;
+ }
+
+@JsonProperty("msoRequest")
+public void setMsoRequest(MsoRequest msoRequest) {
+this.msoRequest = msoRequest;
+ }
+
+public Event withMsoRequest(MsoRequest msoRequest) {
+this.msoRequest = msoRequest;
+return this;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/beans/MsoRequest.java b/common/src/main/java/org/openecomp/mso/client/ruby/beans/MsoRequest.java
new file mode 100644
index 0000000000..d00adae88a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/ruby/beans/MsoRequest.java
@@ -0,0 +1,207 @@
+/*-
+ * ============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.openecomp.mso.client.ruby.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"requestClientName",
+"requestId",
+"requestTime",
+"sourceName",
+"reason",
+"action",
+"workflowId",
+"notification"
+})
+public class MsoRequest {
+
+@JsonProperty("requestClientName")
+private String requestClientName;
+@JsonProperty("requestId")
+private String requestId;
+@JsonProperty("requestTime")
+private String requestTime;
+@JsonProperty("sourceName")
+private String sourceName;
+@JsonProperty("reason")
+private String reason;
+@JsonProperty("action")
+private String action;
+@JsonProperty("workflowId")
+private String workflowId;
+@JsonProperty("notification")
+private String notification;
+
+/**
+* No args constructor for use in serialization
+*
+*/
+public MsoRequest() {
+ }
+
+/**
+*
+* @param requestClientName
+* @param requestTime
+* @param reason
+* @param requestId
+* @param workflowId
+* @param sourceName
+* @param action
+* @param notification
+*/
+public MsoRequest(String requestClientName, String requestId, String requestTime, String sourceName, String reason, String action, String workflowId, String notification) {
+super();
+this.requestClientName = requestClientName;
+this.requestId = requestId;
+this.requestTime = requestTime;
+this.sourceName = sourceName;
+this.reason = reason;
+this.action = action;
+this.workflowId = workflowId;
+this.notification = notification;
+ }
+
+@JsonProperty("requestClientName")
+public String getRequestClientName() {
+return requestClientName;
+ }
+
+@JsonProperty("requestClientName")
+public void setRequestClientName(String requestClientName) {
+this.requestClientName = requestClientName;
+ }
+
+public MsoRequest withRequestClientName(String requestClientName) {
+this.requestClientName = requestClientName;
+return this;
+ }
+
+@JsonProperty("requestId")
+public String getRequestId() {
+return requestId;
+ }
+
+@JsonProperty("requestId")
+public void setRequestId(String requestId) {
+this.requestId = requestId;
+ }
+
+public MsoRequest withRequestId(String requestId) {
+this.requestId = requestId;
+return this;
+ }
+
+@JsonProperty("requestTime")
+public String getRequestTime() {
+return requestTime;
+ }
+
+@JsonProperty("requestTime")
+public void setRequestTime(String requestTime) {
+this.requestTime = requestTime;
+ }
+
+public MsoRequest withRequestTime(String requestTime) {
+this.requestTime = requestTime;
+return this;
+ }
+
+@JsonProperty("sourceName")
+public String getSourceName() {
+return sourceName;
+ }
+
+@JsonProperty("sourceName")
+public void setSourceName(String sourceName) {
+this.sourceName = sourceName;
+ }
+
+public MsoRequest withSourceName(String sourceName) {
+this.sourceName = sourceName;
+return this;
+ }
+
+@JsonProperty("reason")
+public String getReason() {
+return reason;
+ }
+
+@JsonProperty("reason")
+public void setReason(String reason) {
+this.reason = reason;
+ }
+
+public MsoRequest withReason(String reason) {
+this.reason = reason;
+return this;
+ }
+
+@JsonProperty("action")
+public String getAction() {
+return action;
+ }
+
+@JsonProperty("action")
+public void setAction(String action) {
+this.action = action;
+ }
+
+public MsoRequest withAction(String action) {
+this.action = action;
+return this;
+ }
+
+@JsonProperty("workflowId")
+public String getWorkflowId() {
+return workflowId;
+ }
+
+@JsonProperty("workflowId")
+public void setWorkflowId(String workflowId) {
+this.workflowId = workflowId;
+ }
+
+public MsoRequest withWorkflowId(String workflowId) {
+this.workflowId = workflowId;
+return this;
+ }
+
+@JsonProperty("notification")
+public String getNotification() {
+return notification;
+ }
+
+@JsonProperty("notification")
+public void setNotification(String notification) {
+this.notification = notification;
+ }
+
+public MsoRequest withNotification(String notification) {
+this.notification = notification;
+return this;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/beans/Ruby.java b/common/src/main/java/org/openecomp/mso/client/ruby/beans/Ruby.java
new file mode 100644
index 0000000000..1b81043faf
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/ruby/beans/Ruby.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.openecomp.mso.client.ruby.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"event"
+})
+public class Ruby {
+
+@JsonProperty("event")
+private Event event;
+
+/**
+* No args constructor for use in serialization
+*
+*/
+public Ruby() {
+ }
+
+/**
+*
+* @param event
+*/
+public Ruby(Event event) {
+super();
+this.event = event;
+ }
+
+@JsonProperty("event")
+public Event getEvent() {
+return event;
+ }
+
+@JsonProperty("event")
+public void setEvent(Event event) {
+this.event = event;
+ }
+
+public Ruby withEvent(Event event) {
+this.event = event;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java b/common/src/main/java/org/openecomp/mso/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
new file mode 100644
index 0000000000..521318f822
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.openecomp.mso.client.ruby.dmaap;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Optional;
+
+import org.openecomp.mso.client.dmaap.DmaapPublisher;
+
+public class RubyCreateTicketRequestPublisher extends DmaapPublisher{
+ public RubyCreateTicketRequestPublisher() throws FileNotFoundException, IOException {
+ super();
+ }
+
+ @Override
+ public String getUserName() {
+ return msoProperties.get("ruby.create-ticket-request.dmaap.username");
+ }
+
+ @Override
+ public String getPassword() {
+ return msoProperties.get("ruby.create-ticket-request.dmaap.password");
+ }
+
+ @Override
+ public String getTopic() {
+ return msoProperties.get("ruby.create-ticket-request.publisher.topic");
+ }
+
+ @Override
+ public Optional<String> getHost() {
+ return Optional.ofNullable(msoProperties.get("ruby.create-ticket-request.publisher.host"));
+ }
+
+}
+
+
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClient.java b/common/src/main/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClient.java
new file mode 100644
index 0000000000..3ba75bb2b4
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClient.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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.openecomp.mso.client.sdno;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+
+import org.openecomp.mso.client.dmaap.DmaapConsumer;
+import org.openecomp.mso.client.dmaap.DmaapPublisher;
+import org.openecomp.mso.client.sdno.beans.AAIParamList;
+import org.openecomp.mso.client.sdno.beans.Body;
+import org.openecomp.mso.client.sdno.beans.Input;
+import org.openecomp.mso.client.sdno.beans.RequestHdCustom;
+import org.openecomp.mso.client.sdno.beans.SDNO;
+import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class SDNOHealthCheckClient {
+
+ private static final String NODE_TYPE = "VROUTER";
+ private static final String API_OPERATION_TYPE = "health-diagnostic-custom";
+ private static final String MIRRORING_CHECK = "mirroring_check";
+ private static final String CLIENT_NAME = "MSO";
+ private static final String PRE_CHECK_CODE = "VROUTER000003";
+ private static final String POST_CHECK_CODE = "VROUTER000004";
+ private static final String LPORT_MIRRORING_CHECK = "lport_mirroring_check";
+ private static final String CONFIGURATION_ID = "configuration-id";
+
+
+ public boolean lPortMirrorHealthPreCheck(String userId, String requestId, Optional<String>clliCode, String configurationId, String interfaceId) throws Exception{
+ String request = buildLPortMirrorCheckPreRequest(userId, requestId, clliCode, configurationId, interfaceId);
+ return this.execute(requestId, request);
+ }
+
+ public boolean lPortMirrorHealthPostCheck(String userId, String requestId, Optional<String>clliCode, String configurationId, String interfaceId) throws Exception{
+ String request = buildLPortMirrorCheckPostRequest(userId, requestId, clliCode, configurationId, interfaceId);
+ return this.execute(requestId, request);
+ }
+
+ public boolean portMirrorHealthPreCheck(String userId, String requestId, Optional<String> clliCode, String configurationId) throws Exception {
+ final String request = this.buildPortMirrorPreCheckRequest(userId, requestId, clliCode, configurationId);
+ return this.execute(requestId, request);
+ }
+
+ public boolean portMirrorHealthPostCheck(String userId, String requestId, Optional<String> clliCode, String configurationId) throws Exception {
+ final String request = this.buildPortMirrorPostCheckRequest(userId, requestId, clliCode, configurationId);
+ return this.execute(requestId, request);
+ }
+
+ protected String buildLPortMirrorCheckPreRequest(String userId, String requestId, Optional<String> clliCode, String configurationId, String interfaceId) throws JsonProcessingException{
+ return this.buildLPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, interfaceId, PRE_CHECK_CODE);
+ }
+
+ protected String buildLPortMirrorCheckPostRequest(String userId, String requestId, Optional<String> clliCode, String configurationId, String interfaceId) throws JsonProcessingException{
+ return this.buildLPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, interfaceId, POST_CHECK_CODE);
+ }
+
+ protected String buildPortMirrorPreCheckRequest(String userId, String requestId, Optional<String> clliCode, String configurationId) throws JsonProcessingException {
+ return this.buildPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, PRE_CHECK_CODE);
+ }
+
+ protected String buildPortMirrorPostCheckRequest(String userId, String requestId, Optional<String> clliCode, String configurationId) throws JsonProcessingException {
+ return this.buildPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, POST_CHECK_CODE);
+ }
+
+ protected String buildPortMirrorCheckRequest(String userId, String requestId, Optional<String> clliCode, String configurationId, String diagnosticCode) throws JsonProcessingException {
+ final AAIParamList list = new AAIParamList();
+ list.setKey(CONFIGURATION_ID);
+ list.setValue(configurationId);
+
+ return this.buildRequest(userId, requestId, clliCode, diagnosticCode, MIRRORING_CHECK, Collections.singletonList(list));
+ }
+
+ protected String buildLPortMirrorCheckRequest(String userId, String requestId, Optional<String> clliCode, String configurationId, String interfaceId, String diagnosticCode) throws JsonProcessingException {
+
+ final AAIParamList configurationIdParam = new AAIParamList();
+ configurationIdParam.setKey(CONFIGURATION_ID);
+ configurationIdParam.setValue(configurationId);
+ final AAIParamList interfaceIdParam = new AAIParamList();
+ interfaceIdParam.setKey("interface-id");
+ interfaceIdParam.setValue(interfaceId);
+ final List<AAIParamList> list = new ArrayList<>();
+ list.add(configurationIdParam);
+ list.add(interfaceIdParam);
+ return this.buildRequest(userId, requestId, clliCode, diagnosticCode, LPORT_MIRRORING_CHECK, list);
+ }
+
+
+ protected String buildRequest(String userId, String requestId, Optional<String> clliCode, String diagnosticCode, String operationType, List<AAIParamList> paramList) throws JsonProcessingException {
+
+ final RequestHdCustom hdCustom = new RequestHdCustom();
+ hdCustom.withRequestUserId(userId)
+ .withRequestId(requestId)
+ .withRequestClientName(CLIENT_NAME)
+ .withHealthDiagnosticCode(diagnosticCode)
+ .withOperationType(operationType)
+ .withAaiParamList(paramList);
+
+ final Input input = new Input();
+ input.setRequestHdCustom(hdCustom);
+ final Body body = new Body();
+ body.setInput(input);
+ final SDNO request = new SDNO();
+ request.withBody(body).withOperation(API_OPERATION_TYPE).withNodeType(NODE_TYPE);
+ if (clliCode.isPresent()) {
+ request.setNodeLoc(clliCode.get());
+ }
+ return this.getJson(request);
+
+ }
+ protected String getJson(SDNO obj) throws JsonProcessingException {
+ final ObjectMapper mapper = new ObjectMapper();
+ return mapper.writeValueAsString(obj);
+ }
+
+ protected DmaapPublisher getPublisher() throws FileNotFoundException, IOException {
+ return new SDNOHealthCheckDmaapPublisher();
+ }
+
+ protected DmaapConsumer getConsumer(String requestId) throws FileNotFoundException, IOException {
+ return new SDNOHealthCheckDmaapConsumer(requestId);
+ }
+
+ protected boolean execute(String requestId, String request) throws Exception {
+ final DmaapPublisher publisher = this.getPublisher();
+ publisher.send(request);
+
+ final DmaapConsumer consumer = this.getConsumer(requestId);
+
+ return consumer.consume();
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java b/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
new file mode 100644
index 0000000000..534186b7ef
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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.openecomp.mso.client.sdno;
+
+import java.io.IOException;
+import java.util.UUID;
+
+public interface SDNOValidator {
+
+ /**
+ * Issues a health diagnostic request for a given vnf to SDN-O
+ *
+ * @param vnfId
+ * @param requestingUserId
+ * @throws IOException
+ * @throws Exception
+ */
+ public void healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception;
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java b/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java
new file mode 100644
index 0000000000..e6955f57fc
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java
@@ -0,0 +1,111 @@
+/*-
+ * ============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.openecomp.mso.client.sdno;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Optional;
+import java.util.UUID;
+
+import org.onap.aai.domain.yang.GenericVnf;
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.AAIResourcesClient;
+import org.openecomp.mso.client.aai.AAIVersion;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.openecomp.mso.client.dmaap.DmaapConsumer;
+import org.openecomp.mso.client.dmaap.DmaapPublisher;
+import org.openecomp.mso.client.sdno.beans.Body;
+import org.openecomp.mso.client.sdno.beans.Input;
+import org.openecomp.mso.client.sdno.beans.RequestHealthDiagnostic;
+import org.openecomp.mso.client.sdno.beans.SDNO;
+import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+public class SDNOValidatorImpl implements SDNOValidator {
+
+ private final static String clientName = "MSO";
+
+ @Override
+ public void healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception {
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+ AAIResourcesClient client = new AAIResourcesClient(AAIVersion.V10, uuid);
+ GenericVnf vnf = client.get(GenericVnf.class, uri);
+
+ SDNO requestDiagnostic = buildRequestDiagnostic(vnf, uuid, requestingUserId);
+ ObjectMapper mapper = new ObjectMapper();
+ String json = mapper.writeValueAsString(requestDiagnostic);
+ this.submitRequest(json);
+ this.pollForResponse(uuid.toString());
+
+ }
+
+ protected SDNO buildRequestDiagnostic(GenericVnf vnf, UUID uuid, String requestingUserId) {
+
+ Optional<String> vnfType;
+ if (vnf.getVnfType() == null) {
+ vnfType = Optional.empty();
+ } else {
+ vnfType = Optional.of(vnf.getVnfType());
+ }
+ Input input = new Input();
+ SDNO parentRequest = new SDNO();
+ Body body = new Body();
+ parentRequest.setBody(body);
+ parentRequest.setNodeType(vnfType.orElse("NONE").toUpperCase());
+ parentRequest.setOperation("health-diagnostic");
+
+ body.setInput(input);
+
+ RequestHealthDiagnostic request = new RequestHealthDiagnostic();
+ request.setRequestClientName(clientName);
+ request.setRequestNodeName(vnf.getVnfName());
+ request.setRequestNodeIp(vnf.getIpv4OamAddress()); //generic-vnf oam ip
+ request.setRequestUserId(requestingUserId); //mech id?
+ request.setRequestId(uuid.toString()); //something to identify this request by for polling
+
+ input.setRequestHealthDiagnostic(request);
+
+ return parentRequest;
+ }
+ protected void submitRequest(String json) throws FileNotFoundException, IOException, InterruptedException {
+
+ DmaapPublisher publisher = new SDNOHealthCheckDmaapPublisher();
+ publisher.send(json);
+ }
+ protected boolean pollForResponse(String uuid) throws Exception {
+ DmaapConsumer consumer = this.getConsumer(uuid);
+ return consumer.consume();
+ }
+
+
+
+ protected DmaapConsumer getConsumer(String uuid) throws FileNotFoundException, IOException {
+ return new SDNOHealthCheckDmaapConsumer(uuid);
+ }
+
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/AAIParamList.java b/common/src/main/java/org/openecomp/mso/client/sdno/beans/AAIParamList.java
new file mode 100644
index 0000000000..bab37c0685
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/beans/AAIParamList.java
@@ -0,0 +1,87 @@
+/*-
+ * ============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.openecomp.mso.client.sdno.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"key",
+"value"
+})
+public class AAIParamList {
+
+@JsonProperty("key")
+private String key;
+@JsonProperty("value")
+private String value;
+
+/**
+* No args constructor for use in serialization
+*
+*/
+public AAIParamList() {
+ }
+
+/**
+*
+* @param value
+* @param key
+*/
+public AAIParamList(String key, String value) {
+super();
+this.key = key;
+this.value = value;
+ }
+
+@JsonProperty("key")
+public String getKey() {
+return key;
+ }
+
+@JsonProperty("key")
+public void setKey(String key) {
+this.key = key;
+ }
+
+public AAIParamList withKey(String key) {
+this.key = key;
+return this;
+ }
+
+@JsonProperty("value")
+public String getValue() {
+return value;
+ }
+
+@JsonProperty("value")
+public void setValue(String value) {
+this.value = value;
+ }
+
+public AAIParamList withValue(String value) {
+this.value = value;
+return this;
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java b/common/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java
new file mode 100644
index 0000000000..26c74b0615
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java
@@ -0,0 +1,77 @@
+/*-
+ * ============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.openecomp.mso.client.sdno.beans;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "input"
+})
+public class Body implements Serializable
+{
+
+ @JsonProperty("input")
+ private Input input;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+ private final static long serialVersionUID = 9101706044452851559L;
+
+ @JsonProperty("input")
+ public Input getInput() {
+ return input;
+ }
+
+ @JsonProperty("input")
+ public void setInput(Input input) {
+ this.input = input;
+ }
+
+ public Body withInput(Input input) {
+ this.input = input;
+ return this;
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ public Body withAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java b/common/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java
new file mode 100644
index 0000000000..157330a280
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java
@@ -0,0 +1,91 @@
+/*-
+ * ============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.openecomp.mso.client.sdno.beans;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "request-healthdiagnostic",
+ "request-hd-custom"
+})
+public class Input implements Serializable
+{
+
+ @JsonProperty("request-healthdiagnostic")
+ private RequestHealthDiagnostic RequestHealthDiagnostic;
+ @JsonProperty("request-hd-custom")
+ private RequestHdCustom requestHdCustom;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+ private final static long serialVersionUID = 7155546785389227528L;
+
+ @JsonProperty("request-healthdiagnostic")
+ public RequestHealthDiagnostic getRequestHealthDiagnostic() {
+ return RequestHealthDiagnostic;
+ }
+
+ @JsonProperty("request-healthdiagnostic")
+ public void setRequestHealthDiagnostic(RequestHealthDiagnostic RequestHealthDiagnostic) {
+ this.RequestHealthDiagnostic = RequestHealthDiagnostic;
+ }
+
+ @JsonProperty("request-hd-custom")
+ public RequestHdCustom getRequestHdCustom() {
+ return requestHdCustom;
+ }
+
+ @JsonProperty("request-hd-custom")
+ public void setRequestHdCustom(RequestHdCustom requestHdCustom) {
+ this.requestHdCustom = requestHdCustom;
+ }
+
+ public Input withRequestHealthDiagnostic(RequestHealthDiagnostic RequestHealthDiagnostic) {
+ this.RequestHealthDiagnostic = RequestHealthDiagnostic;
+ return this;
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ public Input withAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHdCustom.java b/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHdCustom.java
new file mode 100644
index 0000000000..a0d00a7e6e
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHdCustom.java
@@ -0,0 +1,170 @@
+/*-
+ * ============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.openecomp.mso.client.sdno.beans;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"request-client-name",
+"request-user-id",
+"request-id",
+"health-diagnostic-code",
+"operation-type",
+"aai-param-list"
+})
+public class RequestHdCustom {
+
+@JsonProperty("request-client-name")
+private String requestClientName;
+@JsonProperty("request-user-id")
+private String requestUserId;
+@JsonProperty("request-id")
+private String requestId;
+@JsonProperty("health-diagnostic-code")
+private String healthDiagnosticCode;
+@JsonProperty("operation-type")
+private String operationType;
+@JsonProperty("aai-param-list")
+private List<AAIParamList> aaiParamList = new ArrayList<AAIParamList>();
+
+/**
+* No args constructor for use in serialization
+*
+*/
+public RequestHdCustom() {
+ }
+
+/**
+*
+* @param requestClientName
+* @param operationType
+* @param requestId
+* @param healthDiagnosticCode
+* @param aaiParamList
+* @param requestUserId
+*/
+public RequestHdCustom(String requestClientName, String requestUserId, String requestId, String healthDiagnosticCode, String operationType, List<AAIParamList> aaiParamList) {
+super();
+this.requestClientName = requestClientName;
+this.requestUserId = requestUserId;
+this.requestId = requestId;
+this.healthDiagnosticCode = healthDiagnosticCode;
+this.operationType = operationType;
+this.aaiParamList = aaiParamList;
+ }
+
+@JsonProperty("request-client-name")
+public String getRequestClientName() {
+return requestClientName;
+ }
+
+@JsonProperty("request-client-name")
+public void setRequestClientName(String requestClientName) {
+this.requestClientName = requestClientName;
+ }
+
+public RequestHdCustom withRequestClientName(String requestClientName) {
+this.requestClientName = requestClientName;
+return this;
+ }
+
+@JsonProperty("request-user-id")
+public String getRequestUserId() {
+return requestUserId;
+ }
+
+@JsonProperty("request-user-id")
+public void setRequestUserId(String requestUserId) {
+this.requestUserId = requestUserId;
+ }
+
+public RequestHdCustom withRequestUserId(String requestUserId) {
+this.requestUserId = requestUserId;
+return this;
+ }
+
+@JsonProperty("request-id")
+public String getRequestId() {
+return requestId;
+ }
+
+@JsonProperty("request-id")
+public void setRequestId(String requestId) {
+this.requestId = requestId;
+ }
+
+public RequestHdCustom withRequestId(String requestId) {
+this.requestId = requestId;
+return this;
+ }
+
+@JsonProperty("health-diagnostic-code")
+public String getHealthDiagnosticCode() {
+return healthDiagnosticCode;
+ }
+
+@JsonProperty("health-diagnostic-code")
+public void setHealthDiagnosticCode(String healthDiagnosticCode) {
+this.healthDiagnosticCode = healthDiagnosticCode;
+ }
+
+public RequestHdCustom withHealthDiagnosticCode(String healthDiagnosticCode) {
+this.healthDiagnosticCode = healthDiagnosticCode;
+return this;
+ }
+
+@JsonProperty("operation-type")
+public String getOperationType() {
+return operationType;
+ }
+
+@JsonProperty("operation-type")
+public void setOperationType(String operationType) {
+this.operationType = operationType;
+ }
+
+public RequestHdCustom withOperationType(String operationType) {
+this.operationType = operationType;
+return this;
+ }
+
+@JsonProperty("aai-param-list")
+public List<AAIParamList> getAaiParamList() {
+return aaiParamList;
+ }
+
+@JsonProperty("aai-param-list")
+public void setAaiParamList(List<AAIParamList> aaiParamList) {
+this.aaiParamList = aaiParamList;
+ }
+
+public RequestHdCustom withAaiParamList(List<AAIParamList> aaiParamList) {
+this.aaiParamList = aaiParamList;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java b/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java
new file mode 100644
index 0000000000..2cddd0331e
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java
@@ -0,0 +1,185 @@
+/*-
+ * ============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.openecomp.mso.client.sdno.beans;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "request-client-name",
+ "request-node-name",
+ "request-node-ip",
+ "request-id",
+ "request-user-id",
+ "request-node-type",
+ "health-diagnostic-code"
+})
+public class RequestHealthDiagnostic implements Serializable
+{
+
+ @JsonProperty("request-client-name")
+ private String requestClientName;
+ @JsonProperty("request-node-name")
+ private String requestNodeName;
+ @JsonProperty("request-node-ip")
+ private String requestNodeIp;
+ @JsonProperty("request-id")
+ private String requestId;
+ @JsonProperty("request-user-id")
+ private String requestUserId;
+ @JsonProperty("request-node-type")
+ private String requestNodeType;
+ @JsonProperty("health-diagnostic-code")
+ private String healthDiagnosticCode;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+ private final static long serialVersionUID = 1166788526178388021L;
+
+ @JsonProperty("request-client-name")
+ public String getRequestClientName() {
+ return requestClientName;
+ }
+
+ @JsonProperty("request-client-name")
+ public void setRequestClientName(String requestClientName) {
+ this.requestClientName = requestClientName;
+ }
+
+ public RequestHealthDiagnostic withRequestClientName(String requestClientName) {
+ this.requestClientName = requestClientName;
+ return this;
+ }
+
+ @JsonProperty("request-node-name")
+ public String getRequestNodeName() {
+ return requestNodeName;
+ }
+
+ @JsonProperty("request-node-name")
+ public void setRequestNodeName(String requestNodeName) {
+ this.requestNodeName = requestNodeName;
+ }
+
+ public RequestHealthDiagnostic withRequestNodeName(String requestNodeName) {
+ this.requestNodeName = requestNodeName;
+ return this;
+ }
+
+ @JsonProperty("request-node-ip")
+ public String getRequestNodeIp() {
+ return requestNodeIp;
+ }
+
+ @JsonProperty("request-node-ip")
+ public void setRequestNodeIp(String requestNodeIp) {
+ this.requestNodeIp = requestNodeIp;
+ }
+
+ public RequestHealthDiagnostic withRequestNodeIp(String requestNodeIp) {
+ this.requestNodeIp = requestNodeIp;
+ return this;
+ }
+
+ @JsonProperty("request-id")
+ public String getRequestId() {
+ return requestId;
+ }
+
+ @JsonProperty("request-id")
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public RequestHealthDiagnostic withRequestId(String requestId) {
+ this.requestId = requestId;
+ return this;
+ }
+
+ @JsonProperty("request-user-id")
+ public String getRequestUserId() {
+ return requestUserId;
+ }
+
+ @JsonProperty("request-user-id")
+ public void setRequestUserId(String requestUserId) {
+ this.requestUserId = requestUserId;
+ }
+
+ public RequestHealthDiagnostic withRequestUserId(String requestUserId) {
+ this.requestUserId = requestUserId;
+ return this;
+ }
+
+ @JsonProperty("request-node-type")
+ public String getRequestNodeType() {
+ return requestNodeType;
+ }
+
+ @JsonProperty("request-node-type")
+ public void setRequestNodeType(String requestNodeType) {
+ this.requestNodeType = requestNodeType;
+ }
+
+ public RequestHealthDiagnostic withRequestNodeType(String requestNodeType) {
+ this.requestNodeType = requestNodeType;
+ return this;
+ }
+
+ @JsonProperty("health-diagnostic-code")
+ public String getHealthDiagnosticCode() {
+ return healthDiagnosticCode;
+ }
+
+ @JsonProperty("health-diagnostic-code")
+ public void setHealthDiagnosticCode(String healthDiagnosticCode) {
+ this.healthDiagnosticCode = healthDiagnosticCode;
+ }
+
+ public RequestHealthDiagnostic withHealthDiagnosticCode(String healthDiagnosticCode) {
+ this.healthDiagnosticCode = healthDiagnosticCode;
+ return this;
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ public RequestHealthDiagnostic withAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java b/common/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java
new file mode 100644
index 0000000000..976f5b9a33
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java
@@ -0,0 +1,116 @@
+/*-
+ * ============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.openecomp.mso.client.sdno.beans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"client-name",
+"code",
+"processing-host",
+"request-id",
+"status"
+})
+public class ResultInfo {
+
+@JsonProperty("client-name")
+private String clientName;
+@JsonProperty("code")
+private String code;
+@JsonProperty("processing-host")
+private String processingHost;
+@JsonProperty("request-id")
+private String requestId;
+@JsonProperty("status")
+private String status;
+@JsonIgnore
+private Map<String, Object> additionalProperties = new HashMap<>();
+
+@JsonProperty("client-name")
+public String getClientName() {
+return clientName;
+}
+
+@JsonProperty("client-name")
+public void setClientName(String clientName) {
+this.clientName = clientName;
+}
+
+@JsonProperty("code")
+public String getCode() {
+return code;
+}
+
+@JsonProperty("code")
+public void setCode(String code) {
+this.code = code;
+}
+
+@JsonProperty("processing-host")
+public String getProcessingHost() {
+return processingHost;
+}
+
+@JsonProperty("processing-host")
+public void setProcessingHost(String processingHost) {
+this.processingHost = processingHost;
+}
+
+@JsonProperty("request-id")
+public String getRequestId() {
+return requestId;
+}
+
+@JsonProperty("request-id")
+public void setRequestId(String requestId) {
+this.requestId = requestId;
+}
+
+@JsonProperty("status")
+public String getStatus() {
+return status;
+}
+
+@JsonProperty("status")
+public void setStatus(String status) {
+this.status = status;
+}
+
+@JsonAnyGetter
+public Map<String, Object> getAdditionalProperties() {
+return this.additionalProperties;
+}
+
+@JsonAnySetter
+public void setAdditionalProperty(String name, Object value) {
+this.additionalProperties.put(name, value);
+}
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java b/common/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java
new file mode 100644
index 0000000000..8505ec9a74
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java
@@ -0,0 +1,131 @@
+/*-
+ * ============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.openecomp.mso.client.sdno.beans;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "operation",
+ "nodeLoc",
+ "nodeType",
+ "body"
+})
+public class SDNO implements Serializable
+{
+
+ @JsonProperty("operation")
+ private String operation;
+ @JsonProperty("nodeLoc")
+ private String nodeLoc;
+ @JsonProperty("nodeType")
+ private String nodeType;
+ @JsonProperty("body")
+ private Body body;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<>();
+ private final static long serialVersionUID = -5303297382564282650L;
+
+ @JsonProperty("operation")
+ public String getOperation() {
+ return operation;
+ }
+
+ @JsonProperty("operation")
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ @JsonProperty("nodeLoc")
+ public String getNodeLoc() {
+ return nodeLoc;
+ }
+
+ @JsonProperty("nodeLoc")
+ public void setNodeLoc(String nodeLoc) {
+ this.nodeLoc = nodeLoc;
+ }
+
+ public SDNO withNodeLoc(String nodeLoc) {
+ this.nodeLoc = nodeLoc;
+ return this;
+ }
+
+ public SDNO withOperation(String operation) {
+ this.operation = operation;
+ return this;
+ }
+
+ @JsonProperty("nodeType")
+ public String getNodeType() {
+ return nodeType;
+ }
+
+ @JsonProperty("nodeType")
+ public void setNodeType(String nodeType) {
+ this.nodeType = nodeType;
+ }
+
+ public SDNO withNodeType(String nodeType) {
+ this.nodeType = nodeType;
+ return this;
+ }
+
+ @JsonProperty("body")
+ public Body getBody() {
+ return body;
+ }
+
+ @JsonProperty("body")
+ public void setBody(Body body) {
+ this.body = body;
+ }
+
+ public SDNO withBody(Body body) {
+ this.body = body;
+ return this;
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ public SDNO SDNO (String name, Object value) {
+ this.additionalProperties.put(name, value);
+ return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java b/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
new file mode 100644
index 0000000000..59adeb2026
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
@@ -0,0 +1,161 @@
+/*-
+ * ============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.openecomp.mso.client.sdno.dmaap;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Optional;
+
+import org.openecomp.mso.client.dmaap.DmaapConsumer;
+import org.openecomp.mso.client.exceptions.SDNOException;
+import org.openecomp.mso.jsonpath.JsonPathUtil;
+
+public class SDNOHealthCheckDmaapConsumer extends DmaapConsumer {
+
+ private final String uuid;
+ private boolean continuePolling = true;
+ private final static String healthDiagnosticPath = "body.output.*";
+
+ public SDNOHealthCheckDmaapConsumer() throws FileNotFoundException, IOException {
+ this("none");
+ }
+
+ public SDNOHealthCheckDmaapConsumer(String uuid) throws FileNotFoundException, IOException {
+ super();
+ this.uuid = uuid;
+ }
+
+ @Override
+ public String getUserName() {
+ return msoProperties.get("sdno.health-check.dmaap.username");
+ }
+
+ @Override
+ public String getPassword() {
+ return msoProperties.get("sdno.health-check.dmaap.password");
+ }
+
+ @Override
+ public String getTopic() {
+ return msoProperties.get("sdno.health-check.dmaap.subscriber.topic");
+ }
+
+ @Override
+ public Optional<String> getHost() {
+ return Optional.ofNullable(msoProperties.get("sdno.health-check.dmaap.subscriber.host"));
+ }
+
+ @Override
+ public boolean continuePolling() {
+ return continuePolling;
+ }
+
+ @Override
+ public void stopProcessingMessages() {
+ continuePolling = false;
+ }
+ @Override
+ public void processMessage(String message) throws Exception {
+ if (isHealthDiagnostic(message, this.getRequestId())) {
+ if (!healthDiagnosticSuccessful(message)) {
+ Optional<String> statusMessage = this.getStatusMessage(message);
+ if (statusMessage.isPresent()) {
+ throw new SDNOException("failed with message " + statusMessage.get());
+ } else {
+ throw new SDNOException("failed with no status message");
+ }
+ } else {
+ auditLogger.info("successful health diagnostic found for request: " + this.getRequestId());
+ stopProcessingMessages();
+ }
+ }
+ }
+
+ @Override
+ public boolean isAccepted(String message) {
+ if (isResultInfo(message)) {
+ Optional<String> code = isAccepted(message, this.getRequestId());
+ if (code.isPresent()) {
+ if ("202".equals(code.get())) {
+ return true;
+ } else {
+ //TODO check other statuses 400 and 500
+ }
+ } else {
+ //TODO throw error
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean isFailure(String message) {
+ if (isResultInfo(message)) {
+ Optional<String> code = isFailure(message, this.getRequestId());
+ if (code.isPresent()) {
+ if ("500".equals(code.get())) {
+ return true;
+ } else {
+ //TODO check other statuses 400 and 500
+ }
+ } else {
+ //TODO throw error
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public String getRequestId() {
+ return uuid;
+ }
+
+ protected Optional<String> isAccepted(String json, String uuid) {
+ return JsonPathUtil.getInstance().locateResult(json, String.format("$.result-info[?(@.status=='ACCEPTED' && @.request-id=='%s')].code", uuid));
+ }
+
+ protected Optional<String> isFailure(String json, String uuid) {
+ return JsonPathUtil.getInstance().locateResult(json, String.format("$.result-info[?(@.status=='FAILURE' && @.request-id=='%s')].code", uuid));
+ }
+
+ protected boolean isResultInfo(String json) {
+ return JsonPathUtil.getInstance().pathExists(json, "$[?(@.result-info)]");
+ }
+
+ protected boolean isHealthDiagnostic(String json, String uuid) {
+ return JsonPathUtil.getInstance().pathExists(json, String.format("$[?(@.result-info.request-id=='%s')].%s", uuid, healthDiagnosticPath));
+ }
+
+ protected boolean healthDiagnosticSuccessful(String json) {
+ return JsonPathUtil.getInstance().pathExists(json, "$." + healthDiagnosticPath + "[?(@.response-status=='Success')]");
+ }
+
+ protected Optional<String> getStatusMessage(String json) {
+ return JsonPathUtil.getInstance().locateResult(json, "$." + healthDiagnosticPath + ".error-message");
+ }
+
+ @Override
+ public int getMaximumElapsedTime() {
+ return 300000;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java b/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
new file mode 100644
index 0000000000..ef19bb7921
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.openecomp.mso.client.sdno.dmaap;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Optional;
+
+import org.openecomp.mso.client.dmaap.DmaapPublisher;
+
+public class SDNOHealthCheckDmaapPublisher extends DmaapPublisher {
+
+ public SDNOHealthCheckDmaapPublisher() throws FileNotFoundException, IOException {
+ super();
+ }
+
+ @Override
+ public String getUserName() {
+ return msoProperties.get("sdno.health-check.dmaap.username");
+ }
+
+ @Override
+ public String getPassword() {
+ return msoProperties.get("sdno.health-check.dmaap.password");
+ }
+
+ @Override
+ public String getTopic() {
+ return msoProperties.get("sdno.health-check.dmaap.publisher.topic");
+ }
+
+ @Override
+ public Optional<String> getHost() {
+ return Optional.ofNullable(msoProperties.get("sdno.health-check.dmaap.publisher.host"));
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/jsonpath/JsonPathUtil.java b/common/src/main/java/org/openecomp/mso/jsonpath/JsonPathUtil.java
new file mode 100644
index 0000000000..148eb74068
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/jsonpath/JsonPathUtil.java
@@ -0,0 +1,82 @@
+/*-
+ * ============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.openecomp.mso.jsonpath;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.jayway.jsonpath.Configuration;
+import com.jayway.jsonpath.JsonPath;
+import com.jayway.jsonpath.Option;
+import com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider;
+
+public class JsonPathUtil {
+
+
+ private final Configuration conf;
+
+ private JsonPathUtil() {
+ conf = Configuration.defaultConfiguration().jsonProvider(new JacksonJsonNodeJsonProvider()).addOptions(Option.ALWAYS_RETURN_LIST, Option.SUPPRESS_EXCEPTIONS);
+ }
+
+ private static class Helper {
+ private static final JsonPathUtil INSTANCE = new JsonPathUtil();
+ }
+
+ public static JsonPathUtil getInstance() {
+ return Helper.INSTANCE;
+ }
+ public boolean pathExists(String json, String jsonPath) {
+ return JsonPath.using(conf).parse(json).<ArrayNode>read(jsonPath).size() != 0;
+ }
+
+ public Optional<String> locateResult(String json, String jsonPath) {
+ final ArrayNode result = JsonPath.using(conf).parse(json).read(jsonPath);
+ if (result.size() == 0) {
+ return Optional.empty();
+ } else {
+ if (result.get(0).isValueNode()) {
+ return Optional.of(result.get(0).asText());
+ } else {
+ return Optional.of(result.get(0).toString());
+ }
+
+ }
+ }
+
+ public List<String> locateResultList(String json, String jsonPath) {
+ final ArrayNode resultNodes = JsonPath.using(conf).parse(json).read(jsonPath);
+ final ArrayList<String> result = new ArrayList<>();
+
+ for (JsonNode node : resultNodes) {
+ if (node.isValueNode()) {
+ result.add(node.asText());
+ } else {
+ result.add(node.toString());
+ }
+
+ }
+ return result;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java b/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java
index 963554191e..419bbf8ca6 100644
--- a/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java
+++ b/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java
@@ -202,6 +202,7 @@ public enum MessageEnum implements EELFResolvableErrorEnum{
ASDC_SERVICE_NOT_SUPPORT,
ASDC_ARTIFACT_DEPLOY_SUC,
ASDC_PROPERTIES_NOT_FOUND,
+ ASDC_PROPERTIES_LOAD_SUCCESS,
// Default Messages, in case Log catalog is not defined
GENERAL_EXCEPTION_ARG,
GENERAL_EXCEPTION,
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java
index f0ca191978..c13b9e0b53 100644
--- a/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java
+++ b/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java
@@ -24,7 +24,11 @@ package org.openecomp.mso.properties;
import java.io.FileReader;
import java.io.IOException;
import java.security.GeneralSecurityException;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Properties;
+
+import org.apache.commons.codec.binary.Base64;
import org.openecomp.mso.utils.CryptoUtils;
public class MsoJavaProperties extends AbstractMsoProperties {
@@ -86,11 +90,43 @@ public class MsoJavaProperties extends AbstractMsoProperties {
}
+ /**
+ * @param encryptedAuth: encrypted credentials from properties
+ * @param msoKey: key to use to decrypt from properties
+ * @return base 64 encoded basic auth credentials
+ */
+ public synchronized String getBasicAuth(String encryptedAuth, String msoKey){
+ String encodedString = null;
+ if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty()))
+ return null;
+ try {
+ String auth = decrypt(encryptedAuth, msoKey);
+ byte[] encoded = Base64.encodeBase64(auth.getBytes());
+ encodedString = new String(encoded);
+ encodedString = "Basic " + encodedString;
+
+ } catch (Exception ex) {
+ LOGGER.debug("Exception while getBasicAuth " + encryptedAuth, ex);
+ }
+ return encodedString;
+ }
+
public synchronized int size() {
return this.msoProperties.size();
}
-
+ public synchronized String decrypt(String toDecrypt, String msokey){
+ String result = null;
+ try {
+ result = CryptoUtils.decrypt(toDecrypt, msokey);
+
+ }
+ catch (Exception e) {
+ LOGGER.debug("Failed to decrypt credentials: " + toDecrypt, e);
+ }
+ return result;
+ }
+
@Override
protected synchronized void reloadPropertiesFile() throws IOException {
this.loadPropertiesFile(this.propertiesFileName);
@@ -181,4 +217,12 @@ public class MsoJavaProperties extends AbstractMsoProperties {
return response.toString();
}
+
+ public Map<String, String> asMap() {
+ final Map<String, String> result = new HashMap<>();
+ msoProperties.forEach((key, value) -> result.put(key.toString(), value.toString()));
+
+ return result;
+ }
+
}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/CloudConfiguration.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/CloudConfiguration.java
new file mode 100644
index 0000000000..cb5a1018ad
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/CloudConfiguration.java
@@ -0,0 +1,106 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "cloudConfiguration")
+@JsonInclude(Include.NON_DEFAULT)
+public class CloudConfiguration implements Serializable {
+
+ private static final long serialVersionUID = 6260165690180745471L;
+ @JsonProperty("aicNodeClli")
+ protected String aicNodeClli;
+ @JsonProperty("tenantId")
+ protected String tenantId;
+ @JsonProperty("lcpCloudRegionId")
+ protected String lcpCloudRegionId;
+
+ /**
+ * Gets the value of the aicNodeClli property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAicNodeClli() {
+ return aicNodeClli;
+ }
+
+ /**
+ * Sets the value of the aicNodeClli property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAicNodeClli(String value) {
+ this.aicNodeClli = value;
+ }
+
+ /**
+ * Gets the value of the tenantId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * Sets the value of the tenantId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTenantId(String value) {
+ this.tenantId = value;
+ }
+
+
+ public String getLcpCloudRegionId() {
+ return lcpCloudRegionId;
+ }
+
+ public void setLcpCloudRegionId(String lcpCloudRegionId) {
+ this.lcpCloudRegionId = lcpCloudRegionId;
+ }
+
+ @Override
+ public String toString() {
+ return "CloudConfiguration [aicNodeClli=" + aicNodeClli + ", tenantId="
+ + tenantId + ", lcpCloudRegionId=" + lcpCloudRegionId + "]";
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ExceptionType.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ExceptionType.java
new file mode 100644
index 0000000000..d7dcea381c
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ExceptionType.java
@@ -0,0 +1,156 @@
+/*-
+ * ============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=========================================================
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.05.03 at 03:56:30 PM CDT
+//
+
+
+package org.openecomp.mso.serviceinstancebeans;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for exceptionType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="exceptionType">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="variables" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="50" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "exceptionType", propOrder = {
+ "messageId",
+ "text",
+ "variables"
+})
+@XmlSeeAlso({
+ ServiceException.class,
+ PolicyException.class
+})
+public class ExceptionType {
+
+ @XmlElement(required = true)
+ protected String messageId;
+ @XmlElement(required = true)
+ protected String text;
+ protected List<String> variables;
+
+ /**
+ * Gets the value of the messageId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessageId() {
+ return messageId;
+ }
+
+ /**
+ * Sets the value of the messageId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessageId(String value) {
+ this.messageId = value;
+ }
+
+ /**
+ * Gets the value of the text property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * Sets the value of the text property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setText(String value) {
+ this.text = value;
+ }
+
+ /**
+ * Gets the value of the variables property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the variables property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getVariables().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getVariables() {
+ if (variables == null) {
+ variables = new ArrayList<>();
+ }
+ return this.variables;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationListResponse.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationListResponse.java
new file mode 100644
index 0000000000..5cee0fa237
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationListResponse.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class GetOrchestrationListResponse {
+
+ protected List<RequestList> requestList;
+
+ public List<RequestList> getRequestList() {
+ return requestList;
+ }
+
+ public void setRequestList(List<RequestList> requestList) {
+ this.requestList = requestList;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationResponse.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationResponse.java
new file mode 100644
index 0000000000..54b1b3be61
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationResponse.java
@@ -0,0 +1,40 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class GetOrchestrationResponse {
+
+ protected Request request;
+
+ public Request getRequest() {
+ return request;
+ }
+
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceDirection.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceDirection.java
new file mode 100644
index 0000000000..3334db7d25
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceDirection.java
@@ -0,0 +1,35 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+public enum InstanceDirection {
+
+ source,
+ destination;
+
+ public String value() {
+ return name();
+ }
+
+ public static InstanceDirection fromValue(String v) {
+ return valueOf(v);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceReferences.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceReferences.java
new file mode 100644
index 0000000000..c4421886ba
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceReferences.java
@@ -0,0 +1,110 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class InstanceReferences {
+
+ protected String serviceInstanceId;
+ protected String serviceInstanceName;
+ protected String vnfInstanceId;
+ protected String vnfInstanceName;
+ protected String vfModuleInstanceId;
+ protected String vfModuleInstanceName;
+ protected String volumeGroupInstanceId;
+ protected String volumeGroupInstanceName;
+ protected String networkInstanceId;
+ protected String networkInstanceName;
+ protected String requestorId;
+
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+ public String getVnfInstanceName() {
+ return vnfInstanceName;
+ }
+ public void setVnfInstanceName(String vnfInstanceName) {
+ this.vnfInstanceName = vnfInstanceName;
+ }
+ public String getVfModuleInstanceId() {
+ return vfModuleInstanceId;
+ }
+ public void setVfModuleInstanceId(String vfModuleInstanceId) {
+ this.vfModuleInstanceId = vfModuleInstanceId;
+ }
+ public String getVfModuleInstanceName() {
+ return vfModuleInstanceName;
+ }
+ public void setVfModuleInstanceName(String vfModuleInstanceName) {
+ this.vfModuleInstanceName = vfModuleInstanceName;
+ }
+ public String getVolumeGroupInstanceId() {
+ return volumeGroupInstanceId;
+ }
+ public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
+ this.volumeGroupInstanceId = volumeGroupInstanceId;
+ }
+ public String getVolumeGroupInstanceName() {
+ return volumeGroupInstanceName;
+ }
+ public void setVolumeGroupInstanceName(String volumeGroupInstanceName) {
+ this.volumeGroupInstanceName = volumeGroupInstanceName;
+ }
+ public String getNetworkInstanceId() {
+ return networkInstanceId;
+ }
+ public void setNetworkInstanceId(String networkInstanceId) {
+ this.networkInstanceId = networkInstanceId;
+ }
+ public String getNetworkInstanceName() {
+ return networkInstanceName;
+ }
+ public void setNetworkInstanceName(String networkInstanceName) {
+ this.networkInstanceName = networkInstanceName;
+ }
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/LineOfBusiness.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/LineOfBusiness.java
new file mode 100644
index 0000000000..818d5e0acc
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/LineOfBusiness.java
@@ -0,0 +1,44 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "lineOfBusiness")
+@JsonInclude(Include.NON_DEFAULT)
+public class LineOfBusiness implements Serializable {
+
+ private static final long serialVersionUID = -8574860788160041209L;
+ @JsonProperty("lineOfBusinessName")
+ private String lineOfBusinessName;
+
+ public String getLineOfBusinessName(){
+ return lineOfBusinessName;
+ }
+ public void setLineOfBusinessName(String value){
+ this.lineOfBusinessName = value;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelInfo.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelInfo.java
new file mode 100644
index 0000000000..f91dd10f38
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelInfo.java
@@ -0,0 +1,154 @@
+/*-
+ * ============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=========================================================
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.03.30 at 02:48:23 PM CDT
+//
+
+
+package org.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "modelInfo")
+@JsonInclude(Include.NON_DEFAULT)
+public class ModelInfo implements Serializable {
+
+ private static final long serialVersionUID = 5281763573935476852L;
+ @JsonProperty("modelCustomizationName")
+ protected String modelCustomizationName;
+ @JsonProperty("modelInvariantId")
+ protected String modelInvariantId;
+ @JsonProperty("modelType")
+ protected ModelType modelType;
+ //v2
+ @JsonProperty("modelNameVersionId")
+ protected String modelNameVersionId;
+ @JsonProperty("modelName")
+ protected String modelName;
+ @JsonProperty("modelVersion")
+ protected String modelVersion;
+ @JsonProperty("modelCustomizationUuid")
+ protected String modelCustomizationUuid;
+ //v3
+ @JsonProperty("modelVersionId")
+ protected String modelVersionId;
+ @JsonProperty("modelCustomizationId")
+ protected String modelCustomizationId;
+ //Decomposition fields
+ @JsonProperty("modelUuid")
+ protected String modelUuid;
+ @JsonProperty("modelInvariantUuid")
+ protected String modelInvariantUuid;
+ @JsonProperty("modelInstanceName")
+ protected String modelInstanceName;
+
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+ public String getModelNameVersionId() {
+ return modelNameVersionId;
+ }
+ public void setModelNameVersionId(String modelNameVersionId) {
+ this.modelNameVersionId = modelNameVersionId;
+ }
+ public String getModelName() {
+ return modelName;
+ }
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+ public String getModelVersion() {
+ return modelVersion;
+ }
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+ public ModelType getModelType() {
+ return modelType;
+ }
+ public void setModelType(ModelType modelType) {
+ this.modelType = modelType;
+ }
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+ public String getModelCustomizationUuid() {
+ return modelCustomizationUuid;
+ }
+ public void setModelCustomizationUuid(String modelCustomizationUuid) {
+ this.modelCustomizationUuid = modelCustomizationUuid;
+ }
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+ public String getModelUuid() {
+ return modelUuid;
+ }
+ public void setModelUuid(String modelUuid) {
+ this.modelUuid = modelUuid;
+ }
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+ public String getModelInstanceName() {
+ return modelInstanceName;
+ }
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+ @Override
+ public String toString() {
+ return "ModelInfo [modelCustomizationName=" + modelCustomizationName + ", modelInvariantId=" + modelInvariantId
+ + ", modelType=" + modelType + ", modelNameVersionId=" + modelNameVersionId + ", modelName=" + modelName
+ + ", modelVersion=" + modelVersion + ", modelCustomizationUuid=" + modelCustomizationUuid
+ + ", modelVersionId=" + modelVersionId + ", modelCustomizationId=" + modelCustomizationId
+ + ", modelUuid=" + modelUuid + ", modelInvariantUuid=" + modelInvariantUuid + ", modelInstanceName="
+ + modelInstanceName + "]";
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelType.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelType.java
new file mode 100644
index 0000000000..c7e6615130
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelType.java
@@ -0,0 +1,35 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+/*
+ * Enum for Model Type values returned by API Handler to BPMN
+*/
+public enum ModelType {
+ service,
+ vnf,
+ vfModule,
+ volumeGroup,
+ network,
+ configuration,
+ connectionPoint,
+ pnf
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/OwningEntity.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/OwningEntity.java
new file mode 100644
index 0000000000..985de7d41a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/OwningEntity.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "owningEntity")
+@JsonInclude(Include.NON_DEFAULT)
+public class OwningEntity implements Serializable {
+
+ private static final long serialVersionUID = -3907033130633428448L;
+ @JsonProperty("owningEntityId")
+ private String owningEntityId;
+ @JsonProperty("owningEntityName")
+ private String owningEntityName;
+
+ public String getOwningEntityId(){
+ return owningEntityId;
+ }
+
+ public void setOwningEntityId(String value) {
+ this.owningEntityId = value;
+ }
+
+ public String getOwningEntityName(){
+ return owningEntityName;
+ }
+
+ public void setOwningEntityName(String value){
+ this.owningEntityName = value;
+ }
+ @Override
+ public String toString() {
+ return "OwningEntity [owningEntityId=" + owningEntityId
+ + ", owningEntityName=" + owningEntityName + "]";
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Platform.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Platform.java
new file mode 100644
index 0000000000..37841e0ea4
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Platform.java
@@ -0,0 +1,44 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonInclude(Include.NON_DEFAULT)
+@JsonRootName(value = "platform")
+public class Platform implements Serializable {
+
+ private static final long serialVersionUID = -7334479240678605536L;
+ @JsonProperty("platformName")
+ private String platformName;
+
+ public String getPlatformName(){
+ return platformName;
+ }
+ public void setPlatformName(String value){
+ this.platformName = value;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/PolicyException.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/PolicyException.java
new file mode 100644
index 0000000000..0afd600f6d
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/PolicyException.java
@@ -0,0 +1,59 @@
+/*-
+ * ============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=========================================================
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.03.30 at 02:48:23 PM CDT
+//
+
+
+package org.openecomp.mso.serviceinstancebeans;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for policyException complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="policyException">
+ * &lt;complexContent>
+ * &lt;extension base="{http://org.openecomp/mso/request/types/v1}exceptionType">
+ * &lt;/extension>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "policyException")
+public class PolicyException
+ extends ExceptionType
+{
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Project.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Project.java
new file mode 100644
index 0000000000..d073616b1c
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Project.java
@@ -0,0 +1,45 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "project")
+@JsonInclude(Include.NON_DEFAULT)
+public class Project implements Serializable {
+
+ private static final long serialVersionUID = -3868114191925177035L;
+ @JsonProperty("projectName")
+ private String projectName;
+
+ public String getProjectName(){
+ return projectName;
+ }
+
+ public void setProjectName(String value) {
+ this.projectName = value;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstance.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstance.java
new file mode 100644
index 0000000000..8e4dbd0c87
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstance.java
@@ -0,0 +1,70 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "relatedInstance")
+@JsonInclude(Include.NON_DEFAULT)
+public class RelatedInstance implements Serializable {
+
+ private static final long serialVersionUID = 137250604008221644L;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("instanceId")
+ protected String instanceId;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ //Configuration field
+ @JsonProperty("instanceDirection")
+ protected InstanceDirection instanceDirection;
+
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+ public String getInstanceId() {
+ return instanceId;
+ }
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+ public InstanceDirection getInstanceDirection() {
+ return instanceDirection;
+ }
+ public void setInstanceDirection(InstanceDirection instanceDirection) {
+ this.instanceDirection = instanceDirection;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstanceList.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstanceList.java
new file mode 100644
index 0000000000..b11acccf2a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstanceList.java
@@ -0,0 +1,53 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "relatedInstanceList")
+@JsonInclude(Include.NON_DEFAULT)
+public class RelatedInstanceList implements Serializable {
+
+ private static final long serialVersionUID = 6333898302094446243L;
+ @JsonProperty("relatedInstance")
+ protected RelatedInstance relatedInstance;
+
+ public RelatedInstance getRelatedInstance() {
+ return relatedInstance;
+ }
+
+ public void setRelatedInstance(RelatedInstance relatedInstance) {
+ this.relatedInstance = relatedInstance;
+ }
+
+ @Override
+ public String toString() {
+ return "RelatedInstanceList [relatedInstance=" + relatedInstance + "]";
+ }
+
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Request.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Request.java
new file mode 100644
index 0000000000..ef9020d889
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Request.java
@@ -0,0 +1,83 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+//@JsonRootName(value = "request")
+@JsonInclude(Include.NON_DEFAULT)
+public class Request {
+
+ protected String requestId;
+ protected String startTime;
+ protected String requestScope;
+ protected String requestType;
+ //protected String requestDetails;
+ protected RequestDetails requestDetails;
+ protected InstanceReferences instanceReferences;
+ protected RequestStatus requestStatus;
+
+
+ public String getRequestId() {
+ return requestId;
+ }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+ public String getStartTime() {
+ return startTime;
+ }
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+ public String getRequestScope() {
+ return requestScope;
+ }
+ public void setRequestScope(String requestScope) {
+ this.requestScope = requestScope;
+ }
+ public String getRequestType() {
+ return requestType;
+ }
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+ public RequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+ public void setRequestStatus(RequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+ public InstanceReferences getInstanceReferences() {
+ return instanceReferences;
+ }
+ public void setInstanceReferences(InstanceReferences instanceReferences) {
+ this.instanceReferences = instanceReferences;
+ }
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+ public void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestDetails.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestDetails.java
new file mode 100644
index 0000000000..2bae526efa
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestDetails.java
@@ -0,0 +1,280 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "requestDetails")
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestDetails implements Serializable {
+
+ private static final long serialVersionUID = -73080684945860609L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("requestInfo")
+ protected RequestInfo requestInfo;
+ @JsonProperty("relatedInstanceList")
+ protected RelatedInstanceList[] relatedInstanceList;
+ @JsonProperty("subscriberInfo")
+ protected SubscriberInfo subscriberInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("requestParameters")
+ protected RequestParameters requestParameters;
+ @JsonProperty("project")
+ protected Project project;
+ @JsonProperty("owningEntity")
+ protected OwningEntity owningEntity;
+ @JsonProperty("platform")
+ protected Platform platform;
+ @JsonProperty("lineOfBusiness")
+ protected LineOfBusiness lineOfBusiness;
+ /**
+ * Gets the value of the serviceInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link ModelInfo }
+ *
+ */
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ /**
+ * Sets the value of the serviceInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ModelInfo }
+ *
+ */
+ public void setModelInfo(ModelInfo value) {
+ this.modelInfo = value;
+ }
+
+ /**
+ * Gets the value of the requestInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link RequestInfo }
+ *
+ */
+ public RequestInfo getRequestInfo() {
+ return requestInfo;
+ }
+
+ /**
+ * Sets the value of the requestInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RequestInfo }
+ *
+ */
+ public void setRequestInfo(RequestInfo value) {
+ this.requestInfo = value;
+ }
+
+ /**
+ * Gets the value of the subscriberInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link SubscriberInfo }
+ *
+ */
+ public SubscriberInfo getSubscriberInfo() {
+ return subscriberInfo;
+ }
+
+ /**
+ * Sets the value of the subscriberInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link SubscriberInfo }
+ *
+ */
+ public void setSubscriberInfo(SubscriberInfo value) {
+ this.subscriberInfo = value;
+ }
+
+ /**
+ * Gets the value of the cloudConfiguration property.
+ *
+ * @return
+ * possible object is
+ * {@link CloudConfiguration }
+ *
+ */
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ /**
+ * Sets the value of the cloudConfiguration property.
+ *
+ * @param value
+ * allowed object is
+ * {@link CloudConfiguration }
+ *
+ */
+ public void setCloudConfiguration(CloudConfiguration value) {
+ this.cloudConfiguration = value;
+ }
+
+ /**
+ * Gets the value of the requestParameters property.
+ *
+ * @return
+ * possible object is
+ * {@link RequestParameters }
+ *
+ */
+ public RequestParameters getRequestParameters() {
+ return requestParameters;
+ }
+
+ /**
+ * Sets the value of the requestParameters property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RequestParameters }
+ *
+ */
+ public void setRequestParameters(RequestParameters value) {
+ this.requestParameters = value;
+ }
+
+ public RelatedInstanceList[] getRelatedInstanceList() {
+ return relatedInstanceList;
+ }
+
+ public void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) {
+ this.relatedInstanceList = relatedInstanceList;
+ }
+ /**
+ * Gets the value of the project property.
+ *
+ * @return
+ * possible object is
+ * {@link Project }
+ *
+ */
+ public Project getProject(){
+ return project;
+ }
+ /**
+ * Sets the value of the project property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Project }
+ *
+ */
+ public void setProject(Project value){
+ this.project = value;
+ }
+ /**
+ * Gets the value of the owningEntity property.
+ *
+ * @return
+ * possible object is
+ * {@link OwningEntity }
+ *
+ */
+ public OwningEntity getOwningEntity(){
+ return owningEntity;
+ }
+ /**
+ * Sets the value of the owningEntity property.
+ *
+ * @param value
+ * allowed object is
+ * {@link OwningEntity }
+ *
+ */
+ public void setOwningEntity(OwningEntity value){
+ this.owningEntity = value;
+ }
+ /**
+ * Gets the value of the platform property.
+ *
+ * @return
+ * possible object is
+ * {@link Platform }
+ *
+ */
+ public Platform getPlatform(){
+ return platform;
+ }
+ /**
+ * Sets the value of the platform property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Platform }
+ *
+ */
+ public void setPlatform(Platform value){
+ this.platform = value;
+ }
+ /**
+ * Gets the value of the lineOfBusiness property.
+ *
+ * @return
+ * possible object is
+ * {@link LineOfBusiness }
+ *
+ */
+ public LineOfBusiness getLineOfBusiness(){
+ return lineOfBusiness;
+ }
+ /**
+ * Sets the value of the lineOfBusiness property.
+ *
+ * @param value
+ * allowed object is
+ * {@link LineOfBusiness }
+ *
+ */
+ public void setLineOfBusiness(LineOfBusiness value){
+ this.lineOfBusiness = value;
+ }
+ @Override
+ public String toString() {
+ return "RequestDetails [modelInfo=" + modelInfo + ", requestInfo="
+ + requestInfo + ", relatedInstanceList="
+ + Arrays.toString(relatedInstanceList) + ", subscriberInfo="
+ + subscriberInfo + ", cloudConfiguration=" + cloudConfiguration
+ + ", requestParameters=" + requestParameters + ", platform=" + platform
+ + ", lineOfBusiness=" + ", project=" + project + ", owningEntity=" + owningEntity + "]";
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestError.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestError.java
new file mode 100644
index 0000000000..d57364ae09
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestError.java
@@ -0,0 +1,118 @@
+/*-
+ * ============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=========================================================
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.04.07 at 08:25:52 AM CDT
+//
+
+
+package org.openecomp.mso.serviceinstancebeans;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;choice>
+ * &lt;element name="policyException" type="{http://org.openecomp/mso/request/types/v1}policyException"/>
+ * &lt;element name="serviceException" type="{http://org.openecomp/mso/request/types/v1}serviceException"/>
+ * &lt;/choice>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "policyException",
+ "serviceException"
+})
+@XmlRootElement(name = "requestError")
+public class RequestError {
+
+ protected PolicyException policyException;
+ protected ServiceException serviceException;
+
+ /**
+ * Gets the value of the policyException property.
+ *
+ * @return
+ * possible object is
+ * {@link PolicyException }
+ *
+ */
+ public PolicyException getPolicyException() {
+ return policyException;
+ }
+
+ /**
+ * Sets the value of the policyException property.
+ *
+ * @param value
+ * allowed object is
+ * {@link PolicyException }
+ *
+ */
+ public void setPolicyException(PolicyException value) {
+ this.policyException = value;
+ }
+
+ /**
+ * Gets the value of the serviceException property.
+ *
+ * @return
+ * possible object is
+ * {@link ServiceException }
+ *
+ */
+ public ServiceException getServiceException() {
+ return serviceException;
+ }
+
+ /**
+ * Sets the value of the serviceException property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ServiceException }
+ *
+ */
+ public void setServiceException(ServiceException value) {
+ this.serviceException = value;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestInfo.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestInfo.java
new file mode 100644
index 0000000000..d1e489a174
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestInfo.java
@@ -0,0 +1,239 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
+
+@JsonRootName(value = "requestInfo")
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestInfo implements Serializable {
+
+ private static final long serialVersionUID = -1370946827136030181L;
+ @JsonProperty("billingAccountNumber")
+ protected String billingAccountNumber;
+ @JsonProperty("callbackUrl")
+ protected String callbackUrl;
+ @JsonProperty("correlator")
+ protected String correlator;
+ @JsonProperty("orderNumber")
+ protected String orderNumber;
+ @JsonProperty("productFamilyId")
+ protected String productFamilyId;
+ @JsonProperty("orderVersion")
+ protected Integer orderVersion;
+ @JsonSerialize(include=Inclusion.ALWAYS)
+ @JsonProperty("source")
+ protected String source;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("suppressRollback")
+ @JsonSerialize(include=Inclusion.ALWAYS)
+ protected boolean suppressRollback;
+ @JsonProperty("requestorId")
+ protected String requestorId;
+
+ /**
+ * Gets the value of the callbackUrl property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ /**
+ * Sets the value of the callbackUrl property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCallbackUrl(String value) {
+ this.callbackUrl = value;
+ }
+
+ /**
+ * Gets the value of the correlator property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCorrelator() {
+ return correlator;
+ }
+
+ /**
+ * Sets the value of the correlator property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCorrelator(String value) {
+ this.correlator = value;
+ }
+
+ /**
+ * Gets the value of the orderNumber property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOrderNumber() {
+ return orderNumber;
+ }
+
+ /**
+ * Sets the value of the orderNumber property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOrderNumber(String value) {
+ this.orderNumber = value;
+ }
+
+ /**
+ * Gets the value of the orderVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getOrderVersion() {
+ return orderVersion;
+ }
+
+ /**
+ * Sets the value of the orderVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setOrderVersion(Integer value) {
+ this.orderVersion = value;
+ }
+
+ /**
+ * Gets the value of the source property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSource() {
+ if(null == source || source.isEmpty()){
+ source = "VID";
+ }
+ return source;
+ }
+
+ /**
+ * Sets the value of the source property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSource(String value) {
+ this.source = value;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getBillingAccountNumber() {
+ return billingAccountNumber;
+ }
+
+ public void setBillingAccountNumber(String billingAccountNumber) {
+ this.billingAccountNumber = billingAccountNumber;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ /**
+ * Required for Marshalers to send the fields.
+ * @return
+ */
+ public boolean getSuppressRollback() {
+ return suppressRollback;
+ }
+
+ public void setSuppressRollback(boolean suppressRollback) {
+ this.suppressRollback = suppressRollback;
+ }
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestInfo [billingAccountNumber=" + billingAccountNumber
+ + ", callbackUrl=" + callbackUrl + ", correlator=" + correlator
+ + ", orderNumber=" + orderNumber + ", productFamilyId="
+ + productFamilyId + ", orderVersion=" + orderVersion
+ + ", source=" + source + ", instanceName=" + instanceName
+ + ", suppressRollback=" + suppressRollback + ", requestorId="
+ + requestorId + "]";
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestList.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestList.java
new file mode 100644
index 0000000000..05e1ab9a7a
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestList.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.util.List;
+
+
+public class RequestList {
+
+ protected Request request;
+
+ public Request getRequest() {
+ return request;
+ }
+
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestParameters.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestParameters.java
new file mode 100644
index 0000000000..ba65c088eb
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestParameters.java
@@ -0,0 +1,141 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "requestParameters")
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestParameters implements Serializable {
+
+ private static final long serialVersionUID = -5979049912538894930L;
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+ @JsonProperty("userParams")
+ private List<Map<String, Object>> userParams = new ArrayList<>();
+ @JsonProperty("aLaCarte")
+ private Boolean aLaCarte;
+ @JsonProperty("autoBuildVfModules")
+ private Boolean autoBuildVfModules;
+ @JsonProperty("cascadeDelete")
+ private Boolean cascadeDelete;
+ @JsonProperty("usePreload")
+ private Boolean usePreload; // usePreload would always be true for Update
+ @JsonProperty("rebuildVolumeGroups")
+ private Boolean rebuildVolumeGroups;
+ @JsonProperty("payload")
+ private String payload;
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public Boolean getALaCarte() {
+ return aLaCarte;
+ }
+
+ public void setaLaCarte(boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ }
+
+ public Boolean isaLaCarte() {
+ return aLaCarte;
+ }
+
+ public List<Map<String, Object>> getUserParams() {
+ return userParams;
+ }
+
+ public void setUserParams(List<Map<String, Object>> userParams) {
+ this.userParams = userParams;
+ }
+
+ public String getUserParamValue(String name){
+ if(userParams!=null){
+ for(Map<String, Object> param:userParams){
+ if(param.get("name").equals(name)){
+ return param.get("value").toString();
+ }
+ }
+ }
+ return null;
+ }
+
+ public Boolean getAutoBuildVfModules() {
+ return autoBuildVfModules;
+ }
+
+ public void setAutoBuildVfModules(boolean autoBuildVfModules) {
+ this.autoBuildVfModules = autoBuildVfModules;
+ }
+
+ public Boolean getCascadeDelete() {
+ return cascadeDelete;
+ }
+
+ public void setCascadeDelete(boolean cascadeDelete) {
+ this.cascadeDelete = cascadeDelete;
+ }
+
+ public Boolean isUsePreload() {
+ return usePreload;
+ }
+
+ public void setUsePreload(boolean usePreload) {
+ this.usePreload = usePreload;
+ }
+
+ public Boolean rebuildVolumeGroups() {
+ return rebuildVolumeGroups;
+ }
+
+ public void setRebuildVolumeGroups(boolean rebuildVolumeGroups) {
+ this.rebuildVolumeGroups = rebuildVolumeGroups;
+ }
+ public String getPayload(){
+ return payload;
+ }
+ public void setPayload(String value){
+ this.payload = value;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestParameters [subscriptionServiceType="
+ + subscriptionServiceType + ", userParams=" + userParams
+ + ", aLaCarte=" + aLaCarte + ", autoBuildVfModules="
+ + autoBuildVfModules + ", usePreload="
+ + usePreload + ", rebuildVolumeGroups="
+ + rebuildVolumeGroups + ", payload=" + payload + "]";
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestReferences.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestReferences.java
new file mode 100644
index 0000000000..b01dfd9a3b
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestReferences.java
@@ -0,0 +1,43 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+public class RequestReferences {
+
+ String requestId;
+ String instanceId;
+
+
+ public String getRequestId() {
+ return requestId;
+ }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+ public String getInstanceId() {
+ return instanceId;
+ }
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestStatus.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestStatus.java
new file mode 100644
index 0000000000..58a9c2ca0f
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestStatus.java
@@ -0,0 +1,59 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestStatus {
+
+ protected String requestState;
+ protected String statusMessage;
+ protected Integer percentProgress;
+ protected String finishTime;
+
+
+ public String getRequestState() {
+ return requestState;
+ }
+ public void setRequestState(String requestState) {
+ this.requestState = requestState;
+ }
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+ public void setStatusMessage(String statusMessage) {
+ this.statusMessage = statusMessage;
+ }
+ public Integer getPercentProgress() {
+ return percentProgress;
+ }
+ public void setPercentProgress(Integer percentProgress) {
+ this.percentProgress = percentProgress;
+ }
+ public String getFinishTime() {
+ return finishTime;
+ }
+ public void setFinishTime(String finishTime) {
+ this.finishTime = finishTime;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceException.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceException.java
new file mode 100644
index 0000000000..5eacefe8c0
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceException.java
@@ -0,0 +1,59 @@
+/*-
+ * ============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=========================================================
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2016.03.30 at 02:48:23 PM CDT
+//
+
+
+package org.openecomp.mso.serviceinstancebeans;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for serviceException complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="serviceException">
+ * &lt;complexContent>
+ * &lt;extension base="{http://org.openecomp/mso/request/types/v1}exceptionType">
+ * &lt;/extension>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "serviceException")
+public class ServiceException
+ extends ExceptionType
+{
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java
new file mode 100644
index 0000000000..4f8c1a0f13
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java
@@ -0,0 +1,112 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class ServiceInstancesRequest implements Serializable {
+
+ private static final long serialVersionUID = -4959169541182257787L;
+ @JsonProperty("requestDetails")
+ private RequestDetails requestDetails;
+ @JsonProperty("serviceInstanceId")
+ private String serviceInstanceId;
+ @JsonProperty("vnfInstanceId")
+ private String vnfInstanceId;
+ @JsonProperty("networkInstanceId")
+ private String networkInstanceId;
+ @JsonProperty("volumeGroupInstanceId")
+ private String volumeGroupInstanceId;
+ @JsonProperty("vfModuleInstanceId")
+ private String vfModuleInstanceId;
+ @JsonProperty("configurationId")
+ private String configurationId;
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public String getNetworkInstanceId() {
+ return networkInstanceId;
+ }
+
+ public void setNetworkInstanceId(String networkInstanceId) {
+ this.networkInstanceId = networkInstanceId;
+ }
+
+ public String getVolumeGroupInstanceId() {
+ return volumeGroupInstanceId;
+ }
+
+ public void setVolumeGroupInstanceId(String volumeGroupInstanceId) {
+ this.volumeGroupInstanceId = volumeGroupInstanceId;
+ }
+
+ public String getVfModuleInstanceId() {
+ return vfModuleInstanceId;
+ }
+
+ public void setVfModuleInstanceId(String vfModuleInstanceId) {
+ this.vfModuleInstanceId = vfModuleInstanceId;
+ }
+
+ public String getConfigurationId() {
+ return configurationId;
+ }
+
+ public void setConfigurationId(String configurationId) {
+ this.configurationId = configurationId;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceInstancesRequest [requestDetails=" + requestDetails
+ + ", serviceInstanceId=" + serviceInstanceId
+ + ", vnfInstanceId=" + vnfInstanceId + ", networkInstanceId="
+ + networkInstanceId + ", volumeGroupInstanceId="
+ + volumeGroupInstanceId + ", vfModuleInstanceId="
+ + vfModuleInstanceId + ", configurationId="
+ + configurationId + ",]";
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesResponse.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesResponse.java
new file mode 100644
index 0000000000..339c965ffd
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesResponse.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+public class ServiceInstancesResponse {
+
+ RequestReferences requestReferences;
+
+ public RequestReferences getRequestReferences() {
+ return requestReferences;
+ }
+
+ public void setRequestReferences(RequestReferences requestReferences) {
+ this.requestReferences = requestReferences;
+ }
+
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/SubscriberInfo.java b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/SubscriberInfo.java
new file mode 100644
index 0000000000..47cb1f2d26
--- /dev/null
+++ b/common/src/main/java/org/openecomp/mso/serviceinstancebeans/SubscriberInfo.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "subscriberInfo")
+@JsonInclude(Include.NON_DEFAULT)
+public class SubscriberInfo implements Serializable {
+
+ private static final long serialVersionUID = -1750701712128104652L;
+ @JsonProperty("globalSubscriberId")
+ protected String globalSubscriberId;
+ @JsonProperty("subscriberName")
+ protected String subscriberName;
+
+ /**
+ * Gets the value of the globalSubscriberId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ /**
+ * Sets the value of the globalSubscriberId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setGlobalSubscriberId(String value) {
+ this.globalSubscriberId = value;
+ }
+
+ /**
+ * Gets the value of the subscriberName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ /**
+ * Sets the value of the subscriberName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSubscriberName(String value) {
+ this.subscriberName = value;
+ }
+
+ @Override
+ public String toString() {
+ return "SubscriberInfo [globalSubscriberId=" + globalSubscriberId
+ + ", subscriberName=" + subscriberName + "]";
+ }
+
+}
diff --git a/common/src/main/resources/ASDC.properties b/common/src/main/resources/ASDC.properties
index 5f4f0baa6c..f0f38a5a46 100644
--- a/common/src/main/resources/ASDC.properties
+++ b/common/src/main/resources/ASDC.properties
@@ -182,6 +182,11 @@ ASDC_INIT_ASDC_CLIENT_SUC=\
ASDC Controller successfully initialized|\
No resolution needed|\
ASDC client initialized
+ASDC_PROPERTIES_LOAD_SUCCESS=\
+ MSO-ASDC-5332I|\
+ Properties file loaded successfully|\
+ No resolution needed|\
+ Properties file loaded successfully
ASDC_GENERAL_EXCEPTION_ARG=\
MSO-ASDC-9300E|\
Exception: {0}|\
diff --git a/common/src/main/resources/dmaap/default-consumer.properties b/common/src/main/resources/dmaap/default-consumer.properties
new file mode 100644
index 0000000000..4d2ecce068
--- /dev/null
+++ b/common/src/main/resources/dmaap/default-consumer.properties
@@ -0,0 +1,28 @@
+TransportType=HTTPAAF
+Latitude=47.778998
+Longitude=-122.182883
+Version=1.0
+ServiceName=dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/events
+Environment=TEST
+Partner=BOT_R
+routeOffer=MR1
+SubContextPath=/events/
+Protocol=http
+MethodType=GET
+contenttype=application/json
+host=http://olsd005.wnsnet.attws.com:3904
+partition=MSO
+maxBatchSize=100
+maxAgeMs=250
+group=MSO
+id=dev
+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
+AFT_ENVIRONMENT=AFTUAT
+AFT_DME2_EP_CONN_TIMEOUT=15000
+AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000
+AFT_DME2_EP_READ_TIMEOUT_MS=50000
+sessionstickinessrequired=no
+DME2preferredRouterFilePath=src/main/resources/dmaap/empty.txt
+MessageSentThreadOccurance=50
diff --git a/common/src/main/resources/dmaap/default-publisher.properties b/common/src/main/resources/dmaap/default-publisher.properties
new file mode 100644
index 0000000000..af1b481165
--- /dev/null
+++ b/common/src/main/resources/dmaap/default-publisher.properties
@@ -0,0 +1,28 @@
+TransportType=HTTPAAF
+Latitude=47.778998
+Longitude=-122.182883
+Version=1.0
+ServiceName=dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/events
+Environment=TEST
+Partner=BOT_R
+routeOffer=MR1
+SubContextPath=/events/
+Protocol=http
+MethodType=POST
+contenttype=application/json
+host=http://olsd005.wnsnet.attws.com:3904
+partition=MSO
+maxBatchSize=100
+maxAgeMs=250
+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
+AFT_ENVIRONMENT=AFTUAT
+AFT_DME2_EP_CONN_TIMEOUT=15000
+AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000
+AFT_DME2_EP_READ_TIMEOUT_MS=50000
+sessionstickinessrequired=no
+DME2preferredRouterFilePath=src/main/resources/dmaap/empty.txt
+MessageSentThreadOccurance=50
+
+
diff --git a/common/src/main/resources/dmaap/empty.txt b/common/src/main/resources/dmaap/empty.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/common/src/main/resources/dmaap/empty.txt
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java
index 473f5320df..1122c90438 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java
+++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java
@@ -27,11 +27,13 @@ import org.openecomp.mso.logger.MsoLogger.ErrorCode;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.MDC;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -40,6 +42,7 @@ import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
+
/**
* This class implements all test methods of the MsoLogger features.
*
@@ -49,249 +52,238 @@ public class MsoLoggerTest {
static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- /**
- * This method is called before any test occurs.
- * It creates a fake tree from scratch
- */
- @BeforeClass
- public static final void prepare () {
-
- }
-
- @Before
- public final void cleanErrorLogFile() throws FileNotFoundException {
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log";
- PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
+ /**
+ * This method is called before any test occurs. It creates a fake tree from
+ * scratch
+ */
+ @BeforeClass
+ public static final void prepare() {
+
+ }
+
+ @Before
+ public final void cleanErrorLogFile() throws FileNotFoundException {
+ URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes"))
+ + "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log";
+ PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
asdcConfigFileWriter.print("");
asdcConfigFileWriter.flush();
asdcConfigFileWriter.close();
- }
-
- @Before
- public final void cleanMetricLogFile() throws FileNotFoundException {
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log";
- PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
+ }
+
+ @Before
+ public final void cleanMetricLogFile() throws FileNotFoundException {
+ URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes"))
+ + "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log";
+ PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
asdcConfigFileWriter.print("");
asdcConfigFileWriter.flush();
asdcConfigFileWriter.close();
- }
-
- @Before
- public final void cleanAuditLogFile() throws FileNotFoundException {
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/auditjbo ss.server.name_IS_UNDEFINED.log";
- PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
+ }
+
+ @Before
+ public final void cleanAuditLogFile() throws FileNotFoundException {
+ URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes"))
+ + "/MSO/Test/auditjbo ss.server.name_IS_UNDEFINED.log";
+ PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
asdcConfigFileWriter.print("");
asdcConfigFileWriter.flush();
asdcConfigFileWriter.close();
- }
+ }
-
-
- /**
- * This method implements a test of getSeverifyLevel method.
- */
+ /**
+ * This method implements a test of getSeverifyLevel method.
+ */
@Test
- public final void testGetSeverityLevel () {
+ public final void testGetSeverityLevel() {
try {
- String levelInfo = (String)invokePriveMethod("getSeverityLevel", "INFO");
- Assert.assertEquals (levelInfo, "0");
+ String levelInfo = (String) invokePriveMethod("getSeverityLevel", "INFO");
+ Assert.assertEquals(levelInfo, "0");
- String levelWarn = (String)invokePriveMethod("getSeverityLevel", "WARN");
- Assert.assertEquals (levelWarn, "1");
+ String levelWarn = (String) invokePriveMethod("getSeverityLevel", "WARN");
+ Assert.assertEquals(levelWarn, "1");
- String levelERROR = (String)invokePriveMethod("getSeverityLevel", "ERROR");
- Assert.assertEquals (levelERROR, "2");
+ String levelERROR = (String) invokePriveMethod("getSeverityLevel", "ERROR");
+ Assert.assertEquals(levelERROR, "2");
- String levelDEBUG = (String)invokePriveMethod("getSeverityLevel", "DEBUG");
- Assert.assertEquals (levelDEBUG, "0");
+ String levelDEBUG = (String) invokePriveMethod("getSeverityLevel", "DEBUG");
+ Assert.assertEquals(levelDEBUG, "0");
- String levelFATAL = (String)invokePriveMethod("getSeverityLevel", "FATAL");
- Assert.assertEquals (levelFATAL, "3");
+ String levelFATAL = (String) invokePriveMethod("getSeverityLevel", "FATAL");
+ Assert.assertEquals(levelFATAL, "3");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- }
+ }
- /**
- * This method implements a test of getFinalServiceName method.
- */
+ /**
+ * This method implements a test of getFinalServiceName method.
+ */
@Test
- public final void testGetFinalServiceName () {
+ public final void testGetFinalServiceName() {
try {
- String serviceName1 = (String)invokePriveMethod("getFinalServiceName", "testServiceName1");
+ String serviceName1 = (String) invokePriveMethod("getFinalServiceName", "testServiceName1");
Assert.assertEquals(serviceName1, "testServiceName1");
MsoLogger.setServiceName("testServiceName2");
- String serviceName2 = (String)invokePriveMethod("getFinalServiceName", "testServiceName1");
+ String serviceName2 = (String) invokePriveMethod("getFinalServiceName", "testServiceName1");
Assert.assertEquals(serviceName2, "testServiceName1");
String msgNull = null;
- String serviceName3 = (String)invokePriveMethod("getFinalServiceName", msgNull);
+ String serviceName3 = (String) invokePriveMethod("getFinalServiceName", msgNull);
Assert.assertEquals(serviceName3, "testServiceName2");
MsoLogger.resetServiceName();
- String serviceName4 = (String)invokePriveMethod("getFinalServiceName", msgNull);
+ String serviceName4 = (String) invokePriveMethod("getFinalServiceName", msgNull);
Assert.assertEquals(serviceName4, "invoke0");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- }
+ }
@Test
- public final void testPrepareMsg () {
+ public final void testPrepareMsg() {
try {
String msgNull = null;
MDC.clear();
invokePrepareMsg("INFO", null, null);
- Assert.assertTrue (MDC.get(MsoLogger.REQUEST_ID).equals("trace-#") && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("trace-#") && MDC.get(MsoLogger.SERVICE_NAME).equals("invoke0")
- && MDC.get(MsoLogger.TIMER) == null && MDC.get(MsoLogger.ALERT_SEVERITY).equals("0"));
+ Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("trace-#")
+ && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("trace-#")
+ && MDC.get(MsoLogger.SERVICE_NAME).equals("invoke0") && MDC.get(MsoLogger.TIMER) == null
+ && MDC.get(MsoLogger.ALERT_SEVERITY).equals("0"));
MsoLogger.setLoggerParameters("testRemoteIp", "testUser");
MsoLogger.setLogContext("testReqId", "testSvcId");
invokePrepareMsg("ERROR", "testServiceName3", null);
- Assert.assertTrue (MDC.get(MsoLogger.REQUEST_ID).equals("testReqId") && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId") && MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName3")
- && MDC.get(MsoLogger.TIMER) == null && MDC.get(MsoLogger.ALERT_SEVERITY).equals("2") );
+ Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("testReqId")
+ && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId")
+ && MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName3") && MDC.get(MsoLogger.TIMER) == null
+ && MDC.get(MsoLogger.ALERT_SEVERITY).equals("2"));
MsoLogger.setServiceName("testServiceName2");
invokePrepareMsg("WARN", msgNull, msgNull);
- Assert.assertTrue (MDC.get(MsoLogger.REQUEST_ID).equals("testReqId") && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId") && MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName2")
- && MDC.get(MsoLogger.TIMER) == null && MDC.get(MsoLogger.ALERT_SEVERITY).equals("1"));
+ Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("testReqId")
+ && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId")
+ && MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName2") && MDC.get(MsoLogger.TIMER) == null
+ && MDC.get(MsoLogger.ALERT_SEVERITY).equals("1"));
- MDC.clear ();
- MsoRequest msoRequest = new MsoRequest ();
- msoRequest.setRequestId ("reqId2");
- msoRequest.setServiceInstanceId ("servId2");
- MsoLogger.setLogContext (msoRequest);
- invokePrepareMsg("FATAL", null, "123");
- Assert.assertTrue (MDC.get(MsoLogger.REQUEST_ID).equals("reqId2") && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("servId2") && MDC.get(MsoLogger.TIMER).equals("123") && MDC.get(MsoLogger.ALERT_SEVERITY).equals("3"));
+ MDC.clear();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("reqId2");
+ msoRequest.setServiceInstanceId("servId2");
+ MsoLogger.setLogContext(msoRequest);
+ invokePrepareMsg("FATAL", null, "123");
+ Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("reqId2")
+ && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("servId2")
+ && MDC.get(MsoLogger.TIMER).equals("123") && MDC.get(MsoLogger.ALERT_SEVERITY).equals("3"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- }
- /**
- * This method implements a test of log methods
- */
+ }
+
+ /**
+ * This method implements a test of log methods
+ */
@Test
- public final void testLogMethods () {
+ @Ignore
+ public final void testLogMethods() {
try {
MDC.clear();
MsoLogger.setLogContext("reqId2", "servId2");
MsoLogger.setServiceName("MSO.testServiceName");
- msoLogger.info (MessageEnum.LOGGER_UPDATE_SUC, "testLogger", "INFO", "DEBUG", "target entity", "target service");
- msoLogger.warn (MessageEnum.GENERAL_WARNING, "warning test", "", "", MsoLogger.ErrorCode.UnknownError, "warning test");
- msoLogger.error (MessageEnum.GENERAL_EXCEPTION, "target entity", "target service", MsoLogger.ErrorCode.UnknownError, "error test");
-
- //Fetch from the error log
+ msoLogger.info(MessageEnum.LOGGER_UPDATE_SUC, "testLogger", "INFO", "DEBUG", "target entity",
+ "target service");
+ msoLogger.warn(MessageEnum.GENERAL_WARNING, "warning test", "", "", MsoLogger.ErrorCode.UnknownError,
+ "warning test");
+ msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "target entity", "target service",
+ MsoLogger.ErrorCode.UnknownError, "error test");
+
+ // Fetch from the error log
URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log";
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes"))
+ + "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log";
Path filePath = new File(logFile).toPath();
Charset charset = Charset.defaultCharset();
List<String> stringList = Files.readAllLines(filePath, charset);
- String[] stringArray = stringList.toArray(new String[]{});
+ String[] stringArray = stringList.toArray(new String[] {});
int size = stringArray.length;
- Assert.assertTrue(stringArray[size-3].contains("|reqId2|main|MSO.testServiceName||target entity|target service|INFO|null||") && stringArray[size-3].contains("||MSO-GENERAL-5408I Successfully update Logger: testLogger from level INFO to level DEBUG"));
- Assert.assertTrue(stringArray[size-2].contains("|reqId2|main|MSO.testServiceName||||WARN|UnknownError|warning test|") && stringArray[size-2].contains("|MSO-GENERAL-5401W WARNING: warning test"));
- Assert.assertTrue(stringArray[size-1].contains("|reqId2|main|MSO.testServiceName||target entity|target service|ERROR|UnknownError|error test|") && stringArray[size-1].contains("|MSO-GENERAL-9401E Exception encountered"));
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- /**
- * This method implements a test of recordMetricEvent method.
- */
- @Test
- public final void testRecordMetricEvent () {
- try {
- MDC.clear();
- MsoLogger.setLogContext("reqId", "servId");
- msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful", "VNF" , "createVNF", null);
- MDC.put (MsoLogger.REMOTE_HOST, "127.0.0.1");
- MDC.put (MsoLogger.PARTNERNAME, "testUser");
- msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Exception", "SDNC", "removeSDNC", "testVNF");
-
- //Fetch from the metric log
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log";
-
- Path filePath = new File(logFile).toPath();
- Charset charset = Charset.defaultCharset();
- List<String> stringList = Files.readAllLines(filePath, charset);
- String[] stringArray = stringList.toArray(new String[]{});
- msoLogger.error (MessageEnum.GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.UnknownError, "test error msg");
-
- Assert.assertTrue(stringArray[0].contains("|reqId|servId|main||testRecordMetricEvent||VNF|createVNF|COMPLETE|0|Successful|Test UUID as JBoss not found|INFO|0|"));
- // count the occurance of symbol "|"
- Assert.assertTrue ((stringArray[0].length() - stringArray[0].replace("|", "").length()) == 28);
- Assert.assertTrue(stringArray[1].contains("|reqId|servId|main||testRecordMetricEvent|testUser|SDNC|removeSDNC|ERROR|501|Exception|Test UUID as JBoss not found|INFO|0|") && stringArray[1].contains("|127.0.0.1||||testVNF|||||"));
- Assert.assertTrue ((stringArray[1].length() - stringArray[1].replace("|", "").length()) == 28);
+ Assert.assertTrue(stringArray[size - 3]
+ .contains("|reqId2|main|MSO.testServiceName||target entity|target service|INFO|null||")
+ && stringArray[size - 3].contains(
+ "||MSO-GENERAL-5408I Successfully update Logger: testLogger from level INFO to level DEBUG"));
+ Assert.assertTrue(stringArray[size - 2]
+ .contains("|reqId2|main|MSO.testServiceName||||WARN|UnknownError|warning test|")
+ && stringArray[size - 2].contains("|MSO-GENERAL-5401W WARNING: warning test"));
+ Assert.assertTrue(stringArray[size - 1].contains(
+ "|reqId2|main|MSO.testServiceName||target entity|target service|ERROR|UnknownError|error test|")
+ && stringArray[size - 1].contains("|MSO-GENERAL-9401E Exception encountered"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- }
+ }
- /**
- * This method implements a test of testRecordAuditEvent method.
- */
+ /**
+ * This method implements a test of recordMetricEvent method.
+ *
+ * @throws IOException
+ */
@Test
- public final void testRecordAuditEvent () {
-
- try {
-
- MDC.clear();
- MsoLogger.setLogContext("reqId", "servId");
- msoLogger.recordAuditEvent(123456789L, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- MDC.put (MsoLogger.REMOTE_HOST, "127.0.0.1");
- MDC.put (MsoLogger.PARTNERNAME, "testUser");
- msoLogger.recordAuditEvent(123456789L, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Exception");
-
- //Fetch from the metric log
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) + "/MSO/Test/auditjboss.server.name_IS_UNDEFINED.log";
-
- Path filePath = new File(logFile).toPath();
- Charset charset = Charset.defaultCharset();
- List<String> stringList = Files.readAllLines(filePath, charset);
- String[] stringArray = stringList.toArray(new String[]{});
- msoLogger.error (MessageEnum.GENERAL_EXCEPTION, "", "", ErrorCode.UnknownError, "log error");
-
- Assert.assertTrue (stringArray[0].contains("|reqId|servId|main||testRecordAuditEvent||COMPLETE|0|Successful|Test UUID as JBoss not found|INFO|0|"));
- // count the occurance of symbol "|"
- Assert.assertTrue ((stringArray[0].length() - stringArray[0].replace("|", "").length()) == 25);
- Assert.assertTrue (stringArray[1].contains("|reqId|servId|main||testRecordAuditEvent|testUser|ERROR|501|Exception|Test UUID as JBoss not found|INFO|0|") && stringArray[1].contains("|127.0.0.1||||||||"));
- Assert.assertTrue ((stringArray[1].length() - stringArray[1].replace("|", "").length()) == 25);
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
-
-
-
- // User reflection to invoke to avoid change the publicity of the method
- private static String invokePrepareMsg (String arg1, String arg2, String arg3) {
- Method method;
+ @Ignore
+ public final void testRecordMetricEvent() throws IOException {
+ MDC.clear();
+ MsoLogger.setLogContext("reqId", "servId");
+ msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful",
+ "VNF", "createVNF", null);
+ MDC.put(MsoLogger.REMOTE_HOST, "127.0.0.1");
+ MDC.put(MsoLogger.PARTNERNAME, "testUser");
+ msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable,
+ "Exception", "SDNC", "removeSDNC", "testVNF");
+
+ // Fetch from the metric log
+ URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
+ String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes"))
+ + "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log";
+
+ Path filePath = new File(logFile).toPath();
+ Charset charset = Charset.defaultCharset();
+ List<String> stringList = Files.readAllLines(filePath, charset);
+ String[] stringArray = stringList.toArray(new String[] {});
+ msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.UnknownError, "test error msg");
+
+ Assert.assertTrue(stringArray[0]
+ .contains("|reqId|servId|main||testRecordMetricEvent||VNF|createVNF|COMPLETE|0|Successful|"));
+ // count the occurance of symbol "|"
+ Assert.assertTrue((stringArray[0].length() - stringArray[0].replace("|", "").length()) == 28);
+ Assert.assertTrue(stringArray[1]
+ .contains("|reqId|servId|main||testRecordMetricEvent|testUser|SDNC|removeSDNC|ERROR|501|Exception|")
+ && stringArray[1].contains("|127.0.0.1||||testVNF|||||"));
+ Assert.assertTrue((stringArray[1].length() - stringArray[1].replace("|", "").length()) == 28);
+ }
+
+ /**
+ * This method implements a test of testRecordAuditEvent method.
+ */
+
+ // User reflection to invoke to avoid change the publicity of the method
+ private static String invokePrepareMsg(String arg1, String arg2, String arg3) {
+ Method method;
try {
method = MsoLogger.class.getDeclaredMethod("prepareMsg", String.class, String.class, String.class);
method.setAccessible(true);
- return (String)method.invoke(msoLogger, arg1, arg2, arg3);
+ return (String) method.invoke(msoLogger, arg1, arg2, arg3);
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -308,16 +300,16 @@ public class MsoLoggerTest {
// TODO Auto-generated catch block
e.printStackTrace();
}
- return null;
- }
+ return null;
+ }
- // User reflection to invoke to avoid change the publicity of the method
- private static Object invokePriveMethod (String methodName, String arg) {
- Method method;
+ // User reflection to invoke to avoid change the publicity of the method
+ private static Object invokePriveMethod(String methodName, String arg) {
+ Method method;
try {
method = MsoLogger.class.getDeclaredMethod(methodName, String.class);
method.setAccessible(true);
- return method.invoke(msoLogger, arg);
+ return method.invoke(msoLogger, arg);
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -334,6 +326,6 @@ public class MsoLoggerTest {
// TODO Auto-generated catch block
e.printStackTrace();
}
- return null;
- }
+ return null;
+ }
}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java
new file mode 100644
index 0000000000..da63b27efb
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java
@@ -0,0 +1,75 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+
+import java.util.UUID;
+
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.openecomp.mso.client.aai.entities.uri.AAIUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.openecomp.mso.serviceinstancebeans.ModelInfo;
+import org.openecomp.mso.serviceinstancebeans.RequestDetails;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class AAIConfigurationTest {
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
+
+ @Ignore
+ @Test
+ public void verifyCreate() {
+ AAIConfigurationClient aaiConfiguration = new AAIConfigurationClient();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelInvariantId("testInvariantID");
+ modelInfo.setModelVersionId("testVersionID");
+ modelInfo.setModelCustomizationId("testCustomizationID");
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setModelInfo(modelInfo);
+ String configurationType = "test";
+ String configurationSubType = "test";
+ aaiConfiguration.createConfiguration(requestDetails, UUID.randomUUID().toString(), configurationType, configurationSubType);
+ }
+
+ @Test
+ public void verifyNotExists() {
+ AAIUri path = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "test2");
+ wireMockRule.stubFor(get(
+ urlPathEqualTo("/aai/v11" + path.build()))
+ .willReturn(
+ aResponse()
+ .withHeader("Content-Type", "text/plain")
+ .withBody("hello")
+ .withStatus(404)));
+ AAIConfigurationClient aaiConfiguration = new AAIConfigurationClient();
+ boolean result = aaiConfiguration.configurationExists("test2");
+ assertEquals("path not found", false, result);
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIExceptionMapperTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIExceptionMapperTest.java
new file mode 100644
index 0000000000..625e281792
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/AAIExceptionMapperTest.java
@@ -0,0 +1,63 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.mso.client.aai.entities.AAIError;
+
+public class AAIExceptionMapperTest {
+
+ @Mock private AAIError errorObj;
+
+ @Before
+ public void init() {
+ MockitoAnnotations.initMocks(this);
+ }
+ @Test
+ public void nestedReplace() {
+ String error = "Error %1 on %2";
+ List<String> list = Arrays.asList("PUT", "hello %1");
+ AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
+ String result = formatter.fillInTemplate(error, list);
+ assertEquals("equal", "Error PUT on hello PUT", result);
+
+ }
+
+ @Test
+ public void noReplace() {
+ String error = "Error";
+ List<String> list = new ArrayList<>();
+ AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
+ String result = formatter.fillInTemplate(error, list);
+ assertEquals("equal", "Error", result);
+
+ }
+
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIObjectTypeTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIObjectTypeTest.java
new file mode 100644
index 0000000000..c8f6299d81
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/AAIObjectTypeTest.java
@@ -0,0 +1,39 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class AAIObjectTypeTest {
+
+ @Test
+ public void verifyDefaultCase() {
+ assertEquals("default removed for tenant", "tenant", AAIObjectType.DEFAULT_TENANT.typeName());
+ assertEquals("default removed for cloud-region", "cloud-region", AAIObjectType.DEFAULT_CLOUD_REGION.typeName());
+ }
+
+ @Test
+ public void verifyRegularCase() {
+ assertEquals("default removed for tenant", "allotted-resource", AAIObjectType.ALLOTTED_RESOURCE.typeName());
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java
new file mode 100644
index 0000000000..b6b01b384a
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.NoSuchAlgorithmException;
+import java.util.List;
+import java.util.UUID;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.aai.domain.yang.Pserver;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+public class AAIPServerTest {
+
+ @Test
+ public void pserverTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
+ AAIRestClientImpl client = new AAIRestClientImpl();
+ String json = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/aai/pserver.json")));
+ List<Pserver> list = client.getListOfPservers(json);
+
+ assertEquals("", list.get(0).getHostname(), "test");
+ }
+
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ public void pserverActualTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
+ AAIRestClientImpl client = new AAIRestClientImpl();
+ List<Pserver> list = client.getPhysicalServerByVnfId("d946afed-8ebe-4c5d-9665-54fcc043b8e7", UUID.randomUUID().toString());
+ assertEquals("", list.size(), 0);
+ }
+
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java
new file mode 100644
index 0000000000..daf8130cd4
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java
@@ -0,0 +1,96 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+public class AAIResourcesClientTest {
+
+
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
+
+ @Test
+ public void verifyNotExists() {
+ AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
+ wireMockRule.stubFor(get(
+ urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString()))
+ .willReturn(
+ aResponse()
+ .withHeader("Content-Type", "text/plain")
+ .withBody("hello")
+ .withStatus(404)));
+ AAIResourcesClient client = new AAIResourcesClient();
+ boolean result = client.exists(path);
+ assertEquals("path not found", false, result);
+ }
+
+ @Test
+ public void verifyDelete() {
+ AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
+ wireMockRule.stubFor(get(
+ urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString()))
+ .willReturn(
+ aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("aai/resources/mockObject.json")
+ .withStatus(200)));
+ wireMockRule.stubFor(delete(
+ urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString()))
+ .withQueryParam("resource-version", equalTo("1234"))
+ .willReturn(
+ aResponse()
+ .withStatus(204)));
+ AAIResourcesClient client = new AAIResourcesClient();
+ client.delete(path);
+ }
+
+ @Test
+ public void verifyConnect() {
+ AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
+ AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
+ wireMockRule.stubFor(put(
+ urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString() + "/relationship-list/relationship"))
+ .willReturn(
+ aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withStatus(200)));
+
+ AAIResourceUri pathClone = path.clone();
+ AAIResourcesClient client = new AAIResourcesClient();
+ client.connect(path, path2);
+ assertEquals("uri not modified", pathClone.build().toString(), path.build().toString());
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.java
new file mode 100644
index 0000000000..1abb940f6e
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.java
@@ -0,0 +1,83 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Map;
+import java.util.Optional;
+
+import org.junit.Test;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+public class AAITransactionalClientTest {
+
+
+ private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/bulkprocess/";
+
+ @Test
+ public void run() throws IOException {
+
+
+ AAIResourcesClient client = new AAIResourcesClient();
+ AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
+ AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test2");
+ AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
+ AAIResourceUri uriD = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test4");
+ AAIResourceUri uriE = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test5");
+ AAIResourceUri uriF = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test6");
+
+ AAIResourceUri uriAClone = uriA.clone();
+ AAITransactionalClient transactions = client
+ .beginTransaction().connect(uriA, uriB).connect(uriC, uriD)
+ .beginNewTransaction().connect(uriE, uriF);
+ ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
+ mapper.enable(SerializationFeature.INDENT_OUTPUT);
+ String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
+ Map<String, Object> map1 = mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>(){});
+ Map<String, Object> map2 = mapper.readValue(getJson("test-request.json"), new TypeReference<Map<String, Object>>(){});
+ assertEquals("payloads are equal", map2, map1);
+ assertEquals("uri not manipulated", uriAClone.build().toString(), uriA.build().toString());
+ }
+
+ @Test
+ public void verifyResponse() throws IOException {
+ AAIResourcesClient client = new AAIResourcesClient();
+ AAITransactionalClient transactions = client
+ .beginTransaction();
+ assertEquals("success status", Optional.empty(), transactions.locateErrorMessages(getJson("response-success.json")));
+ assertEquals(transactions.locateErrorMessages(getJson("response-failure.json")).get(), "another error message\nmy great error");
+
+
+ }
+
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename)));
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIURITest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIURITest.java
new file mode 100644
index 0000000000..366c587b11
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/AAIURITest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.junit.Test;
+import org.openecomp.mso.client.aai.entities.uri.AAIUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+
+public class AAIURITest {
+
+
+
+
+ @Test
+ public void verifyTemplateReplacement() {
+ final String id = "test1";
+ AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, id);
+ String manualReplace = AAIObjectType.CONFIGURATION.toString().replaceAll("\\{configuration-id\\}", id);
+ assertEquals("uri template replaced", aaiUri.build(), UriBuilder.fromPath(manualReplace).build());
+
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java
new file mode 100644
index 0000000000..12034e0eea
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java
@@ -0,0 +1,98 @@
+/*-
+ * ============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.openecomp.mso.client.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Pserver;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIValidatorTest {
+
+ @Mock
+ protected AAIRestClientI client;
+ String vnfName = "testVnf";
+ String uuid = "UUID";
+ AAIValidatorImpl validator;
+
+ @Before
+ public void init(){
+ validator = new AAIValidatorImpl();
+ validator.setClient(client);
+ }
+
+ public List<Pserver> getPservers(boolean locked){
+ Pserver pserver = new Pserver();
+ pserver.setInMaint(locked);
+ List<Pserver> pservers = new ArrayList<Pserver>();
+ pservers.add(pserver);
+ return pservers;
+ }
+
+ public GenericVnf createGenericVnfs(boolean locked){
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setInMaint(locked);
+ return genericVnf;
+ }
+
+ @Test
+ public void test_IsPhysicalServerLocked_True() throws IOException{
+ when(client.getPhysicalServerByVnfId(vnfName,uuid)).thenReturn(getPservers(true));
+ boolean locked = validator.isPhysicalServerLocked(vnfName, uuid);
+ assertEquals(true, locked);
+ }
+
+ @Test
+ public void test_IsPhysicalServerLocked_False() throws JsonParseException, JsonMappingException, UnsupportedEncodingException, IOException {
+ when(client.getPhysicalServerByVnfId(vnfName,uuid)).thenReturn(getPservers(false));
+ boolean locked = validator.isPhysicalServerLocked(vnfName, uuid);
+ assertEquals(false, locked);
+ }
+
+ @Test
+ public void test_IsVNFLocked_False() throws Exception{
+ when(client.getVnfByName(vnfName,uuid)).thenReturn(createGenericVnfs(false));
+ boolean locked = validator.isVNFLocked(vnfName, uuid);
+ assertEquals(false, locked);
+ }
+
+ @Test
+ public void test_IsVNFLocked_True() throws Exception{
+ when(client.getVnfByName(vnfName,uuid)).thenReturn(createGenericVnfs(true));
+ boolean locked = validator.isVNFLocked(vnfName, uuid);
+ assertEquals(true,locked );
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/RelationshipsTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/RelationshipsTest.java
new file mode 100644
index 0000000000..b2c1f9ed64
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/entities/RelationshipsTest.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Test;
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+
+public class RelationshipsTest {
+
+ private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/";
+
+ @Test
+ public void run() throws IOException {
+ final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "e2e-complex.json")));
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(content);
+ Relationships relationships = wrapper.getRelationships().get();
+
+ List<AAIResourceUri> test = relationships.getRelatedAAIUris(AAIObjectType.VCE);
+
+ System.out.println(test.get(0).build());
+ List<AAIResourceUri> uris = Arrays.asList(
+ AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"),
+ AAIUriFactory.createResourceUri(AAIObjectType.VCE, "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"),
+ AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a2935fa9-b743-49f4-9813-a127f13c4e93"),
+ AAIUriFactory.createResourceUri(AAIObjectType.VCE, "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4"));
+
+
+ assertTrue(uris.containsAll(test) && test.containsAll(uris));
+
+ }
+
+} \ No newline at end of file
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactoryTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactoryTest.java
new file mode 100644
index 0000000000..a62d4b89c6
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactoryTest.java
@@ -0,0 +1,40 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openecomp.mso.client.aai.AAIObjectType;
+
+public class AAIUriFactoryTest {
+
+
+
+ @Test
+ public void automaticallyEncodeUriTemplateValue() {
+
+ AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+
+ String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
+ assertEquals(expected, uri.build().toString());
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUriTest.java
new file mode 100644
index 0000000000..12ca0a2709
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUriTest.java
@@ -0,0 +1,194 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Optional;
+
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.core.UriBuilder;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.Matchers;
+import org.openecomp.mso.client.aai.AAIObjectType;
+import org.openecomp.mso.client.aai.AAIQueryClient;
+import org.openecomp.mso.client.aai.Format;
+import org.openecomp.mso.client.aai.entities.CustomQuery;
+import org.openecomp.mso.client.aai.exceptions.AAIPayloadException;
+import org.openecomp.mso.client.aai.exceptions.AAIUriComputationException;
+import org.openecomp.mso.client.aai.exceptions.AAIUriNotFoundException;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class ServiceInstanceUriTest {
+
+ private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/";
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
+
+ @Rule
+ public final ExpectedException exception = ExpectedException.none();
+
+ @Test
+ public void found() throws IOException {
+ final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json")));
+
+ ServiceInstanceUri instance = new ServiceInstanceUri("key3");
+ final Optional<String> result = instance.extractRelatedLink(content);
+ final String expected = "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
+ assertEquals("result is equal", expected, result.get());
+
+ }
+
+ @Test
+ public void oneKey() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException {
+
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+ ServiceInstanceUri spy = spy(instance);
+ doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getSerivceInstance(any(Object.class));
+
+ final URI result = spy.build();
+ final URI expected = UriBuilder.fromPath("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").build();
+ assertEquals("result is equal", expected, result);
+
+ }
+
+ @Test
+ public void oneKeyQueryParams() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException {
+
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+ ServiceInstanceUri spy = spy(instance);
+ doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getSerivceInstance(any(Object.class));
+
+ final URI result = spy.resourceVersion("1234").build();
+ final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234").build();
+ assertEquals("result is equal", expected, result);
+
+ }
+
+ @Test
+ public void oneKeyEncoded() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException {
+
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+ ServiceInstanceUri spy = spy(instance);
+ doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space").when(spy).getSerivceInstance(any(Object.class));
+
+ final URI result = spy.build();
+ final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space").build();
+ assertEquals("result is equal", expected, result);
+
+ }
+
+ @Test
+ public void oneKeyGetKeys() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException {
+
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+ ServiceInstanceUri spy = spy(instance);
+ doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%28space").when(spy).getSerivceInstance(any(Object.class));
+
+ assertThat(spy.getURIKeys().values(), contains("key1", "key2", "key3(space"));
+
+ }
+ @Test
+ public void oneKeyClone() throws AAIUriNotFoundException, AAIPayloadException {
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+ ServiceInstanceUri spy = spy(instance);
+ String uri = "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
+ doReturn(uri).when(spy).getSerivceInstance(any(Object.class));
+ doReturn(Optional.of(uri)).when(spy).getCachedValue();
+ final URI result = spy.resourceVersion("1234").clone().build();
+ final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234").build();
+ assertEquals("result is equal", expected, result);
+ }
+
+ @Test
+ public void threeKey() throws IOException {
+
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3");
+ final URI result = instance.build();
+ final URI expected = UriBuilder.fromPath("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").build();
+ assertEquals("result is equal", expected, result);
+
+ }
+
+ @Test
+ public void notfound() throws IOException, AAIUriNotFoundException, AAIPayloadException {
+ final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "empty-query-result.json")));
+
+ ServiceInstanceUri instance = new ServiceInstanceUri("key3");
+ ServiceInstanceUri spy = spy(instance);
+ AAIQueryClient mockQueryClient = mock(AAIQueryClient.class);
+ when(mockQueryClient.query(any(Format.class), any(CustomQuery.class))).thenReturn(content);
+ when(spy.getQueryClient()).thenReturn(mockQueryClient);
+ exception.expect(AAIUriComputationException.class);
+ spy.build();
+
+ }
+
+ @Test
+ public void cloneTest() {
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3");
+ final URI result = instance.build();
+ final URI result2 = instance.clone().queryParam("something", "new").build();
+ assertEquals("uris are not equal", false, result.toString().equals(result2.toString()));
+
+ }
+
+ @Test
+ public void noVertexFound() throws AAIUriNotFoundException, AAIPayloadException {
+ ServiceInstanceUri instance = new ServiceInstanceUri("key3");
+ ServiceInstanceUri spy = spy(instance);
+ stubFor(put(urlMatching("/aai/v[0-9]+/query.*"))
+ .withRequestBody(containing("key3"))
+ .willReturn(aResponse()
+ .withStatus(400)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("")));
+ exception.expect(AAIUriComputationException.class);
+ exception.expectMessage(containsString("NotFoundException"));
+ spy.build();
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriFromUriTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriFromUriTest.java
new file mode 100644
index 0000000000..6e3ab64108
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriFromUriTest.java
@@ -0,0 +1,59 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.junit.Test;
+import org.openecomp.mso.client.aai.AAIObjectType;
+
+public class SimpleUriFromUriTest {
+
+
+
+ @Test
+ public void removeHost() {
+
+ AAIUri uri = new SimpleUri(AAIObjectType.UNKNOWN, UriBuilder.fromUri("https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build());
+
+ assertEquals("root and version removed", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString());
+
+ }
+ @Test
+ public void noChange() {
+
+ AAIUri uri = new SimpleUri(AAIObjectType.UNKNOWN, UriBuilder.fromUri("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build());
+
+ assertEquals("no change", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString());
+
+ }
+
+ @Test
+ public void encodingPreserved() {
+
+ AAIUri uri = new SimpleUri(AAIObjectType.UNKNOWN, UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
+
+ assertEquals("encoding preserved", "/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString());
+
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriTest.java
new file mode 100644
index 0000000000..f4fe216cd2
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriTest.java
@@ -0,0 +1,69 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Map;
+
+import org.junit.Test;
+import org.openecomp.mso.client.aai.AAIObjectPlurals;
+import org.openecomp.mso.client.aai.AAIObjectType;
+
+public class SimpleUriTest {
+
+
+
+ @Test
+ public void relatedToTestPlural() {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
+ uri.relatedTo(AAIObjectPlurals.PSERVER);
+ String uriOutput = uri.build().toString();
+ assertEquals(true, uriOutput.contains("related-to"));
+ }
+
+ @Test
+ public void relatedToTestSingular() {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
+ uri.relatedTo(AAIObjectType.PSERVER, "test2");
+ String uriOutput = uri.build().toString();
+ assertEquals(true, uriOutput.contains("related-to"));
+ }
+
+ @Test
+ public void cloneTest() {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
+ AAIResourceUri cloned = uri.clone();
+ Map<String,String> keys = cloned.getURIKeys();
+ assertThat(keys.values(), contains("test1"));
+ }
+
+ @Test
+ public void getKeysTest() {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "cloud1", "cloud2", "tenant1", "vserver1");
+ Map<String,String> keys = uri.getURIKeys();
+ System.out.println(keys);
+ System.out.println(uri.build());
+ assertEquals("vserver1", keys.get("vserver-id"));
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImplTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImplTest.java
new file mode 100644
index 0000000000..e8d98718a4
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImplTest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============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.openecomp.mso.client.aai.entities.uri.parsers;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Map;
+
+import org.junit.Test;
+import org.openecomp.mso.client.aai.AAIObjectType;
+
+public class UriParserSpringImplTest {
+
+
+
+
+ @Test
+ public void reverseTemplate() {
+ final UriParser parser = new UriParserSpringImpl(AAIObjectType.SERVICE_INSTANCE.toString());
+ final String uri = "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
+
+ Map<String, String> result = parser.parse(uri);
+
+ assertEquals("found customer-id", "key1", result.get("global-customer-id"));
+ assertEquals("found service-type", "key2", result.get("service-type"));
+ assertEquals("found service-instance-id", "key3", result.get("service-instance-id"));
+
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/dmaap/DmaapClientTest.java b/common/src/test/java/org/openecomp/mso/client/dmaap/DmaapClientTest.java
new file mode 100644
index 0000000000..dda7754712
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/dmaap/DmaapClientTest.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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.openecomp.mso.client.dmaap;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.junit.Test;
+import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+
+public class DmaapClientTest {
+
+ @Test
+ public void deobfuscateTest() throws FileNotFoundException, IOException {
+ String encodedBase64 = "dGVzdHBhc3N3b3Jk";
+ String notEncoded = "testpassword";
+ DmaapConsumer consumer = new SDNOHealthCheckDmaapConsumer();
+ assertEquals("decoded password", notEncoded, consumer.deobfuscatePassword(encodedBase64));
+
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/grm/GRMBeansTest.java b/common/src/test/java/org/openecomp/mso/client/grm/GRMBeansTest.java
new file mode 100644
index 0000000000..ef2d984af4
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/grm/GRMBeansTest.java
@@ -0,0 +1,59 @@
+/*-
+ * ============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.openecomp.mso.client.grm;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.reflection.impl.PojoClassFactory;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.affirm.Affirm;
+import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.rule.impl.SetterMustExistRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+
+public class GRMBeansTest {
+ private static final int EXPECTED_CLASS_COUNT = 10;
+ private static final String POJO_PACKAGE = "org.openecomp.mso.client.grm.beans";
+
+ @Test
+ public void ensureExpectedPojoCount() {
+ List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses( POJO_PACKAGE, new FilterPackageInfo());
+ Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size());
+ }
+
+ @Test
+ public void testPojoStructureAndBehavior() {
+ Validator validator = ValidatorBuilder.create()
+ .with(new GetterMustExistRule())
+ .with(new SetterMustExistRule())
+ .with(new SetterTester())
+ .with(new GetterTester())
+ .build();
+
+ validator.validate(POJO_PACKAGE, new FilterPackageInfo());
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/grm/GRMClientTest.java b/common/src/test/java/org/openecomp/mso/client/grm/GRMClientTest.java
new file mode 100644
index 0000000000..6865bbd773
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/grm/GRMClientTest.java
@@ -0,0 +1,185 @@
+/*-
+ * ============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.openecomp.mso.client.grm;
+
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.core.MediaType;
+
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.openecomp.mso.client.grm.exceptions.GRMClientCallFailed;
+import org.openecomp.mso.client.grm.GRMClient;
+import org.openecomp.mso.client.grm.beans.ServiceEndPointRequest;
+import org.openecomp.mso.client.grm.beans.OperationalInfo;
+import org.openecomp.mso.client.grm.beans.Property;
+import org.openecomp.mso.client.grm.beans.ServiceEndPoint;
+import org.openecomp.mso.client.grm.beans.ServiceEndPointList;
+import org.openecomp.mso.client.grm.beans.ServiceEndPointLookupRequest;
+import org.openecomp.mso.client.grm.beans.Version;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+public class GRMClientTest {
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090));
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void testFind() throws Exception {
+ String endpoints = getFileContentsAsString("__files/grm/endpoints.json");
+ wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", MediaType.APPLICATION_JSON)
+ .withBody(endpoints)));
+
+
+ GRMClient client = new GRMClient();
+ ServiceEndPointList sel = client.findRunningServices("TEST.ECOMP_PSL.*", 1, "TEST");
+ List<ServiceEndPoint> list = sel.getServiceEndPointList();
+ assertEquals(3, list.size());
+ }
+
+ @Test(expected = GRMClientCallFailed.class)
+ public void testFindFail() throws Exception {
+
+ wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning"))
+ .willReturn(aResponse()
+ .withStatus(400)
+ .withHeader("Content-Type", MediaType.APPLICATION_JSON)
+ .withBody("")));
+
+ GRMClient client = new GRMClient();
+ client.findRunningServices("TEST.ECOMP_PSL.*", 1, "TEST");
+ }
+
+ @Ignore
+ @Test
+ public void testAdd() throws Exception {
+
+ wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", MediaType.APPLICATION_JSON)
+ .withBody("test")));
+ wireMockRule.addMockServiceRequestListener((request, response) -> {
+ System.out.println("URL Requested => " + request.getAbsoluteUrl());
+ System.out.println("Request Body => " + request.getBodyAsString());
+ System.out.println("Request Headers => " + request.getHeaders().toString());
+ System.out.println("Response Status => " + response.getStatus());
+ System.out.println("Response Body => " + response.getBodyAsString());
+ });
+
+ Version ver = new Version();
+ ver.setMajor(1);
+ ver.setMinor(0);
+ ver.setPatch("0");
+
+ ServiceEndPoint sep = new ServiceEndPoint();
+ sep.setName("TEST.ECOMP_PSL.Inventory");
+ sep.setVersion(ver);
+ sep.setHostAddress("127.0.0.1");
+ sep.setListenPort("8080");
+ sep.setLatitude("37.7022");
+ sep.setLongitude("121.9358");
+ sep.setContextPath("/");
+ sep.setRouteOffer("TEST");
+
+ OperationalInfo operInfo = new OperationalInfo();
+ operInfo.setCreatedBy("edge");
+ operInfo.setUpdatedBy("edge");
+
+ sep.setOperationalInfo(operInfo);
+
+ Property prop1 = new Property();
+ prop1.setName("Environment");
+ prop1.setValue("TEST");
+
+ Property prop2 = new Property();
+ prop2.setName("cpfrun_cluster_name");
+ prop2.setValue("testcase_cluster_no_cluster");
+
+ List<Property> props = new ArrayList<Property>();
+ props.add(prop1);
+ props.add(prop2);
+
+ sep.setProperties(props);
+
+ ServiceEndPointRequest request = new ServiceEndPointRequest();
+ request.setEnv("DEV");
+ request.setServiceEndPoint(sep);
+
+ System.out.println("Request in JSON: " + mapper.writeValueAsString(request));
+
+ GRMClient client = new GRMClient();
+ client.addServiceEndPoint(request);
+ }
+
+ @Test(expected = GRMClientCallFailed.class)
+ public void testAddFail() throws Exception {
+ wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", MediaType.APPLICATION_JSON)
+ .withBody("test")));
+ ServiceEndPointRequest request = new ServiceEndPointRequest();
+ GRMClient client = new GRMClient();
+ client.addServiceEndPoint(request);
+ }
+
+ @Test
+ public void testBuildServiceEndPointLookupRequest() {
+ GRMClient client = new GRMClient();
+ ServiceEndPointLookupRequest request = client.buildServiceEndPointlookupRequest("TEST.ECOMP_PSL.Inventory", 1, "DEV");
+ assertEquals("TEST.ECOMP_PSL.Inventory", request.getServiceEndPoint().getName());
+ assertEquals(Integer.valueOf(1), Integer.valueOf(request.getServiceEndPoint().getVersion().getMajor()));
+ assertEquals("DEV", request.getEnv());
+
+ }
+
+ protected String getFileContentsAsString(String fileName) {
+ String content = "";
+ try {
+ ClassLoader classLoader = this.getClass().getClassLoader();
+ File file = new File(classLoader.getResource(fileName).getFile());
+ content = new String(Files.readAllBytes(file.toPath()));
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ System.out.println("Exception encountered reading " + fileName + ". Error: " + e.getMessage());
+ }
+ return content;
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointListTest.java b/common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointListTest.java
new file mode 100644
index 0000000000..111fec46eb
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointListTest.java
@@ -0,0 +1,75 @@
+/*-
+ * ============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.openecomp.mso.client.grm;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.util.List;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.openecomp.mso.client.grm.beans.ServiceEndPoint;
+import org.openecomp.mso.client.grm.beans.ServiceEndPointList;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ServiceEndPointListTest {
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void testUnmarshall() throws Exception {
+ String endpointsJson = getFileContentsAsString("__files/grm/endpoints.json");
+ ServiceEndPointList sel = mapper.readValue(endpointsJson, ServiceEndPointList.class);
+
+ List<ServiceEndPoint> list = sel.getServiceEndPointList();
+ ServiceEndPoint se = list.get(0);
+
+ assertEquals(3, list.size());
+ assertEquals("dummy.pod.ns.dummy-pod3", se.getName());
+ assertEquals(Integer.valueOf(1), Integer.valueOf(se.getVersion().getMajor()));
+ assertEquals(Integer.valueOf(0), Integer.valueOf(se.getVersion().getMinor()));
+ assertEquals(Integer.valueOf(0), Integer.valueOf(se.getVersion().getPatch()));
+ assertEquals("135.144.120.218", se.getHostAddress());
+ assertEquals("32004", se.getListenPort());
+ assertEquals("37.7022", se.getLatitude());
+ assertEquals("121.9358", se.getLongitude());
+ assertEquals("/", se.getContextPath());
+ assertEquals("edge", se.getOperationalInfo().getCreatedBy());
+ assertEquals("edge", se.getOperationalInfo().getUpdatedBy());
+ assertEquals("Environment", se.getProperties().get(0).getName());
+ assertEquals("DEV", se.getProperties().get(0).getValue());
+ }
+
+ protected String getFileContentsAsString(String fileName) {
+
+ String content = "";
+ try {
+ ClassLoader classLoader = this.getClass().getClassLoader();
+ File file = new File(classLoader.getResource(fileName).getFile());
+ content = new String(Files.readAllBytes(file.toPath()));
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ System.out.println("Exception encountered reading " + fileName + ". Error: " + e.getMessage());
+ }
+ return content;
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointRequestTest.java b/common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointRequestTest.java
new file mode 100644
index 0000000000..230b58bd84
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointRequestTest.java
@@ -0,0 +1,90 @@
+/*-
+ * ============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.openecomp.mso.client.grm;
+
+import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.openecomp.mso.client.grm.beans.OperationalInfo;
+import org.openecomp.mso.client.grm.beans.Property;
+import org.openecomp.mso.client.grm.beans.ServiceEndPoint;
+import org.openecomp.mso.client.grm.beans.ServiceEndPointRequest;
+import org.openecomp.mso.client.grm.beans.Version;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ServiceEndPointRequestTest {
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void testMarshall() throws Exception {
+
+ String expected =
+ "{\"serviceEndPoint\":{\"name\":\"TEST.ECOMP_PSL.Inventory\",\"version\":{\"major\":1,\"minor\":0,\"patch\":\"0\"}," +
+ "\"hostAddress\":\"127.0.0.1\",\"listenPort\":\"8080\",\"latitude\":\"37.7022\",\"longitude\":\"121.9358\"," +
+ "\"contextPath\":\"/\",\"routeOffer\":\"TEST\",\"operationalInfo\":{\"createdBy\":\"edge\",\"updatedBy\":\"edge\"}," +
+ "\"properties\":[{\"name\":\"Environment\",\"value\":\"TEST\"},{\"name\":\"cpfrun_cluster_name\"," +
+ "\"value\":\"testcase_cluster_no_cluster\"}]},\"env\":\"DEV\"}";
+
+ Version ver = new Version();
+ ver.setMajor(1);
+ ver.setMinor(0);
+ ver.setPatch("0");
+
+ ServiceEndPoint sep = new ServiceEndPoint();
+ sep.setName("TEST.ECOMP_PSL.Inventory");
+ sep.setVersion(ver);
+ sep.setHostAddress("127.0.0.1");
+ sep.setListenPort("8080");
+ sep.setLatitude("37.7022");
+ sep.setLongitude("121.9358");
+ sep.setContextPath("/");
+ sep.setRouteOffer("TEST");
+
+ OperationalInfo operInfo = new OperationalInfo();
+ operInfo.setCreatedBy("edge");
+ operInfo.setUpdatedBy("edge");
+
+ sep.setOperationalInfo(operInfo);
+
+ Property prop1 = new Property();
+ prop1.setName("Environment");
+ prop1.setValue("TEST");
+
+ Property prop2 = new Property();
+ prop2.setName("cpfrun_cluster_name");
+ prop2.setValue("testcase_cluster_no_cluster");
+
+ List<Property> props = new ArrayList<Property>();
+ props.add(prop1);
+ props.add(prop2);
+
+ sep.setProperties(props);
+
+ ServiceEndPointRequest request = new ServiceEndPointRequest();
+ request.setEnv("DEV");
+ request.setServiceEndPoint(sep);
+
+ assertEquals(expected, mapper.writeValueAsString(request));
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/policy/PolicyClientImplTest.java b/common/src/test/java/org/openecomp/mso/client/policy/PolicyClientImplTest.java
new file mode 100644
index 0000000000..88cb4fa2a4
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/policy/PolicyClientImplTest.java
@@ -0,0 +1,75 @@
+/*-
+ * ============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.openecomp.mso.client.policy;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openecomp.mso.client.defaultproperties.PolicyRestPropertiesImpl;
+import org.openecomp.mso.client.policy.entities.Bbid;
+import org.openecomp.mso.client.policy.entities.DictionaryData;
+import org.openecomp.mso.client.policy.entities.PolicyDecision;
+import org.openecomp.mso.client.policy.entities.PolicyServiceType;
+import org.openecomp.mso.client.policy.entities.Workstep;
+
+public class PolicyClientImplTest {
+
+ @Test
+ public void successReadProperties() {
+ PolicyRestClient client = new PolicyRestClient(new PolicyRestPropertiesImpl(), PolicyServiceType.GET_DECISION);
+ client.initializeHeaderMap(client.headerMap);
+
+ assertEquals("Found expected Client Auth", client.headerMap.get("ClientAuth"), "Basic bTAzNzQzOnBvbGljeVIwY2sk");
+ assertEquals("Found expected Authorization", client.headerMap.get("Authorization"), "Basic dGVzdHBkcDphbHBoYTEyMw==");
+ assertEquals("Found expected Environment", client.headerMap.get("Environment"), "TEST");
+ assertEquals("Has X-ECOMP-RequestID", client.headerMap.containsKey("X-ECOMP-RequestID"), true);
+ }
+
+ @Test
+ @Ignore
+ public void getDecisionTest() {
+ PolicyClient client = new PolicyClientImpl();
+ PolicyDecision decision = client.getDecision("S", "V", "BB1", "1", "123");
+ assertEquals("Decision is correct", decision.getDecision(), "PERMIT");
+ assertEquals("Decision details is correct", decision.getDetails(), "Retry");
+ }
+
+ @Test
+ @Ignore
+ public void getAllowedTreatmentsTest(){
+ PolicyClient client = new PolicyClientImpl();
+ DictionaryData dictClient = client.getAllowedTreatments("BB1", "1");
+ final String dictBbidString = dictClient.getBbid().getString();
+ final String dictWorkStepString = dictClient.getWorkstep().getString();
+ assertEquals("DictionaryData matches a response Bbid", dictBbidString, "BB1");
+ assertEquals("DicitonaryData matches a response WorkStep", dictWorkStepString, "1");
+ }
+ /*
+ @Test
+ public void getAllowedTreatmentsTest() {
+ PolicyClient client = new PolicyClientImpl();
+ AllowedTreatments allowedTreatments = client.getAllowedTreatments("BB1", "1");
+ int expectedSizeOfList = 4;
+ int sizeOfList = allowedTreatments.getAllowedTreatments().size();
+ assertEquals("Decision is correct", sizeOfList, expectedSizeOfList);
+ }*/
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/ruby/RubyCheckClientTest.java b/common/src/test/java/org/openecomp/mso/client/ruby/RubyCheckClientTest.java
new file mode 100644
index 0000000000..053f1f2533
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/ruby/RubyCheckClientTest.java
@@ -0,0 +1,106 @@
+/*-
+ * ============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.openecomp.mso.client.ruby;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.text.ParseException;
+import java.time.format.DateTimeFormatter;
+
+import org.junit.Test;
+import org.openecomp.mso.client.ruby.beans.Ruby;
+
+import static org.apache.commons.lang3.StringUtils.*;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class RubyCheckClientTest {
+ private final String fileLocation = "src/test/resources/org/openecomp/mso/client/ruby/create-ticket/";
+ private static final String REQUEST_ID = "abc123";
+ private static final String SOURCE_NAME = "source-name";
+ private static final String TIME = "test-time";
+ private static final String REASON = "reason";
+ private static final String WORK_FLOW_ID = "work-flow-Id";
+ private static final String NOTIFICATION = "notification";
+
+
+
+ @Test
+ public void verifyRubyCreateTicketRequest() throws IOException, ParseException{
+ String content = this.getJson("create-ticket-request.json");
+ ObjectMapper mapper = new ObjectMapper();
+ Ruby expected = mapper.readValue(content, Ruby.class);
+ RubyClient client = new RubyClient();
+ RubyClient spy = spy(client);
+ when(spy.getTime()).thenReturn(TIME);
+ String actual = spy.buildRequest(REQUEST_ID, SOURCE_NAME, REASON, WORK_FLOW_ID, NOTIFICATION);
+ assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
+ }
+
+
+ @Test
+ public void verifyTimeFormat() {
+ RubyClient client = new RubyClient();
+ String time = client.getTime();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss Z");
+ formatter.parse(time);
+ }
+
+
+ @Test
+ public void verifyReasonCharLimit() throws IOException{
+ final String reasonLong = repeat("*", 256);
+ RubyClient client = new RubyClient();
+ try{
+ client.buildRequest(REQUEST_ID, SOURCE_NAME, reasonLong, WORK_FLOW_ID, NOTIFICATION);
+ fail("Should have thrown IllegalArgumentException but did not!");
+ }
+ catch(final IllegalArgumentException e){
+ final String msg = "reason exceeds 255 characters";
+ assertEquals(msg, e.getMessage());
+ }
+ }
+
+ @Test
+ public void verifyNotificationCharLimit() throws IOException{
+ final String notificationLong = repeat("*", 1025);
+ RubyClient client = new RubyClient();
+ try{
+ client.buildRequest(REQUEST_ID, SOURCE_NAME, REASON, WORK_FLOW_ID, notificationLong);
+ fail("Should have thrown IllegalArgumentException but did not!");
+ }
+ catch(final IllegalArgumentException e){
+ final String msg = "notification exceeds 1024 characters";
+ assertEquals(msg, e.getMessage());
+ }
+ }
+
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get(fileLocation + filename)));
+ }
+
+}
+
diff --git a/common/src/test/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClientTest.java b/common/src/test/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClientTest.java
new file mode 100644
index 0000000000..6c64d90ff4
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClientTest.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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.openecomp.mso.client.sdno;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Optional;
+
+import org.junit.Test;
+import org.openecomp.mso.client.sdno.beans.SDNO;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class SDNOHealthCheckClientTest {
+
+
+
+ private final String fileLocation = "src/test/resources/org/openecomp/mso/client/sdno/health-check/";
+ private static final String userId = "test-user";
+ private static final Optional<String> clliCode = Optional.of("test-clli");
+ private static final String requestId = "test-request-id";
+ private static final String configurationId = "test-configuration-id";
+ private static final String interfaceId = "test-interface-id";
+
+ @Test
+ public void verfyLPortMirrorPreCheckRequest() throws IOException{
+ String content = this.getJson("custom-lport-mirror-pre-check-request.json");
+ ObjectMapper mapper = new ObjectMapper();
+ SDNO expected = mapper.readValue(content, SDNO.class);
+ SDNOHealthCheckClient client = new SDNOHealthCheckClient();
+ String actual = client.buildLPortMirrorCheckPreRequest(userId, requestId, clliCode, configurationId, interfaceId);
+ assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
+ }
+
+ @Test
+ public void verfyLPortMirrorPostCheckRequest() throws IOException{
+ String content = this.getJson("custom-lport-mirror-post-check-request.json");
+ ObjectMapper mapper = new ObjectMapper();
+ SDNO expected = mapper.readValue(content, SDNO.class);
+ SDNOHealthCheckClient client = new SDNOHealthCheckClient();
+ String actual = client.buildLPortMirrorCheckPostRequest(userId, requestId, clliCode, configurationId, interfaceId);
+ assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
+ }
+
+
+ @Test
+ public void verifyPortMirrorPostCheckRequest() throws IOException{
+ String content = this.getJson("custom-port-mirror-post-check-request.json");
+ ObjectMapper mapper = new ObjectMapper();
+ SDNO expected = mapper.readValue(content, SDNO.class);
+ SDNOHealthCheckClient client = new SDNOHealthCheckClient();
+ String actual = client.buildPortMirrorPostCheckRequest(userId, requestId, clliCode, configurationId);
+
+ assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
+
+ }
+ @Test
+ public void verifyPortMirrorPreCheckRequest() throws IOException {
+ String content = this.getJson("custom-port-mirror-pre-check-request.json");
+ ObjectMapper mapper = new ObjectMapper();
+ SDNO expected = mapper.readValue(content, SDNO.class);
+ SDNOHealthCheckClient client = new SDNOHealthCheckClient();
+ String actual = client.buildPortMirrorPreCheckRequest(userId, requestId, clliCode, configurationId);
+
+ assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
+
+ }
+
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get(fileLocation + filename)));
+ }
+
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/sdno/SDNOValidatorTest.java b/common/src/test/java/org/openecomp/mso/client/sdno/SDNOValidatorTest.java
new file mode 100644
index 0000000000..cd84e7854d
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/client/sdno/SDNOValidatorTest.java
@@ -0,0 +1,116 @@
+/*-
+ * ============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.openecomp.mso.client.sdno;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.UUID;
+
+import org.hamcrest.core.StringContains;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.openecomp.mso.client.dmaap.Consumer;
+import org.openecomp.mso.client.dmaap.exceptions.DMaaPConsumerFailure;
+import org.openecomp.mso.client.exceptions.SDNOException;
+import org.openecomp.mso.client.sdno.beans.SDNO;
+import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+public class SDNOValidatorTest {
+
+
+ @Mock private Consumer mrConsumer;
+ @Spy private SDNOHealthCheckDmaapConsumer dmaapConsumer;
+ private final String fileLocation = "src/test/resources/org/openecomp/mso/client/sdno/";
+ private final String uuid = "xyz123";
+ @Rule public ExpectedException thrown = ExpectedException.none();
+
+ @Before
+ public void setUpTests() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void success() throws IOException, Exception {
+ when(dmaapConsumer.getConsumer()).thenReturn(mrConsumer);
+ when(mrConsumer.fetch()).thenReturn(Arrays.asList(new String[]{getJson("response.json"), getJson("output-success.json")}));
+
+ SDNOValidatorImpl validator = new SDNOValidatorImpl();
+ SDNOValidatorImpl spy = spy(validator);
+ when(dmaapConsumer.getRequestId()).thenReturn("xyz123");
+ doReturn(dmaapConsumer).when(spy).getConsumer(any(String.class));
+ boolean result = spy.pollForResponse("xyz123");
+ assertEquals("result is true", result, true);
+ }
+
+ @Test
+ public void failure() throws IOException, Exception {
+ when(dmaapConsumer.getConsumer()).thenReturn(mrConsumer);
+ when(mrConsumer.fetch()).thenReturn(Arrays.asList(new String[]{getJson("response.json"), getJson("output-failure.json")}));
+
+ SDNOValidatorImpl validator = new SDNOValidatorImpl();
+ SDNOValidatorImpl spy = spy(validator);
+ when(dmaapConsumer.getRequestId()).thenReturn("xyz123");
+ doReturn(dmaapConsumer).when(spy).getConsumer(any(String.class));
+ thrown.expect(SDNOException.class);
+ thrown.expectMessage(new StringContains("my error message"));
+ boolean result = spy.pollForResponse("xyz123");
+
+ }
+ @Ignore
+ @Test
+ public void run() throws Exception {
+ SDNOValidatorImpl validator = new SDNOValidatorImpl();
+ UUID uuid = UUID.randomUUID();
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("test");
+ vnf.setIpv4OamAddress("1.2.3.4");
+ vnf.setVnfType("VPE");
+ SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
+ ObjectMapper mapper = new ObjectMapper();
+ String json = mapper.writeValueAsString(request);
+ validator.submitRequest(json);
+ thrown.expect(DMaaPConsumerFailure.class);
+ boolean result = validator.pollForResponse(uuid.toString());
+ System.out.println(json);
+
+ }
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get(fileLocation + filename)));
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/jsonpath/JsonPathUtilTest.java b/common/src/test/java/org/openecomp/mso/jsonpath/JsonPathUtilTest.java
new file mode 100644
index 0000000000..85bb8b6804
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/jsonpath/JsonPathUtilTest.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.openecomp.mso.jsonpath;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Optional;
+
+import org.junit.Test;
+
+public class JsonPathUtilTest {
+
+ private static final String json = "{\"test\" : \"hello\", \"test2\" : {\"nested\" : \"value\"}}";
+ @Test
+ public void pathExistsTest() {
+ assertEquals("test is found", JsonPathUtil.getInstance().pathExists(json, "$.test"), true);
+ assertEquals("nothing is not found", JsonPathUtil.getInstance().pathExists(json, "$.nothing"), false);
+ }
+
+ @Test
+ public void locateResultTest() {
+ assertEquals("value of hello is found", Optional.of("hello"), JsonPathUtil.getInstance().locateResult(json, "$.test"));
+ assertEquals("nothing returns empty", Optional.empty(), JsonPathUtil.getInstance().locateResult(json, "$.nothing"));
+ }
+
+ @Test
+ public void simpleAndComplexValues() {
+ assertEquals("json doc found", Optional.of("{\"nested\":\"value\"}"), JsonPathUtil.getInstance().locateResult(json, "$.test2"));
+ assertEquals("value found", Optional.of("value"), JsonPathUtil.getInstance().locateResult(json, "$.test2.nested"));
+ }
+} \ No newline at end of file
diff --git a/common/src/test/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequestTest.java b/common/src/test/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequestTest.java
new file mode 100644
index 0000000000..28cbe799cd
--- /dev/null
+++ b/common/src/test/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequestTest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============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.openecomp.mso.serviceinstancebeans;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ServiceInstancesRequestTest {
+
+ @Test
+ public void serializeServiceInstance() {
+ String incomingRequest = "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"9647dfc4-2083-11e7-93ae-92361f002672\",\"modelType\":\"configuration\",\"modelName\":\"MSO-Configuration\",\"modelVersion\":\"1.0\",\"modelUuid\":\"36a3a8ea-49a6-4ac8-b06c-89a545444455\",\"modelCustomizationUuid\":\"68dc9a92-214c-11e7-93ae-92361f002671\"},\"requestInfo\":{\"source\":\"VID\",\"instanceName\":\"port_mirror_config_m830-01\",\"suppressRollback\":false,\"requestorId\":\"mdg1215\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceId\":\"956121e0-542d-4b30-b8c7-be611e3c8f13\",\"modelInfo\":{\"modelInvariantUuid\":\"9647dfc4-2083-11e7-93ae-92361f002671\",\"modelType\":\"service\",\"modelName\":\"MSOTADevInfra_vSAMP10a_Service\",\"modelVersion\":\"1.0\",\"modelUuid\":\"5df8b6de-2083-11e7-93ae-92361f002671\"}}},{\"relatedInstance\":{\"instanceId\":\"956121e0-542d-4b30-b8c7-be611e3c8f11\",\"modelInfo\":{\"modelInvariantUuid\":\"36a3a8ea-49a6-4ac8-b06c-89a545444456\",\"modelType\":\"vnf\",\"modelName\":\"testvnf\",\"modelVersion\":\"1.0\",\"modelUuid\":\"956121e0-542d-4b30-b8c7-be611e3c8f14\",\"modelCustomizationUuid\":\"68dc9a92-214c-11e7-93ae-92361f002676\"},\"instanceDirection\":\"source\"}},{\"relatedInstance\":{\"instanceId\":\"956121e0-542d-4b30-b8c7-be611e3c8f12\",\"modelInfo\":{\"modelInvariantUuid\":\"36a3a8ea-49a6-4ac8-b06c-89a545444477\",\"modelType\":\"vnf\",\"modelName\":\"svProbe vnf model name\",\"modelVersion\":\"1.0\",\"modelUuid\":\"36a3a8ea-49a6-4ac8-b06c-89a545444488\",\"modelCustomizationUuid\":\"68dc9a92-214c-11e7-93ae-92361f002672\"},\"instanceDirection\":\"destination\"}}],\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\"},\"requestParameters\":{\"subscriptionServiceType\":\"MSO-dev-service-type\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"}],\"aLaCarte\":false,\"autoBuildVfModules\":false,\"cascadeDelete\":false,\"usePreload\":true,\"rebuildVolumeGroups\":false}},\"serviceInstanceId\":\"956121e0-542d-4b30-b8c7-be611e3c8f13\"}";
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ try {
+ ServiceInstancesRequest request = mapper.readValue(incomingRequest, ServiceInstancesRequest.class);
+ System.out.println("Java Object: " + request);
+ } catch (Exception e) {
+ System.out.println("Caught Exception " + e.getMessage());
+ Assert.fail("Caught error on object serialization");
+ }
+ }
+}
diff --git a/common/src/test/resources/__files/Policy/policyAbortResponse.json b/common/src/test/resources/__files/Policy/policyAbortResponse.json
new file mode 100644
index 0000000000..c315b1ed1d
--- /dev/null
+++ b/common/src/test/resources/__files/Policy/policyAbortResponse.json
@@ -0,0 +1 @@
+{"decision":"PERMIT","details":"Abort"} \ No newline at end of file
diff --git a/common/src/test/resources/__files/Policy/policySkipResponse.json b/common/src/test/resources/__files/Policy/policySkipResponse.json
new file mode 100644
index 0000000000..7cbdebb6b3
--- /dev/null
+++ b/common/src/test/resources/__files/Policy/policySkipResponse.json
@@ -0,0 +1 @@
+{"decision":"PERMIT","details":"Skip"} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/bulkprocess/response-failure.json b/common/src/test/resources/__files/aai/bulkprocess/response-failure.json
new file mode 100644
index 0000000000..bbc2c38b76
--- /dev/null
+++ b/common/src/test/resources/__files/aai/bulkprocess/response-failure.json
@@ -0,0 +1,32 @@
+{
+ "transaction": [
+ {
+ "put": [
+ {
+ "body": {
+ "401": "{\"requestError\": {\"serviceException\": {\"messageId\": \"SVC3003\",\"text\": \"another error message\",\"variables\": []}}}"
+ }
+ },
+ {
+ "body": {
+ "200": "test2"
+ }
+ }
+ ]
+ },
+ {
+ "put": [
+ {
+ "body": {
+ "400": "{\"requestError\": {\"serviceException\": {\"messageId\": \"SVC3003\",\"text\": \"my great error\",\"variables\": []}}}"
+ }
+ },
+ {
+ "body": {
+ "200": "test4"
+ }
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/bulkprocess/response-success.json b/common/src/test/resources/__files/aai/bulkprocess/response-success.json
new file mode 100644
index 0000000000..7dae38335a
--- /dev/null
+++ b/common/src/test/resources/__files/aai/bulkprocess/response-success.json
@@ -0,0 +1,32 @@
+{
+ "transaction": [
+ {
+ "put": [
+ {
+ "body": {
+ "201": "test"
+ }
+ },
+ {
+ "body": {
+ "200": "test2"
+ }
+ }
+ ]
+ },
+ {
+ "put": [
+ {
+ "body": {
+ "201": "test3"
+ }
+ },
+ {
+ "body": {
+ "200": "test4"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/common/src/test/resources/__files/aai/bulkprocess/test-request.json b/common/src/test/resources/__files/aai/bulkprocess/test-request.json
new file mode 100644
index 0000000000..f5ffe38285
--- /dev/null
+++ b/common/src/test/resources/__files/aai/bulkprocess/test-request.json
@@ -0,0 +1,22 @@
+{
+ "transactions" : [ {
+ "put" : [ {
+ "uri" : "/network/generic-vnfs/generic-vnf/test1/relationship-list/relationship",
+ "body" : {
+ "related-link" : "/cloud-infrastructure/pservers/pserver/test2"
+ }
+ }, {
+ "uri" : "/network/generic-vnfs/generic-vnf/test3/relationship-list/relationship",
+ "body" : {
+ "related-link" : "/cloud-infrastructure/pservers/pserver/test4"
+ }
+ } ]
+ }, {
+ "put" : [ {
+ "uri" : "/network/generic-vnfs/generic-vnf/test5/relationship-list/relationship",
+ "body" : {
+ "related-link" : "/cloud-infrastructure/pservers/pserver/test6"
+ }
+ } ]
+ } ]
+} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/pserver.json b/common/src/test/resources/__files/aai/pserver.json
new file mode 100644
index 0000000000..1a3f40aac3
--- /dev/null
+++ b/common/src/test/resources/__files/aai/pserver.json
@@ -0,0 +1,14 @@
+{
+ "results": [
+ {
+ "pserver": {
+ "hostname": "test"
+ }
+ },
+ {
+ "pserver": {
+ "hostname": "test2"
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/resources/e2e-complex.json b/common/src/test/resources/__files/aai/resources/e2e-complex.json
new file mode 100644
index 0000000000..6fc9cb36e6
--- /dev/null
+++ b/common/src/test/resources/__files/aai/resources/e2e-complex.json
@@ -0,0 +1,660 @@
+{
+ "physical-location-id": "MTCWNJA4DCP",
+ "complex-name": "mtcnj",
+ "resource-version": "1498188613044",
+ "physical-location-type": "Mobility",
+ "street1": "200 S. Laurel Ave, Rm A4-3C30",
+ "city": "Middletown",
+ "state": "NJ",
+ "postal-code": "07748",
+ "country": "USA",
+ "region": "US",
+ "latitude": "40.39596",
+ "longitude": "-74.135342",
+ "lata": "224",
+ "ctag-pools": {
+ "ctag-pool": [
+ {
+ "target-pe": "sfcca301vr1",
+ "availability-zone-name": "mtcnj-esx-az01",
+ "ctag-pool-purpose": "IPAG",
+ "ctag-values": "2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025",
+ "resource-version": "1494254946087",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vpls-pe",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vpls-pes/vpls-pe/sfcca301vr1",
+ "relationship-data": [
+ {
+ "relationship-key": "vpls-pe.equipment-name",
+ "relationship-value": "sfcca301vr1"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "target-pe": "VPESAT-mtcnj401me6",
+ "availability-zone-name": "mtcnj-esx-az01",
+ "ctag-pool-purpose": "VPE",
+ "ctag-values": "3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,3014,3015,3016,3017,3018,3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037,3038,3039,3040,3041,3042,3043,3044,3045,3046,3047,3048,3049,3050",
+ "resource-version": "1494254975977"
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vce",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053",
+ "relationship-data": [
+ {
+ "relationship-key": "vce.vnf-id",
+ "relationship-value": "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vce.vnf-name",
+ "property-value": "mtcnj411vbc"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj104snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj104snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj105snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj105snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/compute_host",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "compute_host"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj106snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj106snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj126sd9",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj126sd9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "vce",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/8ae1e5f8-61f1-4c71-913a-b40cc4593cb9",
+ "relationship-data": [
+ {
+ "relationship-key": "vce.vnf-id",
+ "relationship-value": "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vce.vnf-name",
+ "property-value": "mtcnj411vbc"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102sta",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj102sta"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax102",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnjtax102"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj107snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj107snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj118snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj118snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj110snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj110snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj109snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj109snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj114snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj114snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj119snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj119snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj116snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj116snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "vce",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a2935fa9-b743-49f4-9813-a127f13c4e93",
+ "relationship-data": [
+ {
+ "relationship-key": "vce.vnf-id",
+ "relationship-value": "a2935fa9-b743-49f4-9813-a127f13c4e93"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vce.vnf-name",
+ "property-value": "mtcnj410vbc"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj108snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj108snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj123sd9",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj123sd9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj101snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj102snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax101",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnjtax101"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj113snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj113snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj111snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj111snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj103snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj103snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj117snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj117snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101sta",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj101sta"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "vce",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/c7fe7698-8063-4e26-8bd3-ca3edde0b0d4",
+ "relationship-data": [
+ {
+ "relationship-key": "vce.vnf-id",
+ "relationship-value": "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vce.vnf-name",
+ "property-value": "mtcnj412vbc"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj120snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj120snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj124sd9",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj124sd9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj125sd9",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj125sd9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj112snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj112snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj115snd",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "mtcnj115snd"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ },
+ {
+ "related-to": "cloud-region",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtcnj2",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtcnj2"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "lcp"
+ }
+ ]
+ },
+ {
+ "related-to": "oam-network",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "AAIAIC25"
+ },
+ {
+ "relationship-key": "oam-network.network-uuid",
+ "relationship-value": "f9263cat-4eaa-43a0-bea4-adcf6e123456"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "oam-network.network-name",
+ "property-value": "VLAN-OAM-1323"
+ }
+ ]
+ },
+ {
+ "related-to": "oam-network",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "AAIAIC25"
+ },
+ {
+ "relationship-key": "oam-network.network-uuid",
+ "relationship-value": "b9263fab-4eaa-43a0-bea4-adcf6e999999"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "oam-network.network-name",
+ "property-value": "VLAN-OAM-1323"
+ }
+ ]
+ },
+ {
+ "related-to": "oam-network",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "AAIAIC25"
+ },
+ {
+ "relationship-key": "oam-network.network-uuid",
+ "relationship-value": "cf33dc95-c5d2-48fd-8078-fd949363f63b"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "oam-network.network-name",
+ "property-value": "VLAN-OAM-1323"
+ }
+ ]
+ },
+ {
+ "related-to": "availability-zone",
+ "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "AAIAIC25"
+ },
+ {
+ "relationship-key": "availability-zone.availability-zone-name",
+ "relationship-value": "mtcnj-esx-az01"
+ }
+ ]
+ }
+ ]
+ }
+ } \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/resources/empty-query-result.json b/common/src/test/resources/__files/aai/resources/empty-query-result.json
new file mode 100644
index 0000000000..914332edba
--- /dev/null
+++ b/common/src/test/resources/__files/aai/resources/empty-query-result.json
@@ -0,0 +1,3 @@
+{
+ "results": []
+} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/resources/mockObject.json b/common/src/test/resources/__files/aai/resources/mockObject.json
new file mode 100644
index 0000000000..2f97b47dd3
--- /dev/null
+++ b/common/src/test/resources/__files/aai/resources/mockObject.json
@@ -0,0 +1,10 @@
+{
+ "id" : "something",
+ "resource-version" : "1234",
+ "plural" : {
+ "singular" : [{
+ "id" : "something2",
+ "resource-version" : "5678"
+ }]
+ }
+} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json b/common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json
new file mode 100644
index 0000000000..6ec513e4bb
--- /dev/null
+++ b/common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json
@@ -0,0 +1,8 @@
+{
+ "results": [
+ {
+ "resource-type": "service-instance",
+ "resource-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"
+ }
+ ]
+} \ No newline at end of file
diff --git a/common/src/test/resources/__files/grm/endpoints.json b/common/src/test/resources/__files/grm/endpoints.json
new file mode 100644
index 0000000000..20947540b4
--- /dev/null
+++ b/common/src/test/resources/__files/grm/endpoints.json
@@ -0,0 +1,145 @@
+{
+ "serviceEndPointList": [
+ {
+ "name": "dummy.pod.ns.dummy-pod3",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "135.144.120.218",
+ "listenPort": "32004",
+ "latitude": "37.7022",
+ "longitude": "121.9358",
+ "registrationTime": "2017-07-18T15:39:17.367+0000",
+ "expirationTime": "9999-10-09T15:39:17.368+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:17.367+0000",
+ "updatedTimestamp": "2017-07-18T15:39:17.367+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ },
+ {
+ "name": "dummy.pod.ns.dummy-pod3",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "135.144.120.22",
+ "listenPort": "32004",
+ "latitude": "1.0",
+ "longitude": "1.0",
+ "registrationTime": "2017-07-18T15:39:17.816+0000",
+ "expirationTime": "9999-10-09T15:39:17.817+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:17.816+0000",
+ "updatedTimestamp": "2017-07-18T15:39:17.816+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ },
+ {
+ "name": "dummy.pod.ns.dummy-pod1",
+ "version": {
+ "major": 1,
+ "minor": 0,
+ "patch": "0"
+ },
+ "hostAddress": "135.144.120.218",
+ "listenPort": "32002",
+ "latitude": "1.0",
+ "longitude": "1.0",
+ "registrationTime": "2017-07-18T15:39:14.443+0000",
+ "expirationTime": "9999-10-09T15:39:14.453+0000",
+ "contextPath": "/",
+ "routeOffer": "DEFAULT",
+ "statusInfo": {
+ "status": "RUNNING"
+ },
+ "eventStatusInfo": {
+ "status": "RUNNING"
+ },
+ "validatorStatusInfo": {
+ "status": "RUNNING"
+ },
+ "operationalInfo": {
+ "createdBy": "edge",
+ "updatedBy": "edge",
+ "createdTimestamp": "2017-07-18T15:39:14.443+0000",
+ "updatedTimestamp": "2017-07-18T15:39:14.443+0000"
+ },
+ "protocol": "dummypod-port",
+ "properties": [
+ {
+ "name": "Environment",
+ "value": "DEV"
+ },
+ {
+ "name": "Kubernetes Namespace",
+ "value": "dummy-pod-ns"
+ },
+ {
+ "name": "cpfrun_cluster_name",
+ "value": "CI-PDK1-TFINIT-CJ9125401"
+ }
+ ],
+ "disableType": []
+ }
+ ]
+} \ No newline at end of file
diff --git a/common/src/test/resources/aai.properties b/common/src/test/resources/aai.properties
new file mode 100644
index 0000000000..9d9f1bdce9
--- /dev/null
+++ b/common/src/test/resources/aai.properties
@@ -0,0 +1 @@
+aai.endpoint=http://localhost:8443 \ No newline at end of file
diff --git a/common/src/test/resources/dmaap.properties b/common/src/test/resources/dmaap.properties
new file mode 100644
index 0000000000..8adb8e4976
--- /dev/null
+++ b/common/src/test/resources/dmaap.properties
@@ -0,0 +1,7 @@
+sdno.health-check.dmaap.username=m04768@mso.ecomp.att.com
+sdno.health-check.dmaap.password=eHQ1cUJrOUc
+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=m04768@mso.ecomp.att.com
+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
diff --git a/common/src/test/resources/mso-bad.json b/common/src/test/resources/mso-bad.json
index 42328efb92..57b271459e 100644
--- a/common/src/test/resources/mso-bad.json
+++ b/common/src/test/resources/mso-bad.json
@@ -1,23 +1,3 @@
-/*-
- * ============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=========================================================
- */
-
{
"asdc-connections":{,
"asdc-controller1":{
diff --git a/common/src/test/resources/mso2.json b/common/src/test/resources/mso2.json
index ee7fe124d2..bac30c495c 100644
--- a/common/src/test/resources/mso2.json
+++ b/common/src/test/resources/mso2.json
@@ -1,41 +1,20 @@
-/*-
- * ============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=========================================================
- */
-
{
- "asdc-connections":{
- "asdc-controller1":{
- "asdcUser": "user1B",
- "asdcConsumerGroup": "consumer1",
- "asdcConsumerId": "consumer1",
- "asdcEnvironmentName": "PROD",
- "asdcAddress": "localhost:8443",
- "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
- },
- "asdc-controller2":{
- "asdcUser": "user2B",
- "asdcConsumerGroup": "consumer2",
- "asdcConsumerId": "consumer2",
- "asdcEnvironmentName": "E2E",
- "asdcAddress": "localhost:8443",
- "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
- }
- }
-
-}
+ "asdc-connections": {
+ "asdc-controller1": {
+ "asdcUser": "user1B",
+ "asdcConsumerGroup": "consumer1",
+ "asdcConsumerId": "consumer1",
+ "asdcEnvironmentName": "PROD",
+ "asdcAddress": "localhost:8443",
+ "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
+ },
+ "asdc-controller2": {
+ "asdcUser": "user2B",
+ "asdcConsumerGroup": "consumer2",
+ "asdcConsumerId": "consumer2",
+ "asdcEnvironmentName": "E2E",
+ "asdcAddress": "localhost:8443",
+ "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
+ }
+ }
+} \ No newline at end of file
diff --git a/common/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json b/common/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json
new file mode 100644
index 0000000000..e388d3e9ad
--- /dev/null
+++ b/common/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json
@@ -0,0 +1,15 @@
+{
+ "event": {
+ "msoRequest": {
+ "requestClientName": "MSO",
+ "requestId": "abc123",
+ "requestTime": "test-time",
+ "sourceName": "source-name",
+ "reason": "reason",
+ "action": "Create Ticket",
+ "workflowId": "work-flow-Id",
+ "notification": "notification"
+ }
+}
+}
+
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json b/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json
new file mode 100644
index 0000000000..8c3ca1938d
--- /dev/null
+++ b/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json
@@ -0,0 +1,26 @@
+{
+ "body": {
+ "input": {
+ "request-hd-custom": {
+ "request-client-name": "MSO",
+ "request-user-id": "test-user",
+ "request-id": "test-request-id",
+ "health-diagnostic-code": "VROUTER000004",
+ "operation-type": "lport_mirroring_check",
+ "aai-param-list": [
+ {
+ "key": "configuration-id",
+ "value": "test-configuration-id"
+ },
+ {
+ "key": "interface-id",
+ "value": "test-interface-id"
+ }
+ ]
+ }
+ }
+ },
+ "operation": "health-diagnostic-custom",
+ "nodeLoc": "test-clli",
+ "nodeType": "VROUTER"
+} \ No newline at end of file
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json b/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json
new file mode 100644
index 0000000000..08220abe2d
--- /dev/null
+++ b/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json
@@ -0,0 +1,26 @@
+{
+ "body": {
+ "input": {
+ "request-hd-custom": {
+ "request-client-name": "MSO",
+ "request-user-id": "test-user",
+ "request-id": "test-request-id",
+ "health-diagnostic-code": "VROUTER000003",
+ "operation-type": "lport_mirroring_check",
+ "aai-param-list": [
+ {
+ "key": "configuration-id",
+ "value": "test-configuration-id"
+ },
+ {
+ "key": "interface-id",
+ "value": "test-interface-id"
+ }
+ ]
+ }
+ }
+ },
+ "operation": "health-diagnostic-custom",
+ "nodeLoc": "test-clli",
+ "nodeType": "VROUTER"
+} \ No newline at end of file
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json b/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json
new file mode 100644
index 0000000000..834fcc8e72
--- /dev/null
+++ b/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json
@@ -0,0 +1,22 @@
+{
+ "body": {
+ "input": {
+ "request-hd-custom": {
+ "request-client-name": "MSO",
+ "request-user-id": "test-user",
+ "request-id": "test-request-id",
+ "health-diagnostic-code": "VROUTER000004",
+ "operation-type": "mirroring_check",
+ "aai-param-list": [
+ {
+ "key": "configuration-id",
+ "value": "test-configuration-id"
+ }
+ ]
+ }
+ }
+ },
+ "operation": "health-diagnostic-custom",
+ "nodeLoc": "test-clli",
+ "nodeType": "VROUTER"
+} \ No newline at end of file
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json b/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json
new file mode 100644
index 0000000000..19d934d291
--- /dev/null
+++ b/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json
@@ -0,0 +1,22 @@
+{
+ "body": {
+ "input": {
+ "request-hd-custom": {
+ "request-client-name": "MSO",
+ "request-user-id": "test-user",
+ "request-id": "test-request-id",
+ "health-diagnostic-code": "VROUTER000003",
+ "operation-type": "mirroring_check",
+ "aai-param-list": [
+ {
+ "key": "configuration-id",
+ "value": "test-configuration-id"
+ }
+ ]
+ }
+ }
+ },
+ "operation": "health-diagnostic-custom",
+ "nodeLoc": "test-clli",
+ "nodeType": "VROUTER"
+}
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json b/common/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json
new file mode 100644
index 0000000000..15160b9dd9
--- /dev/null
+++ b/common/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json
@@ -0,0 +1,25 @@
+{
+ "body": {
+ "output": {
+ "response-hd-custom": {
+ "response-status": "Failure",
+ "cached-data": "false",
+ "response-interface-type": "ansible",
+ "response-id": "191bf423-8473-4f7c-9fbb-e5dcbb40a12b",
+ "remote_end_time": "2017-10-13T14:51:53.490+0000",
+ "response-client-name": "MSO",
+ "user_id": "md5621",
+ "remote_start_time": "2017-10-13T14:51:53.173+0000",
+ "error-message": "my error message",
+ "connection-failure-msg": "SDNO was unable to connect to an Ansible REST API server; Please ensure Ansible REST server is running"
+ }
+ }
+ },
+ "result-info": {
+ "code": "200",
+ "status": "SUCCESS",
+ "request-id": "xyz123",
+ "client-name": "MSO",
+ "processing-host": "sdno-sdno-mtsnjv9sdno01"
+ }
+} \ No newline at end of file
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/output-success.json b/common/src/test/resources/org/openecomp/mso/client/sdno/output-success.json
new file mode 100644
index 0000000000..a6794327d8
--- /dev/null
+++ b/common/src/test/resources/org/openecomp/mso/client/sdno/output-success.json
@@ -0,0 +1,22 @@
+{
+ "body": {
+ "output": {
+ "response-healthdiagnostic": {
+ "response-node-ip": "192.20.127.76",
+ "response-id": "xyz123",
+ "response-node-name": "mtvnjv9aads11",
+ "response-status": "Success",
+ "response-interface-type": "ssh",
+ "response-details-json": "result",
+ "cached-data": "false"
+ }
+ }
+ },
+ "result-info": {
+ "client-name": "MSO",
+ "code": "200",
+ "processing-host": "sdno1-host01",
+ "request-id": "xyz123",
+ "status": "SUCCESS"
+ }
+} \ No newline at end of file
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/response.json b/common/src/test/resources/org/openecomp/mso/client/sdno/response.json
new file mode 100644
index 0000000000..2355e86938
--- /dev/null
+++ b/common/src/test/resources/org/openecomp/mso/client/sdno/response.json
@@ -0,0 +1,17 @@
+{
+
+ "result-info": {
+
+ "client-name": "MSO",
+
+ "code": "202",
+
+ "processing-host": "sdno1-host01",
+
+ "request-id": "xyz123",
+
+ "status": "ACCEPTED"
+
+ }
+
+} \ No newline at end of file
diff --git a/common/src/test/resources/policy.properties b/common/src/test/resources/policy.properties
new file mode 100644
index 0000000000..ef064e8bc0
--- /dev/null
+++ b/common/src/test/resources/policy.properties
@@ -0,0 +1,4 @@
+policy.endpoint=https://policyhost:8081/pdp/api/
+policy.client.auth=Basic bTAzNzQzOnBvbGljeVIwY2sk
+policy.auth=Basic dGVzdHBkcDphbHBoYTEyMw==
+policy.environment=TEST \ No newline at end of file