Here is a quick tip on changing port configuration. To set a port as Administratively Down, use Ryu’s standard ofctl REST interface (see Ryu Quickstart with Simple Switch for OF-DPA¬†for getting Ryu up and running):

Bring it back up with:

You can verify using our PortWatch Ryu app to see the port update messages come back from ofagentapp:

How It Works

This example comes from the Ryu documentation on the ofctl_rest interface under Modify the behavior of the port. config and mask are bitmaps of the OFPPC_* flags. In this case, the config is set to enable OFPPC_PORT_DOWN (1 << 0) and the mask is set to the same to specify that only the OFPPC_PORT_DOWN flag should be changed. The ofctl_rest app takes these values and creates an OFPPortMod message and sends it to the appropriate datapath. The switch will then respond (if the async settings are appropriately set) with an OFPPort message with the new port status. To remove the OFPPC_PORT_DOWN flag, a similar request is set with the same mask value (specifying OFPPC_PORT_DOWN flag should be set) and the config value is set to zero to unset the flag. For more information on using port modification messages in your Ryu application, take a look at the documentation for ryu.ofproto.ofproto_v1_3_parser.OFPPortMod.

Happy Coding!

-Leo