Multicast to *all* ports

Hello all,

I have found how to implement a multicast in P4 by setting the standard_metadata.mcast_grp field to a specific group and also binding various egress ports to specific multicast groups.
i.e. in P4Runtime:

multicast_group_entry {
multicast_group_id: 1
replicas {
egress_port: 1
}
replicas {
egress_port: 2
}
}

My problem is that the above way requires to know the number of ports beforehand. Is there a way for a global multicast?
For example, is there a default multicast group that contains all the ports?
Or, is there a way to get the ports, thus use a script to create the group?

1 Like

I know of no way to do a global multicast without knowing the list of port ids before-hand.

It is common when writing production-quality networking control software, though, to have a way (or develop one) where you know the complete list of ports.

1 Like

When using simple_switch_grpc as the software switch, the set of ports can be different each time you start it, by using different command line options to map the port numbers to veth or physical Ethernet ports. I am not aware of any existing API you can call to request that list of ports from the controller software to simple_switch_grpc. All the information is available in some data structures in simple_switch_grpc’s memory to provide that data, if someone wanted to implement such an API.

1 Like