[P4-dev] Fwd: Simple_switch_CLI

Lucas Souza Santos lucassouzasantos at gmail.com
Mon Nov 20 23:33:50 EST 2017


Hey guys, good night, i am having a problem with some with CLI commands,
someone have any idea to solve it?

*That's the problem:*
[image: Imagem inline 1]
*The command:* table_add table_priority set_priority 92 => 1

*The p4 code:*

header_type intrinsic_metadata_t {
   fields {
       ingress_global_timestamp : 48;
       lf_field_list : 8;
       mcast_grp : 16;
       egress_rid : 16;
       resubmit_flag : 8;
       recirculate_flag : 8;
       priority : 3;
   }
}

metadata intrinsic_metadata_t intrinsic_metadata;

header_type pre_t {
    fields {
        preamble: 64;
    }
}

header pre_t pre;

header_type rns_t {
    fields {
        rot_len: 8;
        rotulo: *;
    }
    length: (rot_len + 1);
    max_length: 256;
}

header rns_t rns;

parser start {
    return select(current(0, 64)) {
        0: parse_port;
        default: ingress;
    }
}

parser parse_port {
    extract(rns);
    return ingress;
}

action _drop() {
    drop();
}

action set_priority(priority){
    modify_field(standard_metadata.egress_spec, (rns.rotulo%2));
    modify_field(intrinsic_metadata.priority, priority);
}

action forward() {
    modify_field(standard_metadata.egress_spec, (rns.rotulo%2));
    modify_field(intrinsic_metadata.priority, 7);
}

table table_priority {
    reads {
        rns.rotulo: exact;
    }
    actions {
        set_priority;
        _drop;
        forward;
    }
    size: 1;
}

control ingress {
    apply(table_priority);
}

control egress {
    // leave empty
}

Thanks,
Lucas Santos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171121/ea51820e/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WhatsApp Image 2017-11-21 at 00.48.22.jpeg
Type: image/jpeg
Size: 96148 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171121/ea51820e/attachment.jpeg>


More information about the P4-dev mailing list