diff --git a/contrib/p4/docker_files/switch_bmv2_grpc/Dockerfile b/contrib/p4/docker_files/switch_bmv2_grpc/Dockerfile new file mode 100644 index 000000000..5c686e799 --- /dev/null +++ b/contrib/p4/docker_files/switch_bmv2_grpc/Dockerfile @@ -0,0 +1,112 @@ +# SPDX-FileCopyrightText: 2020-2021 CASTOR Software Research Centre +# +# SPDX-FileCopyrightText: 2020-2021 Johan Paulsson + +# SPDX-License-Identifier: Apache-2.0 + +#Container for using bmv2 open source switch. See ref https://github.com/p4lang/behavioral-model +#It is capable of loading a compiled bmv2 json file + +FROM ubuntu:16.04 + +RUN apt-get update && apt-get install -y \ + automake \ + cmake \ + libjudy-dev \ + libreadline-dev \ + valgrind \ + libtool-bin\ + libgmp-dev \ + libpcap-dev \ + libboost-dev \ + libboost-test-dev \ + libboost-program-options-dev \ + libboost-system-dev \ + libboost-filesystem-dev \ + libboost-thread-dev \ + libevent-dev \ + libtool \ + flex \ + bison \ + pkg-config \ + g++ \ + libssl-dev \ + libffi-dev \ + python3-dev \ + python3-pip \ + wget \ + git \ + sudo \ + && rm -rf /var/lib/apt/list/* + +#Install P4PI + +##protobuf +RUN git clone https://github.com/google/protobuf.git +RUN cd protobuf && git checkout tags/v3.6.1 +RUN cd protobuf && ./autogen.sh +RUN cd protobuf && ./configure +RUN cd protobuf && make +RUN cd protobuf && make install +RUN cd protobuf && ldconfig + +## Grpc +RUN git clone https://github.com/google/grpc.git +RUN cd grpc \ + && git checkout tags/v1.17.2 \ + && git submodule update --init --recursive \ + && make \ + && make install \ + && ldconfig + +## PI +RUN git clone https://github.com/p4lang/PI.git +RUN cd PI \ + && git submodule update --init --recursive \ + &&./autogen.sh \ + && ./configure --with-proto --without-internal-rpc -without-cli --without-bmv2 \ + && make \ + && make install + + +RUN git clone https://github.com/p4lang/behavioral-model.git /usr/local/behavioral-model +RUN cd /usr/local/behavioral-model && git submodule update --init --recursive + + +## Nanomsg +RUN mkdir tempdir +RUN cd tempdir && chmod +x /usr/local/behavioral-model/travis/install-nanomsg.sh && /usr/local/behavioral-model/travis/install-nanomsg.sh +RUN cd tempdir && chmod +x /usr/local/behavioral-model/travis/install-nnpy.sh && /usr/local/behavioral-model/travis/install-nnpy.sh + +RUN cd /usr/local/behavioral-model \ + && ./autogen.sh \ + && ./configure --with-pi --without-thrift \ + && make \ + && make install + +RUN cd /usr/local/behavioral-model/targets/simple_switch_grpc \ + && ./autogen.sh \ + && ./configure \ + && make \ + && make install + +RUN ldconfig + +# RUN cd /usr/local/behavioral-model/travis && sudo chmod +x install-thrift.sh install-nanomsg.sh install-nnpy.sh + + +# #Instead of install_deps.sh +# RUN mkdir tempdir +# RUN cd tempdir && sudo /usr/local/behavioral-model/travis/install-thrift.sh +# RUN cd tempdir && /usr/local/behavioral-model/travis/install-nanomsg.sh +# RUN cd tempdir && /usr/local/behavioral-model/travis/install-nnpy.sh + +# RUN rm -rf tempdir + +# RUN cd /usr/local/behavioral-model/ && ./autogen.sh +# RUN /usr/local/behavioral-model/configure && make && make install +# # RUN make +# # RUN make install +# RUN cd /usr/local/behavioral-model/ && ldconfig + +CMD tail -f /dev/null