use of org.onosproject.ui.lion.LionBundle in project onos by opennetworkinglab.
the class UiExtensionManager method createCoreExtension.
private UiExtension createCoreExtension() {
List<LionBundle> lionBundles = generateBundles(LION_BASE, LION_TAGS);
navLion = lionBundles.stream().filter(f -> f.id().equals("core.fw.Nav")).findFirst().get();
List<UiView> coreViews = of(mkView(PLATFORM, "app", "nav_apps"), mkView(PLATFORM, "settings", "nav_settings"), mkView(PLATFORM, "cluster", "nav_cluster"), mkView(PLATFORM, "processor", "nav_processors"), mkView(PLATFORM, "partition", "nav_partitions"), mkView(NETWORK, "topo", "nav_topo"), // mkView(NETWORK, "topo2", "nav_topo2"),
mkView(NETWORK, "device", "nav_devs"), new UiViewHidden("flow"), new UiViewHidden("port"), new UiViewHidden("group"), new UiViewHidden("meter"), new UiViewHidden("pipeconf"), mkView(NETWORK, "link", "nav_links"), mkView(NETWORK, "host", "nav_hosts"), mkView(NETWORK, "intent", "nav_intents"));
UiMessageHandlerFactory messageHandlerFactory = () -> ImmutableList.of(new UserPreferencesMessageHandler(), new TopologyViewMessageHandler(), new Topo2ViewMessageHandler(), new Topo2TrafficMessageHandler(), new MapSelectorMessageHandler(), new DeviceViewMessageHandler(), new LinkViewMessageHandler(), new HostViewMessageHandler(), new FlowViewMessageHandler(), new PortViewMessageHandler(), new GroupViewMessageHandler(), new MeterViewMessageHandler(), new IntentViewMessageHandler(), new ApplicationViewMessageHandler(), new SettingsViewMessageHandler(), new ClusterViewMessageHandler(), new ProcessorViewMessageHandler(), new PartitionViewMessageHandler(), new PipeconfViewMessageHandler());
UiTopoOverlayFactory topoOverlayFactory = () -> ImmutableList.of(new TrafficOverlay(), new ProtectedIntentOverlay());
UiTopo2OverlayFactory topo2OverlayFactory = () -> ImmutableList.of(new Traffic2Overlay());
UiTopoMapFactory topoMapFactory = () -> ImmutableList.of(new UiTopoMap("australia", "Australia", "*australia", 1.0), new UiTopoMap("americas", "North, Central and South America", "*americas", 0.7), new UiTopoMap("n_america", "North America", "*n_america", 0.9), new UiTopoMap("s_america", "South America", "*s_america", 0.9), new UiTopoMap("usa", "United States", "*continental_us", 1.3), new UiTopoMap("bayareaGEO", "Bay Area, California", "*bayarea", 1.0), new UiTopoMap("europe", "Europe", "*europe", 10.0), new UiTopoMap("italy", "Italy", "*italy", 0.8), new UiTopoMap("uk", "United Kingdom and Ireland", "*uk", 2.0), new UiTopoMap("japan", "Japan", "*japan", 0.8), new UiTopoMap("s_korea", "South Korea", "*s_korea", 0.75), new UiTopoMap("taiwan", "Taiwan", "*taiwan", 0.7), new UiTopoMap("africa", "Africa", "*africa", 0.7), new UiTopoMap("oceania", "Oceania", "*oceania", 0.7), new UiTopoMap("asia", "Asia", "*asia", 0.7));
return new UiExtension.Builder(CL, coreViews).lionBundles(lionBundles).messageHandlerFactory(messageHandlerFactory).topoOverlayFactory(topoOverlayFactory).topo2OverlayFactory(topo2OverlayFactory).topoMapFactory(topoMapFactory).resourcePath(CORE).ui2().build();
}
use of org.onosproject.ui.lion.LionBundle in project onos by opennetworkinglab.
the class TopologyViewMessageHandlerBase method hostDetails.
// Generates a property panel model for a host details response
protected PropertyPanel hostDetails(HostId hostId) {
log.debug("generate prop panel data for host {}", hostId);
Host host = services.host().getHost(hostId);
Annotations annot = host.annotations();
String glyphId = glyphForHost(annot);
LionBundle lion = getLionBundle(LION_TOPO);
PropertyPanel pp = new PropertyPanel(nameForHost(host), glyphId).navPath(HOST_NAV_PATH).id(hostId.toString());
addHostBasicProps(pp, host, lion);
addLocationProps(pp, annot, lion);
return pp;
}
use of org.onosproject.ui.lion.LionBundle in project onos by opennetworkinglab.
the class TopologyViewMessageHandlerBase method summmaryMessage.
// Returns property panel model for summary response.
protected PropertyPanel summmaryMessage() {
// chose NOT to add debug messages, since this is called every few seconds
Topology topology = services.topology().currentTopology();
LionBundle lion = getLionBundle(LION_TOPO);
String panelTitle = lion.getSafe("title_panel_summary");
return new PropertyPanel(panelTitle, "bird").addProp(VERSION, lion.getSafe(VERSION), version).addSeparator().addProp(DEVICES, lion.getSafe(DEVICES), services.device().getDeviceCount()).addProp(LINKS, lion.getSafe(LINKS), topology.linkCount()).addProp(HOSTS, lion.getSafe(HOSTS), services.host().getHostCount()).addProp(TOPOLOGY_SSCS, lion.getSafe(TOPOLOGY_SSCS), topology.clusterCount()).addSeparator().addProp(INTENTS, lion.getSafe(INTENTS), services.intent().getIntentCount()).addProp(FLOWS, lion.getSafe(FLOWS), services.flow().getFlowRuleCount());
}
use of org.onosproject.ui.lion.LionBundle in project onos by opennetworkinglab.
the class BundleStitcherTest method generateBundles.
// -- Testing generateLionBundles(...)
@Test
public void generateBundles() {
title("generateBundles");
List<LionBundle> bundles = BundleStitcher.generateBundles(LION_BASE, LION_TAGS);
print(bundles);
assertEquals("missing the bundle", 1, bundles.size());
LionBundle b = bundles.get(0);
assertEquals("wrong id", "CardGame1", b.id());
assertEquals("unexpected item count", 12, b.size());
assertEquals("missing 3oak", "Three of a Kind", b.getValue("three_oak"));
assertEquals("missing queen", "Queen", b.getValue("queen"));
assertEquals("missing clubs", "Clubs", b.getValue("clubs"));
}
use of org.onosproject.ui.lion.LionBundle in project onos by opennetworkinglab.
the class BundleStitcher method generateBundles.
/**
* Generates an immutable list of localization bundles, using the specified
* resource tree (base) and localization configuration file names (tags).
* <p>
* As an example, you might invoke:
* <pre>
* private static final String LION_BASE = "/org/onosproject/ui/lion";
*
* private static final String[] LION_TAGS = {
* "core.view.App",
* "core.view.Settings",
* "core.view.Cluster",
* "core.view.Processor",
* "core.view.Partition",
* };
*
* List<LionBundle> bundles =
* LionUtils.generateBundles(LION_BASE, LION_TAGS);
* </pre>
* It is expected that in the "LION_BASE" directory there is a subdirectory
* named "_config" which contains the configuration files listed in the
* "LION_TAGS" array, each with a ".lioncfg" suffix...
* <pre>
* /org/onosproject/ui/lion/
* |
* +-- _config
* |
* +-- core.view.App.lioncfg
* +-- core.view.Settings.lioncfg
* :
* </pre>
* These files collate a localization bundle for their particular view
* by referencing resource bundles and their keys.
*
* @param base the base resource directory path
* @param tags the list of bundles to generate
* @return a list of generated localization bundles
*/
public static List<LionBundle> generateBundles(String base, String... tags) {
List<LionBundle> bundles = new ArrayList<>(tags.length);
BundleStitcher stitcher = new BundleStitcher(base);
for (String tag : tags) {
try {
LionBundle lion = stitcher.stitch(tag);
bundles.add(lion);
log.info("Generated LION bundle: {}", lion);
log.debug(" Dumped: {}", lion.dump());
} catch (IllegalArgumentException e) {
log.warn("Unable to generate bundle: {} / {}", base, tag);
log.debug("BOOM!", e);
}
}
return ImmutableList.copyOf(bundles);
}
Aggregations