# Revision history [back]

The pattern in l2switch appears to be the following: a provider class creates instances of flow-installing classes, and injects the configurations (e.g. the table id) via setters (e.g. setFlowTableId).

Take for instance l2switch-main:

private final DataBroker dataService;
private final SalFlowService salFlowService;
private final L2switchConfig mainConfig;

public L2SwitchMainProvider(final DataBroker dataBroker,
final SalFlowService salFlowService, final L2switchConfig config) {
this.dataService = dataBroker;
this.salFlowService = salFlowService;
this.mainConfig = config;
}

public void init() {
// Setup FlowWrtierService
FlowWriterServiceImpl flowWriterService = new FlowWriterServiceImpl(salFlowService);
flowWriterService.setFlowTableId(mainConfig.getReactiveFlowTableId());
flowWriterService.setFlowPriority(mainConfig.getReactiveFlowPriority());
flowWriterService.setFlowIdleTimeout(mainConfig.getReactiveFlowIdleTimeout());
flowWriterService.setFlowHardTimeout(mainConfig.getReactiveFlowHardTimeout());
...


And elsewhere, you have :

public void setFlowTableId(short flowTableId) {
this.flowTableId = flowTableId;
}


The configs are injected on init() of l2switch. Even if you imported L2SwitchConfig in your project, it appears that config objects don't have setters, so that's definitely not an option. And even if you somehow modified the configs from your application, you would likely have to reboot the concerned l2switch plugins (I don't know how to trigger a reboot via application).

Use YangMan

YangMan contains a user-friendly interface that allows you to modify the configs of plugins installed in ODL. This should be your go-to for now. It should show up in your DLUX menu if you've installed it. I don't know exactly in which ODL bundle Yangman exists, but after installing the following, it shows up for me (I suspect it's odl-dluxapps-yangutils):

feature:install odl-dlux-core odl-dluxapps-applications odl-dluxapps-yangutils


If you REALLY want to do this via application...

A viable hack would be to inject all the flow-installing projects in your blueprint, and then use the "setFlowTableId" to set the tableId, without having to reboot ODL. I think this is pretty tedious, but I believe it should work. It won't work if l2switch begins installing rules before your plugins have the time to change the tableId, but I doubt this would happen.