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)]

  • 相关阅读:
    Class.forName和ClassLoader.loadClass的区别
    数据库连接池优化配置(druid,dbcp,c3p0)
    MySQL在默认事务下各SQL语句使用的锁分析
    ArrayList vs LinkedList 空间占用
    MySQL锁详解
    利用ConcurrentHashMap来实现一个ConcurrentHashSet
    list与Set、Map区别及适用场景
    实现一个原子的正整数类:AtomicPositiveInteger
    mysql如何处理亿级数据,第一个阶段——优化SQL语句
    java性能优化
  • 原文地址:https://www.cnblogs.com/heimafeitian/p/9644242.html
Copyright © 2011-2022 走看看