Ubuntu20.04 build and run ONOS

One, install Bazel

There are several ways to install Bazel on Ubuntu:

  1. Install via npm
    npm install -g @bazel/bazelisk
    
    This method needs to install nodejs, the command is sudo apt install nodejs
  2. Use Bazel's apt repository
    Step 1: Add the Bazel release URI as the package source
    sudo apt install curl gnupg
    curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
    sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
    echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
    
    Step 2: Install and update Bazel
    sudo apt update && sudo apt install bazel
    

2. Obtain ONOS source code

Make sure git is installed, then create a local clone of the source repository:

git clone https://gerrit.onosproject.org/onos

If the download is slow, you can use gitee

git clone https://gitee.com/mirrors/onos.git

Three, build

Enter the onos folder

cd onos

Pass git tagcan view the version list, pass git checkout 版本号can select the version, the default is the latest

Execute build

bazel build onos

This step requires downloading a lot of packages, it takes a long time, and some errors may be reported, for example:

Generally, it is a network problem and can be executed multiple timesbazel build onos

Finally this appears, indicating that it has been built

Fourth, run

Excuting an order

bazel run onos-local

To attach to the ONOS CLI console, you can run

./tools/test/bin/onos localhost


After connecting, you can run various ONOS CLI and Apache Karaf commands. For example, to start the OpenFlow and ReactiveForwarding applications, you can do the following:

app activate org.onosproject.openflow
app activate org.onosproject.fwd


Visit http://localhost:8181/onos/ui through a browser, the

account is onos, and the password is rocks

To start a Mininet network controlled by an ONOS instance already running on the development computer, you can use the following command:

sudo mn --switch ovs,protocols=OpenFlow13 --controller remote


In the onos gui display situation:

During the test, it was found that the openflow11 and openflow12 versions cannot be resolved by onos, and I don’t understand why

Guess you like

Origin blog.csdn.net/qq_37579106/article/details/110729679