Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

0

Link retrieval from MD-SAL

asked 2014-05-07 09:47:04 -0700

To retrieve all the nodes or a particular node from MD-SAL, I used the method described on this link.

Is there any way to retrieve all the links or a particular link from MD-SAL?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2014-05-15 02:22:10 -0700

Hi Robert,

This is what worked for me:

    TopologyId topoId = new TopologyId("flow:1");
    InstanceIdentifier topoIdentifier = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(topoId)).toInstance();
     Topology topology = (Topology) dataProviderService.readOperationalData(topoIdentifier);
    List<Link> links = topology .getLink();

I have documented it here:

http://sdntutorials.com/how-to-look-up-topology-and-links-in-md-sal/

edit flag offensive delete publish link more
0

answered 2014-05-07 12:07:34 -0700

Robert Varga gravatar image

The approach would be the same, but you would create an InstanceIdentifier which would target links -- not sure what the original model was, assuming it was network-topology or similar, but it should work like this:

//Look up all the nodes from MD-SAL operational data store InstanceIdentifier<links> nodesIdentifier = InstanceIdentifier.builder(Links.class).toInstance() List<link/> nodes = dataService.readOperationalData(linksIdentifier).getLinks();</links>

//Look up a specific node "node001" LinkId linkId = new LinkId("link001"); InstanceIdentifier instanceIdentifier = InstanceIdentifier.builder(Links.class).child(Link.class, new LinkKey(linkId)).toInstance(); Link link = dataService.readOperationalData(instanceIdentifier);

The specifics really depend on the model -- if you look at the base network topology model ( https://jenkins.opendaylight.org/yangtools/job/yangtools-merge/lastSuccessfulBuild/artifact/model/ietf/ietf-topology/target/yang/network-topology@2013-10-21.yang ), you will see that both nodes and links have the same kind of containment.

edit flag offensive delete publish link more

Comments

Thanks Robert, I will try this out.

kanika28 ( 2014-05-09 07:10:58 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
2 followers

Stats

Asked: 2014-05-07 09:47:04 -0700

Seen: 180 times

Last updated: May 15 '14