Name | Organization | |
---|---|---|
Shravan Ambati | Calix Inc | |
Sanjana Agarwal | ON.Lab | sanjana@onlab.us |
SDN Applications wanting to receive notifications from ONOS must be written as native ONOS Java Application.
Applications written using any other programming language must use the REST APIs of ONOS.
This project aims to provide the same level of visibility to external non java applications,
there by ONOS will be opened up to a wide number of non-Java Applications and significantly expanding the scope of control of ONOS.
This feature will enable ONOS to publish events to a Kafka topic for all other applications subscribing to that topic.
The contribution will be in the form of an App called Kafka Integration Application.
The Application will subscribe to events via Java APIs on ONOS and publish those events to a Kafka Server.
Apache Kafka is a distributed messaging system that supports a pub/sub mechanism among other messaging models.
More information about Apache Kafka can be found here - http://kafka.apache.org/documentation.html .
The diagram below shows the overall architecture of the system.
The Application loads a json config file at start up. This config file will have Kafka config information.
1. In a cluster scenario only the primary and backup controller will be responsible for publishing events to Kafka Server.
2. One of the core assumptions is the order of event stream that is received from Network Devices is the same across all the ONOS controllers.
3. The Leader/Primary will publish event stream to a local store. There will be a shared counter indicating the last published event to Kafka Server. After publishing the event to the Kafka Server, it will update the counter accordingly. All other members will update their local buffers to remove events that have been published. This is based on the shared counter value.
4. In case of Leader failure, the Backup will try to post events that were not sent to the Kafka server. These are basically events present in its local store.
5. As a mechanism to detect duplicated events being sent, we could have seq_id numbers for every event that gets posted. This way the external app can detect duplicates. The sequence number could be a simple timestamp that every event will carry.
As a first step we will only export Device Events and Link Events to consumers and worry about Packet Ins and Packet Out later.
The following steps will walk you through connecting your app to ONOS and listening to specific ONOS events.
Build and run ONOS. This how-to screencast is a good starting point to build and run ONOS locally on your development machine, for any other information please refer to the ONOS Developer Guide.
Do not build using BUCK as the app currently does not support BUCK build. Use 'maven clean install' or mci (for the lazy ones like me).
|
Activate Zookeeper and the Kafka server. Download Kafka version and un-tar it. You can follow the Step 1 of the Quick start guide on this page: http://kafka.apache.org/documentation.html#quickstart
Activate Zookeeper and the Kafka server (in this order) in separate terminals.
Once, both have been activated successfully, you can proceed to the next steps. |
Activate the Kafka integration app. This will activate all the modules of the app. In the ONOS command line, type:
$ app activate org.onosproject.kafkaintegration |
Check that RPC services and the ONOS Protobuf models have been activated too.
$ apps -s -a |
You should see an output similar to this (depending on your defined startup apps in $ONOS_APPS) :
* 18 org.onosproject.drivers 1.7.0.SNAPSHOT Default Device Drivers * 27 org.onosproject.openflow-base 1.7.0.SNAPSHOT OpenFlow Provider * 28 org.onosproject.hostprovider 1.7.0.SNAPSHOT Host Location Provider * 29 org.onosproject.lldpprovider 1.7.0.SNAPSHOT LLDP Link Provider * 30 org.onosproject.openflow 1.7.0.SNAPSHOT OpenFlow Meta App * 41 org.onosproject.fwd 1.7.0.SNAPSHOT Reactive Forwarding App * 44 org.onosproject.incubator.rpc 1.7.0.SNAPSHOT ONOS inter-cluster RPC service * 45 org.onosproject.incubator.protobuf 1.7.0.SNAPSHOT ONOS ProtoBuf models * 51 org.onosproject.kafkaintegration 1.7.0.SNAPSHOT Kafka Integration Application * 58 org.onosproject.mobility 1.7.0.SNAPSHOT Host Mobility App * 81 org.onosproject.proxyarp 1.7.0.SNAPSHOT Proxy ARP/NDP App |
Subscribe for ONOS events. In the subscribe POST operation, create a subscription to a specific ONOS event. A model schema exists on the right-hand side of the call.
The appName would be the same name of the app, with which you registered. The groupId would be the groupId you get as a response after registering your app and the eventType would be the type of the ONOS events you want to register for (LINK and DEVICE events for now).
There is a possibility that the Swagger UI might give wrong responses, like 'No response from server.' In such cases, please check your log to be sure of the correct response. To print your log, you can use the following command in a new Terminal window.
For a successful subscription you should get a 'Subscription for DEVICE event by forwardingApp successful' message. |