Ask is moving to Stack Overflow and! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode


How to delete all flows for testing.

asked 2017-10-06 05:24:39 -0700


I am building a service conposition based on L2switch + some code I am developing. I want to delete all flows during testing. However, it appears l2switch makes the flow rules persistent so that when I restart karaf and try to test the old flow rules are still there when I look at them in mininet. How can I clean out the old flow rules from persistent store?



edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-10-06 06:00:14 -0700

VincentJahjah gravatar image

updated 2017-10-06 06:00:53 -0700

I have a few suggestions, but what you're trying to do feels a bit like going "against" l2switch's intended use case, so it may be a bit tedious.

Configuring l2switch

I know from this page that the l2switch plugins can be told to install rules or not (drop all flows and routing flows), although I think even on the "dumbest" settings, l2switch will still install some rules. Also, if you're relying on those rules, disabling them in l2switch could result in a broken network forwarding layer.

Removing all flows

You can query every openflow table on the network from MDSal. The query pattern looks like this:

query Nodes.class --- getNode() --- for each node --- query all tables (table ids range from 0 to 255, but your rules are probably all installed on table 0) --- for each table --- getFlow() --- for each flow --- remove the flow

This should allow you to remove every rule, as you want. Note that a rule is uninstalled if the given flow definition matches in the following way:

It has the same flowID (the same string), the same nodeId, and the same tableId.

Making it work afterwards

I have a pretty strong feeling that once you uninstall l2swtich's rules, it won't reinstall them. That is, l2switch installs its rules in a pretty straightforward way: if a new node appears on the topology, it installs rules on it. All that l2switch does in certain sections, is listen to node creation. There's pretty straightforward code about it in the l2switch modules that handle rule installation, like here.

The main issue to me is that l2switch's "InitialFlowWriter" classes (there's 3 of them iirc) don't even listen to node deletion; only node creation.

What would cause l2switch to reinstall its rules would then be to take down the entire topology (e.g. shut down mininet) and then bring it all up again (boot mininet again). In principle, shutting down ODL will not change the configuration of your network, so it shouldn't do anything in matters of "uninstalling flow rules".

If shutting down mininet is not a viable option, then there's one thing I believe MIGHT work:

  • Delete all nodes from MDSal "artifically" (but memorize them on the side)
  • Delete all flows from MDSal (maybe?)
  • Redadvertise all nodes on MDSAL (by using the nodes you memorized)

That way, you will have deleted all nodes, and then by re-advertising the nodes on MDSal, you will cause l2switch to re-install its rules, by making it assume that these are all new nodes.

What I DON'T know is whether you can uninstall flow rules even after the nodes are removed from MDSal. I also don't know if deleting a node from MDSal results in the flow rules being uninstalled (but I suspect not, as it requires the intervention of another plugin).

It's possible that l2switch only installs certain rules once, meaning that you can uninstall all flow rules, then delete all nodes ... (more)

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-10-06 05:24:39 -0700

Seen: 528 times

Last updated: Oct 06 '17