Nicira Extension Structures¶
Nicira Extension Actions Structures¶
The followings shows the supported NXAction classes only in OpenFlow1.0¶
The followings shows the supported NXAction classes in OpenFlow1.0 or later¶
-
ryu.ofproto.nicira_ext.ofs_nbits(start, end)¶ The utility method for ofs_nbits
This method is used in the class to set the ofs_nbits.
This method converts start/end bits into ofs_nbits required to specify the bit range of OXM/NXM fields.
ofs_nbits can be calculated as following:
ofs_nbits = (start << 6) + (end - start)
The parameter start/end means the OXM/NXM field of ovs-ofctl command.
field[start..end] Attribute Description start Start bit for OXM/NXM field end End bit for OXM/NXM field
Nicira Extended Match Structures¶
The API of this class is the same as OFPMatch.
You can define the flow match by the keyword arguments. The following arguments are available.
| Argument | Value | Description |
|---|---|---|
| in_port_nxm | Integer 16bit | OpenFlow port number. |
| eth_dst_nxm | MAC address | Ethernet destination address. |
| eth_src_nxm | MAC address | Ethernet source address. |
| eth_type_nxm | Integer 16bit | Ethernet type. Needed to support Nicira extensions that require the eth_type to be set. (i.e. tcp_flags_nxm) |
| vlan_tci | Integer 16bit | VLAN TCI. Basically same as vlan_vid plus vlan_pcp. |
| nw_tos | Integer 8bit | IP ToS or IPv6 traffic class field dscp. Requires setting fields: eth_type_nxm = [0x0800 (IPv4)|0x86dd (IPv6)] |
| ip_proto_nxm | Integer 8bit | IP protocol. Needed to support Nicira extensions that require the ip_proto to be set. (i.e. tcp_flags_nxm) Requires setting fields: eth_type_nxm = [0x0800 (IPv4)|0x86dd (IPv6)] |
| ipv4_src_nxm | IPv4 address | IPv4 source address. Requires setting fields: eth_type_nxm = 0x0800 (IPv4) |
| ipv4_dst_nxm | IPv4 address | IPv4 destination address. Requires setting fields: eth_type_nxm = 0x0800 (IPv4) |
| tcp_src_nxm | Integer 16bit | TCP source port. Requires setting fields: eth_type_nxm = [0x0800 (IPv4)|0x86dd (IPv6)] and ip_proto_nxm = 6 (TCP) |
| tcp_dst_nxm | Integer 16bit | TCP destination port. Requires setting fields: eth_type_nxm = [0x0800 (IPv4)|0x86dd (IPv6)] and ip_proto_nxm = 6 (TCP) |
| udp_src_nxm | Integer 16bit | UDP source port. Requires setting fields: eth_type_nxm = [0x0800 (IPv4)|0x86dd (IPv6)] and ip_proto_nxm = 17 (UDP) |
| udp_dst_nxm | Integer 16bit | UDP destination port. eth_type_nxm = [0x0800 (IPv4)|0x86dd (IPv6)] and ip_proto_nxm = 17 (UDP) |
| icmpv4_type_nxm | Integer 8bit | Type matches the ICMP type and code matches the ICMP code. Requires setting fields: eth_type_nxm = 0x0800 (IPv4) and ip_proto_nxm = 1 (ICMP) |
| icmpv4_code_nxm | Integer 8bit | Type matches the ICMP type and code matches the ICMP code. Requires setting fields: eth_type_nxm = 0x0800 (IPv4) and ip_proto_nxm = 1 (ICMP) |
| arp_op_nxm | Integer 16bit | Only ARP opcodes between 1 and 255 should be specified for matching. Requires setting fields: eth_type_nxm = 0x0806 (ARP) |
| arp_spa_nxm | IPv4 address | An address may be specified as an IP address or host name. Requires setting fields: eth_type_nxm = 0x0806 (ARP) |
| arp_tpa_nxm | IPv4 address | An address may be specified as an IP address or host name. Requires setting fields: eth_type_nxm = 0x0806 (ARP) |
| tunnel_id_nxm | Integer 64bit | Tunnel identifier. |
| arp_sha_nxm | MAC address | An address is specified as 6 pairs of hexadecimal digits delimited by colons. Requires setting fields: eth_type_nxm = 0x0806 (ARP) |
| arp_tha_nxm | MAC address | An address is specified as 6 pairs of hexadecimal digits delimited by colons. Requires setting fields: eth_type_nxm = 0x0806 (ARP) |
| ipv6_src_nxm | IPv6 address | IPv6 source address. Requires setting fields: eth_type_nxm = 0x86dd (IPv6) |
| ipv6_dst_nxm | IPv6 address | IPv6 destination address. Requires setting fields: eth_type_nxm = 0x86dd (IPv6) |
| icmpv6_type_nxm | Integer 8bit | Type matches the ICMP type and code matches the ICMP code. Requires setting fields: eth_type_nxm = 0x86dd (IPv6) and ip_proto_nxm = 58 (ICMP for IPv6) |
| icmpv6_code_nxm | Integer 8bit | Type matches the ICMP type and code matches the ICMP code. Requires setting fields: eth_type_nxm = 0x86dd (IPv6) and ip_proto_nxm = 58 (ICMP for IPv6) |
| nd_target | IPv6 address | The target address ipv6. Requires setting fields: eth_type_nxm = 0x86dd (IPv6) and ip_proto_nxm = 58 (ICMP for IPv6) |
| nd_sll | MAC address | The source link-layer address option. Requires setting fields: eth_type_nxm = 0x86dd (IPv6) and ip_proto_nxm = 58 (ICMP for IPv6) and icmpv6_type_nxm = 135 (Neighbor solicitation) |
| nd_tll | MAC address | The target link-layer address option. Requires setting fields: eth_type_nxm = 0x86dd (IPv6) and ip_proto_nxm = 58 (ICMP for IPv6) and icmpv6_type_nxm = 136 (Neighbor advertisement) |
| ip_frag | Integer 8bit | frag_type specifies what kind of IP fragments or non-fragments to match. Requires setting fields: eth_type_nxm = [0x0800 (IPv4)|0x86dd (IPv6)] |
| ipv6_label | Integer 32bit | Matches IPv6 flow label. Requires setting fields: eth_type_nxm = 0x86dd (IPv6) |
| ip_ecn_nxm | Integer 8bit | Matches ecn bits in IP ToS or IPv6 traffic class fields. Requires setting fields: eth_type_nxm = [0x0800 (IPv4)|0x86dd (IPv6)] |
| nw_ttl | Integer 8bit | IP TTL or IPv6 hop limit value ttl. Requires setting fields: eth_type_nxm = [0x0800 (IPv4)|0x86dd (IPv6)] |
| mpls_ttl | Integer 8bit | The TTL of the outer MPLS label stack entry of a packet. Requires setting fields: eth_type_nxm = 0x8847 (MPLS Unicast) |
| tun_ipv4_src | IPv4 address | Tunnel IPv4 source address. Requires setting fields: eth_type_nxm = 0x0800 (IPv4) |
| tun_ipv4_dst | IPv4 address | Tunnel IPv4 destination address. Requires setting fields: eth_type_nxm = 0x0800 (IPv4) |
| pkt_mark | Integer 32bit | Packet metadata mark. |
| tcp_flags_nxm | Integer 16bit | TCP Flags. Requires setting fields: eth_type_nxm = [0x0800 (IP)|0x86dd (IPv6)] and ip_proto_nxm = 6 (TCP) |
| conj_id | Integer 32bit | Conjunction ID used only with the conjunction action |
| tun_gbp_id | Integer 16bit | The group policy identifier in the VXLAN header. |
| tun_gbp_flags | Integer 8bit | The group policy flags in the VXLAN header. |
| tun_flags | Integer 16bit | Flags indicating various aspects of the tunnel encapsulation. |
| ct_state | Integer 32bit | Conntrack state. |
| ct_zone | Integer 16bit | Conntrack zone. |
| ct_mark | Integer 32bit | Conntrack mark. |
| ct_label | Integer 128bit | Conntrack label. |
| tun_ipv6_src | IPv6 address | Tunnel IPv6 source address. Requires setting fields: eth_type_nxm = 0x86dd (IPv6) |
| tun_ipv6_dst | IPv6 address | Tunnel IPv6 destination address. Requires setting fields: eth_type_nxm = 0x86dd (IPv6) |
| _recirc_id | Integer 32bit | ID for recirculation. |
| _dp_hash | Integer 32bit | Flow hash computed in Datapath. |
| reg<idx> | Integer 32bit | Packet register. <idx> is register number 0-15. |
| xxreg<idx> | Integer 128bit | Packet extended-extended register. <idx> is register number 0-3. |
Note
Setting the TCP flags via the nicira extensions. This is required when using OVS version < 2.4. When using the nxm fields, you need to use any nxm prereq fields as well or you will receive a OFPBMC_BAD_PREREQ error
Example:
# WILL NOT work
flag = tcp.TCP_ACK
match = parser.OFPMatch(
tcp_flags_nxm=(flag, flag),
ip_proto=inet.IPPROTO_TCP,
eth_type=eth_type)
# Works
flag = tcp.TCP_ACK
match = parser.OFPMatch(
tcp_flags_nxm=(flag, flag),
ip_proto_nxm=inet.IPPROTO_TCP,
eth_type_nxm=eth_type)