Page tree

Have questions? Stuck? Please check our FAQ for some common questions and answers.

This wiki documents the current development version of ONOS (master). Refer to the Wiki Archives for documentation for all previous versions of ONOS.

Skip to end of metadata
Go to start of metadata

What is Intel® Developer Zone NFV/DPDK Devlab?

This two day deep-dive session has experts, from Intel and other companies, talk about the various hardware and software technologies Intel has been working on to make the life of an NFV developer easier. ONOS will be one of the open source projects on the agenda. On Day 2, a 2.5 hour ONOS hands-on training session will be lead by Murat from Argela and Jin Gan from Huawei.

At the end of Day 2, participants will form teams and propose an open source project to work on. Participants will be getting hardware access for 15 days after the workshop to work on their project, and participants will need to submit their project before December 23. Organizers will declare the winners by January 12, and the winning teams will get a chance to speak on a subsequent event. 



Grand Prize of $2,000 cash

1st, 2nd and 3rd runner up will also get DPDK in a box dev kit.

When is the event?

December 8 - 9, 2016

Event Register & Details



Tentative Schedule:

When is ONOS hands-on training session?

December 9 (Day 2), 1:00 PM - 3:30 PM

ONOS' Pre-Session VM Preparation and Guide

1. Set up your environment

Install required software

You will need to acquire two files: a VirtualBox installer and the VM 

After you have downloaded VirtualBox, install it, then go to the next section to verify that the VM is working on your system.

Create Virtual Machine

Double-click on the downloaded tutorial zipfile. This will give you an OVF file. Open the OVF file, this will open virtual box with an import dialog.

Click on import. When the import is finished start the VM and log in using:



Example : OnePing (Source code)

* Copyright 2015 Open Networking Laboratory
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and
* limitations under the License.
package org.onos.oneping;

import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IPv4;
import org.onlab.packet.MacAddress;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Objects;
import java.util.Optional;
import java.util.Timer;
import java.util.TimerTask;

import static;
import static;

* Sample application that permits only one ICMP ping per minute for a unique
* src/dst MAC pair per switch.
@Component(immediate = true)
public class OnePing {

private static Logger log = LoggerFactory.getLogger(OnePing.class);

private static final String MSG_PINGED_ONCE =
"Thank you, Vasili. One ping from {} to {} received by {}";
private static final String MSG_PINGED_TWICE =
"What are you doing, Vasili?! I said one ping only!!! " +
"Ping from {} to {} has already been received by {};" +
" 60 second ban has been issued";
private static final String MSG_PING_REENABLED =
"Careful next time, Vasili! Re-enabled ping from {} to {} on {}";

private static final int PRIORITY = 128;
private static final int DROP_PRIORITY = 129;
private static final int TIMEOUT_SEC = 60; // seconds

@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected CoreService coreService;

@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected FlowObjectiveService flowObjectiveService;

@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected FlowRuleService flowRuleService;

@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected PacketService packetService;

private ApplicationId appId;
private final PacketProcessor packetProcessor = new PingPacketProcessor();
private final FlowRuleListener flowListener = new InternalFlowListener();

// Selector for ICMP traffic that is to be intercepted
private final TrafficSelector intercept = DefaultTrafficSelector.builder()

// Means to track detected pings from each device on a temporary basis
private final HashMultimap<DeviceId, PingRecord> pings = HashMultimap.create();
private final Timer timer = new Timer("oneping-sweeper");

public void activate() {
appId = coreService.registerApplication("org.onosproject.oneping",
() ->"Periscope down."));
packetService.addProcessor(packetProcessor, PRIORITY);
packetService.requestPackets(intercept, PacketPriority.CONTROL, appId,

public void deactivate() {

// Processes the specified ICMP ping packet.
private void processPing(PacketContext context, Ethernet eth) {
DeviceId deviceId = context.inPacket().receivedFrom().deviceId();
MacAddress src = eth.getSourceMAC();
MacAddress dst = eth.getDestinationMAC();
PingRecord ping = new PingRecord(src, dst);
boolean pinged = pings.get(deviceId).contains(ping);

if (pinged) {
// Two pings detected; ban further pings and block packet-out
log.warn(MSG_PINGED_TWICE, src, dst, deviceId);
banPings(deviceId, src, dst);
} else {
// One ping detected; track it for the next minute, src, dst, deviceId);
pings.put(deviceId, ping);
timer.schedule(new PingPruner(deviceId, ping), TIMEOUT_SEC * 1000);

// Installs a temporary drop rule for the ICMP pings between given srd/dst.
private void banPings(DeviceId deviceId, MacAddress src, MacAddress dst) {
TrafficSelector selector = DefaultTrafficSelector.builder()
TrafficTreatment drop = DefaultTrafficTreatment.builder()

flowObjectiveService.forward(deviceId, DefaultForwardingObjective.builder()

// Indicates whether the specified packet corresponds to ICMP ping.
private boolean isIcmpPing(Ethernet eth) {
return eth.getEtherType() == Ethernet.TYPE_IPV4 &&
((IPv4) eth.getPayload()).getProtocol() == IPv4.PROTOCOL_ICMP;

// Intercepts packets
private class PingPacketProcessor implements PacketProcessor {
public void process(PacketContext context) {
Ethernet eth = context.inPacket().parsed();
if (isIcmpPing(eth)) {
processPing(context, eth);

// Record of a ping between two end-station MAC addresses
private class PingRecord {
private final MacAddress src;
private final MacAddress dst;

PingRecord(MacAddress src, MacAddress dst) {
this.src = src;
this.dst = dst;

public int hashCode() {
return Objects.hash(src, dst);

public boolean equals(Object obj) {
if (this == obj) {
return true;
if (obj == null || getClass() != obj.getClass()) {
return false;
final PingRecord other = (PingRecord) obj;
return Objects.equals(this.src, other.src) && Objects.equals(this.dst, other.dst);

// Prunes the given ping record from the specified device.
private class PingPruner extends TimerTask {
private final DeviceId deviceId;
private final PingRecord ping;

public PingPruner(DeviceId deviceId, PingRecord ping) {
this.deviceId = deviceId; = ping;

public void run() {
pings.remove(deviceId, ping);

// Listens for our removed flows.
private class InternalFlowListener implements FlowRuleListener {
public void event(FlowRuleEvent event) {
FlowRule flowRule = event.subject();
if (event.type() == RULE_REMOVED && flowRule.appId() == {
Criterion criterion = flowRule.selector().getCriterion(ETH_SRC);
MacAddress src = ((EthCriterion) criterion).mac();
MacAddress dst = ((EthCriterion) criterion).mac();
log.warn(MSG_PING_REENABLED, src, dst, flowRule.deviceId());

  • No labels