[P4-dev] Fwd: Interaction between P4 dataplane and control plane

Antonin Bas antonin at barefootnetworks.com
Wed Feb 10 17:46:24 EST 2016


Re-introducing this thread after mailing list change.

---------- Forwarded message ----------
From: Antonin Bas <antonin at barefootnetworks.com>
Date: Tue, Jan 12, 2016 at 10:46 AM
Subject: Re: [P4-dev] Interaction between P4 dataplane and control plane
To: Ramana Reddy <gtvrreddy at gmail.com>
Cc: P4 Dev <p4-dev at p4.org>


Hi Ramana,

Sorry for the delay. You can perfectly control all your tables (OF tables
and others) using a single controller. I'm sorry if my diagram led you to
believe otherwise.
Let's assume you want to write your controller in Python. Thanks to Thrift,
we generate Python bindings for the PD library. You can then:
- start from a ryu app in Python which manages all your OF tables and
communicates with your OF agent
- add the appropriate PD API calls to your Python app
My point was that you probably want to keep your tables separate: if a
table is managed by OF, you don't want to make manual modifications to it
using PD. But I don't believe this is big constraint.
In a nutshell, nothing prevents you from having a single process /
controller that both handles OF messages (receive PacketIn, send PacketOut)
AND issues PD calls.

Thanks,

Antonin

On Thu, Jan 7, 2016 at 12:42 AM, Ramana Reddy <gtvrreddy at gmail.com> wrote:

> Hi Antonin,
>
> Thanks for your inputs and nice diagram. Those are really very helpful.
> After referring the diagram, I have some concerns on this.
>
> I understood that we need two control programs one is SDN controller for
> OF rules,
> and another one is some control program (not SDN) in p4 for custom table
> rules.  Now, rather than writing a  separate control program to maintain
> custom table rules,
> is it possible to add the same functionality in the SDN controller or just
> I want to write
> a simple control program in P4  and adding a simple SDN control
> functionality in it.
> (Ex: injecting our own packets into the switch).
>
> I also referred the previous thread and verified the following link
>
> https://github.com/p4lang/p4factory/blob/master/targets/basic_routing/of-tests/tests/routing.py,
>
> but it seems to be not working.
>
> Looking forward for your inputs.
>
> Thanks & Regards,
> Ramana
>
>
>
>
> On Wed, Jan 6, 2016 at 12:03 AM, Antonin Bas <antonin at barefootnetworks.com
> > wrote:
>
>> Hi Ramana,
>>
>> It should be perfectly possible to combine OF rules and custom rules,
>> although it does require a bit of work.
>> First, I believe that your P4 tables should either be controlled with OF
>> or directly / manually by you, i.e. I would not mess manually with the
>> tables managed by OF.
>> For manual control, I don't believe the best choice is to use switchapi /
>> switchsai, which are very specific to the switch.p4 program at the moment.
>> Instead, I would interact directly with the lower-level PD API, which is
>> auto-generated from the P4 program. Note that switchapi actually calls into
>> the PD API generated for switch.p4. I believe I already told you about the
>> PD API in a previous thread (
>> http://mail.p4.org/pipermail/p4-dev_p4.org/2015-December/000383.html).
>> I am attaching a diagram (OF.png) of what the overall system would look
>> like.
>> The steps are essentially the same as what we discussed in the previous
>> thread:
>> 1) write your P4 dataplane, which includes an OF pipeline and some extra
>> tables in charge of enforcing your custom rules. Your example ("forward
>> only ack packets  whose payload is zero to the controller") can easily be
>> enforced with a single P4 tables.
>> 2) generate the PD API for your P4 program
>> 3) write the OF agent (this is the hardest part IMO)
>> 4) write the controller for your custom tables, in the fashion of
>> switchapi. You can either write it in C and link it with the PD library
>> (this is what switchapi is doing) or write it in any language and use the
>> PD Thrift RPC server.
>> 5) bind everything together!
>>
>> Best,
>>
>> Antonin
>>
>> On Sun, Jan 3, 2016 at 2:04 AM, Ramana Reddy <gtvrreddy at gmail.com> wrote:
>>
>>> Hi P4-Dev community,
>>>
>>> A very happy new year to every one. As I understood, the application
>>> programs use the switchspi/api libraries to program the tables in the
>>> dataplane in P4. But certain things are not clear to me.
>>>
>>> 1. Assume the following scenario: an SDN controller and P4 switch.  An
>>> SDN controller which is basically adding the rules in P4 and the P4 switch
>>> is working fine. But when I want to add a rule which is non openflow
>>> standard ( Ex: forward only ack packets  whose payload is zero to the
>>> controller), how to add these kind of non openflow rules. What kind of
>>> interface P4 supports to add those rules.
>>>
>>> 2. How can I write an equivalent program ( non SDN controller) which
>>> dynamically program the tables in P4 dataplane and act like a controller.
>>>
>>> 3. How to program the tables in the dataplane through both switchsai/api
>>> library and openflow rules ( something like combining both).
>>>
>>> 4. What is kind of control protocol P4 uses other than switchspi/api
>>> library.
>>>
>>>
>>>
>>> Looking forward for your reply. Any more inputs on control plane and
>>> dataplane interaction  is really helpful.
>>>
>>> Thanks & Regards,
>>> Ramana
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> P4-dev mailing list
>>> P4-dev at p4.org
>>> Listinfo - http://mail.p4.org/mailman/listinfo/p4-dev_p4.org
>>> Archives - http://mail.p4.org/pipermail/p4-dev_p4.org/
>>>
>>
>>
>>
>> --
>> Antonin
>>
>
>


-- 
Antonin



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20160210/81e70732/attachment-0002.html>


More information about the P4-dev mailing list