class Pio::OpenFlow13::Match::Oxm::OpenflowBasic

rubocop:disable ClassLength OpenflowBasic part, tlv_value will use oxm_field, oxm_hasmask

Public Instance Methods

length() click to toggle source
# File lib/pio/open_flow13/match.rb, line 1011
def length
  tlv_value.length + 2
end
masked?() click to toggle source
# File lib/pio/open_flow13/match.rb, line 1015
def masked?
  oxm_hasmask == 1
end
method_missing(method, *args, &block) click to toggle source
# File lib/pio/open_flow13/match.rb, line 1019
def method_missing(method, *args, &block)
  tlv_value.__send__ method, *args, &block
end

Private Instance Methods

choose_tlv_value() click to toggle source

rubocop:disable MethodLength rubocop:disable CyclomaticComplexity rubocop:disable PerceivedComplexity rubocop:disable AbcSize

# File lib/pio/open_flow13/match.rb, line 1029
def choose_tlv_value
  case oxm_field
  when InPort::OXM_FIELD
    InPort
  when Metadata::OXM_FIELD
    masked? ? MaskedMetadata : Metadata
  when DestinationMacAddress::OXM_FIELD
    masked? ? MaskedDestinationMacAddress : DestinationMacAddress
  when SourceMacAddress::OXM_FIELD
    masked? ? MaskedSourceMacAddress : SourceMacAddress
  when EtherType::OXM_FIELD
    EtherType
  when VlanVid::OXM_FIELD
    VlanVid
  when VlanPcp::OXM_FIELD
    VlanPcp
  when IpDscp::OXM_FIELD
    IpDscp
  when IpEcn::OXM_FIELD
    IpEcn
  when Ipv4SourceAddress::OXM_FIELD
    masked? ? MaskedIpv4SourceAddress : Ipv4SourceAddress
  when Ipv4DestinationAddress::OXM_FIELD
    masked? ? MaskedIpv4DestinationAddress : Ipv4DestinationAddress
  when IpProtocol::OXM_FIELD
    IpProtocol
  when TcpSourcePort::OXM_FIELD
    TcpSourcePort
  when TcpDestinationPort::OXM_FIELD
    TcpDestinationPort
  when UdpSourcePort::OXM_FIELD
    UdpSourcePort
  when UdpDestinationPort::OXM_FIELD
    UdpDestinationPort
  when SctpSourcePort::OXM_FIELD
    SctpSourcePort
  when SctpDestinationPort::OXM_FIELD
    SctpDestinationPort
  when Icmpv4Type::OXM_FIELD
    Icmpv4Type
  when Icmpv4Code::OXM_FIELD
    Icmpv4Code
  when ArpOperation::OXM_FIELD
    ArpOperation
  when ArpSenderProtocolAddress::OXM_FIELD
    if masked?
      MaskedArpSenderProtocolAddress
    else
      ArpSenderProtocolAddress
    end
  when ArpTargetProtocolAddress::OXM_FIELD
    if masked?
      MaskedArpTargetProtocolAddress
    else
      ArpTargetProtocolAddress
    end
  when ArpSenderHardwareAddress::OXM_FIELD
    if masked?
      MaskedArpSenderHardwareAddress
    else
      ArpSenderHardwareAddress
    end
  when ArpTargetHardwareAddress::OXM_FIELD
    if masked?
      MaskedArpTargetHardwareAddress
    else
      ArpTargetHardwareAddress
    end
  when Ipv6SourceAddress::OXM_FIELD
    if masked?
      MaskedIpv6SourceAddress
    else
      Ipv6SourceAddress
    end
  when Ipv6DestinationAddress::OXM_FIELD
    masked? ? MaskedIpv6DestinationAddress : Ipv6DestinationAddress
  when TunnelId::OXM_FIELD
    masked? ? MaskedTunnelId : TunnelId
  else
    raise "Unknown OXM field value: #{oxm_field}"
  end
end