Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 1 | -- binary |
| 2 | 04 04 # version, type |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame] | 3 | 00 50 # len |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 4 | 01 02 03 04 # xid |
| 5 | 00 5c 16 c7 # experimenter |
| 6 | 00 00 00 0f # subtype |
| 7 | 00 01 # vport type |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame] | 8 | 00 40 # vport len |
| 9 | 00 00 00 1b # vport flags |
Wilson Ng | 28fc85b | 2014-06-10 18:18:39 -0700 | [diff] [blame] | 10 | 00 00 00 01 # parent port no |
| 11 | 00 00 00 02 # loopback port no |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 12 | 0a 0b 0c 0d 0e 0f # local mac |
| 13 | 01 02 03 04 05 06 # next hop mac |
| 14 | c0 00 00 02 # src ip |
| 15 | c0 00 10 02 # dst ip |
Wilson Ng | 8c9d957 | 2014-04-15 16:27:53 -0700 | [diff] [blame] | 16 | 01 40 00 00 # dscp, ttl, pad(2) |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 17 | 00 00 be ef # vpn |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame] | 18 | 00 00 04 00 # rate limit |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 19 | 66 6f 6f 00 00 00 00 00 00 00 00 00 00 00 00 00 # vport if name |
| 20 | -- python |
| 21 | ofp.message.bsn_virtual_port_create_request( |
| 22 | xid=0x01020304, vport=ofp.bsn_vport_l2gre( |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame] | 23 | flags=ofp.OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID | ofp.OF_BSN_VPORT_L2GRE_DSCP_ASSIGN | \ |
| 24 | ofp.OF_BSN_VPORT_L2GRE_LOOPBACK_IS_VALID | ofp.OF_BSN_VPORT_L2GRE_RATE_LIMIT_IS_VALID, |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 25 | port_no=1, |
Wilson Ng | 28fc85b | 2014-06-10 18:18:39 -0700 | [diff] [blame] | 26 | loopback_port_no=2, |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 27 | local_mac=[0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f], |
| 28 | nh_mac=[0x01, 0x02, 0x03, 0x04, 0x05, 0x06], |
| 29 | src_ip=0xc0000002, |
| 30 | dst_ip=0xc0001002, |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 31 | dscp=1, |
| 32 | ttl=64, |
| 33 | vpn=0xbeef, |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame] | 34 | rate_limit=0x400, |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 35 | if_name="foo" |
| 36 | )) |
| 37 | -- c |
| 38 | obj = of_bsn_virtual_port_create_request_new(OF_VERSION_1_3); |
| 39 | of_bsn_virtual_port_create_request_xid_set(obj, 0x01020304); |
| 40 | { |
| 41 | of_object_t *vport = of_bsn_vport_l2gre_new(OF_VERSION_1_3); |
| 42 | { |
| 43 | of_port_name_t if_name = "foo"; |
| 44 | of_mac_addr_t local_mac = { { 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f } }; |
| 45 | of_mac_addr_t nh_mac = { { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 } }; |
Wilson Ng | 8c9d957 | 2014-04-15 16:27:53 -0700 | [diff] [blame] | 46 | of_bsn_vport_l2gre_flags_set(vport, |
| 47 | OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID | |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame] | 48 | OF_BSN_VPORT_L2GRE_DSCP_ASSIGN | |
| 49 | OF_BSN_VPORT_L2GRE_LOOPBACK_IS_VALID | |
| 50 | OF_BSN_VPORT_L2GRE_RATE_LIMIT_IS_VALID); |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 51 | of_bsn_vport_l2gre_port_no_set(vport, 1); |
Wilson Ng | 28fc85b | 2014-06-10 18:18:39 -0700 | [diff] [blame] | 52 | of_bsn_vport_l2gre_loopback_port_no_set(vport, 2); |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 53 | of_bsn_vport_l2gre_local_mac_set(vport, local_mac); |
| 54 | of_bsn_vport_l2gre_nh_mac_set(vport, nh_mac); |
| 55 | of_bsn_vport_l2gre_src_ip_set(vport, 0xc0000002); |
| 56 | of_bsn_vport_l2gre_dst_ip_set(vport, 0xc0001002); |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 57 | of_bsn_vport_l2gre_dscp_set(vport, 1); |
| 58 | of_bsn_vport_l2gre_ttl_set(vport, 64); |
| 59 | of_bsn_vport_l2gre_vpn_set(vport, 0xbeef); |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame] | 60 | of_bsn_vport_l2gre_rate_limit_set(vport, 0x400); |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 61 | of_bsn_vport_l2gre_if_name_set(vport, if_name); |
| 62 | } |
| 63 | of_bsn_virtual_port_create_request_vport_set(obj, vport); |
| 64 | of_object_delete(vport); |
| 65 | } |
Wilson Ng | 7e7aa35 | 2014-04-15 17:51:01 -0700 | [diff] [blame] | 66 | -- java |
| 67 | builder.setXid(0x01020304) |
| 68 | .setVport( |
| 69 | factory.buildBsnVportL2Gre() |
| 70 | .setFlags( |
| 71 | ImmutableSet.<OFBsnVportL2GreFlags>of( |
| 72 | OFBsnVportL2GreFlags.BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID, |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame] | 73 | OFBsnVportL2GreFlags.BSN_VPORT_L2GRE_DSCP_ASSIGN, |
| 74 | OFBsnVportL2GreFlags.BSN_VPORT_L2GRE_LOOPBACK_IS_VALID, |
| 75 | OFBsnVportL2GreFlags.BSN_VPORT_L2GRE_RATE_LIMIT_IS_VALID |
Wilson Ng | 7e7aa35 | 2014-04-15 17:51:01 -0700 | [diff] [blame] | 76 | ) |
| 77 | ) |
| 78 | .setPortNo(OFPort.of(1)) |
Wilson Ng | 28fc85b | 2014-06-10 18:18:39 -0700 | [diff] [blame] | 79 | .setLoopbackPortNo(OFPort.of(2)) |
Wilson Ng | 7e7aa35 | 2014-04-15 17:51:01 -0700 | [diff] [blame] | 80 | .setLocalMac(MacAddress.of("0a:0b:0c:0d:0e:0f")) |
| 81 | .setNhMac(MacAddress.of("01:02:03:04:05:06")) |
| 82 | .setSrcIp(IPv4Address.of("192.0.0.2")) |
| 83 | .setDstIp(IPv4Address.of("192.0.16.2")) |
| 84 | .setDscp((short)1) |
| 85 | .setTtl((short)64) |
| 86 | .setVpn(0xbeef) |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame] | 87 | .setRateLimit(0x400) |
Wilson Ng | 7e7aa35 | 2014-04-15 17:51:01 -0700 | [diff] [blame] | 88 | .setIfName("foo") |
| 89 | .build() |
| 90 | ); |