Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * Author: Zoltán Lajos Kis <zoltan.lajos.kis@ericsson.com>
  3.  */
  4.  
  5. "use strict";
  6.  
  7. module.exports.bin = [
  8.                 0x02,                          // version = 2
  9.                 0x0e,                          // type = 14
  10.                 0x00, 0xb0,                    // length = 176
  11.                 0x49, 0x96, 0x02, 0xd2,        // xid = 1234567890
  12.                   0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, // cookie = "1122334455667788"
  13.                   0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xba, 0xbb, // cookie_mask = "aaabacadaeafbabb"
  14.                   0x10,                                           // table_id = 16,
  15.                   0x00,                                           // command = 0,
  16.                   0x00, 0x00,                                     // idle_timeout = 0 (disabled)
  17.                   0x00, 0xff,                                     // hard_timeout = 255
  18.                   0x01, 0x00,                                     // priority = 256
  19.                   0x00, 0x00, 0x00, 0x01,                         // buffer_id = 1,
  20.                   0x00, 0x00, 0x00, 0x08,                         // out_port = 8,
  21.                   0xff, 0xff, 0xff, 0xff,                         // out_group = 0 (disabled)
  22.                   0x00, 0x03,                                     // flags = 3
  23.                   0x00, 0x00,                                     // pad
  24.                     0x00, 0x00,                         // type = 0
  25.                     0x00, 0x58,                         // length = 88
  26.                     0x00, 0x00, 0x00, 0x10,             // in_port = 16,
  27.                     0x00, 0x00, 0x03, 0xd6,             // wildcards = 11 1101 0110
  28.                     0x11, 0x22, 0x33, 0x44, 0x00, 0x00, // dl_src = "11:22:33:44:00:00"
  29.                     0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // dl_src_mask = "00:00:00:00:ff:ff"
  30.                     0xaa, 0xbb, 0xcc, 0x00, 0x00, 0x00, // dl_dst = "aa:bb:cc:00:00:00"
  31.                     0x00, 0x00, 0x00, 0xff, 0xff, 0xff, // dl_dst_mask = "00:00:00:ff:ff:ff"
  32.                     0x00, 0x00,                         // dl_vlan (wildcarded)
  33.                     0x00,                               // dl_vlan_pcp (wildcarded)
  34.                     0x00,                               // pad
  35.                     0x08, 0x00,                         // dl_type = 2048 (0x800)
  36.                     0x00,                               // nw_tos (wildcarded)
  37.                     0x06,                               // nw_proto = 6
  38.                     0xc0, 0xa8, 0x01, 0x00,             // nw_src = "192.168.1.0"
  39.                     0x00, 0x00, 0x00, 0xff,             // nw_src_mask = 0.0.0.255"
  40.                     0xc0, 0xa8, 0x00, 0x00,             // nw_dst = "192.168.0.0"
  41.                     0x00, 0x00, 0xff, 0xff,             // nw_dst_mask = 0.0.255.255"
  42.                     0x00, 0x00,                         // tp_src (wildcarded)
  43.                     0x00, 0x00,                         // tp_dst (wildcarded)
  44.                     0x00, 0x00, 0x00, 0x00,             // mpls_label (wildcarded)
  45.                     0x00,                               // mpls_tc (wildcarded)
  46.                     0x00, 0x00, 0x00,                   // pad
  47.                     0x11, 0x22, 0x33, 0x44, 0x00, 0x00, 0x00, 0x00, // metadata = "1122334400000000"
  48.                     0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, // metadata_mask = "00000000ffffffff"
  49.                       0x00, 0x04,              // type = 4
  50.                       0x00, 0x20,              // length = 32
  51.                       0x00, 0x00, 0x00, 0x00,  // pad
  52.                         0x00, 0x03,                         // type = 3
  53.                         0x00, 0x10,                         // length = 16
  54.                         0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, // dl_addr = "12:34:56:78:8a:bc"
  55.                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pad
  56.                           0x00, 0x05,             // type = 5
  57.                           0x00, 0x08,             // len = 8
  58.                           0xc0, 0xa8, 0x01, 0x01, // nw_addr = "192.168.1.1"
  59.                       0x00, 0x01,        // type = 1
  60.                       0x00, 0x08,        // length = 8
  61.                       0x0d,              // table_id = 13
  62.                       0x00, 0x00, 0x00   // pad
  63.             ];
  64.  
  65. module.exports.obj = {
  66.                 "version" : '1.1',
  67.                 "header" : {
  68.                     "type" : 'OFPT_FLOW_MOD',
  69.                     "xid" : 1234567890
  70.                 },
  71.                 "body" : {
  72.                     "cookie" : new Buffer([0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88]),
  73.                     "cookie_mask" : new Buffer([0xaa, 0xab, 0xac ,0xad, 0xae ,0xaf ,0xba ,0xbb]),
  74.                     "table_id" : 16,
  75.                     "command" : 'OFPFC_ADD',
  76.                     "hard_timeout" : 255,
  77.                     "priority" : 256,
  78.                     "buffer_id" : 1,
  79.                     "out_port" : 8,
  80.                     "flags" : ['OFPFF_SEND_FLOW_REM', 'OFPFF_CHECK_OVERLAP'],
  81.                     "match" : {
  82.                         "header" : {"type" : 'OFPMT_STANDARD'},
  83.                         "body" : {
  84.                             "in_port" : 16,
  85.                             "dl_src" : '11:22:33:44:00:00',
  86.                             "dl_src_mask" : '00:00:00:00:ff:ff',
  87.                             'dl_dst' : 'aa:bb:cc:00:00:00',
  88.                             "dl_dst_mask" : '00:00:00:ff:ff:ff',
  89.                             "dl_type" : 2048,
  90.                             "nw_proto" : 6,
  91.                             "nw_src" : '192.168.1.0',
  92.                             "nw_src_mask" : '0.0.0.255',
  93.                             "nw_dst" : '192.168.0.0',
  94.                             "nw_dst_mask" : '0.0.255.255',
  95.                             "metadata" : new Buffer([0x11, 0x22, 0x33, 0x44, 0x00, 0x00, 0x00, 0x00]),
  96.                             "metadata_mask" : new Buffer([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff])
  97.                         }
  98.                     },
  99.                     "instructions" : [
  100.                         {
  101.                             "header" : {"type" : 'OFPIT_APPLY_ACTIONS'},
  102.                             "body" : {
  103.                                 "actions" : [
  104.                                     {
  105.                                         "header" : {"type" : 'OFPAT_SET_DL_SRC'},
  106.                                         "body" : {"dl_addr" : '12:34:56:78:9a:bc'}
  107.                                     },
  108.                                     {
  109.                                         "header" : {"type" : 'OFPAT_SET_NW_SRC'},
  110.                                         "body" : {"nw_addr" : '192.168.1.1'}
  111.                                     }
  112.                                 ]
  113.                             }
  114.                         },
  115.                         {
  116.                             "header" : {"type" : 'OFPIT_GOTO_TABLE'},
  117.                             "body" : {"table_id" : 13}
  118.                         }
  119.                     ]
  120.                 }
  121.             };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement