[P4-dev] bmv2 compiled with DBMELOG

Lok In Anson Leong anson93827 at gmail.com
Sun Nov 13 13:15:57 EST 2016


Hello Antonin,

I am sorry that i forgot to send this question to the mailing list.

For test 1, it works now after i execute the CLI commands. (I am sorry that
i made a silly mistake)

For test 2, can generate_digest use in simple_switch architecture? I am
using the port 9090 everywhere. After i received the termination message
from learn_client, i started the ./sswitch_CLI and typed switch_info. It
can get the switch info. I think the switch is live.

Antonin Bas <antonin at barefootnetworks.com> 於 2016年11月14日週一 上午12:42寫道:

> Please address future questions to the mailing list.
> For test 1, you don't mention if your execute the following CLI commands
> after starting the switch:
> https://github.com/p4lang/behavioral-model/blob/master/targets/l2_switch/commands.txt.
> If you don't, then the switch won't generate learning notifications.
> For test 2, it may be that your switch died or that you are using an
> incorrect port. Assuming you are correctly using the port 9090 everywhere,
> you need to check if the switch died and find out why.
>
> On Sun, Nov 13, 2016 at 7:28 AM, Lok In Anson Leong <anson93827 at gmail.com>
> wrote:
>
> Hello Antonin,
>
> I have fixed this problem after reinstall the bmv2.
> But, i have another question now.
> I am looking on these issues (
> https://github.com/p4lang/behavioral-model/issues/180 and
> https://github.com/p4lang/behavioral-model/issues/211) and trying to use
> learn_client (on bmv2/targets/l2_switch/ folder) to receive learning
> notices.
>
> //------------------test 1--------------------//
> I launched the switch by command:
> sudo ./l2_switch -i 0 at veth1 -i 1 at veth3 -i 2 at veth5 -i 3 at veth7
> --notifications-addr ipc:///tmp/bmv2-0-notifications.ipc --pcap
> l2_switch.json
>
> Thereafter I sent a packet to veth1 by using this python file:
> from scapy.all import *
> p = Ether(dst="aa:bb:cc:dd:ee:ff") / IP(dst="10.0.1.10") / TCP() /
> "aaaaaaaaaaaaaaaaaaa"
> p.show()
> hexdump(p)
> sendp(p, iface = "veth1")
>
> The learn_clinet received nothing.
> //------------------test 1--------------------//
>
> //------------------test 2--------------------//
> mininet topology
> h1 <-> SW <-> h2
>
> Partly p4 code below:
>
> action set_if_info(out_port) {
>     modify_field(standard_metadata.egress_spec, out_port);
> }
>
> field_list test_digest {
>     ethernet.srcAddr;
>     standard_metadata.ingress_port;
> }
>
> action generate_test_packet() {
> modify_field(intrinsic_metadata.learn_id, 0);
> generate_digest(GENERATE_DIGEST_RECEIVER, test_digest);
> }
>
> table test_packet {
> actions {
> _nop;
> generate_test_packet;
> }
> size : 64;
> }
>
> table arp_if_info {
> reads {
> arp.sendprotoAddr : exact;
> }
> actions {
> _drop;
> set_if_info;
> }
> size : 64;
> }
>
> table mac_if_info {
>     reads {
>         ethernet.srcAddr : exact;
>         ipv4.srcAddr : lpm;
>     }
>     actions {
>         _drop;
>         set_if_info;
>     }
>     size : 64;
> }
>
> control ingress {
> if(ethernet.etherType == ETHERTYPE_ARP) {
> apply(arp_if_info);
> } else {
> apply(mac_if_info);
> }
> apply(test_packet);
> }
>
> table_set_default arp_if_info _drop
> table_add arp_if_info set_if_info 10.0.0.10 => 2
> table_add arp_if_info set_if_info 10.0.0.11 => 1
> table_set_default mac_if_info _drop
> table_add mac_if_info set_if_info 00:04:00:00:00:10 10.0.0.10/32 => 2
> table_add mac_if_info set_if_info 00:05:00:00:00:10 10.0.0.11/32 => 1
> table_set_default test_packet generate_test_packet
>
> After "pingall" in mininet, learn_client was terminated.
>
> root at server1:~/bmv2/targets/l2_switch/learn_client# ./learn_client
> I received 2 samples
> Calling callback function
> CB with 2 samples
> ingress port is 1
> terminate called after throwing an instance of
> 'apache::thrift::TApplicationException'
>   what():  _Map_base::at
> Aborted (core dumped)
> //------------------test 2--------------------//
>
> I am sorry to bother you.
> Thank you very much!
>
> Lok In Anson Leong <anson93827 at gmail.com> 於 2016年11月13日週日 下午2:22寫道:
>
> Hello Antonin,
>
> I would like to display the event logging messages. I tried to run this
> command "./l2_switch -i 0 at veth1 -i 1 at veth3 -i 2 at veth5 -i 3 at veth7 --pcap
> --nanolog ipc:///tmp/bm-log.ipc l2_switch.json
> " in /bmv2/targets/l2_switch. But, it got a warning "Warning: you
> requested the nanomsg event logger, but bmv2 was compiled without -DBMELOG,
> and the event logger cannot be activated
> ". So, how can i compile with -DMBELOG in bmv2?
>
> Thank you so much!!
> --
>
> Best Regards,
> Anson Liang Lok In(梁樂賢)
> National Chung Cheng University
> Department of Communication Engineering
>
> --
>
> Best Regards,
> Anson Liang Lok In(梁樂賢)
> National Chung Cheng University
> Department of Communication Engineering
>
>
>
>
> --
> Antonin
>
-- 

Best Regards,
Anson Liang Lok In(梁樂賢)
National Chung Cheng University
Department of Communication Engineering
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161113/7e46e2f2/attachment-0002.html>


More information about the P4-dev mailing list