CDS

Preparation for CDS tests

To enable CDS Enrichment in an ONAP Frankfurt environment the NodePort 30449 for the CDS Blueprint Processor API service needs to be opened

  1. Check existing CDS Services:

    ubuntu@control01:~$ kubectl get service -n onap|grep cds-blueprints-processor-http
    cds-blueprints-processor-http      ClusterIP  10.43.101.198   <none>  8080/TCP
    
  2. Change NodePort to CDS cds-blueprints-processor-http

    Add the “nodePort” under “ports” section and change “type” from “ClusterIP” to “NodePort”

    ubuntu@control01:~$ kubectl edit service cds-blueprints-processor-http -n onap
    
    apiVersion: v1
    kind: Service
    metadata:
      creationTimestamp: "2020-07-23T02:57:36Z"
      labels:
        app: cds-blueprints-processor
        chart: cds-blueprints-processor-6.0.0
        heritage: Tiller
        release: onap
      name: cds-blueprints-processor-http
      namespace: onap
      resourceVersion: "10256"
      selfLink: /api/v1/namespaces/onap/services/cds-blueprints-processor-http
      uid: 6f065c03-4563-4d64-b6f5-a8892226c909
    spec:
      clusterIP: 10.43.101.198
      ports:
      - name: blueprints-processor-http
        nodePort: 30449       -> add line
        port: 8080
        protocol: TCP
        targetPort: 8080
      selector:
        app: cds-blueprints-processor
        release: onap
      sessionAffinity: None
      type: ClusterIP -> change to NodePort
    status:
      loadBalancer: {}
    
  3. Verify NodePort to CDS cds-blueprints-processor-http

    ubuntu@control01:~$ kubectl get service -n onap|grep cds-blueprints-processor-http
    cds-blueprints-processor-http      NodePort    10.43.101.198   <none> 8080:30449/TCP
    
  4. Load ModelType via Bootstrap

    curl --location --request POST 'http://<k8s-host>:30449/api/v1/blueprint-model/bootstrap' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==' \
    --data-raw '{
    "loadModelType" : true,
    "loadResourceDictionary" : false,
    "loadCBA" : false
    }'
    

Load blueprint from file

from onapsdk.cds import Blueprint
blueprint = Blueprint.load_from_file("<< path to CBA file >>")

Enrich blueprint and save

enriched_blueprint = blueprint.enrich()
enriched_blueprint.save("<< path to dest file >>")

Publish blueprint

enriched_blueprint.publish()

Generate data dictionary from blueprint

The method to generate data dictionaries based on the blueprint mappings. As the result it returns a data dictionaries set with valid structure, but some additional actions may be needed. Data dictionary input has to be filled by the user if the type is neither “source-input” nor “source-default”. Things, which are needed to be filled are marked by << FILL >> mark. If the blueprint you are using has only “source-input” or “source-default” input types, the generated data dictionary set is ready to upload to CDS.

generated_dd: DataDictionarySet = blueprint.get_data_dictionaries()
generated_dd.save_to_file("<< path to dest file >>")

Load data dictionary set from file

from onapsdk.cds import DataDictionarySet
dd_set = DataDictionarySet.load_from_file("<< path to dd file >>")

Upload data dictionary set

dd_set.upload()

Retrieve Blueprint Models from CDS

  1. All

from onapsdk.cds import BlueprintModel
all_blueprint_models = BlueprintModel.get_all()
  1. Selected by id of Blueprint Model

blueprint_model = BlueprintModel.get_by_id(blueprint_model_id='11111111-1111-1111-1111-111111111111')
  1. Selected by name and version of Blueprint Model

blueprint_model = BlueprintModel.get_by_name_and_version(blueprint_name='test_name', blueprint_version='1.0.0')

Delete Blueprint Model

blueprint_model.delete()

Download Blueprint Model

blueprint_model.save(dst_file_path='/tmp/blueprint.zip')

Get Blueprint object for Blueprint Model

After that, all operation for blueprint object, like execute blueprint workflow etc. can be executed.

blueprint = blueprint_model.get_blueprint()