Skip to content

RCB workflow

skovzhaw edited this page Jul 5, 2016 · 49 revisions

Prerequisites

Now that you have installed, configured and deployed the RCB Cyclops framework, you can proceed with the Rating-Charging-Billing workflow.

Usage collection

Based on your underlying system, whether you are measuring CloudStack or OpenStack - both being IaaS, or you have developed your own collector for any PaaS, SaaS or IoT scenario, all events and usage records will be processed and persisted by UDR micro service.

Rating, Charging and Billing

Every single core micro service is listening on two queues, one being data queue and second designated for execution of predefined commands.

UDR micro service

In case of UDR micro service the usage data records are being stored into InfluxDB time series database and based on developer's preference, published over RabbitMQ.

Queries

The usage data records are made available to you via RESTful API paginated queries, where more domain specific APIs are to come.

Commands

If you need to process ingested data points/events and create usage records manually, you can proceed by writing your own commands.

As the micro services can already process batches of data points, we will be releasing "flush" processing commands very soon.

RC micro service

As can be seen in the picture above, RC micro service consists of the following two components:

Rating function

Once UDR publishes usage data records over RabbitMQ, it's the rating function that takes care of calculating charge data records. You can either use included [Static rating] (https://github.com/icclab/cyclops/wiki/Static-rating) micro service, [Rule engine] (https://github.com/icclab/cyclops/wiki/Rule-engine) with your own pricing strategies, or write your own.

CDR micro service

Rating function is also responsible for sending created charge data records to CDR micro service, which continues by persisting them into the time series database, as well as making them available over RESTful API queries.

Billing micro service

There are currently two ways how to invoke an invoice generation:

With Rule engine

If you've deployed a rule engine you can simply send a command to Billing micro service with the following format:

{  
  "_class": "GenericBillRequest",
  "subject": "martin",
  "from": 1465047094,
  "to": 1467639096
}

Where Billing micro service will ask Rule engine to prepare an account statement for the specified subject, over the specified time window and by using predefined set of rules.

Created bill will be automatically stored and made available to you over RESTful API queries. More domain specific and sophisticated API calls are coming very soon!

Without Rule engine

If you decide not to use a rule engine and configure Billing micro service to use the same database as CDR micro service, then you will be able to generate invoices locally too.

In order to do that simply send a command to Billing micro service with the following format:

{  
  "_class": "LocalBillRequest",
  "subject": "martin",
  "from": 1465047094,
  "to": 1467639096,
  "include":[  
    "CloudStackIPUsageDataCDR",
    "ExternalUDRCDR"
  ]
}

As opposed to a rule engine, which understand semantics of your data by utilising set of rules, here you will need to explicitly specify what should be included in your bill. Once calculation has finished, the created invoice will be stored into the database and made available to you over RESTful API queries.

Optionally you can also include SLA violations by specifying what percentage should be subtracted:

"sla":{  
  "CloudStackIPUsageDataCDR":20
}

Any coupons you have issued to your customers (in amount, not percentage) can be encoded in a bill request as:

"coupons":{  
  "CloudStackIPUsageDataCDR":100,
  "ExternalUDRCDR":10
}

Overall percentage discount as:

"discount": 10

As well as potential value added tax:

"vat": 20
Clone this wiki locally