Ask Your Question
0

how to deserialize json of topology ?

asked 2015-06-16 02:29:24 -0700

hjdeore gravatar image

updated 2015-06-16 02:29:54 -0700

hi guys,

i am trying to deserialize json of topology using jackson which looks like

{ topology: [1] 0: { topology-id: "flow:1" link: [...6]- node: [...4]-

}-

}

but i am getting error

com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.mynetwork.topology.rev150525.mynetwork.topology.Topology, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information

can anybody have idea how to deserialize this json ?

edit retag flag offensive close merge delete

Comments

Did you get it to work? I have the same problem.

GeorgeC ( 2015-12-18 12:04:13 -0700 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-06-22 12:35:46 -0700

Hello,

The problem you are facing is that Topology is an abstract type. This happens when using yangtools with yang files. Are you trying to recreate a topology via a JSON txt file ? That might prove to be a difficult task and also, I'm pretty sure the data store has serialization / de-serialization included (ie reload topo after karaf restart). Just make sure not to delete the data folder.

edit flag offensive delete publish link more

Comments

Thanks for input. I have resolved this issue by creating classes to map with json. Yang creates interfaces & json needs a class to map data. Hence to resolve this we need to write classes manually.

hjdeore ( 2015-06-22 22:34:44 -0700 )edit

@grmontpetit : if there are parser then to map them in class for example. ObjectMapper mapper = new ObjectMapper(); TopologyImpl t1 = mapper.readValue(dataToDecoder, TopologyImpl.class); if you know then kindly tell for Network Topology present in controller

hjdeore ( 2015-06-24 06:53:06 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-06-16 02:29:24 -0700

Seen: 191 times

Last updated: Jun 22 '15