p4lang / behavioral-model

The reference P4 software switch
Apache License 2.0
545 stars 329 forks source link

About bmv2 and SFC #1052

Closed Amazing8 closed 2 years ago

Amazing8 commented 2 years ago

Hello, I would like to ask if the function of adding SFC to bmv2 can be realized. Do you have any good suggestions? I look forward to your reply and thank you in advance

jafingerhut commented 2 years ago

I know people who know the SFC feature very well, and work on implementing it in Tofino, but they have not attempted to make it work in BMv2.

If you want to implement something in BMv2 that you need new features from the target, e.g. reading queue depths in ingress, for example (I do not know if that is needed or useful for implementing SFC), then you should ask about the "primitive" features that BMv2 does not currently have. If you are not sure what features BMv2 has vs. what it does not, I would start by reading these pages, then if you are not sure, ask in a follow-up comment on this issue:

Amazing8 commented 2 years ago

Thank you very much for your reply, but I'm a novice in Sdn. I don't understand this article. My problem now is that I want to build a simulation network and add Sr and SFC functions to the network. Do you have any good suggestions or implementation methods. My current environment is ODL + mininet; We look forward to your valuable reply and thank you in advance

jfingerh commented 2 years ago

If you are starting with ODL + mininet, then what led you to this Github project to ask such a question? That is, why do you believe the behavioral-model Github project code has anything to do with what you want to achieve?

Have you tried asking your question in forums related to ODL?

Amazing8 commented 2 years ago

I used P4 to define srv6 in bmv2 before. Then, after I defined srv6, I found that I encountered difficulties when adding SFC. I generally understand that the SFC data plane can only be used if OVS switch supports openflow protocol, but the bmv2 that has processed srv6 does not seem to support openflow

jafingerhut commented 2 years ago

SFC means Source Flow Control, yes? Just wanted to verify in case there is another meaning for that acronym and we are talking past each other.

P4-programmable devices that I am aware of do not use Openflow to configure them. They typically use the P4Runtime API, or for Tofino switches what was called BFRT / Barefoot Runtime API, and more recently is beginning to be open sourced as TDI (Table Driven Interface).

Amazing8 commented 2 years ago

The full name of SFC is service function chain, which is a business function chain, a security device like firewall and IPS. Thank you for your reply. Your reply let me know that my previous idea is correct, that is, bmv2 does not use openflow but runtime API. Thank you very much for your patience, I will continue to study how to deploy segmented routing and service chain (SFC) in ODL + mininet environment. I would appreciate it if you have a good idea to help me

antoninbas commented 2 years ago

IMO, Openflow in this context is just a means to an end: you can use Openflow to program compatible switches and realize SFC. There are controllers that "speak" OpenFlow and support SFC use cases and you may be able to use them with OVS (e.g. https://docs.opendaylight.org/projects/sfc/en/latest/user-guide.html#sfc-ovs-integration). However, it is equally possible to realize SFC with P4 + bmv2 (or another P4-programmable switch) + P4Runtime (or another control-plane API for P4-programmable switches). It is however a lot of work as you need to 1) write the P4 program that will implement your data plane functions and 2) write a controller "from scratch" to control the switches that will be running your P4 program. It is possible that the ONOS SDN controller (https://github.com/opennetworkinglab/onos) already provides support for SFC use cases. Because ONOS supports P4-programmable devices, it can be used to control bmv2 switches. https://github.com/stratum/tutorial is a good introduction to using: bmv2 + Stratum + P4Runtime + ONOS. You may also want to reach out to the ONOS team on the ONF Slack.

In any case, I am closing this issue, as it is more of a generic question about P4 use cases, and it is not specific to bmv2.