Nicira Extension Structures¶
Nicira Extension Actions Structures¶
The followings shows the supported NXAction classes only in OpenFlow1.0¶
-
class
os_ken.ofproto.ofproto_v1_0_parser.
NXActionSetQueue
(queue_id, type_=None, len_=None, vendor=None, subtype=None)¶ Set queue action
This action sets the queue that should be used to queue when packets are output.
And equivalent to the followings action of ovs-ofctl command.
set_queue:queue
Attribute
Description
queue_id
Queue ID for the packets
Note
This actions is supported by
OFPActionSetQueue
in OpenFlow1.2 or later.Example:
actions += [parser.NXActionSetQueue(queue_id=10)]
-
class
os_ken.ofproto.ofproto_v1_0_parser.
NXActionDecTtl
(type_=None, len_=None, vendor=None, subtype=None)¶ Decrement IP TTL action
This action decrements TTL of IPv4 packet or hop limit of IPv6 packet.
And equivalent to the followings action of ovs-ofctl command.
dec_ttl
Note
This actions is supported by
OFPActionDecNwTtl
in OpenFlow1.2 or later.Example:
actions += [parser.NXActionDecTtl()]
-
class
os_ken.ofproto.ofproto_v1_0_parser.
NXActionPushMpls
(ethertype, type_=None, len_=None, vendor=None, subtype=None)¶ Push MPLS action
This action pushes a new MPLS header to the packet.
And equivalent to the followings action of ovs-ofctl command.
push_mpls:ethertype
Attribute
Description
ethertype
Ether type(The value must be either 0x8847 or 0x8848)
Note
This actions is supported by
OFPActionPushMpls
in OpenFlow1.2 or later.Example:
match = parser.OFPMatch(dl_type=0x0800) actions += [parser.NXActionPushMpls(ethertype=0x8847)]
-
class
os_ken.ofproto.ofproto_v1_0_parser.
NXActionPopMpls
(ethertype, type_=None, len_=None, vendor=None, subtype=None)¶ Pop MPLS action
This action pops the MPLS header from the packet.
And equivalent to the followings action of ovs-ofctl command.
pop_mpls:ethertype
Attribute
Description
ethertype
Ether type
Note
This actions is supported by
OFPActionPopMpls
in OpenFlow1.2 or later.Example:
match = parser.OFPMatch(dl_type=0x8847) actions += [parser.NXActionPushMpls(ethertype=0x0800)]
-
class
os_ken.ofproto.ofproto_v1_0_parser.
NXActionSetMplsTtl
(ttl, type_=None, len_=None, vendor=None, subtype=None)¶ Set MPLS TTL action
This action sets the MPLS TTL.
And equivalent to the followings action of ovs-ofctl command.
set_mpls_ttl:ttl
Attribute
Description
ttl
MPLS TTL
Note
This actions is supported by
OFPActionSetMplsTtl
in OpenFlow1.2 or later.Example:
actions += [parser.NXActionSetMplsTil(ttl=128)]
-
class
os_ken.ofproto.ofproto_v1_0_parser.
NXActionDecMplsTtl
(type_=None, len_=None, vendor=None, subtype=None)¶ Decrement MPLS TTL action
This action decrements the MPLS TTL.
And equivalent to the followings action of ovs-ofctl command.
dec_mpls_ttl
Note
This actions is supported by
OFPActionDecMplsTtl
in OpenFlow1.2 or later.Example:
actions += [parser.NXActionDecMplsTil()]
-
class
os_ken.ofproto.ofproto_v1_0_parser.
NXActionSetMplsLabel
(label, type_=None, len_=None, vendor=None, subtype=None)¶ Set MPLS Lavel action
This action sets the MPLS Label.
And equivalent to the followings action of ovs-ofctl command.
set_mpls_label:label
Attribute
Description
label
MPLS Label
Note
This actions is supported by
OFPActionSetField(mpls_label=label)
in OpenFlow1.2 or later.Example:
actions += [parser.NXActionSetMplsLabel(label=0x10)]
-
class
os_ken.ofproto.ofproto_v1_0_parser.
NXActionSetMplsTc
(tc, type_=None, len_=None, vendor=None, subtype=None)¶ Set MPLS Tc action
This action sets the MPLS Tc.
And equivalent to the followings action of ovs-ofctl command.
set_mpls_tc:tc
Attribute
Description
tc
MPLS Tc
Note
This actions is supported by
OFPActionSetField(mpls_label=tc)
in OpenFlow1.2 or later.Example:
actions += [parser.NXActionSetMplsLabel(tc=0x10)]
The followings shows the supported NXAction classes in OpenFlow1.0 or later¶
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionPopQueue
(type_=None, len_=None, experimenter=None, subtype=None)¶ Pop queue action
This action restors the queue to the value it was before any set_queue actions were applied.
And equivalent to the followings action of ovs-ofctl command.
pop_queue
Example:
actions += [parser.NXActionPopQueue()]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionRegLoad
(ofs_nbits, dst, value, type_=None, len_=None, experimenter=None, subtype=None)¶ Load literal value action
This action loads a literal value into a field or part of a field.
And equivalent to the followings action of ovs-ofctl command.
load:value->dst[start..end]
Attribute
Description
ofs_nbits
Start and End for the OXM/NXM field. Setting method refer to the
nicira_ext.ofs_nbits
dst
OXM/NXM header for destination field
value
OXM/NXM value to be loaded
Example:
actions += [parser.NXActionRegLoad( ofs_nbits=nicira_ext.ofs_nbits(4, 31), dst="eth_dst", value=0x112233)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionRegLoad2
(dst, value, mask=None, type_=None, len_=None, experimenter=None, subtype=None)¶ Load literal value action
This action loads a literal value into a field or part of a field.
And equivalent to the followings action of ovs-ofctl command.
set_field:value[/mask]->dst
Attribute
Description
value
OXM/NXM value to be loaded
mask
Mask for destination field
dst
OXM/NXM header for destination field
Example:
actions += [parser.NXActionRegLoad2(dst="tun_ipv4_src", value="192.168.10.0", mask="255.255.255.0")]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionNote
(note, type_=None, len_=None, experimenter=None, subtype=None)¶ Note action
This action does nothing at all.
And equivalent to the followings action of ovs-ofctl command.
note:[hh]..
Attribute
Description
note
A list of integer type values
Example:
actions += [parser.NXActionNote(note=[0xaa,0xbb,0xcc,0xdd])]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionSetTunnel
(tun_id, type_=None, len_=None, experimenter=None, subtype=None)¶ Set Tunnel action
This action sets the identifier (such as GRE) to the specified id.
And equivalent to the followings action of ovs-ofctl command.
Note
This actions is supported by
OFPActionSetField
in OpenFlow1.2 or later.set_tunnel:id
Attribute
Description
tun_id
Tunnel ID(32bits)
Example:
actions += [parser.NXActionSetTunnel(tun_id=0xa)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionSetTunnel64
(tun_id, type_=None, len_=None, experimenter=None, subtype=None)¶ Set Tunnel action
This action outputs to a port that encapsulates the packet in a tunnel.
And equivalent to the followings action of ovs-ofctl command.
Note
This actions is supported by
OFPActionSetField
in OpenFlow1.2 or later.set_tunnel64:id
Attribute
Description
tun_id
Tunnel ID(64bits)
Example:
actions += [parser.NXActionSetTunnel64(tun_id=0xa)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionRegMove
(src_field, dst_field, n_bits, src_ofs=0, dst_ofs=0, type_=None, len_=None, experimenter=None, subtype=None)¶ Move register action
This action copies the src to dst.
And equivalent to the followings action of ovs-ofctl command.
move:src[start..end]->dst[start..end ]
Attribute
Description
src_field
OXM/NXM header for source field
dst_field
OXM/NXM header for destination field
n_bits
Number of bits
src_ofs
Starting bit offset in source
dst_ofs
Starting bit offset in destination
Caution
- src_start and src_end difference and dst_start
and dst_end difference must be the same.
Example:
actions += [parser.NXActionRegMove(src_field="reg0", dst_field="reg1", n_bits=5, src_ofs=0 dst_ofs=10)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionResubmit
(in_port=65528, type_=None, len_=None, experimenter=None, subtype=None)¶ Resubmit action
This action searches one of the switch's flow tables.
And equivalent to the followings action of ovs-ofctl command.
resubmit:port
Attribute
Description
in_port
New in_port for checking flow table
Example:
actions += [parser.NXActionResubmit(in_port=8080)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionResubmitTable
(in_port=65528, table_id=255, type_=None, len_=None, experimenter=None, subtype=None)¶ Resubmit action
This action searches one of the switch's flow tables.
And equivalent to the followings action of ovs-ofctl command.
resubmit([port],[table])
Attribute
Description
in_port
New in_port for checking flow table
table_id
Checking flow tables
Example:
actions += [parser.NXActionResubmit(in_port=8080, table_id=10)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionOutputReg
(ofs_nbits, src, max_len, type_=None, len_=None, experimenter=None, subtype=None)¶ Add output action
This action outputs the packet to the OpenFlow port number read from src.
And equivalent to the followings action of ovs-ofctl command.
output:src[start...end]
Attribute
Description
ofs_nbits
Start and End for the OXM/NXM field. Setting method refer to the
nicira_ext.ofs_nbits
src
OXM/NXM header for source field
max_len
Max length to send to controller
Example:
actions += [parser.NXActionOutputReg( ofs_nbits=nicira_ext.ofs_nbits(4, 31), src="reg0", max_len=1024)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionOutputReg2
(ofs_nbits, src, max_len, type_=None, len_=None, experimenter=None, subtype=None)¶ Add output action
This action outputs the packet to the OpenFlow port number read from src.
And equivalent to the followings action of ovs-ofctl command.
output:src[start...end]
Note
Like the
NXActionOutputReg
but organized so that there is room for a 64-bit experimenter OXM as 'src'.Attribute
Description
ofs_nbits
Start and End for the OXM/NXM field. Setting method refer to the
nicira_ext.ofs_nbits
src
OXM/NXM header for source field
max_len
Max length to send to controller
Example:
actions += [parser.NXActionOutputReg2( ofs_nbits=nicira_ext.ofs_nbits(4, 31), src="reg0", max_len=1024)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionLearn
(table_id, specs, idle_timeout=0, hard_timeout=0, priority=32768, cookie=0, flags=0, fin_idle_timeout=0, fin_hard_timeout=0, type_=None, len_=None, experimenter=None, subtype=None)¶ Adds or modifies flow action
This action adds or modifies a flow in OpenFlow table.
And equivalent to the followings action of ovs-ofctl command.
learn(argument[,argument]...)
Attribute
Description
table_id
The table in which the new flow should be inserted
specs
Adds a match criterion to the new flow
Please use the
NXFlowSpecMatch
in order to set the following formatfield=valuefield[start..end] =src[start..end]field[start..end]Please use the
NXFlowSpecLoad
in order to set the following formatload:value->dst[start..end]load:src[start..end] ->dst[start..end]Please use the
NXFlowSpecOutput
in order to set the following formatoutput:field[start..end]idle_timeout
Idle time before discarding(seconds)
hard_timeout
Max time before discarding(seconds)
priority
Priority level of flow entry
cookie
Cookie for new flow
flags
send_flow_rem
fin_idle_timeout
Idle timeout after FIN(seconds)
fin_hard_timeout
Hard timeout after FIN(seconds)
Caution
The arguments specify the flow's match fields, actions, and other properties, as follows. At least one match criterion and one action argument should ordinarily be specified.
Example:
actions += [ parser.NXActionLearn(able_id=10, specs=[parser.NXFlowSpecMatch(src=0x800, dst=('eth_type_nxm', 0), n_bits=16), parser.NXFlowSpecMatch(src=('reg1', 1), dst=('reg2', 3), n_bits=5), parser.NXFlowSpecMatch(src=('reg3', 1), dst=('reg3', 1), n_bits=5), parser.NXFlowSpecLoad(src=0, dst=('reg4', 3), n_bits=5), parser.NXFlowSpecLoad(src=('reg5', 1), dst=('reg6', 3), n_bits=5), parser.NXFlowSpecOutput(src=('reg7', 1), dst="", n_bits=5)], idle_timeout=180, hard_timeout=300, priority=1, cookie=0x64, flags=ofproto.OFPFF_SEND_FLOW_REM, fin_idle_timeout=180, fin_hard_timeout=300)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionExit
(type_=None, len_=None, experimenter=None, subtype=None)¶ Halt action
This action causes OpenvSwitch to immediately halt execution of further actions.
And equivalent to the followings action of ovs-ofctl command.
exit
Example:
actions += [parser.NXActionExit()]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionController
(max_len, controller_id, reason, type_=None, len_=None, experimenter=None, subtype=None)¶ Send packet in message action
This action sends the packet to the OpenFlow controller as a packet in message.
And equivalent to the followings action of ovs-ofctl command.
controller(key=value...)
Attribute
Description
max_len
Max length to send to controller
controller_id
Controller ID to send packet-in
reason
Reason for sending the message
Example:
actions += [ parser.NXActionController(max_len=1024, controller_id=1, reason=ofproto.OFPR_INVALID_TTL)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionController2
(type_=None, len_=None, vendor=None, subtype=None, **kwargs)¶ Send packet in message action
This action sends the packet to the OpenFlow controller as a packet in message.
And equivalent to the followings action of ovs-ofctl command.
controller(key=value...)
Attribute
Description
max_len
Max length to send to controller
controller_id
Controller ID to send packet-in
reason
Reason for sending the message
userdata
Additional data to the controller in the packet-in message
pause
Flag to pause pipeline to resume later
Example:
actions += [ parser.NXActionController(max_len=1024, controller_id=1, reason=ofproto.OFPR_INVALID_TTL, userdata=[0xa,0xb,0xc], pause=True)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionDecTtlCntIds
(cnt_ids, type_=None, len_=None, experimenter=None, subtype=None)¶ Decrement TTL action
This action decrements TTL of IPv4 packet or hop limits of IPv6 packet.
And equivalent to the followings action of ovs-ofctl command.
dec_ttl(id1[,id2]...)
Attribute
Description
cnt_ids
Controller ids
Example:
actions += [parser.NXActionDecTtlCntIds(cnt_ids=[1,2,3])]
Note
If you want to set the following ovs-ofctl command. Please use
OFPActionDecNwTtl
.dec_ttl
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionStackPush
(field, start, end, type_=None, len_=None, experimenter=None, subtype=None)¶ Push field action
This action pushes field to top of the stack.
And equivalent to the followings action of ovs-ofctl command.
pop:dst[start...end]
Attribute
Description
field
OXM/NXM header for source field
start
Start bit for source field
end
End bit for source field
Example:
actions += [parser.NXActionStackPush(field="reg2", start=0, end=5)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionStackPop
(field, start, end, type_=None, len_=None, experimenter=None, subtype=None)¶ Pop field action
This action pops field from top of the stack.
And equivalent to the followings action of ovs-ofctl command.
pop:src[start...end]
Attribute
Description
field
OXM/NXM header for destination field
start
Start bit for destination field
end
End bit for destination field
Example:
actions += [parser.NXActionStackPop(field="reg2", start=0, end=5)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionSample
(probability, collector_set_id=0, obs_domain_id=0, obs_point_id=0, type_=None, len_=None, experimenter=None, subtype=None)¶ Sample packets action
This action samples packets and sends one sample for every sampled packet.
And equivalent to the followings action of ovs-ofctl command.
sample(argument[,argument]...)
Attribute
Description
probability
The number of sampled packets
collector_set_id
The unsigned 32-bit integer identifier of the set of sample collectors to send sampled packets to
obs_domain_id
The Unsigned 32-bit integer Observation Domain ID
obs_point_id
The unsigned 32-bit integer Observation Point ID
Example:
actions += [parser.NXActionSample(probability=3, collector_set_id=1, obs_domain_id=2, obs_point_id=3,)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionSample2
(probability, collector_set_id=0, obs_domain_id=0, obs_point_id=0, sampling_port=0, type_=None, len_=None, experimenter=None, subtype=None)¶ Sample packets action
This action samples packets and sends one sample for every sampled packet. 'sampling_port' can be equal to ingress port or one of egress ports.
And equivalent to the followings action of ovs-ofctl command.
sample(argument[,argument]...)
Attribute
Description
probability
The number of sampled packets
collector_set_id
The unsigned 32-bit integer identifier of the set of sample collectors to send sampled packets to
obs_domain_id
The Unsigned 32-bit integer Observation Domain ID
obs_point_id
The unsigned 32-bit integer Observation Point ID
sampling_port
Sampling port number
Example:
actions += [parser.NXActionSample2(probability=3, collector_set_id=1, obs_domain_id=2, obs_point_id=3, sampling_port=8080)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionFinTimeout
(fin_idle_timeout, fin_hard_timeout, type_=None, len_=None, experimenter=None, subtype=None)¶ Change TCP timeout action
This action changes the idle timeout or hard timeout or both, of this OpenFlow rule when the rule matches a TCP packet with the FIN or RST flag.
And equivalent to the followings action of ovs-ofctl command.
fin_timeout(argument[,argument]...)
Attribute
Description
fin_idle_timeout
Causes the flow to expire after the given number of seconds of inactivity
fin_idle_timeout
Causes the flow to expire after the given number of second, regardless of activity
Example:
match = parser.OFPMatch(ip_proto=6, eth_type=0x0800) actions += [parser.NXActionFinTimeout(fin_idle_timeout=30, fin_hard_timeout=60)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionConjunction
(clause, n_clauses, id_, type_=None, len_=None, experimenter=None, subtype=None)¶ Conjunctive matches action
This action ties groups of individual OpenFlow flows into higher-level conjunctive flows. Please refer to the ovs-ofctl command manual for details.
And equivalent to the followings action of ovs-ofctl command.
conjunction(id,k/n)
Attribute
Description
clause
Number assigned to the flow's dimension
n_clauses
Specify the conjunctive flow's match condition
id_
Conjunction ID
Example:
actions += [parser.NXActionConjunction(clause=1, n_clauses=2, id_=10)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionMultipath
(fields, basis, algorithm, max_link, arg, ofs_nbits, dst, type_=None, len_=None, experimenter=None, subtype=None)¶ Select multipath link action
This action selects multipath link based on the specified parameters. Please refer to the ovs-ofctl command manual for details.
And equivalent to the followings action of ovs-ofctl command.
multipath(fields, basis, algorithm, n_links, arg, dst[start..end])
Attribute
Description
fields
One of NX_HASH_FIELDS_*
basis
Universal hash parameter
algorithm
One of NX_MP_ALG_*.
max_link
Number of output links
arg
Algorithm-specific argument
ofs_nbits
Start and End for the OXM/NXM field. Setting method refer to the
nicira_ext.ofs_nbits
dst
OXM/NXM header for source field
Example:
actions += [parser.NXActionMultipath( fields=nicira_ext.NX_HASH_FIELDS_SYMMETRIC_L4, basis=1024, algorithm=nicira_ext.NX_MP_ALG_HRW, max_link=5, arg=0, ofs_nbits=nicira_ext.ofs_nbits(4, 31), dst="reg2")]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionBundle
(algorithm, fields, basis, slave_type, n_slaves, ofs_nbits, dst, slaves)¶ Select bundle link action
This action selects bundle link based on the specified parameters. Please refer to the ovs-ofctl command manual for details.
And equivalent to the followings action of ovs-ofctl command.
bundle(fields, basis, algorithm, slave_type, slaves:[ s1, s2,...])
Attribute
Description
algorithm
One of NX_MP_ALG_*.
fields
One of NX_HASH_FIELDS_*
basis
Universal hash parameter
slave_type
Type of slaves(must be NXM_OF_IN_PORT)
n_slaves
Number of slaves
ofs_nbits
Start and End for the OXM/NXM field. (must be zero)
dst
OXM/NXM header for source field(must be zero)
slaves
List of slaves
Example:
actions += [parser.NXActionBundle( algorithm=nicira_ext.NX_MP_ALG_HRW, fields=nicira_ext.NX_HASH_FIELDS_ETH_SRC, basis=0, slave_type=nicira_ext.NXM_OF_IN_PORT, n_slaves=2, ofs_nbits=0, dst=0, slaves=[2, 3])]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionBundleLoad
(algorithm, fields, basis, slave_type, n_slaves, ofs_nbits, dst, slaves)¶ Select bundle link action
This action has the same behavior as the bundle action, with one exception. Please refer to the ovs-ofctl command manual for details.
And equivalent to the followings action of ovs-ofctl command.
bundle_load(fields, basis, algorithm, slave_type, dst[start... *emd*], slaves:[ s1, s2,...]) |
Attribute
Description
algorithm
One of NX_MP_ALG_*.
fields
One of NX_HASH_FIELDS_*
basis
Universal hash parameter
slave_type
Type of slaves(must be NXM_OF_IN_PORT)
n_slaves
Number of slaves
ofs_nbits
Start and End for the OXM/NXM field. Setting method refer to the
nicira_ext.ofs_nbits
dst
OXM/NXM header for source field
slaves
List of slaves
Example:
actions += [parser.NXActionBundleLoad( algorithm=nicira_ext.NX_MP_ALG_HRW, fields=nicira_ext.NX_HASH_FIELDS_ETH_SRC, basis=0, slave_type=nicira_ext.NXM_OF_IN_PORT, n_slaves=2, ofs_nbits=nicira_ext.ofs_nbits(4, 31), dst="reg0", slaves=[2, 3])]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionCT
(flags, zone_src, zone_ofs_nbits, recirc_table, alg, actions, type_=None, len_=None, experimenter=None, subtype=None)¶ Pass traffic to the connection tracker action
This action sends the packet through the connection tracker.
And equivalent to the followings action of ovs-ofctl command.
ct(argument[,argument]...)
Attribute
Description
flags
Zero or more(Unspecified flag bits must be zero.)
zone_src
OXM/NXM header for source field
zone_ofs_nbits
Start and End for the OXM/NXM field. Setting method refer to the
nicira_ext.ofs_nbits
. If you need set the Immediate value for zone, zone_src must be set to None or empty character string.recirc_table
Recirculate to a specific table
alg
Well-known port number for the protocol
actions
Zero or more actions may immediately follow this action
Note
If you set number to zone_src, Traceback occurs when you run the to_jsondict.
Example:
match = parser.OFPMatch(eth_type=0x0800, ct_state=(0,32)) actions += [parser.NXActionCT( flags = 1, zone_src = "reg0", zone_ofs_nbits = nicira_ext.ofs_nbits(4, 31), recirc_table = 4, alg = 0, actions = [])]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionNAT
(flags, range_ipv4_min='', range_ipv4_max='', range_ipv6_min='', range_ipv6_max='', range_proto_min=None, range_proto_max=None, type_=None, len_=None, experimenter=None, subtype=None)¶ Network address translation action
This action sends the packet through the connection tracker.
And equivalent to the followings action of ovs-ofctl command.
Note
The following command image does not exist in ovs-ofctl command manual and has been created from the command response.
nat(src=ip_min-ip_max : proto_min-proto-max)
Attribute
Description
flags
Zero or more(Unspecified flag bits must be zero.)
range_ipv4_min
Range ipv4 address minimun
range_ipv4_max
Range ipv4 address maximun
range_ipv6_min
Range ipv6 address minimun
range_ipv6_max
Range ipv6 address maximun
range_proto_min
Range protocol minimum
range_proto_max
Range protocol maximun
Caution
NXActionNAT
must be defined in the actions in theNXActionCT
.Example:
match = parser.OFPMatch(eth_type=0x0800) actions += [ parser.NXActionCT( flags = 1, zone_src = "reg0", zone_ofs_nbits = nicira_ext.ofs_nbits(4, 31), recirc_table = 255, alg = 0, actions = [ parser.NXActionNAT( flags = 1, range_ipv4_min = "10.1.12.0", range_ipv4_max = "10.1.13.255", range_ipv6_min = "", range_ipv6_max = "", range_proto_min = 1, range_proto_max = 1023 ) ] ) ]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionOutputTrunc
(port, max_len, type_=None, len_=None, experimenter=None, subtype=None)¶ Truncate output action
This action truncate a packet into the specified size and outputs it.
And equivalent to the followings action of ovs-ofctl command.
output(port=port,max_len=max_len)
Attribute
Description
port
Output port
max_len
Max bytes to send
Example:
actions += [parser.NXActionOutputTrunc(port=8080, max_len=1024)]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXActionDecNshTtl
(type_=None, len_=None, vendor=None, subtype=None)¶ Decrement NSH TTL action
This action decrements the TTL in the Network Service Header(NSH).
This action was added in OVS v2.9.
And equivalent to the followings action of ovs-ofctl command.
dec_nsh_ttl
Example:
actions += [parser.NXActionDecNshTtl()]
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXFlowSpecMatch
(src, dst, n_bits)¶ Specification for adding match criterion
This class is used by
NXActionLearn
.For the usage of this class, please refer to
NXActionLearn
.Attribute
Description
src
OXM/NXM header and Start bit for source field
dst
OXM/NXM header and Start bit for destination field
n_bits
The number of bits from the start bit
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXFlowSpecLoad
(src, dst, n_bits)¶ Add NXAST_REG_LOAD actions
This class is used by
NXActionLearn
.For the usage of this class, please refer to
NXActionLearn
.Attribute
Description
src
OXM/NXM header and Start bit for source field
dst
OXM/NXM header and Start bit for destination field
n_bits
The number of bits from the start bit
-
class
os_ken.ofproto.ofproto_v1_3_parser.
NXFlowSpecOutput
(src, n_bits, dst='')¶ Add an OFPAT_OUTPUT action
This class is used by
NXActionLearn
.For the usage of this class, please refer to
NXActionLearn
.Attribute
Description
src
OXM/NXM header and Start bit for source field
dst
Must be ''
n_bits
The number of bits from the start bit
-
os_ken.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. |
nsh_flags |
Integer 8bit |
Flags field in NSH Base Header. Requires eth_type_nxm = 0x894f (NSH). Since OpenFlow 1.3 and OVS v2.8. |
nsh_mdtype |
Integer 8bit |
Metadata Type in NSH Base Header. Requires eth_type_nxm = 0x894f (NSH). Since OpenFlow 1.3 and OVS v2.8. |
nsh_np |
Integer 8bit |
Next Protocol type in NSH Base Header. Requires eth_type_nxm = 0x894f (NSH). Since OpenFlow 1.3 and OVS v2.8. |
nsh_spi |
Integer 32bit |
Service Path Identifier in NSH Service Path Header. Requires eth_type_nxm = 0x894f (NSH). Since OpenFlow 1.3 and OVS v2.8. |
nsh_si |
Integer 8bit |
Service Index in NSH Service Path Header. Requires eth_type_nxm = 0x894f (NSH). Since OpenFlow 1.3 and OVS v2.8. |
nsh_c<N> |
Integer 32bit |
Context fields in NSH Context Header. <N> is a number of 1-4. Requires eth_type_nxm = 0x894f (NSH). Since OpenFlow 1.3 and OVS v2.8. |
nsh_ttl |
Integer 8bit |
TTL field in NSH Base Header. Requires eth_type_nxm = 0x894f (NSH). Since OpenFlow 1.3 and OVS v2.9. |
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)