Skip to content

Commit

Permalink
Create a workaround for NETCONF-1218
Browse files Browse the repository at this point in the history
Because base path is hard-coded in ODL, we need to make this application
use /rests base.

This commit should be reverted after NETCONF-1218 is resolved and implemented.

Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
  • Loading branch information
Tobianas committed Jan 29, 2024
1 parent c4466fd commit 9f4954f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ private void startLighty(final ControllerConfiguration controllerConfiguration,
throws ConfigurationException, ExecutionException, InterruptedException, TimeoutException,
ModuleStartupException {

//FIXME remove this after paths NETCONF-1218 is resolved.
restconfConfiguration.setRestconfServletContextPath("/rests");
restconfConfiguration.setHttpPort(8181);

//1. initialize and start Lighty controller (MD-SAL, Controller, YangTools, Akka)
LightyControllerBuilder lightyControllerBuilder = new LightyControllerBuilder();
this.lightyController = lightyControllerBuilder.from(controllerConfiguration).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class RestconfAppTest {
public static void init() {
restconfApp = new Main();
restconfApp.start();
restClient = new RestClient("http://localhost:8888/");
restClient = new RestClient("http://localhost:8181/");
}

/**
Expand All @@ -46,7 +46,7 @@ public static void init() {
@Test
public void simpleApplicationTest() throws IOException, InterruptedException {
HttpResponse<String> operations;
restClient.POST("restconf/data/network-topology:network-topology/topology=topology-netconf",
restClient.POST("rests/data/network-topology:network-topology/topology=topology-netconf",
"""
{
"netconf-topology:node": [
Expand All @@ -56,11 +56,11 @@ public void simpleApplicationTest() throws IOException, InterruptedException {
]
}""");

operations = restClient.GET("restconf/operations");
operations = restClient.GET("rests/operations");
Assert.assertEquals(operations.statusCode(), 200);
operations = restClient.GET("restconf/data/network-topology:network-topology?content=config");
operations = restClient.GET("rests/data/network-topology:network-topology?content=config");
Assert.assertEquals(operations.statusCode(), 200);
operations = restClient.GET("restconf/data/network-topology:network-topology?content=nonconfig");
operations = restClient.GET("rests/data/network-topology:network-topology?content=nonconfig");
Assert.assertEquals(operations.statusCode(), 200);
}

Expand Down

0 comments on commit 9f4954f

Please sign in to comment.