From: miroslav.kovac Date: Wed, 12 Oct 2016 14:22:30 +0000 (+0200) Subject: Bug 6382 - add apidoc for latest restconf draft X-Git-Tag: release/carbon~139^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=fb0eb1f8bebfaaefbeb065b29bcca566b75a803d;p=netconf.git Bug 6382 - add apidoc for latest restconf draft Create a swagger api explorer for latest ietf-netconf-restconf draft Change-Id: Id397bbfdb435b8d8f0474657e6a7557e9b1eb838 Signed-off-by: miroslav.kovac --- diff --git a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/ApiDocGenerator.java b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/ApiDocGenerator.java index f78d61951e..1f4b3b52c0 100644 --- a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/ApiDocGenerator.java +++ b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/ApiDocGenerator.java @@ -43,6 +43,10 @@ public class ApiDocGenerator extends BaseYangSwaggerGenerator { return INSTANCE; } + public void setDraft(final boolean newDraft) { + super.setDraft(newDraft); + } + public void setSchemaService(final SchemaService schemaService) { this.schemaService = schemaService; } diff --git a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/ApiDocServiceImpl.java b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/ApiDocServiceImpl.java index 026296baba..db88458008 100644 --- a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/ApiDocServiceImpl.java +++ b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/ApiDocServiceImpl.java @@ -47,6 +47,11 @@ public class ApiDocServiceImpl implements ApiDocService { @Override public synchronized Response getRootDoc(final UriInfo uriInfo) { final ApiDocGenerator generator = ApiDocGenerator.getInstance(); + if (isNew(uriInfo)) { + generator.setDraft(true); + } else { + generator.setDraft(false); + } final ResourceList rootDoc = generator.getResourceListing(uriInfo); return Response.ok(rootDoc).build(); @@ -58,7 +63,11 @@ public class ApiDocServiceImpl implements ApiDocService { @Override public synchronized Response getDocByModule(final String module, final String revision, final UriInfo uriInfo) { final ApiDocGenerator generator = ApiDocGenerator.getInstance(); - + if (isNew(uriInfo)) { + generator.setDraft(true); + } else { + generator.setDraft(false); + } final ApiDeclaration doc = generator.getApiDeclaration(module, revision, uriInfo); return Response.ok(doc).build(); } @@ -95,17 +104,32 @@ public class ApiDocServiceImpl implements ApiDocService { @Override public synchronized Response getMountRootDoc(final String instanceNum, final UriInfo uriInfo) { - final ResourceList resourceList = MountPointSwagger.getInstance().getResourceList(uriInfo, - Long.parseLong(instanceNum)); + final ResourceList resourceList; + if (isNew(uriInfo)) { + resourceList = MountPointSwagger.getInstanceDraft17().getResourceList(uriInfo, + Long.parseLong(instanceNum)); + } else { + resourceList = MountPointSwagger.getInstance().getResourceList(uriInfo, + Long.parseLong(instanceNum)); + } return Response.ok(resourceList).build(); } @Override public synchronized Response getMountDocByModule(final String instanceNum, final String module, final String revision, final UriInfo uriInfo) { - final ApiDeclaration api = MountPointSwagger.getInstance().getMountPointApi(uriInfo, - Long.parseLong(instanceNum), module, revision); + final ApiDeclaration api; + if (isNew(uriInfo)) { + api = MountPointSwagger.getInstanceDraft17().getMountPointApi(uriInfo, + Long.parseLong(instanceNum), module, revision); + } else { + api = MountPointSwagger.getInstance().getMountPointApi(uriInfo, + Long.parseLong(instanceNum), module, revision); + } return Response.ok(api).build(); } + private static boolean isNew(final UriInfo uriInfo) { + return uriInfo.getBaseUri().toString().contains("/17/"); + } } diff --git a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/BaseYangSwaggerGenerator.java b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/BaseYangSwaggerGenerator.java index abf560ea78..453a9d2da4 100644 --- a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/BaseYangSwaggerGenerator.java +++ b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/impl/BaseYangSwaggerGenerator.java @@ -62,6 +62,7 @@ public class BaseYangSwaggerGenerator { protected static final String API_VERSION = "1.0.0"; protected static final String SWAGGER_VERSION = "1.2"; protected static final String RESTCONF_CONTEXT_ROOT = "restconf"; + private static final String RESTCONF_DRAFT = "17"; static final String MODULE_NAME_SUFFIX = "_module"; protected static final DateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); @@ -69,6 +70,7 @@ public class BaseYangSwaggerGenerator { // private Map MODULE_DOC_CACHE = new HashMap<>() private final ObjectMapper mapper = new ObjectMapper(); + private static boolean newDraft; protected BaseYangSwaggerGenerator() { mapper.registerModule(new JsonOrgModule()); @@ -189,7 +191,7 @@ public class BaseYangSwaggerGenerator { * are added for this node. */ if (node.isConfiguration()) { // This node's config statement is true. - resourcePath = getDataStorePath("/config/", context); + resourcePath = getDataStorePath("config", context); /* * When there are two or more top container or list nodes whose config statement is true in module, @@ -197,22 +199,25 @@ public class BaseYangSwaggerGenerator { */ if (!hasAddRootPostLink) { LOG.debug("Has added root post link for module {}", m.getName()); - addRootPostLink(m, (DataNodeContainer) node, pathParams, resourcePath, apis); + addRootPostLink(m, (DataNodeContainer) node, pathParams, resourcePath, "config", apis); + hasAddRootPostLink = true; } - addApis(node, apis, resourcePath, pathParams, schemaContext, true, m.getName()); + addApis(node, apis, resourcePath, pathParams, schemaContext, true, m.getName(), "config"); } - pathParams = new ArrayList<>(); - resourcePath = getDataStorePath("/operational/", context); - addApis(node, apis, resourcePath, pathParams, schemaContext, false, m.getName()); + resourcePath = getDataStorePath("operational", context); + + addApis(node, apis, resourcePath, pathParams, schemaContext, false, m.getName(), "operational"); } } final Set rpcs = m.getRpcs(); for (final RpcDefinition rpcDefinition : rpcs) { - final String resourcePath = getDataStorePath("/operations/", context); + final String resourcePath; + resourcePath = getDataStorePath("operations", context); + addRpcs(rpcDefinition, apis, resourcePath, schemaContext); } @@ -238,10 +243,10 @@ public class BaseYangSwaggerGenerator { } private void addRootPostLink(final Module module, final DataNodeContainer node, final List pathParams, - final String resourcePath, final List apis) { + final String resourcePath, final String dataStore, final List apis) { if (containsListOrContainer(module.getChildNodes())) { final Api apiForRootPostUri = new Api(); - apiForRootPostUri.setPath(resourcePath); + apiForRootPostUri.setPath(resourcePath.concat(getContent(dataStore))); apiForRootPostUri.setOperations(operationPost(module.getName() + MODULE_NAME_SUFFIX, module.getDescription(), module, pathParams, true, "")); apis.add(apiForRootPostUri); @@ -258,22 +263,29 @@ public class BaseYangSwaggerGenerator { } protected String getDataStorePath(final String dataStore, final String context) { - return dataStore + context; + if (newDraft) { + if ("config".contains(dataStore) || "operational".contains(dataStore)) { + return "/" + RESTCONF_DRAFT + "/data" + context; + } else { + return "/" + RESTCONF_DRAFT + "/operations" + context; + } + } else { + return "/" + dataStore + context; + } } private String generateCacheKey(final String module, final String revision) { return module + "(" + revision + ")"; } - private void addApis(final DataSchemaNode node, final List apis, final String parentPath, final List parentPathParams, final SchemaContext schemaContext, - final boolean addConfigApi, final String parentName) { - + private void addApis(final DataSchemaNode node, final List apis, final String parentPath, final List parentPathParams, + final SchemaContext schemaContext, final boolean addConfigApi, final String parentName, final String dataStore) { final Api api = new Api(); final List pathParams = new ArrayList<>(parentPathParams); - final String resourcePath = parentPath + createPath(node, pathParams, schemaContext) + "/"; + final String resourcePath = parentPath + "/" + createPath(node, pathParams, schemaContext); LOG.debug("Adding path: [{}]", resourcePath); - api.setPath(resourcePath); + api.setPath(resourcePath.concat(getContent(dataStore))); Iterable childSchemaNodes = Collections.emptySet(); if ((node instanceof ListSchemaNode) || (node instanceof ContainerSchemaNode)) { @@ -288,12 +300,25 @@ public class BaseYangSwaggerGenerator { // keep config and operation attributes separate. if (childNode.isConfiguration() == addConfigApi) { final String newParent = parentName + "/" + node.getQName().getLocalName(); - addApis(childNode, apis, resourcePath, pathParams, schemaContext, addConfigApi, newParent); + addApis(childNode, apis, resourcePath, pathParams, schemaContext, addConfigApi, newParent, dataStore); } } } } + protected static String getContent(final String dataStore) { + if (newDraft) { + if ("operational".contains(dataStore)) { + return "?content=nonconfig"; + } else if ("config".contains(dataStore)) { + return "?content=config"; + } else { + return ""; + } + } else { + return ""; + } + } private boolean containsListOrContainer(final Iterable nodes) { for (final DataSchemaNode child : nodes) { if (child instanceof ListSchemaNode || child instanceof ContainerSchemaNode) { @@ -343,12 +368,21 @@ public class BaseYangSwaggerGenerator { if ((schemaNode instanceof ListSchemaNode)) { final List listKeys = ((ListSchemaNode) schemaNode).getKeyDefinition(); + StringBuilder keyBuilder = null; + if (newDraft) { + keyBuilder = new StringBuilder("="); + } + for (final QName listKey : listKeys) { final DataSchemaNode dataChildByName = ((DataNodeContainer) schemaNode).getDataChildByName(listKey); pathListParams.add(((LeafSchemaNode) dataChildByName)); - - final String pathParamIdentifier = new StringBuilder("/{").append(listKey.getLocalName()).append("}") - .toString(); + final String pathParamIdentifier; + if (newDraft) { + pathParamIdentifier = keyBuilder.append("{").append(listKey.getLocalName()).append("}") + .toString(); + } else { + pathParamIdentifier = "/{" + listKey.getLocalName() + "}"; + } path.append(pathParamIdentifier); final Parameter pathParam = new Parameter(); @@ -358,6 +392,9 @@ public class BaseYangSwaggerGenerator { pathParam.setParamType("path"); pathParams.add(pathParam); + if (newDraft) { + keyBuilder = new StringBuilder(","); + } } } return path.toString(); @@ -365,7 +402,7 @@ public class BaseYangSwaggerGenerator { protected void addRpcs(final RpcDefinition rpcDefn, final List apis, final String parentPath, final SchemaContext schemaContext) { final Api rpc = new Api(); - final String resourcePath = parentPath + resolvePathArgumentsName(rpcDefn, schemaContext); + final String resourcePath = parentPath + "/" + resolvePathArgumentsName(rpcDefn, schemaContext); rpc.setPath(resourcePath); final Operation operationSpec = new Operation(); @@ -415,4 +452,7 @@ public class BaseYangSwaggerGenerator { return sortedModules; } + public void setDraft(final boolean draft) { + this.newDraft = draft; + } } diff --git a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/mountpoints/MountPointSwagger.java b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/mountpoints/MountPointSwagger.java index 98268495b8..11a4db0cf4 100644 --- a/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/mountpoints/MountPointSwagger.java +++ b/restconf/sal-rest-docgen/src/main/java/org/opendaylight/netconf/sal/rest/doc/mountpoints/MountPointSwagger.java @@ -39,6 +39,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount private static final String DATASTORES_REVISION = "-"; private static final String DATASTORES_LABEL = "Datastores"; + private static final String RESTCONF_DRAFT = "17"; private DOMMountPointService mountService; private final Map instanceIdToLongId = new TreeMap<>( @@ -50,7 +51,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount private static final AtomicReference selfRef = new AtomicReference<>(); private SchemaService globalSchema; - + private static boolean newDraft; public Map getInstanceIdentifiers() { final Map urlToId = new HashMap<>(); synchronized (lock) { @@ -80,20 +81,29 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount private String generateUrlPrefixFromInstanceID(final YangInstanceIdentifier key, final String moduleName) { final StringBuilder builder = new StringBuilder(); + builder.append("/"); if (moduleName != null) { - builder.append(moduleName); - builder.append(':'); + builder.append(moduleName) + .append(':'); } for (final PathArgument arg : key.getPathArguments()) { final String name = arg.getNodeType().getLocalName(); if (arg instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) { final NodeIdentifierWithPredicates nodeId = (NodeIdentifierWithPredicates) arg; for (final Entry entry : nodeId.getKeyValues().entrySet()) { - builder.append(entry.getValue()).append('/'); + if (newDraft) { + builder.deleteCharAt(builder.length() - 1) + .append("=") + .append(entry.getValue()) + .append('/'); + } else { + builder.append(entry.getValue()) + .append('/'); + } } } else { - builder.append(name); - builder.append('/'); + builder.append(name) + .append('/'); } } return builder.toString(); @@ -101,7 +111,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount private String getYangMountUrl(final YangInstanceIdentifier key) { final String modName = findModuleName(key, globalSchema.getGlobalContext()); - return generateUrlPrefixFromInstanceID(key, modName) + "yang-ext:mount/"; + return generateUrlPrefixFromInstanceID(key, modName) + "yang-ext:mount"; } public ResourceList getResourceList(final UriInfo uriInfo, final Long id) { @@ -187,7 +197,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount getConfig.setNotes(note); final Api api = new Api(); - api.setPath(getDataStorePath("/" + datastore + "/", context)); + api.setPath(getDataStorePath(datastore, context).concat(getContent(datastore))); api.setOperations(Collections.singletonList(getConfig)); return api; @@ -220,7 +230,17 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount selfRef.compareAndSet(null, new MountPointSwagger()); swagger = selfRef.get(); } + newDraft = false; return swagger; } + public static MountPointSwagger getInstanceDraft17() { + MountPointSwagger swagger = selfRef.get(); + if (swagger == null) { + selfRef.compareAndSet(null, new MountPointSwagger()); + swagger = selfRef.get(); + } + newDraft = true; + return swagger; + } } diff --git a/restconf/sal-rest-docgen/src/main/resources/17/explorer/index.html b/restconf/sal-rest-docgen/src/main/resources/17/explorer/index.html new file mode 100644 index 0000000000..d5126dd664 --- /dev/null +++ b/restconf/sal-rest-docgen/src/main/resources/17/explorer/index.html @@ -0,0 +1,127 @@ + + + + + + RestConf Documentation + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +

OpenDaylight RestConf API + Documentation

+
+
+ + + + +
+ + +
+
+

Below are the list of APIs supported by the Controller.

+
+
+
+
+

Mount Points - Select an API below for details on available + queries.

+
+
+
+
+ +
+
+
+ + +
+ + +
+ +
 
+ + + diff --git a/restconf/sal-rest-docgen/src/main/resources/17/explorer/lib/odl/list_mounts.js b/restconf/sal-rest-docgen/src/main/resources/17/explorer/lib/odl/list_mounts.js new file mode 100644 index 0000000000..b9b4c624be --- /dev/null +++ b/restconf/sal-rest-docgen/src/main/resources/17/explorer/lib/odl/list_mounts.js @@ -0,0 +1,22 @@ +//constructs a table of mount points via a json response +//Loads the table into the given dom. +var loadMountList = function( dom ) { + dom.empty(); + dom.append( "

Loading. Please wait...

" ); + $.ajax( { + url: "/apidoc/17/apis/mounts", + datatype: 'jsonp', + success: function( strData ){ + var myData = strData; + var list = $( "
" ); + for( var key in myData ) + { + list.append( "" + + myData[key].instance + ""); + } + dom.empty(); + dom.append( list ); + } + } ); +} \ No newline at end of file diff --git a/restconf/sal-rest-docgen/src/main/resources/17/explorer/static/index.html b/restconf/sal-rest-docgen/src/main/resources/17/explorer/static/index.html new file mode 100644 index 0000000000..4fb8f2272f --- /dev/null +++ b/restconf/sal-rest-docgen/src/main/resources/17/explorer/static/index.html @@ -0,0 +1,117 @@ + + + + + + RestConf Documentation + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +

OpenDaylight RestConf API + Documentation

+
+
+ + + + +
+ + +
+
+

Below are the list of APIs supported by the Controller.

+
+
+
+ +

+ + +
+ + +
+ +
 
+ + + diff --git a/restconf/sal-rest-docgen/src/main/resources/README.txt b/restconf/sal-rest-docgen/src/main/resources/README.txt index 7e72e8347c..0c279a57ac 100644 --- a/restconf/sal-rest-docgen/src/main/resources/README.txt +++ b/restconf/sal-rest-docgen/src/main/resources/README.txt @@ -3,6 +3,7 @@ This component offers Swagger documentation of the RestConf APIs. This Swagger documentation can be accessed in two ways: I. Running server Open a browser and go to http://:8181/apidoc/explorer/index.html +For new restconf draft go to http://:8181/apidoc/17/explorer/index.html II. Static documentation generation By adding a reference to the StaticDocGenerator class in any pom.xml, diff --git a/restconf/sal-rest-docgen/src/main/resources/WEB-INF/web.xml b/restconf/sal-rest-docgen/src/main/resources/WEB-INF/web.xml index cd26769630..849e2c90e3 100644 --- a/restconf/sal-rest-docgen/src/main/resources/WEB-INF/web.xml +++ b/restconf/sal-rest-docgen/src/main/resources/WEB-INF/web.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> index.html @@ -16,8 +16,8 @@ - shiroEnvironmentClass - org.opendaylight.aaa.shiro.web.env.KarafIniWebEnvironment + shiroEnvironmentClass + org.opendaylight.aaa.shiro.web.env.KarafIniWebEnvironment @@ -39,6 +39,11 @@ /apis/* + + JAXRSApiDoc + /17/apis/* + + cross-origin-api-doc org.eclipse.jetty.servlets.CrossOriginFilter @@ -59,13 +64,16 @@ cross-origin-api-doc /apis/* - + + cross-origin-api-doc + /17/apis/* + - - API Doc - /* - + + API Doc + /* + diff --git a/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ApiDocGeneratorTest.java b/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ApiDocGeneratorTest.java index f744da7906..ee1b1eea05 100644 --- a/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ApiDocGeneratorTest.java +++ b/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/ApiDocGeneratorTest.java @@ -52,6 +52,7 @@ public class ApiDocGeneratorTest { @Before public void setUp() throws Exception { this.generator = new ApiDocGenerator(); + generator.setDraft(false); this.helper = new DocGenTestHelper(); this.helper.setUp(); @@ -88,21 +89,21 @@ public class ApiDocGeneratorTest { */ private void validateSwaggerApisForPost(final ApiDeclaration doc) { // two POST URI with concrete schema name in summary - final Api lstApi = findApi("/config/toaster2:lst/", doc); - assertNotNull("Api /config/toaster2:lst/ wasn't found", lstApi); + final Api lstApi = findApi("/config/toaster2:lst", doc); + assertNotNull("Api /config/toaster2:lst wasn't found", lstApi); assertTrue("POST for cont1 in lst is missing", findOperation(lstApi.getOperations(), "POST", "(config)lstPOST", "toaster2/lst(config)lst1-TOP", "toaster2/lst(config)cont1-TOP")); - final Api cont1Api = findApi("/config/toaster2:lst/cont1/", doc); - assertNotNull("Api /config/toaster2:lst/cont1/ wasn't found", cont1Api); + final Api cont1Api = findApi("/config/toaster2:lst/cont1", doc); + assertNotNull("Api /config/toaster2:lst/cont1 wasn't found", cont1Api); assertTrue("POST for cont11 in cont1 is missing", findOperation(cont1Api.getOperations(), "POST", "(config)cont1POST", "toaster2/lst/cont1(config)cont11-TOP", "toaster2/lst/cont1(config)lst11-TOP")); // no POST URI - final Api cont11Api = findApi("/config/toaster2:lst/cont1/cont11/", doc); - assertNotNull("Api /config/toaster2:lst/cont1/cont11/ wasn't found", cont11Api); + final Api cont11Api = findApi("/config/toaster2:lst/cont1/cont11", doc); + assertNotNull("Api /config/toaster2:lst/cont1/cont11 wasn't found", cont11Api); assertTrue("POST operation shouldn't be present.", findOperations(cont11Api.getOperations(), "POST").isEmpty()); } @@ -284,10 +285,10 @@ public class ApiDocGeneratorTest { * @throws Exception */ private void validateToaster(final ApiDeclaration doc) throws Exception { - final Set expectedUrls = new TreeSet<>(Arrays.asList(new String[] { "/config/toaster2:toaster/", - "/operational/toaster2:toaster/", "/operations/toaster2:cancel-toast", + final Set expectedUrls = new TreeSet<>(Arrays.asList(new String[]{"/config/toaster2:toaster", + "/operational/toaster2:toaster", "/operations/toaster2:cancel-toast", "/operations/toaster2:make-toast", "/operations/toaster2:restock-toaster", - "/config/toaster2:toaster/toasterSlot/{slotId}/toaster-augmented:slotInfo/" })); + "/config/toaster2:toaster/toasterSlot/{slotId}/toaster-augmented:slotInfo"})); final Set actualUrls = new TreeSet<>(); diff --git a/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/MountPointSwaggerTest.java b/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/MountPointSwaggerTest.java index 6342d1a780..b040645774 100644 --- a/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/MountPointSwaggerTest.java +++ b/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/MountPointSwaggerTest.java @@ -41,7 +41,7 @@ public class MountPointSwaggerTest { .node(QName.create("nodes")) .node(QName.create("node")) .nodeWithKey(QName.create("node"), QName.create("id"), "123").build(); - private static final String INSTANCE_URL = "nodes/node/123/"; + private static final String INSTANCE_URL = "/nodes/node/123/"; private MountPointSwagger swagger; private DocGenTestHelper helper; private SchemaContext schemaContext; @@ -99,6 +99,7 @@ public class MountPointSwaggerTest { final UriInfo mockInfo = setUpSwaggerForDocGeneration(); this.swagger.onMountPointCreated(instanceId); // add this ID into the list of // mount points + final ApiDeclaration mountPointApi = this.swagger.getMountPointApi(mockInfo, 1L, "Datastores", "-"); assertNotNull("failed to find Datastore API", mountPointApi); final List apis = mountPointApi.getApis(); @@ -115,9 +116,9 @@ public class MountPointSwaggerTest { .getNotes()); } final Set expectedApis = new TreeSet<>(Arrays.asList(new String[] { - "/config/" + INSTANCE_URL + "yang-ext:mount/", - "/operational/" + INSTANCE_URL + "yang-ext:mount/", - "/operations/" + INSTANCE_URL + "yang-ext:mount/", })); + "/config" + INSTANCE_URL + "yang-ext:mount", + "/operational" + INSTANCE_URL + "yang-ext:mount", + "/operations" + INSTANCE_URL + "yang-ext:mount",})); assertEquals(expectedApis, actualApis); }