diff options
author | Simon Horman <horms@verge.net.au> | 2012-07-23 14:33:07 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-07-24 07:55:40 +0900 |
commit | a7eb8c4254272ea6d4274353c2713813c1398e07 (patch) | |
tree | d5e5313f5f5732e5e1cd8ec04823f8cd77fa035e | |
parent | 68bfa1f84d15b470c33ad45581c879da76393c03 (diff) |
of1.2: add OXM_OF_METADATA support
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/ofproto/ofproto_v1_2_parser.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py index b359e16a..71288534 100644 --- a/ryu/ofproto/ofproto_v1_2_parser.py +++ b/ryu/ofproto/ofproto_v1_2_parser.py @@ -1427,6 +1427,7 @@ class Flow(object): def __init__(self): self.in_port = 0 self.in_phy_port = 0 + self.metadata = 0 self.dl_dst = mac.DONTCARE self.dl_src = mac.DONTCARE self.dl_type = 0 @@ -1464,6 +1465,7 @@ class Flow(object): class FlowWildcards(object): def __init__(self): + self.metadata_mask = 0 self.dl_dst_mask = 0 self.dl_src_mask = 0 self.vlan_vid_mask = 0 @@ -1504,6 +1506,14 @@ class OFPMatch(object): self.append_field(ofproto_v1_2.OXM_OF_IN_PHY_PORT, self.flow.in_phy_port) + if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_METADATA): + if self.wc.metadata_mask == UINT64_MAX: + header = ofproto_v1_2.OXM_OF_METADATA + else: + header = ofproto_v1_2.OXM_OF_METADATA_W + self.append_field(header, self.flow.metadata, + self.wc.metadata_mask) + if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ETH_DST): if self.wc.dl_dst_mask: header = ofproto_v1_2.OXM_OF_ETH_DST_W @@ -1706,6 +1716,15 @@ class OFPMatch(object): self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IN_PHY_PORT) self.flow.in_phy_port = phy_port + def set_metadata(self, metadata): + self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_METADATA) + self.flow.metadata = metadata + + def set_metadata_masked(self, metadata, mask): + self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_METADATA) + self.wc.metadata_mask = mask + self.flow.metadata = metadata & mask + def set_dl_dst(self, dl_dst): self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ETH_DST) self.flow.dl_dst = dl_dst @@ -1983,6 +2002,17 @@ class MTInPort(OFPMatchField): self.value = value +@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_METADATA, + ofproto_v1_2.OXM_OF_METADATA_W]) +class MTMetadata(OFPMatchField): + pack_str = '!Q' + + def __init__(self, header, value, mask=None): + super(MTMetadata, self).__init__(header) + self.value = value + self.mask = mask + + @OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_IN_PHY_PORT]) class MTInPhyPort(OFPMatchField): pack_str = '!I' |