[P4-dev] Problem reading table entries from BMv2 via gRPC/P4Runtime

Antonin Bas antonin at barefootnetworks.com
Tue Jul 18 18:36:47 EDT 2017


Regardless, simple_switch_grpc shouldn't crash like this. I'll look into it
and see if the RPC can return an error status instead.

On Tue, Jul 18, 2017 at 1:02 PM, Carmelo Cascone <carmelo at opennetworking.org
> wrote:

> Hi Antonin,
>
> Thanks for the quick reply.
>
> You are right, there was an exception while reading the content of the
> JSON file that was silently dropped, and hence the p4_device_config was
> malformed. Now it works, event the read request.
>
> Thanks.
> Carmelo
>
> On Jul 18, 2017, at 14:12, Antonin Bas <antonin at barefootnetworks.com>
> wrote:
>
> Hi Carmelo,
>
> I may be missing something but when are you sending the bmv2 json to
> simple_switch_grpc?
> The json should be sent as part of the SetForwardingPipelineConfig RPC,
> under p4_device_config (see https://github.com/
> p4lang/behavioral-model/blob/master/targets/simple_switch_
> grpc/tests/base_test.cpp#L48 for an example). Here p4_device_config only
> seems to be 4 bytes. Is it just not showing in the email?
>
> Thanks,
>
> Antonin
>
> On Tue, Jul 18, 2017 at 10:12 AM, Carmelo Cascone <carmelo@
> opennetworking.org> wrote:
>
>> Hi Antonin,
>>
>> I’m seeing some problems when I try to read table entries from BMv2 via
>> gRPC using P4Runtime.
>> I’m using the latest master of both PI and BMv2.
>>
>> This is the P4 program running on the switch:
>> https://github.com/opennetworkinglab/onos/blob/master/tools/
>> test/p4src/p4-16/default.p4
>>
>> BMv2 JSON and P4Info are attached.
>>
>> Below are the messages that I send to the switch (in order). After
>> sending the read request for the table, BMv2 crashes (see log below).
>>
>> Any idea of that the problem could be?
>>
>> Thanks.
>> Carmelo
>>
>>>>
>> *** SENDING GRPC MESSAGE [dummy:1]
>> dummy.DummyService/SayHello:
>>
>> INFO org.onosproject.p4runtime.ctl.P4RuntimeClientImpl - Setting
>> pipeline config for dummy:1 to mock using BMV2_JSON…
>> INFO *** SENDING GRPC MESSAGE [dummy:1]
>> p4.P4Runtime/SetForwardingPipelineConfig:
>> action: VERIFY_AND_COMMIT
>> configs {
>>   device_id: 1
>>   p4info {
>>     tables {
>>       preamble {
>>         id: 33617813
>>         name: "table0"
>>         alias: "table0"
>>       }
>>       match_fields {
>>         id: 1
>>         name: "standard_metadata.ingress_port"
>>         bitwidth: 9
>>         match_type: TERNARY
>>       }
>>       match_fields {
>>         id: 2
>>         name: "hdr.ethernet.dstAddr"
>>         bitwidth: 48
>>         match_type: TERNARY
>>       }
>>       match_fields {
>>         id: 3
>>         name: "hdr.ethernet.srcAddr"
>>         bitwidth: 48
>>         match_type: TERNARY
>>       }
>>       match_fields {
>>         id: 4
>>         name: "hdr.ethernet.etherType"
>>         bitwidth: 16
>>         match_type: TERNARY
>>       }
>>       action_refs {
>>         id: 16794308
>>       }
>>       action_refs {
>>         id: 16829080
>>       }
>>       action_refs {
>>         id: 16793508
>>       }
>>       action_refs {
>>         id: 16800567
>>         annotations: "@defaultonly()"
>>       }
>>       direct_resource_ids: 301990488
>>       size: 1024
>>       with_entry_timeout: true
>>     }
>>     actions {
>>       preamble {
>>         id: 16794308
>>         name: "set_egress_port"
>>         alias: "set_egress_port"
>>       }
>>       params {
>>         id: 1
>>         name: "port"
>>         bitwidth: 9
>>       }
>>     }
>>     actions {
>>       preamble {
>>         id: 16829080
>>         name: "send_to_cpu"
>>         alias: "send_to_cpu"
>>       }
>>     }
>>     actions {
>>       preamble {
>>         id: 16793508
>>         name: "drop"
>>         alias: "drop"
>>       }
>>     }
>>     actions {
>>       preamble {
>>         id: 16800567
>>         name: "NoAction"
>>         alias: "NoAction"
>>       }
>>     }
>>     counters {
>>       preamble {
>>         id: 302025528
>>         name: "port_counters_control.egress_port_counter"
>>         alias: "egress_port_counter"
>>       }
>>       spec {
>>         unit: PACKETS
>>       }
>>       size: 254
>>     }
>>     counters {
>>       preamble {
>>         id: 301999025
>>         name: "port_counters_control.ingress_port_counter"
>>         alias: "ingress_port_counter"
>>       }
>>       spec {
>>         unit: PACKETS
>>       }
>>       size: 254
>>     }
>>     direct_counters {
>>       preamble {
>>         id: 301990488
>>         name: "table0_counter"
>>         alias: "table0_counter"
>>       }
>>       spec {
>>         unit: PACKETS
>>       }
>>       direct_table_id: 33617813
>>     }
>>   }
>>   p4_device_config: "\b\001\022\000"
>> }
>>
>> *** RECEIVED GRPC MESSAGE [dummy:1]
>> p4.P4Runtime/SetForwardingPipelineConfig:
>>
>> INFO org.onosproject.p4runtime.ctl.P4RuntimeClientImpl - Initializing
>> stream chanel on dummy:1...
>> INFO org.onosproject.p4runtime.ctl.P4RuntimeClientImpl - Sending
>> arbitration update to dummy:1...
>> INFO *** SENDING GRPC MESSAGE [dummy:1]
>> p4.P4Runtime/StreamChannel:
>> arbitration {
>>   device_id: 1
>> }
>>
>> INFO Dumping table table0 from dummy:1 (pipeconf mock)...
>> 1815 [onos-p4runtime-client-dummy:1-dummy:1-2] INFO *** SENDING GRPC
>> MESSAGE [dummy:1]
>> p4.P4Runtime/Read:
>> device_id: 1
>> entities {
>>   table_entry {
>>     table_id: 33617813
>>   }
>> }
>>
>> WARN org.onosproject.p4runtime.ctl.P4RuntimeClientImpl - Error on stream
>> channel for dummy:1: Status{code=INTERNAL, description=Connection closed
>> with unknown cause, cause=null}
>>
>>
>> BMv2 LOG:
>>
>> p4-mininet at p4-mininet:~$ simple_switch_grpc --device-id 1 --log-console
>> -Ldebug --no-p4 -- --cpu-port 255 --grpc-server-addr 0.0.0.0:55044
>> Calling target program-options parser
>> Server listening on 0.0.0.0:55044
>> P4Runtime SetForwardingPipelineConfig
>> P4Runtime Read
>> device_id: 1
>> entities {
>>   table_entry {
>>     table_id: 33617813
>>   }
>> }
>> *** Error in `simple_switch_grpc': double free or corruption (out):
>> 0x00007f7d5c005ba0 ***
>> Aborted (core dumped)
>>
>>
>
>
> --
> Antonin
>
>
>


-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170718/eea2e71c/attachment-0002.html>


More information about the P4-dev mailing list