@Component(value="requisitionRestService") public class RequisitionRestService extends OnmsRestService
RESTful service to the OpenNMS Provisioning Groups. In this API, these "groups" of nodes are aptly named and treated as requisitions.
This current implementation supports CRUD operations for managing provisioning requisitions. Requisitions are first POSTed and no provisioning (import) operations are taken. This is done so that a) the XML can be verified and b) so that the operations can happen at a later time. They are moved to the deployed state (put in the active requisition repository) when an import is run.
Example 1: Create a new requisition Note: The foreign-source attribute typically has a 1 to 1 relationship to a provisioning group and to the name used in this requisition. The relationship is implied by name and it is best practice to use the same for all three. If a foreign source definition exists with the same name, it will be used during the provisioning (import) operations in lieu of the default foreign source
curl -X POST \ -H "Content-Type: application/xml" \ -d "<?xml version="1.0" encoding="UTF-8"?> <model-import xmlns="http://xmlns.opennms.org/xsd/config/model-import" date-stamp="2009-03-07T17:56:53.123-05:00" last-import="2009-03-07T17:56:53.117-05:00" foreign-source="site1"> <node node-label="p-brane" foreign-id="1" > <interface ip-addr="10.0.1.3" descr="en1" status="1" snmp-primary="P"> <monitored-service service-name="ICMP"/> <monitored-service service-name="SNMP"/> </interface> <category name="Production"/> <category name="Routers"/> </node> </model-import>" \ -u admin:admin \ http://localhost:8980/opennms/rest/requisitions
Example 2: Query all deployed requisitions
curl -X GET \ -H "Content-Type: application/xml" \ -u admin:admin \ http://localhost:8980/opennms/rest/requisitions/deployed \ 2>/dev/null \ |xmllint --format -
OnmsRestService.ComparisonOperation
DEFAULT_LIMIT
Constructor and Description |
---|
RequisitionRestService() |
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Response |
addOrReplaceInterface(javax.ws.rs.core.UriInfo uriInfo,
String foreignSource,
String foreignId,
RequisitionInterface iface)
Updates or adds an interface to a node
|
javax.ws.rs.core.Response |
addOrReplaceNode(javax.ws.rs.core.UriInfo uriInfo,
String foreignSource,
RequisitionNode node)
Updates or adds a node to a requisition
|
javax.ws.rs.core.Response |
addOrReplaceNodeAssetParameter(javax.ws.rs.core.UriInfo uriInfo,
String foreignSource,
String foreignId,
RequisitionAsset asset)
Updates or adds an asset parameter to a node
|
javax.ws.rs.core.Response |
addOrReplaceNodeCategory(javax.ws.rs.core.UriInfo uriInfo,
String foreignSource,
String foreignId,
RequisitionCategory category)
Updates or adds a category to a node
|
javax.ws.rs.core.Response |
addOrReplaceRequisition(javax.ws.rs.core.UriInfo uriInfo,
Requisition requisition)
Updates or adds a complete requisition with foreign source "foreignSource"
|
javax.ws.rs.core.Response |
addOrReplaceService(javax.ws.rs.core.UriInfo uriInfo,
String foreignSource,
String foreignId,
String ipAddress,
RequisitionMonitoredService service)
Updates or adds a service to an interface
|
javax.ws.rs.core.Response |
deleteAssetParameter(String foreignSource,
String foreignId,
String parameter)
deleteAssetParameter
|
javax.ws.rs.core.Response |
deleteCategory(String foreignSource,
String foreignId,
String category)
deleteCategory
|
javax.ws.rs.core.Response |
deleteDeployedRequisition(String foreignSource)
Deletes the deployed requisition with foreign source "foreignSource"
|
javax.ws.rs.core.Response |
deleteInterface(String foreignSource,
String foreignId,
String ipAddress)
deleteInterface
|
javax.ws.rs.core.Response |
deleteInterfaceService(String foreignSource,
String foreignId,
String ipAddress,
String service)
deleteInterfaceService
|
javax.ws.rs.core.Response |
deleteNode(String foreignSource,
String foreignId)
Delete the node with the given foreign ID for the specified foreign source
|
javax.ws.rs.core.Response |
deletePendingRequisition(String foreignSource)
Deletes the pending requisition with foreign source "foreignSource"
|
RequisitionAsset |
getAssetParameter(String foreignSource,
String foreignId,
String parameter)
Returns the requested category for a given node in the specified foreign source
|
RequisitionAssetCollection |
getAssetParameters(String foreignSource,
String foreignId)
Returns a collection of assets for a given node in the specified foreign source
|
RequisitionCategoryCollection |
getCategories(String foreignSource,
String foreignId)
Returns a collection of categories for a given node in the specified foreign source
|
RequisitionCategory |
getCategory(String foreignSource,
String foreignId,
String category)
Returns the requested category for a given node in the specified foreign source
|
String |
getDeployedCount()
get a plain text numeric string of the number of deployed requisitions
|
RequisitionCollection |
getDeployedRequisitions()
Get all the deployed requisitions
|
DeployedStats |
getDeployedStats()
get the statistics for the deployed requisitions
|
DeployedRequisitionStats |
getDeployedStats(String foreignSource)
get the statistics for a given deployed requisition
|
String |
getForeignSourceRepositoryStrategy()
get a plain text with the current selected foreign source repository strategy
|
RequisitionInterface |
getInterfaceForNode(String foreignSource,
String foreignId,
String ipAddress)
Returns the interface with the given foreign source/foreignid/ipaddress combination.
|
RequisitionInterfaceCollection |
getInterfacesForNode(String foreignSource,
String foreignId)
Returns a collection of interfaces for a given node in the specified foreign source
|
RequisitionNode |
getNode(String foreignSource,
String foreignId)
Returns the node with the foreign ID specified for the given foreign source
|
RequisitionNodeCollection |
getNodes(String foreignSource)
Returns all nodes for a given requisition
|
String |
getPendingCount()
get a plain text numeric string of the number of pending requisitions
|
Requisition |
getRequisition(String foreignSource)
getRequisition
|
RequisitionCollection |
getRequisitions()
Get all the pending requisitions
|
RequisitionMonitoredService |
getServiceForInterface(String foreignSource,
String foreignId,
String ipAddress,
String service)
Returns a service for a given foreignSource/foreignId/interface/service-name combination.
|
RequisitionMonitoredServiceCollection |
getServicesForInterface(String foreignSource,
String foreignId,
String ipAddress)
Returns a collection of services for a given foreignSource/foreignId/interface combination.
|
javax.ws.rs.core.Response |
importRequisition(javax.ws.rs.core.UriInfo uriInfo,
String foreignSource,
String rescanExisting)
importRequisition
|
protected void |
tearDown() |
javax.ws.rs.core.Response |
updateInterface(javax.ws.rs.core.UriInfo uriInfo,
String foreignSource,
String foreignId,
String ipAddress,
MultivaluedMapImpl params)
Updates a specific interface
|
javax.ws.rs.core.Response |
updateNode(javax.ws.rs.core.UriInfo uriInfo,
String foreignSource,
String foreignId,
MultivaluedMapImpl params)
Updates the node with foreign id "foreignId" in foreign source "foreignSource"
|
javax.ws.rs.core.Response |
updateRequisition(javax.ws.rs.core.UriInfo uriInfo,
String foreignSource,
MultivaluedMapImpl params)
Updates the requisition with foreign source "foreignSource"
|
applyQueryFilters, applyQueryFilters, getBadRequestResponse, getBeanWrapperForClass, getException, getException, getNumericValue, getRedirectUri, readLock, readUnlock, removeParameter, removeParameter, setProperties, writeLock, writeUnlock
@PreDestroy protected void tearDown()
public String getDeployedCount()
public DeployedStats getDeployedStats()
public DeployedRequisitionStats getDeployedStats(String foreignSource)
public String getForeignSourceRepositoryStrategy()
public RequisitionCollection getDeployedRequisitions() throws ParseException
RequisitionCollection
object.ParseException
- if any.public RequisitionCollection getRequisitions() throws ParseException
RequisitionCollection
object.ParseException
- if any.public String getPendingCount()
public Requisition getRequisition(String foreignSource)
getRequisition
foreignSource
- a String
object.Requisition
object.public RequisitionNodeCollection getNodes(String foreignSource) throws ParseException
foreignSource
- a String
object.RequisitionNodeCollection
object.ParseException
- if any.public RequisitionNode getNode(String foreignSource, String foreignId) throws ParseException
foreignSource
- a String
object.foreignId
- a String
object.RequisitionNode
object.ParseException
- if any.public RequisitionInterfaceCollection getInterfacesForNode(String foreignSource, String foreignId) throws ParseException
foreignSource
- a String
object.foreignId
- a String
object.RequisitionInterfaceCollection
object.ParseException
- if any.public RequisitionInterface getInterfaceForNode(String foreignSource, String foreignId, String ipAddress) throws ParseException
foreignSource
- a String
object.foreignId
- a String
object.ipAddress
- a String
object.RequisitionInterface
object.ParseException
- if any.public RequisitionMonitoredServiceCollection getServicesForInterface(String foreignSource, String foreignId, String ipAddress) throws ParseException
foreignSource
- a String
object.foreignId
- a String
object.ipAddress
- a String
object.RequisitionMonitoredServiceCollection
object.ParseException
- if any.public RequisitionMonitoredService getServiceForInterface(String foreignSource, String foreignId, String ipAddress, String service) throws ParseException
foreignSource
- a String
object.foreignId
- a String
object.ipAddress
- a String
object.service
- a String
object.RequisitionMonitoredService
object.ParseException
- if any.public RequisitionCategoryCollection getCategories(String foreignSource, String foreignId) throws ParseException
foreignSource
- a String
object.foreignId
- a String
object.RequisitionCategoryCollection
object.ParseException
- if any.public RequisitionCategory getCategory(String foreignSource, String foreignId, String category) throws ParseException
foreignSource
- a String
object.foreignId
- a String
object.category
- a String
object.RequisitionCategory
object.ParseException
- if any.public RequisitionAssetCollection getAssetParameters(String foreignSource, String foreignId) throws ParseException
foreignSource
- a String
object.foreignId
- a String
object.RequisitionAssetCollection
object.ParseException
- if any.public RequisitionAsset getAssetParameter(String foreignSource, String foreignId, String parameter) throws ParseException
foreignSource
- a String
object.foreignId
- a String
object.parameter
- a String
object.RequisitionAsset
object.ParseException
- if any.@Transactional public javax.ws.rs.core.Response addOrReplaceRequisition(@Context javax.ws.rs.core.UriInfo uriInfo, Requisition requisition)
requisition
- a Requisition
object.Response
object.@Transactional public javax.ws.rs.core.Response addOrReplaceNode(@Context javax.ws.rs.core.UriInfo uriInfo, String foreignSource, RequisitionNode node)
foreignSource
- a String
object.node
- a RequisitionNode
object.Response
object.@Transactional public javax.ws.rs.core.Response addOrReplaceInterface(@Context javax.ws.rs.core.UriInfo uriInfo, String foreignSource, String foreignId, RequisitionInterface iface)
foreignSource
- a String
object.foreignId
- a String
object.iface
- a RequisitionInterface
object.Response
object.@Transactional public javax.ws.rs.core.Response addOrReplaceService(@Context javax.ws.rs.core.UriInfo uriInfo, String foreignSource, String foreignId, String ipAddress, RequisitionMonitoredService service)
foreignSource
- a String
object.foreignId
- a String
object.ipAddress
- a String
object.service
- a RequisitionMonitoredService
object.Response
object.@Transactional public javax.ws.rs.core.Response addOrReplaceNodeCategory(@Context javax.ws.rs.core.UriInfo uriInfo, String foreignSource, String foreignId, RequisitionCategory category)
foreignSource
- a String
object.foreignId
- a String
object.category
- a RequisitionCategory
object.Response
object.@Transactional public javax.ws.rs.core.Response addOrReplaceNodeAssetParameter(@Context javax.ws.rs.core.UriInfo uriInfo, String foreignSource, String foreignId, RequisitionAsset asset)
foreignSource
- a String
object.foreignId
- a String
object.asset
- a RequisitionAsset
object.Response
object.@Transactional public javax.ws.rs.core.Response importRequisition(@Context javax.ws.rs.core.UriInfo uriInfo, String foreignSource, String rescanExisting)
importRequisition
foreignSource
- a String
object.Response
object.@Transactional public javax.ws.rs.core.Response updateRequisition(@Context javax.ws.rs.core.UriInfo uriInfo, String foreignSource, MultivaluedMapImpl params)
foreignSource
- a String
object.params
- a MultivaluedMapImpl
object.Response
object.@Transactional public javax.ws.rs.core.Response updateNode(@Context javax.ws.rs.core.UriInfo uriInfo, String foreignSource, String foreignId, MultivaluedMapImpl params)
foreignSource
- a String
object.foreignId
- a String
object.params
- a MultivaluedMapImpl
object.Response
object.@Transactional public javax.ws.rs.core.Response updateInterface(@Context javax.ws.rs.core.UriInfo uriInfo, String foreignSource, String foreignId, String ipAddress, MultivaluedMapImpl params)
foreignSource
- a String
object.foreignId
- a String
object.ipAddress
- a String
object.params
- a MultivaluedMapImpl
object.Response
object.@Transactional public javax.ws.rs.core.Response deletePendingRequisition(String foreignSource)
foreignSource
- a String
object.Response
object.@Transactional public javax.ws.rs.core.Response deleteDeployedRequisition(String foreignSource)
foreignSource
- a String
object.Response
object.@Transactional public javax.ws.rs.core.Response deleteNode(String foreignSource, String foreignId)
@Transactional public javax.ws.rs.core.Response deleteInterface(String foreignSource, String foreignId, String ipAddress)
deleteInterface
@Transactional public javax.ws.rs.core.Response deleteInterfaceService(String foreignSource, String foreignId, String ipAddress, String service)
deleteInterfaceService
@Transactional public javax.ws.rs.core.Response deleteCategory(String foreignSource, String foreignId, String category)
deleteCategory
Copyright © 2021. All rights reserved.