[CONTROLLER-437] RESTConf API Explorer: URL for Toaster is not correct Created: 30/Apr/14  Updated: 14/Nov/17  Due: 22/Aug/14  Resolved: 20/Aug/14

Status: Resolved
Project: controller
Component/s: restconf
Affects Version/s: Helium
Fix Version/s: None

Type: Bug
Reporter: Abhishek Kumar Assignee: Jozef Gloncak
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Mac OS
Platform: PC


Issue Links:
Blocks
blocks CONTROLLER-288 Milestone: Runtime generation of REST... Resolved
External issue ID: 932
Priority: High

 Description   

Devin Avery's comments:
I noticed the POST to config isn't defined correctly. For example, I can't post to /config/toaster:toaster. You can only put to toaster:toaster ( at least in this example). So there is probably some more logic required here make sure we have the correct arguments that can be posted.



 Comments   
Comment by Devin Avery [ 29/May/14 ]

Moving to restconf component.

Comment by Jozef Gloncak [ 16/Jul/14 ]

I am referring to chapters of http://tools.ietf.org/html/draft-bierman-netconf-restconf-02#section-1.4.2
After investigation PUTting and POST-ing works like this:

PUT (chapter 1.4.2.2)

  • URI - /restconf/config/uri1/uri2/.../uriN
  • data - <uriN>....</uriN>

POST (chapter 1.4.2.3)

  • URI - /restconf/config/uri1/uri2/.../uriN
  • data - <uriN+1>....</uriN+1>

Additionally (chapter 5.3), second sentence: "Only YANG container and list data node
types are considered to represent data resources."

Toaster (container) contains only elements of type (leaf) so therefore it isn't posible to
POST data on uri /restconf/config/toaster:toaster

At localhost:8080/apidoc/explorer/#!/toaster(2009-11-20) (running controller on localhost:8080) there is for
POST /config/toaster:toaster and for PUT /config/toaster:toaster the same model:
(config)toaster {
darknessFactor (integer, optional): The darkness factor. Basically, the number of ms to multiple the doneness value by.
}
which can be used only for PUT operation. POST operation for this URI is impossible.

Currently I am trying to:

  • remove POST uris for YANG elements which don't contain lists and containers (POST operation is impossible)
  • create several POST uris for YANG elements which contain several lists and containers.
Comment by Jozef Gloncak [ 16/Jul/14 ]

patch set proposed
https://git.opendaylight.org/gerrit/#/c/9068/

patch was commited as draft because unit tests are missing

Comment by Jozef Gloncak [ 21/Jul/14 ]

patch set proposed (with tests)
https://git.opendaylight.org/gerrit/#/c/9068/

Comment by Jozef Gloncak [ 31/Jul/14 ]

patch set 3 (rebased)
https://git.opendaylight.org/gerrit/#/c/9068/

Comment by Jozef Gloncak [ 14/Aug/14 ]

From e-mail communication with Devin following it was identified that current proposal contains partial fix of reported problem + change of documentation design.

Change of documentation design (more POST URI links - standalone for every subcontainer and sublist) should be tracked as standalone bug and shouldn't be part of this patch.

what should be in corrected:

  • remove from POST links those models which aren't lists and containers and which doesn't exist as subchild (e.g for POST /config/toaster:toaster there is toaster which isn't child)
  • add generating of POST link also for top level (e.g /config which contains as subchild toaster {} container)
Comment by Jozef Gloncak [ 19/Aug/14 ]

POST URI is now generated also for "/config"
POST URI after "unwrapping" for URI "/config/el" contains specific JSON with list or container children:
(config)elPOST {
listOrContainer1,
listOrContainer2,
...
listOrContainerN,
}

All of these list or container children are concretely specified below *POST JSON object.

In parameter section of unwrapped POST there is generated input box with ** prefix for all of list or container children. It means that only one of this boxes should be filled (specified)

patch set
https://git.opendaylight.org/gerrit/#/c/9068/

Comment by Jozef Gloncak [ 20/Aug/14 ]

bug was identified when POST URI link for whole model was generated (not module but its child was evaluated whether it contains any list or container therefore in toaster for URI /config there was no POST).

It was also distinguished between module "toaster" (toaster_module) and container "toaster" because container toaster overwritten JSON module data for swagger.

Question for the future:
what happen if name of the parent element is equal to child element. currently are swagger JSON modules created only from localName which isn't sufficient. Some quick solution (but not in this bug ) could be use whole path of local names from root to element, which should be almost suficient (except cases when element with equal name was added via augmentation (local names are equal but namespaces are different))

Generated at Wed Feb 07 19:53:00 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.