openbaton / docs

documentation for OpenBaton
7 stars 5 forks source link

How to register to NFVO Events #8

Closed trantub closed 7 years ago

trantub commented 7 years ago

Replace the receiveEvent function with the following:

@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public void receiveEvent(@RequestBody String msg){ System.out.println("Received Event from NFVO: " + msg.substring(0,30) + "...") ; JsonParser jsonParser = new JsonParser(); JsonObject json = jsonParser.parse(msg).getAsJsonObject(); Gson mapper = new GsonBuilder().create(); Action action = mapper.fromJson(json.get("action"), Action.class); System.out.println("ACTION=" + action); NetworkServiceRecord nsr = mapper.fromJson(json.get("payload"), NetworkServiceRecord.class); System.out.println("NSR=" + nsr.getName()); /**

ranzpirat commented 7 years ago

Thanks for the find! I did a small commit and opened a pull request which fixes this. See openbaton/docs#10

marcellom commented 7 years ago

As @ranzpirat said, this problem has been fixed in the develop branch, which will be merged into master in the next release. This pull request can be closed.