use of org.opennms.netmgt.model.NetworkBuilder in project opennms by OpenNMS.
the class ReverseDnsRecordTest method setUp.
@Before
public void setUp() throws Exception {
nb = new NetworkBuilder();
nb.addNode(hostname).setForeignSource("dns").setForeignId("1");
nb.addSnmpInterface(100).setIfName(ifname).addIpInterface(ip);
}
use of org.opennms.netmgt.model.NetworkBuilder in project opennms by OpenNMS.
the class Nms4930NetworkBuilder method addMacNodeWithSnmpInterface.
public void addMacNodeWithSnmpInterface(String mac, String ip, Integer ifindex) {
NetworkBuilder nb = getNetworkBuilder();
nb.addNode(ip).setForeignSource("linkd").setForeignId(ip).setType(NodeType.ACTIVE);
nb.addInterface(ip).setIsSnmpPrimary("N").setIsManaged("M").addSnmpInterface(ifindex).setIfName("eth0").setIfType(6).setPhysAddr(mac).setIfDescr("eth0");
m_nodeDao.save(nb.getCurrentNode());
m_nodeDao.flush();
IpNetToMedia at0 = new IpNetToMedia();
at0.setSourceIfIndex(100);
at0.setPhysAddress(mac);
at0.setLastPollTime(at0.getCreateTime());
at0.setSourceNode(m_nodeDao.findByForeignId("linkd", ip));
try {
at0.setNetAddress(InetAddress.getByName(ip));
} catch (UnknownHostException e) {
e.printStackTrace();
}
at0.setIpNetToMediaType(IpNetToMediaType.IPNETTOMEDIA_TYPE_DYNAMIC);
m_ipNetToMediaDao.saveOrUpdate(at0);
m_ipNetToMediaDao.flush();
}
use of org.opennms.netmgt.model.NetworkBuilder in project opennms by OpenNMS.
the class AccessPointDaoTest method addNewAccessPoint.
private void addNewAccessPoint(String name, String mac, String pkg) {
NetworkBuilder nb = new NetworkBuilder();
nb.addNode(name).setForeignSource("apmd").setForeignId(name);
nb.addInterface("169.254.0.1");
m_nodeDao.save(nb.getCurrentNode());
final OnmsAccessPoint ap1 = new OnmsAccessPoint(mac, nb.getCurrentNode().getId(), pkg);
ap1.setStatus(AccessPointStatus.UNKNOWN);
m_accessPointDao.save(ap1);
m_nodeDao.flush();
m_accessPointDao.flush();
}
use of org.opennms.netmgt.model.NetworkBuilder in project opennms by OpenNMS.
the class InstanceStrategyIntegrationTest method addNewController.
private void addNewController(String nodeName, String ipAddress, String pollerCategory) {
NetworkBuilder nb = new NetworkBuilder();
nb.addNode(nodeName).setForeignSource("apmd").setForeignId(nodeName).setType(NodeType.ACTIVE);
nb.setAssetAttribute("pollerCategory", pollerCategory);
nb.addInterface(ipAddress).setIsSnmpPrimary("P").setIsManaged("M");
m_nodeDao.save(nb.getCurrentNode());
m_nodeDao.flush();
}
use of org.opennms.netmgt.model.NetworkBuilder in project opennms by OpenNMS.
the class AccessPointMonitordTest method addNewAccessPoint.
@Transactional(propagation = Propagation.MANDATORY)
public void addNewAccessPoint(String name, String mac, String pkg) {
NetworkBuilder nb = new NetworkBuilder();
nb.addNode(name).setForeignSource("apmd").setForeignId(name);
nb.addInterface("169.254.0.1");
m_nodeDao.save(nb.getCurrentNode());
final OnmsAccessPoint ap1 = new OnmsAccessPoint(mac, nb.getCurrentNode().getId(), pkg);
ap1.setStatus(AccessPointStatus.UNKNOWN);
m_accessPointDao.save(ap1);
m_nodeDao.flush();
m_accessPointDao.flush();
}
Aggregations