Rich Lane | 2083973 | 2014-10-15 22:36:08 -0700 | [diff] [blame] | 1 | -- binary |
| 2 | 05 0c # version, type |
| 3 | 00 58 # 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 48 # length |
| 9 | 00 00 # pad |
| 10 | 01 02 03 04 05 06 # hw_addr |
| 11 | 00 00 # pad |
| 12 | 66 6f 6f 00 00 00 00 00 # name |
| 13 | 00 00 00 00 00 00 00 00 # ... |
| 14 | 00 00 00 24 # config |
| 15 | 00 00 00 02 # state |
| 16 | 00 00 # properties[0].type (ethernet) |
| 17 | 00 20 # properties[0].length |
| 18 | 00 00 00 00 # pad |
| 19 | 00 00 00 01 # properties[0].curr |
| 20 | 00 00 00 02 # properties[0].advertised |
| 21 | 00 00 00 04 # properties[0].supported |
| 22 | 00 00 00 08 # properties[0].peer |
| 23 | 00 00 00 0a # properties[0].curr_speed |
| 24 | 00 00 00 14 # properties[0].max_speed |
| 25 | -- python |
| 26 | ofp.message.port_status( |
| 27 | xid=0x12345678, |
| 28 | reason=ofp.OFPPR_MODIFY, |
| 29 | desc=ofp.port_desc( |
| 30 | port_no=4, |
| 31 | hw_addr=[1,2,3,4,5,6], |
| 32 | name="foo", |
| 33 | config=ofp.OFPPC_NO_FWD|ofp.OFPPC_NO_RECV, |
| 34 | state=ofp.OFPPS_BLOCKED, |
| 35 | properties=[ |
| 36 | ofp.port_desc_prop.ethernet( |
| 37 | curr=ofp.OFPPF_10MB_HD, |
| 38 | advertised=ofp.OFPPF_10MB_FD, |
| 39 | supported=ofp.OFPPF_100MB_HD, |
| 40 | peer=ofp.OFPPF_100MB_FD, |
| 41 | curr_speed=10, |
| 42 | max_speed=20)])) |
| 43 | -- c |
| 44 | obj = of_port_status_new(OF_VERSION_1_4); |
| 45 | of_port_status_xid_set(obj, 0x12345678); |
| 46 | of_port_status_reason_set(obj, OF_PORT_CHANGE_REASON_MODIFY); |
| 47 | { |
| 48 | of_object_t desc; |
| 49 | of_port_status_desc_bind(obj, &desc); |
| 50 | of_port_desc_port_no_set(&desc, 4); |
| 51 | of_mac_addr_t hw_addr = { { 1, 2, 3, 4, 5, 6 } }; |
| 52 | of_port_desc_hw_addr_set(&desc, hw_addr); |
| 53 | of_port_name_t name = "foo"; |
| 54 | of_port_desc_name_set(&desc, name); |
| 55 | of_port_desc_config_set(&desc, OF_PORT_CONFIG_FLAG_NO_FWD|OF_PORT_CONFIG_FLAG_NO_RECV); |
| 56 | of_port_desc_state_set(&desc, OF_PORT_STATE_FLAG_BLOCKED); |
| 57 | { |
| 58 | of_list_port_desc_prop_t list; |
| 59 | of_port_desc_properties_bind(&desc, &list); |
| 60 | { |
| 61 | of_object_t *obj = of_port_desc_prop_ethernet_new(OF_VERSION_1_4); |
| 62 | of_port_desc_prop_ethernet_curr_set(obj, OF_PORT_FEATURE_FLAG_10MB_HD); |
| 63 | of_port_desc_prop_ethernet_advertised_set(obj, OF_PORT_FEATURE_FLAG_10MB_FD); |
| 64 | of_port_desc_prop_ethernet_supported_set(obj, OF_PORT_FEATURE_FLAG_100MB_HD); |
| 65 | of_port_desc_prop_ethernet_peer_set(obj, OF_PORT_FEATURE_FLAG_100MB_FD); |
| 66 | of_port_desc_prop_ethernet_curr_speed_set(obj, 10); |
| 67 | of_port_desc_prop_ethernet_max_speed_set(obj, 20); |
| 68 | of_list_append(&list, obj); |
| 69 | of_object_delete(obj); |
| 70 | } |
| 71 | } |
| 72 | } |