How to remove flows with TREMA?

97 views
Skip to first unread message

Stavros Tech

unread,
Aug 27, 2012, 11:29:11 AM8/27/12
to trem...@googlegroups.com
Hi guys, I'm working on some modifications on the routing switch ( C lang) and i want to remove  some flows (when it is required) and not wait for them to expire. Is there any example to read? For the flows i want to remove i have the MAC source, MAC destination and Ethernet type.

DanDan

unread,
Aug 27, 2012, 10:30:08 PM8/27/12
to trem...@googlegroups.com

You should use Flow Mod ( OpenFlow Message ) to delete flow entry on the switch.
There is an example method that you can refer to in apps/flow_manager/flow_manager.c ( line 898 )
  ==> remove_flow_entry_from_switch()


Stavros Tech於 2012年8月27日星期一UTC+8下午11時29分11秒寫道:

Stavros Tech

unread,
Aug 28, 2012, 9:26:35 AM8/28/12
to trem...@googlegroups.com
Thank's a lot for the quick response. I followed the example today, i did my own function for deleting flows and seems to work fine!!!! Have a nice week.

Sadiq Yakasai

unread,
Sep 17, 2015, 8:51:01 AM9/17/15
to trema-dev
Hello guys,

I am also trying to create a function that deletes all flow entries associated with a MAC address (see below) but its just simply not working as expected. Can someone please advise me if I am missing something basic here.

int
delete_flow ( uint64_t datapath_id, const uint8_t *macsa) {
  struct ofp_match match;
  memset( &match, 0, sizeof( struct ofp_match ) );
  match.wildcards = ( OFPFW_ALL & ~OFPFW_DL_SRC );
  memcpy( match.dl_src, macsa, OFP_ETH_ALEN );
  buffer *flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_DELETE, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT32_MAX, OFPP_NONE, OFPFF_SEND_FLOW_REM, NULL );
  int ret = send_openflow_message( datapath_id, flow_mod );
  printf ("delete flow ret = %d \n", ret);
  free_buffer( flow_mod );
  return ret;
Reply all
Reply to author
Forward
0 new messages