Use ONOS controller to automatically fill P4 tables for scalability

Currently I have a functional Mininet simulation with BMV2 P4 switches, but I use P4utils to manually insert table entries to the switches and add basic routing capabilities. In order to achieve scalability I want to implement ONOS as the controller to detect the network and automatically fill the routing tables in the switches, ¿has anyone achieved this?. The NGSDN tutorial seems to create an ONOS app for this, but it is built for IPv6 and my network uses IPv4. I have limited time for this implementation so I would like to know if there is already an easy way to do this, if not I would just stick to a small topology but it would be better to be able to scale the network.

Thanks in advance for your answers.

Hi @ErickD,

You cna use the pipeline basic, already avaiable in the ONOS master repo. Via this app you should be able to fill the switches via the REST API and the application ReactiveForwarding (app in charge of provide connectivity among hosts)

ONOS APPL: https://github.com/opennetworkinglab/onos/tree/dd5172e5a6e1ba5c7e17e2f497aa8c27a1ed33e9/pipelines/basic/src/main/java/org/onosproject/pipelines/basic

P4 PIPELINE:

Thanks, I will check.

I tried using the app but failed. What I did is starting a docker container with onos with “sudo docker start onos”, then the mininet topology with “sudo python3 topo2.py” (The topology is the same as the ngsdn tutorial) but modified the call to load the basic.json as the p4 program instead of the one used in the tutorial and loaded the netcfg from the same tutorial as the topology is the same. The problem is that onos seems to have problems loading the apps. ¿Any tips?

Here are the apps:


HI @ErickD ,

seems that you don’ t have the “driver”. How you wrote the JSON for device discovery? Con you share it?

Best
Davide

I used the same JSON as the ngsdn tutorial but modified to use the pipeline, also changed the direction because mininet:50001 and so, caused another error.

{
“devices”: {
“device:leaf1”: {
“basic”: {
“managementAddress”: “grpc://127.0.0.1:50001?device_id=1”,
“driver”: “stratum-bmv2”,
“pipeconf”: “org.onosproject.pipelines.basic”,
“locType”: “grid”,
“gridX”: 200,
“gridY”: 600
},
“fabricDeviceConfig”: {
“myStationMac”: “00:aa:00:00:00:01”,
“mySid”: “3:101:2::”,
“isSpine”: false
}
},
“device:leaf2”: {
“basic”: {
“managementAddress”: “grpc://127.0.0.1:50002?device_id=1”,
“driver”: “stratum-bmv2”,
“pipeconf”: “org.onosproject.pipelines.basic”,
“locType”: “grid”,
“gridX”: 800,
“gridY”: 600
},
“fabricDeviceConfig”: {
“myStationMac”: “00:aa:00:00:00:02”,
“mySid”: “3:102:2::”,
“isSpine”: false
}
},
“device:spine1”: {
“basic”: {
“managementAddress”: “grpc://127.0.0.1:50003?device_id=1”,
“driver”: “stratum-bmv2”,
“pipeconf”: “org.onosproject.pipelines.basic”,
“locType”: “grid”,
“gridX”: 400,
“gridY”: 400
},
“fabricDeviceConfig”: {
“myStationMac”: “00:bb:00:00:00:01”,
“mySid”: “3:201:2::”,
“isSpine”: true
}
},
“device:spine2”: {
“basic”: {
“managementAddress”: “grpc://127.0.0.1:50004?device_id=1”,
“driver”: “stratum-bmv2”,
“pipeconf”: “org.onosproject.pipelines.basic”,
“locType”: “grid”,
“gridX”: 600,
“gridY”: 400
},
“fabricDeviceConfig”: {
“myStationMac”: “00:bb:00:00:00:02”,
“mySid”: “3:202:2::”,
“isSpine”: true
}
}
},
“ports”: {
“device:leaf1/3”: {
“interfaces”: [
{
“name”: “leaf1-3”,
“ips”: [“2001:1:1::ff/64”]
}
]
},
“device:leaf1/4”: {
“interfaces”: [
{
“name”: “leaf1-4”,
“ips”: [“2001:1:1::ff/64”]
}
]
},
“device:leaf1/5”: {
“interfaces”: [
{
“name”: “leaf1-5”,
“ips”: [“2001:1:1::ff/64”]
}
]
},
“device:leaf1/6”: {
“interfaces”: [
{
“name”: “leaf1-6”,
“ips”: [“2001:1:2::ff/64”]
}
]
},
“device:leaf2/3”: {
“interfaces”: [
{
“name”: “leaf2-3”,
“ips”: [“2001:2:3::ff/64”]
}
]
},
“device:leaf2/4”: {
“interfaces”: [
{
“name”: “leaf2-4”,
“ips”: [“2001:2:4::ff/64”]
}
]
}
},
“hosts”: {
“00:00:00:00:00:1A/None”: {
“basic”: {
“name”: “h1a”,
“locType”: “grid”,
“gridX”: 100,
“gridY”: 700
}
},
“00:00:00:00:00:1B/None”: {
“basic”: {
“name”: “h1b”,
“locType”: “grid”,
“gridX”: 100,
“gridY”: 800
}
},
“00:00:00:00:00:1C/None”: {
“basic”: {
“name”: “h1c”,
“locType”: “grid”,
“gridX”: 250,
“gridY”: 800
}
},
“00:00:00:00:00:20/None”: {
“basic”: {
“name”: “h2”,
“locType”: “grid”,
“gridX”: 400,
“gridY”: 700
}
},
“00:00:00:00:00:30/None”: {
“basic”: {
“name”: “h3”,
“locType”: “grid”,
“gridX”: 750,
“gridY”: 700
}
},
“00:00:00:00:00:40/None”: {
“basic”: {
“name”: “h4”,
“locType”: “grid”,
“gridX”: 850,
“gridY”: 700
}
}
}
}

  1. You can simplify the json like this and load only one switch.
{
    "devices": {
        "device:bmv2:s01": {
            "ports": {
                "1": {
                    "name": "s01-eth1", 
                    "speed": 10000, 
                    "enabled": true, 
                    "number": 1, 
                    "removed": false, 
                    "type": "copper"
                }, 
                "2": {
                    "name": "s01-eth2", 
                    "speed": 10000, 
                    "enabled": true, 
                    "number": 2, 
                    "removed": false, 
                    "type": "copper"
                }
            }, 
            "basic": {
                "managementAddress": "grpc://127.0.0.1:50001?device_id=1", 
                "driver": "“stratum-bmv2", 
                "pipeconf": "org.onosproject.pipelines.basic"
            }
        }
    }
}
  1. Are you sure that the container has the network reachability, because if the onos container is isolated the hand shake is going to fail. (I’m saying that because they running a docker compose https://github.com/opennetworkinglab/ngsdn-tutorial/blob/advanced/EXERCISE-2.md#3-understanding-yang-enabled-transport-protocols )