Ask Your Question
0

Requesting Data via dataBroker returns null, but via RestAPI works

asked 2015-07-29 04:22:57 -0700

luna gravatar image

updated 2015-07-29 04:34:57 -0700

Hello,

I generally try to fetch some daat from openDaylight operational datastore. However if i follow the approach, using InstanceIdentifiers, read from datastore like following lines:

TopologyId topoId = new TopologyId("flow:1");
InstanceIdentifier<Topology> topoIdentifier = InstanceIdentifier
     .builder(NetworkTopology.class)
     .child(Topology.class, new TopologyKey(topoId)).toInstance();
CheckedFuture<Optional<Topology>, ReadFailedException> topoFuture =
     (CheckedFuture<Optional<Topology>, ReadFailedException>) dataBroker
     .newReadOnlyTransaction().read(
     LogicalDatastoreType.OPERATIONAL, topoIdentifier);

Optional<Topology> topologyOpt = null;

try {
   if (topoFuture.isDone())
      topologyOpt = topoFuture.get();
} catch (InterruptedException | ExecutionException e1) {
    ...
}

But topologyOpt.isPresent() returns false. When I do the same via REST API, calling following url:

 http://localhost:8181/restconf/operational/network-topology:network-topology/topology/flow:1/

I get a valid response. What is wrong with my first approach ? In my case, this appears not only on topology, the same result ist when requesting nodes or other stuff. Is there some basic point, I'm missing ? Does anyone got the same issue. Working on ODL-helium. All the code is running in a self developed application, based on toaster example

Any help will be appreciated.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-08-05 13:26:13 -0700

Hello,

So I think your problem is that you aren't submitting anything to the store, so your topology isn't present (based on the code snippet).

You say it works using RestConf, but did you do a POST / PUT to create the topology in the Operational Store before sending a GET ?

In OVSDB southbound, the ovsdb:1 is initialized under "network-topology" on the Operational and Config tree, when the module is loaded. Here is the code.

Cheers

edit flag offensive delete publish link more

Comments

You are right, i didnt store anything and didnt do a POST / PUT before sending a GET request. What i basically did, is, connecting mininet to controller, do a pingall, so that all switches and host get "discovered". After a certain event which rises, after pingall, i request the nodes

luna ( 2015-08-06 13:57:52 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-07-29 04:22:57 -0700

Seen: 83 times

Last updated: Aug 05 '15