Onboard custom service in CORD-4.1

Onboard custom service in CORD-4.1

This article will describe how to onboard your service in CORD-4.1, and modify official pod-test for create instance.

Installation CORD in a Box

Download source code from GitHub.

Execute script with -v argument indicates using Vagrant to create Virtual POD (CORD in a box).

Generate configuration files and start build.

CORD Architecture

We can devide CORD into 3 part:

  • corddev: we develop our service on this vm.
  • head1: headnode, called prod before, most service run here.
  • compute1: compute node, it will be gave a random name like: overdue-boys.

And when we develop services on CORD, we put our service in corddev:/opt/cord/orchestration/xos_services, /opt/cord mounted from localhost:~/cord/, so you can modify services and config in localhost, instead of ssh to corddev.

There is a big change between version and version. In cord-4.0, CORD uses milestone folder to record which step have done, so deployment will use same command as build CORD.

Deploy Services Flow


It doesn’t matter which kind of CORD you use, but I use M-CORD for demonstration here.

Before we start to deploy our service, I assume you already have your service in xos_services folder. If not, you can clone one from my github repository, or just use exampleservice for practice.

Modify your cord-profile as following, append your service configuration in xos_services block:

Create service synchronizer

In CORD architecture, when you upload an yaml config to XOS TOSCA engine, it will call service-synchronizer to deal with 2 things: create serviceinstance and sync instance. In the sync step, it will use the ansible playbook wrote in your synchronizer folder.

So here comes a brief step to put your synchroinzer in CORD:

  • register service in ~/cord/.repo/manifest.xml.
  • make sure service’s version control have opencord/cord-4.1 branch.
  • add service information in docker_images.yml
  • put service in genconfig/config.yml, in docker_image_whitelist block, and this step need to be done in both corddev & headnode, unless re-run the copy-config step.

Write onboard playbook in platform-install

you can use exampleservice as example, it contains several play roles in make pod-test. Or use my service playbook.

  • maas-test-client-install
  • test-subscriber-config
  • xos-onboard-hosts
  • test-subscriber-enable
  • test-vsg
  • exampleservice-config
  • test-exampleservice

But the keystep to create a single exampleservice instance, is the last 2 steps, so take a look and modify it.

We can use make pod-test as our templates, copy their playbooks and modify it to fit our needs.

Let’s take a look at pod-test part in Makefile, it will ssh to headnode, and send command to make it run the pod-test-playbook.yml with ansible.

So, the pod-test-playbook.yml does the following things:

  • Create test client
  • Create test subscriber
  • Enable test subscriber
  • onboard exampleservice
  • test exampleservice

But we only need to onbord our custom service, and create a serviceinstance, there is no need to create test client and subscriber (of course you can create one if you want).

Add custom command in Makefile

If you don’t want to modify original pod-test file, you can add by youself.

Copy Ansible playbook and Ansible roles folder

Modify Ansible files

Modify Ansible Playbook

In this part, I skip paste code in here, just remind you, please make sure your configuration have right correspond path with your service file.

Next step

After you done, run commands below:

make xos-teardown will clean all docker image, stop xos-related container, include services in CORD profile.

make clean-openstack will clean all networks and instances from openstack, you will get a clean compute node.

make -j4 build will base on milestone folder to decide which step should CORD build, so it will start from start-xos.

make compute-node-refresh will make xos synchronizer get compute node information, and take it as available node to put instance in, if this step wasn’t done, maybe you will get a No suitable nodes to pick from.

make myservice will running your playbook and send yaml to TOSCA, then your synchroinzer will create instance.

Appendix: Debug Services

If you find xos can’t start normally (ansible failed in somewhere), maybe your service cause some problems, here is a debug guide.

(source: https://guide.opencord.org/xos-gui/architecture/)

Our service will become part of xos-core, you can use docker ps to find our target:

We need to inspect mcord_xos_core_1, this container’s log will tell us where is the problem.

Find Log by docker log

docker log is very useful command, espectially when your container was keeping restart, usually this situation means process in container dead and dead again.

Find Log by docker exec

Use docker exec command can let you execute a shell in container, and find some informations / logs in it.

Also, if container runs not only 1 process, you can take a look with process’s stdout/stderr by:

2 Replies to “Onboard custom service in CORD-4.1”

  1. 你好,看了你的blog,许多很好的文章,我们目前正在研究M-CORD,有些问题想与交流,可否告知你的邮箱,我的邮箱是xion[email protected]或者加我wechat:xzhwei,谢谢

Leave a Reply

Your email address will not be published. Required fields are marked *