GithubHelp home page GithubHelp logo

Comments (4)

Dscano avatar Dscano commented on June 21, 2024

Hi yhx-coder,

did you build on your own the stratum_bmv2 or you download it form stratum assets? That error seems related to bmv2 switch rather than stratum. https://github.com/p4lang/behavioral-model/search?q=InvalidMirroringOperation

from stratum.

pudelkoM avatar pudelkoM commented on June 21, 2024

The bmv2 version is not as self-contained as the others. It requires some libraries that have to be manually installed beforehand.
You can check how the bmv2 Docker image built and replicate that locally:

stratum/Dockerfile.build

Lines 63 to 85 in 88d02d5

ARG PI_COMMIT
RUN git clone https://github.com/p4lang/PI.git /tmp/PI && \
cd /tmp/PI && git checkout ${PI_COMMIT} && \
git submodule update --init --recursive && \
./autogen.sh && \
./configure --without-bmv2 --without-proto --without-fe-cpp \
--without-cli --without-internal-rpc && \
make -j${JOBS} && make install && ldconfig && \
rm -rf /tmp/PI
ARG BMV2_COMMIT
ENV BMV2_INSTALL /usr/local
RUN git clone https://github.com/p4lang/behavioral-model.git /tmp/bmv2 && \
cd /tmp/bmv2 && git checkout ${BMV2_COMMIT} && \
./autogen.sh && \
./configure --without-targets --with-pi --disable-elogger \
--without-nanomsg --without-thrift --prefix=${BMV2_INSTALL} \
CXXFLAGS="-I${PWD}/targets/simple_switch -DWITH_SIMPLE_SWITCH -isystem$BMV2_INSTALL/include -isystem$PI_INSTALL/include -L$PI_INSTALL/lib" && \
make -j${JOBS} && make install && ldconfig && \
cd targets/simple_switch && \
make -j${JOBS} && make install && ldconfig && \
cp /tmp/bmv2/tools/veth* ${BMV2_INSTALL}/bin/ && \
rm -rf /tmp/bmv2

ENV BUILD_DEPS \
python-setuptools \
python-pip \
help2man
RUN apt-get update && \
apt-get install -y --no-install-recommends ${BUILD_DEPS}
# Build Mininet
RUN mkdir /tmp/mininet
WORKDIR /tmp/mininet
RUN curl -L https://github.com/mininet/mininet/tarball/master | \
tar xz --strip-components 1
# Install in a special directory that we will copy to the runtime image.
RUN mkdir -p /output
RUN PREFIX=/output make install-mnexec install-manpages
RUN python setup.py install --root /output
# Install `m` utility so user can attach to a mininet host directly
RUN cp util/m /output/bin/m && sed -i 's#sudo##g' /output/bin/m
# Copy Stratum souce to build additionally needed targets.
COPY . /tmp/stratum
WORKDIR /tmp/stratum
# As well as the P4Runtime Python bindings installed by PI. This is not needed
# to run mininet, but it's useful to execute Python scripts acting as a
# P4Runtime client, e.g. control plane apps or PTF tests.
RUN bazel build @com_github_p4lang_p4runtime//:p4runtime_proto \
@com_google_protobuf//:protobuf_python \
@com_google_googleapis//google/rpc:status_cc_proto \
@com_google_googleapis//google/rpc:status_proto \
@com_google_googleapis//google/rpc:error_details_cc_proto \
@com_google_googleapis//google/rpc:error_details_proto \
@com_google_googleapis//google/rpc:code_cc_proto \
@com_google_googleapis//google/rpc:code_proto \
@com_github_grpc_grpc//src/compiler:grpc_python_plugin
ENV PYTHON_PACKAGE_BASE /output/usr/local/lib/python2.7/dist-packages
RUN ./bazel-out/host/bin/external/com_google_protobuf/protoc \
./bazel-stratum/external/com_github_p4lang_p4runtime/p4/v1/p4data.proto \
./bazel-stratum/external/com_github_p4lang_p4runtime/p4/v1/p4runtime.proto \
./bazel-stratum/external/com_github_p4lang_p4runtime/p4/config/v1/p4info.proto \
./bazel-stratum/external/com_github_p4lang_p4runtime/p4/config/v1/p4types.proto \
./bazel-stratum/external/com_google_googleapis/google/rpc/status.proto \
./bazel-stratum/external/com_google_googleapis/google/rpc/code.proto \
-I./bazel-stratum/external/com_google_googleapis -I./bazel-stratum/external/com_github_p4lang_p4runtime \
-I./bazel-stratum/external/com_google_protobuf/src \
--python_out $PYTHON_PACKAGE_BASE --grpc_out $PYTHON_PACKAGE_BASE \
--plugin=protoc-gen-grpc=./bazel-bin/external/com_github_grpc_grpc/src/compiler/grpc_python_plugin
RUN touch $PYTHON_PACKAGE_BASE/p4/__init__.py && \
touch $PYTHON_PACKAGE_BASE/p4/v1/__init__.py && \
touch $PYTHON_PACKAGE_BASE/p4/config/__init__.py && \
touch $PYTHON_PACKAGE_BASE/p4/config/v1/__init__.py && \
touch $PYTHON_PACKAGE_BASE/google/__init__.py && \
touch $PYTHON_PACKAGE_BASE/google/rpc/__init__.py
# Install a version of the protobuf and grpc python bindings that is
# compatible to that used to generate the P4Runtime ones.
ARG PROTOBUF_VER=3.14.0
ARG GRPC_VER=1.33.2
RUN pip install --root /output "protobuf<=${PROTOBUF_VER}"
RUN pip install --root /output "grpcio<=${GRPC_VER}"

from stratum.

yhx-coder avatar yhx-coder commented on June 21, 2024

thanks. I try to follow the Dockerfile.build, the previous error is fixed.However, another error happens: stratum_bmv2: undefined symbol: _pi_port_status_get.Now I guess the the reason is that I don't build the bmv2 or pi correcttly. It's a little difficult for me :( .I decide to use the docker. thanks for your support.

from stratum.

pudelkoM avatar pudelkoM commented on June 21, 2024

Sorry to hear that. Getting the PI and bmv2 setup right is indeed tricky. That's why we're relying on docker images for it.
I hope you can solve your use case with docker.

If there is anything else, feel free to re-open this issue or create a new one.

from stratum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.