Versions Compared

Key

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

...

Model architecture and abstraction

NOTE! The model architecture and abstraction presented below is the draft version. The new architecture using core ONOS abstractions and Route subsystem is in progress. However, the most important component (XmppController being responsible for XMPP protocol handling) will remain unchanged.

The eXtensible Messaging and Presence Protocol (XMPP) is a general-purpose, universal protocol. The main feature of XMPP is its extensibility and payload-agnosticism, what makes XMPP very powerful and high-level protocol that may carry various information such as routing, configuration or monitoring.

The main assumption of XMPP protocol implementation design for ONOS was to provide extensibility of XMPP protocol, as Publish/Subscribe extension is not the only use case for XMPP. The current implementation allows to re-use the core implementation of basic XMPP mechanisms (such as stream establishment or handling of basic XML stanzas) and based on that develop the new XEPs that are needed for particular use case.

Image Removed

The XMPP Stanza is composed of header, extension-specific (XEP-specific) part and optionally payload. In order to make our implementation architecture extensible and make possible to add new XMPP extensions seamlessly we made a decision to divide XMPP parsing process into three parts. The basic part is implemented in Protocols layer (XmppController) and handles core XMPP functionalities (such as Stream negotiation). It is also responsible for recognizing XMPP messages and parsing XMPP Stanza headers. The handling of the XEP-specific part is moved to Providers layer. We assume that for the each XEP the new XMPP Provider will be created. We have already created XmppPubSubProvider being responsible for XMPP Publish/Subscribe message handling. Additionally, the XmppDeviceProvider is common for all XEP-specific Providers. The payload of the XMPP messages (if exists) is handled by XmppDriver, which is responsible for translating XML payload into Java abstractions. These objects returned by XmppDriver are passed to the PubSub Subsystem. Then, they are encapsulated in PubSub Event and all PubSub listeners are notified about new incoming PubSub message. Each future XEP implementation should follow this architecture. The payload parsing logic should be moved to Driver subsystem. Moreover, the new subsystem, which will provide XEP-specific abstractions for ONOS applications, should be created for every new XEP.

Our implementation design of XMPP functionality for ONOS controller is depicted below. It is composed of two main parts: the XMPP Providers and Route Server application. The XMPP Providers implement XMPP SBI, while Route Server application realizes BGP-VPN system using data abstractions provided by XMPP Providers.The XMPP Providers translates XMPP objects into three ONOS abstractions: Device, Route and Flow.

Image Added


XMPP Providers

We have made decision to divide Protocols layer into two components: XMPP Controller and XMPP PubSub Controller. Such a decision is due to the nature of XMPP protocol. XMPP may be extended by new XEPs, so that we provide a possibility to build new extensions in future without modyfing already existing implementation. The implementation of core XMPP is provided by XMPP ControllerThe core part of the implementation architecture is XmppController, which is responsible for:

  • Establishing XMPP stream
  • Stream errors handling
  • Decoding/encoding XMPP Stanzas
  • Maintaining the state of connected XMPP devices

The XmppPubSubProvider Based on core XMPP implementation we have developed XMPP PubSub Controller implementing Publish/Subscribe (XEP-0060) extension. The XMPP PubSub Controller listens to IQ stanzas based on thatand:

  • parses XMPP messages into PubSub abstractions. The Subscribe and Unsubscribe XMPP messages are passed directly, while the Publish/Retract XMPP messages are parsed using methods provided by XmppDriver. For BGP-signaled End System IP VPNs use case, XmppDriver translates XML data carried in XMPP body into BgpInfo ONOS Java object.ONOS abstractions.
  • handles PubSub errors
  • constructs XMPP Event Notification messages and sends them to underlaying XMPP devices

The PubSub Subsystem is newly created ONOS subsystem, which provides Publish/Subscribe abstractions. It provides interface between Providers and Apps layer and is responsible for notifying listeners observing the PubSub Events. The Device Subsystem is the standard ONOS core subsystem storing status of connected devices. The abstractions provides by both PubSub and Device Subsystems may be used by ONOS applicationsXMPP PubSub Controller produces notifications, that can be handled by higher layers. The Providers layer includes the XMPP Device Provider and XMPP EVPN Provider. The XMPP Device Provider listens to notification from XMPP Controller and creates a new Device object, when a XMPP session is established. The XMPP EVPN Provider is implemented based on XMPP PubSub Controller. It listens to XMPP PubSub events (SUBSCRIBE, UNSUBSCRIBE, PUBLISH, RETRACT). These messages are handled by Route Provider, which translates PubSub attributes and payload into BGP EVPN constructs, which are provided by RouteService subsystem. The PubSub messages are handled, so that:

  • According to IETF spec 2, SUBSCRIBE and UNSUBSCRIBE messages are translated into BGP RouteTarget configuration. Moreover, when a SUBSCRIBE/UNSUBSCRIBE message is received the XMPP Route Provider associates/deassociates Device to/from VPN instance.
  • According to IETF spec 2, PUBLISH/RETRACT messages are translated into BGP Route objects and are stored in distributed RouteStore. Moreover, a BGP Route Update or BGP Route Delete event is generated.

The events generated by RouteService are handled by Route Server application. When new event is handled, the Route Server may install a Flow, which is constructed based on BGP Route object and translated into XMPP Event Notification (Message stanza). The Flow installation request is handled by XMPP Flow Provider, which generates XMPP Message stanza based on the Flow object and sends it to the appropriate devices.

Key implementation pieces of code

The code implementing XMPP protocol is located in Protocols and Providers layers. The source code of XMPP Core controller is already integrated with ONOS master branch. The source code of XMPP PubSub Controller, EVPN Provider and Route Server is available at : https://github.com/osinstom/onos/tree/xmpp-1.0bgpvpn.

The XMPP implementation follows ONOS code convention. The folder structure of Protocols layer's modules includes “api” subfolder  containing interface definitions and “ctl” containing implementation classes. The implementation uses also several external libraries:

  • Tinder, which provides XMPP abstractions. It is also used in open source XMPP server implementations such as Openfire.
  • Aalto-XML, which provides asynchronous, non-blocking XML parsing mechanism
  • Netty, which provides multi-threaded and efficient TCP Java-based server

Interfaces and classes

  • XmppController.java interface implemented by XmppControllerImpl.java tracks all connected XMPP devices, provides interface to obtain XMPP device and register/unregister listeners.

  • XmppDevice.java interface implemented by AbstractXmppDevice.java represents underlaying XMPP devices and allows to perform operations on them. With each XmppDevice.java object there is a Netty channel associated.

  • XmppDeviceId.java class implements identifier representation based on XMPP JID address.

  • The XmppDeviceProvider.java manages any XMPP device and its interactions with the ONOS core. It notifies ONOS Device Subsystem about already connected/disconnected devices.

  • The XmppDeviceListener.java notifies the provider in ONOS core that XMPP device is connected/disconnected.

  • XmppServer.java and XmppChannelInitializer.java implements Netty TCP server listening on XMPP connection on TCP 5269 port and configures Netty channel pipeline.

  • XMPP encoding and decoding is implemented by several classes in order to provide efficient XML stream parsing. XmlStreamDecoder.java class reads asynchronously incoming XML data using Aalto-XML library. XmlMerger.java class accumulates incoming XML events from XmlStreamDecoder.java and creates XML document. The XmppDecoder.java class translates XML document into XMPP stanzas. The XmppEncoder.java class translates Tinder objects into bytes ready to send over a network socket.

  • The XmppChannelHandler.java class implements XMPP protocol state machine.

  • The XmppPubSubProvider XmppPubSubController.java interface implemented by XmppPubSubControllerImpl.java implements provides XMPP Publish/Subscribe mechanism for parsing XMPP PubSub messages and sending XMPP Event Notifications.
  • The XmppMessageListener.java, XmppIqListener.java and XmppPresenceListener.java interfaces informs providers in the ONOS core other modules of ONOS about incoming XMPP stanzas. Currently, only the XmppIqListener is implemented by InternalXmppIqListener.java in XmppPubSubProvider XmppPubSubControllerImpl.java, because XMPP Publish/Subscribe does not operate on the other XMPP stanzas.

  • The XmppDeviceProviderXmppRouteProvider.java manages any XMPP device and its interactions with the ONOS core. It notifies ONOS Device Subsystem about already connected/disconnected devices.
  • The XmppDeviceListener.java notifies the provider in ONOS core that XMPP device is connected/disconnected.

...

  • class implements the Route Provider. It listens to XMPP PubSub messages and translates the XML payload into BGP configuration.
  • The XmppPublishEventsListener.java and XmppSubscribeEventsListener.java interfaces are used to inform other modules of ONOS about new events related to XMPP publication and subscription. These interfaces are implemented by InternalXmppPubSubEventListener.java internal class contained in XmppRouteProvider.java.
  • The XmppFlowProvider.java class implements the Flow Provider. It is invoked by Apps layer's modules. When Flow installation request is generated, the XmppFlowProvider translates FlowRule objects into XML message and sends a Message stanza (XMPP Event Notification) to underlaying devices.

Setting up Virtual Lab

As the main use case for XMPP implementation in ONOS, the XMPP-based BGP-signaled End-System IP/VPNs architecture has been implemented. This architecture in general consists of centralized control plane entity called End-System Route Server and distributed vRouters (or VPN Forwarders). For the experiments purposes the XMPP-enabled vRouter emulator (based on Mininet and Open vSwitch) has been implemented (https://github.com/osinstom/vrouter-client-py). It provides basic functionalities of VPN Forwarder such as XMPP communication with server and VXLAN encapsulation.  There was   We have also developed the Proof-of-Concept Route Server application for ONOS providing VPN membership management and BGP route distribution logic, which is are the basic functionality of End-System Route Server.

In order to run a simple demo you have to set tup three VMs. We use VirtualBox to provide three VMs on local laptop. It's preferred to create two separate networks between VMs (we use VBox Host-Only Adapter networks):  management network for control plane operations and data network for connecting emulated compute nodes. The lab architecture is presented below:

Image Modified


Controller node

...

  • Download ONOS sources:

    Code Block
    mkdir onos/
    cd onos/
    git init
    git pull https://gerrit.onosproject.orggithub.com/osinstom/onos refs/changes/81/16781/1.git 
    git checkout xmpp-bgpvpn


  • Start ONOS:

    Code Block
    export ONOS_ROOT=<your-path-to-onos>/onos
    tools/build/onos-buck run onos-local -- clean debug


  • Activate XMPP Provider and PoC Application:

    Code Block
    cd tools/test/bin
    ./onos localhost
    app activate org.onosproject.protocolsproviders.xmpp.evpn org.onosproject.xmppapps.devicerouteserver


  • You should have XMPP server listening on 5269 TCP port

...

  • Download vRouter emulator. Note that it is a prototype version.

    Code Block
    git clone https://github.com/osinstom/vrouter-client-py.git


  • Configure vRouter.

    Code Block
    cd vrouter-client-py
    nano config.ini

    You should configure jid, vrouter.ip and controller.ip parameters. The jid parameter identifies XMPP client and should be unique for compute node. The vrouter.ip is an IP address of data network interface. The controller.ip parameter is an IP address of ONOS controller. Sample config:

    Code Block
    [general]
    jid=agent2@vnsw.contrailsystems.com
    vrouter.ip=192.168.121.3
    controller.ip=192.168.10.2


  • Run vRouter console.

    Code Block
    sudo python vrouter.py
  • The vRouter emulator should establish XMPP stream with controller. You can choose the action to perform from command-line menu. Note that it is prototype (work in progress) application so far and not all function may work properly. Actually, the code from Gerrit patch handles only the device-related operations. As a result of above command you should see new device registered in the ONOS core.

Demo and Results

...

Widget Connector
urlhttps://www.youtube.com/watch?v=FDswSlhkWwU

Gerrit

...

reviews:

https://gerrit.onosproject.org/#/c/16781/

...