Ask Your Question
0

How do I programatically load new switches into ODL so they are visible in the console

asked 2014-11-11 13:07:19 -0700

scurtis gravatar image

I'm trying to programatically create switches in a custom plugin that loads some set inventory so it is visible in the ODL console. The code doing the work makes use of the switch manager service as follows:

try {
    Node node = new Node(Node.NodeIDType.OPENFLOW, Long.valueOf(1L));
    Switch newSwitch = new Switch(node);
    switchManager.getNetworkDevices().add(newSwitch);
} catch (ConstructionException e) {
    e.printStackTrace();
}

I don't get any exceptions thrown but I also don't get any switches visible. When I print the contents of the devices out after the fact the new switch does not appear in the list.

Is this the correct way to do something like this or am I bypassing some internal caching somewhere.

When I get this working I'd also like to programatically create host devices as well.

Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-06-25 19:35:23 -0700

jeffcavalcante gravatar image

updated 2015-06-25 19:37:42 -0700

You have to save them on the network-topology container of ODL's database.

Create an InstanceIdentifier to the network-topology/topology, then create a WriteOnly transaction and save the Node object you've created.

Hope I've helped.

edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
2 followers

Stats

Asked: 2014-11-11 13:07:19 -0700

Seen: 67 times

Last updated: Jun 25 '15