Skip to content

Instantly share code, notes, and snippets.

@yasuhito
yasuhito / -
Created February 29, 2016 05:09
/home/yasuhito/.rvm/rubies/ruby-2.1.8/bin/ruby -I/home/yasuhito/.rvm/gems/ruby-2.1.8/gems/rspec-core-3.2.3/lib:/home/yasuhito/.rvm/gems/ruby-2.1.8/gems/rspec-support-3.2.2/lib /home/yasuhito/.rvm/gems/ruby-2.1.8/gems/rspec-core-3.2.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
You are using HTTP Gem 0.5.1. WebMock supports version >= 0.6.0.
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
/home/yasuhito/.rvm/gems/ruby-2.1.8/gems/sinatra-contrib-1.4.4/lib/sinatra/respond_with.rb:4: warning: variable $KCODE is no longer effective; ignored
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
VNetAPIClient
class RoutingSwitch < Trema::Controller
delegate :switch_ready, to: :@topology
delegate :features_reply, to: :@topology
delegate :switch_disconnected, to: :@topology
delegate :port_modify, to: :@topology
def packet_in(dpid, packet_in)
@topology.packet_in(dpid, packet_in)
@path_manager.packet_in(dpid, packet_in) unless packet_in.lldp?
@yasuhito
yasuhito / rest.rb
Last active December 11, 2015 08:28
get 'slices/:slice_id' do
rest_api { Slice.find_by!(name: params[:slice_id]) }
end
class Slice
def self.find_by!(query)
# ...
remote_klass =
Trema.trema_process('RoutingSwitch', socket_dir).controller.slice
remote_klass.find_by!(query)
# L2 routing path manager
class PathManager < Trema::Controller
def packet_in(_dpid, message)
path = maybe_create_shortest_path(message)
ports = path ? [path.out_port] : @graph.external_ports
ports.each do |each|
send_packet_out(each.dpid,
raw_data: message.raw_data,
actions: SendOutPort.new(each.number))
end
class RoutingSwitch < Trema::Controller
# ...
def start_topology
TopologyController.new { |topo| topo.add_observer @path_manager }.start
end
end
class PathManager < Trema::Controller
# ...
def delete_link(port_a, port_b, _topology)
@yasuhito
yasuhito / git_issue.zsh
Last active September 4, 2015 10:08
https://gist.github.com/azu/d3fb5f970e4ff945ead4 を percol から peco にしただけのモノです
# peco + git issue
function found_command { which $1 &> /dev/null }
function is_issued() {
ISSUE_TYPE=$(git config issue.type 2>/dev/null)
if [ "$ISSUE_TYPE" != "" ]; then
return 0
else
return 1
fi
}
@yasuhito
yasuhito / gist:9262976
Last active August 29, 2015 13:56
Trema を使っている人々

ソフトウェア・サービス

Wakame-vdc: Datacenter Hypervisor - Open Source Cloud Computing / IaaS

  • プレスリリース: http://axsh.jp/news/publicity/894
  • ソースコード: https://github.com/axsh/wakame-vdc/
  • 主なユーザ
    • 国立情報学研究所 (プライベートクラウド)
    • 九州電力 (プライベートクラウド)
    • 大手メーカー (顧客向けWebシステムの基盤として)
    • NTTPCコミュニケーションズ WebARENA VPSクラウド (パブリッククラウド)
    • 京セラコミュニケーションシステム GreenOffice Unified Cloud (パブリッククラウド)
@yasuhito
yasuhito / gist:9085031
Last active August 29, 2015 13:56
Trema ハンズオン@沖縄

Trema ハンズオン@沖縄

ハンズオンで使う VM とセットアップ方法を説明します。

当日までに VM にログインできることを確認 しておいてください。

必要なハードウェア

@yasuhito
yasuhito / gist:6596629
Created September 17, 2013 16:16
Hello World
$><<[[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []], [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []
git clone https://github.com/trema/trema-edge.git
Cloning into 'trema-edge'...
remote: Counting objects: 15697, done.
remote: Compressing objects: 100% (3932/3932), done.
remote: Total 15697 (delta 12073), reused 15309 (delta 11690)
Receiving objects: 100% (15697/15697), 13.43 MiB | 881 KiB/s, done.
Resolving deltas: 100% (12073/12073), done.