This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'sinatra/base' | |
require 'webrick' | |
require 'log' | |
class Time | |
def to_s | |
strftime( "%Y-%m-%d %H:%M:%S" ) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "sqlite3" | |
class Slice | |
SUCCEEDED = 0 | |
FAILED = -1 | |
NO_SLICE_FOUND = -2 | |
NO_BINDING_FOUND = -3 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ForwardingEntry | |
include DefaultLogger | |
attr_reader :mac | |
attr_reader :port_no | |
attr_reader :dpid | |
attr_reader :vid | |
attr_writer :age_max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "pio/type/mac-address" | |
module Pio | |
module Type | |
module Ieee802dot1qHeader | |
def ieee802dot1q_header options | |
class_eval do | |
mac_address :destination_mac | |
mac_address :source_mac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ICMP Type | |
ECHO_REQUEST = 8 | |
ECHO_REPLY = 0 | |
TTL_EXCEEDED = 11 | |
DESTINATION_UNREACHABLE = 3 | |
# DESTINATION_UNREACHABLE code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module( flower_dpid_table ). | |
-behaviour(gen_server). | |
%% gen_server callbacks | |
-export([ init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3 ]). | |
%% APIs | |
-export( [ insert_dpid_entry/2, delete_dpid_entry/1, get_switches/0 ] ). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
package org.openflow.example; | |
import java.io.IOException; | |
import java.net.InetAddress; | |
import java.nio.channels.SelectionKey; | |
import java.nio.channels.ServerSocketChannel; | |
import java.nio.channels.SocketChannel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/switches/?' | |
get '/switches/:datapath_id/?' | |
get '/switches/:datapath_id/description/?' | |
get '/switches/:datapath_id/features/?' | |
get '/switches/:datapath_id/ports/?' | |
get '/switches/:datapath_id/ports/:port_no/?' | |
post '/switches/whitelist/add/' | |
get '/switches/whitelist/show/' | |
delete '/switches/whitelist/del/' | |
post '/switches/blacklist/add/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#<Sinatra::Request:0x7f3055151ad0 | |
@env= | |
{"rack.logger"=> | |
#<Rack::NullLogger:0x7f30551659e0 | |
@app= | |
#<Rack::Protection::FrameOptions:0x7f3055165c38 | |
@app= | |
#<Rack::Protection::HttpOrigin:0x7f3055165dc8 | |
@app= | |
#<Rack::Protection::IPSpoofing:0x7f3055165f58 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "bindata" | |
require "pio/dhcp/frame" | |
require "pio/dhcp/request" | |
require "pio/dhcp/reply" | |
module Pio | |
# Dhcp parser and generator. |