Class: Trema::FlowRemoved

Inherits:
Object
  • Object
show all
Defined in:
ruby/trema/flow-removed.c

Constant Summary collapse

OFPRR_IDLE_TIMEOUT =
INT2NUM( OFPRR_IDLE_TIMEOUT )
OFPRR_HARD_TIMEOUT =
INT2NUM( OFPRR_HARD_TIMEOUT )
OFPRR_DELETE =
INT2NUM( OFPRR_DELETE )

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ FlowRemoved

When a flow is deleted or expired a OFPT_FLOW_REMOVED message is sent as long as the OFPFF_SEND_FLOW_REM bit is toggled in the flags bitmap during flow setup. A user would not explicitly instantiate a Trema::FlowRemoved object but would be created while parsing the OPPT_FLOW_REMOVED message. Returns an object that encapsulates the OPPT_FLOW_REMOVED OpenFlow message.

Returns self.

Examples:

FlowRemoved.new(
  :datapath_id => 0xabc,
  :transaction_id => 0,
  :match => Match,
  :cookie => 123456789,
  :priority => 65535,
  :reason => 0,
  :duration_sec => 1,
  :duration_nsec => 783000000,
  :idle_timeout => 1,
  :packet_count => 1
  :byte_count=> 64
)

Parameters:

  • options (Hash) (defaults to: {})

    the options to create a message with.

Options Hash (options):

  • :datapath_id (Symbol)

    message originator identifier.

  • :transaction_id (Symbol)

    unsolicited message transaction_id is zero.

  • :match (Symbol)

    a Match object describing the flow fields copied from the corresponding flow setup message.

  • :cookie (Symbol)

    an opaque handle copied from the corresponding flow setup message.

  • :priority (Symbol)

    the priority level of the flow copied from the corresponding flow setup message.

  • :reason (Symbol)

    the reason why the flow is removed.

  • :duration_sec (Symbol)

    the number of seconds the flow was active.

  • :duration_nsec (Symbol)

    the number of nanoseconds the flow was active.

  • :idle_timeout (Symbol)

    time elapsed in seconds before the flow is removed, copied from the corresponding flow setup message.

  • :packet_count (Symbol)

    a counter of the total number of packets.

  • :byte_count (Symbol)

    a counter of the total number of bytes.



92
93
94
95
96
# File 'ruby/trema/flow-removed.c', line 92

static VALUE
flow_removed_init( VALUE self, VALUE options ) {
  rb_iv_set( self, "@attribute", options );
  return self;
}

Instance Method Details

#byte_countNumber

A counter of the total number of bytes.

Returns:

  • (Number)

    the value of byte_count.



215
216
217
218
# File 'ruby/trema/flow-removed.c', line 215

static VALUE
flow_removed_byte_count( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "byte_count" ) ) );
}

An opaque handle copied from the corresponding flow setup message.

Returns:

  • (Number)

    the value of cookie.



137
138
139
140
# File 'ruby/trema/flow-removed.c', line 137

static VALUE
flow_removed_cookie( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "cookie" ) ) );
}

#datapath_idNumber

Message originator identifier.

Returns:

  • (Number)

    the value of datapath_id.



104
105
106
107
# File 'ruby/trema/flow-removed.c', line 104

static VALUE
flow_removed_datapath_id( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "datapath_id" ) ) );
}

#duration_nsecNumber

The number of nanoseconds the flow was active.

Returns:

  • (Number)

    the value of duration_nsec.



182
183
184
185
# File 'ruby/trema/flow-removed.c', line 182

static VALUE
flow_removed_duration_nsec( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "duration_nsec" ) ) );
}

#duration_secNumber

The number of seconds the flow was active.

Returns:

  • (Number)

    the value of duration_sec.



171
172
173
174
# File 'ruby/trema/flow-removed.c', line 171

static VALUE
flow_removed_duration_sec( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "duration_sec" ) ) );
}

#idle_timeoutNumber

Time elapsed in seconds before the flow is removed.

Returns:

  • (Number)

    the value of idle_timeout.



193
194
195
196
# File 'ruby/trema/flow-removed.c', line 193

static VALUE
flow_removed_idle_timeout( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "idle_timeout" ) ) );
}

#matchMatch

Flow fields matched.

Returns:

  • (Match)

    an object that encapsulates flow fields details.



126
127
128
129
# File 'ruby/trema/flow-removed.c', line 126

static VALUE
flow_removed_match( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "match" ) ) );
}

#packet_countNumber

A counter of the total number of packets.

Returns:

  • (Number)

    the value of packet_count.



204
205
206
207
# File 'ruby/trema/flow-removed.c', line 204

static VALUE
flow_removed_packet_count( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "packet_count" ) ) );
}

#priorityNumber

The priority level of the flow copied from the corresponding flow setup message.

Returns:

  • (Number)

    the value of priority.



149
150
151
152
# File 'ruby/trema/flow-removed.c', line 149

static VALUE
flow_removed_priority( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "priority" ) ) );
}

#reasonNumber

The reason why the flow is removed.

Returns:

  • (Number)

    the value of reason.



160
161
162
163
# File 'ruby/trema/flow-removed.c', line 160

static VALUE
flow_removed_reason( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "reason" ) ) );
}

#transaction_idNumber

For this asynchronous message the transaction_id is set to zero.

Returns:

  • (Number)

    the value of transaction_id.



115
116
117
118
# File 'ruby/trema/flow-removed.c', line 115

static VALUE
flow_removed_transaction_id( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "transaction_id" ) ) );
}