Ask is moving to Stack Overflow and! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode


Application composition : Changing table-ID for L2 Switch.

asked 2017-10-05 13:25:56 -0700

updated 2017-10-06 04:44:57 -0700

Hello, I want to write an ACL application which defaults to the behavior of l2 switch. For this I need two tables - one with the l2switch rules and one with my filter rules. However, l2switch wants to put its flow rules in table 0. How can I instruct l2switch to put its flow rules in another table ID (say table 1) ? I see that there are config files I can put here


To change the switch behavior and table location.

See :

Is there a way for my application to access the config datastore at provider initiaialization to directly update it rather than deal with this config file.



edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-10-06 06:50:53 -0700

VincentJahjah gravatar image

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 NotificationProviderService notificationService;
private final SalFlowService salFlowService;
private final L2switchConfig mainConfig;

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

public void init() {
    // Setup FlowWrtierService
    FlowWriterServiceImpl flowWriterService = new FlowWriterServiceImpl(salFlowService);

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.

edit flag offensive delete publish link more


Even if I could set the table id importing l2switchconfig into the project will not work. Each bundle has its own classloader.

mranga ( 2017-10-06 12:57:00 -0700 )edit

Ah, yes. I assumed the classes would be visible, but they aren't declared in the blueprint...

VincentJahjah ( 2017-10-06 13:26:46 -0700 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-10-05 13:25:56 -0700

Seen: 119 times

Last updated: Oct 06 '17