blob: 9fb5bde945ebec1ec2c3ee3d17f399488f3baba0 [file] [log] [blame]
Rich Lane20839732014-10-15 22:36:08 -07001-- binary
205 0c # version, type
300 58 # length
412 34 56 78 # xid
502 # reason
600 00 00 00 00 00 00 # pad
700 00 00 04 # port_no
800 48 # length
900 00 # pad
1001 02 03 04 05 06 # hw_addr
1100 00 # pad
1266 6f 6f 00 00 00 00 00 # name
1300 00 00 00 00 00 00 00 # ...
1400 00 00 24 # config
1500 00 00 02 # state
1600 00 # properties[0].type (ethernet)
1700 20 # properties[0].length
1800 00 00 00 # pad
1900 00 00 01 # properties[0].curr
2000 00 00 02 # properties[0].advertised
2100 00 00 04 # properties[0].supported
2200 00 00 08 # properties[0].peer
2300 00 00 0a # properties[0].curr_speed
2400 00 00 14 # properties[0].max_speed
25-- python
26ofp.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
44obj = of_port_status_new(OF_VERSION_1_4);
45of_port_status_xid_set(obj, 0x12345678);
46of_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}