Skip to content

Instantly share code, notes, and snippets.

View shun159's full-sized avatar
☁️
In da cloud

Eishun Kondoh shun159

☁️
In da cloud
View GitHub Profile
-module(calculate_port_mask).
-export([calc/2]).
calc(Min, Max) when Min < Max->
calc(Min, Max, 0, 16);
calc(_, _) ->
[].
calc(Min, Max, Length0, BitSize) ->
fields = {
'image': fields.DictOfStringsField(nullable=False),
# This should eventually be deconstructed into component parts
'instance_properties': fields.ObjectField('Instance'),
'instance_type': fields.ObjectField('Flavor', nullable=True),
'num_instances': fields.IntegerField(nullable=False, default=1),
'force_hosts': fields.StringField(nullable=True),
'force_nodes': fields.StringField(nullable=True),
'pci_requests': fields.ListOfObjectsField('PCIRequest', nullable=True),
'retry': fields.ObjectField('Retry', nullable=True),
(setq tab-width 2) ;; or any other preferred value
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq standard-indent 2)
(prefer-coding-system 'utf-8)
(setq quail-japanese-use-double-n 't)
(setq gnutls-min-prime-bits 1024)
(require 'package)
@shun159
shun159 / self-learning-switch.md
Last active September 7, 2015 09:08
self learning-switch

nicira拡張では、nicira_headerという構造体にメッセージを格納してやる必要があります。

/* Header for Nicira vendor requests and replies. */
struct nicira_header {
    struct ofp_header header;   /* type == OFPT_VENDOR */
    ovs_be32 vendor;            /* NX_VENDOR_ID. */
    ovs_be32 subtype;           /* See the NXT numbers in ofp-msgs.h. */
};
OFP_ASSERT(sizeof(struct nicira_header) == 16);
(setq gnutls-min-prime-bits 1024)
(require 'package)
(setq-default indent-tabs-mode nil)
; Add package-archives
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
# bin/cbench --port 6653 --switches 6 --loops 10 --ms-per-test 1000 --delay 1000 -t
cbench: controller benchmarking tool
   running in mode 'throughput'
   connecting to controller at localhost:6653
   faking 6 switches :: 10 tests each; 1000 ms per test
   with 100000 unique source MACs per switch
   starting test with 1000 ms delay after features_reply
   ignoring first 1 "warmup" and last 0 "cooldown" loops
 debugging info is off
# bin/cbench --port 6653 --switches 32 --loops 10 --ms-per-test 1000 --delay 1000
cbench: controller benchmarking tool
   running in mode 'latency'
   connecting to controller at localhost:6653
   faking 32 switches :: 10 tests each; 1000 ms per test
   with 100000 unique source MACs per switch
   starting test with 1000 ms delay after features_reply
   ignoring first 1 "warmup" and last 0 "cooldown" loops
 debugging info is off
ovs-ofctl dump-flows breth0
NXST_FLOW reply (xid=0x4):
cookie=0x0, duration=693447.208s, table=0, n_packets=10102518, n_bytes=1589674138, idle_age=0, hard_age=65534, priority=0 actions=NORMAL
ovs-ofctl dump-flows pool
NXST_FLOW reply (xid=0x4): flags=[more]
cookie=0x56024f2d6159d333, duration=693374.596s, table=0, n_packets=0, n_bytes=0, idle_age=65534, hard_age=65534, priority=32764 actions=note:00.14.00.00.00.00.80.00.70.68.79.73.5f.64.65.66.61.75.6c.74.5f.64.72.6f.70.00.00.00.00.00
cookie=0x6d9f8c311cddaed6, duration=693374.596s, table=0, n_packets=0, n_bytes=0, idle_age=65534, hard_age=65534, priority=65535,dl_dst=01:80:c2:00:00:00/ff:ff:ff:ff:ff:f0 actions=note:00.11.00.00.00.00.80.00.70.68.79.73.5f.62.70.64.75.5f.64.72.6f.70.00.00.00.00.00.00.00.00
cookie=0x2439ec19261ddf46, duration=693374.596s, table=0, n_packets=0, n_bytes=0, idle_age=65534, hard_age=65534, priority=65535,dl_dst=01:00:0c:cc:cc:c0/ff:ff:ff:ff:ff:f0 actions=note:00.11.00.00.00.00.80.00.70.68.79.73.5f.62.70.64.75.5f.64.72.6f.70.00.
@shun159
shun159 / nsx_hv_dump_flows.md
Created May 8, 2015 11:29
nsx_hv_dump_flows
ubuntu@ubuntu:~$ sudo ovs-ofctl dump-flows br0
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=348684.018s, table=0, n_packets=14786838, n_bytes=5290610226, idle_age=0, hard_age=65534, priority=0 actions=NORMAL

buntu@ubuntu:~$ sudo ovs-ofctl dump-flows br-int
NXST_FLOW reply (xid=0x4): flags=[more]
 cookie=0x36f56ad8b59e686a, duration=348715.026s, table=0, n_packets=145, n_bytes=23513, idle_age=65534, hard_age=65534, priority=32764 actions=note:00.14.00.00.00.00.80.00.70.68.79.73.5f.64.65.66.61.75.6c.74.5f.64.72.6f.70.00.00.00.00.00
 cookie=0x6ab2898ad5d689d8, duration=348715.026s, table=0, n_packets=0, n_bytes=0, idle_age=65534, hard_age=65534, priority=65535,dl_dst=01:80:c2:00:00:00/ff:ff:ff:ff:ff:f0 actions=note:00.11.00.00.00.00.80.00.70.68.79.73.5f.62.70.64.75.5f.64.72.6f.70.00.00.00.00.00.00.00.00
 cookie=0x6d3c4fc21a75facf, duration=348715.026s, table=0, n_packets=0, n_bytes=0, idle_age=65534, hard_age=65534, priority=65535,dl_dst=01:00:0c:cc:cc:c0/ff:ff:ff:ff:ff:f0 actions=note:00.11.00.00.00.0
ovs-ofctl dump-flows breth0
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=693031.019s, table=0, n_packets=10332858, n_bytes=1660703448, idle_age=0, hard_age=65534, priority=0 actions=NORMAL

ovs-ofctl dump-flows breth1
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=693032.011s, table=0, n_packets=6, n_bytes=468, idle_age=65534, hard_age=65534, priority=0 actions=NORMAL

ovs-ofctl dump-flows nvp-patch