AT_CHECK([ovs-ofctl check-vlan 0000 0000], [0], [dnl
-> 0000/0000
NXM: <any> -> 0000/0000
+OXM: <any> -> 0000/0000,--
OF1.0: 0000/1,00/1 -> 0000/0000
OF1.1: 0000/1,00/1 -> 0000/0000
])
AT_CHECK([ovs-ofctl check-vlan 0000 ffff], [0], [dnl
vlan_tci=0x0000 -> 0000/ffff
NXM: NXM_OF_VLAN_TCI(0000) -> 0000/ffff
+OXM: OXM_OF_VLAN_VID(0000) -> 0000/1fff,--
OF1.0: ffff/0,00/1 -> 0000/ffff
OF1.1: ffff/0,00/1 -> 0000/ffff
])
AT_CHECK([ovs-ofctl check-vlan 1abc 1fff], [0], [dnl
dl_vlan=2748 -> 1abc/1fff
NXM: NXM_OF_VLAN_TCI_W(1abc/1fff) -> 1abc/1fff
+OXM: OXM_OF_VLAN_VID(1abc) -> 1abc/1fff,--
OF1.0: 0abc/0,00/1 -> 1abc/1fff
OF1.1: 0abc/0,00/1 -> 1abc/1fff
])
AT_CHECK([ovs-ofctl check-vlan b000 f000], [0], [dnl
dl_vlan_pcp=5 -> b000/f000
NXM: NXM_OF_VLAN_TCI_W(b000/f000) -> b000/f000
+OXM: OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(05) -> 1000/1000,05
OF1.0: 0000/1,05/0 -> b000/f000
OF1.1: fffe/0,05/0 -> b000/f000
])
AT_CHECK([ovs-ofctl check-vlan babc ffff], [0], [dnl
dl_vlan=2748,dl_vlan_pcp=5 -> babc/ffff
NXM: NXM_OF_VLAN_TCI(babc) -> babc/ffff
+OXM: OXM_OF_VLAN_VID(1abc), OXM_OF_VLAN_PCP(05) -> 1abc/1fff,05
OF1.0: 0abc/0,05/0 -> babc/ffff
OF1.1: 0abc/0,05/0 -> babc/ffff
])
AT_CHECK([ovs-ofctl check-vlan 0000 0fff], [0], [dnl
vlan_tci=0x0000/0x0fff -> 0000/0fff
NXM: NXM_OF_VLAN_TCI_W(0000/0fff) -> 0000/0fff
+OXM: OXM_OF_VLAN_VID_W(0000/0fff) -> 0000/0fff,--
OF1.0: 0000/0,00/1 -> 1000/1fff
OF1.1: 0000/0,00/1 -> 1000/1fff
])
AT_CHECK([ovs-ofctl check-vlan 0000 f000], [0], [dnl
vlan_tci=0x0000/0xf000 -> 0000/f000
NXM: NXM_OF_VLAN_TCI_W(0000/f000) -> 0000/f000
+OXM: OXM_OF_VLAN_VID_W(0000/1000) -> 0000/1000,--
OF1.0: ffff/0,00/1 -> 0000/ffff
OF1.1: ffff/0,00/1 -> 0000/ffff
])
AT_CHECK([ovs-ofctl check-vlan 0000 efff], [0], [dnl
vlan_tci=0x0000/0xefff -> 0000/efff
NXM: NXM_OF_VLAN_TCI_W(0000/efff) -> 0000/efff
+OXM: OXM_OF_VLAN_VID_W(0000/0fff) -> 0000/0fff,--
OF1.0: 0000/0,00/0 -> 1000/ffff
OF1.1: 0000/0,00/0 -> 1000/ffff
])
AT_CHECK([ovs-ofctl check-vlan 1001 1001], [0], [dnl
vlan_tci=0x1001/0x1001 -> 1001/1001
NXM: NXM_OF_VLAN_TCI_W(1001/1001) -> 1001/1001
+OXM: OXM_OF_VLAN_VID_W(1001/1001) -> 1001/1001,--
OF1.0: 0001/0,00/1 -> 1001/1fff
OF1.1: 0001/0,00/1 -> 1001/1fff
])
AT_CHECK([ovs-ofctl check-vlan 3000 3000], [0], [dnl
vlan_tci=0x3000/0x3000 -> 3000/3000
NXM: NXM_OF_VLAN_TCI_W(3000/3000) -> 3000/3000
+OXM: OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01) -> 1000/1000,01
OF1.0: 0000/1,01/0 -> 3000/f000
OF1.1: fffe/0,01/0 -> 3000/f000
])
free(nxm_s);
ofpbuf_uninit(&nxm);
+ /* Convert to and from OXM. */
+ ofpbuf_init(&nxm, 0);
+ nxm_match_len = nx_put_match(&nxm, true, &rule, htonll(0), htonll(0));
+ nxm_s = nx_match_to_string(nxm.data, nxm_match_len);
+ error = nx_pull_match(&nxm, nxm_match_len, 0, &nxm_rule, NULL, NULL);
+ printf("OXM: %s -> ", nxm_s);
+ if (error) {
+ printf("%s\n", ofperr_to_string(error));
+ } else {
+ uint16_t vid = ntohs(nxm_rule.flow.vlan_tci) &
+ (VLAN_VID_MASK | VLAN_CFI);
+ uint16_t mask = ntohs(nxm_rule.wc.vlan_tci_mask) &
+ (VLAN_VID_MASK | VLAN_CFI);
+
+ printf("%04"PRIx16"/%04"PRIx16",", vid, mask);
+ if (vid && vlan_tci_to_pcp(nxm_rule.wc.vlan_tci_mask)) {
+ printf("%02"PRIx8"\n", vlan_tci_to_pcp(nxm_rule.flow.vlan_tci));
+ } else {
+ printf("--\n");
+ }
+ }
+ free(nxm_s);
+ ofpbuf_uninit(&nxm);
+
/* Convert to and from OpenFlow 1.0. */
ofputil_cls_rule_to_ofp10_match(&rule, &of10_match);
ofputil_cls_rule_from_ofp10_match(&of10_match, 0, &of10_rule);