From 311fe904d2bd6f95ce65f3dd853913130f57d056 Mon Sep 17 00:00:00 2001 From: Yusuke Iwase Date: Fri, 5 Dec 2014 09:53:24 +0900 Subject: [PATCH] ofproto_v1_[234]_parser: Add notes for vlan_vid match field To make it possible to refer the usage of vlan_vid match field at Ryu-documentation, This patch adds notes into ofproto_v1_[234]_parser. Signed-off-by: IWASE Yusuke Signed-off-by: FUJITA Tomonori --- ryu/ofproto/ofproto_v1_2_parser.py | 60 ++++++++++++++++++++++++++++++ ryu/ofproto/ofproto_v1_3_parser.py | 60 ++++++++++++++++++++++++++++++ ryu/ofproto/ofproto_v1_4_parser.py | 60 ++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+) diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py index 39a5b0c8..20f3b572 100644 --- a/ryu/ofproto/ofproto_v1_2_parser.py +++ b/ryu/ofproto/ofproto_v1_2_parser.py @@ -3316,6 +3316,66 @@ class OFPMatch(StringifyMixin): ... print match['ipv6_src'] ... ('2001:db8:bd05:1d2:288a:1fc0:1:10ee', 'ffff:ffff:ffff:ffff::') + + .. Note:: + + For VLAN id match field, special values are defined in OpenFlow Spec. + + 1) Packets with and without a VLAN tag + + - Example:: + + match = parser.OFPMatch() + + - Packet Matching + + ====================== ===== + non-VLAN-tagged MATCH + VLAN-tagged(vlan_id=3) MATCH + VLAN-tagged(vlan_id=5) MATCH + ====================== ===== + + 2) Only packets without a VLAN tag + + - Example:: + + match = parser.OFPMatch(vlan_vid=0x0000) + + - Packet Matching + + ====================== ===== + non-VLAN-tagged MATCH + VLAN-tagged(vlan_id=3) x + VLAN-tagged(vlan_id=5) x + ====================== ===== + + 3) Only packets with a VLAN tag regardless of its value + + - Example:: + + match = parser.OFPMatch(vlan_vid=(0x1000, 0x1000)) + + - Packet Matching + + ====================== ===== + non-VLAN-tagged x + VLAN-tagged(vlan_id=3) MATCH + VLAN-tagged(vlan_id=5) MATCH + ====================== ===== + + 4) Only packets with VLAN tag and VID equal + + - Example:: + + match = parser.OFPMatch(vlan_vid=(0x1000 | 3)) + + - Packet Matching + + ====================== ===== + non-VLAN-tagged x + VLAN-tagged(vlan_id=3) MATCH + VLAN-tagged(vlan_id=5) x + ====================== ===== """ def __init__(self, type_=None, length=None, _ordered_fields=None, diff --git a/ryu/ofproto/ofproto_v1_3_parser.py b/ryu/ofproto/ofproto_v1_3_parser.py index 53d235c3..1d2d671b 100644 --- a/ryu/ofproto/ofproto_v1_3_parser.py +++ b/ryu/ofproto/ofproto_v1_3_parser.py @@ -743,6 +743,66 @@ class OFPMatch(StringifyMixin): ... print match['ipv6_src'] ... ('2001:db8:bd05:1d2:288a:1fc0:1:10ee', 'ffff:ffff:ffff:ffff::') + + .. Note:: + + For VLAN id match field, special values are defined in OpenFlow Spec. + + 1) Packets with and without a VLAN tag + + - Example:: + + match = parser.OFPMatch() + + - Packet Matching + + ====================== ===== + non-VLAN-tagged MATCH + VLAN-tagged(vlan_id=3) MATCH + VLAN-tagged(vlan_id=5) MATCH + ====================== ===== + + 2) Only packets without a VLAN tag + + - Example:: + + match = parser.OFPMatch(vlan_vid=0x0000) + + - Packet Matching + + ====================== ===== + non-VLAN-tagged MATCH + VLAN-tagged(vlan_id=3) x + VLAN-tagged(vlan_id=5) x + ====================== ===== + + 3) Only packets with a VLAN tag regardless of its value + + - Example:: + + match = parser.OFPMatch(vlan_vid=(0x1000, 0x1000)) + + - Packet Matching + + ====================== ===== + non-VLAN-tagged x + VLAN-tagged(vlan_id=3) MATCH + VLAN-tagged(vlan_id=5) MATCH + ====================== ===== + + 4) Only packets with VLAN tag and VID equal + + - Example:: + + match = parser.OFPMatch(vlan_vid=(0x1000 | 3)) + + - Packet Matching + + ====================== ===== + non-VLAN-tagged x + VLAN-tagged(vlan_id=3) MATCH + VLAN-tagged(vlan_id=5) x + ====================== ===== """ def __init__(self, type_=None, length=None, _ordered_fields=None, diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py index 60ead3f8..1363908d 100644 --- a/ryu/ofproto/ofproto_v1_4_parser.py +++ b/ryu/ofproto/ofproto_v1_4_parser.py @@ -641,6 +641,66 @@ class OFPMatch(StringifyMixin): ... print match['ipv6_src'] ... ('2001:db8:bd05:1d2:288a:1fc0:1:10ee', 'ffff:ffff:ffff:ffff::') + + .. Note:: + + For VLAN id match field, special values are defined in OpenFlow Spec. + + 1) Packets with and without a VLAN tag + + - Example:: + + match = parser.OFPMatch() + + - Packet Matching + + ====================== ===== + non-VLAN-tagged MATCH + VLAN-tagged(vlan_id=3) MATCH + VLAN-tagged(vlan_id=5) MATCH + ====================== ===== + + 2) Only packets without a VLAN tag + + - Example:: + + match = parser.OFPMatch(vlan_vid=0x0000) + + - Packet Matching + + ====================== ===== + non-VLAN-tagged MATCH + VLAN-tagged(vlan_id=3) x + VLAN-tagged(vlan_id=5) x + ====================== ===== + + 3) Only packets with a VLAN tag regardless of its value + + - Example:: + + match = parser.OFPMatch(vlan_vid=(0x1000, 0x1000)) + + - Packet Matching + + ====================== ===== + non-VLAN-tagged x + VLAN-tagged(vlan_id=3) MATCH + VLAN-tagged(vlan_id=5) MATCH + ====================== ===== + + 4) Only packets with VLAN tag and VID equal + + - Example:: + + match = parser.OFPMatch(vlan_vid=(0x1000 | 3)) + + - Packet Matching + + ====================== ===== + non-VLAN-tagged x + VLAN-tagged(vlan_id=3) MATCH + VLAN-tagged(vlan_id=5) x + ====================== ===== """ def __init__(self, type_=None, length=None, _ordered_fields=None,