zoukankan      html  css  js  c++  java
  • run p4 in mininet

    https://github.com/p4lang/behavioral-model

    1、安装工具

    install_deps.sh 

    2、编译behavioral-model

     ./autogen.sh
     ./configure
    make
    [sudo] make install # if you need to install bmv2   //没意义

    3、测试

    make check

    4、安装p4c-bm

    git下载代码:https://github.com/p4lang/p4c-bm

    sudo pip install -r requirements.txt
    sudo pip install -r requirements_v1_1.txt if you are interested in compiling P4 v1.1 programs
    sudo python setup.py install

    derek@ubox16:~$ p4c-bmv2 --version
    1.11.0-e389bd34

    5、在mininet上运行

    1)编译json

    cd target/simple_router
    p4c-bmv2 --json simple_router.json simple_router.p4

    2)运行

    cd mininet
    sudo python 1sw_demo.py --behavioral-exe ../targets/simple_router/simple_router --json ../targets/simple_router/simple_router.json

    mininet>pingall  //不通

    3)配置table

    再开一个终端:

    - cd targets/simple_router
    - ./runtime_CLI < commands.txt

    mininet> pingall
    *** Ping: testing ping reachability
    h1 -> h2 
    h2 -> h1 
    *** Results: 0% dropped (2/2 received)

    4)读写表项

    开一个终端:

    cd tools

    ./runtime_CLI.py --thrift-port 9090


    RuntimeCmd: show_tables
    forward [implementation=None, mk=routing_metadata.nhop_ipv4(exact, 32)]
    ipv4_lpm [implementation=None, mk=ipv4.dstAddr(lpm, 32)]
    send_frame [implementation=None, mk=standard_metadata.egress_port(exact, 9)]
    RuntimeCmd: table_info forward
    forward [implementation=None, mk=routing_metadata.nhop_ipv4(exact, 32)]
    ********************************************************************************
    _drop []
    set_dmac [dmac(48)]
    RuntimeCmd: 
    forward [implementation=None, mk=routing_metadata.nhop_ipv4(exact, 32)]
    ********************************************************************************
    _drop []
    set_dmac [dmac(48)]
    RuntimeCmd: 
    forward [implementation=None, mk=routing_metadata.nhop_ipv4(exact, 32)]
    ********************************************************************************
    _drop []
    set_dmac [dmac(48)]

  • 相关阅读:
    p67 把特定位置的位变成0,进行与运算
    p65 逻辑与运算
    JavaScript对象和初始面向对象
    JavaScript操作DOM对象
    JavaScript操作BOM对象
    JavaScript基础
    DAO模式
    使用ADO.NET访问数据库
    连接查询和分组查询
    模糊查询和聚合函数
  • 原文地址:https://www.cnblogs.com/heimafeitian/p/9644242.html
Copyright © 2011-2022 走看看