SDN Controller Programming Guide
167
When adding the “Switches” view to the framework in hm-switches.js, name it “hm-switches”
(Highlighted in the hm-switches.js listing), thus the associated properties file must have the same
name. Create the file hm-ui/src/main/resources/com/hp/hm/ui/lion/hm-switches.properties with
the content from the following hm-switches.properties listing. The prefix “key-“ was added to the
text keys to differentiate them from other strings used in the JavaScript code, however, follow the
naming conventions defined in GUI on page 52. Title and icon keys are reserved keys
automatically used by the framework to set the view’s title and icon. For more information see GUI
on page 52 for details about available icons and how define custom icons.
hm-switches.properties:
title = Open Flow Switches
icon = grid
key-button = Refresh Data
On the other hand, the properties file associated to hm-nav.js from the hm-nav.js listing needs a
special treatment: nav-lion.properties is a reserved name for properties files that contain text
associated to the navigation panel, and since hm-nav.js is adding content to it add the text in the
file hm-ui/src/main/resources/com/hp/hm/io/lion/nav-lion.properties. The following nav-
lion.properties listing shows the content of the nav-lion.properties file.
nav-lion.properties:
# Navigation category: Health Monitor
key-cat-hm = Health Monitor
key-nav-switches = Switches
Integrating Views to the SDN Controller GUI
In order to integrate views to the HP VAN SDN Controller an UI extension needs to be registered
so the framework hooks the views into the controller’s GUI. The SDN Controller SDK provides a
SelfRegisteringUIExtension class that can be used to subscribe the application’s views. The
following UIExtension.java listing illustrates the way of subscribing the user interface.
UIExtension.java:
package com.hp.hm.ui;
import org.apache.felix.scr.annotations.Component;
import com.hp.sdn.ui.misc.SelfRegisteringUIExtension;
@Component
public class UIExtension extends SelfRegisteringUIExtension {
public UIExtension() {
super("hm", "com/hp/hm/ui", UIExtension.class);
}
}
Some dependencies need to be added so SelfRegisteringUIExtension can be used; open the hm-
ui/pom.xml file and add the XML extract from the following UIExtension Module Dependencies
llisting to the <dependencies> node; after updating the POM file update the Eclipse project
dependencies (see Updating Project Dependencies on page 115).
UIExtension Module Dependencies: