I believe from security and priority, you mean to say FireWall and Traffic shaping services respectively. As far as I know you cannot achieve traffic shaping just be OpenFlow(Though firewall service could be achieved to an extent by OpenFlow). In short OpenFlow is meant for setting forwarding rules for an in coming packet. Though there are plugins such as NICIRA which can add some functionality such as handling TCP, UDP, ARP packets, but the primary job of openflow packet is to forward packet to next port, drop or punt to controller based on flow rules.
However in your case, You need to implement SFC. You need to deploy firewall or traffic shaping applications(an opensource traffic shaping application here) in a separate server. you need to configure VXLAN on S1 and S2. Then add flows on S1 and S2 such that packets are forwarded to the server. and other flow to forward the flows from the server to next destination. In the Server you apply firewall and traffic shaping rules on packet by packet basis.
Hope this basic information atleast helps you to where to look for information / get going.
EDIT
Please look at really good tutorial from David Mahler, specifically the introduction to OpenFlow, this would clear your doubts on Packet traversal in OpenvSwitch.
Coming to Controller, there are number of controller implementations with languages from C++, Python, Java to Ruby.
Assuming you are a python developer, you can check with POX, here are good tutorial links(link1 and link2) however I'm not sure how well its maintained, I see the commits for code was last done 3 years ago, not sure it is actively maintained. There is also example to parse the packet here, where you can apply appropriate algorithm. If you are looking for Java there are controllers such as Floodlight and Opendaylight, which has pretty much better community support.