flow entry with empty actions set in Mininet with more than one switch and POX controller - openflow

I'm using Mininet and POX controller. The network topology has multiple switches.
Whenever I install flow for some switch, and afterwards I check the flow table in that switch, its actions set is empty.
dump-flows shows actions=
However, when there's only one switch in the network, the actions set is not empty.
What may be the reason for the actions set being empty ?
Thank you

After looking in OpenFlow specifications again,
I learned that an empty actions set in a flow entry is a drop flow.
From OpenFlow Switch Specifications v1.3.1
Drop. There is no explicit action to represent drops. Instead, packets whose action
sets have no output actions should be dropped.
Afterwards, I realized where was the error in the code which made the incorrect flow entry installed.

Related

what is the differences between "write metadata" and "set metadata" in ovs?

I mean, write metadata is implemented by the instructions in openflow, on the other side, set field in action can also set the metadata ,what is the differences between them?
As far as I can see, WRITE_METADATA and SET_FIELD for metadata do the same in Open vSwitch.
I'm guessing both are exposed by Open vSwitch to follow the OpenFlow specifications as much as possible. OpenFlow has a clear distinction between Actions and Instructions (cf. Sections 5.5 and 5.6 of OpenFlow v1.5.1): Instructions are attached to rules and applied at the end of each table, whereas Actions are attached to packets (using the Write-Actions Instruction) and applied at the end of the pipeline (or before if the Apply-Actions Instruction is executed). In Open vSwitch, the distinction is not as clear: Actions can be attached to both packets and rules.
Thus, while WRITE_METADATA is different from SET_FIELD in the OpenFlow specification because the first is an Instruction, the second an Action, you can do the same as WRITE_METADATA with a SET_FIELD Action.

SDN: How the controller can get the installed flows on switch?

According to described here
http://flowgrammable.org/sdn/openflow/message-layer/flowmod/
and in the OpenFlow switch specifications, the flow_mod message is not acknowledgeable.
Is there any way for the controller (POX, ODL, or any other) to receive a confirmation for installed flow match or to retrieve the installed flows in the switch's flow table?
Thank you
There is a concept in openflow called "barrier" where the controller
can send a barrier request to have the switch acknowledge the flow_mod.
In OpenDaylight, the default openflowplugin stats collection will poll
the connected switches and will store the config (including the flow table)
in OpenDaylight's operational store.

Can openvswitch save any data by itself?

I know each ovs has flow tables and these tables set or modify by the controller. My question is:
Can an ovs save any data without interference of the controller?
In the other words, can an ovs create a table in itself and change it with each new packet?
In theory: Yes.
However, as any controller you will find thinks it's the boss of the network, it will remove anything the switch puts in flow tables on its own. I.e., as soon as the controller connects to the switch, tables are flushed.
If you are looking to implement something like this, just imitate the process of the OpenFlow protocol implementation. A packet arrives, switch does not know what to do, asks controller, controller tells switch what to do.
Where you start in this chain is up to you. You could, for example, introduce a new action which triggers an upcall. Or you implement this with an autonomous thread running in the bridge. Or you build an application on top of each switch which receives commands from somewhere and modifies flow-tables with the ovs-* binaries. Or you look into what switches do when they are not connected to a controller.
In practice, Open vSwitch already does this, as it applies the flow-mods it receives from a controller. All you need to figure out is where these flow-mods should come from. But to help you with that, additional information about your scenario is needed.

Difference between instructions and actions in OpenFlow

In OpenFlow protocol we have a flow table (or multiple flow tables). Each flow table in the switich contains a set of flow entries. Each flow entry contains header fields, counters and a set of instructions or actions to be applied. Instrucions are like "add this action to action set" (write-actions instruction) or "clear action set" (clear-actions instruction), and actions are like "output to port X" (output action) or "drop this packet" (drop action). But how does work ? what exactly is in the flow entry, an action or an instruction ? or maybe both are ? what exactly is an action set ? could someone give me a little exmaple that uses these terms ?
"Actions can discard, modify, queue, or forward the packet. In version 1.0 of the OpenFlow protocol the Action set is modified directly by the Actions list in the FlowMod message; however, in 1.1.0 and subsequent versions the the protocol, the Action set is modified by the Instruction structure carried in the FlowMod. An Instruction may carry an Actions list to update the Action set, or be applied immediately to the packet bypassing the Action set".
ref. (http://flowgrammable.org/sdn/openflow/actions/#ofp_1_4)
In other words, when a packet matches a particular OpenFlow flow, the switch running OpenFlow v1.0 applies a set of actions to the packet. Now, with the new OpenFlow version, instead of applying a set of actions, the switch applies a flow instruction to a matching packet.
According to OpenFlow specification 1.5.1 (https://www.opennetworking.org/images/stories/downloads/sdn-resources/onf-specifications/openflow/openflow-switch-v1.5.1.pdf), the instruction set associated with a flow entry contains a maximum of one instruction of each type, following the order:
Apply-Actions, Clear-Actions, Write-Actions, Write-Metadata, Stat-Trigger or Goto-Table.

(MPLS) tunneling in OpenFlow

We have a network consisting of multiple OpenFlow 1.0 and 1.3 compatible switches, that are interconnected. Each of the switches is connected to one or more switches in a way that there is a route from every switch to every other switch, though not necessarily directly (so the packets might end up having to be passed through multiple switches to reach it's destination).
What I need to do is to get some form of tunneling system, where I can create a flow that passes packets through all these switches to the target machine.
What I know that is possible is to push and pop MPLS labels to the packet. So I figured I might push two labels at the ingress. The outer label identifies the target switch and the inner label identifies the target port. This way I only need flows on each switch to pass packets with matching labels to the target switch first and then to the target port, when it reached the target switch.
The problem here is only that I found no way of matching on MPLS labels. Does anyone know if there is a way to match on these labels? Or is there any other way of doing what I want to do?
Thanks a lot in advance!
yes, you can do
match = parser.OFPMatch(in_port=inPort,eth_type=ether.ETH_TYPE_MPLS,mpls_label=m_label)
that's how you can match mpls labels and give whatever actions you wanna give.