Package org.opennms.web.rest.v1
Class SnmpConfigRestService
- java.lang.Object
-
- org.opennms.web.rest.v1.OnmsRestService
-
- org.opennms.web.rest.v1.SnmpConfigRestService
-
@Component("snmpConfigRestService") @Transactional public class SnmpConfigRestService extends OnmsRestService
REST service to the OpenNMS SNMP configuration
snmp-config.xml
This current implementation setting and getting all parameters which are in snmp-config.xml
Be aware that setting the SNMP configuration for a rage of IPs is currently not supported by this REST service!The implementation only supports a PUT request because it is an implied "Update" of the configuration since it requires an IP address and all IPs have a default configuration. This request is is passed to the factory for optimization of the configuration store:
snmp-config.xml
.Example 1: Change SNMP configuration.
curl -v -X PUT -H "Content-Type: application/xml" \ -H "Accept: application/xml" \ -d "<snmp-info> <community>yRuSonoZ</community> <port>161</port> <retries>1</retries> <timeout>2000</timeout> <version>v2c</version> </snmp-info>" \ -u admin:admin http://localhost:8980/opennms/rest/snmpConfig/10.1.1.1
Example 2: Query SNMP community string.
curl -v -X GET -u admin:admin http://localhost:8980/opennms/rest/snmpConfig/10.1.1.1
- Since:
- 1.8.1
- Version:
- $Id: $
- Author:
- Mathew Brozowski
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opennms.web.rest.v1.OnmsRestService
OnmsRestService.ComparisonOperation
-
-
Field Summary
-
Fields inherited from class org.opennms.web.rest.v1.OnmsRestService
DEFAULT_LIMIT
-
-
Constructor Summary
Constructors Constructor Description SnmpConfigRestService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static String[]
getAddresses(String input)
SnmpInfo
getSnmpInfo(String ipAddr, String location)
getSnmpInfojavax.ws.rs.core.Response
setSnmpInfo(String ipAddress, SnmpInfo snmpInfo)
setSnmpInfoprotected void
tearDown()
javax.ws.rs.core.Response
updateInterface(String ipAddress, MultivaluedMapImpl params)
Updates a specific interface-
Methods inherited from class org.opennms.web.rest.v1.OnmsRestService
applyQueryFilters, applyQueryFilters, getBadRequestResponse, getBeanWrapperForClass, getException, getException, getNumericValue, getRedirectUri, readLock, readUnlock, removeParameter, removeParameter, setProperties, writeLock, writeUnlock
-
-
-
-
Method Detail
-
tearDown
@PreDestroy protected void tearDown()
-
getSnmpInfo
public SnmpInfo getSnmpInfo(String ipAddr, String location)
getSnmpInfo
- Parameters:
ipAddr
- aString
object.- Returns:
- a
org.opennms.web.snmpinfo.SnmpInfo
object.
-
setSnmpInfo
public javax.ws.rs.core.Response setSnmpInfo(String ipAddress, SnmpInfo snmpInfo)
setSnmpInfo
- Parameters:
ipAddress
- aString
object.snmpInfo
- aorg.opennms.web.snmpinfo.SnmpInfo
object.- Returns:
- a
Response
object.
-
updateInterface
@Transactional public javax.ws.rs.core.Response updateInterface(String ipAddress, MultivaluedMapImpl params)
Updates a specific interface- Parameters:
ipAddress
- aString
object.params
- aMultivaluedMapImpl
object.- Returns:
- a
Response
object.
-
-