ONOS APP OAR not getting generated with Bazel

90 views
Skip to first unread message

Deval Bhamare

unread,
Feb 29, 2020, 4:25:43 PM2/29/20
to briga...@onosproject.org, Carmelo Cascone

Dear Team, 


I have developed a cutomized pipeconf ONOS app in existing onos/apps folder. When I try to do bazel build onos with my new app (with all required code files and BUILD file in onos/apps/my-app-folder), build goes well, but the OAR file is NOT generated for my app. I can see that bazel generated OAR file for existing Apps, but there is not OAR file for my app anywhere in Onos folder. 



I have searched a lot about it, but couldn't find the solution. I also read in one thread that if you want to generate JAR file for your app, you need to add your App name in modules.bzl. I did that and I can see the jar is generated for my app, but NO OAR


 Can you please help me with this? Am I missing some step? Do I have to add my App name in some file? 


Thanks in advance. Sample BUILD file is attached as well. 


Regards,


Deval.



BUILD

Deval Bhamare

unread,
Mar 1, 2020, 5:34:15 AM3/1/20
to briga...@onosproject.org, Carmelo Cascone

Error has been solved. Thanks for the help and support. 




From: Deval Bhamare
Sent: Saturday, February 29, 2020 11:25:39 PM
To: briga...@onosproject.org
Cc: Carmelo Cascone
Subject: ONOS APP OAR not getting generated with Bazel
 

Eder Ollora Zaballa

unread,
Mar 1, 2020, 5:52:07 AM3/1/20
to briga...@onosproject.org, Deval Bhamare, Carmelo Cascone
Hi Deval,

Maybe you could share how you solved it so developers that might read the emails have an idea of your issue and solution.

Cheers,


From: Deval Bhamare <Deval....@kau.se>
Sent: Sunday, March 1, 2020 11:34:09 AM
To: briga...@onosproject.org <briga...@onosproject.org>
Cc: Carmelo Cascone <car...@opennetworking.org>
Subject: [brigade-p4] Re: ONOS APP OAR not getting generated with Bazel
 
--
You received this message because you are subscribed to the Google Groups "P4 brigade" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brigade-p4+...@onosproject.org.
To view this discussion on the web visit https://groups.google.com/a/onosproject.org/d/msgid/brigade-p4/36eae8df66054715be47f8cd827b5026%40kau.se.

Deval Bhamare

unread,
Mar 1, 2020, 6:18:22 AM3/1/20
to Eder Ollora Zaballa, briga...@onosproject.org, Carmelo Cascone

Hi, 


So, I have been to create OAR both with Bazel and Maven. 
For Maven, list is long as I had to include corresponding dependencies with correct version, specific to my app and may not be relevant here. 


For Bazel, 

I had to add the dependencies to BUILD file, same as above. Then there was a class mismatch error so, I had to upgrade my JAVA to JAVA 11. Nice guide here: 

https://www.javahelps.com/2017/09/install-oracle-jdk-9-on-linux.html


Also directory structure should be proper. It should match the BUNDLE in your BUILD file. BUILD file location also should be correct, above the /src directory in your app directory. 


Within /src also the directory structure should be proper. Open any existing app and you may follow it. If you have some P4-code then it should be complied and the corresponding p4info, bin and json should be kept in /resources under src/main/resources. 


I followed the steps how they complied fabric.p4 and the Makefile from 

https://github.com/opencord/fabric-tofino


After this, final step is to include your App name in tools / build / bazle / modules.bzl file as  "// apps / application name: onos-apps-application name-oar 


Important thing is to add OAR int the end, else it will create only JAR file. 


Hope this will save some efforts to someone. 


Thanks,

Deval.


From: Eder Ollora Zaballa <eo...@fotonik.dtu.dk>
Sent: Sunday, March 1, 2020 12:52:04 PM
To: briga...@onosproject.org; Deval Bhamare
Cc: Carmelo Cascone
Subject: Re: ONOS APP OAR not getting generated with Bazel
 

Deval Bhamare

unread,
Mar 1, 2020, 9:33:09 AM3/1/20
to briga...@onosproject.org, eo...@fotonik.dtu.dk, Carmelo Cascone

Hi again, 


Now, I want to populate tables for my app on Tofino using Onos through my pipeconfApp, which is now running on Onos. I have been referring to the tutorial here: https://github.com/opencord/fabric-tofino


So as I understand, 

1. Either I can install stratum or use something like below to start gRPC server on tofino to enable the communication with Onos. 

./run_switchd.sh -c $SDE_INSTALL/share/p4/targets/tofino/skip_p4.conf --skip-p4 --p4rt-server 0.0.0.0:50051


2. Also, I need to push netcfg.json to Onos with REST using curl or similar. For that, is below json file would be valid (given gRPC is on above IP:port)?


1   {

  1   "devices": {

  2     "device:tofino": {

  3       "basic": {

  4         "managementAddress": "grpc://0.0.0.0:50051?device_id=1",

  5         "driver": "stratum-tofino",

  6         "pipeconf": "org.opencord.my_pipeconf"

  7       }

  8     }

  9   }

 10 }



Thanks,


Deval






From: Deval Bhamare
Sent: Sunday, March 1, 2020 1:18 PM
To: Eder Ollora Zaballa; briga...@onosproject.org
Cc: Carmelo Cascone

Carmelo Cascone

unread,
Mar 2, 2020, 4:56:19 PM3/2/20
to Deval Bhamare, briga...@onosproject.org, eo...@fotonik.dtu.dk
Hi Deval,

Quick heads up: for a proper tutorial on ONOS+P4+Stratum together I suggest you use this one:

You will find much more information there than fabric-tofino’s README, which is mostly instructions on how to use the fabric.p4 pipeconf with ONOS.

Concerning your questions:

1. I suggest you install Stratum on the switch if you want better support from the ONOS side, for two reasons: (1) ONOS’s P4Runtime client has been mostly tested with Stratum’s P4Runtime server implementation, and (2) Stratum exposes a gNMI service which can be used by ONOS to configure ports, obtains port counters, etc. I don’t believe bf_switchd has native support for gNMI.

2. I don't think you should use the special 0.0.0.0 IPv4 address in the netcfg.json, instead you should use the IP address of the switch on your management network. In other words, whatever IP address that allows you to ping the switch management interface from the machine running ONOS.

Hope it helps
Carmelo

Deval Bhamare

unread,
Mar 5, 2020, 6:02:48 AM3/5/20
to Carmelo Cascone, briga...@onosproject.org, eo...@fotonik.dtu.dk

Hi Carmelo,


Thank you for your reply and I have gone through the resource suggested. 


My problem is, I am communicating with Tofino Switch using bfshell on address 127.0.0.1:7777 and it works. 


Now, as per the ONOS Pipaconf guide, when I try to push the below tofinno-necfg.json for my vepg app, ONOS says (screenshot attached).  


  1   "devices": {

  2     "device:tofino": {

  3       "basic": {

  4         "managementAddress": "grpc://127.0.0.1:7777?device_id=1",

  5         "driver": "p4runtime",

  6         "pipeconf": "org.opencord.fabric.tofino.montara_sde_8_9_0"

  7       }

  8     }

  9   }

 10 }


As you can see in the beginning part, ONOS LOG says: 


2020-03-05T11:36:19,072 | WARN  | onos-gdp-1       | GeneralDeviceProvider            | 235 - org.onosproject.onos-providers-general-device - 2.2.2.SNAPSHOT | Detected change of connection endpoints for device:tofino, will tear down existing connection and set up a new one...

2020-03-05T11:36:19,109 | INFO  | onos-gdp-1       | GrpcChannelControllerImpl        | 230 - org.onosproject.onos-protocols-grpc-ctl - 2.2.2.SNAPSHOT | Creating new gRPC channel grpc://127.0.0.1:7777?device_id=1...

2020-03-05T11:36:19,191 | INFO  | onos-gdp-1       | DeviceManager                    | 193 - org.onosproject.onos-core-net - 2.2.2.SNAPSHOT | Local role is MASTER for device:tofino



So loks like communication channel is being established. But later on it says:


2020-03-05T11:36:19,195 | WARN  | onos-event-dispatch-default0 | ModelCache                       | 210 - org.onosproject._onos-gui2-base-jar - 2.2.2.SNAPSHOT | DeviceID device:tofino not found as a UiDevice

2020-03-05T11:36:19,197 | INFO  | onos-gdp-1       | GeneralDeviceProvider            | 235 - org.onosproject.onos-providers-general-device - 2.2.2.SNAPSHOT | Notifying role MASTER (preference 0) for term 1 to device:tofino

2020-03-05T11:36:19,199 | WARN  | onos-event-dispatch-default0 | ModelCache                       | 210 - org.onosproject._onos-gui2-base-jar - 2.2.2.SNAPSHOT | DeviceID device:tofino not found as a UiDevice

2020-03-05T11:36:19,200 | WARN  | onos-device-manager-background | DeviceManager                    | 193 - org.onosproject.onos-core-net - 2.2.2.SNAPSHOT | Node was instructed to be MASTER role for device:tofino, but this node cannot reach the device.  Relinquishing role.  



So I cannot see any device or when I try to populate tables, I get message: 


2020-03-05T11:38:01,377 | WARN  | onos-flowservice-device-installer-3 | ECFlowRuleStore                  | 192 - org.onosproject.onos-core-dist - 2.2.2.SNAPSHOT | No master for device:tofino 



Please suggest. 


Thanks,


Deval.



From: Carmelo Cascone <car...@opennetworking.org>
Sent: Monday, March 2, 2020 11:56:15 PM
To: Deval Bhamare
Cc: briga...@onosproject.org; eo...@fotonik.dtu.dk
Subject: Re: ONOS + Tofino + Stratum
 
Screen Shot 2020-03-05 at 11.56.42.png

Yi Tseng

unread,
Mar 5, 2020, 5:20:02 PM3/5/20
to Deval Bhamare, Carmelo Cascone, briga...@onosproject.org, eo...@fotonik.dtu.dk
Hi Deval,

I think the BFShell is not an implementation of P4Runtime gRPC server. 

That's why ONOS cannot set up the mastership to the device

You can also find "sessionOpen=false" in your screenshot file.

Yi



--
Yi Tseng
Member of Technical Staff
Open Networking Foundation

Deval Bhamare

unread,
Mar 6, 2020, 2:44:29 AM3/6/20
to Yi Tseng, Carmelo Cascone, briga...@onosproject.org, eo...@fotonik.dtu.dk
Thank you Yi and Carmelo.

~Deval
From: Yi Tseng <y...@opennetworking.org>
Sent: Friday, March 6, 2020 12:19:24 AM
To: Deval Bhamare
Cc: Carmelo Cascone; briga...@onosproject.org; eo...@fotonik.dtu.dk
Subject: Re: [brigade-p4] Re: ONOS + Tofino + Stratum
 
Reply all
Reply to author
Forward
0 new messages