Class: Match
- Inherits:
-
Object
- Object
- Match
- Defined in:
- lib/openflowdev/match.rb
Overview
Class that represents OpenFlow flow matching attributes
Instance Attribute Summary collapse
-
#arp_op_code ⇒ Object
readonly
integer : ARP opcode.
-
#arp_src_hw_addr ⇒ Object
readonly
string : ARP source hardware address.
-
#arp_src_ipv4 ⇒ Object
readonly
string : ARP source IPv4 address.
-
#arp_tgt_hw_addr ⇒ Object
readonly
string : ARP target hardware address.
-
#arp_tgt_ipv4 ⇒ Object
readonly
string : ARP target IPv4 address.
-
#eth_type ⇒ Object
readonly
integer : Ethernet type.
-
#ethernet_dst ⇒ Object
readonly
string : Ethernet Destination address e.g.
-
#ethernet_src ⇒ Object
readonly
string : Ethernet Source address e.g.
-
#icmpv4_code ⇒ Object
readonly
integer : ICMPv4 code.
-
#icmpv4_type ⇒ Object
readonly
integer : ICMPv4 type.
-
#icmpv6_code ⇒ Object
readonly
integer : ICMPv6 code.
-
#icmpv6_type ⇒ Object
readonly
integer : ICMPv6 type.
-
#in_phy_port ⇒ Object
readonly
integer : Input physical port - not used for matches.
-
#in_port ⇒ Object
readonly
integer : Input port.
-
#ip_dscp ⇒ Object
readonly
integer : Differentiated Services Code Point.
-
#ip_ecn ⇒ Object
readonly
integer : Explicit Congestion Notificaiton.
-
#ip_proto ⇒ Object
readonly
integer : Ip protocol.
-
#ipv4_dst ⇒ Object
readonly
string : IPv4 Destination IP address.
-
#ipv4_src ⇒ Object
readonly
string : IPv4 Source IP address.
-
#ipv6_dst ⇒ Object
readonly
string : IPv6 Destination IP address.
-
#ipv6_ext_hdr ⇒ Object
readonly
integer : IPv6 Extension header.
-
#ipv6_flabel ⇒ Object
readonly
string : IPv6 Flow Label.
-
#ipv6_src ⇒ Object
readonly
string : IPv6 Source IP address.
-
#metadata ⇒ Object
readonly
integer : Openflow intra-table metadata.
-
#metadata_mask ⇒ Object
readonly
integer : Openflow intra-table metadata mask.
-
#mpls_bos ⇒ Object
readonly
integer : Multiprotocol Label Switching bottom of stack flag.
-
#mpls_label ⇒ Object
readonly
integer : Multiprotocol Label Switching label.
-
#mpls_tc ⇒ Object
readonly
integer : Multiprotocol Label Switching traffic class.
-
#sctp_dst ⇒ Object
readonly
integer : Stream control transmission protocol destination port.
-
#sctp_src ⇒ Object
readonly
integer : Stream control transmission protocol source port.
-
#tcp_dst_port ⇒ Object
readonly
integer : TCP Destination port number.
-
#tcp_src_port ⇒ Object
readonly
integer : TCP Source port number.
-
#tunnel_id ⇒ Object
readonly
integer : tunnel identifier.
-
#udp_dst_port ⇒ Object
readonly
integer : UDP Destination port number.
-
#udp_src_port ⇒ Object
readonly
integer : UDP Source port number.
-
#vlan_id ⇒ Object
readonly
integer: VLAN identifier.
-
#vlan_pcp ⇒ Object
readonly
integer: VLAN priority code point.
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
- Parameters *
eth_type - integer : Ethernet type *
ipv4_destination - string : IPv4 Destination IP address *
ipv4_source - string : IPv4 Source IP address *
ipv6_source - string : IPv6 Source IP address *
ipv6_destination - string : IPv6 Destination IP address *
ipv6_flabel - string : IPv6 Flow Label *
ipv6_ext_header - integer : IPv6 Extension header *
ethernet_destination -
string : Ethernet Destination address e.g.
- integer : IPv6 Extension header *
- string : IPv6 Flow Label *
- string : IPv6 Destination IP address *
- string : IPv6 Source IP address *
- string : IPv4 Source IP address *
- string : IPv4 Destination IP address *
- integer : Ethernet type *
- Parameters *
-
#to_hash ⇒ Object
:nodoc:.
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
Parameters
eth_type-
integer : Ethernet type
ipv4_destination-
string : IPv4 Destination IP address
ipv4_source-
string : IPv4 Source IP address
ipv6_source-
string : IPv6 Source IP address
ipv6_destination-
string : IPv6 Destination IP address
ipv6_flabel-
string : IPv6 Flow Label
ipv6_ext_header-
integer : IPv6 Extension header
ethernet_destination-
string : Ethernet Destination address e.g. “00:11:22:33:44:55”
ethernet_source-
string : Ethernet Source address e.g. “00:11:22:33:44:55”
in_physical_port-
integer : Input physical port - not used for matches
in_port-
integer : Input port
ip_protocol_num-
integer : Ip protocol
ip_dscp-
integer : Differentiated Services Code Point
ip_ecn-
integer : Explicit Congestion Notificaiton
tcp_source_port-
integer : TCP Source port number
tcp_destination_port-
integer : TCP Destination port number
udp_source_port-
integer : UDP Source port number
udp_destination_port-
integer : UDP Destination port number
icmpv4_type-
integer : ICMPv4 type
icmpv4_code-
integer : ICMPv4 code
icmpv6_type-
integer : ICMPv6 type
icmpv6_code-
integer : ICMPv6 code
arp_op_code-
integer : ARP opcode
arp_source_ipv4-
string : ARP source IPv4 address. e.g. “111.222.333.444”
arp_target_ipv4-
string : ARP target IPv4 address. e.g. “111.222.333.444”
arp_source_hardware_address-
string : ARP source hardware address. e.g. “111.222.333.444”
arp_target_hardware_address-
string : ARP target hardware address. e.g. “111.222.333.444”
vlan_id-
integer: VLAN identifier
vlan_pcp-
integer: VLAN priority code point
sctp_destination-
integer : Stream control transmission protocol destination port
sctp_source-
integer : Stream control transmission protocol source port
mpls_label-
integer : Multiprotocol Label Switching label
mpls_tc-
integer : Multiprotocol Label Switching traffic class
mpls_bos-
integer : Multiprotocol Label Switching bottom of stack flag
tunnel_id-
integer : tunnel identifier
metadata-
integer : Openflow intra-table metadata
metadata_mask-
integer : Openflow intra-table metadata mask
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/openflowdev/match.rb', line 151 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 = @metadata_mask = end |
Instance Attribute Details
#arp_op_code ⇒ Object (readonly)
integer : ARP opcode
80 81 82 |
# File 'lib/openflowdev/match.rb', line 80 def arp_op_code @arp_op_code end |
#arp_src_hw_addr ⇒ Object (readonly)
string : ARP source hardware address. e.g. “111.222.333.444”
86 87 88 |
# File 'lib/openflowdev/match.rb', line 86 def arp_src_hw_addr @arp_src_hw_addr end |
#arp_src_ipv4 ⇒ Object (readonly)
string : ARP source IPv4 address. e.g. “111.222.333.444”
82 83 84 |
# File 'lib/openflowdev/match.rb', line 82 def arp_src_ipv4 @arp_src_ipv4 end |
#arp_tgt_hw_addr ⇒ Object (readonly)
string : ARP target hardware address. e.g. “111.222.333.444”
88 89 90 |
# File 'lib/openflowdev/match.rb', line 88 def arp_tgt_hw_addr @arp_tgt_hw_addr end |
#arp_tgt_ipv4 ⇒ Object (readonly)
string : ARP target IPv4 address. e.g. “111.222.333.444”
84 85 86 |
# File 'lib/openflowdev/match.rb', line 84 def arp_tgt_ipv4 @arp_tgt_ipv4 end |
#eth_type ⇒ Object (readonly)
integer : Ethernet type
36 37 38 |
# File 'lib/openflowdev/match.rb', line 36 def eth_type @eth_type end |
#ethernet_dst ⇒ Object (readonly)
string : Ethernet Destination address e.g. “00:11:22:33:44:55”
50 51 52 |
# File 'lib/openflowdev/match.rb', line 50 def ethernet_dst @ethernet_dst end |
#ethernet_src ⇒ Object (readonly)
string : Ethernet Source address e.g. “00:11:22:33:44:55”
52 53 54 |
# File 'lib/openflowdev/match.rb', line 52 def ethernet_src @ethernet_src end |
#icmpv4_code ⇒ Object (readonly)
integer : ICMPv4 code
74 75 76 |
# File 'lib/openflowdev/match.rb', line 74 def icmpv4_code @icmpv4_code end |
#icmpv4_type ⇒ Object (readonly)
integer : ICMPv4 type
72 73 74 |
# File 'lib/openflowdev/match.rb', line 72 def icmpv4_type @icmpv4_type end |
#icmpv6_code ⇒ Object (readonly)
integer : ICMPv6 code
78 79 80 |
# File 'lib/openflowdev/match.rb', line 78 def icmpv6_code @icmpv6_code end |
#icmpv6_type ⇒ Object (readonly)
integer : ICMPv6 type
76 77 78 |
# File 'lib/openflowdev/match.rb', line 76 def icmpv6_type @icmpv6_type end |
#in_phy_port ⇒ Object (readonly)
integer : Input physical port - not used for matches
54 55 56 |
# File 'lib/openflowdev/match.rb', line 54 def in_phy_port @in_phy_port end |
#in_port ⇒ Object (readonly)
integer : Input port
56 57 58 |
# File 'lib/openflowdev/match.rb', line 56 def in_port @in_port end |
#ip_dscp ⇒ Object (readonly)
integer : Differentiated Services Code Point
60 61 62 |
# File 'lib/openflowdev/match.rb', line 60 def ip_dscp @ip_dscp end |
#ip_ecn ⇒ Object (readonly)
integer : Explicit Congestion Notificaiton
62 63 64 |
# File 'lib/openflowdev/match.rb', line 62 def ip_ecn @ip_ecn end |
#ip_proto ⇒ Object (readonly)
integer : Ip protocol
58 59 60 |
# File 'lib/openflowdev/match.rb', line 58 def ip_proto @ip_proto end |
#ipv4_dst ⇒ Object (readonly)
string : IPv4 Destination IP address
38 39 40 |
# File 'lib/openflowdev/match.rb', line 38 def ipv4_dst @ipv4_dst end |
#ipv4_src ⇒ Object (readonly)
string : IPv4 Source IP address
40 41 42 |
# File 'lib/openflowdev/match.rb', line 40 def ipv4_src @ipv4_src end |
#ipv6_dst ⇒ Object (readonly)
string : IPv6 Destination IP address
44 45 46 |
# File 'lib/openflowdev/match.rb', line 44 def ipv6_dst @ipv6_dst end |
#ipv6_ext_hdr ⇒ Object (readonly)
integer : IPv6 Extension header
48 49 50 |
# File 'lib/openflowdev/match.rb', line 48 def ipv6_ext_hdr @ipv6_ext_hdr end |
#ipv6_flabel ⇒ Object (readonly)
string : IPv6 Flow Label
46 47 48 |
# File 'lib/openflowdev/match.rb', line 46 def ipv6_flabel @ipv6_flabel end |
#ipv6_src ⇒ Object (readonly)
string : IPv6 Source IP address
42 43 44 |
# File 'lib/openflowdev/match.rb', line 42 def ipv6_src @ipv6_src end |
#metadata ⇒ Object (readonly)
integer : Openflow intra-table metadata
106 107 108 |
# File 'lib/openflowdev/match.rb', line 106 def @metadata end |
#metadata_mask ⇒ Object (readonly)
integer : Openflow intra-table metadata mask
108 109 110 |
# File 'lib/openflowdev/match.rb', line 108 def @metadata_mask end |
#mpls_bos ⇒ Object (readonly)
integer : Multiprotocol Label Switching bottom of stack flag
102 103 104 |
# File 'lib/openflowdev/match.rb', line 102 def mpls_bos @mpls_bos end |
#mpls_label ⇒ Object (readonly)
integer : Multiprotocol Label Switching label
98 99 100 |
# File 'lib/openflowdev/match.rb', line 98 def mpls_label @mpls_label end |
#mpls_tc ⇒ Object (readonly)
integer : Multiprotocol Label Switching traffic class
100 101 102 |
# File 'lib/openflowdev/match.rb', line 100 def mpls_tc @mpls_tc end |
#sctp_dst ⇒ Object (readonly)
integer : Stream control transmission protocol destination port
94 95 96 |
# File 'lib/openflowdev/match.rb', line 94 def sctp_dst @sctp_dst end |
#sctp_src ⇒ Object (readonly)
integer : Stream control transmission protocol source port
96 97 98 |
# File 'lib/openflowdev/match.rb', line 96 def sctp_src @sctp_src end |
#tcp_dst_port ⇒ Object (readonly)
integer : TCP Destination port number
66 67 68 |
# File 'lib/openflowdev/match.rb', line 66 def tcp_dst_port @tcp_dst_port end |
#tcp_src_port ⇒ Object (readonly)
integer : TCP Source port number
64 65 66 |
# File 'lib/openflowdev/match.rb', line 64 def tcp_src_port @tcp_src_port end |
#tunnel_id ⇒ Object (readonly)
integer : tunnel identifier
104 105 106 |
# File 'lib/openflowdev/match.rb', line 104 def tunnel_id @tunnel_id end |
#udp_dst_port ⇒ Object (readonly)
integer : UDP Destination port number
70 71 72 |
# File 'lib/openflowdev/match.rb', line 70 def udp_dst_port @udp_dst_port end |
#udp_src_port ⇒ Object (readonly)
integer : UDP Source port number
68 69 70 |
# File 'lib/openflowdev/match.rb', line 68 def udp_src_port @udp_src_port end |
#vlan_id ⇒ Object (readonly)
integer: VLAN identifier
90 91 92 |
# File 'lib/openflowdev/match.rb', line 90 def vlan_id @vlan_id end |
#vlan_pcp ⇒ Object (readonly)
integer: VLAN priority code point
92 93 94 |
# File 'lib/openflowdev/match.rb', line 92 def vlan_pcp @vlan_pcp end |
Instance Method Details
#to_hash ⇒ Object
:nodoc:
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/openflowdev/match.rb', line 202 def to_hash #:nodoc: 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, 'metadata-mask' => @metadata_mask}} hash.delete("vlan-match") if !@vlan_id hash end |