Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

What is a data dictionary?

For each unique identified dynamic resource, along with all their ingredients, we need to create a data dictionary.Data dictionary are based on specific data type: resource assignment data type

Here are the modeling guideline: CDS Modeling Concepts

FIX ME - add generic DD model

Bellow are examples of data dictionary for each resource source

Deck of Cards
idDD


Card
labelinput

Value will be pass as input.

For any resources that should be resolved by passing the value as input, similar model should be used.

In that case, the request payload will expect a parameter name unit-number

Code Block
themeEclipse
{
    "tags": "unit-number",
    "name": "unit-number",
    "property": {
      "description": "unit-number",
      "type": "string"
    },
    "updated-by": "adetalhouet",
    "sources": {
      "input": {
        "type": "source-input"
      }
    }
  }



Card
labeldefault

Value will be defaulted.

Code Block
themeEclipse
{
  "tags": "prefix-id",
  "name": "prefix-id",
  "property" :{
    "description": "prefix-id",
    "type": "integer"
  },
  "updated-by": "adetalhouet",
  "sources": {
    "default": {
      "type": "source-default",
    }
  "properties": {
      }
    }
  }
}}
}



Card
labelrest

Value will be resolved through REST.

Modeling reference: CDS Modeling Concepts

In this example, we're making a POST request to an IPAM system with no payload.

Some ingredients are required to perform the query, in this case, $prefixId. Hence It is provided as an input-key-mapping and defined as a key-dependencies. Please refer to the modeling guideline for more in depth understanding.

As part of this request, the expected response will be as bellow. What is of interest is the address field, as this is what we're trying to resolve.

Code Block
themeEclipse
titleresponse
collapsetrue
{
Code Block
themeEclipse
titlecreate_netbox_ip_address
{
    "tags" : "oam-local-ipv4-address",
    "name" : "create_netbox_ip",
    "propertyid" : {4,
      "descriptionaddress" : "netbox ip192.168.10.2/32",
      "typevrf": null,
    "tenant": "dt-netbox-ip"null,
    "status": 1,
    }"role": null,
    "updated-by" interface": null,
    "description": "adetalhouet",
    "sourcesnat_inside" : {null,
     "created": "primary2018-config08-data30",
 : {
        "type" : "source-rest",
        "properties" : {
          "type" : "JSON",
          "verb" : "POST",
          "endpoint-selector" : "ipam-1",
          "url-path" : "/api/ipam/prefixes/$prefixId/available-ips/",
          "path" : "/address",
          "input-key-mapping" : {
            "prefixId" : "prefix-id"
          },
          "output-key-mapping" : {
            "address" : "address"
          },   "last_updated": "2018-08-30T14:59:05.277820Z"
}

To tell the resolution framework what is of interest in the response, the path property can be used, which uses JSON_PATH, to get the value.

Code Block
themeEclipse
titlecreate_netbox_ip_address
{
    "tags" : "oam-local-ipv4-address",
    "name" : "create_netbox_ip",
    "property" : {
      "description" : "netbox ip",
      "type" : "dt-netbox-ip"
    },
    "updated-by" : "adetalhouet",
    "sources" : {
      "primary-config-data" : {
        "type" : "source-rest",
        "properties" : {
          "type" : "JSON",
          "verb" : "POST",
          "endpoint-selector" : "ipam-1",
          "url-path" : "/api/ipam/prefixes/$prefixId/available-ips/",
          "path" : "/address",
          "input-key-mapping" : {
            "prefixId" : "prefix-id"
          },
          "output-key-mapping" : {
            "address" : "address"
          },
          "key-dependencies" : [ "prefix-id" ]
        }
      }
    }
  }



Card
labeldb

Value will be resolved through a database.

Modeling reference: CDS Modeling Concepts

In this example, we're making a SQL to the primary database.

Some ingredients are required to perform the query, in this case, $vfmoudleid. Hence It is provided as an input-key-mapping and defined as a key-dependencies. Please refer to the modeling guideline for more in depth understanding.

As part of this request, the expected response will be as put in value. In the output-key-mapping section, that value will be mapped to the expected resource name to resolve.

Code Block
themeEclipse
titlevf-module-type
{
  "name": "vf-module-type",
  "tags": "vf-module-type",
  "property": {
    "description": "vf-module-type",
    "type": "string"
  },
  "updated-by": "adetalhouet",
  "sources": {
    "primary-db": {
      "type": "source-primary-db",
      "properties": {
        "type": "SQL",
        "query": "select sdnctl.demo.value as value from sdnctl.demo where sdnctl.demo.id=:vfmoduleid",
        "input-key-mapping": {
          "vfmoduleid": "vf-module-number"
        },
        "output-key-mapping": {
          "vf-module-type": "value"
        },
        "key-dependencies": [
          "vf-module-number"
        ]
      }
    }
  }
}



Card
labelcapability

Value will be resolved through a the execution of a script.

Modeling reference: CDS Modeling Concepts

In this example, we're making use of a Python script.

Some ingredients are required to perform the query, in this case, $vf-module-type. Hence It is provided as a key-dependencies. Please refer to the modeling guideline for more in depth understanding.

As part of this request, the expected response will set within the script itself.

Code Block
themeEclipse
titleinterface-description
{
  "tags": "interface-description",
  "name": "interface-description",
  "property": {
    "description": "interface-description",
    "type": "string"
  },
  "updated-by": "adetalhouet",
  "sources": {
    "capability": {
      "type": "source-capability",
      "properties": {
        "script-type": "jython",
        "script-class-reference": "Scripts/python/DescriptionExample.py",
        "instance-dependencies": [],
        "key-dependencies": [
          "vf-module-type"
        ]
      }
    }
  }
}

The script itself is as follow. The key is to have the script class derived from the framework standards.

In the case of resource resolution, the class to derive from is AbstractRAProcessor

It will give the required methods to implement: process and recover, along with some utility functions, such as set_resource_data_value or addError.

These functions either come from the AbstractRAProcessor class, or from the class it derived from.

FIX ME - give more information about scripting

Code Block
themeEclipse
titleScripts/python/DescriptionExample.py
collapsetrue
#  Copyright (c) 2019 Bell Canada.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this 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.

from abstract_ra_processor import AbstractRAProcessor
from blueprint_constants import *
from java.lang import Exception as JavaException

class DescriptionExample(AbstractRAProcessor):

    def process(self, resource_assignment):
          "key-dependencies" : [ "prefix-id" ]try:
        }
    # get }
    }dependencies result
  }
Card
labeldb
Code Block
themeEclipse
{
  "name": "vf-module-type",
  "tags": "vf-module-type",
  "property": {
   value "description": = self.raRuntimeService.getStringFromResolutionStore("vf-module-type",
    "type": "string")
  },
  "updated-by": "adetalhouet",
  "sources": {
    "primary-db": {
      "type": "source-primary-db",
      # logic  "properties": {
based on dependency outcome
         "type":   result = "SQL",
         "query": "select sdnctl.demo.value asif value from sdnctl.demo where sdnctl.demo.id=:vfmoduleid",== "vfw":
        "input-key-mapping": {
        result = "This  "vfmoduleid": "vf-module-number"
 is the Virtual Firewall entity"
       },
     elif value == "output-key-mappingvsn": {

                result = "vf-module-type": "valueThis is the Virtual Sink entity"
        },
    elif value ==  "key-dependenciesvpg": [

                result = "vf-module-number"
    This is the Virtual Packet Generator"

    ]
      }
  # set }
value  }
}
Card
labelcapability
Code Block
themeEclipse
{
  "tags": "interface-description",
  "name": "interface-description",
  "property": {
    "description": "interface-description",
    "type": "string"
  },
  "updated-by": "adetalhouet",
  "sources": {
    "capability": {
for resource getting currently resolved
            self.set_resource_data_value(resource_assignment, result)

        except JavaException, err:
          log.error("Java Exception in the script {}", err)
        "type": "source-capability",except Exception, err:
      "properties": {
   log.error("Python Exception in  the "script-type": {}"jython", err)
        "script-class-reference": "DescriptionExample",return None

    def recover(self,   "instance-dependencies": [

runtime_exception, resource_assignment):
         ]
 print self.addError(runtime_exception.getMessage())
     }
   return }None

  }
}



Workflows

The following workflows are contracts established between SO, SDNC and CDS to cover the instantiation and the post-instantiation use cases.

...