behavioral-model
behavioral-model copied to clipboard
Unable to generate digest messages in simple_switch
I'm trying to generate a digest message using the digest
extern. This is what I'm doing -
action send_digest() {
meta.con_notif.queue_len = (bit<32>) standard_metadata.enq_qdepth;
digest<con_notif_meta_t>(1, meta.con_notif);
}
apply {
send_digest()
}
The script that's listening for messages is the following. I'm not trying to decode any messages, just trying to detect that they were sent. I am running this script as root, and I passed --notifications-addr ipc:///tmp/bmv2-0-notifications.ipc
as well as --device-id 0
as arguments.
import nnpy
def main():
print("Listening on socket")
sub = nnpy.Socket(nnpy.AF_SP, nnpy.SUB)
sub.connect('ipc:///tmp/bmv2-0-notifications.ipc')
sub.setsockopt(nnpy.SUB, nnpy.SUB_SUBSCRIBE, '')
while(True):
msg = sub.recv()
print("message recieved")
print(msg)
if __name__ == '__main__':
main()
I get a single message on this socket when I start the switch. But other than that, the socket is dead and I receive no messages. What's going wrong here?
As discussed on Slack, this is the expected behavior if you keep sending similar packets (which produce the same digest value) but do not send an "ack" after receiving the first digest notification. bmv2 filters out duplicates to avoid sending too many messages to the control plane, which is pretty standard, and an entry is only cleared from the filter after you ack it.
A good read is probably the P4Runtime specification which describes how learning / digests work: https://p4.org/p4runtime/spec/v1.1.0/P4Runtime-Spec.html#sec-digestentry
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment, or this will be closed in 180 days