ONOS-5554 Remove the BTI driver
Change-Id: I631fd8a84941b5d364d4120e17fbd2e0ac10d47b
diff --git a/drivers/bti/BUCK b/drivers/bti/BUCK
deleted file mode 100644
index da0ac30..0000000
--- a/drivers/bti/BUCK
+++ /dev/null
@@ -1,32 +0,0 @@
-COMPILE_DEPS = [
- '//lib:CORE_DEPS',
- '//protocols/snmp/api:onos-protocols-snmp-api',
- '//incubator/api:onos-incubator-api',
- '//lib:org.apache.servicemix.bundles.snmp4j',
- '//lib:snmp-core',
- '//lib:bti7000',
- '//lib:mibs-net-snmp',
- '//lib:joda-time',
-]
-
-TEST_DEPS = [
- '//lib:TEST_ADAPTERS',
- '//core/api:onos-api-tests',
-]
-
-# TODO ONOS-5554 excluding from the build
-# osgi_jar_with_tests (
-# deps = COMPILE_DEPS,
-# test_deps = TEST_DEPS,
-# resources_root = 'src/main/resources',
-# resources = glob(['src/main/resources/**']),
-# )
-#
-# onos_app (
-# app_name = 'org.onosproject.drivers.bti',
-# title = 'Bti Device Drivers',
-# category = 'Drivers',
-# url = 'http://onosproject.org',
-# description = 'ONOS Bti Device Drivers application.',
-# required_apps = [ 'org.onosproject.snmp' ],
-# )
diff --git a/drivers/bti/features.xml b/drivers/bti/features.xml
deleted file mode 100644
index 4b6b864..0000000
--- a/drivers/bti/features.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-
-<!--
- ~ Copyright 2016-present Open Networking Foundation
- ~
- ~ 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>
-
- <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
-
- <bundle>mvn:${project.groupId}/onos-snmp-api/${project.version}</bundle>
-
- <bundle>mvn:${project.groupId}/onos-incubator-api/${project.version}</bundle>
-
- </feature>
-</features>
diff --git a/drivers/bti/pom.xml b/drivers/bti/pom.xml
deleted file mode 100644
index cb09a14..0000000
--- a/drivers/bti/pom.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2016-present Open Networking Foundation
- ~
- ~ 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/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>onos-drivers-general</artifactId>
- <groupId>org.onosproject</groupId>
- <version>1.14.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>onos-drivers-bti</artifactId>
- <packaging>bundle</packaging>
-
- <properties>
- <onos.app.name>org.onosproject.drivers.bti</onos.app.name>
- <onos.app.origin>ON.Lab</onos.app.origin>
- <onos.app.category>Drivers</onos.app.category>
- <onos.app.title>Bti Device Drivers</onos.app.title>
- <onos.app.url>http://onosproject.org</onos.app.url>
- <onos.app.requires>
- org.onosproject.snmp
- </onos.app.requires>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-snmp-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-incubator-api</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/drivers/bti/src/main/java/org/onosproject/drivers/bti/Bti7000DeviceDescriptor.java b/drivers/bti/src/main/java/org/onosproject/drivers/bti/Bti7000DeviceDescriptor.java
deleted file mode 100644
index ab780b5..0000000
--- a/drivers/bti/src/main/java/org/onosproject/drivers/bti/Bti7000DeviceDescriptor.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.drivers.bti;
-
-import com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.I_Device;
-import com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0._OidRegistry;
-import com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System;
-import com.btisystems.pronx.ems.core.model.ClassRegistry;
-import com.btisystems.pronx.ems.core.model.IClassRegistry;
-import com.btisystems.pronx.ems.core.model.NetworkDevice;
-import com.btisystems.pronx.ems.core.snmp.ISnmpConfiguration;
-import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
-import com.btisystems.pronx.ems.core.snmp.V2cSnmpConfiguration;
-import com.google.common.collect.ImmutableList;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.SparseAnnotations;
-import org.onosproject.net.device.DefaultDeviceDescription;
-import org.onosproject.net.device.DeviceDescription;
-import org.onosproject.net.device.DeviceDescriptionDiscovery;
-import org.onosproject.net.device.DeviceService;
-import org.onosproject.net.device.PortDescription;
-import org.onosproject.net.driver.AbstractHandlerBehaviour;
-import org.onosproject.snmp.SnmpController;
-import org.onosproject.snmp.SnmpDevice;
-import org.slf4j.Logger;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Bti 7000 SNMP device description behaviour. Provides device description and port information.
- */
-public class Bti7000DeviceDescriptor extends AbstractHandlerBehaviour implements DeviceDescriptionDiscovery {
-
- private final Logger log = getLogger(getClass());
- protected static final IClassRegistry CLASS_REGISTRY =
- new ClassRegistry(_OidRegistry.oidRegistry, I_Device.class);
- private static final String UNKNOWN = "unknown";
-
- @Override
- public DeviceDescription discoverDeviceDetails() {
- SnmpController controller = checkNotNull(handler().get(SnmpController.class));
- DeviceId deviceId = handler().data().deviceId();
- SnmpDevice snmpDevice = controller.getDevice(deviceId);
- DeviceService deviceService = checkNotNull(handler().get(DeviceService.class));
- Device device = deviceService.getDevice(deviceId);
- DeviceDescription desc = null;
- String ipAddress = snmpDevice.getSnmpHost();
- int port = snmpDevice.getSnmpPort();
-
- ISnmpConfiguration config = new V2cSnmpConfiguration();
- config.setPort(port);
-
- try (ISnmpSession session = controller.getSession(deviceId)) {
- // Each session will be auto-closed.
- String deviceOid = session.identifyDevice();
- desc = populateDescription(session, device);
-
- } catch (IOException | RuntimeException ex) {
- log.error("Failed to walk device.", ex.getMessage());
- log.debug("Detailed problem was ", ex);
- }
- return desc;
- }
-
- @Override
- public List<PortDescription> discoverPortDetails() {
- //TODO implement
- return ImmutableList.of();
- }
-
- private DeviceDescription populateDescription(ISnmpSession session, Device device) {
- NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
- session.getAddress().getHostAddress());
- try {
- session.walkDevice(networkDevice, Collections.singletonList(CLASS_REGISTRY.getClassToOidMap().get(
- System.class)));
-
- com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System systemTree =
- (com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System)
- networkDevice.getRootObject().getEntity(CLASS_REGISTRY.getClassToOidMap().get(
- com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System.class));
- if (systemTree != null) {
- String[] systemComponents = systemTree.getSysDescr().split(";");
- return new DefaultDeviceDescription(device.id().uri(), device.type(),
- systemComponents[0], systemComponents[2],
- systemComponents[3], UNKNOWN, device.chassisId(),
- (SparseAnnotations) device.annotations());
- }
- } catch (IOException ex) {
- throw new IllegalArgumentException("Error reading details for device." + session.getAddress(), ex);
- }
- return null;
- }
-}
diff --git a/drivers/bti/src/main/java/org/onosproject/drivers/bti/Bti7000SnmpAlarmConsumer.java b/drivers/bti/src/main/java/org/onosproject/drivers/bti/Bti7000SnmpAlarmConsumer.java
deleted file mode 100644
index dcd0bfb..0000000
--- a/drivers/bti/src/main/java/org/onosproject/drivers/bti/Bti7000SnmpAlarmConsumer.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.drivers.bti;
-
-import com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.I_Device;
-import com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0._OidRegistry;
-import com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.btisystems.btiproducts.bti7000.objects.conditions.ActAlarmTable;
-import com.btisystems.mibbler.mibs.bti7000.interfaces.btisystems.btiproducts.bti7000.objects.conditions.IActAlarmTable;
-import com.btisystems.pronx.ems.core.model.ClassRegistry;
-import com.btisystems.pronx.ems.core.model.IClassRegistry;
-import com.btisystems.pronx.ems.core.model.NetworkDevice;
-import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
-import com.google.common.collect.ImmutableList;
-import org.apache.commons.lang.StringUtils;
-import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmConsumer;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmEntityId;
-import org.onosproject.incubator.net.faultmanagement.alarm.DefaultAlarm;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.driver.AbstractHandlerBehaviour;
-import org.onosproject.snmp.SnmpController;
-import org.slf4j.Logger;
-import org.snmp4j.smi.OctetString;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.List;
-import java.util.TimeZone;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * BTI 7000 specific implementation to provide a list of current alarms.
- */
-public class Bti7000SnmpAlarmConsumer extends AbstractHandlerBehaviour implements AlarmConsumer {
- private final Logger log = getLogger(getClass());
- protected static final IClassRegistry CLASS_REGISTRY = new ClassRegistry(_OidRegistry.oidRegistry, I_Device.class);
-
- static final int ALARM_SEVERITY_MINOR = 2;
- static final int ALARM_SEVERITY_MAJOR = 3;
- static final int ALARM_SEVERITY_CRITICAL = 4;
-
-
- private Alarm.SeverityLevel mapAlarmSeverity(int intAlarmSeverity) {
- Alarm.SeverityLevel mappedSeverity;
- switch (intAlarmSeverity) {
- case ALARM_SEVERITY_MINOR:
- mappedSeverity = Alarm.SeverityLevel.MINOR;
- break;
- case ALARM_SEVERITY_MAJOR:
- mappedSeverity = Alarm.SeverityLevel.MAJOR;
- break;
- case ALARM_SEVERITY_CRITICAL:
- mappedSeverity = Alarm.SeverityLevel.CRITICAL;
- break;
- default:
- mappedSeverity = Alarm.SeverityLevel.MINOR;
- log.warn("Unexpected alarm severity: {}", intAlarmSeverity);
- }
- return mappedSeverity;
- }
-
- /**
- * Converts an SNMP string representation into a {@link Date} object,
- * and applies time zone conversion to provide the time on the local machine, ie PSM server.
- *
- * @param actAlarmDateAndTime MIB-II DateAndTime formatted. May optionally contain
- * a timezone offset in 3 extra bytes
- * @param sysInfoTimeZone Must be supplied if actAlarmDateAndTime is just local time (with no timezone)
- * @param swVersion Must be supplied if actAlarmDateAndTime is just local time (with no timezone)
- * @return adjusted {@link Date} or a simple conversion if other fields are null.
- */
- public static Date getLocalDateAndTime(String actAlarmDateAndTime, String sysInfoTimeZone,
- String swVersion) {
- if (StringUtils.isBlank(actAlarmDateAndTime)) {
- return null;
- }
-
- GregorianCalendar decodedDateAndTimeCal = btiMakeCalendar(OctetString.fromHexString(actAlarmDateAndTime));
- if ((sysInfoTimeZone == null) || (swVersion == null)) {
- return decodedDateAndTimeCal.getTime();
- }
-
- TimeZone javaTimeZone = getTimeZone();
- decodedDateAndTimeCal.setTimeZone(javaTimeZone);
-
- GregorianCalendar localTime = new GregorianCalendar();
- localTime.setTimeInMillis(decodedDateAndTimeCal.getTimeInMillis());
-
- return localTime.getTime();
- }
-
- /**
- * This method is similar to SNMP4J approach with some fixes for the 11-bytes version (ie the one with timezone
- * offset).
- * <p>
- * For original makeCalendar refer @see http://www.snmp4j.org/agent/doc/org/snmp4j/agent/mo/snmp/DateAndTime.html
- * <p>
- * Creates a <code>GregorianCalendar</code> from a properly formatted SNMP4J DateAndTime <code>OctetString</code>.
- *
- * @param dateAndTimeValue an OctetString conforming to the DateAndTime TC.
- * @return the corresponding <code>GregorianCalendar</code> instance.
- */
- public static GregorianCalendar btiMakeCalendar(OctetString dateAndTimeValue) {
- int year = (dateAndTimeValue.get(0) & 0xFF) * 256
- + (dateAndTimeValue.get(1) & 0xFF);
- int month = (dateAndTimeValue.get(2) & 0xFF);
- int date = (dateAndTimeValue.get(3) & 0xFF);
- int hour = (dateAndTimeValue.get(4) & 0xFF);
- int minute = (dateAndTimeValue.get(5) & 0xFF);
- int second = (dateAndTimeValue.get(6) & 0xFF);
- int deci = (dateAndTimeValue.get(7) & 0xFF);
- GregorianCalendar gc =
- new GregorianCalendar(year, month - 1, date, hour, minute, second);
- gc.set(Calendar.MILLISECOND, deci * 100);
-
- if (dateAndTimeValue.length() == 11) {
- char directionOfOffset = (char) dateAndTimeValue.get(8);
- int hoursOffset = directionOfOffset == '+'
- ? dateAndTimeValue.get(9) : -dateAndTimeValue.get(9);
- org.joda.time.DateTimeZone offset =
- org.joda.time.DateTimeZone.forOffsetHoursMinutes(hoursOffset, dateAndTimeValue.get(10));
- org.joda.time.DateTime dt =
- new org.joda.time.DateTime(year, month, date, hour, minute, second, offset);
- return dt.toGregorianCalendar();
- }
- return gc;
- }
-
- private static TimeZone getTimeZone() {
- return Calendar.getInstance().getTimeZone();
- }
-
- @Override
- public List<Alarm> consumeAlarms() {
- SnmpController controller = checkNotNull(handler().get(SnmpController.class));
- ISnmpSession session;
- List<Alarm> alarms = new ArrayList<>();
- DeviceId deviceId = handler().data().deviceId();
- try {
- session = controller.getSession(deviceId);
- log.debug("Getting alarms for BTI 7000 device at {}", deviceId);
- NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
- session.getAddress().getHostAddress());
- session.walkDevice(networkDevice, Collections.singletonList(
- CLASS_REGISTRY.getClassToOidMap().get(ActAlarmTable.class)));
-
- IActAlarmTable deviceAlarms = (IActAlarmTable) networkDevice.getRootObject()
- .getEntity(CLASS_REGISTRY.getClassToOidMap().get(ActAlarmTable.class));
- if ((deviceAlarms != null) && (deviceAlarms.getActAlarmEntry() != null)
- && (!deviceAlarms.getActAlarmEntry().isEmpty())) {
-
- deviceAlarms.getActAlarmEntry().values().forEach((alarm) -> {
- DefaultAlarm.Builder alarmBuilder = new DefaultAlarm.Builder(
- deviceId, alarm.getActAlarmDescription(),
- mapAlarmSeverity(alarm.getActAlarmSeverity()),
- getLocalDateAndTime(alarm.getActAlarmDateAndTime(), null, null).getTime())
- .forSource(AlarmEntityId.alarmEntityId("other:" + alarm.getActAlarmInstanceIdx()));
- alarms.add(alarmBuilder.build());
- });
-
- }
- log.debug("Conditions retrieved: {}", deviceAlarms);
-
- } catch (IOException ex) {
- log.error("Error reading alarms for device {}.", deviceId, ex);
- alarms.add(controller.buildWalkFailedAlarm(deviceId));
-
- }
-
- return ImmutableList.copyOf(alarms);
- }
-}
diff --git a/drivers/bti/src/main/java/org/onosproject/drivers/bti/BtiDriversLoader.java b/drivers/bti/src/main/java/org/onosproject/drivers/bti/BtiDriversLoader.java
deleted file mode 100644
index d048b1b..0000000
--- a/drivers/bti/src/main/java/org/onosproject/drivers/bti/BtiDriversLoader.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.drivers.bti;
-
-import org.apache.felix.scr.annotations.Component;
-import org.onosproject.net.driver.AbstractDriverLoader;
-
-/**
- * Loader for BTI device drivers.
- */
-@Component(immediate = true)
-public class BtiDriversLoader extends AbstractDriverLoader {
-
- public BtiDriversLoader() {
- super("/bti-drivers.xml");
- }
-}
diff --git a/drivers/bti/src/main/java/org/onosproject/drivers/bti/NetSnmpAlarmConsumer.java b/drivers/bti/src/main/java/org/onosproject/drivers/bti/NetSnmpAlarmConsumer.java
deleted file mode 100644
index e2e479e..0000000
--- a/drivers/bti/src/main/java/org/onosproject/drivers/bti/NetSnmpAlarmConsumer.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.drivers.bti;
-
-import com.btisystems.mibbler.mibs.netsnmp.netsnmp.I_Device;
-import com.btisystems.mibbler.mibs.netsnmp.netsnmp._OidRegistry;
-import com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.interfaces.IfTable;
-import com.btisystems.pronx.ems.core.model.ClassRegistry;
-import com.btisystems.pronx.ems.core.model.IClassRegistry;
-import com.btisystems.pronx.ems.core.model.NetworkDevice;
-import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
-import com.google.common.collect.ImmutableList;
-import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmConsumer;
-import org.onosproject.incubator.net.faultmanagement.alarm.AlarmEntityId;
-import org.onosproject.incubator.net.faultmanagement.alarm.DefaultAlarm;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.driver.AbstractHandlerBehaviour;
-import org.onosproject.snmp.SnmpController;
-import org.slf4j.Logger;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Net SNMP specific implementation to provide a list of current alarms.
- */
-public class NetSnmpAlarmConsumer extends AbstractHandlerBehaviour implements AlarmConsumer {
- private final Logger log = getLogger(getClass());
- protected static final IClassRegistry CLASS_REGISTRY =
- new ClassRegistry(_OidRegistry.oidRegistry, I_Device.class);
-
- @Override
- public List<Alarm> consumeAlarms() {
- SnmpController controller = checkNotNull(handler().get(SnmpController.class));
- List<Alarm> alarms = new ArrayList<>();
- ISnmpSession session;
- DeviceId deviceId = handler().data().deviceId();
- try {
- session = controller.getSession(deviceId);
-
- NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
- session.getAddress()
- .getHostAddress());
- session.walkDevice(networkDevice, Collections.singletonList(
- CLASS_REGISTRY.getClassToOidMap().get(IfTable.class)));
-
- IfTable interfaceTable = (IfTable) networkDevice.getRootObject()
- .getEntity(CLASS_REGISTRY.getClassToOidMap().get(IfTable.class));
- if (interfaceTable != null) {
- interfaceTable.getEntries().values().forEach((ifEntry) -> {
- if (ifEntry.getIfAdminStatus() == 1 && ifEntry.getIfOperStatus() == 2) {
- alarms.add(new DefaultAlarm.Builder(deviceId, "Link Down.",
- Alarm.SeverityLevel.CRITICAL,
- System.currentTimeMillis())
- .forSource(AlarmEntityId
- .alarmEntityId("port:" + ifEntry.
- getIfDescr())).build());
- }
- log.debug("Interface: " + ifEntry);
- });
- }
- } catch (IOException ex) {
- log.error("Error reading alarms for device {}.", deviceId, ex);
- alarms.add(controller.buildWalkFailedAlarm(deviceId));
- }
- return ImmutableList.copyOf(alarms);
- }
-}
diff --git a/drivers/bti/src/main/java/org/onosproject/drivers/bti/NetSnmpDeviceDescriptor.java b/drivers/bti/src/main/java/org/onosproject/drivers/bti/NetSnmpDeviceDescriptor.java
deleted file mode 100644
index 9aa648e..0000000
--- a/drivers/bti/src/main/java/org/onosproject/drivers/bti/NetSnmpDeviceDescriptor.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.drivers.bti;
-
-import com.btisystems.mibbler.mibs.netsnmp.netsnmp.I_Device;
-import com.btisystems.mibbler.mibs.netsnmp.netsnmp._OidRegistry;
-import com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System;
-import com.btisystems.pronx.ems.core.model.ClassRegistry;
-import com.btisystems.pronx.ems.core.model.IClassRegistry;
-import com.btisystems.pronx.ems.core.model.NetworkDevice;
-import com.btisystems.pronx.ems.core.snmp.ISnmpConfiguration;
-import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
-import com.btisystems.pronx.ems.core.snmp.V2cSnmpConfiguration;
-import com.google.common.collect.ImmutableList;
-import org.apache.commons.lang.StringUtils;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.SparseAnnotations;
-import org.onosproject.net.device.DefaultDeviceDescription;
-import org.onosproject.net.device.DeviceDescription;
-import org.onosproject.net.device.DeviceDescriptionDiscovery;
-import org.onosproject.net.device.DeviceService;
-import org.onosproject.net.device.PortDescription;
-import org.onosproject.net.driver.AbstractHandlerBehaviour;
-import org.onosproject.snmp.SnmpController;
-import org.onosproject.snmp.SnmpDevice;
-import org.slf4j.Logger;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Net SNMP device description behaviour. Provides device description and port information.
- */
-public class NetSnmpDeviceDescriptor extends AbstractHandlerBehaviour implements DeviceDescriptionDiscovery {
- private final Logger log = getLogger(getClass());
- protected static final IClassRegistry CLASS_REGISTRY =
- new ClassRegistry(_OidRegistry.oidRegistry, I_Device.class);
- private static final String UNKNOWN = "unknown";
-
-
- //TODO evaluate a common abstract class for all Snmp description discovery
- @Override
- public DeviceDescription discoverDeviceDetails() {
- SnmpController controller = checkNotNull(handler().get(SnmpController.class));
- DeviceId deviceId = handler().data().deviceId();
- SnmpDevice snmpDevice = controller.getDevice(deviceId);
- DeviceService deviceService = checkNotNull(handler().get(DeviceService.class));
- Device device = deviceService.getDevice(deviceId);
- DeviceDescription desc = null;
- String ipAddress = snmpDevice.getSnmpHost();
- int port = snmpDevice.getSnmpPort();
-
- ISnmpConfiguration config = new V2cSnmpConfiguration();
- config.setPort(port);
-
- try (ISnmpSession session = controller.getSession(deviceId)) {
- // Each session will be auto-closed.
- String deviceOid = session.identifyDevice();
- //TODO obtain desctiption
- desc = populateDescription(session, device);
-
- } catch (IOException | RuntimeException ex) {
- log.error("Failed to walk device.", ex.getMessage());
- log.debug("Detailed problem was ", ex);
- }
-
- return desc;
- }
-
- @Override
- public List<PortDescription> discoverPortDetails() {
- //TODO implement
- return ImmutableList.of();
- }
-
- private DeviceDescription populateDescription(ISnmpSession session, Device device) {
- NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
- session.getAddress().getHostAddress());
- try {
- session.walkDevice(networkDevice, Collections.singletonList(CLASS_REGISTRY.getClassToOidMap().get(
- System.class)));
-
- com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System systemTree =
- (com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System)
- networkDevice.getRootObject().getEntity(CLASS_REGISTRY.getClassToOidMap().get(
- com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System.class));
- if (systemTree != null) {
- // TODO SNMP sys-contacts may be verbose; ONOS-GUI doesn't abbreviate fields neatly;
- // so cut it here until supported in prop displayer
- String manufacturer = StringUtils.abbreviate(systemTree.getSysContact(), 20);
- return new DefaultDeviceDescription(device.id().uri(), device.type(),
- manufacturer, UNKNOWN, UNKNOWN, UNKNOWN,
- device.chassisId(), (SparseAnnotations) device.annotations());
- }
- } catch (IOException ex) {
- throw new IllegalArgumentException("Error reading details for device." + session.getAddress(), ex);
- }
- return null;
- }
-}
diff --git a/drivers/bti/src/main/java/org/onosproject/drivers/bti/package-info.java b/drivers/bti/src/main/java/org/onosproject/drivers/bti/package-info.java
deleted file mode 100644
index 0f31287..0000000
--- a/drivers/bti/src/main/java/org/onosproject/drivers/bti/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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 for BTI device drivers.
- */
-package org.onosproject.drivers.bti;
\ No newline at end of file
diff --git a/drivers/bti/src/main/resources/bti-drivers.xml b/drivers/bti/src/main/resources/bti-drivers.xml
deleted file mode 100644
index a132e95..0000000
--- a/drivers/bti/src/main/resources/bti-drivers.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ Copyright 2016-present Open Networking Foundation
- ~
- ~ 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.
- -->
-<drivers>
- <driver name="bti7000" manufacturer="bti" hwVersion="1.0.0" swVersion="1.0.0">
- <behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery"
- impl="org.onosproject.drivers.bti.Bti7000DeviceDescriptor"/>
- <behaviour api="org.onosproject.incubator.net.faultmanagement.alarm.AlarmConsumer"
- impl="org.onosproject.drivers.bti.Bti7000SnmpAlarmConsumer"/>
- </driver>
- <driver name="NetSnmp" manufacturer="bti" hwVersion="1.0.0" swVersion="1.0.0">
- <behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery"
- impl="org.onosproject.drivers.bti.NetSnmpDeviceDescriptor"/>
- <behaviour api="org.onosproject.incubator.net.faultmanagement.alarm.AlarmConsumer"
- impl="org.onosproject.drivers.bti.NetSnmpAlarmConsumer"/>
- </driver>
-</drivers>
-
diff --git a/drivers/bti/src/test/java/org/onosproject/drivers/bti/BtiDriversLoaderTest.java b/drivers/bti/src/test/java/org/onosproject/drivers/bti/BtiDriversLoaderTest.java
deleted file mode 100644
index b90c82e..0000000
--- a/drivers/bti/src/test/java/org/onosproject/drivers/bti/BtiDriversLoaderTest.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.onosproject.drivers.bti;
-
-
-import org.junit.Before;
-import org.onosproject.net.driver.AbstractDriverLoaderTest;
-
-/**
- * BTI Drivers loader test.
- */
-public class BtiDriversLoaderTest extends AbstractDriverLoaderTest {
-
- @Before
- public void setUp() {
- loader = new BtiDriversLoader();
- }
-}
diff --git a/lib/BUCK b/lib/BUCK
index 409182c..6a2971d 100644
--- a/lib/BUCK
+++ b/lib/BUCK
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Tue, 22 May 2018 17:57:55 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Thu, 24 May 2018 16:00:10 GMT. Do not edit this file manually. *****
# ***** Use onos-lib-gen *****
pass_thru_pom(
@@ -1266,15 +1266,6 @@
)
remote_jar (
- name = 'bti7000',
- out = 'mibbler-mibs-bti7000-1.0-20151221.1.jar',
- url = 'mvn:org.onosproject:mibbler-mibs-bti7000:jar:1.0-20151221.1',
- sha1 = 'aebb218bd04e29d8a1ea9036de715919bb7a73e5',
- maven_coords = 'org.onosproject:mibbler-mibs-bti7000:1.0-20151221.1',
- visibility = [ 'PUBLIC' ],
-)
-
-remote_jar (
name = 'mibs-net-snmp',
out = 'mibbler-mibs-net-snmp-1.0-20151221.1.jar',
url = 'mvn:org.onosproject:mibbler-mibs-net-snmp:jar:1.0-20151221.1',
diff --git a/lib/deps.json b/lib/deps.json
index 2ffee82..d62dbf2 100644
--- a/lib/deps.json
+++ b/lib/deps.json
@@ -238,7 +238,6 @@
"repo": "https://oss.sonatype.org/content/repositories/snapshots"
},
"snmp-core": "mvn:org.onosproject:snmp-core:1.3-20161021.1",
- "bti7000": "mvn:org.onosproject:mibbler-mibs-bti7000:1.0-20151221.1",
"mibs-net-snmp": "mvn:org.onosproject:mibbler-mibs-net-snmp:1.0-20151221.1",
"mibs-rfc": "mvn:org.onosproject:mibbler-mibs-rfc:1.0-20151221.1",
diff --git a/modules.defs b/modules.defs
index 3de0fea..5f9354b 100644
--- a/modules.defs
+++ b/modules.defs
@@ -90,8 +90,6 @@
# Drivers
'//drivers/default:onos-drivers-default-oar',
'//drivers/arista:onos-drivers-arista-oar',
- # TODO ONOS-5554 excluding from the build
- #'//drivers/bti:onos-drivers-bti-oar',
'//drivers/ciena/waveserver:onos-drivers-ciena-waveserver-oar',
'//drivers/ciena/c5162:onos-drivers-ciena-c5162-oar',
'//drivers/ciena/c5170:onos-drivers-ciena-c5170-oar',
diff --git a/protocols/snmp/api/BUCK b/protocols/snmp/api/BUCK
index eec6b2f..067c6ea 100644
--- a/protocols/snmp/api/BUCK
+++ b/protocols/snmp/api/BUCK
@@ -3,7 +3,6 @@
'//incubator/api:onos-incubator-api',
'//lib:org.apache.servicemix.bundles.snmp4j',
'//lib:snmp-core',
- '//lib:bti7000',
'//lib:mibs-net-snmp',
'//lib:mibs-rfc',
]
diff --git a/protocols/snmp/ctl/BUCK b/protocols/snmp/ctl/BUCK
index 7ba20f6..b4357e1 100644
--- a/protocols/snmp/ctl/BUCK
+++ b/protocols/snmp/ctl/BUCK
@@ -4,7 +4,6 @@
'//protocols/snmp/api:onos-protocols-snmp-api',
'//lib:org.apache.servicemix.bundles.snmp4j',
'//lib:snmp-core',
- '//lib:bti7000',
'//lib:mibs-net-snmp',
'//lib:mibs-rfc',
]
diff --git a/providers/snmp/BUCK b/providers/snmp/BUCK
index 15d6202..24d8a97 100644
--- a/providers/snmp/BUCK
+++ b/providers/snmp/BUCK
@@ -5,7 +5,6 @@
'//lib:org.apache.servicemix.bundles.snmp4j',
'//lib:mibs-rfc',
'//lib:snmp-core',
- '//lib:bti7000',
'//lib:mibs-net-snmp',
]
diff --git a/providers/snmp/device/BUCK b/providers/snmp/device/BUCK
index c9c49de..317784e 100644
--- a/providers/snmp/device/BUCK
+++ b/providers/snmp/device/BUCK
@@ -3,7 +3,6 @@
'//lib:JACKSON',
'//lib:org.apache.servicemix.bundles.snmp4j',
'//lib:snmp-core',
- '//lib:bti7000',
'//lib:mibs-net-snmp',
'//lib:mibs-rfc',
'//incubator/api:onos-incubator-api',