aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Hwang <mhwang@research.att.com>2017-05-09 09:52:15 -0400
committerVijay Venkatesh Kumar <vv770d@att.com>2017-05-10 20:23:54 +0000
commit03b4fd0a6e6bc0ce88b8904cfa01869b74a2f210 (patch)
tree8d76a527ed86807658a879df6153c6c6e73ba971
parent473bcb6c7dea189d9481f894b82358f6ec93629b (diff)
[DCAE-16] Merge changes from internal AT&T 1707
Non-functional changes like licensing, pom consolidation, filtering of keywords. Functional changes include support for integration with asdc which caused an API breaking change. Change-Id: I5a52d968c6403a7d35c4bbf49f7ddf7a5ba4428e Signed-off-by: Michael Hwang <mhwang@research.att.com>
-rw-r--r--CHANGELOG.md15
-rw-r--r--LICENSE.txt22
-rw-r--r--docs/API.adoc623
-rw-r--r--docs/API.md528
-rw-r--r--docs/DatabaseTables.md10
-rw-r--r--docs/Deployment.md2
-rw-r--r--license/pom.xml29
-rw-r--r--license/src/main/resources/licenses/att_license/header.txt4
-rw-r--r--license/src/main/resources/licenses/att_license/license.txt2
-rw-r--r--license/src/main/resources/licenses/licenses.properties1
-rw-r--r--pom.xml147
-rw-r--r--src/gen/java/io/swagger/api/ApiException.java27
-rw-r--r--src/gen/java/io/swagger/api/ApiOriginFilter.java27
-rw-r--r--src/gen/java/io/swagger/api/ApiResponseMessage.java27
-rw-r--r--src/gen/java/io/swagger/api/DcaeServiceTypesApi.java118
-rw-r--r--src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java39
-rw-r--r--src/gen/java/io/swagger/api/DcaeServicesApi.java44
-rw-r--r--src/gen/java/io/swagger/api/DcaeServicesApiService.java29
-rw-r--r--src/gen/java/io/swagger/api/DcaeServicesGroupbyApi.java27
-rw-r--r--src/gen/java/io/swagger/api/DcaeServicesGroupbyApiService.java27
-rw-r--r--src/gen/java/io/swagger/api/JacksonJsonProvider.java27
-rw-r--r--src/gen/java/io/swagger/api/NotFoundException.java27
-rw-r--r--src/gen/java/io/swagger/api/StringUtil.java27
-rw-r--r--src/gen/java/io/swagger/model/DCAEService.java31
-rw-r--r--src/gen/java/io/swagger/model/DCAEServiceComponent.java27
-rw-r--r--src/gen/java/io/swagger/model/DCAEServiceComponentRequest.java27
-rw-r--r--src/gen/java/io/swagger/model/DCAEServiceGroupByResults.java27
-rw-r--r--src/gen/java/io/swagger/model/DCAEServiceGroupByResultsPropertyValues.java27
-rw-r--r--src/gen/java/io/swagger/model/DCAEServiceRequest.java51
-rw-r--r--src/gen/java/io/swagger/model/DCAEServiceType.java294
-rw-r--r--src/gen/java/io/swagger/model/DCAEServiceTypeRequest.java342
-rw-r--r--src/gen/java/io/swagger/model/InlineResponse200.java27
-rw-r--r--src/gen/java/io/swagger/model/InlineResponse2001.java27
-rw-r--r--src/gen/java/io/swagger/model/InlineResponse200Links.java27
-rw-r--r--src/gen/java/io/swagger/model/Link.java27
-rw-r--r--src/main/java/io/swagger/api/Bootstrap.java29
-rw-r--r--src/main/java/io/swagger/api/factories/DcaeServiceTypesApiServiceFactory.java27
-rw-r--r--src/main/java/io/swagger/api/factories/DcaeServicesApiServiceFactory.java34
-rw-r--r--src/main/java/io/swagger/api/factories/DcaeServicesGroupbyApiServiceFactory.java27
-rw-r--r--src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java194
-rw-r--r--src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java95
-rw-r--r--src/main/java/io/swagger/api/impl/DcaeServicesGroupbyApiServiceImpl.java31
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/InventoryApplication.java85
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/InventoryConfiguration.java57
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/LinkSerializer.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/clients/DCAEControllerClient.java29
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java34
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceComponentsDAO.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTransactionDAO.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTypeTransactionDAO.java43
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTypesDAO.java82
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/daos/DCAEServicesDAO.java41
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/daos/InventoryDAO.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/daos/InventoryDAOManager.java101
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/dbthings/StringListArgument.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceComponentObjectMapper.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceObjectMapper.java29
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapper.java35
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceComponentObject.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceObject.java41
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceTypeObject.java81
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerClientException.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerConnectionException.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerTimeoutException.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/exceptions/DatabusControllerClientException.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DBIExceptionMapper.java82
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerConnectionExceptionMapper.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerExceptionMapper.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerTimeoutExceptionMapper.java27
-rw-r--r--src/main/java/org/openecomp/dcae/inventory/providers/NotFoundExceptionMapper.java27
-rw-r--r--src/main/resources/config.yml38
-rw-r--r--src/main/resources/logback.xml25
-rw-r--r--src/test/java/DcaeServiceTypesApiServiceImplTests.java220
-rw-r--r--src/test/java/org/openecomp/dcae/inventory/daos/InventoryDAOManagerTests.java44
-rw-r--r--src/test/java/org/openecomp/dcae/inventory/exception/mappers/DBIExceptionMapperTests.java117
-rw-r--r--swagger_inventory.yaml680
77 files changed, 3308 insertions, 2188 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d615560..ddc7ee2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,19 @@
# Change Log
-## 1.0.0
+All notable changes to this project will be documented in this file.
-2016-08-22
+The format is based on [Keep a Changelog](http://keepachangelog.com/)
+and this project adheres to [Semantic Versioning](http://semver.org/).
-Changes:
+The version in the brackets represents the version of DCAE inventory and not the ONAP DCAE version.
+
+## [2.4.0]
+
+ONAP version: 1.1.0
+
+* Replace the ONAP 1.0.0 code base with the modified internal 1707 code base which includes support for versioning of dcae service types and asdc integration work.
+
+## [1.0.0]
* DCAE service type resource's data model expanded to have the fields: `serviceIds` and `serviceLocations`
* Underlying Postgres table `dcae_service_types` schema changed to store the new fields
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index ae12da2..0000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright © 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
- */
diff --git a/docs/API.adoc b/docs/API.adoc
deleted file mode 100644
index ea837e6..0000000
--- a/docs/API.adoc
+++ /dev/null
@@ -1,623 +0,0 @@
-= DCAE Inventory API
-
-
-[[_overview]]
-== Overview
-DCAE Inventory is a web service that provides the following:
-
-. Real-time data on all DCAE services and their components
-. Comprehensive details on available DCAE service types
-
-
-=== Version information
-[%hardbreaks]
-_Version_ : 1.0.0
-
-
-
-
-[[_paths]]
-== Paths
-
-[[_dcaeservicetypesget]]
-=== GET /dcae-service-types
-
-==== Description
-Get a list of `DCAEServiceType` objects.
-
-
-==== Parameters
-
-[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
-|===
-|Type|Name|Description|Schema|Default
-|*Query*|*offset* +
-_optional_|Query resultset offset used for pagination (zero-based)|integer(int32)|
-|*Query*|*serviceId* +
-_optional_||string|
-|*Query*|*serviceLocation* +
-_optional_||string|
-|*Query*|*vnfType* +
-_optional_||string|
-|===
-
-
-==== Responses
-
-[options="header", cols=".^2,.^14,.^4"]
-|===
-|HTTP Code|Description|Schema
-|*200*|List of `DCAEServiceType` objects|<<_inlineresponse200,InlineResponse200>>
-|===
-
-
-==== Consumes
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-==== Produces
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-[[_dcaeservicetypestypenameget]]
-=== GET /dcae-service-types/{typeName}
-
-==== Description
-Get a `DCAEServiceType` object.
-
-
-==== Parameters
-
-[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
-|===
-|Type|Name|Description|Schema|Default
-|*Path*|*typeName* +
-_required_||string|
-|===
-
-
-==== Responses
-
-[options="header", cols=".^2,.^14,.^4"]
-|===
-|HTTP Code|Description|Schema
-|*200*|Single `DCAEServiceType` object|<<_dcaeservicetype,DCAEServiceType>>
-|*404*|Resource not found|<<_dcaeservicetype,DCAEServiceType>>
-|===
-
-
-==== Consumes
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-==== Produces
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-[[_dcaeservicetypestypenameput]]
-=== PUT /dcae-service-types/{typeName}
-
-==== Description
-Inserts a new `DCAEServiceType` or updates an existing instance. Updates are only allowed iff there are no running DCAE services of the requested type,
-
-
-==== Parameters
-
-[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
-|===
-|Type|Name|Description|Schema|Default
-|*Path*|*typeName* +
-_required_||string|
-|*Body*|*body* +
-_required_||<<_dcaeservicetyperequest,DCAEServiceTypeRequest>>|
-|===
-
-
-==== Responses
-
-[options="header", cols=".^2,.^14,.^4"]
-|===
-|HTTP Code|Description|Schema
-|*200*|Single `DCAEServiceType` object.|<<_dcaeservicetype,DCAEServiceType>>
-|*400*|Bad request provided.|<<_apiresponsemessage,ApiResponseMessage>>
-|*409*|Failed to update because there are still DCAE services of the requested type running.|<<_apiresponsemessage,ApiResponseMessage>>
-|===
-
-
-==== Consumes
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-==== Produces
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-[[_dcaeservicesget]]
-=== GET /dcae-services
-
-==== Description
-Get a list of `DCAEService` objects.
-
-
-==== Parameters
-
-[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
-|===
-|Type|Name|Description|Schema|Default
-|*Query*|*componentType* +
-_optional_|Use to filter by a specific DCAE service component type|string|
-|*Query*|*created* +
-_optional_|Use to filter by created time|string|
-|*Query*|*offset* +
-_optional_|Query resultset offset used for pagination (zero-based)|integer(int32)|
-|*Query*|*shareable* +
-_optional_|Use to filter by DCAE services that have shareable components or not|boolean|
-|*Query*|*typeName* +
-_optional_|DCAE service type name|string|
-|*Query*|*vnfId* +
-_optional_||string|
-|*Query*|*vnfLocation* +
-_optional_||string|
-|*Query*|*vnfType* +
-_optional_||string|
-|===
-
-
-==== Responses
-
-[options="header", cols=".^2,.^14,.^4"]
-|===
-|HTTP Code|Description|Schema
-|*200*|List of `DCAEService` objects|<<_inlineresponse2001,InlineResponse2001>>
-|*502*|Bad response from DCAE controller|<<_apiresponsemessage,ApiResponseMessage>>
-|*504*|Failed to connect with DCAE controller|<<_apiresponsemessage,ApiResponseMessage>>
-|===
-
-
-==== Consumes
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-==== Produces
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-[[_dcaeservicesgroupbypropertynameget]]
-=== GET /dcae-services-groupby/{propertyName}
-
-==== Description
-Get a list of unique values for the given `propertyName`
-
-
-==== Parameters
-
-[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
-|===
-|Type|Name|Description|Schema|Default
-|*Path*|*propertyName* +
-_required_|Property to find unique values. Restricted to `type`, `vnfType`, `vnfLocation`|string|
-|===
-
-
-==== Responses
-
-[options="header", cols=".^2,.^14,.^4"]
-|===
-|HTTP Code|Description|Schema
-|*200*|List of unique property values|<<_dcaeservicegroupbyresults,DCAEServiceGroupByResults>>
-|===
-
-
-==== Consumes
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-==== Produces
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-[[_dcaeservicesserviceidget]]
-=== GET /dcae-services/{serviceId}
-
-==== Description
-Get a `DCAEService` object.
-
-
-==== Parameters
-
-[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
-|===
-|Type|Name|Description|Schema|Default
-|*Path*|*serviceId* +
-_required_||string|
-|===
-
-
-==== Responses
-
-[options="header", cols=".^2,.^14,.^4"]
-|===
-|HTTP Code|Description|Schema
-|*200*|Single `DCAEService` object|<<_dcaeservice,DCAEService>>
-|*404*|DCAE service not found|<<_apiresponsemessage,ApiResponseMessage>>
-|*502*|Bad response from DCAE controller|<<_apiresponsemessage,ApiResponseMessage>>
-|*504*|Failed to connect with DCAE controller|<<_apiresponsemessage,ApiResponseMessage>>
-|===
-
-
-==== Consumes
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-==== Produces
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-[[_dcaeservicesserviceidput]]
-=== PUT /dcae-services/{serviceId}
-
-==== Description
-Put a new or update an existing `DCAEService` object.
-
-
-==== Parameters
-
-[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
-|===
-|Type|Name|Description|Schema|Default
-|*Path*|*serviceId* +
-_required_||string|
-|*Body*|*body* +
-_required_||<<_dcaeservicerequest,DCAEServiceRequest>>|
-|===
-
-
-==== Responses
-
-[options="header", cols=".^2,.^14,.^4"]
-|===
-|HTTP Code|Description|Schema
-|*200*|Single `DCAEService` object|<<_dcaeservice,DCAEService>>
-|*422*|Bad request provided|<<_apiresponsemessage,ApiResponseMessage>>
-|===
-
-
-==== Consumes
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-==== Produces
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-[[_dcaeservicesserviceiddelete]]
-=== DELETE /dcae-services/{serviceId}
-
-==== Description
-Remove an existing `DCAEService` object.
-
-
-==== Parameters
-
-[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
-|===
-|Type|Name|Description|Schema|Default
-|*Path*|*serviceId* +
-_required_||string|
-|===
-
-
-==== Responses
-
-[options="header", cols=".^2,.^14,.^4"]
-|===
-|HTTP Code|Description|Schema
-|*200*|DCAE service has been removed|No Content
-|*404*|Unknown DCAE service|<<_apiresponsemessage,ApiResponseMessage>>
-|===
-
-
-==== Consumes
-
-* `application/vnd.dcae.inventory.v1+json`
-* `application/json`
-
-
-==== Produces
-
-* `application/json`
-* `application/vnd.dcae.inventory.v1+json`
-
-
-
-
-[[_definitions]]
-== Definitions
-
-[[_apiresponsemessage]]
-=== ApiResponseMessage
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*code* +
-_optional_||integer(int32)
-|*message* +
-_optional_||string
-|*type* +
-_optional_||string
-|===
-
-
-[[_dcaeservice]]
-=== DCAEService
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*components* +
-_optional_||< <<_dcaeservicecomponent,DCAEServiceComponent>> > array
-|*created* +
-_optional_||string(date-time)
-|*deploymentRef* +
-_optional_|Reference to a Cloudify deployment|string
-|*modified* +
-_optional_||string(date-time)
-|*selfLink* +
-_optional_|Link.title is serviceId|<<_link,Link>>
-|*serviceId* +
-_optional_||string
-|*typeLink* +
-_optional_|Link.title is typeName|<<_link,Link>>
-|*vnfId* +
-_optional_||string
-|*vnfLink* +
-_optional_|Link.title is vnfId|<<_link,Link>>
-|*vnfLocation* +
-_optional_|Location information of the associated VNF|string
-|*vnfType* +
-_optional_||string
-|===
-
-
-[[_dcaeservicecomponent]]
-=== DCAEServiceComponent
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*componentId* +
-_required_|The id format is unique to the source|string
-|*componentLink* +
-_required_|Link to the underlying resource of this component|<<_link,Link>>
-|*componentSource* +
-_required_|Specifies the name of the underying source service that is responsible for this components|enum (DCAEController, DMaaPController)
-|*componentType* +
-_required_||string
-|*created* +
-_required_||string(date-time)
-|*location* +
-_optional_|Location information of the component|string
-|*modified* +
-_required_||string(date-time)
-|*shareable* +
-_required_|Used to determine if this component can be shared amongst different DCAE services|integer(int32)
-|*status* +
-_optional_||string
-|===
-
-
-[[_dcaeservicecomponentrequest]]
-=== DCAEServiceComponentRequest
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*componentId* +
-_required_|The id format is unique to the source|string
-|*componentSource* +
-_required_|Specifies the name of the underying source service that is responsible for this components|enum (DCAEController, DMaaPController)
-|*componentType* +
-_required_||string
-|*shareable* +
-_required_|Used to determine if this component can be shared amongst different DCAE services|integer(int32)
-|===
-
-
-[[_dcaeservicegroupbyresults]]
-=== DCAEServiceGroupByResults
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*propertyName* +
-_optional_|Property name of DCAE service that the group by operation was performed on|string
-|*propertyValues* +
-_optional_||< <<_dcaeservicegroupbyresultspropertyvalues,DCAEServiceGroupByResultsPropertyValues>> > array
-|===
-
-
-[[_dcaeservicegroupbyresultspropertyvalues]]
-=== DCAEServiceGroupByResultsPropertyValues
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*count* +
-_optional_||integer(int32)
-|*dcaeServiceQueryLink* +
-_optional_|Link.title is the DCAE service property value. Following this link will provide a list of DCAE services that all have this property value.|<<_link,Link>>
-|*propertyValue* +
-_optional_||string
-|===
-
-
-[[_dcaeservicerequest]]
-=== DCAEServiceRequest
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*components* +
-_required_|List of DCAE service components that this service is composed of|< <<_dcaeservicecomponentrequest,DCAEServiceComponentRequest>> > array
-|*deploymentRef* +
-_optional_|Reference to a Cloudify deployment|string
-|*typeName* +
-_required_|Name of the associated DCAE service type|string
-|*vnfId* +
-_required_|Id of the associated VNF that this service is monitoring|string
-|*vnfLocation* +
-_required_|Location identifier of the associated VNF that this service is monitoring|string
-|*vnfType* +
-_required_|The type of the associated VNF that this service is monitoring|string
-|===
-
-
-[[_dcaeservicetype]]
-=== DCAEServiceType
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*blueprintTemplate* +
-_required_|String representation of a Cloudify blueprint with unbound variables|string
-|*created* +
-_required_|Created timestamp for this DCAE service type in epoch time|string(date-time)
-|*owner* +
-_required_|Name of the owner of this DCAE service type|string
-|*selfLink* +
-_optional_|Link.title is typeName|<<_link,Link>>
-|*serviceIds* +
-_optional_|List of service ids that are associated with this DCAE service type|< string > array
-|*serviceLocations* +
-_optional_|List of service locations that are associated with this DCAE service type|< string > array
-|*typeName* +
-_required_|Unique name for this DCAE service type|string
-|*vnfTypes* +
-_required_|List of VNF types associated with this DCAE service type|< string > array
-|===
-
-
-[[_dcaeservicetyperequest]]
-=== DCAEServiceTypeRequest
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*blueprintTemplate* +
-_required_|String representation of a Cloudify blueprint with unbound variables|string
-|*owner* +
-_required_||string
-|*serviceIds* +
-_optional_|List of service ids that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service id.|< string > array
-|*serviceLocations* +
-_optional_|List of service locations that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service location.|< string > array
-|*vnfTypes* +
-_required_||< string > array
-|===
-
-
-[[_inlineresponse200]]
-=== InlineResponse200
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*items* +
-_optional_||< <<_dcaeservicetype,DCAEServiceType>> > array
-|*links* +
-_optional_||<<_inlineresponse200links,InlineResponse200Links>>
-|*totalCount* +
-_optional_||integer(int32)
-|===
-
-
-[[_inlineresponse2001]]
-=== InlineResponse2001
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*items* +
-_optional_||< <<_dcaeservice,DCAEService>> > array
-|*links* +
-_optional_||<<_inlineresponse200links,InlineResponse200Links>>
-|*totalCount* +
-_optional_||integer(int32)
-|===
-
-
-[[_inlineresponse200links]]
-=== InlineResponse200Links
-Pagination links
-
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*nextLink* +
-_optional_||<<_link,Link>>
-|*previousLink* +
-_optional_||<<_link,Link>>
-|===
-
-
-[[_link]]
-=== Link
-
-[options="header", cols=".^3,.^11,.^4"]
-|===
-|Name|Description|Schema
-|*params* +
-_optional_||< string, string > map
-|*rel* +
-_optional_||string
-|*rels* +
-_optional_||< string > array
-|*title* +
-_optional_||string
-|*type* +
-_optional_||string
-|*uri* +
-_optional_||string
-|*uriBuilder* +
-_optional_||<<_uribuilder,UriBuilder>>
-|===
-
-
-[[_uribuilder]]
-=== UriBuilder
-_Type_ : object
-
-
-
-
-
diff --git a/docs/API.md b/docs/API.md
new file mode 100644
index 0000000..a6f0472
--- /dev/null
+++ b/docs/API.md
@@ -0,0 +1,528 @@
+# DCAE Inventory API
+
+
+<a name="overview"></a>
+## Overview
+DCAE Inventory is a web service that provides the following:
+
+1. Real-time data on all DCAE services and their components
+2. Comprehensive details on available DCAE service types
+
+
+### Version information
+*Version* : 2.1.0
+
+
+### Contact information
+*Contact Email* : dcae@lists.openecomp.org
+
+
+
+
+<a name="paths"></a>
+## Paths
+
+<a name="dcaeservicetypestypenameput"></a>
+### POST /dcae-service-types
+
+#### Description
+Inserts a new `DCAEServiceType` or updates an existing instance. Updates are only allowed iff there are no running DCAE services of the requested type,
+
+
+#### Parameters
+
+|Type|Name|Description|Schema|Default|
+|---|---|---|---|---|
+|**Body**|**body** <br>*required*||[DCAEServiceTypeRequest](#dcaeservicetyperequest)||
+
+
+#### Responses
+
+|HTTP Code|Description|Schema|
+|---|---|---|
+|**200**|Single `DCAEServiceType` object.|[DCAEServiceType](#dcaeservicetype)|
+|**400**|Bad request provided.|[ApiResponseMessage](#apiresponsemessage)|
+|**409**|Failed to update because there are still DCAE services of the requested type running.|[ApiResponseMessage](#apiresponsemessage)|
+
+
+#### Consumes
+
+* `application/json`
+
+
+#### Produces
+
+* `application/json`
+
+
+<a name="dcaeservicetypesget"></a>
+### GET /dcae-service-types
+
+#### Description
+Get a list of `DCAEServiceType` objects.
+
+
+#### Parameters
+
+|Type|Name|Description|Schema|Default|
+|---|---|---|---|---|
+|**Query**|**asdcResourceId** <br>*optional*|Filter by associated asdc design resource id. Setting this to `NONE` will return instances that have asdc resource id set to null|string||
+|**Query**|**asdcServiceId** <br>*optional*|Filter by associated asdc design service id. Setting this to `NONE` will return instances that have asdc service id set to null|string||
+|**Query**|**offset** <br>*optional*|Query resultset offset used for pagination (zero-based)|integer(int32)||
+|**Query**|**onlyActive** <br>*optional*|If set to true, query returns only *active* DCAE service types. If set to false, then all DCAE service types are returned. Default is true|boolean|`"true"`|
+|**Query**|**onlyLatest** <br>*optional*|If set to true, query returns just the latest versions of DCAE service types. If set to false, then all versions are returned. Default is true|boolean|`"true"`|
+|**Query**|**serviceId** <br>*optional*|Filter by assocaited service id. Instances with service id null or empty is always returned.|string||
+|**Query**|**serviceLocation** <br>*optional*|Filter by associated service location. Instances with service location null or empty is always returned.|string||
+|**Query**|**typeName** <br>*optional*|Filter by service type name|string||
+|**Query**|**vnfType** <br>*optional*|Filter by associated vnf type. No wildcards, matches are explicit. This field is treated case insensitive.|string||
+
+
+#### Responses
+
+|HTTP Code|Description|Schema|
+|---|---|---|
+|**200**|List of `DCAEServiceType` objects|[InlineResponse200](#inlineresponse200)|
+
+
+#### Consumes
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+#### Produces
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+<a name="dcaeservicetypestypeidget"></a>
+### GET /dcae-service-types/{typeId}
+
+#### Description
+Get a `DCAEServiceType` object.
+
+
+#### Parameters
+
+|Type|Name|Description|Schema|Default|
+|---|---|---|---|---|
+|**Path**|**typeId** <br>*required*||string||
+
+
+#### Responses
+
+|HTTP Code|Description|Schema|
+|---|---|---|
+|**200**|Single `DCAEServiceType` object|[DCAEServiceType](#dcaeservicetype)|
+|**404**|Resource not found|[DCAEServiceType](#dcaeservicetype)|
+
+
+#### Consumes
+
+* `application/json`
+
+
+#### Produces
+
+* `application/json`
+
+
+<a name="dcaeservicetypestypeiddelete"></a>
+### DELETE /dcae-service-types/{typeId}
+
+#### Description
+Deactivates existing `DCAEServiceType` instances
+
+
+#### Parameters
+
+|Type|Name|Description|Schema|Default|
+|---|---|---|---|---|
+|**Path**|**typeId** <br>*required*||string||
+
+
+#### Responses
+
+|HTTP Code|Description|Schema|
+|---|---|---|
+|**200**|`DCAEServiceType` has been deactivated|[ApiResponseMessage](#apiresponsemessage)|
+|**404**|`DCAEServiceType` not found|[ApiResponseMessage](#apiresponsemessage)|
+|**410**|`DCAEServiceType` already gone|[ApiResponseMessage](#apiresponsemessage)|
+
+
+#### Consumes
+
+* `application/vnd.dcae.inventory.v1+json`
+* `application/json`
+
+
+#### Produces
+
+* `application/vnd.dcae.inventory.v1+json`
+* `application/json`
+
+
+<a name="dcaeservicesget"></a>
+### GET /dcae-services
+
+#### Description
+Get a list of `DCAEService` objects.
+
+
+#### Parameters
+
+|Type|Name|Description|Schema|Default|
+|---|---|---|---|---|
+|**Query**|**componentType** <br>*optional*|Use to filter by a specific DCAE service component type|string||
+|**Query**|**created** <br>*optional*|Use to filter by created time|string||
+|**Query**|**offset** <br>*optional*|Query resultset offset used for pagination (zero-based)|integer(int32)||
+|**Query**|**shareable** <br>*optional*|Use to filter by DCAE services that have shareable components or not|boolean||
+|**Query**|**typeId** <br>*optional*|DCAE service type name|string||
+|**Query**|**vnfId** <br>*optional*||string||
+|**Query**|**vnfLocation** <br>*optional*||string||
+|**Query**|**vnfType** <br>*optional*|Filter by associated vnf type. This field is treated case insensitive.|string||
+
+
+#### Responses
+
+|HTTP Code|Description|Schema|
+|---|---|---|
+|**200**|List of `DCAEService` objects|[InlineResponse2001](#inlineresponse2001)|
+|**502**|Bad response from DCAE controller|[ApiResponseMessage](#apiresponsemessage)|
+|**504**|Failed to connect with DCAE controller|[ApiResponseMessage](#apiresponsemessage)|
+
+
+#### Consumes
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+#### Produces
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+<a name="dcaeservicesgroupbypropertynameget"></a>
+### GET /dcae-services-groupby/{propertyName}
+
+#### Description
+Get a list of unique values for the given `propertyName`
+
+
+#### Parameters
+
+|Type|Name|Description|Schema|Default|
+|---|---|---|---|---|
+|**Path**|**propertyName** <br>*required*|Property to find unique values. Restricted to `type`, `vnfType`, `vnfLocation`|string||
+
+
+#### Responses
+
+|HTTP Code|Description|Schema|
+|---|---|---|
+|**200**|List of unique property values|[DCAEServiceGroupByResults](#dcaeservicegroupbyresults)|
+
+
+#### Consumes
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+#### Produces
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+<a name="dcaeservicesserviceidget"></a>
+### GET /dcae-services/{serviceId}
+
+#### Description
+Get a `DCAEService` object.
+
+
+#### Parameters
+
+|Type|Name|Description|Schema|Default|
+|---|---|---|---|---|
+|**Path**|**serviceId** <br>*required*||string||
+
+
+#### Responses
+
+|HTTP Code|Description|Schema|
+|---|---|---|
+|**200**|Single `DCAEService` object|[DCAEService](#dcaeservice)|
+|**404**|DCAE service not found|[ApiResponseMessage](#apiresponsemessage)|
+|**502**|Bad response from DCAE controller|[ApiResponseMessage](#apiresponsemessage)|
+|**504**|Failed to connect with DCAE controller|[ApiResponseMessage](#apiresponsemessage)|
+
+
+#### Consumes
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+#### Produces
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+<a name="dcaeservicesserviceidput"></a>
+### PUT /dcae-services/{serviceId}
+
+#### Description
+Put a new or update an existing `DCAEService` object.
+
+
+#### Parameters
+
+|Type|Name|Description|Schema|Default|
+|---|---|---|---|---|
+|**Path**|**serviceId** <br>*required*||string||
+|**Body**|**body** <br>*required*||[DCAEServiceRequest](#dcaeservicerequest)||
+
+
+#### Responses
+
+|HTTP Code|Description|Schema|
+|---|---|---|
+|**200**|Single `DCAEService` object|[DCAEService](#dcaeservice)|
+|**422**|Bad request provided|[ApiResponseMessage](#apiresponsemessage)|
+
+
+#### Consumes
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+#### Produces
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+<a name="dcaeservicesserviceiddelete"></a>
+### DELETE /dcae-services/{serviceId}
+
+#### Description
+Remove an existing `DCAEService` object.
+
+
+#### Parameters
+
+|Type|Name|Description|Schema|Default|
+|---|---|---|---|---|
+|**Path**|**serviceId** <br>*required*||string||
+
+
+#### Responses
+
+|HTTP Code|Description|Schema|
+|---|---|---|
+|**200**|DCAE service has been removed|No Content|
+|**404**|Unknown DCAE service|[ApiResponseMessage](#apiresponsemessage)|
+
+
+#### Consumes
+
+* `application/vnd.dcae.inventory.v1+json`
+* `application/json`
+
+
+#### Produces
+
+* `application/json`
+* `application/vnd.dcae.inventory.v1+json`
+
+
+
+
+<a name="definitions"></a>
+## Definitions
+
+<a name="apiresponsemessage"></a>
+### ApiResponseMessage
+
+|Name|Description|Schema|
+|---|---|---|
+|**code** <br>*optional*||integer(int32)|
+|**message** <br>*optional*||string|
+|**type** <br>*optional*||string|
+
+
+<a name="dcaeservice"></a>
+### DCAEService
+
+|Name|Description|Schema|
+|---|---|---|
+|**components** <br>*optional*||< [DCAEServiceComponent](#dcaeservicecomponent) > array|
+|**created** <br>*optional*||string(date-time)|
+|**deploymentRef** <br>*optional*|Reference to a Cloudify deployment|string|
+|**modified** <br>*optional*||string(date-time)|
+|**selfLink** <br>*optional*|Link.title is serviceId|[Link](#link)|
+|**serviceId** <br>*optional*||string|
+|**typeLink** <br>*optional*|Link.title is typeId|[Link](#link)|
+|**vnfId** <br>*optional*||string|
+|**vnfLink** <br>*optional*|Link.title is vnfId|[Link](#link)|
+|**vnfLocation** <br>*optional*|Location information of the associated VNF|string|
+|**vnfType** <br>*optional*||string|
+
+
+<a name="dcaeservicecomponent"></a>
+### DCAEServiceComponent
+
+|Name|Description|Schema|
+|---|---|---|
+|**componentId** <br>*required*|The id format is unique to the source|string|
+|**componentLink** <br>*required*|Link to the underlying resource of this component|[Link](#link)|
+|**componentSource** <br>*required*|Specifies the name of the underying source service that is responsible for this components|enum (DCAEController, DMaaPController)|
+|**componentType** <br>*required*||string|
+|**created** <br>*required*||string(date-time)|
+|**location** <br>*optional*|Location information of the component|string|
+|**modified** <br>*required*||string(date-time)|
+|**shareable** <br>*required*|Used to determine if this component can be shared amongst different DCAE services|integer(int32)|
+|**status** <br>*optional*||string|
+
+
+<a name="dcaeservicecomponentrequest"></a>
+### DCAEServiceComponentRequest
+
+|Name|Description|Schema|
+|---|---|---|
+|**componentId** <br>*required*|The id format is unique to the source|string|
+|**componentSource** <br>*required*|Specifies the name of the underying source service that is responsible for this components|enum (DCAEController, DMaaPController)|
+|**componentType** <br>*required*||string|
+|**shareable** <br>*required*|Used to determine if this component can be shared amongst different DCAE services|integer(int32)|
+
+
+<a name="dcaeservicegroupbyresults"></a>
+### DCAEServiceGroupByResults
+
+|Name|Description|Schema|
+|---|---|---|
+|**propertyName** <br>*optional*|Property name of DCAE service that the group by operation was performed on|string|
+|**propertyValues** <br>*optional*||< [DCAEServiceGroupByResultsPropertyValues](#dcaeservicegroupbyresultspropertyvalues) > array|
+
+
+<a name="dcaeservicegroupbyresultspropertyvalues"></a>
+### DCAEServiceGroupByResultsPropertyValues
+
+|Name|Description|Schema|
+|---|---|---|
+|**count** <br>*optional*||integer(int32)|
+|**dcaeServiceQueryLink** <br>*optional*|Link.title is the DCAE service property value. Following this link will provide a list of DCAE services that all have this property value.|[Link](#link)|
+|**propertyValue** <br>*optional*||string|
+
+
+<a name="dcaeservicerequest"></a>
+### DCAEServiceRequest
+
+|Name|Description|Schema|
+|---|---|---|
+|**components** <br>*required*|List of DCAE service components that this service is composed of|< [DCAEServiceComponentRequest](#dcaeservicecomponentrequest) > array|
+|**deploymentRef** <br>*optional*|Reference to a Cloudify deployment|string|
+|**typeId** <br>*required*|Id of the associated DCAE service type|string|
+|**vnfId** <br>*required*|Id of the associated VNF that this service is monitoring|string|
+|**vnfLocation** <br>*required*|Location identifier of the associated VNF that this service is monitoring|string|
+|**vnfType** <br>*required*|The type of the associated VNF that this service is monitoring|string|
+
+
+<a name="dcaeservicetype"></a>
+### DCAEServiceType
+
+|Name|Description|Schema|
+|---|---|---|
+|**asdcResourceId** <br>*optional*|Id of vf/vnf instance this DCAE service type is associated with. Value source is from ASDC's notification event's field `resourceInvariantUUID`.|string|
+|**asdcServiceId** <br>*optional*|Id of service this DCAE service type is associated with. Value source is from ASDC's notification event's field `serviceInvariantUUID`.|string|
+|**asdcServiceURL** <br>*optional*|URL to the ASDC service model|string|
+|**blueprintTemplate** <br>*required*|String representation of a Cloudify blueprint with unbound variables|string|
+|**created** <br>*required*|Created timestamp for this DCAE service type in epoch time|string(date-time)|
+|**deactivated** <br>*optional*|Deactivated timestamp for this DCAE service type in epoch time|string(date-time)|
+|**owner** <br>*required*||string|
+|**selfLink** <br>*required*|Link to self where the Link.title is typeName|[Link](#link)|
+|**serviceIds** <br>*optional*|List of service ids that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service id.|< string > array|
+|**serviceLocations** <br>*optional*|List of service locations that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service location.|< string > array|
+|**typeId** <br>*required*|Unique identifier for this DCAE service type|string|
+|**typeName** <br>*required*|Descriptive name for this DCAE service type|string|
+|**typeVersion** <br>*required*|Version number for this DCAE service type|integer(int32)|
+|**vnfTypes** <br>*optional*||< string > array|
+
+
+<a name="dcaeservicetyperequest"></a>
+### DCAEServiceTypeRequest
+
+|Name|Description|Schema|
+|---|---|---|
+|**asdcResourceId** <br>*optional*|Id of vf/vnf instance this DCAE service type is associated with. Value source is from ASDC's notification event's field `resourceInvariantUUID`.|string|
+|**asdcServiceId** <br>*optional*|Id of service this DCAE service type is associated with. Value source is from ASDC's notification event's field `serviceInvariantUUID`.|string|
+|**asdcServiceURL** <br>*optional*|URL to the ASDC service model|string|
+|**blueprintTemplate** <br>*required*|String representation of a Cloudify blueprint with unbound variables|string|
+|**owner** <br>*required*||string|
+|**serviceIds** <br>*optional*|List of service ids that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service id.|< string > array|
+|**serviceLocations** <br>*optional*|List of service locations that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service location.|< string > array|
+|**typeName** <br>*required*|Descriptive name for this DCAE service type|string|
+|**typeVersion** <br>*required*|Version number for this DCAE service type|integer(int32)|
+|**vnfTypes** <br>*optional*||< string > array|
+
+
+<a name="inlineresponse200"></a>
+### InlineResponse200
+
+|Name|Description|Schema|
+|---|---|---|
+|**items** <br>*optional*||< [DCAEServiceType](#dcaeservicetype) > array|
+|**links** <br>*optional*||[InlineResponse200Links](#inlineresponse200links)|
+|**totalCount** <br>*optional*||integer(int32)|
+
+
+<a name="inlineresponse2001"></a>
+### InlineResponse2001
+
+|Name|Description|Schema|
+|---|---|---|
+|**items** <br>*optional*||< [DCAEService](#dcaeservice) > array|
+|**links** <br>*optional*||[InlineResponse200Links](#inlineresponse200links)|
+|**totalCount** <br>*optional*||integer(int32)|
+
+
+<a name="inlineresponse200links"></a>
+### InlineResponse200Links
+Pagination links
+
+
+|Name|Description|Schema|
+|---|---|---|
+|**nextLink** <br>*optional*||[Link](#link)|
+|**previousLink** <br>*optional*||[Link](#link)|
+
+
+<a name="link"></a>
+### Link
+
+|Name|Description|Schema|
+|---|---|---|
+|**params** <br>*optional*||< string, string > map|
+|**rel** <br>*optional*||string|
+|**rels** <br>*optional*||< string > array|
+|**title** <br>*optional*||string|
+|**type** <br>*optional*||string|
+|**uri** <br>*optional*||string|
+|**uriBuilder** <br>*optional*||[UriBuilder](#uribuilder)|
+
+
+<a name="uribuilder"></a>
+### UriBuilder
+*Type* : object
+
+
+
+
+
diff --git a/docs/DatabaseTables.md b/docs/DatabaseTables.md
index f3df9e1..30f4f7b 100644
--- a/docs/DatabaseTables.md
+++ b/docs/DatabaseTables.md
@@ -14,16 +14,20 @@ As of version 0.12.0.
Table "public.dcae_service_types"
Column | Type | Modifiers
--------------------+-----------------------------+-----------
+ type_id | character varying | not null
+ type_version | integer | not null
type_name | character varying | not null
owner | character varying | not null
+ blueprint_template | text | not null
vnf_types | character varying[] | not null
service_ids | character varying[] |
service_locations | character varying[] |
- blueprint_template | text | not null
+ asdc_service_id | character varying | not null
+ asdc_resource_id | character varying | not null
created | timestamp without time zone | not null
is_active | boolean | not null
Indexes:
- "pk_type_created" PRIMARY KEY, btree (type_name, created)
+ "pk_type_created" PRIMARY KEY, btree (type_id, created)
```
## `dcae_services`
@@ -40,7 +44,7 @@ Indexes:
Column | Type | Modifiers
----------------+-----------------------------+-----------
service_id | character varying | not null
- type_name | character varying | not null
+ type_id | character varying | not null
vnf_id | character varying | not null
vnf_type | character varying | not null
vnf_location | character varying | not null
diff --git a/docs/Deployment.md b/docs/Deployment.md
index 762af85..ff3974f 100644
--- a/docs/Deployment.md
+++ b/docs/Deployment.md
@@ -35,5 +35,5 @@ In order for HTTPS to be enabled for DCAE Inventory, an HTTPS `applicationConnec
The DCAE Inventory has been developed and tested using Java 8. Here is a sample run command:
```
-java -jar dcae-inventory-1.0.0.jar server /opt/config.yml
+java -jar dcae-inventory-2.3.1.jar server /opt/config.yml
```
diff --git a/license/pom.xml b/license/pom.xml
deleted file mode 100644
index 4a98c2a..0000000
--- a/license/pom.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.openecomp.dcae.dcae-inventory</groupId>
- <artifactId>license</artifactId>
- <name>dcae-inventory</name>
- <description>This Maven artifact is meant to provide licensing to all modules and submodules using the licensing
- maven plugin.
- </description>
- <version>1.0.0-SNAPSHOT</version>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
- <configuration>
- <jarname>license</jarname>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- </plugins>
- <finalName>license</finalName>
- </build>
-</project>
diff --git a/license/src/main/resources/licenses/att_license/header.txt b/license/src/main/resources/licenses/att_license/header.txt
deleted file mode 100644
index dbff902..0000000
--- a/license/src/main/resources/licenses/att_license/header.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-This code is licensed under the Apache License, Version 2.0; you may
-not use this code for any purpose except in compliance with the Apache
-License. You may obtain a copy of the License at
- http://www.att.com/legal/openecomp.html
diff --git a/license/src/main/resources/licenses/att_license/license.txt b/license/src/main/resources/licenses/att_license/license.txt
deleted file mode 100644
index 5df403b..0000000
--- a/license/src/main/resources/licenses/att_license/license.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-You may obtain a copy of the License at
- http://www.att.com/legal/openecomp.html
diff --git a/license/src/main/resources/licenses/licenses.properties b/license/src/main/resources/licenses/licenses.properties
deleted file mode 100644
index df0558d..0000000
--- a/license/src/main/resources/licenses/licenses.properties
+++ /dev/null
@@ -1 +0,0 @@
-att_license=ATT License
diff --git a/pom.xml b/pom.xml
index a90d5d9..8cabfda 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,8 @@
<groupId>org.openecomp.dcae</groupId>
<artifactId>dcae-inventory</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.1.0</version>
+ <!--internal <version>2.4.0</version>-->
<properties>
<dropwizard.version>0.9.2</dropwizard.version>
@@ -22,18 +23,18 @@
</properties>
<pluginRepositories>
- <!-- Black Duck plugin dependencies -->
- <pluginRepository>
- <id>JCenter</id>
- <name>JCenter Repository</name>
- <url>http://jcenter.bintray.com</url>
- </pluginRepository>
+ <!-- Black Duck plugin dependencies -->
+ <pluginRepository>
+ <id>JCenter</id>
+ <name>JCenter Repository</name>
+ <url>http://jcenter.bintray.com</url>
+ </pluginRepository>
- <pluginRepository>
- <id>Restlet</id>
- <name>Restlet Repository</name>
- <url>http://maven.restlet.com</url>
- </pluginRepository>
+ <pluginRepository>
+ <id>Restlet</id>
+ <name>Restlet Repository</name>
+ <url>http://maven.restlet.com</url>
+ </pluginRepository>
</pluginRepositories>
@@ -140,30 +141,54 @@
<artifactId>jersey-media-multipart</artifactId>
<version>2.22.1</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>2.0.2-beta</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>1.6.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>1.6.5</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
<!-- blackduck maven plugin -->
- <plugin>
- <groupId>com.blackducksoftware.integration</groupId>
- <artifactId>hub-maven-plugin</artifactId>
- <version>1.4.0</version>
- <inherited>false</inherited>
- <configuration>
- <hubProjectName>${project.name}</hubProjectName>
- <outputDirectory>${project.basedir}</outputDirectory>
- </configuration>
- <executions>
- <execution>
- <id>create-bdio-file</id>
- <phase>package</phase>
- <goals>
- <goal>createHubOutput</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <plugin>
+ <groupId>com.blackducksoftware.integration</groupId>
+ <artifactId>hub-maven-plugin</artifactId>
+ <version>1.4.0</version>
+ <inherited>false</inherited>
+ <configuration>
+ <hubProjectName>${project.name}</hubProjectName>
+ <outputDirectory>${project.basedir}</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-bdio-file</id>
+ <phase>package</phase>
+ <goals>
+ <goal>createHubOutput</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -268,7 +293,7 @@
</goals>
<configuration>
<image>${project.artifactId}</image>
- <newName>${docker.registry}/openecomp/${project.artifactId}:${docker.version}-${maven.build.timestamp}</newName>
+ <newName>${docker.registry}/openecomp/${project.artifactId}:${project.version}-${maven.build.timestamp}</newName>
<!--serverId>${docker.registry}</serverId-->
<pushImage>false</pushImage>
</configuration>
@@ -302,63 +327,12 @@
<licenseName>apache_v2</licenseName>
<inceptionYear>2017</inceptionYear>
<organizationName>AT&amp;T Intellectual Property. All rights reserved.</organizationName>
- <projectName>PROJECT</projectName>
- <canUpdateCopyright>true</canUpdateCopyright>
- <canUpdateDescription>true</canUpdateDescription>
- <canUpdateLicense>true</canUpdateLicense>
- <emptyLineAfterHeader>true</emptyLineAfterHeader>
- </configuration>
- <executions>
- <execution>
- <id>first</id>
- <goals>
- <goal>update-file-header</goal>
- </goals>
- <phase>process-sources</phase>
- </execution>
- </executions>
-<!--
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>license-maven-plugin</artifactId>
- <version>1.10</version>
- <configuration>
- <licenseName>att_license</licenseName>
- <licenseResolver>classpath://licenses</licenseResolver>
- <inceptionYear>2016</inceptionYear>
- <organizationName>AT&amp;T</organizationName>
- <projectName>dcae-inventory</projectName>
--->
- <!-- NOTE: Once you have established the tags and delimiter, they cannot be changed -->
-<!-- <processStartTag>============LICENSE_START===========</processStartTag>
- <processEndTag>============LICENSE_END===========</processEndTag>
- <sectionDelimiter>==================================</sectionDelimiter>
+ <projectName>${project.artifactId}</projectName>
<canUpdateCopyright>true</canUpdateCopyright>
<canUpdateDescription>true</canUpdateDescription>
<canUpdateLicense>true</canUpdateLicense>
<emptyLineAfterHeader>true</emptyLineAfterHeader>
-
- <excludes>
---> <!--
- Files which are to be excluded. The pom.xml is excluded because
- the start/end tags and the delimiters are in the body of the file.
- This confuses the algorithm. So, this file must be manually updated
- with a license header.
- -->
-<!-- <exclude>*.xml</exclude>
- <exclude>target/*</exclude>
- <exclude>*.png</exclude>
- <exclude>*.md</exclude>
- <exclude>*.yml</exclude>
- <exclude>*.yaml</exclude>
- </excludes>
</configuration>
- <dependencies>
- <dependency>
- <groupId>org.openecomp.dcae.dcae-inventory</groupId>
- <artifactId>license</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
<executions>
<execution>
<id>first</id>
@@ -368,7 +342,6 @@
<phase>process-sources</phase>
</execution>
</executions>
--->
</plugin>
<plugin>
@@ -430,12 +403,12 @@
<repository>
<id>ecomp-releases</id>
<name>Open eCOMP Release Repository</name>
- <url>${nexusproxy}/${releases.path}</url>
+ <url>${nexusproxy}/${releases.path}</url>
</repository>
<snapshotRepository>
<id>ecomp-snapshots</id>
<name>Open eCOMP Snapshot Repository</name>
- <url>${nexusproxy}/${snapshots.path}</url>
+ <url>${nexusproxy}/${snapshots.path}</url>
</snapshotRepository>
<site>
<id>ecomp-site</id>
diff --git a/src/gen/java/io/swagger/api/ApiException.java b/src/gen/java/io/swagger/api/ApiException.java
index a2be1d8..cdc6162 100644
--- a/src/gen/java/io/swagger/api/ApiException.java
+++ b/src/gen/java/io/swagger/api/ApiException.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z")
public class ApiException extends Exception{
private int code;
diff --git a/src/gen/java/io/swagger/api/ApiOriginFilter.java b/src/gen/java/io/swagger/api/ApiOriginFilter.java
index b449d84..b6f29f2 100644
--- a/src/gen/java/io/swagger/api/ApiOriginFilter.java
+++ b/src/gen/java/io/swagger/api/ApiOriginFilter.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
import java.io.IOException;
import javax.servlet.*;
diff --git a/src/gen/java/io/swagger/api/ApiResponseMessage.java b/src/gen/java/io/swagger/api/ApiResponseMessage.java
index 018a208..bf4e13a 100644
--- a/src/gen/java/io/swagger/api/ApiResponseMessage.java
+++ b/src/gen/java/io/swagger/api/ApiResponseMessage.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
import javax.xml.bind.annotation.XmlTransient;
@javax.xml.bind.annotation.XmlRootElement
diff --git a/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java b/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java
index f8604b8..72f1f63 100644
--- a/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java
+++ b/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
import io.swagger.api.factories.DcaeServiceTypesApiServiceFactory;
import io.swagger.annotations.ApiParam;
@@ -46,13 +43,36 @@ public class DcaeServiceTypesApi {
@Context
UriInfo uriInfo;
- public static Link buildLinkForGet(UriInfo uriInfo, String rel, String vnfType, Integer offset) {
+ public static Link buildLinkForGet(UriInfo uriInfo, String rel, String typeName, Boolean onlyLatest, Boolean onlyActive,
+ String vnfType, String serviceId, String serviceLocation, String asdcServiceId,
+ String asdcResourceId, Integer offset) {
UriBuilder ub = uriInfo.getBaseUriBuilder().path(DcaeServiceTypesApi.class)
.path(DcaeServiceTypesApi.class, "dcaeServiceTypesGet");
+ if (typeName != null) {
+ ub.queryParam("typeName", typeName);
+ }
+ if (onlyLatest != null) {
+ ub.queryParam("onlyLatest", onlyLatest);
+ }
+ if (onlyActive != null) {
+ ub.queryParam("onlyActive", onlyActive);
+ }
if (vnfType != null) {
ub.queryParam("vnfType", vnfType);
}
+ if (serviceId != null) {
+ ub.queryParam("serviceId", serviceId);
+ }
+ if (serviceLocation != null) {
+ ub.queryParam("serviceLocation", serviceLocation);
+ }
+ if (asdcServiceId != null) {
+ ub.queryParam("asdcServiceId", asdcServiceId);
+ }
+ if (asdcResourceId != null) {
+ ub.queryParam("asdcResourceId", asdcResourceId);
+ }
if (offset != null) {
ub.queryParam("offset", offset);
}
@@ -70,44 +90,57 @@ public class DcaeServiceTypesApi {
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "List of `DCAEServiceType` objects", response = InlineResponse200.class)})
public Response dcaeServiceTypesGet(
- @ApiParam(value = "") @QueryParam("vnfType") String vnfType,
- @ApiParam(value = "") @QueryParam("serviceId") String serviceId,
- @ApiParam(value = "") @QueryParam("serviceLocation") String serviceLocation,
+ @ApiParam(value = "Filter by service type name") @QueryParam("typeName") String typeName,
+ @ApiParam(value = "If set to true, query returns just the latest versions of DCAE service types. If set to false, then all versions are returned. Default is true")
+ @DefaultValue("true") @QueryParam("onlyLatest") Boolean onlyLatest,
+ @ApiParam(value = "If set to true, query returns only *active* DCAE service types. If set to false, then all DCAE service types are returned. Default is true")
+ @DefaultValue("true") @QueryParam("onlyActive") Boolean onlyActive,
+ @ApiParam(value = "Filter by associated vnf type. No wildcards, matches are explicit. This field is treated case insensitive.")
+ @QueryParam("vnfType") String vnfType,
+ @ApiParam(value = "Filter by assocaited service id. Instances with service id null or empty is always returned.")
+ @QueryParam("serviceId") String serviceId,
+ @ApiParam(value = "Filter by associated service location. Instances with service location null or empty is always returned.")
+ @QueryParam("serviceLocation") String serviceLocation,
+ @ApiParam(value = "Filter by associated asdc design service id. Setting this to `NONE` will return instances that have asdc service id set to null")
+ @QueryParam("asdcServiceId") String asdcServiceId,
+ @ApiParam(value = "Filter by associated asdc design resource id. Setting this to `NONE` will return instances that have asdc resource id set to null")
+ @QueryParam("asdcResourceId") String asdcResourceId,
@ApiParam(value = "Query resultset offset used for pagination (zero-based)") @QueryParam("offset") Integer offset,
@Context SecurityContext securityContext)
throws NotFoundException {
- return delegate.dcaeServiceTypesGet(vnfType, serviceId, serviceLocation, offset, uriInfo, securityContext);
+ return delegate.dcaeServiceTypesGet(typeName, onlyLatest, onlyActive, vnfType, serviceId, serviceLocation,
+ asdcServiceId, asdcResourceId, offset, uriInfo, securityContext);
}
- public static Link buildLinkForGet(UriInfo uriInfo, String rel, String typeName) {
+ public static Link buildLinkForGet(UriInfo uriInfo, String rel, String typeId) {
// This same method can be used for PUTs as well
UriBuilder ub = uriInfo.getBaseUriBuilder().path(DcaeServiceTypesApi.class)
- .path(DcaeServiceTypesApi.class, "dcaeServiceTypesTypeNameGet");
- Link.Builder lb = Link.fromUri(ub.build(typeName));
+ .path(DcaeServiceTypesApi.class, "dcaeServiceTypesTypeIdGet");
+ Link.Builder lb = Link.fromUri(ub.build(typeId));
lb.rel(rel);
return lb.build();
}
@GET
- @Path("/{typeName}")
- @Consumes({"application/json", "application/vnd.dcae.inventory.v1+json"})
- @Produces({"application/json", "application/vnd.dcae.inventory.v1+json"})
+ @Path("/{typeId}")
+ @Consumes({"application/json"})
+ @Produces({"application/json"})
@io.swagger.annotations.ApiOperation(value = "", notes = "Get a `DCAEServiceType` object.", response = DCAEServiceType.class, tags = {})
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Single `DCAEServiceType` object", response = DCAEServiceType.class),
@io.swagger.annotations.ApiResponse(code = 404, message = "Resource not found", response = DCAEServiceType.class)})
- public Response dcaeServiceTypesTypeNameGet(
- @ApiParam(value = "", required = true) @PathParam("typeName") String typeName,
+ public Response dcaeServiceTypesTypeIdGet(
+ @ApiParam(value = "", required = true) @PathParam("typeId") String typeId,
@Context SecurityContext securityContext)
throws NotFoundException {
- return delegate.dcaeServiceTypesTypeNameGet(typeName, uriInfo, securityContext);
+ return delegate.dcaeServiceTypesTypeIdGet(typeId, uriInfo, securityContext);
}
- @PUT
- @Path("/{typeName}")
- @Consumes({"application/json", "application/vnd.dcae.inventory.v1+json"})
- @Produces({"application/json", "application/vnd.dcae.inventory.v1+json"})
+ @POST
+ @Path("/")
+ @Consumes({"application/json"})
+ @Produces({"application/json"})
@io.swagger.annotations.ApiOperation(value = "", notes = "Inserts a new `DCAEServiceType` or updates an existing instance. Updates are only allowed iff there are no running DCAE services of the requested type,",
response = DCAEServiceType.class, tags = {})
@io.swagger.annotations.ApiResponses(value = {
@@ -115,10 +148,25 @@ public class DcaeServiceTypesApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Bad request provided.", response = ApiResponseMessage.class),
@io.swagger.annotations.ApiResponse(code = 409, message = "Failed to update because there are still DCAE services of the requested type running.", response = ApiResponseMessage.class)})
public Response dcaeServiceTypesTypeNamePut(
- @ApiParam(value = "", required = true) @PathParam("typeName") String typeName,
@ApiParam(value = "", required = true) @Valid DCAEServiceTypeRequest request,
@Context SecurityContext securityContext)
throws NotFoundException {
- return delegate.dcaeServiceTypesTypeNamePut(typeName, request, uriInfo, securityContext);
+ return delegate.dcaeServiceTypesTypeIdPost(request, uriInfo, securityContext);
}
+
+ @DELETE
+ @Path("/{typeId}")
+ @io.swagger.annotations.ApiOperation(value = "", notes = "Deactivates existing `DCAEServiceType` instances", response = DCAEServiceType.class, tags = {})
+ @io.swagger.annotations.ApiResponses(value = {
+ @io.swagger.annotations.ApiResponse(code = 200, message = "`DCAEServiceType` has been deactivated", response = ApiResponseMessage.class),
+ @io.swagger.annotations.ApiResponse(code = 404, message = "`DCAEServiceType` not found", response = ApiResponseMessage.class),
+ @io.swagger.annotations.ApiResponse(code = 410, message = "`DCAEServiceType` already gone", response = ApiResponseMessage.class)
+ })
+ public Response dcaeServiceTypesTypeIdDelete(
+ @ApiParam(value = "", required = true) @PathParam("typeId") String typeId,
+ @Context SecurityContext securityContext)
+ throws NotFoundException {
+ return delegate.dcaeServiceTypesTypeIdDelete(typeId, uriInfo, securityContext);
+ }
+
}
diff --git a/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java b/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java
index 60fee9c..afc7476 100644
--- a/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java
+++ b/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
import io.swagger.model.DCAEServiceTypeRequest;
import javax.ws.rs.core.Response;
@@ -31,12 +28,16 @@ import javax.ws.rs.core.UriInfo;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z")
public abstract class DcaeServiceTypesApiService {
- public abstract Response dcaeServiceTypesGet(String vnfType, String serviceId, String serviceLocation, Integer offset,
- UriInfo uriInfo, SecurityContext securityContext)
+ public abstract Response dcaeServiceTypesGet(String typeName, Boolean onlyLatest, Boolean onlyActive,
+ String vnfType, String serviceId, String serviceLocation,
+ String asdcServiceId, String asdcResourceId,
+ Integer offset, UriInfo uriInfo, SecurityContext securityContext)
throws NotFoundException;
- public abstract Response dcaeServiceTypesTypeNameGet(String typeName, UriInfo uriInfo, SecurityContext securityContext)
+ public abstract Response dcaeServiceTypesTypeIdGet(String typeId, UriInfo uriInfo, SecurityContext securityContext)
throws NotFoundException;
- public abstract Response dcaeServiceTypesTypeNamePut(String typeName, DCAEServiceTypeRequest request, UriInfo uriInfo,
+ public abstract Response dcaeServiceTypesTypeIdPost(DCAEServiceTypeRequest request, UriInfo uriInfo,
SecurityContext securityContext)
throws NotFoundException;
+ public abstract Response dcaeServiceTypesTypeIdDelete(String typeId, UriInfo uriInfo, SecurityContext securityContext)
+ throws NotFoundException;
}
diff --git a/src/gen/java/io/swagger/api/DcaeServicesApi.java b/src/gen/java/io/swagger/api/DcaeServicesApi.java
index 81715d4..55d79f3 100644
--- a/src/gen/java/io/swagger/api/DcaeServicesApi.java
+++ b/src/gen/java/io/swagger/api/DcaeServicesApi.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
import io.dropwizard.jersey.params.DateTimeParam;
import io.swagger.api.factories.DcaeServicesApiServiceFactory;
@@ -48,8 +45,8 @@ public class DcaeServicesApi {
@Context
UriInfo uriInfo;
- public static Link buildLinkForGetByTypeName(UriInfo uriInfo, String rel, String typeName) {
- return buildLinkForGet(uriInfo, rel, typeName, null, null, null, null, null, null, null);
+ public static Link buildLinkForGetByTypeId(UriInfo uriInfo, String rel, String typeId) {
+ return buildLinkForGet(uriInfo, rel, typeId, null, null, null, null, null, null, null);
}
public static Link buildLinkForGetByVnfType(UriInfo uriInfo, String rel, String vnfType) {
@@ -60,14 +57,14 @@ public class DcaeServicesApi {
return buildLinkForGet(uriInfo, rel, null, null, null, vnfLocation, null, null, null, null);
}
- public static Link buildLinkForGet(UriInfo uriInfo, String rel, String typeName, String vnfId, String vnfType,
+ public static Link buildLinkForGet(UriInfo uriInfo, String rel, String typeId, String vnfId, String vnfType,
String vnfLocation, String componentType, Boolean shareable, DateTime created,
Integer offset) {
UriBuilder ub = uriInfo.getBaseUriBuilder().path(DcaeServicesApi.class)
.path(DcaeServicesApi.class, "dcaeServicesGet");
- if (typeName != null) {
- ub.queryParam("typeName", typeName);
+ if (typeId != null) {
+ ub.queryParam("typeId", typeId);
}
if (vnfId != null) {
ub.queryParam("vnfId", vnfId);
@@ -106,9 +103,10 @@ public class DcaeServicesApi {
@io.swagger.annotations.ApiResponse(code = 502, message = "Bad response from DCAE controller", response = ApiResponseMessage.class),
@io.swagger.annotations.ApiResponse(code = 504, message = "Failed to connect with DCAE controller", response = ApiResponseMessage.class)})
public Response dcaeServicesGet(
- @ApiParam(value = "DCAE service type name") @QueryParam("typeName") String typeName,
+ @ApiParam(value = "DCAE service type name") @QueryParam("typeId") String typeId,
@ApiParam(value = "") @QueryParam("vnfId") String vnfId,
- @ApiParam(value = "") @QueryParam("vnfType") String vnfType,
+ @ApiParam(value = "Filter by associated vnf type. This field is treated case insensitive.")
+ @QueryParam("vnfType") String vnfType,
@ApiParam(value = "") @QueryParam("vnfLocation") String vnfLocation,
@ApiParam(value = "Use to filter by a specific DCAE service component type") @QueryParam("componentType") String componentType,
@ApiParam(value = "Use to filter by DCAE services that have shareable components or not") @QueryParam("shareable") Boolean shareable,
@@ -116,7 +114,7 @@ public class DcaeServicesApi {
@ApiParam(value = "Query resultset offset used for pagination (zero-based)") @QueryParam("offset") Integer offset,
@Context SecurityContext securityContext)
throws NotFoundException {
- return delegate.dcaeServicesGet(typeName, vnfId, vnfType, vnfLocation, componentType, shareable,
+ return delegate.dcaeServicesGet(typeId, vnfId, vnfType, vnfLocation, componentType, shareable,
(created == null ? null : created.get()), offset, uriInfo, securityContext);
}
diff --git a/src/gen/java/io/swagger/api/DcaeServicesApiService.java b/src/gen/java/io/swagger/api/DcaeServicesApiService.java
index 4b4aa38..99f9f25 100644
--- a/src/gen/java/io/swagger/api/DcaeServicesApiService.java
+++ b/src/gen/java/io/swagger/api/DcaeServicesApiService.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
import io.swagger.model.DCAEServiceRequest;
import org.joda.time.DateTime;
@@ -32,7 +29,7 @@ import javax.ws.rs.core.UriInfo;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z")
public abstract class DcaeServicesApiService {
- public abstract Response dcaeServicesGet(String typeName, String vnfId, String vnfType, String vnfLocation,
+ public abstract Response dcaeServicesGet(String typeId, String vnfId, String vnfType, String vnfLocation,
String componentType, Boolean shareable, DateTime created, Integer offset,
UriInfo uriInfo, SecurityContext securityContext)
throws NotFoundException;
diff --git a/src/gen/java/io/swagger/api/DcaeServicesGroupbyApi.java b/src/gen/java/io/swagger/api/DcaeServicesGroupbyApi.java
index db0ab69..d108e31 100644
--- a/src/gen/java/io/swagger/api/DcaeServicesGroupbyApi.java
+++ b/src/gen/java/io/swagger/api/DcaeServicesGroupbyApi.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
import io.swagger.api.factories.DcaeServicesGroupbyApiServiceFactory;
import io.swagger.annotations.ApiParam;
diff --git a/src/gen/java/io/swagger/api/DcaeServicesGroupbyApiService.java b/src/gen/java/io/swagger/api/DcaeServicesGroupbyApiService.java
index d842c46..bc25d4e 100644
--- a/src/gen/java/io/swagger/api/DcaeServicesGroupbyApiService.java
+++ b/src/gen/java/io/swagger/api/DcaeServicesGroupbyApiService.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.core.UriInfo;
diff --git a/src/gen/java/io/swagger/api/JacksonJsonProvider.java b/src/gen/java/io/swagger/api/JacksonJsonProvider.java
index 2e1affb..c7a5db2 100644
--- a/src/gen/java/io/swagger/api/JacksonJsonProvider.java
+++ b/src/gen/java/io/swagger/api/JacksonJsonProvider.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import io.swagger.util.Json;
diff --git a/src/gen/java/io/swagger/api/NotFoundException.java b/src/gen/java/io/swagger/api/NotFoundException.java
index f3bde83..3eb483f 100644
--- a/src/gen/java/io/swagger/api/NotFoundException.java
+++ b/src/gen/java/io/swagger/api/NotFoundException.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z")
public class NotFoundException extends ApiException {
private int code;
diff --git a/src/gen/java/io/swagger/api/StringUtil.java b/src/gen/java/io/swagger/api/StringUtil.java
index 04cb0e4..e20f46f 100644
--- a/src/gen/java/io/swagger/api/StringUtil.java
+++ b/src/gen/java/io/swagger/api/StringUtil.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z")
public class StringUtil {
/**
diff --git a/src/gen/java/io/swagger/model/DCAEService.java b/src/gen/java/io/swagger/model/DCAEService.java
index b70919f..779487c 100644
--- a/src/gen/java/io/swagger/model/DCAEService.java
+++ b/src/gen/java/io/swagger/model/DCAEService.java
@@ -1,28 +1,25 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
@@ -122,7 +119,7 @@ public class DCAEService {
}
/**
- * Link.title is typeName
+ * Link.title is typeId
**/
public DCAEService typeLink(Link typeLink) {
this.typeLink = typeLink;
@@ -130,7 +127,7 @@ public class DCAEService {
}
- @ApiModelProperty(value = "Link.title is typeName")
+ @ApiModelProperty(value = "Link.title is typeId")
@JsonProperty("typeLink")
public Link getTypeLink() {
return typeLink;
diff --git a/src/gen/java/io/swagger/model/DCAEServiceComponent.java b/src/gen/java/io/swagger/model/DCAEServiceComponent.java
index 34c81a8..6550c76 100644
--- a/src/gen/java/io/swagger/model/DCAEServiceComponent.java
+++ b/src/gen/java/io/swagger/model/DCAEServiceComponent.java
@@ -1,28 +1,25 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
diff --git a/src/gen/java/io/swagger/model/DCAEServiceComponentRequest.java b/src/gen/java/io/swagger/model/DCAEServiceComponentRequest.java
index 1f0913f..f65bf38 100644
--- a/src/gen/java/io/swagger/model/DCAEServiceComponentRequest.java
+++ b/src/gen/java/io/swagger/model/DCAEServiceComponentRequest.java
@@ -1,28 +1,25 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
diff --git a/src/gen/java/io/swagger/model/DCAEServiceGroupByResults.java b/src/gen/java/io/swagger/model/DCAEServiceGroupByResults.java
index b9f0d34..f8f0449 100644
--- a/src/gen/java/io/swagger/model/DCAEServiceGroupByResults.java
+++ b/src/gen/java/io/swagger/model/DCAEServiceGroupByResults.java
@@ -1,28 +1,25 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
diff --git a/src/gen/java/io/swagger/model/DCAEServiceGroupByResultsPropertyValues.java b/src/gen/java/io/swagger/model/DCAEServiceGroupByResultsPropertyValues.java
index 76d69a0..0d39b51 100644
--- a/src/gen/java/io/swagger/model/DCAEServiceGroupByResultsPropertyValues.java
+++ b/src/gen/java/io/swagger/model/DCAEServiceGroupByResultsPropertyValues.java
@@ -1,28 +1,25 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
diff --git a/src/gen/java/io/swagger/model/DCAEServiceRequest.java b/src/gen/java/io/swagger/model/DCAEServiceRequest.java
index f9f9083..06f6935 100644
--- a/src/gen/java/io/swagger/model/DCAEServiceRequest.java
+++ b/src/gen/java/io/swagger/model/DCAEServiceRequest.java
@@ -1,28 +1,25 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
@@ -40,7 +37,7 @@ import java.util.List;
public class DCAEServiceRequest {
@NotEmpty
- private String typeName = null;
+ private String typeId = null;
@NotEmpty
private String vnfId = null;
@NotEmpty
@@ -54,19 +51,19 @@ public class DCAEServiceRequest {
/**
**/
- public DCAEServiceRequest typeName(String typeName) {
- this.typeName = typeName;
+ public DCAEServiceRequest typeId(String typeId) {
+ this.typeId = typeId;
return this;
}
- @ApiModelProperty(required = true, value = "Name of the associated DCAE service type")
- @JsonProperty("typeName")
- public String getTypeName() {
- return typeName;
+ @ApiModelProperty(required = true, value = "Id of the associated DCAE service type")
+ @JsonProperty("typeId")
+ public String getTypeId() {
+ return typeId;
}
- public void setTypeName(String typeName) {
- this.typeName = typeName;
+ public void setTypeId(String typeId) {
+ this.typeId = typeId;
}
/**
@@ -165,7 +162,7 @@ public class DCAEServiceRequest {
return false;
}
DCAEServiceRequest dCAEServiceRequest = (DCAEServiceRequest) o;
- return Objects.equals(typeName, dCAEServiceRequest.typeName) &&
+ return Objects.equals(typeId, dCAEServiceRequest.typeId) &&
Objects.equals(vnfId, dCAEServiceRequest.vnfId) &&
Objects.equals(vnfType, dCAEServiceRequest.vnfType) &&
Objects.equals(vnfLocation, dCAEServiceRequest.vnfLocation) &&
@@ -175,7 +172,7 @@ public class DCAEServiceRequest {
@Override
public int hashCode() {
- return Objects.hash(typeName, vnfId, vnfType, vnfLocation, deploymentRef, components);
+ return Objects.hash(typeId, vnfId, vnfType, vnfLocation, deploymentRef, components);
}
@Override
@@ -183,7 +180,7 @@ public class DCAEServiceRequest {
StringBuilder sb = new StringBuilder();
sb.append("class DCAEServiceRequest {\n");
- sb.append(" typeName: ").append(toIndentedString(typeName)).append("\n");
+ sb.append(" typeId: ").append(toIndentedString(typeId)).append("\n");
sb.append(" vnfId: ").append(toIndentedString(vnfId)).append("\n");
sb.append(" vnfType: ").append(toIndentedString(vnfType)).append("\n");
sb.append(" vnfLocation: ").append(toIndentedString(vnfLocation)).append("\n");
diff --git a/src/gen/java/io/swagger/model/DCAEServiceType.java b/src/gen/java/io/swagger/model/DCAEServiceType.java
index abe5930..5598604 100644
--- a/src/gen/java/io/swagger/model/DCAEServiceType.java
+++ b/src/gen/java/io/swagger/model/DCAEServiceType.java
@@ -1,222 +1,134 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
+
import com.fasterxml.jackson.annotation.JsonProperty;
-import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.NotEmpty;
+
import javax.ws.rs.core.Link;
-import java.util.ArrayList;
import java.util.Date;
-import java.util.List;
+@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z")
+public final class DCAEServiceType extends DCAEServiceTypeRequest {
+ @NotEmpty
+ private String typeId = null;
+ @NotEmpty
+ private Link selfLink = null;
+ @NotEmpty
+ private Date created = null;
+ private Date deactivated = null;
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z")
-public class DCAEServiceType {
-
- private String typeName = null;
- private Link selfLink = null;
- private Date created = null;
- private String owner = null;
- private List<String> vnfTypes = new ArrayList<String>();
- private List<String> serviceIds = null;
- private List<String> serviceLocations = null;
- private String blueprintTemplate = null;
-
- /**
- **/
- public DCAEServiceType typeName(String typeName) {
- this.typeName = typeName;
- return this;
- }
-
-
- @ApiModelProperty(required = true, value = "Unique name for this DCAE service type")
- @JsonProperty("typeName")
- public String getTypeName() {
- return typeName;
- }
- public void setTypeName(String typeName) {
- this.typeName = typeName;
- }
-
- /**
- * Link.title is typeName
- **/
- public DCAEServiceType selfLink(Link selfLink) {
- this.selfLink = selfLink;
- return this;
- }
-
-
- @ApiModelProperty(value = "Link.title is typeName")
- @JsonProperty("selfLink")
- public Link getSelfLink() {
- return selfLink;
- }
- public void setSelfLink(Link selfLink) {
- this.selfLink = selfLink;
- }
-
- /**
- **/
- public DCAEServiceType created(Date created) {
- this.created = created;
- return this;
- }
-
-
- @ApiModelProperty(required = true, value = "Created timestamp for this DCAE service type in epoch time")
- @JsonProperty("created")
- public Date getCreated() {
- return created;
- }
- public void setCreated(Date created) {
- this.created = created;
- }
-
- /**
- **/
- public DCAEServiceType owner(String owner) {
- this.owner = owner;
- return this;
- }
-
-
- @ApiModelProperty(required = true, value = "Name of the owner of this DCAE service type")
- @JsonProperty("owner")
- public String getOwner() {
- return owner;
- }
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- /**
- **/
- public DCAEServiceType vnfTypes(List<String> vnfTypes) {
- this.vnfTypes = vnfTypes;
- return this;
- }
-
-
- @ApiModelProperty(required = true, value = "List of VNF types associated with this DCAE service type")
- @JsonProperty("vnfTypes")
- public List<String> getVnfTypes() {
- return vnfTypes;
- }
- public void setVnfTypes(List<String> vnfTypes) {
- this.vnfTypes = vnfTypes;
- }
-
- @ApiModelProperty(required = false, value = "List of service ids that are associated with this DCAE service type")
- @JsonProperty("serviceIds")
- public List<String> getServiceIds() {
- return serviceIds;
+ @ApiModelProperty(required = true, value = "Unique identifier for this DCAE service type")
+ @JsonProperty("typeId")
+ public String getTypeId() {
+ return typeId;
}
- public void setServiceIds(List<String> serviceIds) {
- this.serviceIds = serviceIds;
+
+ public void setTypeId(String typeId) {
+ this.typeId = typeId;
}
- @ApiModelProperty(required = false, value = "List of service locations that are associated with this DCAE service type")
- @JsonProperty("serviceLocations")
- public List<String> getServiceLocations() {
- return serviceLocations;
+
+ @ApiModelProperty(required = true, value = "Link to self where the Link.title is typeName")
+ @JsonProperty("selfLink")
+ public Link getSelfLink() {
+ return selfLink;
}
- public void setServiceLocations(List<String> serviceLocations) {
- this.serviceLocations = serviceLocations;
+
+ public void setSelfLink(Link selfLink) {
+ this.selfLink = selfLink;
}
- /**
- * String representation of a Cloudify blueprint with unbound variables
- **/
- public DCAEServiceType blueprintTemplate(String blueprintTemplate) {
- this.blueprintTemplate = blueprintTemplate;
- return this;
- }
-
-
- @ApiModelProperty(required = true, value = "String representation of a Cloudify blueprint with unbound variables")
- @JsonProperty("blueprintTemplate")
- public String getBlueprintTemplate() {
- return blueprintTemplate;
- }
- public void setBlueprintTemplate(String blueprintTemplate) {
- this.blueprintTemplate = blueprintTemplate;
- }
-
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
+
+ @ApiModelProperty(required = true, value = "Created timestamp for this DCAE service type in epoch time")
+ @JsonProperty("created")
+ public Date getCreated() {
+ return created;
}
- if (o == null || getClass() != o.getClass()) {
- return false;
+
+ public void setCreated(Date created) {
+ this.created = created;
}
- DCAEServiceType dCAEServiceType = (DCAEServiceType) o;
- return Objects.equals(typeName, dCAEServiceType.typeName) &&
- Objects.equals(selfLink, dCAEServiceType.selfLink) &&
- Objects.equals(created, dCAEServiceType.created) &&
- Objects.equals(owner, dCAEServiceType.owner) &&
- Objects.equals(vnfTypes, dCAEServiceType.vnfTypes) &&
- Objects.equals(blueprintTemplate, dCAEServiceType.blueprintTemplate);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(typeName, selfLink, created, owner, vnfTypes, blueprintTemplate);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("class DCAEServiceType {\n");
-
- sb.append(" typeName: ").append(toIndentedString(typeName)).append("\n");
- sb.append(" selfLink: ").append(toIndentedString(selfLink)).append("\n");
- sb.append(" created: ").append(toIndentedString(created)).append("\n");
- sb.append(" owner: ").append(toIndentedString(owner)).append("\n");
- sb.append(" vnfTypes: ").append(toIndentedString(vnfTypes)).append("\n");
- sb.append(" blueprintTemplate: ").append(toIndentedString(blueprintTemplate)).append("\n");
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces
- * (except the first line).
- */
- private String toIndentedString(Object o) {
- if (o == null) {
- return "null";
+
+
+ @ApiModelProperty(required = false, value = "Deactivated timestamp for this DCAE service type in epoch time")
+ @JsonProperty("deactivated")
+ public Date getDeactivated() {
+ return deactivated;
+ }
+
+ public void setDeactivated(Date deactivated) {
+ this.deactivated = deactivated;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DCAEServiceType dCAEServiceType = (DCAEServiceType) o;
+ return Objects.equals(typeId, dCAEServiceType.typeId) &&
+ Objects.equals(selfLink, dCAEServiceType.selfLink) &&
+ Objects.equals(created, dCAEServiceType.created) &&
+ Objects.equals(deactivated, dCAEServiceType.deactivated) &&
+ super.equals((DCAEServiceTypeRequest) o);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(typeId, selfLink, created, deactivated) + super.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class DCAEServiceType {\n");
+
+ sb.append(" typeId: ").append(toIndentedString(typeId)).append("\n");
+ sb.append(" selfLink: ").append(toIndentedString(selfLink)).append("\n");
+ sb.append(" created: ").append(toIndentedString(created)).append("\n");
+ sb.append(" deactivated: ").append(toIndentedString(deactivated)).append("\n");
+ sb.append(super.toString()).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
}
- return o.toString().replace("\n", "\n ");
- }
}
diff --git a/src/gen/java/io/swagger/model/DCAEServiceTypeRequest.java b/src/gen/java/io/swagger/model/DCAEServiceTypeRequest.java
index 3e94c24..7cd3577 100644
--- a/src/gen/java/io/swagger/model/DCAEServiceTypeRequest.java
+++ b/src/gen/java/io/swagger/model/DCAEServiceTypeRequest.java
@@ -1,163 +1,227 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
+
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
+@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z")
+public class DCAEServiceTypeRequest {
+
+ @NotEmpty
+ private String owner = null;
+ @NotEmpty
+ private String typeName = null;
+ @NotNull
+ private Integer typeVersion = 1;
+ @NotEmpty
+ private String blueprintTemplate = null;
+
+ // REVIEW: Look to deprecate these depending upon how the ASDC integration goes
+ private List<String> serviceIds = null;
+ private List<String> vnfTypes = new ArrayList<String>();
+
+ private List<String> serviceLocations = null;
+
+ // TODO: This should eventually become required fields
+ private String asdcServiceId = null;
+ private String asdcResourceId = null;
+ private String asdcServiceURL = null;
+
+
+ /**
+ **/
+ public DCAEServiceTypeRequest owner(String owner) {
+ this.owner = owner;
+ return this;
+ }
+
+
+ @ApiModelProperty(required = true, value = "")
+ @JsonProperty("owner")
+ public String getOwner() {
+ return owner;
+ }
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z")
-public class DCAEServiceTypeRequest {
-
- @NotEmpty
- private String owner = null;
- @NotEmpty
- private List<String> vnfTypes = new ArrayList<String>();
- @NotEmpty
- private String blueprintTemplate = null;
- private List<String> serviceLocations = null;
- private List<String> serviceIds = null;
-
- /**
- **/
- public DCAEServiceTypeRequest owner(String owner) {
- this.owner = owner;
- return this;
- }
-
-
- @ApiModelProperty(required = true, value = "")
- @JsonProperty("owner")
- public String getOwner() {
- return owner;
- }
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- /**
- **/
- public DCAEServiceTypeRequest vnfTypes(List<String> vnfTypes) {
- this.vnfTypes = vnfTypes;
- return this;
- }
-
-
- @ApiModelProperty(required = true, value = "")
- @JsonProperty("vnfTypes")
- public List<String> getVnfTypes() {
- return vnfTypes;
- }
- public void setVnfTypes(List<String> vnfTypes) {
- this.vnfTypes = vnfTypes;
- }
-
- /**
- * String representation of a Cloudify blueprint with unbound variables
- **/
- public DCAEServiceTypeRequest blueprintTemplate(String blueprintTemplate) {
- this.blueprintTemplate = blueprintTemplate;
- return this;
- }
-
-
- @ApiModelProperty(required = true, value = "String representation of a Cloudify blueprint with unbound variables")
- @JsonProperty("blueprintTemplate")
- public String getBlueprintTemplate() {
- return blueprintTemplate;
- }
- public void setBlueprintTemplate(String blueprintTemplate) {
- this.blueprintTemplate = blueprintTemplate;
- }
-
- @ApiModelProperty(required = false, value = "List of service locations that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service location.")
- @JsonProperty("serviceLocations")
- public List<String> getServiceLocations() {
- return this.serviceLocations;
- }
- public void setServiceLocations(List<String> serviceLocations) {
- this.serviceLocations = serviceLocations;
- }
-
- @ApiModelProperty(required = false, value = "List of service ids that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service id.")
- @JsonProperty("serviceIds")
- public List<String> getServiceIds() {
- return this.serviceIds;
- }
- public void setServiceIds(List<String> serviceIds) {
- this.serviceIds = serviceIds;
- }
-
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- DCAEServiceTypeRequest dCAEServiceTypeRequest = (DCAEServiceTypeRequest) o;
- return Objects.equals(owner, dCAEServiceTypeRequest.owner) &&
- Objects.equals(vnfTypes, dCAEServiceTypeRequest.vnfTypes) &&
- Objects.equals(blueprintTemplate, dCAEServiceTypeRequest.blueprintTemplate);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(owner, vnfTypes, blueprintTemplate);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("class DCAEServiceTypeRequest {\n");
-
- sb.append(" owner: ").append(toIndentedString(owner)).append("\n");
- sb.append(" vnfTypes: ").append(toIndentedString(vnfTypes)).append("\n");
- sb.append(" blueprintTemplate: ").append(toIndentedString(blueprintTemplate)).append("\n");
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces
- * (except the first line).
- */
- private String toIndentedString(Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
+ @ApiModelProperty(required = true, value = "Descriptive name for this DCAE service type")
+ @JsonProperty("typeName")
+ public String getTypeName() {
+ return typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ this.typeName = typeName;
+ }
+
+
+ @ApiModelProperty(required = true, value = "Version number for this DCAE service type")
+ @JsonProperty("typeVersion")
+ public Integer getTypeVersion() {
+ return this.typeVersion;
+ }
+
+ public void setTypeVersion(Integer typeVersion) {
+ this.typeVersion = typeVersion;
+ }
+
+ /**
+ **/
+ public DCAEServiceTypeRequest vnfTypes(List<String> vnfTypes) {
+ this.vnfTypes = vnfTypes;
+ return this;
+ }
+
+
+ @ApiModelProperty(required = false, value = "")
+ @JsonProperty("vnfTypes")
+ public List<String> getVnfTypes() {
+ return vnfTypes;
+ }
+
+ public void setVnfTypes(List<String> vnfTypes) {
+ this.vnfTypes = vnfTypes;
+ }
+
+ /**
+ * String representation of a Cloudify blueprint with unbound variables
+ **/
+ public DCAEServiceTypeRequest blueprintTemplate(String blueprintTemplate) {
+ this.blueprintTemplate = blueprintTemplate;
+ return this;
+ }
+
+
+ @ApiModelProperty(required = true, value = "String representation of a Cloudify blueprint with unbound variables")
+ @JsonProperty("blueprintTemplate")
+ public String getBlueprintTemplate() {
+ return blueprintTemplate;
+ }
+
+ public void setBlueprintTemplate(String blueprintTemplate) {
+ this.blueprintTemplate = blueprintTemplate;
+ }
+
+ @ApiModelProperty(required = false, value = "List of service locations that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service location.")
+ @JsonProperty("serviceLocations")
+ public List<String> getServiceLocations() {
+ return this.serviceLocations;
+ }
+
+ public void setServiceLocations(List<String> serviceLocations) {
+ this.serviceLocations = serviceLocations;
+ }
+
+ @ApiModelProperty(required = false, value = "List of service ids that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service id.")
+ @JsonProperty("serviceIds")
+ public List<String> getServiceIds() {
+ return this.serviceIds;
+ }
+
+ public void setServiceIds(List<String> serviceIds) {
+ this.serviceIds = serviceIds;
+ }
+
+ @ApiModelProperty(required = false, value = "Id of service this DCAE service type is associated with. Value source is from ASDC's notification event's field `serviceInvariantUUID`.")
+ @JsonProperty("asdcServiceId")
+ public String getAsdcServiceId() {
+ return asdcServiceId;
+ }
+
+ public void setAsdcServiceId(String asdcServiceId) {
+ this.asdcServiceId = asdcServiceId;
+ }
+
+ @ApiModelProperty(required = false, value = "Id of vf/vnf instance this DCAE service type is associated with. Value source is from ASDC's notification event's field `resourceInvariantUUID`.")
+ @JsonProperty("asdcResourceId")
+ public String getAsdcResourceId() {
+ return asdcResourceId;
+ }
+
+ public void setAsdcResourceId(String asdcResourceId) {
+ this.asdcResourceId = asdcResourceId;
+ }
+
+ @ApiModelProperty(required = false, value = "URL to the ASDC service model")
+ @JsonProperty("asdcServiceURL")
+ public String getAsdcServiceURL() {
+ return asdcServiceURL;
+ }
+
+ public void setAsdcServiceURL(String asdcServiceURL) {
+ this.asdcServiceURL = asdcServiceURL;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DCAEServiceTypeRequest dCAEServiceTypeRequest = (DCAEServiceTypeRequest) o;
+ return Objects.equals(owner, dCAEServiceTypeRequest.owner) &&
+ Objects.equals(vnfTypes, dCAEServiceTypeRequest.vnfTypes) &&
+ Objects.equals(blueprintTemplate, dCAEServiceTypeRequest.blueprintTemplate);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(owner, vnfTypes, blueprintTemplate);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class DCAEServiceTypeRequest {\n");
+
+ sb.append(" owner: ").append(toIndentedString(owner)).append("\n");
+ sb.append(" vnfTypes: ").append(toIndentedString(vnfTypes)).append("\n");
+ sb.append(" blueprintTemplate: ").append(toIndentedString(blueprintTemplate)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
}
diff --git a/src/gen/java/io/swagger/model/InlineResponse200.java b/src/gen/java/io/swagger/model/InlineResponse200.java
index c5ffdf8..0c44fdf 100644
--- a/src/gen/java/io/swagger/model/InlineResponse200.java
+++ b/src/gen/java/io/swagger/model/InlineResponse200.java
@@ -1,28 +1,25 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
diff --git a/src/gen/java/io/swagger/model/InlineResponse2001.java b/src/gen/java/io/swagger/model/InlineResponse2001.java
index 26cf3be..88e3816 100644
--- a/src/gen/java/io/swagger/model/InlineResponse2001.java
+++ b/src/gen/java/io/swagger/model/InlineResponse2001.java
@@ -1,28 +1,25 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
diff --git a/src/gen/java/io/swagger/model/InlineResponse200Links.java b/src/gen/java/io/swagger/model/InlineResponse200Links.java
index ffcb51a..bff7254 100644
--- a/src/gen/java/io/swagger/model/InlineResponse200Links.java
+++ b/src/gen/java/io/swagger/model/InlineResponse200Links.java
@@ -1,28 +1,25 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
diff --git a/src/gen/java/io/swagger/model/Link.java b/src/gen/java/io/swagger/model/Link.java
index 56a6f95..3c69b26 100644
--- a/src/gen/java/io/swagger/model/Link.java
+++ b/src/gen/java/io/swagger/model/Link.java
@@ -1,28 +1,25 @@
-package io.swagger.model;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.model;
+
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
diff --git a/src/main/java/io/swagger/api/Bootstrap.java b/src/main/java/io/swagger/api/Bootstrap.java
index 71be330..5050ed3 100644
--- a/src/main/java/io/swagger/api/Bootstrap.java
+++ b/src/main/java/io/swagger/api/Bootstrap.java
@@ -1,28 +1,25 @@
-package io.swagger.api;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api;
+
import io.swagger.jaxrs.config.SwaggerContextService;
import io.swagger.models.*;
@@ -40,6 +37,8 @@ public class Bootstrap extends HttpServlet {
.title("Swagger Server")
.description("DCAE Inventory is a web service that provides the following:\n\n1. Real-time data on all DCAE services and their components\n2. Comprehensive details on available DCAE service types\n")
.termsOfService("")
+ .contact(new Contact()
+ .email("dcae@lists.openecomp.org"))
.license(new License()
.name("")
.url(""));
diff --git a/src/main/java/io/swagger/api/factories/DcaeServiceTypesApiServiceFactory.java b/src/main/java/io/swagger/api/factories/DcaeServiceTypesApiServiceFactory.java
index ba583b8..fecd8fe 100644
--- a/src/main/java/io/swagger/api/factories/DcaeServiceTypesApiServiceFactory.java
+++ b/src/main/java/io/swagger/api/factories/DcaeServiceTypesApiServiceFactory.java
@@ -1,28 +1,25 @@
-package io.swagger.api.factories;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api.factories;
+
import io.swagger.api.DcaeServiceTypesApiService;
import io.swagger.api.impl.DcaeServiceTypesApiServiceImpl;
diff --git a/src/main/java/io/swagger/api/factories/DcaeServicesApiServiceFactory.java b/src/main/java/io/swagger/api/factories/DcaeServicesApiServiceFactory.java
index 6bd06a0..47f213d 100644
--- a/src/main/java/io/swagger/api/factories/DcaeServicesApiServiceFactory.java
+++ b/src/main/java/io/swagger/api/factories/DcaeServicesApiServiceFactory.java
@@ -1,28 +1,25 @@
-package io.swagger.api.factories;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api.factories;
+
import org.openecomp.dcae.inventory.clients.DCAEControllerClient;
import org.openecomp.dcae.inventory.clients.DatabusControllerClient;
import io.swagger.api.DcaeServicesApiService;
@@ -44,13 +41,6 @@ public class DcaeServicesApiServiceFactory {
}
public static DcaeServicesApiService getDcaeServicesApi() {
- // TODO: Hide these exceptions behind a custom exception. This should be fatal.
- if (dcaeControllerClient == null) {
- throw new RuntimeException("DCAE controller client not configured");
- }
- if (databusControllerClient == null) {
- throw new RuntimeException("Databus controller client not configured");
- }
return new DcaeServicesApiServiceImpl(dcaeControllerClient, databusControllerClient);
}
diff --git a/src/main/java/io/swagger/api/factories/DcaeServicesGroupbyApiServiceFactory.java b/src/main/java/io/swagger/api/factories/DcaeServicesGroupbyApiServiceFactory.java
index 43cdcb6..041fbaf 100644
--- a/src/main/java/io/swagger/api/factories/DcaeServicesGroupbyApiServiceFactory.java
+++ b/src/main/java/io/swagger/api/factories/DcaeServicesGroupbyApiServiceFactory.java
@@ -1,28 +1,25 @@
-package io.swagger.api.factories;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api.factories;
+
import io.swagger.api.DcaeServicesGroupbyApiService;
import io.swagger.api.impl.DcaeServicesGroupbyApiServiceImpl;
diff --git a/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java b/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java
index 261f52c..34d8a4b 100644
--- a/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java
+++ b/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java
@@ -1,28 +1,25 @@
-package io.swagger.api.impl;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api.impl;
+
import org.openecomp.dcae.inventory.daos.DCAEServiceTypesDAO;
import org.openecomp.dcae.inventory.daos.DCAEServicesDAO;
import org.openecomp.dcae.inventory.daos.InventoryDAOManager;
@@ -45,6 +42,8 @@ import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.core.UriInfo;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
+import java.util.UUID;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-04-18T20:16:22.119Z")
public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
@@ -54,21 +53,30 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
private DCAEServiceType createDCAEServiceType(DCAEServiceTypeObject serviceTypeObject, UriInfo uriInfo) {
DCAEServiceType serviceType = new DCAEServiceType();
- serviceType.setSelfLink(DcaeServiceTypesApi.buildLinkForGet(uriInfo, "self", serviceTypeObject.getTypeName()));
+ serviceType.setSelfLink(DcaeServiceTypesApi.buildLinkForGet(uriInfo, "self", serviceTypeObject.getTypeId()));
+ serviceType.setTypeId(serviceTypeObject.getTypeId());
serviceType.setTypeName(serviceTypeObject.getTypeName());
+ serviceType.setTypeVersion(serviceTypeObject.getTypeVersion());
serviceType.setOwner(serviceTypeObject.getOwner());
serviceType.setVnfTypes(serviceTypeObject.getVnfTypes());
serviceType.setServiceIds(serviceTypeObject.getServiceIds());
serviceType.setServiceLocations(serviceTypeObject.getServiceLocations());
serviceType.setBlueprintTemplate(serviceTypeObject.getBlueprintTemplate());
- serviceType.created(serviceTypeObject.getCreated().toDate());
+ serviceType.setAsdcServiceId(serviceTypeObject.getAsdcServiceId());
+ serviceType.setAsdcResourceId(serviceTypeObject.getAsdcResourceId());
+ // TODO: Construct ASDC service URL somehow
+ serviceType.setCreated(serviceTypeObject.getCreated().toDate());
+
+ DateTime deactivated = serviceTypeObject.getDeactivated();
+ serviceType.setDeactivated(deactivated == null ? null : deactivated.toDate());
return serviceType;
}
@Override
- public Response dcaeServiceTypesGet(String vnfType, String serviceId, String serviceLocation, Integer offset, UriInfo uriInfo,
- SecurityContext securityContext)
+ public Response dcaeServiceTypesGet(String typeName, Boolean onlyLatest, Boolean onlyActive, String vnfType,
+ String serviceId, String serviceLocation, String asdcServiceId,
+ String asdcResourceId, Integer offset, UriInfo uriInfo, SecurityContext securityContext)
throws NotFoundException {
List<DCAEServiceTypeObject> serviceTypeObjects = new ArrayList<>();
@@ -76,12 +84,23 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
DateTime createdCutoff = DateTime.now(DateTimeZone.UTC);
try (Handle jdbiHandle = InventoryDAOManager.getInstance().getHandle()) {
- StringBuilder sb = new StringBuilder("select * from dcae_service_types");
+ StringBuilder sb = new StringBuilder("select * from ");
+
+ if (onlyLatest) {
+ // Use the view which filters types that are of only the latest versions
+ sb.append("dcae_service_types_latest");
+ } else {
+ sb.append("dcae_service_types");
+ }
List<String> whereClauses = new ArrayList<String>();
+ if (typeName != null) {
+ whereClauses.add(":typeName = type_name");
+ }
+
if (vnfType != null) {
- whereClauses.add(":vnfType = any(vnf_types)");
+ whereClauses.add("lower(:vnfType) = any(lower(vnf_types\\:\\:text)\\:\\:text[])");
}
if (serviceId != null) {
@@ -92,9 +111,27 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
whereClauses.add("(:serviceLocation = any(service_locations) or service_locations = \'{}\' or service_locations is null)");
}
+ if (asdcServiceId != null) {
+ if ("NONE".equals(asdcServiceId.toUpperCase(Locale.ENGLISH))) {
+ whereClauses.add("asdc_service_id is null");
+ } else {
+ whereClauses.add(":asdcServiceId = asdc_service_id");
+ }
+ }
+
+ if (asdcResourceId != null) {
+ if ("NONE".equals(asdcResourceId.toUpperCase(Locale.ENGLISH))) {
+ whereClauses.add("asdc_resource_id is null");
+ } else {
+ whereClauses.add(":asdcResourceId = asdc_resource_id");
+ }
+ }
+
whereClauses.add("created < :createdCutoff");
- // We only want the active service types
- whereClauses.add("is_active = TRUE");
+
+ if (onlyActive) {
+ whereClauses.add("deactivated is null");
+ }
if (!whereClauses.isEmpty()) {
sb.append(" where ");
@@ -106,6 +143,10 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
Query<DCAEServiceTypeObject> query = jdbiHandle.createQuery(sb.toString()).map(new DCAEServiceTypeObjectMapper());
+ if (typeName != null) {
+ query.bind("typeName", typeName);
+ }
+
if (vnfType != null) {
query.bind("vnfType", vnfType);
}
@@ -118,6 +159,14 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
query.bind("serviceLocation", serviceLocation);
}
+ if (asdcServiceId != null && !"NONE".equals(asdcServiceId.toUpperCase(Locale.ENGLISH))) {
+ query.bind("asdcServiceId", asdcServiceId);
+ }
+
+ if (asdcResourceId != null && !"NONE".equals(asdcResourceId.toUpperCase(Locale.ENGLISH))) {
+ query.bind("asdcResourceId", asdcResourceId);
+ }
+
query.bind("createdCutoff", createdCutoff);
serviceTypeObjects = query.list();
@@ -144,14 +193,18 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
InlineResponse200Links navigationLinks = new InlineResponse200Links();
Integer offsetPrev = offset - PAGINATION_PAGE_SIZE;
+ // TODO: MUST UPDATE THIS LINK NAV CODE
+
if (offsetPrev >= 0) {
- navigationLinks.setPreviousLink(DcaeServiceTypesApi.buildLinkForGet(uriInfo, "prev", vnfType, offsetPrev));
+ navigationLinks.setPreviousLink(DcaeServiceTypesApi.buildLinkForGet(uriInfo, "prev", typeName, onlyLatest,
+ onlyActive, vnfType, serviceId, serviceLocation, asdcServiceId, asdcResourceId, offsetPrev));
}
Integer offsetNext = offset + PAGINATION_PAGE_SIZE;
if (offsetNext < totalCount) {
- navigationLinks.setNextLink(DcaeServiceTypesApi.buildLinkForGet(uriInfo, "next", vnfType, offsetNext));
+ navigationLinks.setNextLink(DcaeServiceTypesApi.buildLinkForGet(uriInfo, "next", typeName, onlyLatest,
+ onlyActive, vnfType, serviceId, serviceLocation, asdcServiceId, asdcResourceId, offsetNext));
}
response.setLinks(navigationLinks);
@@ -160,10 +213,10 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
}
@Override
- public Response dcaeServiceTypesTypeNameGet(String typeName, UriInfo uriInfo, SecurityContext securityContext)
+ public Response dcaeServiceTypesTypeIdGet(String typeId, UriInfo uriInfo, SecurityContext securityContext)
throws NotFoundException {
DCAEServiceTypesDAO serviceTypesDAO = InventoryDAOManager.getInstance().getDCAEServiceTypesDAO();
- DCAEServiceTypeObject serviceTypeObject = serviceTypesDAO.getByTypeName(typeName);
+ DCAEServiceTypeObject serviceTypeObject = serviceTypesDAO.getByTypeId(typeId);
if (serviceTypeObject == null) {
return Response.status(Response.Status.NOT_FOUND).build();
@@ -172,51 +225,88 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
return Response.ok().entity(createDCAEServiceType(serviceTypeObject, uriInfo)).build();
}
+ /**
+ * Create a DCAE service type database object
+ *
+ * Utility method that takes a DCAE service type request body and creates a database object representation
+ * to insert.
+ *
+ * @param typeId
+ * @param request
+ * @return
+ */
+ private static DCAEServiceTypeObject createDCAEServiceTypeDBO(String typeId, DCAEServiceTypeRequest request) {
+ DCAEServiceTypeObject serviceTypeObject = new DCAEServiceTypeObject();
+ serviceTypeObject.setTypeId(typeId);
+ serviceTypeObject.setTypeName(request.getTypeName());
+ serviceTypeObject.setTypeVersion(request.getTypeVersion());
+ serviceTypeObject.setOwner(request.getOwner());
+ serviceTypeObject.setBlueprintTemplate(request.getBlueprintTemplate());
+ serviceTypeObject.setVnfTypes(request.getVnfTypes());
+ serviceTypeObject.setServiceIds(request.getServiceIds());
+ serviceTypeObject.setServiceLocations(request.getServiceLocations());
+ serviceTypeObject.setAsdcServiceId(request.getAsdcServiceId());
+ serviceTypeObject.setAsdcResourceId(request.getAsdcResourceId());
+ serviceTypeObject.setCreated(DateTime.now(DateTimeZone.UTC));
+
+ return serviceTypeObject;
+ }
+
@Override
- public Response dcaeServiceTypesTypeNamePut(String typeName, DCAEServiceTypeRequest request, UriInfo uriInfo,
+ public Response dcaeServiceTypesTypeIdPost(DCAEServiceTypeRequest request, UriInfo uriInfo,
SecurityContext securityContext) {
DCAEServiceTypesDAO serviceTypesDAO = InventoryDAOManager.getInstance().getDCAEServiceTypesDAO();
- DCAEServiceTypeObject serviceTypeObject = serviceTypesDAO.getByTypeName(typeName);
+ // Must query by the implicit composite key: type name, type version, asdc service id, asdc resource id
+ // Had to split up the queries into two because in SQL selecting by null has to be `some_field is null`
+ //
+ // FIXME: There is a race condition here where there could be multiple records with different ids
+ // for the same implicit composite key. Maybe the answer is to simply add back in a PUT.
+ DCAEServiceTypeObject serviceTypeObject
+ = (request.getAsdcServiceId() == null || request.getAsdcResourceId() == null)
+ ? serviceTypesDAO.getByRequestFromNotASDC(request) : serviceTypesDAO.getByRequestFromASDC(request);
if (serviceTypeObject == null) {
- // Create object from request
- serviceTypeObject = new DCAEServiceTypeObject();
- serviceTypeObject.setTypeName(typeName);
- serviceTypeObject.setOwner(request.getOwner());
- serviceTypeObject.setVnfTypes(request.getVnfTypes());
- serviceTypeObject.setServiceIds(request.getServiceIds());
- serviceTypeObject.setServiceLocations(request.getServiceLocations());
- serviceTypeObject.setBlueprintTemplate(request.getBlueprintTemplate());
- serviceTypeObject.setCreated(DateTime.now(DateTimeZone.UTC));
-
- serviceTypesDAO.insertNewerVersion(serviceTypeObject);
-
+ // Generate a new type id
+ String typeId = UUID.randomUUID().toString();
+ serviceTypeObject = createDCAEServiceTypeDBO(typeId, request);
+ serviceTypesDAO.insert(serviceTypeObject);
return Response.ok().entity(createDCAEServiceType(serviceTypeObject, uriInfo)).build();
}
+ // Service type with same composite key already exists so try to update
+
+ String typeId = serviceTypeObject.getTypeId();
DCAEServicesDAO servicesDAO = InventoryDAOManager.getInstance().getDCAEServicesDAO();
- Integer count = servicesDAO.countByType(DCAEServiceObject.DCAEServiceStatus.RUNNING, typeName);
+ Integer count = servicesDAO.countByType(DCAEServiceObject.DCAEServiceStatus.RUNNING, typeId);
- LOG.info(String.format("Checked num DCAE services running: %s, %d", typeName, count));
+ LOG.info(String.format("Checked num DCAE services running: %s, %d", typeId, count));
// Allow the updating of an existing DCAE service type IFF there are no running DCAE services for this type
if (count > 0) {
- String message = String.format("DCAE services of type %s are still running: %d", typeName, count);
+ String message = String.format("DCAE services of type %s are still running: %d", typeId, count);
ApiResponseMessage entity = new ApiResponseMessage(ApiResponseMessage.ERROR, message);
return Response.status(Response.Status.CONFLICT).entity(entity).build();
} else {
- serviceTypeObject.setOwner(request.getOwner());
- serviceTypeObject.setVnfTypes(request.getVnfTypes());
- serviceTypeObject.setServiceIds(request.getServiceIds());
- serviceTypeObject.setServiceLocations(request.getServiceLocations());
- serviceTypeObject.setBlueprintTemplate(request.getBlueprintTemplate());
- serviceTypeObject.setCreated(DateTime.now(DateTimeZone.UTC));
+ serviceTypeObject = createDCAEServiceTypeDBO(typeId, request);
+ serviceTypesDAO.update(serviceTypeObject);
+ return Response.ok().entity(serviceTypeObject).build();
+ }
+ }
- InventoryDAOManager.getInstance().getDCAEServiceTypeTransactionDAO().upsert(serviceTypeObject);
+ @Override
+ public Response dcaeServiceTypesTypeIdDelete(String typeId, UriInfo uriInfo, SecurityContext securityContext)
+ throws NotFoundException {
+ DCAEServiceTypesDAO serviceTypesDAO = InventoryDAOManager.getInstance().getDCAEServiceTypesDAO();
- return Response.ok().entity(serviceTypeObject).build();
+ if (serviceTypesDAO.getByTypeId(typeId) == null) {
+ throw new NotFoundException(1, String.format("DCAE service type not found: %s", typeId));
+ } else if (serviceTypesDAO.getByTypeIdActiveOnly(typeId) == null) {
+ return Response.status(Response.Status.GONE).build();
}
+
+ serviceTypesDAO.deactivateExisting(typeId);
+ return Response.ok().build();
}
}
diff --git a/src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java b/src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java
index 1861688..d1e790c 100644
--- a/src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java
+++ b/src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java
@@ -1,28 +1,25 @@
-package io.swagger.api.impl;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api.impl;
+
import org.openecomp.dcae.inventory.clients.DCAEControllerClient;
import org.openecomp.dcae.inventory.clients.DatabusControllerClient;
import org.openecomp.dcae.inventory.daos.DCAEServiceComponentsDAO;
@@ -66,7 +63,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService {
DCAEService service = new DCAEService();
service.setServiceId(serviceObject.getServiceId());
service.setSelfLink(DcaeServicesApi.buildLinkForGet(uriInfo, "self", serviceObject.getServiceId()));
- service.setTypeLink(DcaeServiceTypesApi.buildLinkForGet(uriInfo, "type", serviceObject.getTypeName()));
+ service.setTypeLink(DcaeServiceTypesApi.buildLinkForGet(uriInfo, "type", serviceObject.getTypeId()));
service.setCreated(serviceObject.getCreated().toDate());
service.setModified(serviceObject.getModified().toDate());
service.setVnfId(serviceObject.getVnfId());
@@ -89,30 +86,34 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService {
// TODO: When putting together the components fail. Should this be a 500 case?
// For now, this is just logged as a warning.
- if (COMPONENT_SOURCE_DCAE_CONTROLLER.equals(sco.getComponentSource().toUpperCase())) {
- try {
- DCAEControllerClient.ServiceInstance serviceInstance
- = this.dcaeControllerClient.getServiceInstance(component.getComponentId());
- component.setStatus(serviceInstance.getStatus());
- // There's no specific location rather its inferred from the tenant
- component.setLocation(this.dcaeControllerClient.getLocation(serviceInstance));
- Link componentLink = Link.fromUri(this.dcaeControllerClient.constructResourceURI(sco.getComponentId()))
- .rel("component").title(component.getComponentId()).build();
- component.setComponentLink(componentLink);
- } catch (DCAEControllerClientException e) {
- LOG.warn(String.format("%s, %s", e.getMessage(), sco.toString()));
- }
- } else if (COMPONENT_SOURCE_DATA_BUS_CONTROLLER.equals(sco.getComponentSource().toUpperCase())) {
- try {
- if (this.databusControllerClient.isExists(sco.getComponentId())) {
- Link componentLink = Link.fromUri(this.databusControllerClient.constructResourceURI(sco.getComponentId()))
+ if (COMPONENT_SOURCE_DCAE_CONTROLLER.equals(sco.getComponentSource().toUpperCase(Locale.ENGLISH))) {
+ if (this.dcaeControllerClient != null) {
+ try {
+ DCAEControllerClient.ServiceInstance serviceInstance
+ = this.dcaeControllerClient.getServiceInstance(component.getComponentId());
+ component.setStatus(serviceInstance.getStatus());
+ // There's no specific location rather its inferred from the AIC tenant
+ component.setLocation(this.dcaeControllerClient.getLocation(serviceInstance));
+ Link componentLink = Link.fromUri(this.dcaeControllerClient.constructResourceURI(sco.getComponentId()))
.rel("component").title(component.getComponentId()).build();
component.setComponentLink(componentLink);
- } else {
- LOG.warn(String.format("Feed/topic does not exist: %s", sco.getComponentId()));
+ } catch (DCAEControllerClientException e) {
+ LOG.warn(String.format("%s, %s", e.getMessage(), sco.toString()));
+ }
+ }
+ } else if (COMPONENT_SOURCE_DATA_BUS_CONTROLLER.equals(sco.getComponentSource().toUpperCase(Locale.ENGLISH))) {
+ if (this.databusControllerClient != null) {
+ try {
+ if (this.databusControllerClient.isExists(sco.getComponentId())) {
+ Link componentLink = Link.fromUri(this.databusControllerClient.constructResourceURI(sco.getComponentId()))
+ .rel("component").title(component.getComponentId()).build();
+ component.setComponentLink(componentLink);
+ } else {
+ LOG.warn(String.format("Feed/topic does not exist: %s", sco.getComponentId()));
+ }
+ } catch (DatabusControllerClientException e) {
+ LOG.warn(String.format("%s, %s", e.getMessage(), sco.toString()));
}
- } catch (DatabusControllerClientException e) {
- LOG.warn(String.format("%s, %s", e.getMessage(), sco.toString()));
}
} else {
LOG.warn(String.format("Handling unknown component source: %s", sco.getComponentSource()));
@@ -127,7 +128,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService {
}
@Override
- public Response dcaeServicesGet(String typeName, String vnfId, String vnfType, String vnfLocation,
+ public Response dcaeServicesGet(String typeId, String vnfId, String vnfType, String vnfLocation,
String componentType, Boolean shareable, DateTime created, Integer offset,
UriInfo uriInfo, SecurityContext securityContext) {
List<DCAEServiceObject> serviceObjects = new ArrayList<>();
@@ -147,8 +148,8 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService {
List<String> whereClauses = new ArrayList<String>();
- if (typeName != null) {
- whereClauses.add("ds.type_name = :typeName");
+ if (typeId != null) {
+ whereClauses.add("ds.type_id = :typeId");
}
if (vnfId != null) {
@@ -156,7 +157,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService {
}
if (vnfType != null) {
- whereClauses.add("ds.vnf_type = :vnfType");
+ whereClauses.add("lower(ds.vnf_type) = lower(:vnfType)");
}
if (vnfLocation != null) {
@@ -184,8 +185,8 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService {
Query<DCAEServiceObject> query = jdbiHandle.createQuery(sb.toString()).map(new DCAEServiceObjectMapper());
- if (typeName != null) {
- query.bind("typeName", typeName);
+ if (typeId != null) {
+ query.bind("typeId", typeId);
}
if (vnfId != null) {
@@ -240,14 +241,14 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService {
Integer offsetPrev = offset - PAGINATION_PAGE_SIZE;
if (offsetPrev >= 0) {
- navigationLinks.setPreviousLink(DcaeServicesApi.buildLinkForGet(uriInfo, "prev", typeName, vnfId, vnfType,
+ navigationLinks.setPreviousLink(DcaeServicesApi.buildLinkForGet(uriInfo, "prev", typeId, vnfId, vnfType,
vnfLocation, componentType, shareable, created, offsetPrev));
}
Integer offsetNext = offset + PAGINATION_PAGE_SIZE;
if (offsetNext < serviceObjects.size()) {
- navigationLinks.setNextLink(DcaeServicesApi.buildLinkForGet(uriInfo, "next", typeName, vnfId, vnfType,
+ navigationLinks.setNextLink(DcaeServicesApi.buildLinkForGet(uriInfo, "next", typeId, vnfId, vnfType,
vnfLocation, componentType, shareable, created, offsetNext));
}
@@ -278,8 +279,8 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService {
public Response dcaeServicesServiceIdPut(String serviceId, DCAEServiceRequest request, UriInfo uriInfo,
SecurityContext securityContext) {
// Check to make sure that the DCAE service type exists
- if (InventoryDAOManager.getInstance().getDCAEServiceTypesDAO().getByTypeName(request.getTypeName()) == null) {
- String errorMessage = String.format("DCAE service type does not exist: %s", request.getTypeName());
+ if (InventoryDAOManager.getInstance().getDCAEServiceTypesDAO().getByTypeIdActiveOnly(request.getTypeId()) == null) {
+ String errorMessage = String.format("DCAE service type does not exist: %s", request.getTypeId());
ApiResponseMessage message = new ApiResponseMessage(ApiResponseMessage.ERROR, errorMessage);
return Response.status(422).entity(message).build();
}
diff --git a/src/main/java/io/swagger/api/impl/DcaeServicesGroupbyApiServiceImpl.java b/src/main/java/io/swagger/api/impl/DcaeServicesGroupbyApiServiceImpl.java
index 10bd7fa..09d3143 100644
--- a/src/main/java/io/swagger/api/impl/DcaeServicesGroupbyApiServiceImpl.java
+++ b/src/main/java/io/swagger/api/impl/DcaeServicesGroupbyApiServiceImpl.java
@@ -1,28 +1,25 @@
-package io.swagger.api.impl;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package io.swagger.api.impl;
+
import org.openecomp.dcae.inventory.daos.InventoryDAOManager;
import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceObject;
import io.swagger.api.*;
@@ -46,7 +43,7 @@ public class DcaeServicesGroupbyApiServiceImpl extends DcaeServicesGroupbyApiSer
switch (propertyName) {
case "type":
- columnName = "type_name";
+ columnName = "type_id";
break;
case "vnfLocation":
columnName = "vnf_location";
@@ -83,7 +80,7 @@ public class DcaeServicesGroupbyApiServiceImpl extends DcaeServicesGroupbyApiSer
switch (propertyName) {
case "type":
- value.setDcaeServiceQueryLink(DcaeServicesApi.buildLinkForGetByTypeName(uriInfo, "dcae_services",
+ value.setDcaeServiceQueryLink(DcaeServicesApi.buildLinkForGetByTypeId(uriInfo, "dcae_services",
propertyValue));
break;
case "vnfLocation":
diff --git a/src/main/java/org/openecomp/dcae/inventory/InventoryApplication.java b/src/main/java/org/openecomp/dcae/inventory/InventoryApplication.java
index 9a16331..b64a917 100644
--- a/src/main/java/org/openecomp/dcae/inventory/InventoryApplication.java
+++ b/src/main/java/org/openecomp/dcae/inventory/InventoryApplication.java
@@ -1,39 +1,35 @@
-package org.openecomp.dcae.inventory;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory;
+
import org.openecomp.dcae.inventory.clients.DCAEControllerClient;
import org.openecomp.dcae.inventory.clients.DatabusControllerClient;
import org.openecomp.dcae.inventory.daos.InventoryDAOManager;
-import org.openecomp.dcae.inventory.dbthings.StringListArgument;
+import org.openecomp.dcae.inventory.exceptions.mappers.DBIExceptionMapper;
import org.openecomp.dcae.inventory.exceptions.mappers.DCAEControllerConnectionExceptionMapper;
import org.openecomp.dcae.inventory.exceptions.mappers.DCAEControllerTimeoutExceptionMapper;
import org.openecomp.dcae.inventory.providers.NotFoundExceptionMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import io.dropwizard.Application;
import io.dropwizard.client.JerseyClientBuilder;
-import io.dropwizard.jdbi.DBIFactory;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import io.swagger.api.DcaeServiceTypesApi;
@@ -47,7 +43,6 @@ import io.swagger.models.Contact;
import io.swagger.models.Info;
import org.eclipse.jetty.servlets.CrossOriginFilter;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
-import org.skife.jdbi.v2.DBI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,6 +51,7 @@ import javax.servlet.FilterRegistration;
import javax.ws.rs.client.Client;
import javax.ws.rs.core.Link;
import java.util.EnumSet;
+import java.util.Locale;
/**
@@ -66,6 +62,10 @@ public class InventoryApplication extends Application<InventoryConfiguration> {
static final Logger LOG = LoggerFactory.getLogger(InventoryApplication.class);
public static void main(String[] args) throws Exception {
+ // This is here to try to fix a "high" issue caught by Fortify. Did this **plus** setting locale for each of the
+ // string comparisons that use `toUpper` because of this StackOverflow post:
+ // http://stackoverflow.com/questions/38308777/fixed-fortify-scan-locale-changes-are-reappearing
+ Locale.setDefault(Locale.ENGLISH);
new InventoryApplication().run(args);
}
@@ -79,7 +79,8 @@ public class InventoryApplication extends Application<InventoryConfiguration> {
// This Info object was lifted from the Swagger generated io.swagger.api.Bootstrap file. Although it was not generated
// correctly.
Info info = new Info().title("DCAE Inventory API").version("0.8.0")
- .description("DCAE Inventory is a web service that provides the following:\n\n1. Real-time data on all DCAE services and their components\n2. Comprehensive details on available DCAE service types\n");
+ .description("DCAE Inventory is a web service that provides the following:\n\n1. Real-time data on all DCAE services and their components\n2. Comprehensive details on available DCAE service types\n")
+ .contact(new Contact().email("dcae@lists.openecomp.org"));
// Swagger/servlet/jax-rs magic!
BeanConfig beanConfig = new BeanConfig();
beanConfig.setInfo(info);
@@ -91,10 +92,8 @@ public class InventoryApplication extends Application<InventoryConfiguration> {
public void run(InventoryConfiguration configuration, Environment environment) {
LOG.info("Starting DCAE inventory application");
LOG.info(String.format("DB driver properties: %s", configuration.getDataSourceFactory().getProperties().toString()));
- final DBIFactory factory = new DBIFactory();
- final DBI jdbi = factory.build(environment, configuration.getDataSourceFactory(), "dcae-database");
- jdbi.registerArgumentFactory(new StringListArgument());
- InventoryDAOManager.getInstance().init(jdbi);
+ InventoryDAOManager.getInstance().setup(environment, configuration);
+ InventoryDAOManager.getInstance().initialize();
// Add filter for CORS support for DCAE dashboard
// http://jitterted.com/tidbits/2014/09/12/cors-for-dropwizard-0-7-x/
@@ -113,24 +112,42 @@ public class InventoryApplication extends Application<InventoryConfiguration> {
// Setup DCAE controller client
// Used by the dcae-services API
- final Client clientDCAEController = new JerseyClientBuilder(environment).using(configuration.getJerseyClientConfiguration())
- .build("DCAEControllerClient");
- HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder().build();
- clientDCAEController.register(feature);
- final DCAEControllerClient dcaeControllerClient = new DCAEControllerClient(clientDCAEController, configuration.getDcaeControllerConnection());
- DcaeServicesApiServiceFactory.setDcaeControllerClient(dcaeControllerClient);
+ if (configuration.getDcaeControllerConnection().getRequired()) {
+ final Client clientDCAEController = new JerseyClientBuilder(environment).using(configuration.getJerseyClientConfiguration())
+ .build("DCAEControllerClient");
+ HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder().build();
+ clientDCAEController.register(feature);
+ final DCAEControllerClient dcaeControllerClient = new DCAEControllerClient(clientDCAEController, configuration.getDcaeControllerConnection());
+ DcaeServicesApiServiceFactory.setDcaeControllerClient(dcaeControllerClient);
+
+ LOG.info("Use of DCAE controller client is required. Turned on.");
+ } else {
+ LOG.warn("Use of DCAE controller client is *not* required. Turned off.");
+ }
// Setup Databus controller client
// Used by the dcae-services API
- final Client clientDatabusController = new JerseyClientBuilder(environment).using(configuration.getJerseyClientConfiguration())
- .build("DatabusControllerClient");
- final DatabusControllerClient databusControllerClient = new DatabusControllerClient(clientDatabusController,
- configuration.getDatabusControllerConnection());
- DcaeServicesApiServiceFactory.setDatabusControllerClient(databusControllerClient);
+ if (configuration.getDatabusControllerConnection().getRequired()) {
+ final Client clientDatabusController = new JerseyClientBuilder(environment).using(configuration.getJerseyClientConfiguration())
+ .build("DatabusControllerClient");
+ clientDatabusController.register(HttpAuthenticationFeature.basicBuilder().credentials(
+ configuration.getDatabusControllerConnection().getMechId(),
+ configuration.getDatabusControllerConnection().getPassword()).build());
+ final DatabusControllerClient databusControllerClient = new DatabusControllerClient(clientDatabusController,
+ configuration.getDatabusControllerConnection());
+ DcaeServicesApiServiceFactory.setDatabusControllerClient(databusControllerClient);
+
+ LOG.info("Use of databus controller client is required. Turned on.");
+ } else {
+ LOG.warn("Use of databus controller client is *not* required. Turned off.");
+ }
environment.jersey().register(NotFoundExceptionMapper.class);
environment.jersey().register(DCAEControllerConnectionExceptionMapper.class);
environment.jersey().register(DCAEControllerTimeoutExceptionMapper.class);
+ environment.jersey().register(DBIExceptionMapper.UnableToObtainConnectionExceptionMapper.class);
+ environment.jersey().register(DBIExceptionMapper.UnableToExecuteStatementExceptionMapper.class);
+ environment.jersey().register(DBIExceptionMapper.UnableToCreateStatementExceptionMapper.class);
environment.jersey().register(new DcaeServicesApi());
environment.jersey().register(new DcaeServiceTypesApi());
diff --git a/src/main/java/org/openecomp/dcae/inventory/InventoryConfiguration.java b/src/main/java/org/openecomp/dcae/inventory/InventoryConfiguration.java
index 54370ee..55bcca2 100644
--- a/src/main/java/org/openecomp/dcae/inventory/InventoryConfiguration.java
+++ b/src/main/java/org/openecomp/dcae/inventory/InventoryConfiguration.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory;
+
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import io.dropwizard.client.JerseyClientConfiguration;
@@ -58,6 +55,9 @@ public class InventoryConfiguration extends Configuration {
@JsonProperty
private String password;
+ @JsonProperty
+ private Boolean required = true;
+
public String getHost() {
return this.host;
}
@@ -77,6 +77,10 @@ public class InventoryConfiguration extends Configuration {
public String getPassword() {
return this.password;
}
+
+ public Boolean getRequired() {
+ return this.required;
+ }
}
public static class DatabusControllerConnectionConfiguration {
@@ -88,6 +92,17 @@ public class InventoryConfiguration extends Configuration {
@JsonProperty
private Integer port;
+ @NotNull
+ @JsonProperty
+ private String mechId;
+
+ @NotNull
+ @JsonProperty
+ private String password;
+
+ @JsonProperty
+ private Boolean required = true;
+
public String getHost() {
return host;
}
@@ -95,6 +110,18 @@ public class InventoryConfiguration extends Configuration {
public Integer getPort() {
return port;
}
+
+ public String getMechId() {
+ return mechId;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public Boolean getRequired() {
+ return this.required;
+ }
}
@NotEmpty
diff --git a/src/main/java/org/openecomp/dcae/inventory/LinkSerializer.java b/src/main/java/org/openecomp/dcae/inventory/LinkSerializer.java
index 8cf07db..b83697f 100644
--- a/src/main/java/org/openecomp/dcae/inventory/LinkSerializer.java
+++ b/src/main/java/org/openecomp/dcae/inventory/LinkSerializer.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory;
+
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
diff --git a/src/main/java/org/openecomp/dcae/inventory/clients/DCAEControllerClient.java b/src/main/java/org/openecomp/dcae/inventory/clients/DCAEControllerClient.java
index 23e05fd..adbe8b7 100644
--- a/src/main/java/org/openecomp/dcae/inventory/clients/DCAEControllerClient.java
+++ b/src/main/java/org/openecomp/dcae/inventory/clients/DCAEControllerClient.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.clients;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.clients;
+
import org.openecomp.dcae.inventory.InventoryConfiguration;
import org.openecomp.dcae.inventory.exceptions.DCAEControllerClientException;
import org.openecomp.dcae.inventory.exceptions.DCAEControllerConnectionException;
@@ -171,7 +168,7 @@ public class DCAEControllerClient {
// Apparently the exceptions are wrapped which is not ideal because many different types of errors are embedded
// in single exception. TODO: May want to come back to split up the errors.
// Example:
- // javax.ws.rs.ProcessingException: org.apache.http.conn.ConnectTimeoutException: Connect to aaa.bbb.ccc:9998
+ // javax.ws.rs.ProcessingException: org.apache.http.conn.ConnectTimeoutException: Connect to <dcae controller domain name>:9998
String message = "Connecting with DCAE controller probably timed out";
LOG.error(message, e);
String exceptionMessage = String.format("%s: %s", message, e.getMessage());
diff --git a/src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java b/src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java
index ac3bbf1..9df11d5 100644
--- a/src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java
+++ b/src/main/java/org/openecomp/dcae/inventory/clients/DatabusControllerClient.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.clients;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.clients;
+
import org.openecomp.dcae.inventory.InventoryConfiguration;
import org.openecomp.dcae.inventory.exceptions.DatabusControllerClientException;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -51,7 +48,7 @@ public class DatabusControllerClient {
resourcePath = (new StringBuilder("/")).append(resourcePath).toString();
}
- return UriBuilder.fromPath(resourcePath.toString()).scheme("http").host(this.connectionConfiguration.getHost())
+ return UriBuilder.fromPath(resourcePath.toString()).scheme("https").host(this.connectionConfiguration.getHost())
.port(this.connectionConfiguration.getPort()).build();
}
@@ -74,6 +71,11 @@ public class DatabusControllerClient {
} catch (IOException e) {
throw new DatabusControllerClientException(e);
}
+ } else if (response.getStatus() == 401) {
+ // You probably got this because your mech id/password is not authorized
+ throw new DatabusControllerClientException(String.format("Check the mech id/password: %d", response.getStatus()));
+ } else if (response.getStatus() == 403) {
+ throw new DatabusControllerClientException(String.format("Credentials not authorized: %d", response.getStatus()));
}
throw new DatabusControllerClientException(String.format("Unexpected error from databus controller: %d",
diff --git a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceComponentsDAO.java b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceComponentsDAO.java
index d1b5ec0..9a674c9 100644
--- a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceComponentsDAO.java
+++ b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceComponentsDAO.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.daos;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.daos;
+
import org.openecomp.dcae.inventory.dbthings.mappers.DCAEServiceComponentObjectMapper;
import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceComponentObject;
import org.skife.jdbi.v2.sqlobject.Bind;
diff --git a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTransactionDAO.java b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTransactionDAO.java
index dc3d6b3..f0fca86 100644
--- a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTransactionDAO.java
+++ b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTransactionDAO.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.daos;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.daos;
+
import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceComponentObject;
import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceObject;
import org.joda.time.DateTime;
diff --git a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTypeTransactionDAO.java b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTypeTransactionDAO.java
deleted file mode 100644
index c3c65e2..0000000
--- a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTypeTransactionDAO.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.openecomp.dcae.inventory.daos;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
- */
-
-import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceTypeObject;
-import org.skife.jdbi.v2.sqlobject.CreateSqlObject;
-
-/**
- * Created by mhwang on 5/19/16.
- */
-public abstract class DCAEServiceTypeTransactionDAO {
-
- @CreateSqlObject
- abstract DCAEServiceTypesDAO getServiceTypesDAO();
-
- public void upsert(DCAEServiceTypeObject newerVersion) {
- // Order of operation is important here!
- this.getServiceTypesDAO().deactivateExisting(newerVersion.getTypeName());
- this.getServiceTypesDAO().insertNewerVersion(newerVersion);
- }
-
-}
diff --git a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTypesDAO.java b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTypesDAO.java
index 5c961f9..50b79b2 100644
--- a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTypesDAO.java
+++ b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServiceTypesDAO.java
@@ -1,30 +1,29 @@
-package org.openecomp.dcae.inventory.daos;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.daos;
+
import org.openecomp.dcae.inventory.dbthings.mappers.DCAEServiceTypeObjectMapper;
+
import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceTypeObject;
+import io.swagger.model.DCAEServiceTypeRequest;
import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.BindBean;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
@@ -32,10 +31,9 @@ import org.skife.jdbi.v2.sqlobject.SqlUpdate;
import org.skife.jdbi.v2.sqlobject.customizers.Mapper;
/**
- * DCAE service type records are treated immutable. Newer versions are added with the flag "is_active" set to TRUE.
- * The responsibility of managing the active version on the caller of this DAO.
- *
- * Currently the "is_active" flag is hidden to the application except in this DAO.
+ * DCAE service type records are no longer treated immutable because versioning is handled by clients
+ * to DCAE inventory i.e. ASDC. There is field "deactivated" that determines if a service type is active.
+ * Inserts and updates automatically activates a service type while deleting deactivates a service type.
*
* Created by mhwang on 4/19/16.
*/
@@ -48,21 +46,45 @@ public interface DCAEServiceTypesDAO extends InventoryDAO {
* Note that service_ids and service_locations are nullable fields. This might not be the right decision but because
* the resource model allows for nulls, thought it should consistent.
*/
- @SqlUpdate("create table dcae_service_types (type_name varchar not null, owner varchar not null," +
- "vnf_types varchar[] not null, service_ids varchar[], service_locations varchar[], blueprint_template text not null, " +
- "created timestamp not null, is_active boolean not null, constraint pk_type_created primary key (type_name, created))")
+ @SqlUpdate("create table dcae_service_types (type_id varchar not null, type_version integer not null, " +
+ "type_name varchar not null, owner varchar not null, blueprint_template text not null, " +
+ "vnf_types varchar[] not null, service_ids varchar[], service_locations varchar[], " +
+ "asdc_service_id varchar, asdc_resource_id varchar, " +
+ "created timestamp not null, deactivated timestamp, constraint pk_type_created primary key (type_id))")
void createTable();
- @SqlUpdate("insert into dcae_service_types(type_name, owner, vnf_types, service_ids, service_locations, " +
- "blueprint_template, created, is_active) values (:typeName, :owner, :vnfTypes, :serviceIds, :serviceLocations, " +
- ":blueprintTemplate, :created, TRUE)")
- void insertNewerVersion(@BindBean DCAEServiceTypeObject serviceObject);
+ // REVIEW: asdcServiceId and asdcResourceId is implicitly part of the unique key and thus shouldn't be updated.
+ @SqlUpdate("insert into dcae_service_types(type_id, type_version, type_name, owner, blueprint_template, vnf_types, " +
+ "service_ids, service_locations, asdc_service_id, asdc_resource_id, created, deactivated) " +
+ "values (:typeId, :typeVersion, :typeName, :owner, :blueprintTemplate, :vnfTypes, :serviceIds, " +
+ ":serviceLocations, :asdcServiceId, :asdcResourceId, :created, null)")
+ void insert(@BindBean DCAEServiceTypeObject serviceObject);
+
+ @SqlUpdate("update dcae_service_types set " +
+ "owner = :owner, blueprint_template = :blueprintTemplate, vnf_types = :vnfTypes, " +
+ "service_ids = :serviceIds, service_locations = :serviceLocations, created = :created, " +
+ "deactivated = null where type_id = :typeId")
+ void update(@BindBean DCAEServiceTypeObject serviceObject);
+
+ @SqlUpdate("update dcae_service_types set deactivated = (now() at time zone 'utc') where type_id = :typeId")
+ void deactivateExisting(@Bind("typeId") String typeId);
+
+ @Mapper(DCAEServiceTypeObjectMapper.class)
+ @SqlQuery("select * from dcae_service_types where type_id = :it")
+ DCAEServiceTypeObject getByTypeId(@Bind String typeId);
+
+ @Mapper(DCAEServiceTypeObjectMapper.class)
+ @SqlQuery("select * from dcae_service_types where deactivated is null and type_id = :it")
+ DCAEServiceTypeObject getByTypeIdActiveOnly(@Bind String typeId);
- @SqlUpdate("update dcae_service_types set is_active = FALSE where type_name = :typeName and is_active = TRUE")
- void deactivateExisting(@Bind("typeName") String typeName);
+ @Mapper(DCAEServiceTypeObjectMapper.class)
+ @SqlQuery("select * from dcae_service_types where type_name = :typeName and type_version = :typeVersion " +
+ "and asdc_service_id is null and asdc_resource_id is null")
+ DCAEServiceTypeObject getByRequestFromNotASDC(@BindBean DCAEServiceTypeRequest serviceTypeObject);
@Mapper(DCAEServiceTypeObjectMapper.class)
- @SqlQuery("select * from dcae_service_types where is_active = TRUE and type_name = :it")
- DCAEServiceTypeObject getByTypeName(@Bind String typeName);
+ @SqlQuery("select * from dcae_service_types where type_name = :typeName and type_version = :typeVersion " +
+ "and asdc_service_id = :asdcServiceId and asdc_resource_id = :asdcResourceId")
+ DCAEServiceTypeObject getByRequestFromASDC(@BindBean DCAEServiceTypeRequest serviceTypeObject);
}
diff --git a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java
index 405476d..5bfd3cd 100644
--- a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java
+++ b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.daos;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.daos;
+
import org.joda.time.DateTime;
import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
diff --git a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServicesDAO.java b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServicesDAO.java
index e40b8b5..9200677 100644
--- a/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServicesDAO.java
+++ b/src/main/java/org/openecomp/dcae/inventory/daos/DCAEServicesDAO.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.daos;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.daos;
+
import org.openecomp.dcae.inventory.dbthings.mappers.DCAEServiceObjectMapper;
import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceObject;
import org.joda.time.DateTime;
@@ -42,17 +39,17 @@ public interface DCAEServicesDAO extends InventoryDAO {
@SqlQuery("select exists (select * from information_schema.tables where table_name = \'dcae_services\')")
Boolean checkIfTableExists();
- @SqlUpdate("create table dcae_services (service_id varchar not null primary key, type_name varchar not null, " +
+ @SqlUpdate("create table dcae_services (service_id varchar not null primary key, type_id varchar not null, " +
"vnf_id varchar not null, vnf_type varchar not null, vnf_location varchar not null, deployment_ref varchar, " +
"created timestamp not null, modified timestamp not null, status varchar not null)")
void createTable();
- @SqlUpdate("insert into dcae_services(service_id, type_name, vnf_id, vnf_type, vnf_location, deployment_ref, " +
- "created, modified, status) values (:serviceId, :typeName, :vnfId, :vnfType, :vnfLocation, :deploymentRef, " +
+ @SqlUpdate("insert into dcae_services(service_id, type_id, vnf_id, vnf_type, vnf_location, deployment_ref, " +
+ "created, modified, status) values (:serviceId, :typeId, :vnfId, :vnfType, :vnfLocation, :deploymentRef, " +
":created, :modified, :status)")
void insert(@BindBean DCAEServiceObject serviceObject);
- @SqlUpdate("update dcae_services set type_name = :typeName, vnf_id = :vnfId, vnf_type = :vnfType, " +
+ @SqlUpdate("update dcae_services set type_id = :typeId, vnf_id = :vnfId, vnf_type = :vnfType, " +
"vnf_location = :vnfLocation, deployment_ref = :deploymentRef, modified = :modified, status = :status " +
"where service_id = :serviceId")
void update(@BindBean DCAEServiceObject serviceObject);
@@ -71,7 +68,9 @@ public interface DCAEServicesDAO extends InventoryDAO {
@Bind("serviceId") String serviceId);
@Mapper(IntegerMapper.class)
- @SqlQuery("select count(1) from dcae_services where status = :status and type_name = :typeName")
- Integer countByType(@Bind("status") DCAEServiceObject.DCAEServiceStatus status, @Bind("typeName") String typeName);
+ @SqlQuery("select count(1) from dcae_services where status = :status and type_id = :typeId")
+ Integer countByType(@Bind("status") DCAEServiceObject.DCAEServiceStatus status, @Bind("typeId") String typeId);
}
+
+
diff --git a/src/main/java/org/openecomp/dcae/inventory/daos/InventoryDAO.java b/src/main/java/org/openecomp/dcae/inventory/daos/InventoryDAO.java
index 6205d2c..ef2fb8d 100644
--- a/src/main/java/org/openecomp/dcae/inventory/daos/InventoryDAO.java
+++ b/src/main/java/org/openecomp/dcae/inventory/daos/InventoryDAO.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.daos;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.daos;
+
/**
* Created by mhwang on 4/19/16.
*/
diff --git a/src/main/java/org/openecomp/dcae/inventory/daos/InventoryDAOManager.java b/src/main/java/org/openecomp/dcae/inventory/daos/InventoryDAOManager.java
index fd4d2eb..77611b5 100644
--- a/src/main/java/org/openecomp/dcae/inventory/daos/InventoryDAOManager.java
+++ b/src/main/java/org/openecomp/dcae/inventory/daos/InventoryDAOManager.java
@@ -1,30 +1,32 @@
-package org.openecomp.dcae.inventory.daos;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.daos;
+
+import org.openecomp.dcae.inventory.InventoryConfiguration;
+import org.openecomp.dcae.inventory.dbthings.StringListArgument;
+import io.dropwizard.jdbi.DBIFactory;
+import io.dropwizard.setup.Environment;
import org.skife.jdbi.v2.DBI;
import org.skife.jdbi.v2.Handle;
+import org.skife.jdbi.v2.util.BooleanMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,18 +52,54 @@ public final class InventoryDAOManager {
return instance;
}
+ public static class InventoryDAOManagerSetupException extends RuntimeException {
+
+ public InventoryDAOManagerSetupException(String message) {
+ super(message);
+ }
+
+ }
+
private final static Logger LOG = LoggerFactory.getLogger(InventoryDAOManager.class);
// WATCH! Table creation order matters where mapping tables refer to other tables for foreign keys.
private final static List<Class> DAO_CLASSES = Arrays.asList(DCAEServiceTypesDAO.class, DCAEServicesDAO.class,
DCAEServiceComponentsDAO.class, DCAEServicesComponentsMapsDAO.class);
private DBI jdbi;
+ private Environment environment;
+ private InventoryConfiguration configuration;
private InventoryDAOManager() {
}
- public void init(DBI jdbi) {
- this.jdbi = jdbi;
+ /**
+ * Setup the manager
+ *
+ * Saving the Dropwizard environment and configuration which are used to construct the DBI object in a later
+ * initialize call. This method can only be called once to be safe and to avoid runtime problems that could be
+ * caused if the global instance of this class gets into a weird state (Couldn't use Java's `final` qualifier).
+ *
+ * @param environment
+ * @param inventoryConfiguration
+ */
+ public void setup(Environment environment, InventoryConfiguration inventoryConfiguration) {
+ if (this.environment == null && this.configuration == null) {
+ this.environment = environment;
+ this.configuration = inventoryConfiguration;
+ } else {
+ throw new InventoryDAOManagerSetupException("InventoryDAOManager setup can only be called once.");
+ }
+ }
+
+ /**
+ * Initialize the manager
+ *
+ * Create the underlying validated DBI object that is used to manage database connections
+ */
+ public void initialize() {
+ final DBIFactory factory = new DBIFactory();
+ final DBI jdbi = factory.build(this.environment, this.configuration.getDataSourceFactory(), "dcae-database");
+ jdbi.registerArgumentFactory(new StringListArgument());
for (Class<? extends InventoryDAO> daoClass : DAO_CLASSES) {
final InventoryDAO dao = jdbi.onDemand(daoClass);
@@ -73,6 +111,31 @@ public final class InventoryDAOManager {
LOG.info(String.format("Sql table created: %s", daoClass.getSimpleName()));
}
}
+
+ // CREATE VIEWS
+ // TODO: This doesn't belong here and is not consistent with the above approach. Make it better.
+ try (Handle jdbiHandle = jdbi.open()) {
+ String viewName = "dcae_service_types_latest";
+ String checkQuery = String.format("select exists (select * from information_schema.tables where table_name = '%s')",
+ viewName);
+
+ if (jdbiHandle.createQuery(checkQuery).map(BooleanMapper.FIRST).first()) {
+ LOG.info(String.format("Sql view exists: %s", viewName));
+ } else {
+ StringBuilder sb = new StringBuilder(String.format("create view %s as ", viewName));
+ sb.append("select s.* from dcae_service_types s ");
+ sb.append("join (select type_name, max(type_version) as max_version from dcae_service_types group by type_name) as f ");
+ sb.append("on s.type_name = f.type_name and s.type_version = f.max_version");
+
+ jdbiHandle.execute(sb.toString());
+ LOG.info(String.format("Sql view created: %s", viewName));
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("", e);
+ }
+
+ // Do this assignment at the end after performing table checks to ensure that connection is good
+ this.jdbi = jdbi;
}
private InventoryDAO getDAO(Class<? extends InventoryDAO> klass) {
@@ -102,10 +165,6 @@ public final class InventoryDAOManager {
return jdbi.onDemand(DCAEServiceTransactionDAO.class);
}
- public DCAEServiceTypeTransactionDAO getDCAEServiceTypeTransactionDAO() {
- return jdbi.onDemand(DCAEServiceTypeTransactionDAO.class);
- }
-
public DCAEServiceTypesDAO getDCAEServiceTypesDAO() {
return (DCAEServiceTypesDAO) this.getDAO(DCAEServiceTypesDAO.class);
}
diff --git a/src/main/java/org/openecomp/dcae/inventory/dbthings/StringListArgument.java b/src/main/java/org/openecomp/dcae/inventory/dbthings/StringListArgument.java
index 11c77fd..afd0e78 100644
--- a/src/main/java/org/openecomp/dcae/inventory/dbthings/StringListArgument.java
+++ b/src/main/java/org/openecomp/dcae/inventory/dbthings/StringListArgument.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.dbthings;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.dbthings;
+
import org.skife.jdbi.v2.StatementContext;
import org.skife.jdbi.v2.tweak.Argument;
import org.skife.jdbi.v2.tweak.ArgumentFactory;
diff --git a/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceComponentObjectMapper.java b/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceComponentObjectMapper.java
index ee0602f..23b42b1 100644
--- a/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceComponentObjectMapper.java
+++ b/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceComponentObjectMapper.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.dbthings.mappers;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.dbthings.mappers;
+
import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceComponentObject;
import org.joda.time.DateTime;
import org.skife.jdbi.v2.StatementContext;
diff --git a/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceObjectMapper.java b/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceObjectMapper.java
index 7cff043..27cb22f 100644
--- a/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceObjectMapper.java
+++ b/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceObjectMapper.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.dbthings.mappers;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.dbthings.mappers;
+
import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceObject;
import org.joda.time.DateTime;
import org.skife.jdbi.v2.StatementContext;
@@ -40,7 +37,7 @@ public class DCAEServiceObjectMapper implements ResultSetMapper<DCAEServiceObjec
public DCAEServiceObject map(int i, ResultSet resultSet, StatementContext statementContext) throws SQLException {
DCAEServiceObject object = new DCAEServiceObject();
object.setServiceId(resultSet.getString("service_id"));
- object.setTypeName(resultSet.getString("type_name"));
+ object.setTypeId(resultSet.getString("type_id"));
object.setVnfId(resultSet.getString("vnf_id"));
object.setVnfType(resultSet.getString("vnf_type"));
object.setVnfLocation(resultSet.getString("vnf_location"));
diff --git a/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapper.java b/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapper.java
index bbd9903..dc64423 100644
--- a/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapper.java
+++ b/src/main/java/org/openecomp/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapper.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.dbthings.mappers;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.dbthings.mappers;
+
import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceTypeObject;
import org.joda.time.DateTime;
import org.skife.jdbi.v2.StatementContext;
@@ -31,6 +28,7 @@ import org.skife.jdbi.v2.tweak.ResultSetMapper;
import java.sql.Array;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.sql.Timestamp;
import java.util.Arrays;
/**
@@ -41,7 +39,9 @@ public class DCAEServiceTypeObjectMapper implements ResultSetMapper<DCAEServiceT
@Override
public DCAEServiceTypeObject map(int i, ResultSet resultSet, StatementContext statementContext) throws SQLException {
DCAEServiceTypeObject object = new DCAEServiceTypeObject();
+ object.setTypeId(resultSet.getString("type_id"));
object.setTypeName(resultSet.getString("type_name"));
+ object.setTypeVersion(resultSet.getInt("type_version"));
object.setOwner(resultSet.getString("owner"));
String[] vnfTypes = (String[]) resultSet.getArray("vnf_types").getArray();
object.setVnfTypes(Arrays.asList(vnfTypes));
@@ -61,7 +61,12 @@ public class DCAEServiceTypeObjectMapper implements ResultSetMapper<DCAEServiceT
}
object.setBlueprintTemplate(resultSet.getString("blueprint_template"));
+ object.setAsdcServiceId(resultSet.getString("asdc_service_id"));
+ object.setAsdcResourceId(resultSet.getString("asdc_resource_id"));
object.setCreated(new DateTime(resultSet.getTimestamp("created")));
+
+ Timestamp deactivated = resultSet.getTimestamp("deactivated");
+ object.setDeactivated(deactivated == null ? null : new DateTime(deactivated));
return object;
}
diff --git a/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceComponentObject.java b/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceComponentObject.java
index f7b783e..0ec9c19 100644
--- a/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceComponentObject.java
+++ b/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceComponentObject.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.dbthings.models;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.dbthings.models;
+
import io.swagger.model.DCAEServiceComponentRequest;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
diff --git a/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceObject.java b/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceObject.java
index 5defd46..4374acd 100644
--- a/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceObject.java
+++ b/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceObject.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.dbthings.models;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.dbthings.models;
+
import io.swagger.model.DCAEServiceRequest;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
@@ -38,7 +35,7 @@ public class DCAEServiceObject {
}
private String serviceId = null;
- private String typeName = null;
+ private String typeId = null;
private DateTime created = null;
private DateTime modified = null;
private String vnfId = null;
@@ -57,12 +54,12 @@ public class DCAEServiceObject {
this.serviceId = serviceId;
}
- public String getTypeName() {
- return typeName;
+ public String getTypeId() {
+ return typeId;
}
- public void setTypeName(String typeName) {
- this.typeName = typeName;
+ public void setTypeId(String typeId) {
+ this.typeId = typeId;
}
public DateTime getCreated() {
@@ -135,7 +132,7 @@ public class DCAEServiceObject {
public DCAEServiceObject(String serviceId, DCAEServiceRequest request) {
DateTime now = DateTime.now(DateTimeZone.UTC);
this.setServiceId(serviceId);
- this.setTypeName(request.getTypeName());
+ this.setTypeId(request.getTypeId());
this.setVnfId(request.getVnfId());
this.setVnfType(request.getVnfType());
this.setVnfLocation(request.getVnfLocation());
@@ -158,7 +155,7 @@ public class DCAEServiceObject {
this.setCreated(source.getCreated());
// Mutable fields
- this.setTypeName(updateRequest.getTypeName());
+ this.setTypeId(updateRequest.getTypeId());
this.setVnfId(updateRequest.getVnfId());
this.setVnfType(updateRequest.getVnfType());
this.setVnfLocation(updateRequest.getVnfLocation());
diff --git a/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceTypeObject.java b/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceTypeObject.java
index 1213207..b57a28f 100644
--- a/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceTypeObject.java
+++ b/src/main/java/org/openecomp/dcae/inventory/dbthings/models/DCAEServiceTypeObject.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.dbthings.models;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.dbthings.models;
+
import org.joda.time.DateTime;
import java.util.List;
@@ -34,13 +31,26 @@ import java.util.List;
*/
public class DCAEServiceTypeObject {
+ private String typeId = null;
private String typeName = null;
+ private Integer typeVersion = null;
+ private String blueprintTemplate = null;
private String owner = null;
private List<String> vnfTypes = null;
private List<String> serviceIds = null;
private List<String> serviceLocations = null;
- private String blueprintTemplate = null;
+ private String asdcServiceId = null;
+ private String asdcResourceId = null;
private DateTime created = null;
+ private DateTime deactivated = null;
+
+ public String getTypeId() {
+ return typeId;
+ }
+
+ public void setTypeId(String typeId) {
+ this.typeId = typeId;
+ }
public String getTypeName() {
return typeName;
@@ -50,6 +60,22 @@ public class DCAEServiceTypeObject {
this.typeName = typeName;
}
+ public Integer getTypeVersion() {
+ return typeVersion;
+ }
+
+ public void setTypeVersion(Integer typeVersion) {
+ this.typeVersion = typeVersion;
+ }
+
+ public String getBlueprintTemplate() {
+ return blueprintTemplate;
+ }
+
+ public void setBlueprintTemplate(String blueprintTemplate) {
+ this.blueprintTemplate = blueprintTemplate;
+ }
+
public String getOwner() {
return owner;
}
@@ -82,12 +108,20 @@ public class DCAEServiceTypeObject {
this.serviceLocations = serviceLocations;
}
- public String getBlueprintTemplate() {
- return blueprintTemplate;
+ public String getAsdcServiceId() {
+ return asdcServiceId;
}
- public void setBlueprintTemplate(String blueprintTemplate) {
- this.blueprintTemplate = blueprintTemplate;
+ public void setAsdcServiceId(String asdcServiceId) {
+ this.asdcServiceId = asdcServiceId;
+ }
+
+ public String getAsdcResourceId() {
+ return asdcResourceId;
+ }
+
+ public void setAsdcResourceId(String asdcResourceId) {
+ this.asdcResourceId = asdcResourceId;
}
public DateTime getCreated() {
@@ -98,4 +132,11 @@ public class DCAEServiceTypeObject {
this.created = created;
}
+ public DateTime getDeactivated() {
+ return deactivated;
+ }
+
+ public void setDeactivated(DateTime deactivated) {
+ this.deactivated = deactivated;
+ }
}
diff --git a/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerClientException.java b/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerClientException.java
index 5fde36b..eb30ae7 100644
--- a/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerClientException.java
+++ b/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerClientException.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.exceptions;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.exceptions;
+
/**
* Created by mhwang on 5/13/16.
*/
diff --git a/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerConnectionException.java b/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerConnectionException.java
index b901915..2b9e6e7 100644
--- a/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerConnectionException.java
+++ b/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerConnectionException.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.exceptions;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.exceptions;
+
/**
* Created by mhwang on 8/23/16.
*/
diff --git a/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerTimeoutException.java b/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerTimeoutException.java
index 5d76de6..8aa9255 100644
--- a/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerTimeoutException.java
+++ b/src/main/java/org/openecomp/dcae/inventory/exceptions/DCAEControllerTimeoutException.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.exceptions;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.exceptions;
+
/**
* Created by mhwang on 8/23/16.
*/
diff --git a/src/main/java/org/openecomp/dcae/inventory/exceptions/DatabusControllerClientException.java b/src/main/java/org/openecomp/dcae/inventory/exceptions/DatabusControllerClientException.java
index dbc3e3b..6209521 100644
--- a/src/main/java/org/openecomp/dcae/inventory/exceptions/DatabusControllerClientException.java
+++ b/src/main/java/org/openecomp/dcae/inventory/exceptions/DatabusControllerClientException.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.exceptions;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.exceptions;
+
/**
* Created by mhwang on 5/25/16.
*/
diff --git a/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DBIExceptionMapper.java b/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DBIExceptionMapper.java
new file mode 100644
index 0000000..5dce2dd
--- /dev/null
+++ b/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DBIExceptionMapper.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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.dcae.inventory.exceptions.mappers;
+
+import org.openecomp.dcae.inventory.daos.InventoryDAOManager;
+import io.swagger.api.ApiResponseMessage;
+import org.skife.jdbi.v2.exceptions.DBIException;
+import org.skife.jdbi.v2.exceptions.UnableToCreateStatementException;
+import org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException;
+import org.skife.jdbi.v2.exceptions.UnableToObtainConnectionException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+
+/**
+ * Created by mhwang on 3/6/17.
+ *
+ * Responsible for handling DBIExceptions for Inventory which are raised by database client calls
+ * http://jdbi.org/apidocs/org/skife/jdbi/v2/exceptions/DBIException.html
+ *
+ * This class is intended to be extended to match on specific exceptions that are derived from DBIException
+ */
+public class DBIExceptionMapper<T extends DBIException> implements ExceptionMapper<T> {
+
+ private final static Logger LOG = LoggerFactory.getLogger(DBIExceptionMapper.class);
+
+ /**
+ * Upon a DBIException, this handler will attempt to re-initialize the Inventory's database connection
+ * and craft a specific message telling the client what to do.
+ *
+ * @param exception Derived class of DBIException
+ * @return Returns a Response with a status code of 502 with an ApiResponseMessage object
+ */
+ @Override
+ public Response toResponse(T exception) {
+ LOG.error("", exception);
+ StringBuilder clientMessage = new StringBuilder("There is a database issue.");
+
+ try {
+ InventoryDAOManager.getInstance().initialize();
+ clientMessage.append(" Connection has been successfully reset. Please try again.");
+ } catch(Exception e) {
+ LOG.error(String.format("Failed to re-initialize database connection: %s", e.getMessage()));
+ clientMessage.append(" Connection reset attempt has failed. Please try again soon.");
+ }
+
+ ApiResponseMessage response = new ApiResponseMessage(ApiResponseMessage.ERROR, clientMessage.toString());
+ return Response.status(Response.Status.BAD_GATEWAY).entity(response).build();
+ }
+
+ // Here are the handlers for specific derived DBIException
+
+ public final static class UnableToObtainConnectionExceptionMapper extends DBIExceptionMapper<UnableToObtainConnectionException> {
+ }
+
+ public final static class UnableToCreateStatementExceptionMapper extends DBIExceptionMapper<UnableToCreateStatementException> {
+ }
+
+ public final static class UnableToExecuteStatementExceptionMapper extends DBIExceptionMapper<UnableToExecuteStatementException> {
+ }
+
+}
diff --git a/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerConnectionExceptionMapper.java b/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerConnectionExceptionMapper.java
index f5efd77..76936e0 100644
--- a/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerConnectionExceptionMapper.java
+++ b/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerConnectionExceptionMapper.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.exceptions.mappers;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.exceptions.mappers;
+
import org.openecomp.dcae.inventory.exceptions.DCAEControllerConnectionException;
import javax.ws.rs.core.Response;
diff --git a/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerExceptionMapper.java b/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerExceptionMapper.java
index 5647b75..b9ffda0 100644
--- a/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerExceptionMapper.java
+++ b/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerExceptionMapper.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.exceptions.mappers;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.exceptions.mappers;
+
import io.swagger.api.ApiResponseMessage;
import javax.ws.rs.core.Response;
diff --git a/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerTimeoutExceptionMapper.java b/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerTimeoutExceptionMapper.java
index 2b850ff..9939aee 100644
--- a/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerTimeoutExceptionMapper.java
+++ b/src/main/java/org/openecomp/dcae/inventory/exceptions/mappers/DCAEControllerTimeoutExceptionMapper.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.exceptions.mappers;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.exceptions.mappers;
+
import org.openecomp.dcae.inventory.exceptions.DCAEControllerTimeoutException;
import javax.ws.rs.core.Response;
diff --git a/src/main/java/org/openecomp/dcae/inventory/providers/NotFoundExceptionMapper.java b/src/main/java/org/openecomp/dcae/inventory/providers/NotFoundExceptionMapper.java
index ce5a55a..0f54b46 100644
--- a/src/main/java/org/openecomp/dcae/inventory/providers/NotFoundExceptionMapper.java
+++ b/src/main/java/org/openecomp/dcae/inventory/providers/NotFoundExceptionMapper.java
@@ -1,28 +1,25 @@
-package org.openecomp.dcae.inventory.providers;
-
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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
- *
+ *
+ * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+package org.openecomp.dcae.inventory.providers;
+
import io.swagger.api.ApiResponseMessage;
import io.swagger.api.NotFoundException;
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index bb5e513..b385750 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -39,16 +39,18 @@ database:
minIdleTime: 1 minute
dcaeControllerConnection:
- host:
+ host: dcae-controller-hostname
port: 9998
# Apparently this is variable parameter amongst DCAE controller instances
basePath: resources
- user:
- password:
+ user:
+ password:
databusControllerConnection:
- host:
- port: 8080
+ host: databus-controller-hostname
+ port: 8443
+ mechId:
+ password:
httpClient:
# The minimum number of threads to use for asynchronous calls.
@@ -64,3 +66,29 @@ httpClient:
# If true, the client will encode request entities with gzip
# content encoding. (Requires gzipEnabled to be true).
gzipEnabledForRequests: false
+
+ # Requests to databus controller were timing out so I bumped it up 4x of default
+ timeout: 5000milliseconds
+ connectionTimeout: 5000milliseconds
+
+server:
+ # requestLog is for those messages you see right when the service handles HTTP requests
+ requestLog:
+ appenders:
+ - type: file
+ currentLogFilename: /opt/logs/DCAE/inventory/audit.log
+ archive: true
+ archivedLogFilenamePattern: /opt/logs/DCAE/inventory/audit-%d.log.gz
+ archivedFileCount: 10
+ - type: console
+
+# Rolling is c.q.l.core.rolling.TimeBasedRollingPolicy
+logging:
+ level: INFO
+ appenders:
+ - type: file
+ currentLogFilename: /opt/logs/DCAE/inventory/audit.log
+ archive: true
+ archivedLogFilenamePattern: /opt/logs/DCAE/inventory/audit-%d.log.gz
+ archivedFileCount: 10
+ - type: console
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index 9e3f5bc..aa16762 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -1,15 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ============LICENSE_START===========
+ ============LICENSE_START=======================================================
dcae-inventory
- ==================================
- Copyright (C) 2016 AT&T
- ==================================
- This code is licensed under the Apache License, Version 2.0; you may
- not use this code for any purpose except in compliance with the Apache
- License. You may obtain a copy of the License at
- http://www.att.com/legal/openecomp.html
- ============LICENSE_END===========
+ ================================================================================
+ 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=========================================================
-->
<configuration>
diff --git a/src/test/java/DcaeServiceTypesApiServiceImplTests.java b/src/test/java/DcaeServiceTypesApiServiceImplTests.java
new file mode 100644
index 0000000..ce0011b
--- /dev/null
+++ b/src/test/java/DcaeServiceTypesApiServiceImplTests.java
@@ -0,0 +1,220 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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=========================================================
+ */
+
+import org.openecomp.dcae.inventory.daos.DCAEServiceTypesDAO;
+import org.openecomp.dcae.inventory.daos.DCAEServicesDAO;
+import org.openecomp.dcae.inventory.daos.InventoryDAOManager;
+import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceObject;
+import org.openecomp.dcae.inventory.dbthings.models.DCAEServiceTypeObject;
+import io.swagger.api.impl.DcaeServiceTypesApiServiceImpl;
+import io.swagger.model.DCAEServiceType;
+import io.swagger.model.DCAEServiceTypeRequest;
+import org.joda.time.DateTime;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.*;
+
+import org.junit.runner.RunWith;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.Objects;
+
+
+/**
+ * Created by mhwang on 10/27/16.
+ */
+@PrepareForTest({InventoryDAOManager.class})
+@RunWith(PowerMockRunner.class)
+public class DcaeServiceTypesApiServiceImplTests {
+
+ private final static Logger LOG = LoggerFactory.getLogger(DcaeServiceTypesApiServiceImplTests.class);
+
+ private final static String URL_PATH = "http://testing-is-good.com";
+
+ private DcaeServiceTypesApiServiceImpl api = null;
+ private UriInfo uriInfo = null;
+ private DCAEServiceTypesDAO mockTypesDAO = null;
+ private DCAEServicesDAO mockServicesDAO = null;
+
+ @Before
+ public void setupClass() {
+ api = new DcaeServiceTypesApiServiceImpl();
+
+ uriInfo = mock(UriInfo.class);
+ mockTypesDAO = mock(DCAEServiceTypesDAO.class);
+ mockServicesDAO = mock(DCAEServicesDAO.class);
+
+ // PowerMockito does bytecode magic to mock static methods and use final classes
+ PowerMockito.mockStatic(InventoryDAOManager.class);
+ InventoryDAOManager mockDAOManager = mock(InventoryDAOManager.class);
+
+ when(InventoryDAOManager.getInstance()).thenReturn(mockDAOManager);
+ when(mockDAOManager.getDCAEServiceTypesDAO()).thenReturn(mockTypesDAO);
+ when(mockDAOManager.getDCAEServicesDAO()).thenReturn(mockServicesDAO);
+
+ when(uriInfo.getBaseUriBuilder()).thenReturn(UriBuilder.fromPath(URL_PATH));
+ }
+
+ private static boolean matchTypeVsTypeObject(DCAEServiceType serviceType, DCAEServiceTypeObject serviceTypeObject, String prefixPath) {
+ return Objects.equals(serviceType.getTypeId(), serviceTypeObject.getTypeId())
+ && Objects.equals(serviceType.getTypeName(), serviceTypeObject.getTypeName())
+ && Objects.equals(serviceType.getTypeVersion(), serviceTypeObject.getTypeVersion())
+ && Objects.equals(serviceType.getOwner(), serviceTypeObject.getOwner())
+ && Objects.equals(serviceType.getBlueprintTemplate(), serviceTypeObject.getBlueprintTemplate())
+ && Objects.equals(serviceType.getCreated(), serviceTypeObject.getCreated().toDate())
+ && Objects.equals(serviceType.getVnfTypes(), serviceTypeObject.getVnfTypes())
+ && Objects.equals(serviceType.getServiceIds(), serviceTypeObject.getServiceIds())
+ && Objects.equals(serviceType.getServiceLocations(), serviceTypeObject.getServiceLocations())
+ && Objects.equals(serviceType.getAsdcResourceId(), serviceTypeObject.getAsdcResourceId())
+ && Objects.equals(serviceType.getAsdcServiceId(), serviceTypeObject.getAsdcServiceId())
+ && serviceType.getSelfLink().getUri().toString().contains(prefixPath)
+ && serviceType.getSelfLink().getUri().toString().contains(serviceTypeObject.getTypeId());
+ }
+
+ @Test
+ public void testGetSuccess() {
+ DCAEServiceTypeObject minimalFixture = new DCAEServiceTypeObject();
+ minimalFixture.setTypeId("abc:1");
+ minimalFixture.setTypeName("abc");
+ minimalFixture.setTypeVersion(1);
+ minimalFixture.setOwner("tester");
+ minimalFixture.setBlueprintTemplate("{ blueprint template goes here }");
+ minimalFixture.setCreated(DateTime.parse("2016-10-28T00:00"));
+
+ DCAEServiceTypeObject fullFixture = new DCAEServiceTypeObject();
+ fullFixture.setTypeId("def:1");
+ fullFixture.setTypeName("def");
+ fullFixture.setTypeVersion(1);
+ fullFixture.setOwner("tester");
+ fullFixture.setBlueprintTemplate("{ blueprint template goes here }");
+ fullFixture.setCreated(DateTime.parse("2016-10-28T00:00"));
+ fullFixture.setAsdcServiceId("4bb4e740-3920-442d-9ed3-89f15bdbff8a");
+ fullFixture.setAsdcResourceId("3ea9dfae-a00d-4da8-8c87-02a34de8fc02");
+ fullFixture.setVnfTypes(Arrays.asList(new String[] { "vnf-marble", "vnf-granite" }));
+ fullFixture.setServiceIds(Arrays.asList(new String[] { "service-alpha", "service-bravo" }));
+ fullFixture.setServiceLocations(Arrays.asList(new String[] { "New York", "Washington" }));
+
+ for (DCAEServiceTypeObject fixture : new DCAEServiceTypeObject[] {minimalFixture, fullFixture}) {
+ String someTypeId = fixture.getTypeId();
+ when(mockTypesDAO.getByTypeId(someTypeId)).thenReturn(fixture);
+
+ try {
+ Response response = api.dcaeServiceTypesTypeIdGet(someTypeId, uriInfo, null);
+ DCAEServiceType serviceType = (DCAEServiceType) response.getEntity();
+ assertTrue("GET - 200 test case failed", matchTypeVsTypeObject(serviceType, fixture, URL_PATH));
+ } catch (Exception e) {
+ throw new RuntimeException("Unexpected exception: get 200", e);
+ }
+ }
+ }
+
+ @Test
+ public void testGetNotFound() {
+ String someTypeId = "abc:1";
+ when(mockTypesDAO.getByTypeId(someTypeId)).thenReturn(null);
+
+ try {
+ Response response = api.dcaeServiceTypesTypeIdGet(someTypeId, uriInfo, null);
+ assertEquals("GET - 404 test case failed", 404, response.getStatus());
+ } catch(Exception e) {
+ throw new RuntimeException("Unexpected exception: get 404", e);
+ }
+ }
+
+ // TODO: Update this to check type id again. Must mock dao calls deeper.
+ private static boolean matchTypeVsTypeRequest(DCAEServiceType serviceType, DCAEServiceTypeRequest serviceTypeRequest, String prefixPath) {
+ return Objects.equals(serviceType.getTypeName(), serviceTypeRequest.getTypeName())
+ && Objects.equals(serviceType.getTypeVersion(), serviceTypeRequest.getTypeVersion())
+ && Objects.equals(serviceType.getOwner(), serviceTypeRequest.getOwner())
+ && Objects.equals(serviceType.getBlueprintTemplate(), serviceTypeRequest.getBlueprintTemplate())
+ && serviceType.getCreated() != null
+ && Objects.equals(serviceType.getVnfTypes(), serviceTypeRequest.getVnfTypes())
+ && Objects.equals(serviceType.getServiceIds(), serviceTypeRequest.getServiceIds())
+ && Objects.equals(serviceType.getServiceLocations(), serviceTypeRequest.getServiceLocations())
+ && Objects.equals(serviceType.getAsdcResourceId(), serviceTypeRequest.getAsdcResourceId())
+ && Objects.equals(serviceType.getAsdcServiceId(), serviceTypeRequest.getAsdcServiceId())
+ && serviceType.getSelfLink().getUri().toString().contains(prefixPath);
+ }
+
+ // TODO: Need to add tests for repeated POSTs == updates.
+ @Test
+ public void testPost() {
+ DCAEServiceTypeRequest minimalFixture = new DCAEServiceTypeRequest();
+ minimalFixture.setTypeName("abc");
+ minimalFixture.setTypeVersion(1);
+ minimalFixture.setOwner("tester");
+ minimalFixture.setBlueprintTemplate("{ blueprint template goes here }");
+
+ DCAEServiceTypeRequest fullFixture = new DCAEServiceTypeRequest();
+ fullFixture.setTypeName("def");
+ fullFixture.setTypeVersion(1);
+ fullFixture.setOwner("tester");
+ fullFixture.setBlueprintTemplate("{ blueprint template goes here }");
+ fullFixture.setAsdcServiceId("4bb4e740-3920-442d-9ed3-89f15bdbff8a");
+ fullFixture.setAsdcResourceId("3ea9dfae-a00d-4da8-8c87-02a34de8fc02");
+ fullFixture.setVnfTypes(Arrays.asList(new String[] { "vnf-marble", "vnf-granite" }));
+ fullFixture.setServiceIds(Arrays.asList(new String[] { "service-alpha", "service-bravo" }));
+ fullFixture.setServiceLocations(Arrays.asList(new String[] { "New York", "Washington" }));
+
+ for (DCAEServiceTypeRequest fixture : new DCAEServiceTypeRequest[] {minimalFixture, fullFixture}) {
+ try {
+ Response response = api.dcaeServiceTypesTypeIdPost(fixture, uriInfo, null);
+ DCAEServiceType serviceType = (DCAEServiceType) response.getEntity();
+ assertTrue("POST - 200 test case failed", matchTypeVsTypeRequest(serviceType, fixture, URL_PATH));
+ } catch (Exception e) {
+ throw new RuntimeException("Unexpected exception: post new 200", e);
+ }
+ }
+ }
+
+ @Test
+ public void testPostConflict() {
+ DCAEServiceTypeRequest minimalFixture = new DCAEServiceTypeRequest();
+ minimalFixture.setTypeName("abc");
+ minimalFixture.setTypeVersion(1);
+ minimalFixture.setOwner("tester");
+ minimalFixture.setBlueprintTemplate("{ blueprint template goes here }");
+
+ String expectedTypeId = String.format("%s:%s", minimalFixture.getTypeName(), minimalFixture.getTypeVersion());
+
+ when(mockTypesDAO.getByTypeId(expectedTypeId)).thenReturn(new DCAEServiceTypeObject());
+ when(mockServicesDAO.countByType(DCAEServiceObject.DCAEServiceStatus.RUNNING, expectedTypeId)).thenReturn(10);
+
+ try {
+ Response response = api.dcaeServiceTypesTypeIdPost(minimalFixture, uriInfo, null);
+ assertEquals("POST - 401 test case failed", 409, response.getStatus());
+ } catch (Exception e) {
+ throw new RuntimeException("Unexpected exception: post new 200", e);
+ }
+ }
+
+}
diff --git a/src/test/java/org/openecomp/dcae/inventory/daos/InventoryDAOManagerTests.java b/src/test/java/org/openecomp/dcae/inventory/daos/InventoryDAOManagerTests.java
new file mode 100644
index 0000000..16e3688
--- /dev/null
+++ b/src/test/java/org/openecomp/dcae/inventory/daos/InventoryDAOManagerTests.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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.dcae.inventory.daos;
+
+import org.openecomp.dcae.inventory.InventoryConfiguration;
+import io.dropwizard.setup.Environment;
+import org.junit.Test;
+import static org.mockito.Mockito.mock;
+
+/**
+ * Created by mhwang on 3/8/17.
+ */
+public class InventoryDAOManagerTests {
+
+ @Test(expected=InventoryDAOManager.InventoryDAOManagerSetupException.class)
+ public void testInitializeStrictness() {
+ InventoryDAOManager daoManager = InventoryDAOManager.getInstance();
+ Environment environment = mock(Environment.class);
+ InventoryConfiguration configuration = mock(InventoryConfiguration.class);
+ // This should be ok
+ daoManager.setup(environment, configuration);
+ // Cannot do another call
+ daoManager.setup(environment, configuration);
+ }
+
+}
diff --git a/src/test/java/org/openecomp/dcae/inventory/exception/mappers/DBIExceptionMapperTests.java b/src/test/java/org/openecomp/dcae/inventory/exception/mappers/DBIExceptionMapperTests.java
new file mode 100644
index 0000000..6e72182
--- /dev/null
+++ b/src/test/java/org/openecomp/dcae/inventory/exception/mappers/DBIExceptionMapperTests.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * dcae-inventory
+ * ================================================================================
+ * 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.dcae.inventory.exception.mappers;
+
+import org.openecomp.dcae.inventory.daos.InventoryDAOManager;
+import org.openecomp.dcae.inventory.exceptions.mappers.DBIExceptionMapper;
+import io.swagger.api.ApiResponseMessage;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.skife.jdbi.v2.exceptions.UnableToCreateStatementException;
+import org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException;
+import org.skife.jdbi.v2.exceptions.UnableToObtainConnectionException;
+
+import javax.ws.rs.core.Response;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Created by mhwang on 3/8/17.
+ */
+@PrepareForTest({InventoryDAOManager.class})
+@RunWith(PowerMockRunner.class)
+public class DBIExceptionMapperTests {
+
+ @Test
+ public void testReinitializeSuccess() {
+ // PowerMockito does bytecode magic to mock static methods and use final classes
+ PowerMockito.mockStatic(InventoryDAOManager.class);
+ InventoryDAOManager mockDAOManager = mock(InventoryDAOManager.class);
+ when(InventoryDAOManager.getInstance()).thenReturn(mockDAOManager);
+
+ RuntimeException fakeException = new RuntimeException("Spoofing database failure");
+
+ // Test UnableToObtainConnectionExceptionMapper
+
+ DBIExceptionMapper.UnableToObtainConnectionExceptionMapper mapperOne = new DBIExceptionMapper.UnableToObtainConnectionExceptionMapper();
+ Response responseOne = mapperOne.toResponse(new UnableToObtainConnectionException(fakeException));
+ assert responseOne.getStatus() == 502;
+ String messageOne = ((ApiResponseMessage) responseOne.getEntity()).getMessage();
+ assert messageOne.contains("successfully reset");
+
+ // Test UnableToCreateStatementExceptionMapper
+
+ DBIExceptionMapper.UnableToCreateStatementExceptionMapper mapperTwo = new DBIExceptionMapper.UnableToCreateStatementExceptionMapper();
+ Response responseTwo = mapperTwo.toResponse(new UnableToCreateStatementException(fakeException));
+ assert responseTwo.getStatus() == 502;
+ String messageTwo = ((ApiResponseMessage) responseTwo.getEntity()).getMessage();
+ assert messageTwo.contains("successfully reset");
+
+ // Test UnableToExecuteStatementExceptionMapper
+
+ DBIExceptionMapper.UnableToExecuteStatementExceptionMapper mapperThree = new DBIExceptionMapper.UnableToExecuteStatementExceptionMapper();
+ Response responseThree = mapperThree.toResponse(new UnableToExecuteStatementException(fakeException));
+ assert responseThree.getStatus() == 502;
+ String messageThree = ((ApiResponseMessage) responseThree.getEntity()).getMessage();
+ assert messageThree.contains("successfully reset");
+ }
+
+ @Test
+ public void testReinitializeFailed() {
+ // PowerMockito does bytecode magic to mock static methods and use final classes
+ PowerMockito.mockStatic(InventoryDAOManager.class);
+ InventoryDAOManager mockDAOManager = mock(InventoryDAOManager.class);
+ when(InventoryDAOManager.getInstance()).thenReturn(mockDAOManager);
+ Mockito.doThrow(new RuntimeException("Spoof initialization failure")).when(mockDAOManager).initialize();
+
+ RuntimeException fakeException = new RuntimeException("Spoofing database failure");
+
+ // Test UnableToObtainConnectionExceptionMapper
+
+ DBIExceptionMapper.UnableToObtainConnectionExceptionMapper mapperOne = new DBIExceptionMapper.UnableToObtainConnectionExceptionMapper();
+ Response responseOne = mapperOne.toResponse(new UnableToObtainConnectionException(fakeException));
+ assert responseOne.getStatus() == 502;
+ String messageOne = ((ApiResponseMessage) responseOne.getEntity()).getMessage();
+ assert !messageOne.contains("successfully reset");
+
+ // Test UnableToCreateStatementExceptionMapper
+
+ DBIExceptionMapper.UnableToCreateStatementExceptionMapper mapperTwo = new DBIExceptionMapper.UnableToCreateStatementExceptionMapper();
+ Response responseTwo = mapperTwo.toResponse(new UnableToCreateStatementException(fakeException));
+ assert responseTwo.getStatus() == 502;
+ String messageTwo = ((ApiResponseMessage) responseTwo.getEntity()).getMessage();
+ assert !messageTwo.contains("successfully reset");
+
+ // Test UnableToExecuteStatementExceptionMapper
+
+ DBIExceptionMapper.UnableToExecuteStatementExceptionMapper mapperThree = new DBIExceptionMapper.UnableToExecuteStatementExceptionMapper();
+ Response responseThree = mapperThree.toResponse(new UnableToExecuteStatementException(fakeException));
+ assert responseThree.getStatus() == 502;
+ String messageThree = ((ApiResponseMessage) responseThree.getEntity()).getMessage();
+ assert !messageThree.contains("successfully reset");
+ }
+
+}
diff --git a/swagger_inventory.yaml b/swagger_inventory.yaml
new file mode 100644
index 0000000..11dbcbc
--- /dev/null
+++ b/swagger_inventory.yaml
@@ -0,0 +1,680 @@
+swagger: '2.0'
+info:
+ version: "2.1.0"
+ title: DCAE Inventory API
+ description: |
+ DCAE Inventory is a web service that provides the following:
+
+ 1. Real-time data on all DCAE services and their components
+ 2. Comprehensive details on available DCAE service types
+ contact:
+ email: dcae@lists.openecomp.org
+externalDocs:
+ description: DCAE Inventory
+ url: https://gerrit.onap.org/r/#/admin/projects/dcae/dcae-inventory
+paths:
+ /dcae-service-types:
+ get:
+ summary: ""
+ description: "Get a list of `DCAEServiceType` objects."
+ operationId: "dcaeServiceTypesGet"
+ consumes:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ produces:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ parameters:
+ - name: "typeName"
+ in: "query"
+ description: "Filter by service type name"
+ required: false
+ type: "string"
+ - name: "onlyLatest"
+ in: "query"
+ description: "If set to true, query returns just the latest versions of DCAE\
+ \ service types. If set to false, then all versions are returned. Default\
+ \ is true"
+ required: false
+ type: "boolean"
+ default: true
+ - name: "onlyActive"
+ in: "query"
+ description: "If set to true, query returns only *active* DCAE service types.\
+ \ If set to false, then all DCAE service types are returned. Default is\
+ \ true"
+ required: false
+ type: "boolean"
+ default: true
+ - name: "vnfType"
+ in: "query"
+ description: "Filter by associated vnf type. No wildcards, matches are explicit.\
+ \ This field is treated case insensitive."
+ required: false
+ type: "string"
+ - name: "serviceId"
+ in: "query"
+ description: "Filter by assocaited service id. Instances with service id null\
+ \ or empty is always returned."
+ required: false
+ type: "string"
+ - name: "serviceLocation"
+ in: "query"
+ description: "Filter by associated service location. Instances with service\
+ \ location null or empty is always returned."
+ required: false
+ type: "string"
+ - name: "asdcServiceId"
+ in: "query"
+ description: "Filter by associated asdc design service id. Setting this to\
+ \ `NONE` will return instances that have asdc service id set to null"
+ required: false
+ type: "string"
+ - name: "asdcResourceId"
+ in: "query"
+ description: "Filter by associated asdc design resource id. Setting this to\
+ \ `NONE` will return instances that have asdc resource id set to null"
+ required: false
+ type: "string"
+ - name: "offset"
+ in: "query"
+ description: "Query resultset offset used for pagination (zero-based)"
+ required: false
+ type: "integer"
+ format: "int32"
+ responses:
+ 200:
+ description: "List of `DCAEServiceType` objects"
+ schema:
+ $ref: "#/definitions/InlineResponse200"
+ post:
+ summary: ""
+ description: "Inserts a new `DCAEServiceType` or updates an existing instance.\
+ \ Updates are only allowed iff there are no running DCAE services of the requested\
+ \ type,"
+ operationId: "dcaeServiceTypesTypeNamePut"
+ consumes:
+ - "application/json"
+ produces:
+ - "application/json"
+ parameters:
+ - in: "body"
+ name: "body"
+ required: true
+ schema:
+ $ref: "#/definitions/DCAEServiceTypeRequest"
+ responses:
+ 200:
+ description: "Single `DCAEServiceType` object."
+ schema:
+ $ref: "#/definitions/DCAEServiceType"
+ 400:
+ description: "Bad request provided."
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ 409:
+ description: "Failed to update because there are still DCAE services of\
+ \ the requested type running."
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ /dcae-service-types/{typeId}:
+ get:
+ summary: ""
+ description: "Get a `DCAEServiceType` object."
+ operationId: "dcaeServiceTypesTypeIdGet"
+ consumes:
+ - "application/json"
+ produces:
+ - "application/json"
+ parameters:
+ - name: "typeId"
+ in: "path"
+ required: true
+ type: "string"
+ responses:
+ 200:
+ description: "Single `DCAEServiceType` object"
+ schema:
+ $ref: "#/definitions/DCAEServiceType"
+ 404:
+ description: "Resource not found"
+ schema:
+ $ref: "#/definitions/DCAEServiceType"
+ delete:
+ summary: ""
+ description: "Deactivates existing `DCAEServiceType` instances"
+ operationId: "dcaeServiceTypesTypeIdDelete"
+ consumes:
+ - "application/vnd.dcae.inventory.v1+json"
+ - "application/json"
+ produces:
+ - "application/vnd.dcae.inventory.v1+json"
+ - "application/json"
+ parameters:
+ - name: "typeId"
+ in: "path"
+ required: true
+ type: "string"
+ responses:
+ 200:
+ description: "`DCAEServiceType` has been deactivated"
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ 410:
+ description: "`DCAEServiceType` already gone"
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ 404:
+ description: "`DCAEServiceType` not found"
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ /dcae-services:
+ get:
+ summary: ""
+ description: "Get a list of `DCAEService` objects."
+ operationId: "dcaeServicesGet"
+ consumes:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ produces:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ parameters:
+ - name: "typeId"
+ in: "query"
+ description: "DCAE service type name"
+ required: false
+ type: "string"
+ - name: "vnfId"
+ in: "query"
+ required: false
+ type: "string"
+ - name: "vnfType"
+ in: "query"
+ description: "Filter by associated vnf type. This field is treated case insensitive."
+ required: false
+ type: "string"
+ - name: "vnfLocation"
+ in: "query"
+ required: false
+ type: "string"
+ - name: "componentType"
+ in: "query"
+ description: "Use to filter by a specific DCAE service component type"
+ required: false
+ type: "string"
+ - name: "shareable"
+ in: "query"
+ description: "Use to filter by DCAE services that have shareable components\
+ \ or not"
+ required: false
+ type: "boolean"
+ - name: "created"
+ in: "query"
+ description: "Use to filter by created time"
+ required: false
+ type: "string"
+ - name: "offset"
+ in: "query"
+ description: "Query resultset offset used for pagination (zero-based)"
+ required: false
+ type: "integer"
+ format: "int32"
+ responses:
+ 200:
+ description: "List of `DCAEService` objects"
+ schema:
+ $ref: "#/definitions/InlineResponse2001"
+ 502:
+ description: "Bad response from DCAE controller"
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ 504:
+ description: "Failed to connect with DCAE controller"
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ /dcae-services-groupby/{propertyName}:
+ get:
+ summary: ""
+ description: "Get a list of unique values for the given `propertyName`"
+ operationId: "dcaeServicesGroupbyPropertyNameGet"
+ consumes:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ produces:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ parameters:
+ - name: "propertyName"
+ in: "path"
+ description: "Property to find unique values. Restricted to `type`, `vnfType`,\
+ \ `vnfLocation`"
+ required: true
+ type: "string"
+ responses:
+ 200:
+ description: "List of unique property values"
+ schema:
+ $ref: "#/definitions/DCAEServiceGroupByResults"
+ /dcae-services/{serviceId}:
+ get:
+ summary: ""
+ description: "Get a `DCAEService` object."
+ operationId: "dcaeServicesServiceIdGet"
+ consumes:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ produces:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ parameters:
+ - name: "serviceId"
+ in: "path"
+ required: true
+ type: "string"
+ responses:
+ 200:
+ description: "Single `DCAEService` object"
+ schema:
+ $ref: "#/definitions/DCAEService"
+ 502:
+ description: "Bad response from DCAE controller"
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ 404:
+ description: "DCAE service not found"
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ 504:
+ description: "Failed to connect with DCAE controller"
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ put:
+ summary: ""
+ description: "Put a new or update an existing `DCAEService` object."
+ operationId: "dcaeServicesServiceIdPut"
+ consumes:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ produces:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ parameters:
+ - name: "serviceId"
+ in: "path"
+ required: true
+ type: "string"
+ - in: "body"
+ name: "body"
+ required: true
+ schema:
+ $ref: "#/definitions/DCAEServiceRequest"
+ responses:
+ 200:
+ description: "Single `DCAEService` object"
+ schema:
+ $ref: "#/definitions/DCAEService"
+ 422:
+ description: "Bad request provided"
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+ delete:
+ summary: ""
+ description: "Remove an existing `DCAEService` object."
+ operationId: "dcaeServicesServiceIdDelete"
+ consumes:
+ - "application/vnd.dcae.inventory.v1+json"
+ - "application/json"
+ produces:
+ - "application/json"
+ - "application/vnd.dcae.inventory.v1+json"
+ parameters:
+ - name: "serviceId"
+ in: "path"
+ required: true
+ type: "string"
+ responses:
+ 200:
+ description: "DCAE service has been removed"
+ 404:
+ description: "Unknown DCAE service"
+ schema:
+ $ref: "#/definitions/ApiResponseMessage"
+definitions:
+ DCAEServiceTypeRequest:
+ type: "object"
+ required:
+ - "blueprintTemplate"
+ - "owner"
+ - "typeName"
+ - "typeVersion"
+ properties:
+ owner:
+ type: "string"
+ typeName:
+ type: "string"
+ description: "Descriptive name for this DCAE service type"
+ typeVersion:
+ type: "integer"
+ format: "int32"
+ description: "Version number for this DCAE service type"
+ blueprintTemplate:
+ type: "string"
+ description: "String representation of a Cloudify blueprint with unbound variables"
+ serviceIds:
+ type: "array"
+ description: "List of service ids that are used to associate with DCAE service\
+ \ type. DCAE service types with this propery as null or empty means them\
+ \ apply for every service id."
+ items:
+ type: "string"
+ vnfTypes:
+ type: "array"
+ items:
+ type: "string"
+ serviceLocations:
+ type: "array"
+ description: "List of service locations that are used to associate with DCAE\
+ \ service type. DCAE service types with this propery as null or empty means\
+ \ them apply for every service location."
+ items:
+ type: "string"
+ asdcServiceId:
+ type: "string"
+ description: "Id of service this DCAE service type is associated with. Value\
+ \ source is from ASDC's notification event's field `serviceInvariantUUID`."
+ asdcResourceId:
+ type: "string"
+ description: "Id of vf/vnf instance this DCAE service type is associated with.\
+ \ Value source is from ASDC's notification event's field `resourceInvariantUUID`."
+ asdcServiceURL:
+ type: "string"
+ description: "URL to the ASDC service model"
+ DCAEServiceComponentRequest:
+ type: "object"
+ required:
+ - "componentId"
+ - "componentSource"
+ - "componentType"
+ - "shareable"
+ properties:
+ componentId:
+ type: "string"
+ description: "The id format is unique to the source"
+ componentType:
+ type: "string"
+ componentSource:
+ type: "string"
+ description: "Specifies the name of the underying source service that is responsible\
+ \ for this components"
+ enum:
+ - "DCAEController"
+ - "DMaaPController"
+ shareable:
+ type: "integer"
+ format: "int32"
+ description: "Used to determine if this component can be shared amongst different\
+ \ DCAE services"
+ DCAEServiceGroupByResultsPropertyValues:
+ type: "object"
+ properties:
+ count:
+ type: "integer"
+ format: "int32"
+ propertyValue:
+ type: "string"
+ dcaeServiceQueryLink:
+ description: "Link.title is the DCAE service property value. Following this\
+ \ link will provide a list of DCAE services that all have this property\
+ \ value."
+ $ref: "#/definitions/Link"
+ DCAEServiceGroupByResults:
+ type: "object"
+ properties:
+ propertyName:
+ type: "string"
+ description: "Property name of DCAE service that the group by operation was\
+ \ performed on"
+ propertyValues:
+ type: "array"
+ items:
+ $ref: "#/definitions/DCAEServiceGroupByResultsPropertyValues"
+ InlineResponse200:
+ type: "object"
+ properties:
+ links:
+ $ref: "#/definitions/InlineResponse200Links"
+ totalCount:
+ type: "integer"
+ format: "int32"
+ items:
+ type: "array"
+ items:
+ $ref: "#/definitions/DCAEServiceType"
+ DCAEServiceRequest:
+ type: "object"
+ required:
+ - "components"
+ - "typeId"
+ - "vnfId"
+ - "vnfLocation"
+ - "vnfType"
+ properties:
+ typeId:
+ type: "string"
+ description: "Id of the associated DCAE service type"
+ vnfId:
+ type: "string"
+ description: "Id of the associated VNF that this service is monitoring"
+ vnfType:
+ type: "string"
+ description: "The type of the associated VNF that this service is monitoring"
+ vnfLocation:
+ type: "string"
+ description: "Location identifier of the associated VNF that this service\
+ \ is monitoring"
+ deploymentRef:
+ type: "string"
+ description: "Reference to a Cloudify deployment"
+ components:
+ type: "array"
+ description: "List of DCAE service components that this service is composed\
+ \ of"
+ items:
+ $ref: "#/definitions/DCAEServiceComponentRequest"
+ InlineResponse200Links:
+ type: "object"
+ properties:
+ previousLink:
+ $ref: "#/definitions/Link"
+ nextLink:
+ $ref: "#/definitions/Link"
+ description: "Pagination links"
+ ApiResponseMessage:
+ type: "object"
+ properties:
+ code:
+ type: "integer"
+ format: "int32"
+ type:
+ type: "string"
+ message:
+ type: "string"
+ DCAEService:
+ type: "object"
+ properties:
+ serviceId:
+ type: "string"
+ selfLink:
+ description: "Link.title is serviceId"
+ $ref: "#/definitions/Link"
+ created:
+ type: "string"
+ format: "date-time"
+ modified:
+ type: "string"
+ format: "date-time"
+ typeLink:
+ description: "Link.title is typeId"
+ $ref: "#/definitions/Link"
+ vnfId:
+ type: "string"
+ vnfLink:
+ description: "Link.title is vnfId"
+ $ref: "#/definitions/Link"
+ vnfType:
+ type: "string"
+ vnfLocation:
+ type: "string"
+ description: "Location information of the associated VNF"
+ deploymentRef:
+ type: "string"
+ description: "Reference to a Cloudify deployment"
+ components:
+ type: "array"
+ items:
+ $ref: "#/definitions/DCAEServiceComponent"
+ InlineResponse2001:
+ type: "object"
+ properties:
+ links:
+ $ref: "#/definitions/InlineResponse200Links"
+ totalCount:
+ type: "integer"
+ format: "int32"
+ items:
+ type: "array"
+ items:
+ $ref: "#/definitions/DCAEService"
+ UriBuilder:
+ type: "object"
+ Link:
+ type: "object"
+ properties:
+ title:
+ type: "string"
+ rel:
+ type: "string"
+ uri:
+ type: "string"
+ format: "uri"
+ uriBuilder:
+ $ref: "#/definitions/UriBuilder"
+ rels:
+ type: "array"
+ items:
+ type: "string"
+ params:
+ type: "object"
+ additionalProperties:
+ type: "string"
+ type:
+ type: "string"
+ DCAEServiceComponent:
+ type: "object"
+ required:
+ - "componentId"
+ - "componentLink"
+ - "componentSource"
+ - "componentType"
+ - "created"
+ - "modified"
+ - "shareable"
+ properties:
+ componentId:
+ type: "string"
+ description: "The id format is unique to the source"
+ componentLink:
+ description: "Link to the underlying resource of this component"
+ $ref: "#/definitions/Link"
+ created:
+ type: "string"
+ format: "date-time"
+ modified:
+ type: "string"
+ format: "date-time"
+ componentType:
+ type: "string"
+ componentSource:
+ type: "string"
+ description: "Specifies the name of the underying source service that is responsible\
+ \ for this components"
+ enum:
+ - "DCAEController"
+ - "DMaaPController"
+ status:
+ type: "string"
+ location:
+ type: "string"
+ description: "Location information of the component"
+ shareable:
+ type: "integer"
+ format: "int32"
+ description: "Used to determine if this component can be shared amongst different\
+ \ DCAE services"
+ DCAEServiceType:
+ type: "object"
+ required:
+ - "blueprintTemplate"
+ - "created"
+ - "owner"
+ - "selfLink"
+ - "typeId"
+ - "typeName"
+ - "typeVersion"
+ properties:
+ owner:
+ type: "string"
+ typeName:
+ type: "string"
+ description: "Descriptive name for this DCAE service type"
+ typeVersion:
+ type: "integer"
+ format: "int32"
+ description: "Version number for this DCAE service type"
+ blueprintTemplate:
+ type: "string"
+ description: "String representation of a Cloudify blueprint with unbound variables"
+ serviceIds:
+ type: "array"
+ description: "List of service ids that are used to associate with DCAE service\
+ \ type. DCAE service types with this propery as null or empty means them\
+ \ apply for every service id."
+ items:
+ type: "string"
+ vnfTypes:
+ type: "array"
+ items:
+ type: "string"
+ serviceLocations:
+ type: "array"
+ description: "List of service locations that are used to associate with DCAE\
+ \ service type. DCAE service types with this propery as null or empty means\
+ \ them apply for every service location."
+ items:
+ type: "string"
+ asdcServiceId:
+ type: "string"
+ description: "Id of service this DCAE service type is associated with. Value\
+ \ source is from ASDC's notification event's field `serviceInvariantUUID`."
+ asdcResourceId:
+ type: "string"
+ description: "Id of vf/vnf instance this DCAE service type is associated with.\
+ \ Value source is from ASDC's notification event's field `resourceInvariantUUID`."
+ asdcServiceURL:
+ type: "string"
+ description: "URL to the ASDC service model"
+ typeId:
+ type: "string"
+ description: "Unique identifier for this DCAE service type"
+ selfLink:
+ description: "Link to self where the Link.title is typeName"
+ $ref: "#/definitions/Link"
+ created:
+ type: "string"
+ format: "date-time"
+ description: "Created timestamp for this DCAE service type in epoch time"
+ deactivated:
+ type: "string"
+ format: "date-time"
+ description: "Deactivated timestamp for this DCAE service type in epoch time"