Added datatypes for 3rd Party Partners 23/99123/2
authorAtif Husain <atif.husain@team.telstra.com>
Wed, 4 Dec 2019 05:40:38 +0000 (16:40 +1100)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Wed, 11 Dec 2019 12:14:00 +0000 (12:14 +0000)
Issue-ID: SDC-2385
Change-Id: Iedc5d5b9b30e7cccd3654a1b6e84514643b6d62f
Signed-off-by: Atif Husain <atif.husain@team.telstra.com>
catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml
catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java
catalog-be/src/test/resources/types/datatypes/constraintTest.json

index f1dab7d..3e90362 100644 (file)
@@ -2549,3 +2549,152 @@ onap.datatypes.monitoring.rcc_event_details:
       description: The user specific data
       required: false
 
+##### Partner service domain datatypes ######
+
+onap.datatypes.partner.access_details:
+  derived_from: tosca.datatypes.Root
+  properties:
+    addressId:
+      type: string
+      description: id of the site
+      required: true
+    dsl_stability_profile:
+      type: string
+      description: profile of stability
+      required: false
+      default: standard
+      constraints:
+        - valid_values:
+            - standard
+            - stable
+    partner_priorty_assist:
+      type: boolean
+      description: assistance flag
+      required: false
+      default: true
+    battery_backup:
+      type: boolean
+      description: backup requirement flag
+      required: false
+      default: true
+    central_splitter:
+      type: boolean
+      description: applicable to FTTN service
+      required: false
+      default: true
+    service_restoration_sla:
+      type: string
+      description: This is the service restoration SLA from an partner perspective.
+      required: false
+      default: Standard
+      constraints:
+        - valid_values:
+            - Standard
+            - Enhanced
+
+onap.datatypes.partner.bandwidth:
+  derived_from: tosca.datatypes.Root
+  properties:
+    bandwidth_type:
+      type: string
+      description: type of bandwidth
+      required: true
+      default: standard
+      constraints:
+        - valid_values:
+            - standard
+            - guaranteed
+    downstream:
+      type: string
+      description: down speed
+      required: true
+      constraints:
+        - valid_values:
+            - 128
+            - 512
+            - 1
+            - 2
+            - 5
+            - 10
+            - 20
+            - 25
+            - 30
+            - 40
+            - 50
+            - 100
+            - 250
+            - 500
+            - 1000
+    upstream:
+      type: string
+      description: up speed
+      required: false
+      constraints:
+        - valid_values:
+            - 128
+            - 512
+            - 1
+            - 2
+            - 5
+            - 10
+            - 20
+            - 25
+            - 30
+            - 40
+            - 50
+            - 100
+            - 250
+            - 500
+            - 1000
+    units:
+      type: string
+      description: unit of speed
+      required: true
+      constraints:
+        - valid_values:
+            - k
+            - M
+    service_alias:
+      type: string
+      description: 16 digit id
+      required: false
+
+onap.datatypes.partner.service_details:
+  derived_from: tosca.datatypes.Root
+  properties:
+    bandwidth:
+      type: onap.datatypes.partner.bandwidth
+      description: bandwidth details for access
+      required: false
+    line_of_business:
+      type: string
+      description: LOB
+      required: false
+      constraints:
+        - valid_values:
+            - CONSUMER
+            - WHOLESALE
+            - BUSINESS
+    access_details:
+      type: onap.datatypes.partner.access_details
+      required: false
+
+onap.datatypes.partner.sppartner_details:
+  derived_from: tosca.datatypes.Root
+  properties:
+    partner_url:
+      type: string
+      description: Partner URL to access and provision the service
+      required: false
+    uuid:
+      type: string
+      description: UUID of the service definition defined in the partner catalog
+      required: false
+    auth_user:
+      type: string
+      description: Authentication  details to access the Service URL
+      required: false
+    auth_password:
+      type: string
+      description: Authentication  details to access the Service URL
+      required: false
index eb48a5f..2308c25 100644 (file)
@@ -286,6 +286,142 @@ public class PropertyValueConstraintValidationUtilTest {
                Assert.assertTrue(responseEither.isRight());
        }
 
+       @Test
+       public void bandwidthTypeValueSuccessTest(){
+               Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
+               Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+
+               PropertyDefinition propertyDefinition = new PropertyDefinition();
+               propertyDefinition.setType("onap.datatypes.partner.bandwidth");
+               propertyDefinition.setValue("{\"bandwidth_type\":\"guaranteed\"}");
+               propertyDefinition.setName("bandwidth_type");
+
+               Either<Boolean, ResponseFormat> responseEither =
+                               propertyValueConstraintValidationUtil.validatePropertyConstraints(
+                                               Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+
+               Assert.assertTrue(responseEither.isLeft());
+       }
+
+       @Test
+       public void bandwidthTypeValueFailTest(){
+               Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
+               Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+
+               PropertyDefinition propertyDefinition = new PropertyDefinition();
+               propertyDefinition.setType("onap.datatypes.partner.bandwidth");
+               propertyDefinition.setValue("{\"bandwidth_type\":\"incorrectValue\"}");
+               propertyDefinition.setName("bandwidth_type");
+
+               Either<Boolean, ResponseFormat> responseEither =
+                               propertyValueConstraintValidationUtil.validatePropertyConstraints(
+                                               Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+
+               Assert.assertTrue(responseEither.isRight());
+       }
+
+       @Test
+       public void bandwidthDownstreamValueSuccessTest(){
+               Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
+               Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+
+               PropertyDefinition propertyDefinition = new PropertyDefinition();
+               propertyDefinition.setType("onap.datatypes.partner.bandwidth");
+               propertyDefinition.setValue("{\"downstream\":\"128\"}");
+               propertyDefinition.setName("downstream");
+
+               Either<Boolean, ResponseFormat> responseEither =
+                               propertyValueConstraintValidationUtil.validatePropertyConstraints(
+                                               Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+
+               Assert.assertTrue(responseEither.isLeft());
+       }
+
+       @Test
+       public void bandwidthDownstreamValueFailTest(){
+               Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
+               Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+
+               PropertyDefinition propertyDefinition = new PropertyDefinition();
+               propertyDefinition.setType("onap.datatypes.partner.bandwidth");
+               propertyDefinition.setValue("{\"downstream\":\"incorrectValue\"}");
+               propertyDefinition.setName("downstream");
+
+               Either<Boolean, ResponseFormat> responseEither =
+                               propertyValueConstraintValidationUtil.validatePropertyConstraints(
+                                               Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+
+               Assert.assertTrue(responseEither.isRight());
+       }
+
+       @Test
+       public void bandwidthUpstreamValueSuccessTest(){
+               Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
+               Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+
+               PropertyDefinition propertyDefinition = new PropertyDefinition();
+               propertyDefinition.setType("onap.datatypes.partner.bandwidth");
+               propertyDefinition.setValue("{\"upstream\":\"128\"}");
+               propertyDefinition.setName("upstream");
+
+               Either<Boolean, ResponseFormat> responseEither =
+                               propertyValueConstraintValidationUtil.validatePropertyConstraints(
+                                               Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+
+               Assert.assertTrue(responseEither.isLeft());
+       }
+
+       @Test
+       public void bandwidthUpstreamValueFailTest(){
+               Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
+               Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+
+               PropertyDefinition propertyDefinition = new PropertyDefinition();
+               propertyDefinition.setType("onap.datatypes.partner.bandwidth");
+               propertyDefinition.setValue("{\"upstream\":\"incorrectValue\"}");
+               propertyDefinition.setName("upstream");
+
+               Either<Boolean, ResponseFormat> responseEither =
+                               propertyValueConstraintValidationUtil.validatePropertyConstraints(
+                                               Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+
+               Assert.assertTrue(responseEither.isRight());
+       }
+
+       @Test
+       public void bandwidthUnitsValueSuccessTest(){
+               Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
+               Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+
+               PropertyDefinition propertyDefinition = new PropertyDefinition();
+               propertyDefinition.setType("onap.datatypes.partner.bandwidth");
+               propertyDefinition.setValue("{\"units\":\"M\"}");
+               propertyDefinition.setName("units");
+
+               Either<Boolean, ResponseFormat> responseEither =
+                               propertyValueConstraintValidationUtil.validatePropertyConstraints(
+                                               Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+
+               Assert.assertTrue(responseEither.isLeft());
+       }
+
+       @Test
+       public void bandwidthUnitsValueFailTest(){
+               Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
+               Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+
+               PropertyDefinition propertyDefinition = new PropertyDefinition();
+               propertyDefinition.setType("onap.datatypes.partner.bandwidth");
+               propertyDefinition.setValue("{\"units\":\"incorrectValue\"}");
+               propertyDefinition.setName("units");
+
+               Either<Boolean, ResponseFormat> responseEither =
+                               propertyValueConstraintValidationUtil.validatePropertyConstraints(
+                                               Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+
+               Assert.assertTrue(responseEither.isRight());
+       }
+
        private void createDataTypeMap() {
                Type constraintType = new TypeToken<PropertyConstraint>() {}.getType();
                Type typeOfHashMap = new TypeToken<Map<String, DataTypeDefinition>>() { }.getType();
@@ -335,3 +471,4 @@ public class PropertyValueConstraintValidationUtilTest {
        }
 
 }
+
index 9596e92..9a52294 100644 (file)
     "creationTime": 1550136564094,
     "modificationTime": 1550136564094,
     "toscaPresentation": {}
+  },
+  "onap.datatypes.partner.access_details": {
+    "derivedFrom": {
+      "name": "tosca.datatypes.Root",
+      "uniqueId": "tosca.datatypes.Root.datatype",
+      "description": "The TOSCA root Data Type all other TOSCA base Data Types derive from",
+      "creationTime": 1550136563278,
+      "modificationTime": 1550136563278,
+      "toscaPresentation": {}
+    },
+    "properties": [
+      {
+        "uniqueId": "onap.datatypes.partner.access_details.addressId",
+        "type": "string",
+        "description": "id of the site",
+        "required": true,
+        "definition": false,
+        "password": false,
+        "name": "addressId",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "constraints": [
+          {
+            "validValues": [
+              "standard",
+              "stable"
+            ]
+          }
+        ],
+        "uniqueId": "onap.datatypes.partner.access_details.dsl_stability_profile",
+        "type": "string",
+        "description": "profile of stability",
+        "required": false,
+        "definition": false,
+        "defaultValue": "standard",
+        "password": false,
+        "name": "dsl_stability_profile",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "uniqueId": "onap.datatypes.partner.access_details.partner_priorty_assist",
+        "type": "boolean",
+        "description": "assistance flag",
+        "required": false,
+        "definition": true,
+        "defaultValue": true,
+        "password": false,
+        "name": "partner_priorty_assist",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "uniqueId": "onap.datatypes.partner.access_details.battery_backup",
+        "type": "boolean",
+        "description": "backup requirement flag",
+        "required": false,
+        "definition": true,
+        "defaultValue": true,
+        "password": false,
+        "name": "battery_backup",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "uniqueId": "onap.datatypes.partner.access_details.central_splitter",
+        "type": "boolean",
+        "description": "applicable to FTTN service",
+        "required": false,
+        "definition": true,
+        "defaultValue": true,
+        "password": false,
+        "name": "central_splitter",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "constraints": [
+          {
+            "validValues": [
+              "Standard",
+              "Enhanced"
+            ]
+          }
+        ],
+        "uniqueId": "onap.datatypes.partner.access_details.service_restoration_sla",
+        "type": "string",
+        "description": "This is the service restoration SLA from an partner perspective.",
+        "required": false,
+        "definition": false,
+        "defaultValue": "Standard",
+        "password": false,
+        "name": "service_restoration_sla",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      }
+    ]
+  },
+  "onap.datatypes.partner.bandwidth": {
+    "derivedFrom": {
+      "name": "tosca.datatypes.Root",
+      "uniqueId": "tosca.datatypes.Root.datatype",
+      "description": "The TOSCA root Data Type all other TOSCA base Data Types derive from",
+      "creationTime": 1550136563278,
+      "modificationTime": 1550136563278,
+      "toscaPresentation": {}
+    },
+    "properties": [
+      {
+        "constraints": [
+          {
+            "validValues": [
+              "standard",
+              "guaranteed"
+            ]
+          }
+        ],
+        "uniqueId": "onap.datatypes.partner.bandwidth.bandwidth_type",
+        "type": "string",
+        "description": "type of bandwidth",
+        "required": true,
+        "definition": false,
+        "defaultValue": "standard",
+        "password": false,
+        "name": "bandwidth_type",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "constraints": [
+          {
+            "validValues": [
+              "128",
+              "512",
+              "1",
+              "2",
+              "5",
+              "10",
+              "20",
+              "25",
+              "30",
+              "40",
+              "50",
+              "100",
+              "250",
+              "500",
+              "1000"
+            ]
+          }
+        ],
+        "uniqueId": "onap.datatypes.partner.bandwidth.downstream",
+        "type": "string",
+        "description": "down speed",
+        "required": true,
+        "definition": true,
+        "password": false,
+        "name": "downstream",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "constraints": [
+          {
+            "validValues": [
+              "128",
+              "512",
+              "1",
+              "2",
+              "5",
+              "10",
+              "20",
+              "25",
+              "30",
+              "40",
+              "50",
+              "100",
+              "250",
+              "500",
+              "1000"
+            ]
+          }
+        ],
+        "uniqueId": "onap.datatypes.partner.bandwidth.upstream",
+        "type": "string",
+        "description": "up speed",
+        "required": true,
+        "definition": true,
+        "password": false,
+        "name": "upstream",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "constraints": [
+          {
+            "validValues": [
+              "k",
+              "M"
+            ]
+          }
+        ],
+        "uniqueId": "onap.datatypes.partner.bandwidth.units",
+        "type": "string",
+        "description": "unit of speed",
+        "required": true,
+        "definition": true,
+        "password": false,
+        "name": "units",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "uniqueId": "onap.datatypes.partner.bandwidth.service_alias",
+        "type": "string",
+        "description": "16 digit id",
+        "required": false,
+        "definition": false,
+        "password": false,
+        "name": "service_alias",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      }
+    ]
+  },
+  "onap.datatypes.partner.service_details": {
+    "derivedFrom": {
+      "name": "tosca.datatypes.Root",
+      "uniqueId": "tosca.datatypes.Root.datatype",
+      "description": "The TOSCA root Data Type all other TOSCA base Data Types derive from",
+      "creationTime": 1550136563278,
+      "modificationTime": 1550136563278,
+      "toscaPresentation": {}
+    },
+    "properties": [
+      {
+        "uniqueId": "onap.datatypes.partner.service_details.bandwidth",
+        "type": "onap.datatypes.partner.bandwidth",
+        "description": "bandwidth details for access",
+        "required": false,
+        "definition": false,
+        "password": false,
+        "name": "bandwidth",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "constraints": [
+          {
+            "validValues": [
+              "CONSUMER",
+              "WHOLESALE",
+              "BUSINESS"
+            ]
+          }
+        ],
+        "uniqueId": "onap.datatypes.partner.service_details.line_of_business",
+        "type": "string",
+        "description": "LOB",
+        "required": false,
+        "definition": false,
+        "password": false,
+        "name": "line_of_business",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "uniqueId": "onap.datatypes.partner.service_details.access_details",
+        "type": "onap.datatypes.partner.access_details",
+        "required": false,
+        "definition": false,
+        "password": false,
+        "name": "access_details",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      }
+    ]
+  },
+  "onap.datatypes.partner.sppartner_details": {
+    "derivedFrom": {
+      "name": "tosca.datatypes.Root",
+      "uniqueId": "tosca.datatypes.Root.datatype",
+      "description": "The TOSCA root Data Type all other TOSCA base Data Types derive from",
+      "creationTime": 1550136563278,
+      "modificationTime": 1550136563278,
+      "toscaPresentation": {}
+    },
+    "properties": [
+      {
+        "uniqueId": "onap.datatypes.partner.sppartner_details.partner_url",
+        "type": "string",
+        "description": "Partner URL to access and provision the service",
+        "required": false,
+        "definition": false,
+        "password": false,
+        "name": "partner_url",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "uniqueId": "onap.datatypes.partner.sppartner_details.uuid",
+        "type": "string",
+        "description": "UUID of the service definition defined in the partner catalog",
+        "required": false,
+        "definition": false,
+        "password": false,
+        "name": "uuid",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "uniqueId": "onap.datatypes.partner.sppartner_details.auth_user",
+        "type": "string",
+        "description": "Authentication  details to access the Service URL",
+        "required": false,
+        "definition": false,
+        "password": false,
+        "name": "auth_user",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      },
+      {
+        "uniqueId": "onap.datatypes.partner.sppartner_details.auth_password",
+        "type": "string",
+        "description": "Authentication  details to access the Service URL",
+        "required": false,
+        "definition": false,
+        "password": false,
+        "name": "auth_password",
+        "hidden": false,
+        "immutable": false,
+        "toscaPresentation": {}
+      }
+    ]
   }
-}
\ No newline at end of file
+}