Rich Lane | c9fc57d | 2013-05-16 16:39:12 -0700 | [diff] [blame] | 1 | -- binary |
| 2 | 04 0c # version, type |
| 3 | 00 50 # length |
| 4 | 12 34 56 78 # xid |
| 5 | 02 # reason |
| 6 | 00 00 00 00 00 00 00 # pad |
| 7 | 00 00 00 04 # port_no |
| 8 | 00 00 00 00 # pad |
| 9 | 01 02 03 04 05 06 # hw_addr |
| 10 | 00 00 # pad |
| 11 | 66 6f 6f 00 00 00 00 00 # name |
| 12 | 00 00 00 00 00 00 00 00 # ... |
| 13 | 00 00 00 24 # config |
| 14 | 00 00 00 02 # state |
| 15 | 00 00 00 01 # curr |
| 16 | 00 00 00 02 # advertised |
| 17 | 00 00 00 04 # supported |
| 18 | 00 00 00 08 # peer |
| 19 | 00 00 00 0a # curr_speed |
| 20 | 00 00 00 14 # max_speed |
| 21 | -- python |
| 22 | ofp.message.port_status( |
| 23 | xid=0x12345678, |
| 24 | reason=ofp.OFPPR_MODIFY, |
| 25 | desc=ofp.port_desc( |
| 26 | port_no=4, |
| 27 | hw_addr=[1,2,3,4,5,6], |
| 28 | name="foo", |
| 29 | config=ofp.OFPPC_NO_FWD|ofp.OFPPC_NO_RECV, |
| 30 | state=ofp.OFPPS_BLOCKED, |
| 31 | curr=ofp.OFPPF_10MB_HD, |
| 32 | advertised=ofp.OFPPF_10MB_FD, |
| 33 | supported=ofp.OFPPF_100MB_HD, |
| 34 | peer=ofp.OFPPF_100MB_FD, |
| 35 | curr_speed=10, |
| 36 | max_speed=20)) |
Rich Lane | 2083973 | 2014-10-15 22:36:08 -0700 | [diff] [blame] | 37 | -- c |
| 38 | obj = of_port_status_new(OF_VERSION_1_3); |
| 39 | of_port_status_xid_set(obj, 0x12345678); |
| 40 | of_port_status_reason_set(obj, OF_PORT_CHANGE_REASON_MODIFY); |
| 41 | { |
| 42 | of_object_t desc; |
| 43 | of_port_status_desc_bind(obj, &desc); |
| 44 | of_port_desc_port_no_set(&desc, 4); |
| 45 | of_mac_addr_t hw_addr = { { 1, 2, 3, 4, 5, 6 } }; |
| 46 | of_port_desc_hw_addr_set(&desc, hw_addr); |
| 47 | of_port_name_t name = "foo"; |
| 48 | of_port_desc_name_set(&desc, name); |
| 49 | of_port_desc_config_set(&desc, OF_PORT_CONFIG_FLAG_NO_FWD|OF_PORT_CONFIG_FLAG_NO_RECV); |
| 50 | of_port_desc_state_set(&desc, OF_PORT_STATE_FLAG_BLOCKED); |
| 51 | of_port_desc_curr_set(&desc, OF_PORT_FEATURE_FLAG_10MB_HD); |
| 52 | of_port_desc_advertised_set(&desc, OF_PORT_FEATURE_FLAG_10MB_FD); |
| 53 | of_port_desc_supported_set(&desc, OF_PORT_FEATURE_FLAG_100MB_HD); |
| 54 | of_port_desc_peer_set(&desc, OF_PORT_FEATURE_FLAG_100MB_FD); |
| 55 | of_port_desc_curr_speed_set(&desc, 10); |
| 56 | of_port_desc_max_speed_set(&desc, 20); |
| 57 | } |