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

Revision history [back]

click to hide/show revision 1
initial version

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?)
  • Bring all nodes back up online "artifically" (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, then re-advertise all nodes. But if l2switch installs certain rules after intervals of times, it's possible you end up with just a few extra rules being left behind (installed between the time you uninstalled all flow rules and the time you uninstalled all nodes)...

So yeah. I see a few ways of doing it, but I'm not convinced which will work.

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?)
  • Bring Redadvertise all nodes back up online "artifically" 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, then re-advertise all nodes. But if l2switch installs certain rules after intervals of times, it's possible you end up with just a few extra rules being left behind (installed between the time you uninstalled all flow rules and the time you uninstalled all nodes)...

So yeah. I see a few ways of doing it, but I'm not convinced which will work.