p4lang / tutorials

P4 language tutorials
Apache License 2.0
1.36k stars 887 forks source link

error:Invalid JSON file: build/ #506

Closed RogueCHU closed 1 year ago

RogueCHU commented 1 year ago

i'm a beginner in P4. I tried to build a new custom mininet topology and then type 'make run', but something wrong happened. And i found that the file "build/" was empty. Could you please help me?

my custom topology is as follows:

{"switches": {"s1": {}},
 "hosts": { "h1": {"ip": "10.0.1.1/24", "mac": "08:00:00:00:01:11", "commands": ["route add default gw 10.0.1.10 dev eth0", "arp -i eth0 -s 10.0.1.10 08:00:00:00:01:00"]},
            "h2": {"ip": "10.0.2.2/24", "mac": "08:00:00:00:02:00", "commands": ["route add default gw 10.0.2.20 dev eth0", "arp -i eth0 -s 10.0.2.20 08:00:00:00:02:00"]},
            "h3": {"ip": "10.0.2.3/24", "mac": "08:00:00:00:02:01", "commands": ["route add default gw 10.0.2.30 dev eth0", "arp -i eth0 -s 10.0.2.30 08:00:00:00:02:00"]}}, 
 "links": [["h1", "s1-p1"],["s1-p2","h2"],["s1-p3","h3"]]}

the details of errors are as follows:

mkdir -p build pcaps logs
sudo python3 ../../utils/run_exercise.py -t topology.json -j build/ -b simple_switch_grpc
Reading topology file.
Building mininet topology.
Invalid JSON file: build/
make: *** [../../utils/Makefile:35:run] error 1
RogueCHU commented 1 year ago

ohh I fixed it. both the .p4 program and the topology.json program must be in the same file.