[P4-discuss] table_modify ternary table is not working in BMV2 runtime_CLI

Thambi Sreedharan thambisree at gmail.com
Fri Oct 7 19:37:40 EDT 2016


Hi

I am new to P4,

trying to modify ternary table entry and I getting error

P4 code:

header_type ethernet_t {

    fields {

        dstAddr : 48;

        srcAddr : 48;

        etherType : 16;

    }

}


parser start {

    return parse_ethernet;

}

header_type imd_t {

fields {

myport : 5;

}


}

header ethernet_t ethernet;

metadata imd_t imd;


parser parse_ethernet {

    extract(ethernet);

    return ingress;

}


action _nop() { }


action setport(port) {

modify_field(imd.myport, port);

}


table ternary_1 {

    reads {

        ethernet.dstAddr : ternary;

    }

    actions { _nop;setport; }

    size : 65536;

}


table ternary_2 {

    reads {

        ethernet.srcAddr : ternary;

    }

    actions { _nop; }

    size : 65536;

}


table ternary_3 {

    reads {

        ethernet.srcAddr : ternary;

        ethernet.dstAddr : ternary;

    }

    actions { _nop; }

    size : 65536;

}


control ingress {

    apply(ternary_1);

    apply(ternary_2);

    apply(ternary_3);

}


control egress { }


use the p4c-bm to compile and got json file

started the BMV2 with json

ran $BMV2_PATH/tools/runtime_CLI.py

added entry as follows

RuntimeCmd: table_add ternary_1 setport aa:bb:cc:dd:dd:02&&&01 => 6 0

Adding entry to ternary match table ternary_1

match key:           TERNARY-aa:bb:cc:dd:dd:02 &&& 00:00:00:00:00:01

action:              setport

runtime data:        06

Entry has been added with handle 1

want to modify the entry and did as follows


RuntimeCmd: table_modify ternary_1 setport  1 aa:bb:cc:dd:dd:02&&&01 => 7 0

Error: Action setport needs 1 parameters

Please let me know how to modify a ternary table ?


Thanks

Thambi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-discuss_lists.p4.org/attachments/20161007/29d6cdbf/attachment-0002.html>


More information about the P4-discuss mailing list