Versions Compared

Key

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

Useing the dcae-cli Tool

...

to deploy a micro service through a component spec

Overview

The dcae-cli is a Python command-line tool for component developers. With it, the developer can :

...

  1. https://onap.readthedocs.io/en/latest/submodules/dcaegen2.git/docs/sections/components/dcae-cli/dcae-cli-tool.html
  2. https://wikilf-onap.onapatlassian.orgnet/wiki/display/DW/MicroServices+Onboarding

Requirements:

  • ONAP deployment (3 node deployment is sufficient)
  • A Another single Ubuntu instance

...

  • (which we will install docker on)

Follow the below instructions step by step to install , validate component spec and deploy on local env:.

  • Execute the commands as a root user to avoid permission issues. 

Clone the repo onto one of the ONAP instanaces

Login to an instance on the onap deployment and switch to a root user.

root@excl-xxxxxx-lego-casablanca-node-3:~# git clone https://gerrit.onap.org/r/p/dcaegen2/platform/cli.git
Cloning into 'cli'...
remote: Counting objects: 2, done
remote: Finding sources: 100% (2/2)
remote: Total 507 (delta 0), reused 507 (delta 0)
Receiving objects: 100% (507/507), 384.30 KiB | 0 bytes/s, done.
Resolving deltas: 100% (179/179), done.
Checking connectivity... done.

...

Periodically, upgrade the dcae_cli to get the latest version

$ pip

...

install

...

--upgrade

...

onap-dcae-cli

...

Setup postgres database

Create a new postgres db.

(cli_tool) root@excl-xxxxxx-lego-casablanca-node-3:~# mkdir postgres

...

Now we got consul host, <consul_host=10.209.63.6 >

For the Docker Host

Login to the ubuntu VM, install docker and update it's configuration to accept tcp requests..here are the steps.

Login to the ubuntu instance.

Switch to a root user

install docker:


sudo curl https://We also need to expose the Config-Binding service

root@excl-xxxxxx-lego-casablanca-node-1:~# kubectl -n onap expose svc config-binding-service --type=LoadBalancer --name=mycbs

service "mycbs" exposed

root@excl-xxxxxx-lego-casablanca-node-1:~# kubectl -n onap get svc -o wide | grep config

config-binding-service             ClusterIP      10.43.184.13    <none>                                 10000/TCP                                                     6d        app=config-binding-service

mycbs                                  LoadBalancer   10.43.178.39    10.209.63.17                           10000:31464/TCP                                       3d        app=config-binding-service

Take a note of the exposed Config Binding Service ip-address above (10.209.63.17) and keep this terminal open.


For the Docker Host

Login to the ubuntu VM, install docker and update it's configuration to accept tcp requests.here are the steps.

Login to the ubuntu instance.

Switch to a root user

install docker:

sudo curl https://releases.rancher.com/install-docker/17.03.sh | sh
sudo touch /etc/docker/daemon.json
sudo chmod 777 /etc/docker/daemon.json
sudo bash -c "cat > /etc/docker/daemon.json <<EOF
{
\"log-driver\": \"json-file\",
\"log-opts\": {
\"max-size\": \"20m\",
\"max-file\": \"3\"
}
}
EOF"

...

(cli_tool) root@excl-xxxxxx-lego-casablanca-node-3:~/pmmapper# dcae_cli -v component run --attached dcae-pm-mapper --dmaap-file dmaap.json 
Running the Component.....

DCAE.Discovery | INFO | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
DCAE.Discovery | INFO | * If you run a 'component reconfig' command, you must first execute the following
DCAE.Discovery | INFO | * export SERVICE_NAME=root.e677f7f8-ac75-4919-bdf7-6b794a8f2cc8.1-0-0.dcae-pm-mapper
DCAE.Discovery | INFO | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
DCAE.Docker | INFO | Running image 'nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.datafile.datafile-app-server:1.1.1' as 'root.ad8ef3fbe677f7f8-5acaac75-40954919-ad48bdf7-44358bbdd0826b794a8f2cc8.1-10-0.dcae-pm-mapper'

Take a note of the SERVICE_NAME.

Above command is run as attach mode, press ctrl+c to stop the micro service but keep it running while you verify the docker container is running in the next step before stopping the dcae_cli command.

...

ModeDescription
attachedcomponent is run in the ‘foreground’, container logs are streamed to stdout. Ctrl-C is used to terminate the dcae_cli session.
unattachedcomponent is run in the ‘background’, container logs are viewed via docker logs command, container runs until undeployed with dcae_cli undeploy command.

Check micro service on the Docker host:


In the example component spec, datafile image is provided. Therefore Go back to the previously opened terminal on the ONAP deployment and verify that the service is executing ( the output will be similar to this) by executing the command

# curl http://<IP of the exposed Config Binding Service>:10000/service_component/<SERVICE_NAME>    

i.e.

root@excl-xxxxxx-lego-casablanca-node-1:~#  curl http://10.209.63.17:10000/service_component/root.e677f7f8-ac75-4919-bdf7-6b794a8f2cc8.1-0-0.dcae-pm-mapper

{"pm-mapper-filter": "{ \"filters\":[]}", "3GPP.schema.file": "{\"3GPP_Schema\":\"./etc/3GPP_relaxed_schema.xsd\"}", "streams_publish.pm_mapper_handle_out.message_router_topic": "unauthenticated.PM_VES_OUTPUT", "streams_subscribes": {}, "streams_publishes": {"pm_mapper_handle_out": {"type": "message_router", "aaf_password": null, "dmaap_info": {"topic_url": "https://we-are-message-router.us:3905/events/some-topic", "client_role": null, "location": null, "client_id": null}, "aaf_username": null}}, "streams_subscribes.pm_mapper_handle_in.feed_id": "1", "services_calls": {}}ubuntu@masternightly-node-2:

Check micro service on the Docker host:

In the example component spec the datafile image is provided therefore it is deployed.

Goto the terminal thats previously logged into the ubuntu VM.

...