From 550e89067127538ed41ae38128c479af21f75051 Mon Sep 17 00:00:00 2001 From: Ozgur Yurekten Date: Mon, 15 Jul 2019 14:08:25 +0300 Subject: nx_action_encap and nx_action_decap classes are defined Signed-off-by: Ozgur Yurekten Signed-off-by: FUJITA Tomonori --- ryu/ofproto/nicira_ext.py | 2 ++ ryu/ofproto/nx_actions.py | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/ryu/ofproto/nicira_ext.py b/ryu/ofproto/nicira_ext.py index 9ac673a3..19c8394c 100644 --- a/ryu/ofproto/nicira_ext.py +++ b/ryu/ofproto/nicira_ext.py @@ -63,6 +63,8 @@ NXAST_CONTROLLER2 = 37 NXAST_SAMPLE2 = 38 NXAST_OUTPUT_TRUNC = 39 NXAST_CT_CLEAR = 43 +NXAST_RAW_ENCAP = 46 +NXAST_RAW_DECAP = 47 NXAST_DEC_NSH_TTL = 48 NX_ACTION_RESUBMIT_PACK_STR = '!HHIHHB3x' diff --git a/ryu/ofproto/nx_actions.py b/ryu/ofproto/nx_actions.py index 7f543471..5707ca17 100644 --- a/ryu/ofproto/nx_actions.py +++ b/ryu/ofproto/nx_actions.py @@ -2999,6 +2999,78 @@ def generate(ofp_name, ofpp_name): self.max_len) return data + class NXActionEncapEther(NXAction): + """ + Encap Ether + + This action encaps package with ethernet + + And equivalent to the followings action of ovs-ofctl command. + + :: + + encap(ethernet) + + Example:: + + actions += [parser.NXActionEncapEther()] + """ + _subtype = nicira_ext.NXAST_RAW_ENCAP + + _fmt_str = '!HI' + + def __init__(self, + type_=None, len_=None, vendor=None, subtype=None): + super(NXActionEncapEther, self).__init__() + self.hdr_size = 0 + self.new_pkt_type = 0x00000000 + + @classmethod + def parser(cls, buf): + return cls() + + def serialize_body(self): + data = bytearray() + msg_pack_into(self._fmt_str, data, 0, self.hdr_size, self.new_pkt_type) + return data + + + + class NXActionEncapNsh(NXAction): + """ + Encap nsh + + This action encaps package with nsh + + And equivalent to the followings action of ovs-ofctl command. + + :: + + encap(nsh(md_type=1)) + + Example:: + + actions += [parser.NXActionEncapNsh()] + """ + _subtype = nicira_ext.NXAST_RAW_ENCAP + + _fmt_str = '!HI' + + def __init__(self, + type_=None, len_=None, vendor=None, subtype=None): + super(NXActionEncapNsh, self).__init__() + self.hdr_size = hdr_size + self.new_pkt_type = 0x0001894F + + @classmethod + def parser(cls, buf): + return cls() + + def serialize_body(self): + data = bytearray() + msg_pack_into(self._fmt_str, data, 0, self.hdr_size, self.new_pkt_type) + return data + class NXActionDecNshTtl(NXAction): """ Decrement NSH TTL action @@ -3083,6 +3155,8 @@ def generate(ofp_name, ofpp_name): 'NXFlowSpecMatch', 'NXFlowSpecLoad', 'NXFlowSpecOutput', + 'NXActionEncapNsh', + 'NXActionEncapEther', 'NXActionDecNshTtl', ] vars = locals() -- cgit v1.2.3