What is the standard_metadata.egress_spec?

Hello everyone,

could someone explain to me what is standard_metadata.egress_spec that is used here? In the Basic exercise from GitHub (tutorials/exercises/basic at master · p4lang/tutorials · GitHub) the ipv4_forward action is use this variable but it doesn’t mention anywhere else in the file except the JSON runtime files.

  action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) {
        standard_metadata.egress_spec = port;
        hdr.ethernet.srcAddr = hdr.ethernet.dstAddr;
        hdr.ethernet.dstAddr = dstAddr;
        hdr.ipv4.ttl = hdr.ipv4.ttl - 1;
    }

Also, I found a project that uses the standard_metadata.instance_type. What is this used for?

Thanks in advance!

Please read this documentation, which hopefully answers your questions. If you have any further questions, please reply here to follow up: behavioral-model/simple_switch.md at main · p4lang/behavioral-model · GitHub