Uploaded image for project: 'Common Controller SDK'
  1. Common Controller SDK
  2. CCSDK-1611

Handle all Data Type and DD with complex type.

XMLWordPrintable

      The CDS capabilities shall be extended to support complex data type use case covered in the below illustration for the DB, REST, INPUT, and DEFAULT capabilities. Each of the rows shall be documented and covered as part of the Jira updates. The capabilities shall also required a UAT to ensure different combination and permutation of complex data type modeling for input and output key mapping is supported.  

       

      Note: 

      1. In the case we define output-key-mapping to empty, the request to the system and the Data Dictionary defined should be perfect align to return the expected type (Primary type, collection or complex type).

      i.e:

      • Database resource resolution DD sample:
      "name" : "protected-prefix-id""tags" : "protected-prefix-id""updated-by" : "Singal, Kapil <ks220y@att.com>""property" : {    
         "description" : "protected-prefix-id",    
         "type" : "string"  
      },  
      "sources" : {    
         "processor-db" : {      
            "type" : "source-db",      
            "properties" : {        
               "type" : "SQL",        
               "query" : "select sdnctl.IP.prefix_id from sdnctl.IP where description = \"protected\"",
               "output-key-mapping" : {}         
            }    
         }  
      }

      In this example, the query return a prefix_id as a String, so that there is no need for mapping here.

       

      • REST resource resolution DD sample:
      {
        "name" : "vfw_private_ip",
        "tags" : "vfw_private_ip",
        "updated-by" : "Singal, Kapil <ks220y@att.com>",
        "property" : {
          "description" : "vfw_private_ip",
          "type" : "list"
        },
        "sources" : {
          "sdnc" : {
            "type" : "source-rest",
            "properties" : {
              "type" : "JSON",
              "url-path" : "config/GENERIC-RESOURCE-API:services/vnf/$vnf-id/vfw_private_ips",
              "path" : "/param/values",
              "expression-type" : "JSON_POINTER",
              "input-key-mapping" : {
                "vnf-id" : "vnf-id"
              },
              "output-key-mapping" : {},
              "key-dependencies" : [ "vnf-id" ]
            }
          }
        }
      }

      In this case, the DD map the response by providing a PATH="/param/values" where to find the exact output in the response of the REST System.

      2. there are two scenario where the Output-Key-Mapping is empty:

      • When executing in REST commands such as PUT, POST, PATCH and DELETE that returns no response body with HTTP code of success or failure.
      • When Executing a source capability that returns the instance value without assign it to a variable. Not recommended practice.

      Use cases :

      Response 200 samples:
      1. Primary type  

      {"value": "some value" } -> Expect output-key-mapping = ["dd-name": "value"]
      OR
      { "some value" }  -> Expect output-key-mapping = [] => See the note above for this case

       

      2. Collection of String

      Expected output-key-mapping

       

      ["dd-name-value": "value"]
      OR
      [] => See the note above for this case

       sample 1: 

      {    
      "page": 2,    
      "per_page": 6,
      "total": 12,
      "total_pages": 2,
      "data": [{
         "id": 7,
         "email": "michael@email.com",
         "value": "some value 1"
       },        
       {
         "id": 8
         "email": "joe@email.com",
         "value": "some value 2"
        } 
      ]}
      

      Sample 2: 

      {    
      "page": 2,    
      "per_page": 6,
      "total": 12,
      "total_pages": 2,
      "data": {
         "value": ["some value 1",
                    "some value 2", 
                    "some value 3",
                    "..."]
       } 
      }
      

       

      3. Collection of Complex type (data type) 

      Expected output-key-mapping

      ["dd-name": "data"]
      OR
      ["dd-name-id": "id", "dd-name-email": "email", "dd-name-value": "value"]
      OR
      ["dd-name-id": "id", "dd-name-email": "email"]
      OR
      []  => See the note above for this case

      Sample response 

      {    
      "page": 2,    
      "per_page": 6,
      "total": 12,
      "total_pages": 2,
      "data": [{
         "id": 7,
         "email": "michael@email.com",
         "value": "some value 1"
       },        
       {
         "id": 8
         "email": "joe@email.com",
         "value": "some value 2"
       } 
      ]}
      

      3. Complex type (data type)

       Expect output-key-mapping

      ["dd-name": "data"]
      OR
      ["dd-name-id": "id", "dd-name-email": "email", "dd-name-value": "value"]
      OR
      ["dd-name-id": "id", "dd-name-email": "email"]
      OR
      []  => See the note above for this case

      Sample response

      {    
      "page": 2,    
      "per_page": 6,
      "total": 12,
      "total_pages": 2,
      "data": {
         "id": 7,
         "email": "michael@email.com",
         "value": "some value 1"
       }
      }
      

       

            ssteve ssteve
            ssteve ssteve
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: