[ONOS-3203] End-to-end demo of Fault Management via SNMP.
This adds SNMP device-discovery, and a Fault Management app which makes alarms available to users via REST/GUI/CLI interfaces.
There is still code cleanup that could be done, but aim of this commit is an end-to-end proof of concept.
To demonstrate :
1) /opt/onos/bin/onos-service
onos> app activate org.onosproject.snmp
onos> app activate org.onosproject.faultmanagement
2) SNMP devices are seeded via config file. The default seed file contains connection details for devices (SNMP agents) available via internet e.g. demo.snmplabs.com
cp /opt/onos/apache-karaf-3.0.3/etc/samples/org.onosproject.provider.snmp.device.impl.SnmpDeviceProvider.cfg /opt/onos/apache-karaf-3.0.3/etc/
3) ONOS will poll these SNMP devices and store their alarms.
4) You can now manipulate the alarms via REST e.g. http://<onos>:8181/onos/v1/fm/alarms , via CLI via various "alarm-*” commands or in UI with an Alarms Overlay.
More info at https://wiki.onosproject.org/display/ONOS/Fault+Management
15/Dec/15: Updated regarding review comments from Thomas Vachuska.
17/Dec/15: Updated coreService.registerApplication(name) as per https://gerrit.onosproject.org/#/c/6878/
Change-Id: I886f8511f178dc4600ab96e5ff10cc90329cabec
diff --git a/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmServiceUtil.java b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmServiceUtil.java
new file mode 100644
index 0000000..fca8bbd
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmServiceUtil.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.faultmanagement.alarms.gui;
+
+import java.util.Map;
+import java.util.Set;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
+import org.onosproject.incubator.net.faultmanagement.alarm.AlarmId;
+import org.onosproject.incubator.net.faultmanagement.alarm.AlarmService;
+import org.onosproject.net.DeviceId;
+
+/**
+ *
+ * Utility for invoking on alarm service.
+ */
+public final class AlarmServiceUtil {
+
+ static Alarm lookupAlarm(AlarmId alarmId) {
+ return alarmService().getAlarm(alarmId);
+ }
+
+ static Set<Alarm> lookUpAlarms() {
+ return alarmService().getAlarms();
+ }
+
+ static Set<Alarm> lookUpAlarms(DeviceId deviceId) {
+ return alarmService().getAlarms(deviceId);
+ }
+
+ static Map<Alarm.SeverityLevel, Long> lookUpAlarmCounts(DeviceId deviceId) {
+ return alarmService().getAlarmCounts(deviceId);
+ }
+
+ static Map<Alarm.SeverityLevel, Long> lookUpAlarmCounts() {
+ return alarmService().getAlarmCounts();
+ }
+
+ private static AlarmService alarmService() {
+ return AbstractShellCommand.get(AlarmService.class);
+ }
+
+ private AlarmServiceUtil() {
+ }
+}
diff --git a/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTableComponent.java b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTableComponent.java
new file mode 100644
index 0000000..bf9eb94
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTableComponent.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.faultmanagement.alarms.gui;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onosproject.ui.UiExtension;
+import org.onosproject.ui.UiExtensionService;
+import org.onosproject.ui.UiMessageHandlerFactory;
+import org.onosproject.ui.UiView;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+/**
+ * Skeletal ONOS UI Table-View application component.
+ */
+@Component(immediate = true)
+public class AlarmTableComponent {
+
+ private static final String VIEW_ID = "alarmTable";
+ private static final String VIEW_TEXT = "Alarms";
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected UiExtensionService uiExtensionService;
+
+ // List of application views
+ private final List<UiView> uiViews = ImmutableList.of(
+ new UiView(UiView.Category.OTHER, VIEW_ID, VIEW_TEXT)
+ );
+
+ // Factory for UI message handlers
+ private final UiMessageHandlerFactory messageHandlerFactory =
+ () -> ImmutableList.of(
+ new AlarmTableMessageHandler()
+ );
+
+ // Application UI extension
+ protected UiExtension extension =
+ new UiExtension.Builder(getClass().getClassLoader(), uiViews)
+ .resourcePath(VIEW_ID)
+ .messageHandlerFactory(messageHandlerFactory)
+ .build();
+
+ @Activate
+ protected void activate() {
+ uiExtensionService.register(extension);
+ log.info("Started");
+ }
+
+ @Deactivate
+ protected void deactivate() {
+ uiExtensionService.unregister(extension);
+ log.info("Stopped");
+ }
+
+}
diff --git a/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTableMessageHandler.java b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTableMessageHandler.java
new file mode 100644
index 0000000..df475e2
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTableMessageHandler.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.faultmanagement.alarms.gui;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableSet;
+import org.onosproject.ui.RequestHandler;
+import org.onosproject.ui.UiMessageHandler;
+import org.onosproject.ui.table.TableModel;
+import org.onosproject.ui.table.TableRequestHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.Set;
+import org.joda.time.DateTime;
+import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
+import org.onosproject.incubator.net.faultmanagement.alarm.AlarmId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.ui.table.cell.TimeFormatter;
+
+/**
+ * Skeletal ONOS UI Table-View message handler.
+ */
+public class AlarmTableMessageHandler extends UiMessageHandler {
+
+ private static final String ALARM_TABLE_DATA_REQ = "alarmTableDataRequest";
+ private static final String ALARM_TABLE_DATA_RESP = "alarmTableDataResponse";
+ private static final String ALARM_TABLES = "alarmTables";
+
+ private static final String ALARM_TABLE_DETAIL_REQ = "alarmTableDetailsRequest";
+ private static final String ALARM_TABLE_DETAIL_RESP = "alarmTableDetailsResponse";
+ private static final String DETAILS = "details";
+
+ private static final String ID = "id";
+ private static final String DEVICE_ID_STR = "alarmDeviceId";
+ private static final String DESCRIPTION = "alarmDesc";
+ private static final String SOURCE = "alarmSource";
+ private static final String TIME_RAISED = "alarmTimeRaised";
+ private static final String TIME_UPDATED = "alarmTimeUpdated";
+ private static final String TIME_CLEARED = "alarmTimeCleared";
+ private static final String SEVERITY = "alarmSeverity";
+ private static final String RESULT = "result";
+
+ // TODO No need to show id column in ONOS-GUI
+
+ // TODO Replace SEVERITY column by color-coding of row depending on severity ie. red=critical, green=cleared etc
+ private static final String[] COLUMN_IDS = {ID, DEVICE_ID_STR, DESCRIPTION, SOURCE, TIME_RAISED, SEVERITY};
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Override
+ protected Collection<RequestHandler> createRequestHandlers() {
+ return ImmutableSet.of(
+ new AlarmTableDataRequestHandler(),
+ new AlarmTableDetailRequestHandler()
+ );
+ }
+
+ // handler for alarm table requests
+ private final class AlarmTableDataRequestHandler extends TableRequestHandler {
+
+ private AlarmTableDataRequestHandler() {
+ super(ALARM_TABLE_DATA_REQ, ALARM_TABLE_DATA_RESP, ALARM_TABLES);
+ }
+
+ @Override
+ protected String defaultColumnId() {
+ // if necessary, override defaultColumnId() -- if it isn't "id"
+ return ID;
+ }
+
+ @Override
+ protected String[] getColumnIds() {
+ return COLUMN_IDS;
+ }
+
+ @Override
+ protected TableModel createTableModel() {
+ // if required, override createTableModel() to set column formatters / comparators
+ TableModel tm = super.createTableModel();
+ tm.setFormatter(TIME_RAISED, new TimeFormatter());
+ return tm;
+ }
+
+ @Override
+ protected void populateTable(TableModel tm, ObjectNode payload) {
+ log.debug(" populateTable tm={} payload ={}", tm, payload);
+ String devId = string(payload, "devId");
+
+ Set<Alarm> alarms = Strings.isNullOrEmpty(devId) ?
+ AlarmServiceUtil.lookUpAlarms() :
+ AlarmServiceUtil.lookUpAlarms(DeviceId.deviceId(devId));
+
+ alarms.stream().forEach((alarm) -> {
+ populateRow(tm.addRow(), alarm);
+ });
+
+ }
+
+ private void populateRow(TableModel.Row row, Alarm alarm) {
+ log.debug("populate table Row row={} item ={}", row, alarm);
+
+ row.cell(ID, alarm.id().fingerprint())
+ .cell(DEVICE_ID_STR, alarm.deviceId())
+ .cell(DESCRIPTION, alarm.description())
+ .cell(SOURCE, alarm.source())
+ .cell(TIME_RAISED, new DateTime(alarm.timeRaised()))
+ .cell(SEVERITY, alarm.severity());
+ }
+ }
+
+ // handler for alarm details requests
+ private final class AlarmTableDetailRequestHandler extends RequestHandler {
+
+ private AlarmTableDetailRequestHandler() {
+ super(ALARM_TABLE_DETAIL_REQ);
+ }
+
+ @Override
+ public void process(long sid, ObjectNode payload) {
+ log.debug("sid={}, payload ={}", sid, payload);
+
+ String id = string(payload, ID, "(none)");
+ Alarm alarm = AlarmServiceUtil.lookupAlarm(AlarmId.alarmId(Long.parseLong(id)));
+ ObjectNode rootNode = objectNode();
+ ObjectNode data = objectNode();
+ rootNode.set(DETAILS, data);
+
+ if (alarm == null) {
+ rootNode.put(RESULT, "Item with id '" + id + "' not found");
+ log.warn("attempted to get item detail for id '{}'", id);
+
+ } else {
+ rootNode.put(RESULT, "Found item with id '" + id + "'");
+
+ data.put(ID, alarm.id().fingerprint());
+ data.put(DESCRIPTION, alarm.description());
+ data.put(DEVICE_ID_STR, alarm.deviceId().toString());
+ data.put(SOURCE, alarm.source().toString());
+ long timeRaised = alarm.timeRaised();
+ data.put(TIME_RAISED,
+ formatTime(timeRaised)
+ );
+ data.put(TIME_UPDATED, formatTime(alarm.timeUpdated()));
+ data.put(TIME_CLEARED, formatTime(alarm.timeCleared()));
+ data.put(SEVERITY, alarm.severity().toString());
+ }
+ log.debug("send ={}", rootNode);
+
+ sendMessage(ALARM_TABLE_DETAIL_RESP, 0, rootNode);
+ }
+ }
+
+ private static String formatTime(Long msSinceStartOfEpoch) {
+ if (msSinceStartOfEpoch == null) {
+ return "-";
+ }
+ return new TimeFormatter().format(new DateTime(msSinceStartOfEpoch));
+ }
+
+
+}
diff --git a/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTopovComponent.java b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTopovComponent.java
new file mode 100644
index 0000000..901d30f
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTopovComponent.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.faultmanagement.alarms.gui;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onosproject.ui.UiExtension;
+import org.onosproject.ui.UiExtensionService;
+import org.onosproject.ui.UiMessageHandlerFactory;
+import org.onosproject.ui.UiTopoOverlayFactory;
+import org.onosproject.ui.UiView;
+import org.onosproject.ui.UiViewHidden;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+/**
+ * Skeletal ONOS UI Topology-Overlay application component.
+ */
+@Component(immediate = true)
+public class AlarmTopovComponent {
+
+ private static final ClassLoader CL = AlarmTopovComponent.class.getClassLoader();
+ private static final String VIEW_ID = "alarmTopov";
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected UiExtensionService uiExtensionService;
+
+ // List of application views
+ private final List<UiView> uiViews = ImmutableList.of(
+ new UiViewHidden(VIEW_ID)
+ );
+
+ // Factory for UI message handlers
+ private final UiMessageHandlerFactory messageHandlerFactory =
+ () -> ImmutableList.of(
+ new AlarmTopovMessageHandler()
+ );
+
+ // Factory for UI topology overlays
+ private final UiTopoOverlayFactory topoOverlayFactory =
+ () -> ImmutableList.of(
+ new AlarmTopovOverlay()
+ );
+
+ // Application UI extension
+ protected UiExtension extension =
+ new UiExtension.Builder(CL, uiViews)
+ .resourcePath(VIEW_ID)
+ .messageHandlerFactory(messageHandlerFactory)
+ .topoOverlayFactory(topoOverlayFactory)
+ .build();
+
+ @Activate
+ protected void activate() {
+ uiExtensionService.register(extension);
+ log.info("Started");
+ }
+
+ @Deactivate
+ protected void deactivate() {
+ uiExtensionService.unregister(extension);
+ log.info("Stopped");
+ }
+
+}
diff --git a/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTopovMessageHandler.java b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTopovMessageHandler.java
new file mode 100644
index 0000000..adeb9d5
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTopovMessageHandler.java
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2014,2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.faultmanagement.alarms.gui;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableSet;
+import org.onlab.osgi.ServiceDirectory;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Element;
+import org.onosproject.net.HostId;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.host.HostService;
+import org.onosproject.ui.RequestHandler;
+import org.onosproject.ui.UiConnection;
+import org.onosproject.ui.UiMessageHandler;
+import org.onosproject.ui.topo.DeviceHighlight;
+import org.onosproject.ui.topo.Highlights;
+import org.onosproject.ui.topo.NodeBadge;
+import org.onosproject.ui.topo.NodeBadge.Status;
+import org.onosproject.ui.topo.TopoJson;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.Set;
+import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
+import org.onosproject.incubator.net.faultmanagement.alarm.AlarmService;
+
+/**
+ * Skeletal ONOS UI Topology-Overlay message handler.
+ */
+public class AlarmTopovMessageHandler extends UiMessageHandler {
+
+ private static final String ALARM_TOPOV_DISPLAY_START = "alarmTopovDisplayStart";
+ private static final String ALARM_TOPOV_DISPLAY_UPDATE = "alarmTopovDisplayUpdate";
+ private static final String ALARM_TOPOV_DISPLAY_STOP = "alarmTopovDisplayStop";
+
+ private static final String ID = "id";
+ private static final String MODE = "mode";
+
+ private enum Mode {
+
+ IDLE, MOUSE
+ }
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private DeviceService deviceService;
+ private HostService hostService;
+ private AlarmService alarmService;
+
+ private Mode currentMode = Mode.IDLE;
+ private Element elementOfNote;
+
+ // ===============-=-=-=-=-=-======================-=-=-=-=-=-=-================================
+ @Override
+ public void init(UiConnection connection, ServiceDirectory directory) {
+ super.init(connection, directory);
+ deviceService = directory.get(DeviceService.class);
+ hostService = directory.get(HostService.class);
+ alarmService = directory.get(AlarmService.class);
+ }
+
+ @Override
+ protected Collection<RequestHandler> createRequestHandlers() {
+ return ImmutableSet.of(
+ new DisplayStartHandler(),
+ new DisplayUpdateHandler(),
+ new DisplayStopHandler()
+ );
+ }
+
+ // === -------------------------
+ // === Handler classes
+ private final class DisplayStartHandler extends RequestHandler {
+
+ public DisplayStartHandler() {
+ super(ALARM_TOPOV_DISPLAY_START);
+ }
+
+ @Override
+ public void process(long sid, ObjectNode payload) {
+ String mode = string(payload, MODE);
+
+ log.debug("Start Display: mode [{}]", mode);
+ clearState();
+ clearForMode();
+
+ switch (mode) {
+ case "mouse":
+ currentMode = Mode.MOUSE;
+
+ sendMouseData();
+ break;
+
+ default:
+ currentMode = Mode.IDLE;
+
+ break;
+ }
+ }
+ }
+
+ private final class DisplayUpdateHandler extends RequestHandler {
+
+ public DisplayUpdateHandler() {
+ super(ALARM_TOPOV_DISPLAY_UPDATE);
+ }
+
+ @Override
+ public void process(long sid, ObjectNode payload) {
+ String id = string(payload, ID);
+ log.debug("Update Display: id [{}]", id);
+ if (!Strings.isNullOrEmpty(id)) {
+ updateForMode(id);
+ } else {
+ clearForMode();
+ }
+ }
+ }
+
+ private final class DisplayStopHandler extends RequestHandler {
+
+ public DisplayStopHandler() {
+ super(ALARM_TOPOV_DISPLAY_STOP);
+ }
+
+ @Override
+ public void process(long sid, ObjectNode payload) {
+ log.debug("Stop Display");
+ clearState();
+ clearForMode();
+ }
+ }
+
+ // === ------------
+ private void clearState() {
+ currentMode = Mode.IDLE;
+ elementOfNote = null;
+ }
+
+ private void updateForMode(String id) {
+ log.debug("host service: {}", hostService);
+ log.debug("device service: {}", deviceService);
+
+ try {
+ HostId hid = HostId.hostId(id);
+ log.debug("host id {}", hid);
+ elementOfNote = hostService.getHost(hid);
+ log.debug("host element {}", elementOfNote);
+
+ } catch (RuntimeException e) {
+ try {
+ DeviceId did = DeviceId.deviceId(id);
+ log.debug("device id {}", did);
+ elementOfNote = deviceService.getDevice(did);
+ log.debug("device element {}", elementOfNote);
+
+ } catch (RuntimeException e2) {
+ log.debug("Unable to process ID [{}]", id);
+ elementOfNote = null;
+ }
+ }
+
+ switch (currentMode) {
+ case MOUSE:
+ sendMouseData();
+ break;
+
+ default:
+ break;
+ }
+
+ }
+
+ private void clearForMode() {
+ sendHighlights(new Highlights());
+ }
+
+ private void sendHighlights(Highlights highlights) {
+ sendMessage(TopoJson.highlightsMessage(highlights));
+ }
+
+ private void sendMouseData() {
+ if (elementOfNote != null && elementOfNote instanceof Device) {
+ DeviceId devId = (DeviceId) elementOfNote.id();
+ Set<Alarm> alarmsOnDevice = alarmService.getAlarms(devId);
+ Highlights highlights = new Highlights();
+
+ addDeviceBadge(highlights, devId, alarmsOnDevice.size());
+ sendHighlights(highlights);
+ }
+ // Note: could also process Host, if available
+ }
+
+ private void addDeviceBadge(Highlights h, DeviceId devId, int n) {
+ DeviceHighlight dh = new DeviceHighlight(devId.toString());
+ dh.setBadge(createBadge(n));
+ h.add(dh);
+ }
+
+ private NodeBadge createBadge(int n) {
+ Status status = n > 0 ? Status.ERROR : Status.INFO;
+ String noun = n > 0 ? "(Alarmed)" : "(Normal)";
+ String msg = "Alarms: " + n + " " + noun;
+ return NodeBadge.number(status, n, msg);
+ }
+
+}
diff --git a/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTopovOverlay.java b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTopovOverlay.java
new file mode 100644
index 0000000..7fc87db
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/AlarmTopovOverlay.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.faultmanagement.alarms.gui;
+
+import java.util.Map;
+import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
+import org.onosproject.net.DeviceId;
+import org.onosproject.ui.UiTopoOverlay;
+import org.onosproject.ui.topo.ButtonId;
+import org.onosproject.ui.topo.PropertyPanel;
+import org.onosproject.ui.topo.TopoConstants.CoreButtons;
+import static org.onosproject.ui.topo.TopoConstants.Properties.*;
+
+/**
+ * Our topology overlay.
+ */
+public class AlarmTopovOverlay extends UiTopoOverlay {
+
+ // NOTE: this must match the ID defined in alarmTopov.js
+ private static final String OVERLAY_ID = "alarmsTopo-overlay";
+
+ private static final ButtonId ALARM1_BUTTON = new ButtonId("alarm1button");
+ private static final ButtonId ALARM2_BUTTON = new ButtonId("alarm2button");
+
+ public AlarmTopovOverlay() {
+ super(OVERLAY_ID);
+ }
+
+ @Override
+ public void modifySummary(PropertyPanel pp) {
+ pp.title("Alarms Overview");
+ // We could just remove some properties here but lets keep it uncluttered, unless
+ // there is feedback other properties are essential.
+ pp.removeAllProps();
+ Map<Alarm.SeverityLevel, Long> countsForAll = AlarmServiceUtil.lookUpAlarmCounts();
+ addAlarmCountsProperties(pp, countsForAll);
+
+ }
+
+ @Override
+ public void modifyDeviceDetails(PropertyPanel pp, DeviceId deviceId) {
+ pp.title("Alarm Details");
+ pp.removeProps(LATITUDE, LONGITUDE, PORTS, FLOWS, TUNNELS, SERIAL_NUMBER, PROTOCOL);
+
+ Map<Alarm.SeverityLevel, Long> countsForDevice = AlarmServiceUtil.lookUpAlarmCounts(deviceId);
+ addAlarmCountsProperties(pp, countsForDevice);
+
+ pp.addButton(ALARM1_BUTTON)
+ .addButton(ALARM2_BUTTON);
+
+ pp.removeButtons(CoreButtons.SHOW_PORT_VIEW)
+ .removeButtons(CoreButtons.SHOW_GROUP_VIEW);
+ }
+
+ private void addAlarmCountsProperties(PropertyPanel pp, Map<Alarm.SeverityLevel, Long> countsForDevice) {
+
+ // TODO we could show these as color-coded squares with a count inside, to save space on the screen.
+
+ long cr = countsForDevice.getOrDefault(Alarm.SeverityLevel.CRITICAL, 0L);
+ long ma = countsForDevice.getOrDefault(Alarm.SeverityLevel.MAJOR, 0L);
+ long mi = countsForDevice.getOrDefault(Alarm.SeverityLevel.MINOR, 0L);
+ long wa = countsForDevice.getOrDefault(Alarm.SeverityLevel.WARNING, 0L);
+ long in = countsForDevice.getOrDefault(Alarm.SeverityLevel.INDETERMINATE, 0L);
+ long cl = countsForDevice.getOrDefault(Alarm.SeverityLevel.CLEARED, 0L);
+
+ // Unfortunately the PropertyPanel does not righ justify numbers even when using longs,
+ // but that not in scope of fault management work
+ pp.addProp("Critical", cr);
+ pp.addProp("Major", ma);
+ pp.addProp("Minor", mi);
+ pp.addProp("Warning", wa);
+ pp.addProp("Indeter.", in);
+ pp.addProp("Cleared", cl);
+ pp.addSeparator();
+ pp.addProp("Total", cr + ma + mi + wa + in + cl);
+
+ }
+
+}
diff --git a/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/package-info.java b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/package-info.java
new file mode 100644
index 0000000..fcb4284
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/java/org/onosproject/faultmanagement/alarms/gui/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Fault Management GUI implementation.
+ */
+package org.onosproject.faultmanagement.alarms.gui;
diff --git a/apps/faultmanagement/fmgui/src/main/resources/alarmTable/css.html b/apps/faultmanagement/fmgui/src/main/resources/alarmTable/css.html
new file mode 100644
index 0000000..436ca0e
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/alarmTable/css.html
@@ -0,0 +1 @@
+<link rel="stylesheet" href="app/view/alarmTable/alarmTable.css">
\ No newline at end of file
diff --git a/apps/faultmanagement/fmgui/src/main/resources/alarmTable/js.html b/apps/faultmanagement/fmgui/src/main/resources/alarmTable/js.html
new file mode 100644
index 0000000..b7bdb61
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/alarmTable/js.html
@@ -0,0 +1 @@
+<script src="app/view/alarmTable/alarmTable.js"></script>
\ No newline at end of file
diff --git a/apps/faultmanagement/fmgui/src/main/resources/alarmTopov/css.html b/apps/faultmanagement/fmgui/src/main/resources/alarmTopov/css.html
new file mode 100644
index 0000000..3294fbd
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/alarmTopov/css.html
@@ -0,0 +1 @@
+<link rel="stylesheet" href="app/view/alarmTopov/alarmTopov.css">
diff --git a/apps/faultmanagement/fmgui/src/main/resources/alarmTopov/js.html b/apps/faultmanagement/fmgui/src/main/resources/alarmTopov/js.html
new file mode 100644
index 0000000..5ca23c2
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/alarmTopov/js.html
@@ -0,0 +1,2 @@
+<script src="app/view/alarmTopov/alarmTopovDemo.js"></script>
+<script src="app/view/alarmTopov/alarmTopovOverlay.js"></script>
diff --git a/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTable/alarmTable.css b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTable/alarmTable.css
new file mode 100644
index 0000000..47dfee4
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTable/alarmTable.css
@@ -0,0 +1,35 @@
+/* css for alarm table view */
+
+#ov-alarm-table h2 {
+ display: inline-block;
+}
+
+/* Panel Styling */
+#ov-alarm-table-item-details-panel.floatpanel {
+ position: absolute;
+ top: 115px;
+}
+
+.light #ov-alarm-table-item-details-panel.floatpanel {
+ background-color: rgb(229, 234, 237);
+}
+.dark #ov-alarm-table-item-details-panel.floatpanel {
+ background-color: #3A4042;
+}
+
+#ov-alarm-table-item-details-panel h3 {
+ margin: 0;
+ font-size: large;
+}
+
+#ov-alarm-table-item-details-panel h4 {
+ margin: 0;
+}
+
+#ov-alarm-table-item-details-panel td {
+ padding: 5px;
+}
+#ov-alarm-table-item-details-panel td.label {
+ font-style: italic;
+ opacity: 0.8;
+}
diff --git a/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTable/alarmTable.html b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTable/alarmTable.html
new file mode 100644
index 0000000..b9eacc3
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTable/alarmTable.html
@@ -0,0 +1,54 @@
+<!-- partial HTML -->
+<div id="ov-alarm-table">
+ <div class="tabular-header">
+ <h2>Alarms for {{devId || "all devices."}} ({{tableData.length}} total)</h2>
+ <div class="ctrl-btns">
+ <div class="refresh" ng-class="{active: autoRefresh}"
+ icon icon-id="refresh" icon-size="36"
+ tooltip tt-msg="autoRefreshTip"
+ ng-click="toggleRefresh()"></div>
+ </div>
+ </div>
+
+ <div class="summary-list" onos-table-resize>
+
+ <div class="table-header" onos-sortable-header>
+ <table>
+ <tr>
+
+ <td colId="id" sortable>Id </td>
+ <td colId="alarmDeviceId" sortable>Device </td>
+ <td colId="alarmDesc" sortable>Description </td>
+ <td colId="alarmSource" sortable>Source </td>
+ <td colId="alarmTimeRaised" sortable>Time Raised </td>
+ <td colId="alarmSeverity" sortable>Severity </td>
+
+ </tr>
+ </table>
+ </div>
+
+ <div class="table-body">
+ <table>
+ <tr ng-if="!tableData.length" class="no-data">
+ <td colspan="3">
+ No Alarms found
+ </td>
+ </tr>
+
+ <tr ng-repeat="item in tableData track by $index"
+ ng-click="selectCallback($event, item)"
+ ng-class="{selected: item.id === selId}">
+ <td>{{item.id}}</td>
+ <td>{{item.alarmDeviceId}}</td>
+ <td>{{item.alarmDesc}}</td>
+ <td>{{item.alarmSource}}</td>
+ <td>{{item.alarmTimeRaised}}</td>
+ <td>{{item.alarmSeverity}}</td>
+ </tr>
+ </table>
+ </div>
+
+ </div>
+
+ <ov-alarm-table-item-details-panel></ov-alarm-table-item-details-panel>
+</div>
diff --git a/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTable/alarmTable.js b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTable/alarmTable.js
new file mode 100644
index 0000000..82ceeda
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTable/alarmTable.js
@@ -0,0 +1,157 @@
+// js for alarm app table view
+(function () {
+ 'use strict';
+
+ // injected refs
+ var $log, $scope, $loc, devId, fs, wss;
+
+ // constants
+ var detailsReq = 'alarmTableDetailsRequest',
+ detailsResp = 'alarmTableDetailsResponse',
+ pName = 'ov-alarm-table-item-details-panel',
+ propOrder = ['id', 'alarmDeviceId', 'alarmDesc', 'alarmSource', 'alarmTimeRaised', 'alarmTimeUpdated', 'alarmTimeCleared', 'alarmSeverity'],
+ friendlyProps = ['Alarm Id', 'Device Id', 'Description', 'Source', 'Time Raised', 'Time Updated', 'Time Cleared', 'Severity'];
+
+
+ function addProp(tbody, index, value) {
+ var tr = tbody.append('tr');
+
+ function addCell(cls, txt) {
+ tr.append('td').attr('class', cls).html(txt);
+ }
+ addCell('label', friendlyProps[index] + ' :');
+ addCell('value', value);
+ }
+
+ function populatePanel(panel) {
+ var title = panel.append('h3'),
+ tbody = panel.append('table').append('tbody');
+
+ title.text('Alarm Details');
+
+ propOrder.forEach(function (prop, i) {
+ addProp(tbody, i, $scope.panelDetails[prop]);
+ });
+
+ panel.append('hr');
+ panel.append('h4').text('Comments');
+ panel.append('p').text($scope.panelDetails.comment);
+ }
+
+ function respDetailsCb(data) {
+ $scope.panelDetails = data.details;
+ $scope.$apply();
+ }
+
+ angular.module('ovAlarmTable', [])
+ .controller('OvAlarmTableCtrl',
+ ['$log', '$scope', '$location', 'TableBuilderService',
+ 'FnService', 'WebSocketService',
+ function (_$log_, _$scope_, _$location_, tbs, _fs_, _wss_) {
+ var params;
+
+ $log = _$log_;
+ $scope = _$scope_;
+ $loc = _$location_;
+
+ fs = _fs_;
+ wss = _wss_;
+
+
+ params = $loc.search();
+ if (params.hasOwnProperty('devId')) {
+ $scope.devId = params['devId'];
+ }
+
+ var handlers = {};
+ $scope.panelDetails = {};
+
+ // details response handler
+ handlers[detailsResp] = respDetailsCb;
+ wss.bindHandlers(handlers);
+
+ // custom selection callback
+ function selCb($event, row) {
+ $log.debug("selCb row=" + JSON.stringify(row, null, 4) +
+ ", $event=" + JSON.stringify($event, null, 4));
+ $log.debug('$scope.selId=', $scope.selId);
+ if ($scope.selId) {
+ $log.debug('send');
+ wss.sendEvent(detailsReq, {id: row.id});
+ } else {
+ $log.debug('hidePanel');
+ $scope.hidePanel();
+ }
+ $log.debug('Got a click on:', row);
+ }
+
+ // TableBuilderService creating a table for us
+ tbs.buildTable({
+ scope: $scope,
+ tag: 'alarmTable',
+ selCb: selCb,
+ query: params
+ });
+
+ // cleanup
+ $scope.$on('$destroy', function () {
+ wss.unbindHandlers(handlers);
+ $log.log('OvAlarmTableCtrl has been destroyed');
+ });
+
+ $log.log('OvAlarmTableCtrl has been created');
+ }])
+
+ .directive('ovAlarmTableItemDetailsPanel', ['PanelService', 'KeyService',
+ function (ps, ks) {
+ return {
+ restrict: 'E',
+ link: function (scope, element, attrs) {
+ // insert details panel with PanelService
+ // create the panel
+ var panel = ps.createPanel(pName, {
+ width: 400,
+ margin: 20,
+ hideMargin: 0
+ });
+ panel.hide();
+ scope.hidePanel = function () {
+ panel.hide();
+ };
+
+ function closePanel() {
+ if (panel.isVisible()) {
+ $scope.selId = null;
+ panel.hide();
+ return true;
+ }
+ return false;
+ }
+
+ // create key bindings to handle panel
+ ks.keyBindings({
+ esc: [closePanel, 'Close the details panel'],
+ _helpFormat: ['esc']
+ });
+ ks.gestureNotes([
+ ['click', 'Select a row to show item details']
+ ]);
+
+ // update the panel's contents when the data is changed
+ scope.$watch('panelDetails', function () {
+ if (!fs.isEmptyObject(scope.panelDetails)) {
+ panel.empty();
+ populatePanel(panel);
+ panel.show();
+ }
+ });
+
+ // cleanup on destroyed scope
+ scope.$on('$destroy', function () {
+ ks.unbindKeys();
+ ps.destroyPanel(pName);
+ });
+ }
+ };
+ }]);
+}());
diff --git a/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/alarmTopov.css b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/alarmTopov.css
new file mode 100644
index 0000000..e657900
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/alarmTopov.css
@@ -0,0 +1,2 @@
+/* css for alarm app topology overlay */
+
diff --git a/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/alarmTopovDemo.js b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/alarmTopovDemo.js
new file mode 100644
index 0000000..8c4846e
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/alarmTopovDemo.js
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ Alarm Demo module. This contains the "business logic" for the topology
+ overlay that we are implementing.
+ */
+
+(function () {
+ 'use strict';
+
+ // injected refs
+ var $log, fs, flash, wss;
+
+ // constants
+ var displayStart = 'alarmTopovDisplayStart',
+ displayUpdate = 'alarmTopovDisplayUpdate',
+ displayStop = 'alarmTopovDisplayStop';
+
+ // internal state
+ var currentMode = null;
+
+
+ // === ---------------------------
+ // === Helper functions
+
+ function sendDisplayStart(mode) {
+ wss.sendEvent(displayStart, {
+ mode: mode
+ });
+ }
+
+ function sendDisplayUpdate(what) {
+ wss.sendEvent(displayUpdate, {
+ id: what ? what.id : ''
+ });
+ }
+
+ function sendDisplayStop() {
+ wss.sendEvent(displayStop);
+ }
+
+ // === ---------------------------
+ // === Main API functions
+
+ function startDisplay(mode) {
+ if (currentMode === mode) {
+ $log.debug('(in mode', mode, 'already)');
+ } else {
+ currentMode = mode;
+ sendDisplayStart(mode);
+ flash.flash('Starting display mode: ' + mode);
+ }
+ }
+
+ function updateDisplay(m) {
+ if (currentMode) {
+ sendDisplayUpdate(m);
+ }
+ }
+
+ function stopDisplay() {
+ if (currentMode) {
+ currentMode = null;
+ sendDisplayStop();
+ flash.flash('Canceling display mode');
+ return true;
+ }
+ return false;
+ }
+
+ // === ---------------------------
+ // === Module Factory Definition
+
+ angular.module('ovAlarmTopov', [])
+ .factory('AlarmTopovDemoService',
+ ['$log', 'FnService', 'FlashService', 'WebSocketService',
+
+ function (_$log_, _fs_, _flash_, _wss_) {
+ $log = _$log_;
+ fs = _fs_;
+ flash = _flash_;
+ wss = _wss_;
+
+ return {
+ startDisplay: startDisplay,
+ updateDisplay: updateDisplay,
+ stopDisplay: stopDisplay
+ };
+ }]);
+}());
diff --git a/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/alarmTopovOverlay.js b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/alarmTopovOverlay.js
new file mode 100644
index 0000000..37ebda3
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/alarmTopovOverlay.js
@@ -0,0 +1,136 @@
+// alarm topology overlay - client side
+//
+// This is the glue that binds our business logic (in alarmTopovDemo.js)
+// to the overlay framework.
+
+(function () {
+ 'use strict';
+
+ // injected refs
+ var $log, tov, stds, ns;
+
+ // internal state should be kept in the service module (not here)
+
+ // our overlay definition
+ var overlay = {
+ // NOTE: this must match the ID defined in AppUiTopovOverlay
+ overlayId: 'alarmsTopo-overlay',
+ glyphId: '*star4',
+ tooltip: 'Alarms Overlay',
+ // These glyphs get installed using the overlayId as a prefix.
+ // e.g. 'star4' is installed as 'alarmsTopo-overlay-star4'
+ // They can be referenced (from this overlay) as '*star4'
+ // That is, the '*' prefix stands in for 'alarmsTopo-overlay-'
+ glyphs: {
+ star4: {
+ vb: '0 0 8 8',
+ // TODO new icon needed
+ d: 'M1,4l2,-1l1,-2l1,2l2,1l-2,1l-1,2l-1,-2z'
+ },
+ banner: {
+ vb: '0 0 6 6',
+ // TODO new icon needed
+ d: 'M1,1v4l2,-2l2,2v-4z'
+ }
+ },
+ activate: function () {
+ $log.debug("Alarm topology overlay ACTIVATED");
+ },
+ deactivate: function () {
+ stds.stopDisplay();
+ $log.debug("Alarm topology overlay DEACTIVATED");
+ },
+ // detail panel button definitions
+ buttons: {
+ alarm1button: {
+ gid: 'chain',
+ tt: 'Show alarms for this device',
+ cb: function (data) {
+ $log.debug('Show alarms for selected device. data:', data);
+ ns.navTo("alarmTable", {devId: data.id});
+
+ }
+ },
+ alarm2button: {
+ gid: '*banner',
+ tt: 'Show alarms for all devices',
+ cb: function (data) {
+ $log.debug('Show alarms for all devices. data:', data);
+ ns.navTo("alarmTable");
+
+ }
+ }
+ },
+ // Key bindings for traffic overlay buttons
+ // NOTE: fully qual. button ID is derived from overlay-id and key-name
+ keyBindings: {
+ 0: {
+ cb: function () {
+ stds.stopDisplay();
+ },
+ tt: 'Cancel Alarm Count on Device',
+ gid: 'xMark'
+ },
+ V: {
+ cb: function () {
+ stds.startDisplay('mouse');
+ },
+ tt: 'Start Alarm Count on Device',
+ gid: '*banner'
+ },
+ _keyOrder: [
+ '0', 'V'
+ ]
+ },
+ hooks: {
+ // hook for handling escape key
+ // Must return true to consume ESC, false otherwise.
+ escape: function () {
+ // Must return true to consume ESC, false otherwise.
+ return stds.stopDisplay();
+ },
+ // hooks for when the selection changes...
+ empty: function () {
+ selectionCallback('empty');
+ },
+ single: function (data) {
+ selectionCallback('single', data);
+ },
+ multi: function (selectOrder) {
+ selectionCallback('multi', selectOrder);
+ tov.addDetailButton('alarm1button');
+ tov.addDetailButton('alarm2button');
+ },
+ mouseover: function (m) {
+ // m has id, class, and type properties
+ $log.debug('mouseover:', m);
+ stds.updateDisplay(m);
+ },
+ mouseout: function () {
+ $log.debug('mouseout');
+ stds.updateDisplay();
+ }
+ }
+ };
+
+
+ function buttonCallback(x) {
+ $log.debug('Toolbar-button callback', x);
+ }
+
+ function selectionCallback(x, d) {
+ $log.debug('Selection callback', x, d);
+ }
+
+ // invoke code to register with the overlay service
+ angular.module('ovAlarmTopov')
+ .run(['$log', 'TopoOverlayService', 'AlarmTopovDemoService', 'NavService',
+ function (_$log_, _tov_, _stds_, _ns_) {
+ $log = _$log_;
+ tov = _tov_;
+ stds = _stds_;
+ ns = _ns_;
+ tov.register(overlay);
+ }]);
+
+}());
diff --git a/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/sampleTopov.html b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/sampleTopov.html
new file mode 100644
index 0000000..e51c1e0
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/app/view/alarmTopov/sampleTopov.html
@@ -0,0 +1,4 @@
+<!-- partial HTML -->
+<div id="ov-alarm-topov">
+ <p>This is a hidden view .. just a placeholder to house the javascript</p>
+</div>
diff --git a/apps/faultmanagement/fmgui/src/main/resources/css.html b/apps/faultmanagement/fmgui/src/main/resources/css.html
new file mode 100644
index 0000000..860f655
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/css.html
@@ -0,0 +1 @@
+<link rel="stylesheet" href="app/view/alarmCustom/alarmCustom.css">
\ No newline at end of file
diff --git a/apps/faultmanagement/fmgui/src/main/resources/js.html b/apps/faultmanagement/fmgui/src/main/resources/js.html
new file mode 100644
index 0000000..d07cd63
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/main/resources/js.html
@@ -0,0 +1 @@
+<script src="app/view/alarmCustom/alarmCustom.js"></script>
\ No newline at end of file
diff --git a/apps/faultmanagement/fmgui/src/test/java/org/onosproject/faultmanagement/alarms/gui/README.txt b/apps/faultmanagement/fmgui/src/test/java/org/onosproject/faultmanagement/alarms/gui/README.txt
new file mode 100644
index 0000000..8374808
--- /dev/null
+++ b/apps/faultmanagement/fmgui/src/test/java/org/onosproject/faultmanagement/alarms/gui/README.txt
@@ -0,0 +1 @@
+# Need to write unit tests for the GUI server-side code ; write them after there are examples at web/gui/src/test/java/org/onosproject/ui/impl
\ No newline at end of file