summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/apps/faultmanagement
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/apps/faultmanagement')
-rw-r--r--framework/src/onos/apps/faultmanagement/app/app.xml24
-rw-r--r--framework/src/onos/apps/faultmanagement/app/features.xml25
-rw-r--r--framework/src/onos/apps/faultmanagement/app/pom.xml46
-rw-r--r--framework/src/onos/apps/faultmanagement/fmmgr/pom.xml54
-rw-r--r--framework/src/onos/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/AlarmsManager.java222
-rw-r--r--framework/src/onos/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/pom.xml141
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/AlarmCodec.java101
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/AlarmsWebResource.java148
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/package-info.java20
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/src/main/webapp/WEB-INF/web.xml42
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmCodecContext.java73
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmCodecTest.java140
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmJsonMatcher.java135
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmsWebResourceTest.java72
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/src/test/resources/org/onosproject/faultmanagement/web/alarm-full.json15
-rw-r--r--framework/src/onos/apps/faultmanagement/fmweb/src/test/resources/org/onosproject/faultmanagement/web/alarm-minimal.json12
-rw-r--r--framework/src/onos/apps/faultmanagement/pom.xml56
18 files changed, 0 insertions, 1346 deletions
diff --git a/framework/src/onos/apps/faultmanagement/app/app.xml b/framework/src/onos/apps/faultmanagement/app/app.xml
deleted file mode 100644
index 288ccc49..00000000
--- a/framework/src/onos/apps/faultmanagement/app/app.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<app name="org.onosproject.faultmanagement" origin="BTI Systems" version="${project.version}"
- featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
- features="${project.artifactId}">
- <description>${project.description}</description>
-
- <artifact>mvn:${project.groupId}/onos-app-fm-mgr/${project.version}</artifact>
- <artifact>mvn:${project.groupId}/onos-app-fm-web/${project.version}</artifact>
-</app>
diff --git a/framework/src/onos/apps/faultmanagement/app/features.xml b/framework/src/onos/apps/faultmanagement/app/features.xml
deleted file mode 100644
index 86aab911..00000000
--- a/framework/src/onos/apps/faultmanagement/app/features.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
- ~ 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.
- -->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
- <feature name="${project.artifactId}" version="${project.version}"
- description="${project.description}">
- <feature>onos-api</feature>
- <feature>onos-drivers</feature>
- <bundle>mvn:${project.groupId}/onos-app-fm-mgr/${project.version}</bundle>
- <bundle>mvn:${project.groupId}/onos-app-fm-web/${project.version}</bundle>
- </feature>
-</features>
diff --git a/framework/src/onos/apps/faultmanagement/app/pom.xml b/framework/src/onos/apps/faultmanagement/app/pom.xml
deleted file mode 100644
index c446c0ae..00000000
--- a/framework/src/onos/apps/faultmanagement/app/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-fm</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>onos-app-fm-onosfw</artifactId>
- <packaging>pom</packaging>
-
- <description>ONOS framework applications</description>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-fm-web</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-fm-mgr</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/framework/src/onos/apps/faultmanagement/fmmgr/pom.xml b/framework/src/onos/apps/faultmanagement/fmmgr/pom.xml
deleted file mode 100644
index a6bb3103..00000000
--- a/framework/src/onos/apps/faultmanagement/fmmgr/pom.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ~ 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.
- -->
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-fm</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>onos-app-fm-mgr</artifactId>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-incubator-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-core-serializers</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>5.0.0</version>
- <type>jar</type>
- </dependency>
- </dependencies>
-</project>
diff --git a/framework/src/onos/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/AlarmsManager.java b/framework/src/onos/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/AlarmsManager.java
deleted file mode 100644
index 74fe7072..00000000
--- a/framework/src/onos/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/AlarmsManager.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * 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.impl;
-
-import static com.google.common.base.Strings.isNullOrEmpty;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-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.Modified;
-import org.apache.felix.scr.annotations.Property;
-import static org.onlab.util.Tools.nullIsNotFound;
-
-import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmEntityId;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmEvent;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmId;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmListener;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmService;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.slf4j.Logger;
-import static org.slf4j.LoggerFactory.getLogger;
-import org.apache.felix.scr.annotations.Service;
-import static org.onlab.util.Tools.get;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.IdGenerator;
-import org.onosproject.core.CoreService;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.onlab.util.ItemNotFoundException;
-import org.onosproject.incubator.net.faultmanagement.alarm.DefaultAlarm;
-import org.osgi.service.component.ComponentContext;
-
-/**
- * Implementation of the Alarm service.
- */
-@Component(immediate = true)
-@Service
-public class AlarmsManager implements AlarmService {
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
- private final Logger log = getLogger(getClass());
- private ApplicationId appId;
- private IdGenerator idGenerator;
-
-
- @Property(name = "fmDevices", value = "127.0.0.1", label = "Instance-specific configurations")
- private String devConfigs;
-
- private final Map<AlarmId, Alarm> alarms = new ConcurrentHashMap<>();
-
-
- private final AtomicLong alarmIdGenerator = new AtomicLong(0);
-
- @Override
- public Alarm update(final Alarm replacement) {
-
- final Alarm found = alarms.get(replacement.id());
- if (found == null) {
- throw new ItemNotFoundException("Alarm with id " + replacement.id() + " found");
- }
- final Alarm updated = new DefaultAlarm.Builder(found).
- withAcknowledged(replacement.acknowledged()).
- withAssignedUser(replacement.assignedUser()).build();
- alarms.put(replacement.id(), updated);
- return updated;
- }
-
- @Override
- public int getActiveAlarmCount(final DeviceId deviceId) {
- //TODO
- throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
- }
- private static final String NOT_SUPPORTED_YET = "Not supported yet.";
-
- @Override
- public Alarm getAlarm(final AlarmId alarmId) {
- return nullIsNotFound(
- alarms.get(alarmId),
- "Alarm is not found");
- }
-
- @Override
- public Set<Alarm> getAlarms() {
- //TODO
- throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
- }
-
- @Override
- public Set<Alarm> getActiveAlarms() {
- // Enpty set if no values
- return alarms.isEmpty() ? new HashSet<>() : new HashSet<>(alarms.values());
-
- }
-
- private static DefaultAlarm generateFake(final DeviceId deviceId, final AlarmId alarmId) {
-
- return new DefaultAlarm.Builder(
- alarmId, deviceId, "NE is not reachable", Alarm.SeverityLevel.MAJOR, System.currentTimeMillis()).
- withTimeUpdated(System.currentTimeMillis()).
- withServiceAffecting(true)
- .withAcknowledged(true).
- withManuallyClearable(true)
- .withAssignedUser("user1").build();
- }
-
- @Override
- public Set<Alarm> getAlarms(final Alarm.SeverityLevel severity) {
- //TODO
- throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
- }
-
- @Override
- public Set<Alarm> getAlarms(final DeviceId deviceId) {
- //TODO
- throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
- }
-
- @Override
- public Set<Alarm> getAlarms(final DeviceId deviceId, final AlarmEntityId source) {
- //TODO
- throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
- }
-
- @Override
- public Set<Alarm> getAlarmsForLink(final ConnectPoint src, final ConnectPoint dst) {
- //TODO
- throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
- }
-
- @Override
- public Set<Alarm> getAlarmsForFlow(final DeviceId deviceId, final long flowId) {
- //TODO
- throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
- }
-
- private void discoverAlarmsForDevice(final DeviceId deviceId) {
- final AlarmId alarmId = new AlarmId(alarmIdGenerator.incrementAndGet());
-
- // TODO In a new thread invoke SNMP Provider with DeviceId and device type and when done update our of alarms
- //
- alarms.put(alarmId, generateFake(deviceId, alarmId));
-
- }
-
- private class InternalAlarmListener implements AlarmListener {
-
- @Override
- public void event(final AlarmEvent event) {
- // TODO
- throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
- }
- }
-
- @Activate
- public void activate(final ComponentContext context) {
- log.info("Activate ...");
- appId = coreService.registerApplication("org.onos.faultmanagement.alarms");
- idGenerator = coreService.getIdGenerator("alarm-ids");
- log.info("Started with appId={} idGenerator={}", appId, idGenerator);
-
- final boolean result = modified(context);
- log.info("modified result = {}", result);
-
- }
-
- @Deactivate
- public void deactivate(final ComponentContext context) {
- log.info("Deactivate ...");
- // cfgService.unregisterProperties(getClass(), false);
-
- log.info("Stopped");
- }
-
- @Modified
- public boolean modified(final ComponentContext context) {
- log.info("context={}", context);
- if (context == null) {
- log.info("No configuration file");
- return false;
- }
- final Dictionary<?, ?> properties = context.getProperties();
- final String ipaddresses = get(properties, "fmDevices");
- log.info("Settings: devConfigs={}", ipaddresses);
- if (!isNullOrEmpty(ipaddresses)) {
- discover(ipaddresses);
-
- }
- return true;
- }
-
- private void discover(final String ipaddresses) {
- for (String deviceEntry : ipaddresses.split(",")) {
- final DeviceId deviceId = DeviceId.deviceId(deviceEntry);
- if (deviceId != null) {
- log.info("Device {} needs to have its alarms refreshed!", deviceId);
- discoverAlarmsForDevice(deviceId);
- }
- }
- }
-
-}
diff --git a/framework/src/onos/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/package-info.java b/framework/src/onos/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/package-info.java
deleted file mode 100644
index a3f56459..00000000
--- a/framework/src/onos/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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 application implementation.
- */
-package org.onosproject.faultmanagement.impl;
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/pom.xml b/framework/src/onos/apps/faultmanagement/fmweb/pom.xml
deleted file mode 100644
index edaa9d3c..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/pom.xml
+++ /dev/null
@@ -1,141 +0,0 @@
-<?xml version="1.0"?>
-<!--
-~ 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.
--->
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-fm</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
-
- <artifactId>onos-app-fm-web</artifactId>
- <packaging>bundle</packaging>
- <properties>
- <web.context>/onos/v1/fm</web.context>
- <api.version>1.0.0</api.version>
- <api.title>ONOS Fault Management Application REST API</api.title>
- <api.description>
- APIs for interacting with the Fault Management application.
- </api.description>
- <api.package>org.onos.faultmanagement.web</api.package>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-incubator-api</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-client</artifactId>
- <version>1.19</version>
- <scope>test</scope>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-core-common</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-rest</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <type>jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-rest</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.sun.jersey.jersey-test-framework</groupId>
- <artifactId>jersey-test-framework-core</artifactId>
- <version>1.19</version>
- </dependency>
-
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <_wab>src/main/webapp/</_wab>
- <Include-Resource>
- WEB-INF/classes/apidoc/swagger.json=target/swagger.json,
- {maven-resources}
- </Include-Resource>
- <Bundle-SymbolicName>
- ${project.groupId}.${project.artifactId}
- </Bundle-SymbolicName>
- <Import-Package>
- org.slf4j,
- org.osgi.framework,
- javax.ws.rs,
- javax.ws.rs.core,
- com.sun.jersey.api.core,
- com.sun.jersey.spi.container.servlet,
- com.sun.jersey.server.impl.container.servlet,
- com.fasterxml.jackson.databind,
- com.fasterxml.jackson.databind.node,
- com.fasterxml.jackson.core,
- org.apache.karaf.shell.commands,
- org.apache.commons.lang.math.*,
- com.google.common.*,
- org.onlab.packet.*,
- org.onlab.rest.*,
- org.onosproject.*,
- org.onlab.util.*,
- org.jboss.netty.util.*
- </Import-Package>
- <Web-ContextPath>${web.context}</Web-ContextPath>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/AlarmCodec.java b/framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/AlarmCodec.java
deleted file mode 100644
index a764c908..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/AlarmCodec.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.web;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import org.onosproject.net.DeviceId;
-import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmEntityId;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmId;
-import org.onosproject.incubator.net.faultmanagement.alarm.DefaultAlarm;
-import org.slf4j.Logger;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Implementation of encoder for Alarm codec.
- */
-public final class AlarmCodec extends JsonCodec<Alarm> {
-
- private final Logger log = getLogger(getClass());
-
- @Override
- public ObjectNode encode(final Alarm alarm, final CodecContext context) {
- checkNotNull(alarm, "Alarm cannot be null");
-
- return context.mapper().createObjectNode()
- .put("id", alarm.id().fingerprint())
- .put("deviceId", alarm.deviceId().toString())
- .put("description", alarm.description())
- .put("source",
- alarm.source() == null ? null
- : alarm.source().toString())
- .put("timeRaised", alarm.timeRaised())
- .put("timeUpdated", alarm.timeUpdated())
- .put("timeCleared", alarm.timeCleared())
- .put("severity", alarm.severity().toString())
- .put("serviceAffecting", alarm.serviceAffecting())
- .put("acknowledged", alarm.acknowledged())
- .put("manuallyClearable", alarm.manuallyClearable())
- .put("assignedUser", alarm.assignedUser());
-
- }
-
- @Override
- public Alarm decode(final ObjectNode json, final CodecContext context) {
- if (json == null || !json.isObject()) {
- return null;
- }
-
- log.debug("id={}, full json={} ", json.get("id"), json);
- final Long id = json.get("id").asLong();
-
- final DeviceId deviceId = DeviceId.deviceId(json.get("deviceId").asText());
- final String description = json.get("description").asText();
- final Long timeRaised = json.get("timeRaised").asLong();
- final Long timeUpdated = json.get("timeUpdated").asLong();
-
- final JsonNode jsonTimeCleared = json.get("timeCleared");
- final Long timeCleared = jsonTimeCleared == null || jsonTimeCleared.isNull() ? null : jsonTimeCleared.asLong();
-
- final Alarm.SeverityLevel severity
- = Alarm.SeverityLevel.valueOf(json.get("severity").asText().toUpperCase());
-
- final Boolean serviceAffecting = json.get("serviceAffecting").asBoolean();
- final Boolean acknowledged = json.get("acknowledged").asBoolean();
- final Boolean manuallyClearable = json.get("manuallyClearable").asBoolean();
-
- final JsonNode jsonAssignedUser = json.get("assignedUser");
- final String assignedUser
- = jsonAssignedUser == null || jsonAssignedUser.isNull() ? null : jsonAssignedUser.asText();
-
- return new DefaultAlarm.Builder(
- AlarmId.valueOf(id), deviceId, description, severity, timeRaised).forSource(AlarmEntityId.NONE).
- withTimeUpdated(timeUpdated).
- withTimeCleared(timeCleared).
- withServiceAffecting(serviceAffecting).
- withAcknowledged(acknowledged).
- withManuallyClearable(manuallyClearable).
- withAssignedUser(assignedUser).
- build();
-
- }
-}
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/AlarmsWebResource.java b/framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/AlarmsWebResource.java
deleted file mode 100644
index 56c891cd..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/AlarmsWebResource.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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.web;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.io.IOException;
-import java.io.InputStream;
-import org.onosproject.rest.AbstractWebResource;
-
-import javax.ws.rs.core.Response;
-import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmId;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import org.onosproject.codec.CodecService;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmService;
-import org.slf4j.Logger;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Alarms on devices or ONOS.
- */
-@Path("alarms")
-public class AlarmsWebResource extends AbstractWebResource {
-
- public static final String ALARM_NOT_FOUND = "Alarm is not found";
-
- private final Logger log = getLogger(getClass());
-
- public AlarmsWebResource() {
- get(CodecService.class).registerCodec(Alarm.class, new AlarmCodec());
- }
-
- /**
- * Get all alarms. Returns a list of all alarms across all devices.
- *
- * @param includeCleared include recently cleared alarms in response
- * @return JSON encoded set of alarms
- */
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response getAlarms(@DefaultValue("false") @QueryParam("includeCleared") final boolean includeCleared
- ) {
-
- log.info("Requesting all alarms, includeCleared={}", includeCleared);
- final AlarmService service = get(AlarmService.class);
-
- final Iterable<Alarm> alarms = includeCleared
- ? service.getAlarms()
- : service.getActiveAlarms();
-
- final ObjectNode result = new ObjectMapper().createObjectNode();
- result.set("alarms",
- codec(Alarm.class).
- encode(alarms, this));
- return ok(result.toString()).build();
-
- }
-
- /**
- * Get specified alarm. Returns details of the specified alarm.
- *
- * @param id ONOS allocated identifier
- * @return JSON encoded alarm
- */
- @GET
- @Path("{id}")
- @Produces(MediaType.APPLICATION_JSON)
- public Response getAlarm(@PathParam("id") final String id) {
- log.info("HTTP GET alarm for id={}", id);
-
- final AlarmId alarmId = toAlarmId(id);
- final Alarm alarm = get(AlarmService.class).getAlarm(alarmId);
-
- final ObjectNode result = mapper().createObjectNode();
- result.set("alarm", codec(Alarm.class).encode(alarm, this));
- return ok(result.toString()).build();
- }
-
- /**
- * Update book-keeping fields on the alarm. Returns an up-to-date version of the alarm. Some of its fields may have
- * been updated since the REST client last retrieved the alarm being updated.
- *
- * @param alarmIdPath
- * @param stream input JSON
- * @return updated JSON encoded alarm
- */
- @PUT
- @Path("{alarm_id}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- public Response update(@PathParam("alarm_id") final String alarmIdPath, final InputStream stream) {
- log.info("PUT NEW ALARM at /{}", alarmIdPath);
-
- try {
- final ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
- log.info("jsonTree={}", jsonTree);
-
- final Alarm alarm = codec(Alarm.class).decode(jsonTree, this);
-
- final AlarmService service = get(AlarmService.class);
-
- if (Long.parseLong(alarmIdPath) != alarm.id().fingerprint()) {
- throw new IllegalArgumentException("id in path is " + Long.parseLong(alarmIdPath)
- + " but payload uses id=" + alarm.id().fingerprint());
-
- }
- final Alarm updated = service.update(alarm);
- final ObjectNode encoded = new AlarmCodec().encode(updated, this);
- return ok(encoded.toString()).build();
-
- } catch (IOException ioe) {
- throw new IllegalArgumentException(ioe);
- }
- }
-
- private static AlarmId toAlarmId(final String id) {
- try {
- return AlarmId.valueOf(Long.parseLong(id));
- } catch (NumberFormatException ex) {
- throw new IllegalArgumentException("Alarm id should be numeric", ex);
- }
-
- }
-
-}
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/package-info.java b/framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/package-info.java
deleted file mode 100644
index 9c291231..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/src/main/java/org/onosproject/faultmanagement/web/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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 web support.
- */
-package org.onosproject.faultmanagement.web;
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/src/main/webapp/WEB-INF/web.xml b/framework/src/onos/apps/faultmanagement/fmweb/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 18671f01..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-~ 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.
--->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- id="ONOS" version="2.5">
- <display-name>FM2 REST API v1.0</display-name>
-
- <servlet>
- <servlet-name>JAX-RS Service</servlet-name>
- <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
- <init-param>
- <param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
- <param-value>com.sun.jersey.api.core.ClassNamesResourceConfig</param-value>
- </init-param>
- <init-param>
- <param-name>com.sun.jersey.config.property.classnames</param-name>
- <param-value>
- org.onosproject.faultmanagement.web.AlarmsWebResource</param-value>
- </init-param>
- <load-on-startup>10</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>JAX-RS Service</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-</web-app>
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmCodecContext.java b/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmCodecContext.java
deleted file mode 100644
index 89886e8a..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmCodecContext.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.web;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
-
-/**
- * Mock codec context for use in codec unit tests.
- */
-public class AlarmCodecContext implements CodecContext {
-
- private final ObjectMapper mapper = new ObjectMapper();
- private final Map<Class<?>, JsonCodec> codecs = new ConcurrentHashMap<>();
-
- /**
- * Constructs a new mock codec context.
- */
- public AlarmCodecContext() {
- codecs.clear();
- registerCodec(Alarm.class, new AlarmCodec());
-
- }
-
- @Override
- public ObjectMapper mapper() {
- return mapper;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getService(Class<T> serviceClass) {
- // TODO
- return null;
- }
-
- /**
- * Registers the specified JSON codec for the given entity class.
- *
- * @param entityClass entity class
- * @param codec JSON codec
- * @param <T> entity type
- */
- public <T> void registerCodec(Class<T> entityClass, JsonCodec<T> codec) {
- codecs.putIfAbsent(entityClass, codec);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> JsonCodec<T> codec(Class<T> entityClass) {
- return codecs.get(entityClass);
- }
-}
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmCodecTest.java b/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmCodecTest.java
deleted file mode 100644
index 3009b99a..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmCodecTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.web;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.io.IOException;
-import java.io.InputStream;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.hamcrest.Matchers.nullValue;
-
-import org.junit.Test;
-import org.onosproject.codec.JsonCodec;
-import static org.onosproject.faultmanagement.web.AlarmJsonMatcher.matchesAlarm;
-import org.onosproject.net.DeviceId;
-import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmEntityId;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmId;
-import org.onosproject.incubator.net.faultmanagement.alarm.DefaultAlarm;
-
-public class AlarmCodecTest {
-
- private final AlarmCodecContext context = new AlarmCodecContext();
-
- // Use this to check handling for miminal Alarm
- private final Alarm alarmMinimumFields = new DefaultAlarm.Builder(
- new AlarmId(44),
- DeviceId.deviceId("of:2222000000000000"),
- "NE unreachable",
- Alarm.SeverityLevel.CLEARED,
- 1).
- build();
-
- // Use this to check handling for fully populated Alarm
- private final Alarm alarmWithSource = new DefaultAlarm.Builder(
- new AlarmId(44),
- DeviceId.deviceId("of:2222000000000000"),
- "NE unreachable",
- Alarm.SeverityLevel.CLEARED, 1).
- forSource(AlarmEntityId.alarmEntityId("port:1/2/3/4")).
- withTimeUpdated(2).
- withTimeCleared(3L).
- withServiceAffecting(true).
- withAcknowledged(true).
- withManuallyClearable(true).
- withAssignedUser("the assigned user").build();
-
- @Test
- public void alarmCodecTestWithOptionalFieldMissing() {
- //context.registerService(AlarmService.class, new AlarmServiceAdapter());
- final JsonCodec<Alarm> codec = context.codec(Alarm.class);
- assertThat(codec, is(notNullValue()));
-
- final ObjectNode alarmJson = codec.encode(alarmMinimumFields, context);
- assertThat(alarmJson, notNullValue());
- assertThat(alarmJson, matchesAlarm(alarmMinimumFields));
-
- }
-
- @Test
- public void alarmCodecTestWithOptionalField() {
- final JsonCodec<Alarm> codec = context.codec(Alarm.class);
- assertThat(codec, is(notNullValue()));
-
- final ObjectNode alarmJson = codec.encode(alarmWithSource, context);
- assertThat(alarmJson, notNullValue());
- assertThat(alarmJson, matchesAlarm(alarmWithSource));
-
- }
-
- @Test
- public void verifyMinimalAlarmIsEncoded() throws Exception {
- final JsonCodec<Alarm> alarmCodec = context.codec(Alarm.class);
-
- final Alarm alarm = getDecodedAlarm(alarmCodec, "alarm-minimal.json");
- assertCommon(alarm);
-
- assertThat(alarm.timeCleared(), nullValue());
- assertThat(alarm.assignedUser(), nullValue());
-
- }
-
- @Test
- public void verifyFullyLoadedAlarmIsEncoded() throws Exception {
- final JsonCodec<Alarm> alarmCodec = context.codec(Alarm.class);
-
- final Alarm alarm = getDecodedAlarm(alarmCodec, "alarm-full.json");
- assertCommon(alarm);
-
- assertThat(alarm.timeCleared(), is(2222L));
- assertThat(alarm.assignedUser(), is("foo"));
-
- }
-
- private void assertCommon(final Alarm alarm) {
- assertThat(alarm.id(), is(new AlarmId(10L)));
- assertThat(alarm.description(), is("NE is not reachable"));
- assertThat(alarm.source(), is(AlarmEntityId.NONE));
- assertThat(alarm.timeRaised(), is(999L));
- assertThat(alarm.timeUpdated(), is(1111L));
- assertThat(alarm.severity(), is(Alarm.SeverityLevel.MAJOR));
- assertThat(alarm.serviceAffecting(), is(true));
- assertThat(alarm.acknowledged(), is(false));
- assertThat(alarm.manuallyClearable(), is(true));
- }
-
- /**
- * Reads in a rule from the given resource and decodes it.
- *
- * @param resourceName resource to use to read the JSON for the rule
- * @return decoded flow rule
- * @throws IOException if processing the resource failsdecode
- */
- private Alarm getDecodedAlarm(final JsonCodec<Alarm> codec, final String resourceName) throws IOException {
- final InputStream jsonStream = AlarmCodecTest.class
- .getResourceAsStream(resourceName);
- final JsonNode json = context.mapper().readTree(jsonStream);
- assertThat(json, notNullValue());
- final Alarm result = codec.decode((ObjectNode) json, context);
- assertThat(result, notNullValue());
- return result;
- }
-
-
-}
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmJsonMatcher.java b/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmJsonMatcher.java
deleted file mode 100644
index 14bb45f3..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmJsonMatcher.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.web;
-
-import org.hamcrest.Description;
-import org.hamcrest.TypeSafeDiagnosingMatcher;
-import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Hamcrest matcher for alarms.
- */
-public final class AlarmJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode> {
-
- private final Alarm alarm;
-
- private AlarmJsonMatcher(final Alarm alarm) {
- this.alarm = alarm;
- }
-
- @Override
- public boolean matchesSafely(final JsonNode jsonAlarm, final Description description) {
- final String jsonAlarmId = jsonAlarm.get("id").asText();
- final String alarmId = Long.toString(alarm.id().fingerprint());
- if (!jsonAlarmId.equals(alarmId)) {
- description.appendText("alarm id was " + jsonAlarmId);
- return false;
- }
-
- final String jsonDeviceId = jsonAlarm.get("deviceId").asText();
- final String alarmDeviceId = alarm.deviceId().toString();
- if (!jsonDeviceId.equals(alarmDeviceId)) {
- description.appendText("DeviceId was " + jsonDeviceId);
- return false;
- }
-
-
- final String jsonDescription = jsonAlarm.get("description").asText();
- final String alarmDesc = alarm.description();
- if (!jsonDescription.equals(alarmDesc)) {
- description.appendText("description was " + jsonDescription);
- return false;
- }
-
- final long jsonTimeRaised = jsonAlarm.get("timeRaised").asLong();
- final long timeRaised = alarm.timeRaised();
- if (timeRaised != jsonTimeRaised) {
- description.appendText("timeRaised was " + jsonTimeRaised);
- return false;
- }
-
-
- final long jsonTimeUpdated = jsonAlarm.get("timeUpdated").asLong();
- final long timeUpdated = alarm.timeUpdated();
- if (timeUpdated != jsonTimeUpdated) {
- description.appendText("timeUpdated was " + jsonTimeUpdated);
- return false;
- }
-
- final JsonNode jsonTimeClearedNode = jsonAlarm.get("timeCleared");
-
- if (alarm.timeCleared() != null) {
- final Long jsonTimeCleared = jsonTimeClearedNode.longValue();
- final Long timeCleared = alarm.timeCleared();
-
- if (!timeCleared.equals(jsonTimeCleared)) {
- description.appendText("Time Cleared was " + jsonTimeCleared);
- return false;
- }
- } else {
- // No clear time not specified, JSON representation must be empty
- if (!jsonTimeClearedNode.isNull()) {
- description.appendText("Time Cleared should be null");
- return false;
- }
- }
-
- final String jsonSeverity = jsonAlarm.get("severity").asText();
- final String severity = alarm.severity().toString();
- if (!severity.equals(jsonSeverity)) {
- description.appendText("severity was " + jsonSeverity);
- return false;
- }
-
- final JsonNode jsonAlarmNode = jsonAlarm.get("source");
-
- if (alarm.source() != null) {
- final String jsonSource = jsonAlarmNode.textValue();
- final String source = alarm.source().toString();
-
- if (!source.equals(jsonSource)) {
- description.appendText("source was " + jsonSource);
- return false;
- }
- } else {
- // source not specified, JSON representation must be empty
- if (!jsonAlarmNode.isNull()) {
- description.appendText("source should be null");
- return false;
- }
- }
-
- // In progress
- return true;
- }
-
- @Override
- public void describeTo(final Description description) {
- description.appendText(alarm.toString());
- }
-
- /**
- * Factory to allocate a alarm matcher.
- *
- * @param alarm alarm object we are looking for
- * @return matcher
- */
- public static AlarmJsonMatcher matchesAlarm(final Alarm alarm) {
- return new AlarmJsonMatcher(alarm);
- }
-}
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmsWebResourceTest.java b/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmsWebResourceTest.java
deleted file mode 100644
index 0b7d9811..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/src/test/java/org/onosproject/faultmanagement/web/AlarmsWebResourceTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.web;
-
-import com.sun.jersey.api.client.WebResource;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.not;
-import org.junit.Ignore;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.osgi.TestServiceDirectory;
-import org.onlab.rest.BaseResource;
-import org.onosproject.codec.CodecService;
-import org.onosproject.codec.impl.CodecManager;
-import org.onosproject.rest.ResourceTest;
-
-/**
- * Test of the Fault Management Web REST API for Alarms.
- */
-public class AlarmsWebResourceTest extends ResourceTest {
-
- @Before
- public void setUp() {
-
- final CodecManager codecService = new CodecManager();
- codecService.activate();
-
- final ServiceDirectory testDirectory
- = new TestServiceDirectory()
- // Currently no alarms-service implemented
- // .add(AlarmsService.class, alarmsService)
- .add(CodecService.class, codecService);
- BaseResource.setServiceDirectory(testDirectory);
- }
-
- @Test
- @Ignore
- public void getAllAlarms() {
- final WebResource rs = resource();
- final String response = rs.path("/alarms").get(String.class);
- // Ensure hard-coded alarms returned okay
- assertThat(response, containsString("\"NE is not reachable\","));
- assertThat(response, containsString("\"Equipment Missing\","));
- }
-
- @Test
- @Ignore
- public void getAlarm() {
- final WebResource rs = resource();
- final String response = rs.path("/alarms/1").get(String.class);
- // Ensure hard-coded alarms returned okay
- assertThat(response, containsString("\"NE is not reachable\","));
- assertThat(response, not(containsString("\"Equipment Missing\",")));
- }
-
-}
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/src/test/resources/org/onosproject/faultmanagement/web/alarm-full.json b/framework/src/onos/apps/faultmanagement/fmweb/src/test/resources/org/onosproject/faultmanagement/web/alarm-full.json
deleted file mode 100644
index 215fc938..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/src/test/resources/org/onosproject/faultmanagement/web/alarm-full.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": 10,
- "deviceId": "of:123",
- "description": "NE is not reachable",
- "source": "none:none",
- "timeRaised": 999,
- "timeUpdated": 1111,
- "timeUpdated": 1111,
- "timeCleared": 2222,
- "severity": "MAJOR",
- "serviceAffecting": true,
- "acknowledged": false,
- "manuallyClearable": true,
- "assignedUser": "foo"
-} \ No newline at end of file
diff --git a/framework/src/onos/apps/faultmanagement/fmweb/src/test/resources/org/onosproject/faultmanagement/web/alarm-minimal.json b/framework/src/onos/apps/faultmanagement/fmweb/src/test/resources/org/onosproject/faultmanagement/web/alarm-minimal.json
deleted file mode 100644
index 4a24db09..00000000
--- a/framework/src/onos/apps/faultmanagement/fmweb/src/test/resources/org/onosproject/faultmanagement/web/alarm-minimal.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "id": 10,
- "deviceId": "of:123",
- "description": "NE is not reachable",
- "source": "none:none",
- "timeRaised": 999,
- "timeUpdated": 1111,
- "severity": "MAJOR",
- "serviceAffecting": true,
- "acknowledged": false,
- "manuallyClearable": true
-} \ No newline at end of file
diff --git a/framework/src/onos/apps/faultmanagement/pom.xml b/framework/src/onos/apps/faultmanagement/pom.xml
deleted file mode 100644
index 3ea3bc81..00000000
--- a/framework/src/onos/apps/faultmanagement/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2014 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-apps</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>onos-app-fm</artifactId>
- <packaging>pom</packaging>
-
- <description>ONOS framework applications</description>
-
- <modules>
- <module>fmmgr</module>
- <module>fmweb</module>
- <module>app</module>
- </modules>
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava-testlib</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>