KShortest path algorithm

3 views
Skip to first unread message

Sergio Vera Martínez

unread,
Nov 15, 2020, 1:56:19 PM11/15/20
to ONOS Developers
Hi everyone,

I'm trying to use the KShortest path algorithm by default instead of Dijkstra. To find the paths properly, in the "internalSearch()" method in "KShortestPathsSearch.java", it's checked that the variable maxPaths is not equal to ALL_PATHS. By default in "GraphPathSearch" interface is set to -1. How can I change the value of this variable without  changing it directly from the interface (in a custom java class e.j)? Since it's public, static and final I can't modify it from an external class. Thanks in advance.

Best regards 

Thomas Vachuska

unread,
Nov 16, 2020, 1:54:18 AM11/16/20
to Sergio Vera Martínez, ONOS Developers
Hi,

This is a good question. I looked into this and it's currently not possible. We can configure or programmatically inject default path search of the link weight function, but ALL_PATHS is currently hard-coded. I’ll be putting up a Gerri review with a small change that will allow configuring or programmatically injecting default maxPaths value to be used by the DefaultTopology. I want to run a full set of unit tests on this, but hopefully it should be up in about 30 minutes or so.  I will reply again when this is available for review.

Thomas

--
You received this message because you are subscribed to the Google Groups "ONOS Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to onos-dev+u...@onosproject.org.
To view this discussion on the web visit https://groups.google.com/a/onosproject.org/d/msgid/onos-dev/25c42696-c6c0-42c6-a653-0485a26530bbn%40onosproject.org.

Thomas Vachuska

unread,
Nov 16, 2020, 2:30:07 AM11/16/20
to Sergio Vera Martínez, ONOS Developers
Hi,

This Gerrit review contains the enhancement that will allow you to set the default maxPaths count to be used. Clearly, it can be used even with the default Dijkstra, but is intended to be used with the default setting of K-shortest paths algorithm setting.

Hopefully, this will address the issue and allow you to use K-short paths by default.

Thomas

Thomas Vachuska

unread,
Nov 16, 2020, 2:30:17 AM11/16/20
to Sergio Vera Martínez, ONOS Developers

Sergio Vera Martínez

unread,
Nov 16, 2020, 4:19:30 AM11/16/20
to ONOS Developers, tom
Hi Tom,

Thank you so much for your help! To download this commit, is it enough to make a git pull? I am in the branch of version 2.4.0, and I have seen on gerrit that the commit has been done in master.

Best regards

El dia dilluns, 16 de novembre de 2020 a les 8:30:23 UTC+1, tom va escriure:

Sergio Vera Martínez

unread,
Nov 16, 2020, 8:09:58 AM11/16/20
to ONOS Developers, tom

Hi again,

Sorry for bothering you but I still have an error trying to use the setDefaultMaxPaths from my custom .java class. It says that cannot find the method. To use it, I declare the PathAdminService and call the method. Is it correct? Thanks in advance.

Best regards
El dia dilluns, 16 de novembre de 2020 a les 10:19:30 UTC+1, Sergio Vera Martínez va escriure:

Andrea Campanella

unread,
Nov 16, 2020, 8:20:49 AM11/16/20
to Sergio Vera Martínez, ONOS Developers, tom
A git pull is not enough, the patch is not merged yet, you will have to dowload it like so:
git fetch "https://gerrit.onosproject.org/onos" refs/changes/37/24137/1 && git checkout FETCH_HEAD
Then issue the command (assuming you have ONOS’ bash_profile exported)
onos-publish -l
When the patch is merged these won’t be necessary anymore. 

Thanks, 
Andrea Campanella

Member of Technical Staff at ONF
Member of ONOS Technical Steering Team
Member of Ambassador Steering Team, ONOS and CORD Community

Sergio Vera Martínez

unread,
Nov 16, 2020, 8:24:05 AM11/16/20
to ONOS Developers, and...@opennetworking.org, ONOS Developers

I have decided to copy the methods by hand. But I still have this issue:

"I still have an error trying to use the setDefaultMaxPaths from my custom .java class. It says that cannot find the method. To use it, I declare the PathAdminService and call the method. Is it correct?"

Thanks in advance.

Regards

El dia dilluns, 16 de novembre de 2020 a les 14:20:54 UTC+1, and...@opennetworking.org va escriure:

Andrea Campanella

unread,
Nov 16, 2020, 8:25:23 AM11/16/20
to Sergio Vera Martínez, ONOS Developers
You still need the 
onos-publish -l

That pushes the artifacts with the new API to your system to be picked up by the apps. 

Thanks, 
Andrea Campanella

Member of Technical Staff at ONF
Member of ONOS Technical Steering Team
Member of Ambassador Steering Team, ONOS and CORD Community

Sergio Vera Martínez

unread,
Nov 16, 2020, 11:02:06 AM11/16/20
to ONOS Developers, and...@opennetworking.org
Thank you so much. I didn't know of the existence of this command. Apart from building the onos and my custom application, do I need to apply always this command?

Best regards

El dia dilluns, 16 de novembre de 2020 a les 14:25:30 UTC+1, and...@opennetworking.org va escriure:

Andrea Campanella

unread,
Nov 16, 2020, 11:09:21 AM11/16/20
to Sergio Vera Martínez, ONOS Developers
Only when a new API is added and not merged into the upstream. 

When the API is merged and ONOS released you should not need to. 

Thanks, 
Andrea Campanella

Member of Technical Staff at ONF
Member of ONOS Technical Steering Team
Member of Ambassador Steering Team, ONOS and CORD Community

Thomas Vachuska

unread,
Nov 16, 2020, 1:42:57 PM11/16/20
to Sergio Vera Martínez, ONOS Developers, Andrea Campanella
Hi Sergio,

The patch https://gerrit.onosproject.org/c/onos/+/24137 has been merged into master so if you pull the latest, you should be able to use the the component configuration to set the maxPath value for org.onosproject.store.topology.impl.DistributedTopoogyStore component. Alternatively, you should be able to use the PathAdminSevice.setDefaultMaxPaths(int maxPaths) to inject an alternate default value to ALL_PATHS. Either of these should allow you to use K-shortest paths algorithm as the default.  Please let us know if this does not work for you for some reason.

Thomas

Sergio Vera Martínez

unread,
Nov 16, 2020, 2:38:28 PM11/16/20
to ONOS Developers, tom, ONOS Developers, and...@opennetworking.org, Sergio Vera Martínez

Hi everyone,

Everything is working properly now! Thank you so much for your time and consideration.

Best regards
El dia dilluns, 16 de novembre de 2020 a les 19:43:04 UTC+1, tom va escriure:

Thomas Vachuska

unread,
Nov 16, 2020, 2:43:00 PM11/16/20
to Sergio Vera Martínez, ONOS Developers, and...@opennetworking.org
Great to hear!  Happy coding.

Thomas

On Nov 16, 2020, at 11:38, Sergio Vera Martínez <sergio.ver...@estudiantat.upc.edu> wrote:


Hi everyone,

Reply all
Reply to author
Forward
0 new messages