Rich Lane | 1ac4300 | 2013-12-03 12:56:35 -0800 | [diff] [blame^] | 1 | -- binary |
| 2 | 04 04 # version, type |
| 3 | 00 48 # length |
| 4 | 12 34 56 78 # xid |
| 5 | 00 5c 16 c7 # experimenter |
| 6 | 00 00 00 2e # subtype |
| 7 | 00 14 # table_id |
| 8 | 00 12 # key_length |
| 9 | fe dc ba 98 76 54 32 10 ff ee cc bb aa 99 88 77 # checksum |
| 10 | |
| 11 | 00 00 # key[0].type |
| 12 | 00 08 # key[0].length |
| 13 | 00 00 00 05 # key[0].value |
| 14 | |
| 15 | 00 01 # key[1].type |
| 16 | 00 0a # key[1].length |
| 17 | 01 23 45 67 89 ab # key[1].value |
| 18 | |
| 19 | 00 00 # value[0].type |
| 20 | 00 08 # value[0].length |
| 21 | 00 00 00 06 # value[0].value |
| 22 | |
| 23 | 00 01 # value[1].type |
| 24 | 00 0a # value[1].length |
| 25 | ff ee dd cc bb aa # value[1].value |
| 26 | -- python |
| 27 | ofp.message.bsn_gentable_entry_add( |
| 28 | xid=0x12345678, |
| 29 | checksum=0xFEDCBA9876543210FFEECCBBAA998877, |
| 30 | table_id=20, |
| 31 | key=[ |
| 32 | ofp.bsn_tlv.port(5), |
| 33 | ofp.bsn_tlv.mac([0x01, 0x23, 0x45, 0x67, 0x89, 0xab]), |
| 34 | ], |
| 35 | value=[ |
| 36 | ofp.bsn_tlv.port(6), |
| 37 | ofp.bsn_tlv.mac([0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa]), |
| 38 | ]) |
| 39 | -- java |
| 40 | builder.setXid(0x12345678) |
| 41 | .setChecksum(OFChecksum128.of(0xFEDCBA9876543210L, 0xFFEECCBBAA998877L)) |
| 42 | .setTableId(20) |
| 43 | .setKey( |
| 44 | ImmutableList.<OFBsnTlv>of( |
| 45 | factory.bsnTlvPort(OFPort.of(5)), |
| 46 | factory.bsnTlvMac(MacAddress.of("01:23:45:67:89:ab")) |
| 47 | ) |
| 48 | ) |
| 49 | .setValue( |
| 50 | ImmutableList.<OFBsnTlv>of( |
| 51 | factory.bsnTlvPort(OFPort.of(6)), |
| 52 | factory.bsnTlvMac(MacAddress.of("ff:ee:dd:cc:bb:aa")) |
| 53 | ) |
| 54 | ) |
| 55 | -- c |
| 56 | obj = of_bsn_gentable_entry_add_new(OF_VERSION_1_3); |
| 57 | of_bsn_gentable_entry_add_xid_set(obj, 0x12345678); |
| 58 | of_bsn_gentable_entry_add_table_id_set(obj, 20); |
| 59 | { |
| 60 | of_checksum_128_t checksum = { 0xFEDCBA9876543210L, 0xFFEECCBBAA998877L }; |
| 61 | of_bsn_gentable_entry_add_checksum_set(obj, checksum); |
| 62 | } |
| 63 | { |
| 64 | of_object_t *list = of_list_bsn_tlv_new(OF_VERSION_1_3); |
| 65 | { |
| 66 | of_object_t *tlv = of_bsn_tlv_port_new(OF_VERSION_1_3); |
| 67 | of_bsn_tlv_port_value_set(tlv, 5); |
| 68 | of_list_append(list, tlv); |
| 69 | of_object_delete(tlv); |
| 70 | } |
| 71 | { |
| 72 | of_mac_addr_t mac = { { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab } }; |
| 73 | of_object_t *tlv = of_bsn_tlv_mac_new(OF_VERSION_1_3); |
| 74 | of_bsn_tlv_mac_value_set(tlv, mac); |
| 75 | of_list_append(list, tlv); |
| 76 | of_object_delete(tlv); |
| 77 | } |
| 78 | of_bsn_gentable_entry_add_key_set(obj, list); |
| 79 | of_object_delete(list); |
| 80 | } |
| 81 | { |
| 82 | of_object_t *list = of_list_bsn_tlv_new(OF_VERSION_1_3); |
| 83 | { |
| 84 | of_object_t *tlv = of_bsn_tlv_port_new(OF_VERSION_1_3); |
| 85 | of_bsn_tlv_port_value_set(tlv, 6); |
| 86 | of_list_append(list, tlv); |
| 87 | of_object_delete(tlv); |
| 88 | } |
| 89 | { |
| 90 | of_mac_addr_t mac = { { 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa } }; |
| 91 | of_object_t *tlv = of_bsn_tlv_mac_new(OF_VERSION_1_3); |
| 92 | of_bsn_tlv_mac_value_set(tlv, mac); |
| 93 | of_list_append(list, tlv); |
| 94 | of_object_delete(tlv); |
| 95 | } |
| 96 | of_bsn_gentable_entry_add_value_set(obj, list); |
| 97 | of_object_delete(list); |
| 98 | } |