Class: Match
- Inherits:
-
Object
- Object
- Match
- Defined in:
- lib/openflowdev/match.rb
Overview
Copyright © 2015, BROCADE COMMUNICATIONS SYSTEMS, INC
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Instance Attribute Summary collapse
-
#arp_op_code ⇒ Object
readonly
Returns the value of attribute arp_op_code.
-
#arp_src_hw_addr ⇒ Object
readonly
Returns the value of attribute arp_src_hw_addr.
-
#arp_src_ipv4 ⇒ Object
readonly
Returns the value of attribute arp_src_ipv4.
-
#arp_tgt_hw_addr ⇒ Object
readonly
Returns the value of attribute arp_tgt_hw_addr.
-
#arp_tgt_ipv4 ⇒ Object
readonly
Returns the value of attribute arp_tgt_ipv4.
-
#eth_type ⇒ Object
readonly
Returns the value of attribute eth_type.
-
#ethernet_dst ⇒ Object
readonly
Returns the value of attribute ethernet_dst.
-
#ethernet_src ⇒ Object
readonly
Returns the value of attribute ethernet_src.
-
#icmpv4_code ⇒ Object
readonly
Returns the value of attribute icmpv4_code.
-
#icmpv4_type ⇒ Object
readonly
Returns the value of attribute icmpv4_type.
-
#icmpv6_code ⇒ Object
readonly
Returns the value of attribute icmpv6_code.
-
#icmpv6_type ⇒ Object
readonly
Returns the value of attribute icmpv6_type.
-
#in_phy_port ⇒ Object
readonly
Returns the value of attribute in_phy_port.
-
#in_port ⇒ Object
readonly
Returns the value of attribute in_port.
-
#ip_dscp ⇒ Object
readonly
Returns the value of attribute ip_dscp.
-
#ip_ecn ⇒ Object
readonly
Returns the value of attribute ip_ecn.
-
#ip_proto ⇒ Object
readonly
Returns the value of attribute ip_proto.
-
#ipv4_dst ⇒ Object
readonly
Returns the value of attribute ipv4_dst.
-
#ipv4_src ⇒ Object
readonly
Returns the value of attribute ipv4_src.
-
#ipv6_dst ⇒ Object
readonly
Returns the value of attribute ipv6_dst.
-
#ipv6_ext_hdr ⇒ Object
readonly
Returns the value of attribute ipv6_ext_hdr.
-
#ipv6_flabel ⇒ Object
readonly
Returns the value of attribute ipv6_flabel.
-
#ipv6_src ⇒ Object
readonly
Returns the value of attribute ipv6_src.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#metadata_mask ⇒ Object
readonly
Returns the value of attribute metadata_mask.
-
#mpls_bos ⇒ Object
readonly
Returns the value of attribute mpls_bos.
-
#mpls_label ⇒ Object
readonly
Returns the value of attribute mpls_label.
-
#mpls_tc ⇒ Object
readonly
Returns the value of attribute mpls_tc.
-
#sctp_dst ⇒ Object
readonly
Returns the value of attribute sctp_dst.
-
#sctp_src ⇒ Object
readonly
Returns the value of attribute sctp_src.
-
#tcp_dst_port ⇒ Object
readonly
Returns the value of attribute tcp_dst_port.
-
#tcp_src_port ⇒ Object
readonly
Returns the value of attribute tcp_src_port.
-
#tunnel_id ⇒ Object
readonly
Returns the value of attribute tunnel_id.
-
#udp_dst_port ⇒ Object
readonly
Returns the value of attribute udp_dst_port.
-
#udp_src_port ⇒ Object
readonly
Returns the value of attribute udp_src_port.
-
#vlan_id ⇒ Object
readonly
Returns the value of attribute vlan_id.
-
#vlan_pcp ⇒ Object
readonly
Returns the value of attribute vlan_pcp.
Instance Method Summary collapse
-
#initialize(eth_type: nil, ipv4_destination: nil, ipv4_source: nil, ipv6_source: nil, ipv6_destination: nil, ipv6_flabel: nil, ipv6_ext_header: nil, ethernet_destination: nil, ethernet_source: nil, in_port: nil, in_physical_port: nil, ip_protocol_num: nil, ip_dscp: nil, ip_ecn: nil, tcp_source_port: nil, tcp_destination_port: nil, udp_source_port: nil, udp_destination_port: nil, icmpv4_type: nil, icmpv4_code: nil, icmpv6_type: nil, icmpv6_code: nil, arp_op_code: nil, arp_source_ipv4: nil, arp_target_ipv4: nil, arp_source_hardware_address: nil, arp_target_hardware_address: nil, vlan_id: nil, vlan_pcp: nil, sctp_destination: nil, sctp_source: nil, mpls_label: nil, mpls_tc: nil, mpls_bos: nil, tunnel_id: nil, metadata: nil, metadata_mask: nil) ⇒ Match
constructor
A new instance of Match.
- #to_hash ⇒ Object
Constructor Details
#initialize(eth_type: nil, ipv4_destination: nil, ipv4_source: nil, ipv6_source: nil, ipv6_destination: nil, ipv6_flabel: nil, ipv6_ext_header: nil, ethernet_destination: nil, ethernet_source: nil, in_port: nil, in_physical_port: nil, ip_protocol_num: nil, ip_dscp: nil, ip_ecn: nil, tcp_source_port: nil, tcp_destination_port: nil, udp_source_port: nil, udp_destination_port: nil, icmpv4_type: nil, icmpv4_code: nil, icmpv6_type: nil, icmpv6_code: nil, arp_op_code: nil, arp_source_ipv4: nil, arp_target_ipv4: nil, arp_source_hardware_address: nil, arp_target_hardware_address: nil, vlan_id: nil, vlan_pcp: nil, sctp_destination: nil, sctp_source: nil, mpls_label: nil, mpls_tc: nil, mpls_bos: nil, tunnel_id: nil, metadata: nil, metadata_mask: nil) ⇒ Match
Returns a new instance of Match.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/openflowdev/match.rb', line 41 def initialize(eth_type: nil, ipv4_destination: nil, ipv4_source: nil, ipv6_source: nil, ipv6_destination: nil, ipv6_flabel: nil, ipv6_ext_header: nil, ethernet_destination: nil, ethernet_source: nil, in_port: nil, in_physical_port: nil, ip_protocol_num: nil, ip_dscp: nil, ip_ecn: nil, tcp_source_port: nil, tcp_destination_port: nil, udp_source_port: nil, udp_destination_port: nil, icmpv4_type: nil, icmpv4_code: nil, icmpv6_type: nil, icmpv6_code: nil, arp_op_code: nil, arp_source_ipv4: nil, arp_target_ipv4: nil, arp_source_hardware_address: nil, arp_target_hardware_address: nil, vlan_id: nil, vlan_pcp: nil, sctp_destination: nil, sctp_source: nil, mpls_label: nil, mpls_tc: nil, mpls_bos: nil, tunnel_id: nil, metadata: nil, metadata_mask: nil) @eth_type = eth_type @ipv4_dst = ipv4_destination @ipv4_src = ipv4_source @ipv6_dst = ipv6_destination @ipv6_src = ipv6_source @ipv6_flabel = ipv6_flabel @ipv6_ext_hdr = ipv6_ext_header @ethernet_dst = ethernet_destination @ethernet_src = ethernet_source @in_port = in_port @in_phy_port = in_physical_port @ip_proto = ip_protocol_num @ip_dscp = ip_dscp @ip_ecn = ip_ecn @tcp_src_port = tcp_source_port @tcp_dst_port = tcp_destination_port @udp_dst_port = udp_destination_port @udp_src_port = udp_source_port @icmpv4_type = icmpv4_type @icmpv4_code = icmpv4_code @icmpv6_type = icmpv6_type @icmpv6_code = icmpv6_code @arp_op_code = arp_op_code @arp_src_ipv4 = arp_source_ipv4 @arp_tgt_ipv4 = arp_target_ipv4 @arp_src_hw_addr = arp_source_hardware_address @arp_tgt_hw_addr = arp_target_hardware_address @vlan_id = vlan_id @vlan_pcp = vlan_pcp @sctp_dst = sctp_destination @sctp_src = sctp_source @mpls_label = mpls_label @mpls_tc = mpls_tc @mpls_bos = mpls_bos @tunnel_id = tunnel_id @metdata = = end |
Instance Attribute Details
#arp_op_code ⇒ Object (readonly)
Returns the value of attribute arp_op_code.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def arp_op_code @arp_op_code end |
#arp_src_hw_addr ⇒ Object (readonly)
Returns the value of attribute arp_src_hw_addr.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def arp_src_hw_addr @arp_src_hw_addr end |
#arp_src_ipv4 ⇒ Object (readonly)
Returns the value of attribute arp_src_ipv4.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def arp_src_ipv4 @arp_src_ipv4 end |
#arp_tgt_hw_addr ⇒ Object (readonly)
Returns the value of attribute arp_tgt_hw_addr.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def arp_tgt_hw_addr @arp_tgt_hw_addr end |
#arp_tgt_ipv4 ⇒ Object (readonly)
Returns the value of attribute arp_tgt_ipv4.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def arp_tgt_ipv4 @arp_tgt_ipv4 end |
#eth_type ⇒ Object (readonly)
Returns the value of attribute eth_type.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def eth_type @eth_type end |
#ethernet_dst ⇒ Object (readonly)
Returns the value of attribute ethernet_dst.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ethernet_dst @ethernet_dst end |
#ethernet_src ⇒ Object (readonly)
Returns the value of attribute ethernet_src.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ethernet_src @ethernet_src end |
#icmpv4_code ⇒ Object (readonly)
Returns the value of attribute icmpv4_code.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def icmpv4_code @icmpv4_code end |
#icmpv4_type ⇒ Object (readonly)
Returns the value of attribute icmpv4_type.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def icmpv4_type @icmpv4_type end |
#icmpv6_code ⇒ Object (readonly)
Returns the value of attribute icmpv6_code.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def icmpv6_code @icmpv6_code end |
#icmpv6_type ⇒ Object (readonly)
Returns the value of attribute icmpv6_type.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def icmpv6_type @icmpv6_type end |
#in_phy_port ⇒ Object (readonly)
Returns the value of attribute in_phy_port.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def in_phy_port @in_phy_port end |
#in_port ⇒ Object (readonly)
Returns the value of attribute in_port.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def in_port @in_port end |
#ip_dscp ⇒ Object (readonly)
Returns the value of attribute ip_dscp.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ip_dscp @ip_dscp end |
#ip_ecn ⇒ Object (readonly)
Returns the value of attribute ip_ecn.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ip_ecn @ip_ecn end |
#ip_proto ⇒ Object (readonly)
Returns the value of attribute ip_proto.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ip_proto @ip_proto end |
#ipv4_dst ⇒ Object (readonly)
Returns the value of attribute ipv4_dst.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ipv4_dst @ipv4_dst end |
#ipv4_src ⇒ Object (readonly)
Returns the value of attribute ipv4_src.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ipv4_src @ipv4_src end |
#ipv6_dst ⇒ Object (readonly)
Returns the value of attribute ipv6_dst.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ipv6_dst @ipv6_dst end |
#ipv6_ext_hdr ⇒ Object (readonly)
Returns the value of attribute ipv6_ext_hdr.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ipv6_ext_hdr @ipv6_ext_hdr end |
#ipv6_flabel ⇒ Object (readonly)
Returns the value of attribute ipv6_flabel.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ipv6_flabel @ipv6_flabel end |
#ipv6_src ⇒ Object (readonly)
Returns the value of attribute ipv6_src.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def ipv6_src @ipv6_src end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def end |
#metadata_mask ⇒ Object (readonly)
Returns the value of attribute metadata_mask.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def end |
#mpls_bos ⇒ Object (readonly)
Returns the value of attribute mpls_bos.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def mpls_bos @mpls_bos end |
#mpls_label ⇒ Object (readonly)
Returns the value of attribute mpls_label.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def mpls_label @mpls_label end |
#mpls_tc ⇒ Object (readonly)
Returns the value of attribute mpls_tc.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def mpls_tc @mpls_tc end |
#sctp_dst ⇒ Object (readonly)
Returns the value of attribute sctp_dst.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def sctp_dst @sctp_dst end |
#sctp_src ⇒ Object (readonly)
Returns the value of attribute sctp_src.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def sctp_src @sctp_src end |
#tcp_dst_port ⇒ Object (readonly)
Returns the value of attribute tcp_dst_port.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def tcp_dst_port @tcp_dst_port end |
#tcp_src_port ⇒ Object (readonly)
Returns the value of attribute tcp_src_port.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def tcp_src_port @tcp_src_port end |
#tunnel_id ⇒ Object (readonly)
Returns the value of attribute tunnel_id.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def tunnel_id @tunnel_id end |
#udp_dst_port ⇒ Object (readonly)
Returns the value of attribute udp_dst_port.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def udp_dst_port @udp_dst_port end |
#udp_src_port ⇒ Object (readonly)
Returns the value of attribute udp_src_port.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def udp_src_port @udp_src_port end |
#vlan_id ⇒ Object (readonly)
Returns the value of attribute vlan_id.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def vlan_id @vlan_id end |
#vlan_pcp ⇒ Object (readonly)
Returns the value of attribute vlan_pcp.
33 34 35 |
# File 'lib/openflowdev/match.rb', line 33 def vlan_pcp @vlan_pcp end |
Instance Method Details
#to_hash ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/openflowdev/match.rb', line 92 def to_hash hash = {'ethernet-match' => {'ethernet-type' => {:type => @eth_type}, 'ethernet-destination' => {:address => @ethernet_dst}, 'ethernet-source' => {:address => @ethernet_src}}, 'ipv4-destination' => @ipv4_dst, 'ipv4-source' => @ipv4_src, 'ipv6-destination' => @ipv6_dst, 'ipv6-source' => @ipv6_src, 'ipv6-label' => {'ipv6-flabel' => @ipv6_flabel}, 'ipv6-ext-header' => {'ipv6-exthdr' => @ipv6_ext_hdr}, 'in-port' => @in_port, 'in_phy_port' => @in_phy_port, 'ip-match' => {'ip-dscp' => @ip_dscp, 'ip-ecn' => @ip_ecn, 'ip-protocol' => @ip_proto}, 'tcp-destination-port' => @tcp_dst_port, 'tcp-source-port' => @tcp_src_port, 'udp-source-port' => @udp_src_port, 'udp-destination-port' => @udp_dst_port, 'icmpv4-match' => {'icmpv4-code' => @icmpv4_code, 'icmpv4-type' => @icmpv4_type}, 'icmpv6-match' => {'icmpv6-code' => @icmpv6_code, 'icmpv6-type' => @icmpv6_type}, 'arp-op' => @arp_op_code, 'arp-source-transport-address' => @arp_src_ipv4, 'arp-source-hardware-address' => {:address => @arp_src_hw_addr}, 'arp-target-hardware-address' => {:address => @arp_tgt_hw_addr}, 'arp-target-transport-address' => @arp_tgt_ipv4, 'vlan-match' => {'vlan-id' => {'vlan-id' => @vlan_id, 'vlan-id-present' => !@vlan_id.nil?}, 'vlan-pcp' => @vlan_pcp}, 'sctp-source-port' => @sctp_src, 'sctp-destination-port' => @sctp_dst, 'protocol-match-fields' => {'mpls-label' => @mpls_label, 'mpls-tc' => @mpls_tc, 'mpls-bos' => @mpls_bos}, :tunnel => {'tunnel-id' => @tunnel_id}, :metadata => {:metadata => , 'metadata-mask' => }} hash.delete("vlan-match") if !@vlan_id hash end |