Search in sources :

Example 1 with StringAttributeType

use of org.opennms.netmgt.collectd.StringAttributeType in project opennms by OpenNMS.

the class BasePersisterTest method buildStringAttribute.

private SnmpAttribute buildStringAttribute() {
    EasyMock.expect(m_ifDao.load(m_intf.getId())).andReturn(m_intf).anyTimes();
    m_easyMockUtils.replayAll();
    SnmpCollectionAgent agent = DefaultCollectionAgent.create(m_intf.getId(), m_ifDao, m_transMgr);
    MockDataCollectionConfig dataCollectionConfig = new MockDataCollectionConfig();
    OnmsSnmpCollection collection = new OnmsSnmpCollection(agent, new ServiceParameters(new HashMap<String, Object>()), dataCollectionConfig, m_locationAwareSnmpClient);
    NodeResourceType resourceType = new NodeResourceType(agent, collection);
    SnmpCollectionResource resource = new NodeInfo(resourceType, agent);
    MibObject mibObject = new MibObject();
    mibObject.setOid(".1.1.1.1");
    mibObject.setAlias("mibObjectAlias");
    mibObject.setType("string");
    mibObject.setInstance("0");
    mibObject.setMaxval(null);
    mibObject.setMinval(null);
    SnmpAttributeType attributeType = new StringAttributeType(resourceType, "some-collection", mibObject, new AttributeGroupType("mibGroup", AttributeGroupType.IF_TYPE_IGNORE));
    return new SnmpAttribute(resource, attributeType, SnmpUtils.getValueFactory().getOctetString("foo".getBytes()));
}
Also used : NodeResourceType(org.opennms.netmgt.collectd.NodeResourceType) SnmpCollectionAgent(org.opennms.netmgt.collectd.SnmpCollectionAgent) HashMap(java.util.HashMap) MockDataCollectionConfig(org.opennms.netmgt.mock.MockDataCollectionConfig) SnmpAttributeType(org.opennms.netmgt.collectd.SnmpAttributeType) StringAttributeType(org.opennms.netmgt.collectd.StringAttributeType) SnmpAttribute(org.opennms.netmgt.collectd.SnmpAttribute) NodeInfo(org.opennms.netmgt.collectd.NodeInfo) AttributeGroupType(org.opennms.netmgt.collection.api.AttributeGroupType) ServiceParameters(org.opennms.netmgt.collection.api.ServiceParameters) SnmpCollectionResource(org.opennms.netmgt.collectd.SnmpCollectionResource) MibObject(org.opennms.netmgt.config.datacollection.MibObject) OnmsSnmpCollection(org.opennms.netmgt.collectd.OnmsSnmpCollection)

Aggregations

HashMap (java.util.HashMap)1 NodeInfo (org.opennms.netmgt.collectd.NodeInfo)1 NodeResourceType (org.opennms.netmgt.collectd.NodeResourceType)1 OnmsSnmpCollection (org.opennms.netmgt.collectd.OnmsSnmpCollection)1 SnmpAttribute (org.opennms.netmgt.collectd.SnmpAttribute)1 SnmpAttributeType (org.opennms.netmgt.collectd.SnmpAttributeType)1 SnmpCollectionAgent (org.opennms.netmgt.collectd.SnmpCollectionAgent)1 SnmpCollectionResource (org.opennms.netmgt.collectd.SnmpCollectionResource)1 StringAttributeType (org.opennms.netmgt.collectd.StringAttributeType)1 AttributeGroupType (org.opennms.netmgt.collection.api.AttributeGroupType)1 ServiceParameters (org.opennms.netmgt.collection.api.ServiceParameters)1 MibObject (org.opennms.netmgt.config.datacollection.MibObject)1 MockDataCollectionConfig (org.opennms.netmgt.mock.MockDataCollectionConfig)1