p4lang / p4app

Apache License 2.0
112 stars 58 forks source link

simple_router doesn't work out of the box #46

Closed matt-telstra closed 6 years ago

matt-telstra commented 6 years ago

Steps to reproduce

I just followed the readme

I installed the latest stable version of docker (using apt-get)

git clone https://github.com/p4lang/p4app.git
cd p4apps

I copied the binary to /usr/local/bin and made it readable and executible. ls -l /usr/local/bin/p4app gives:

-rwxr-xr-x 1 root root 4968 Mar 12 23:23 /usr/local/bin/p4app

Then ran the simple_router.p4app example:

p4app run examples/simple_router.p4app

Expected behaviour

Example runs without error messages

Observed behaviour

...
451e2f2a11b0: Pull complete
45096d0e4760: Pull complete
Digest: sha256:1c5d36c6fcc1640d2cc0ea06c448bc13a2c176121b0f318fe85b2a7666d87d24
Status: Downloaded newer image for p4lang/p4app:latest
Entering build directory.
Extracting package.
Reading package manifest.
> p4c-bm2-ss --p4v 16 "simple_router.p4" -o "simple_router.json"
simple_router.p4:1:19: error: no include path in which to search for core.p4
simple_router.p4:2:22: error: no include path in which to search for v1model.p4
parser.p4(1):syntax error, unexpected IDENTIFIER "packet_in"
parser ParserImpl(packet_in
                  ^^^^^^^^^
error: Preprocessor returned exit code 256; aborting compilation
error: 2 errors encountered, aborting compilation
Compile failed.

Are there other dependencies I need to install? (e.g. apt-get install p4-something) I started with a clean VM and then executed only the steps described above.

flyingyang commented 6 years ago

I have encounted the same problem, but I directly install the p4c and bvm2 in the Ubuntu16.04. I sovle this problem like this: 1. go into the git repository. 2. execute "git pull"(update to the newest version). 3. reinstall. Hope it works for you.

matt-telstra commented 6 years ago

Can you please give more detail?

What are p4c and bvm2? How do I install them? (The README's Installation guide doesn't explain)

flyingyang commented 6 years ago

p4c is the p4 compile, and the bvm2 is the behavioral-model.
The VM/docker may have installed the two softwares. You can find the git repository in you VM/docker and execute the update operation.

matt-telstra commented 6 years ago

I tried again with a different VM hosting provider and it just worked.

I didn't need to do git pull on anything (other than this repo).

matt-telstra commented 6 years ago

Actually, whilst it installs properly, I don't think it runs successfully.

How do I check whether it runs properly?

I've tried:

mininet> h1 ping -c 1 h2
PING 10.0.1.10 (10.0.1.10) 56(84) bytes of data.

--- 10.0.1.10 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

mininet> h1 ping -c 1 h2
PING 10.0.1.10 (10.0.1.10) 56(84) bytes of data.

--- 10.0.1.10 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

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

The nodes can't talk to each other. So is it broken? How is the simple_router example meant to work?

theojepsen commented 6 years ago

Yes, it was broken. PR #48 should fix this.