Network Slicing in P4


I appreciate it if you would guide me how it is possible to have network slicing in the P4 tutorial.

Best regards,

Just to clarify your request, when you say “network slicing”, you mean you want something like VLANs or VRFs to logically divide up the network tables into multiple separate network tables, one logical table per slice?

If yes, are you thinking that the network slice would be derived from some header field in the packets?

Are you thinking that this header field is assigned the correct value by hosts before they send packets into the network? Or should the first hop switch do some kind of lookup to determine which slice the packet is part of?

Dear Andy,

Thanks for your response.
Yes, I mean having some isolated virtual networks on the same network. As in my scenario each host is part of one virtual network, it is applicable if the first hop switch determines the related slice. I was wondering if you would guide me how to have this in the P4 tutorial.

Best regards,

There are many ways to do what you want when using P4, because it lets you use existing standard headers, or new custom headers you define. If you could answer some of the questions later in this message, it could help guide you towards a solution you will find acceptable.

Do you care how you identify which network slice a packet is in, e.g. by a particular kind of header on the packet?

Perhaps the answer to the question above would be clearer if you could answer this question first: Do you want to be able for the header to encapsulate an arbitrary Ethernet frame, or is only IPv4 packet or only IPv6 packets good enough for your purpose?

If arbitrary Ethernet frames, then something like an 802.1Q header is probably better, because it contains a 16-bit Ethertype field to identify the Ethertype of the original frame, and can thus be used in arbitrary Ethernet frames.