Cbench結果

自作ネットワークコントローラに対して負荷テストを行った。
決して悪いスコアではないはず。

Load Regulatorなし版

瞬間的な性能は出るものの、
長時間駆動には耐えられない。
※メモリがリークしてVMそのものがクラッシュしてしまう。

Load Regulatorあり版

性能はかなり劣化するものの、
安定して動作する。

書きかけ 自作OpenFlow Controller(OpenFlow 1.5について①)

最近、OpenFlow1.5が公開されました。

https://www.opennetworking.org/images/stories/downloads/sdn-resources/onf-specifications/openflow/openflow-switch-v1.5.0.noipr.pdf

大まかな特徴としては(ovs/OPENFLOW-1.1+.md at master · openvswitch/ovs · GitHub)、

  • Time scheduled bundles [EXT-340] [optional for OF1.5+]
  • Egress Tables [EXT-306] [optional for OF1.5+]
  • Packet Type aware pipeline Prototype for OVS was done during specification. [EXT-112] [optional for OF1.5+]
  • Extensible Flow Entry Statistics [EXT-334] [required for OF1.5+]
  • Flow Entry Statistics Trigger [EXT-335] [optional for OF1.5+]
  • Controller connection status Prototype for OVS was done during specification. [EXT-454] [optional for OF1.5+]
  • Meter action [EXT-379] [required for OF1.5+ if metering is supported]
  • Enable setting all pipeline fields in packet-out Prototype for OVS was done during specification. [EXT-427] [required for OF1.5+]
  • Port properties for pipeline fields Prototype for OVS was done during specification. [EXT-388] [optional for OF1.5+]
  • Port property for recirculation Prototype for OVS was done during specification. [EXT-399] [optional for OF1.5+]

特に、EXT-306のEgress Tablesについては、Egress processingという概念が追加され、 考え方も変わっています。が、この辺はいまいち調べきれてないです。

f:id:shun3382:20150311123333p:plain

また、今までテーブル間で一貫して利用できるフィールドに加え、 openflow_basicクラスとは別にpacket_regsクラスが追加されています。 これは、nicira_extで利用可能だったreg(x)フィールドに由来してそうです。 metadataとは別に、packet_regsフィールドを持つのは、vlanidや、input_port等 各マッチフィールドの値を格納し、1つのテーブルで更に処理を分ける等するのでしょうか。 nicira_extにある、loadやmoveは、openflow1.5では、set_fieldと、copy_fieldとして、 アクションに追加されているようです。

Erlangで書くとこんな感じに書けそうです。

gist9c7e4ea87b9f282354c3

個人的には、nicira_extで提供されていたlearnアクションが specとして利用できると、コントローラの実装ももっと簡単になるのになー と思ったりするばかりです。

つづく

書きかけ 自作OpenFlow Controller

自作OpenFlow Controllerを作ってみています。
この例はNXを使ってopenvswitchへ転送情報を自己学習するように命令をしています。

table 0はポートに入力されたパケットを元に、table1に対して学習を行い、かつtable1へ遷移する命令を書き込んています。
table 1のビルトインフローとして、宛先アドレスに一致するフロー情報がなければ、floodするフローに当たり全ポートからパケットをフラッディングするものを書き込んでいます。

gist35594bb37a1b5d944ce7

LINC-Switchをテストコードの中で起動する

こんなふうにすると、とりあえず動くっぽい。 これまで、何か開発するときにスイッチを上げたりしてた手間を なくせそうな予感。そううまくは行かないかもしれないが…。

ちょうど、コンフィグを入れているような感じ。 内容はとりあえずデフォルトのsys.configの内容。

これで、コントローラの指定などすると、 リスナ(ハンドラ部?)でメッセージのテストがそのままできそう。 うん、これは良さそう。

teardownするときは、stopで良いんじゃないかな。 今度はこれでテストを書いてみよう。

OFパケットをデコードして遊んでみた③

table_features全体をデコードするようにしてみました。 巨大ですね…。これはヒドい。

iex(7)> :timer.tc fn -> do_decode table_features end
{755,
 {:ok,
  [version: 4, type: :multipart_request, xid: 0,
   body: [flags: [:more],
    body: [[table_id: 0, name: "Flow Table 0x00",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, :icmpv6_type,
          :icmpv6_code, :ipv6_nd_target, ...]}],
       [wildcards: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, :icmpv6_type,
          :icmpv6_code, ...]}],
       [write_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, :icmpv6_type, ...]}],
       [apply_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, ...]}],
       [experimenter: [experimenter: 101, exp_type: 0, data: ""]],
       [experimenter: [experimenter: 101, exp_type: 1, data: <<0, 0, 0, 1>>]],
       [experimenter: [experimenter: 101, exp_type: 2,
         data: <<0, 0, 0, 1, 0, 0, 0, 2>>]]]],
     [table_id: 1, name: "Flow Table 0x01",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, :icmpv6_type,
          :icmpv6_code, ...]}],
       [wildcards: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, :icmpv6_type, ...]}],
       [write_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, ...]}],
       [apply_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, ...]}]]],
     [table_id: 2, name: "Flow Table 0x02",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
          22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, :icmpv6_type, ...]}],
       [wildcards: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, ...]}],
       [write_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, ...]}],
       [apply_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, ...]}]]],
     [table_id: 3, name: "Flow Table 0x03",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
          23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, ...]}],
       [wildcards: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, ...]}],
       [write_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, ...]}],
       [apply_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, ...]}]]],
     [table_id: 4, name: "Flow Table 0x04",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
          24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, ...]}],
       [wildcards: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, ...]}],
       [write_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, ...]}],
       [apply_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, ...]}]]],
     [table_id: 5, name: "Flow Table 0x05",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
          24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, ...]}],
       [wildcards: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, ...]}],
       [write_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          ...]}],
       [apply_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          ...]}]]],
     [table_id: 6, name: "Flow Table 0x06",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
          25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, ...]}],
       [wildcards: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          ...]}],
       [write_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, ...]}],
       [apply_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, ...]}]]],
     [table_id: 7, name: "Flow Table 0x07",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
          26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          ...]}],
       [wildcards: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, ...]}],
       [write_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, ...]}],
       [apply_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, ...]}]]],
     [table_id: 8, name: "Flow Table 0x08",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
          27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, ...]}],
       [wildcards: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, ...]}],
       [write_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, ...]}],
       [apply_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, ...]}]]],
     [table_id: 9, name: "Flow Table 0x09",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
          27, 28, 29, 30, 31, 32, 33, 34, 35, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, ...]}],
       [wildcards: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, ...]}],
       [write_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, ...]}],
       [apply_setfield: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, ...]}]]]]]], ""}}

OFパケットをデコードして遊んでみた②

matchやactions廻りをデコードしてみました。 ここのミソは、デコードした時にビットマップなフラグを そのままの数値にするのではなく、ビットマップをアトムの配列にしてます。 とても読みやすいですね。

ex(9)> :timer.tc fn ->  do_decode table_features end
{397,
 {:ok,
  [version: 4, type: :multipart_request, xid: 0,
   body: [flags: [:more],
    body: [[table_id: 0, name: "Flow Table 0x00",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, :icmpv6_type,
          :icmpv6_code, :ipv6_nd_target, ...]}], nil, nil, nil, nil, nil, nil]],
     [table_id: 1, name: "Flow Table 0x01",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, :icmpv6_type,
          :icmpv6_code, ...]}], nil, nil, nil]],
     [table_id: 2, name: "Flow Table 0x02",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
          22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, :icmpv6_type, ...]}],
       nil, nil, nil]],
     [table_id: 3, name: "Flow Table 0x03",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
          23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, :ipv6_flabel, ...]}], nil, nil, nil]],
     [table_id: 4, name: "Flow Table 0x04",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
          24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, :ipv6_dst, ...]}], nil, nil, nil]],
     [table_id: 5, name: "Flow Table 0x05",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
          24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, :ipv6_src, ...]}], nil, nil, nil]],
     [table_id: 6, name: "Flow Table 0x06",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
          25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          :arp_tha, ...]}], nil, nil, nil]],
     [table_id: 7, name: "Flow Table 0x07",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
          26, 27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, :arp_sha,
          ...]}], nil, nil, nil]],
     [table_id: 8, name: "Flow Table 0x08",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
          27, 28, 29, 30, 31, 32, 33, 34, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, ...]}], nil,
       nil, nil]],
     [table_id: 9, name: "Flow Table 0x09",
      matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
      max_entries: 16777216,
      properties: [[instructions: {:instruction_ids,
         [goto_table: 131076, write_actions: 262148, clear_actions: 393220]}],
       [next_tables: {:next_table_ids,
         [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
          27, 28, 29, 30, 31, 32, 33, 34, 35, ...]}],
       [write_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [apply_actions: {:action_ids,
         [:output, :group, :set_queue, :set_mpls_ttl, :dec_mpls_ttl,
          :set_nw_ttl, :dec_nw_ttl, :copy_ttl_out, :copy_ttl_in, :push_vlan,
          :pop_vlan, :push_mpls, :pop_mpls, :push_pbb, :pop_pbb, :set_field]}],
       [match: {:oxm_ids,
         [:in_port, :metadata, :eth_dst, :eth_src, :eth_type, :vlan_vid,
          :vlan_pcp, :ip_dscp, :ip_ecn, :ip_proto, :ipv4_src, :ipv4_dst,
          :tcp_src, :tcp_dst, :udp_src, :udp_dst, :sctp_src, :sctp_dst,
          :icmpv4_type, :icmpv4_code, :arp_op, :arp_spa, :arp_tpa, ...]}], nil,
       nil, nil]]]]], ""}}

OFパケットをデコードして遊んでみた

table features をデコードしてみると、こんな感じになっていました。 requestのクセに結構複雑ですね。しかもこれまだ途中なんですよね。 propertiesのあたりが後9倍くらいは複雑になるかもしれませんです。

未だOF1.3の仕様書の読み込みが足りていない模様。 これは本当にrequestメッセージなのか…??

do_decode table_features
{:ok,
 [version: 4, type: :multipart_request, xid: 0,
  body: [flags: [:more],
   body: [[table_id: 0, name: "Flow Table 0x00",
     matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     max_entries: 16777216,
     properties: [[instruction_ids: [goto_table: 131076, write_actions: 262148,
        clear_actions: 393220]], nil, nil, nil, nil, nil, nil, nil, nil, nil,
      nil]],
    [table_id: 1, name: "Flow Table 0x01",
     matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     max_entries: 16777216,
     properties: [[instruction_ids: [goto_table: 131076, write_actions: 262148,
        clear_actions: 393220]], nil, nil, nil, nil, nil, nil, nil]],
    [table_id: 2, name: "Flow Table 0x02",
     matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     max_entries: 16777216,
     properties: [[instruction_ids: [goto_table: 131076, write_actions: 262148,
        clear_actions: 393220]], nil, nil, nil, nil, nil, nil, nil]],
    [table_id: 3, name: "Flow Table 0x03",
     matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     max_entries: 16777216,
     properties: [[instruction_ids: [goto_table: 131076, write_actions: 262148,
        clear_actions: 393220]], nil, nil, nil, nil, nil, nil, nil]],
    [table_id: 4, name: "Flow Table 0x04",
     matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     max_entries: 16777216,
     properties: [[instruction_ids: [goto_table: 131076, write_actions: 262148,
        clear_actions: 393220]], nil, nil, nil, nil, nil, nil, nil]],
    [table_id: 5, name: "Flow Table 0x05",
     matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     max_entries: 16777216,
     properties: [[instruction_ids: [goto_table: 131076, write_actions: 262148,
        clear_actions: 393220]], nil, nil, nil, nil, nil, nil, nil]],
    [table_id: 6, name: "Flow Table 0x06",
     matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     max_entries: 16777216,
     properties: [[instruction_ids: [goto_table: 131076, write_actions: 262148,
        clear_actions: 393220]], nil, nil, nil, nil, nil, nil, nil]],
    [table_id: 7, name: "Flow Table 0x07",
     matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     max_entries: 16777216,
     properties: [[instruction_ids: [goto_table: 131076, write_actions: 262148,
        clear_actions: 393220]], nil, nil, nil, nil, nil, nil, nil]],
    [table_id: 8, name: "Flow Table 0x08",
     matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     max_entries: 16777216,
     properties: [[instruction_ids: [goto_table: 131076, write_actions: 262148,
        clear_actions: 393220]], nil, nil, nil, nil, nil, nil, nil]],
    [table_id: 9, name: "Flow Table 0x09",
     matadata_match: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     metadata_write: <<255, 255, 255, 255, 255, 255, 255, 255>>,
     max_entries: 16777216,
     properties: [[instruction_ids: [goto_table: 131076, write_actions: 262148,
        clear_actions: 393220]], nil, nil, nil, nil, nil, nil, nil]]]]], ""}
````