问题描述
我想了解如何在开放流规则中计算元数据.
I would like to understand how the Metadata are calculated in an Open Flow rule.
cookie = 0x6900000,持续时间= 228925.519s,table = 17,n_packets = 384,n_bytes = 35436,优先级= 10,元数据= 0xf30000000000/0xffffff0000000000 actions = write_metadata:0xc000f30000000000/0xffffffffffffffffe,goto_table:211
cookie=0x6900000, duration=228925.519s, table=17, n_packets=384, n_bytes=35436, priority=10,metadata=0xf30000000000/0xffffff0000000000 actions=write_metadata:0xc000f30000000000/0xfffffffffffffffe,goto_table:211
示例:我的流程与此非常相似.如何精确计算元数据.
Example: I have a flow very similar to this. How are exactly the Metadata are Calculated.
以及如何解释元数据值和掩码
And how to Intrepret the Metadata Values and Mask
有人说new_metadata = old_metadata& 〜遮罩|价值和面具
Some saysnew_metadata = old_metadata & ~mask | value & Mask
老实说我听不懂,有人可以解释一下
Honestly i do not understand it, could some one explain it
推荐答案
write_metadata:value[/mask]
Updates the metadata field for the flow. If mask is omit‐
ted, the metadata field is set exactly to value; if mask
is specified, then a 1-bit in mask indicates that the
corresponding bit in the metadata field will be replaced
with the corresponding bit from value. Both value and
mask are 64-bit values that are decimal by default; use a
0x prefix to specify them in hexadecimal.
前面的解释确实等同于:
The preceding explanation is indeed equivalent to:
new_metadata = (old_metadata & ~mask) | (value & mask)
换句话说,我们首先擦除掩码(old_metadata & ~mask
)中设置为1的旧元数据值的位,然后将掩码中也设置为1的值的位设置为1(| (value & mask)
).
In other words, we first erase bits of the old metadata value set to 1 in the mask (old_metadata & ~mask
) and then set to 1 the bits of the value that are also set to 1 in the mask (| (value & mask)
).
这篇关于OpenFlow规则元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!