Skip to content
Snippets Groups Projects
Commit 6e66dae6 authored by Lalith Suresh's avatar Lalith Suresh
Browse files

Fix restPort hard coding

parent 2bd9894d
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ public class Main { ...@@ -36,7 +36,7 @@ public class Main {
FloodlightModuleLoader fml = new FloodlightModuleLoader(); FloodlightModuleLoader fml = new FloodlightModuleLoader();
IFloodlightModuleContext moduleContext = fml.loadModulesFromConfig(settings.getModuleFile()); IFloodlightModuleContext moduleContext = fml.loadModulesFromConfig(settings.getModuleFile());
IRestApiService restApi = moduleContext.getServiceImpl(IRestApiService.class); IRestApiService restApi = moduleContext.getServiceImpl(IRestApiService.class);
restApi.run(); restApi.run(settings.getRestPort());
IFloodlightProviderService controller = IFloodlightProviderService controller =
moduleContext.getServiceImpl(IFloodlightProviderService.class); moduleContext.getServiceImpl(IFloodlightProviderService.class);
controller.setCmdLineOptions(settings); controller.setCmdLineOptions(settings);
......
...@@ -12,5 +12,5 @@ public interface IRestApiService extends IFloodlightService { ...@@ -12,5 +12,5 @@ public interface IRestApiService extends IFloodlightService {
/** /**
* Runs the REST API server * Runs the REST API server
*/ */
public void run(); public void run(int restPort);
} }
...@@ -30,7 +30,6 @@ public class RestApiServer ...@@ -30,7 +30,6 @@ public class RestApiServer
implements IFloodlightModule, IRestApiService { implements IFloodlightModule, IRestApiService {
protected static Logger logger = LoggerFactory.getLogger(RestApiServer.class); protected static Logger logger = LoggerFactory.getLogger(RestApiServer.class);
protected List<RestletRoutable> restlets; protected List<RestletRoutable> restlets;
protected int restPort = 8080;
protected FloodlightModuleContext fmlContext; protected FloodlightModuleContext fmlContext;
// *********** // ***********
...@@ -72,7 +71,7 @@ public class RestApiServer ...@@ -72,7 +71,7 @@ public class RestApiServer
return slashFilter; return slashFilter;
} }
public void run(FloodlightModuleContext fmlContext) { public void run(FloodlightModuleContext fmlContext, int restPort) {
// Add everything in the module context to the rest // Add everything in the module context to the rest
for (Class<? extends IFloodlightService> s : fmlContext.getAllServices()) { for (Class<? extends IFloodlightService> s : fmlContext.getAllServices()) {
context.getAttributes().put(s.getCanonicalName(), context.getAttributes().put(s.getCanonicalName(),
...@@ -108,9 +107,9 @@ public class RestApiServer ...@@ -108,9 +107,9 @@ public class RestApiServer
} }
@Override @Override
public void run() { public void run(int restPort) {
RestApplication restApp = new RestApplication(); RestApplication restApp = new RestApplication();
restApp.run(fmlContext); restApp.run(fmlContext, restPort);
} }
// ***************** // *****************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment