RUNOS Developer Guide

Requirements to RUNOS developer


RUNOS Application Development

Structure of Application

Each user application for RUNOS have the following structure:

--docs
  |--app.rst
--include
  |--App.hpp
--src
  |--App.cc
--CMakeLists.txt
--conanfile.py
--README.md
--settings.json

Folder docs contains app.rst file for automatic generation of documentation in the Sphinx.

Src and include folders contains sources of your application.

Basic Methods of Application

Registration of Application

REGISTER_APPLICATION(your_class, list_of_dependeces)
where:
  • your_class - name of your application class;
  • list_of_dependeces - list of applications on which your application depends.

Example of YourApp registration:

namespace runos {

REGISTER_APPLICATION(YourApp, {"controller", "switch-manager",
                                "topology", ""})

// Methods implementation of YourApp class

} // namespace runos

Init Application

To init your application you must define init method in your application:

void init(Loader *loader, const Config &config)

In implementation of this method:

  • you can extract settings from RUNOS configuration file (runos-settings.json);
  • you can define dependencies on the other applications;
  • you can define handlers;
  • you can defines connects <signal to slot> between applications.

Example of init method implementation:

// YourApp.hpp
#include "Application.hpp"
#include "Loader.hpp"

namespace runos {

class YourApp : public Application
{
    Q_OBJECT
    SIMPLE_APPLICATION(YourApp, "your-app")
public:
    void init(Loader* loader, const Config& config) override;
}

} // namespace runos

// YourApp.cc
void YourApp::init(Loader *, const Config& )
{
    LOG(INFO) << "init YourApp ... ";
}

Start Application

void startUp(class Loader *)

Startup methods are launched after all applications are initialized.

Example of startUp method implementation:

#include "Application.hpp"
#include "Loader.hpp"

void YourApp::startUp(Loader *)
{
    LOG(INFO) << "All services inited";
}

Logging

You can use logging of different levels: INFO, WARNING, ERROR.

Examples:

LOG(INFO) << "Information message";
LOG(WARNING) << "Warning";
LOG(ERROR) << "Error";

Extract Settings from Configuration File

Flow Tables

Signals

Packet Parsing

OpenFlow Message Sending

Matching Fields

RUNOS::OXM support the following Match fields from OpenFlow 1.3 protocol .

Depending on fields such as the MAC address and IP address, you can further specify the mask.

Field Description Basic Type Mask Support
in_port Port number of receiving port uint8_t no
eth_type Frame type of Ethernet uint16_t no
eth_src Source MAC address of Ethernet ethernet yes
eth_dst Destination MAC address of Ethernet ethernet yes
ip_proto Protocol type of IP uint8_t no
ipv4_src Source IP address of IPv4 uint32_t yes
ipv4_dst Destination IP address of IPv4 uint32_t yes
tcp_src Source port number of TCP uint16_t no
tcp_dst Destination port number of TCP uint16_t no
udp_src Source port number of UDP uint16_t no
udp_dst Destination port number of UDP uint16_t no
arp_spa Source IP address of ARP uint32_t yes
arp_tpa Target IP address of ARP uint32_t yes
arp_sha Source MAC address of ARP uint32_t yes
arp_tha Target MAC address of ARP uint32_t yes
arp_op Operation code of ARP uint16_t no
vlan_vid VLAN identificator uint16_t no
ipv6_src Source IP address of IPv6 IPv6Addr yes
ipv6_dst Destination IP address of IPv6 IPv6Addr yes
icmp_type Type of ICMP uint8_t no
icmp_code Code of ICMP uint8_t no

Packet Parsing


RUNOS Core

  • Application Class
  • Loader Class
  • Logger Class

Application

Application can have one of the following states:
  • APP_REGISTERED,
  • APP_INITIALIZING,
  • APP_INITIALIZED,
  • APP_STARTED.

Loader

Loader states:
  • INITIALIZING,
  • STARTING,
  • RUNNING.

RUNOS Core Applications

RUNOS Core consists from the following core applications:

OFServer

OFServer supports OpenFlow connections with switches and it processes received OpenFlow messages.

Dependencies: DpidChecker

Files: OFServer.hpp, OFServer.cc,

Controller

Controller is …

Dependencies:

Files: Controller.hpp, Controller.cc

DpidChecker

DpidChecker is …

Dependencies:

Files: DpidChecker.hpp, DpidChecker.cc

Switch Manager

Switch Manager provides switch discovery and controls switch state in the network topology.

Dependencies:

Files: SwitchManager.hpp, SwitchManager.cc

Switch Ordering

Switch Ordering provides …

Dependencies:

Files: SwitchOrdering.hpp, SwitchOrdering.cc

Topology

Topology provides topology discovery and controls network topology state in the real time.

Dependencies:

Files: Topology.hpp, Topology.cc

Recovery Manager

Recovery Manager provides active/standby reservation

Dependencies:

Files: RecoveryManager.hpp, RecoveryManager.cc

Database Connector

Database Connector provides controller connection to Redis in-memory data store.

Dependencies:

Files: DataBaseConnector.hpp, DataBaseConnector.cc

Flow Entries Verifier

Flow Entries Verifier provides …

Dependencies:

Files: FlowEntriesVerifier.hpp, FlowEntriesVerifier.cc

OpenFlow Message Sender

OpenFlow Message Sender provides sending OpenFlow messages to switches.

Dependencies:

Files: OFMsg-Sender.hpp, OFMsg-Sender.cc

Stats Bucket Manager

Stats Bucket Manager …

Dependencies:

Files: StatsBucketManager.hpp, StatsBucketManager.cc

Stats Rules Manager

Stats Rules Manager provides …

Dependencies:

Files: StatsRulesManager.hpp, StatsRulesManager.cc

Rest-Listiner

Rest-Listiner provides REST access to controller applications.

Dependencies:

Files: Rest-Listiner.hpp, Rest-Listiner.cc

Command Line

Command Line provides CLI access to controller applications.

Dependencies:

Files: Command-Line.hpp, Command-Line.cc