ONOS netcfg

1,033 views
Skip to first unread message

Telmo Isasi

unread,
Jun 28, 2022, 11:18:11 AM6/28/22
to ONOS Developers
Hello,
I connected ONOS 2.7.0 with a Tofino switch using stratum and the fabric-tna pipeconf. When I edit the netcfg.json file and I deploy it in ONOS using make netcfg, the segmentrouting part of the device doesn't appear, I don't know why. 
This is what I wrote in netcfg.json:

"devices": {
    "device:leaf1": {
      "basic": {
        "managementAddress": "grpc://10.98.1.155:9559?device_id=1",
        "driver": "stratum-tofino",
        "pipeconf": "org.stratumproject.fabric.montara_sde_9_7_0"
      },
      "segmentrouting":{
        "ipv4NodeSid": 101,
        "ipv4Loopback": "192.168.1.1",
        "routerMac": "84:C7:8F:01:0C:20",
        "isEdgeRouter": true,
        "adjacencySids": []
      }
    }
  },




But this is what appears when I check netcfg in the ONOS CLI:


"devices" : {
    "device:leaf1" : {
      "basic" : {
        "managementAddress" : "grpc://10.98.1.155:9559?device_id=1",
        "driver" : "stratum-tofino",
        "pipeconf" : "org.stratumproject.fabric.montara_sde_9_7_0"
      }
    }

  },

And in the ONOS logs this appears:
15:05:57.086 INFO  [NetworkConfigManager] Configuration 'segmentrouting' queued for subject device:leaf1


Eder Ollora

unread,
Jun 30, 2022, 3:09:07 AM6/30/22
to ONOS Developers, Telmo Isasi
Hi Telmo,

Please see this line of code, if gives you the exact message for your config:


I do not have a deep knowledge about network configuration in ONOS and the way it is processed. However, checking the files in ONOS repository,  I would say that your configuration needs a class with the equivalent keys (as attributes). I know that a common way to process JSON config is to deparse it to a pre-defined class, which allows a more Java-ish way to consult the information. Why deparse a JSON string everytime you want to know something when you can just have a class representing the same content, right?. For example, the "basic":  { . . . } part of the configuration is probably assigned to a particular class.

It works (more or less) the following way: A class associates  the word "basic" with the class BasicDeviceConfig (i.e., registers a ConfigFactory). ONOS core uses this "association" to probably parse until the key "basic" and then deparse the rest of the information to the BasicDeviceConfig class. Now, your "segmentrouting" is a sub-key for the device id, you would need a similar association with the key "segmentrouting" and the proper custom class you created for it. 

There must be a class that you can use for that purpose, a class that has the same as keys as attributes. Check the tutorial or app where you saw this process suggested. 


Good luck,
Reply all
Reply to author
Forward
0 new messages