@Test @Transactional @JUnitTemporaryDatabase public void testGetInterfacesWithIpAddress() throws Exception { Interface[] interfaces = NetworkElementFactory.getInstance(m_appContext).getInterfacesWithIpAddress("fe80:0000:0000:0000:aaaa:bbbb:cccc:dddd%5"); assertEquals("interface count", 1, interfaces.length); assertEquals("node ID", m_dbPopulator.getNode1().getId().intValue(), interfaces[0].getNodeId()); assertEquals("ifIndex", 4, interfaces[0].getIfIndex()); interfaces = NetworkElementFactory.getInstance(m_appContext).getInterfacesWithIpAddress("fe80:0000:0000:0000:aaaa:bbbb:cccc:0001%5"); assertEquals("interface count", 0, interfaces.length); interfaces = NetworkElementFactory.getInstance(m_appContext).getInterfacesWithIpAddress("fe80:0000:0000:0000:aaaa:bbbb:cccc:dddd%4"); assertEquals("interface count", 0, interfaces.length); }
@Override public Interface[] getInterfacesWithIpAddress(String ipAddress) { OnmsCriteria criteria = new OnmsCriteria(OnmsIpInterface.class); criteria.createAlias("snmpInterface", "snmpInterface", OnmsCriteria.LEFT_JOIN); criteria.add(Restrictions.eq("ipAddress", InetAddressUtils.addr(ipAddress))); return onmsIpInterfaces2InterfaceArray(m_ipInterfaceDao.findMatching(criteria)); }
NetworkElementFactory implements InitializingBean, NetworkElementFactoryInterface { @Override public Interface[] getInterfacesWithIpAddress(String ipAddress) { OnmsCriteria criteria = new OnmsCriteria(OnmsIpInterface.class); criteria.createAlias("snmpInterface", "snmpInterface", OnmsCriteria.LEFT_JOIN); criteria.add(Restrictions.eq("ipAddress", InetAddressUtils.addr(ipAddress))); return onmsIpInterfaces2InterfaceArray(m_ipInterfaceDao.findMatching(criteria)); } }
NetworkElementFactory implements InitializingBean, NetworkElementFactoryInterface { @Override public Interface[] getInterfacesWithIpAddress(String ipAddress) { OnmsCriteria criteria = new OnmsCriteria(OnmsIpInterface.class); criteria.createAlias("snmpInterface", "snmpInterface", OnmsCriteria.LEFT_JOIN); criteria.add(Restrictions.eq("ipAddress", InetAddressUtils.addr(ipAddress))); return onmsIpInterfaces2InterfaceArray(m_ipInterfaceDao.findMatching(criteria)); }  }
NetworkElementFactory implements InitializingBean, NetworkElementFactoryInterface { @Override public Interface[] getInterfacesWithIpAddress(String ipAddress) { OnmsCriteria criteria = new OnmsCriteria(OnmsIpInterface.class); criteria.createAlias("snmpInterface", "snmpInterface", OnmsCriteria.LEFT_JOIN); criteria.add(Restrictions.eq("ipAddress", InetAddressUtils.addr(ipAddress))); return onmsIpInterfaces2InterfaceArray(m_ipInterfaceDao.findMatching(criteria)); }  static NetworkElementFactoryInterface getInstance(ServletContext servletContext); static NetworkElementFactoryInterface getInstance(ApplicationContext appContext); @Override String getNodeLabel(int nodeId); @Override String getIpPrimaryAddress(int nodeId); @Override OnmsNode getNode(int nodeId); @Override OnmsNode getNode(String  lookupCriteria); @Override List<OnmsNode> getAllNodes(); @Override List<OnmsNode> getNodesLike(String nodeLabel); @Override List<OnmsNode> getNodesWithIpLike(String iplike); @Override List<OnmsNode> getNodesWithService(int serviceId); @Override List<OnmsNode> getNodesWithPhysAddr(String macAddr); @Override List<OnmsNode> getNodesWithPhysAddrAtInterface(String macAddr); @Override List<OnmsNode> getNodesWithPhysAddrFromSnmpInterface(String macAddr); @Override List<OnmsNode> getNodesWithIfAlias(String ifAlias); @Override String getHostname(String ipAddress); @Override Integer getIfIndex(int ipinterfaceid); @Override Integer getIfIndex(int nodeID, String ipaddr); @Override Interface getInterface(int ipInterfaceId); @Override Interface getInterface(int nodeId, String ipAddress); @Override Interface getInterface(int nodeId, String ipAddress, int ifIndex); @Override Interface getSnmpInterface(int nodeId, int ifIndex); @Override Interface[] getInterfacesWithIpAddress(String ipAddress); @Override Interface[] getInterfacesWithIfAlias(int nodeId, String ifAlias); @Override Interface[] getAllInterfacesOnNode(int nodeId); @Override Interface[] getAllSnmpInterfacesOnNode(int nodeId); @Override Interface[] getActiveInterfacesOnNode(int nodeId); @Override Interface[] getAllInterfaces(); @Override Interface[] getAllInterfaces(boolean includeSnmp); @Override Interface[] getAllManagedIpInterfaces(boolean includeSNMP); @Override Service getService(int nodeId, String ipAddress, int serviceId); @Override Service getService(int ifServiceId); @Override Service[] getAllServices(); @Override Service[] getServicesOnInterface(int nodeId, String ipAddress); @Override Service[] getServicesOnInterface(int nodeId, String ipAddress, boolean includeDeletions); @Override Service[] getServicesOnNode(int nodeId); @Override Service[] getServicesOnNode(int nodeId, int serviceId); @Override String getServiceNameFromId(int serviceId); @Override int getServiceIdFromName(String serviceName); @Override Map<Integer, String> getServiceIdToNameMap(); @Override Map<String, Integer> getServiceNameToIdMap(); @Override List<OnmsNode> getNodesLikeAndIpLike(String nodeLabel, String iplike, int serviceId); @Override List<OnmsNode> getNodesLike(String nodeLabel, int serviceId); @Override List<OnmsNode> getNodesWithIpLike(String iplike, int serviceId); @Override List<OnmsNode> getAllNodes(int serviceId); @Override List<OnmsNode> getNodesFromPhysaddr(String AtPhysAddr); @Override AtInterface getAtInterface(int nodeId, String ipAddr); @Override IpRouteInterface[] getIpRoute(int nodeID); @Override boolean isParentNode(int nodeId); @Override boolean isBridgeNode(int nodeID); @Override boolean isRouteInfoNode(int nodeID); @Override Set<Integer> getLinkedNodeIdOnNode(int nodeID); @Override List<LinkInterface> getDataLinksOnNode(int nodeId); @Override List<LinkInterface> getDataLinksOnInterface(int nodeId, String ipAddress); @Override List<LinkInterface> getDataLinksOnInterface(int id); @Override List<LinkInterface> getDataLinksOnInterface(int nodeId, int ifIndex); @Override Vlan[] getVlansOnNode(int nodeID); @Override StpInterface[] getStpInterface(int nodeID); @Override StpInterface[] getStpInterface(int nodeID, int ifindex); @Override StpNode[] getStpNode(int nodeID); @Override List<Integer> getNodeIdsWithIpLike(String iplike); List<OnmsNode> getNodesWithCategories(TransactionTemplate transTemplate, final String[] categories1, final boolean onlyNodesWithDownAggregateStatus); @Override List<OnmsNode> getNodesWithCategories(String[] categories, boolean onlyNodesWithDownAggregateStatus); @Override List<OnmsNode> getNodesWithCategories(TransactionTemplate transTemplate, final String[] categories1, final String[] categories2, final boolean onlyNodesWithDownAggregateStatus); @Override List<OnmsNode> getNodesWithCategories(String[] categories1, String[] categories2, boolean onlyNodesWithDownAggregateStatus); @Override void afterPropertiesSet(); }
NetworkElementFactory implements InitializingBean, NetworkElementFactoryInterface { @Override public Interface[] getInterfacesWithIpAddress(String ipAddress) { OnmsCriteria criteria = new OnmsCriteria(OnmsIpInterface.class); criteria.createAlias("snmpInterface", "snmpInterface", OnmsCriteria.LEFT_JOIN); criteria.add(Restrictions.eq("ipAddress", InetAddressUtils.addr(ipAddress))); return onmsIpInterfaces2InterfaceArray(m_ipInterfaceDao.findMatching(criteria)); }  static NetworkElementFactoryInterface getInstance(ServletContext servletContext); static NetworkElementFactoryInterface getInstance(ApplicationContext appContext); @Override String getNodeLabel(int nodeId); @Override String getIpPrimaryAddress(int nodeId); @Override OnmsNode getNode(int nodeId); @Override OnmsNode getNode(String  lookupCriteria); @Override List<OnmsNode> getAllNodes(); @Override List<OnmsNode> getNodesLike(String nodeLabel); @Override List<OnmsNode> getNodesWithIpLike(String iplike); @Override List<OnmsNode> getNodesWithService(int serviceId); @Override List<OnmsNode> getNodesWithPhysAddr(String macAddr); @Override List<OnmsNode> getNodesWithPhysAddrAtInterface(String macAddr); @Override List<OnmsNode> getNodesWithPhysAddrFromSnmpInterface(String macAddr); @Override List<OnmsNode> getNodesWithIfAlias(String ifAlias); @Override String getHostname(String ipAddress); @Override Integer getIfIndex(int ipinterfaceid); @Override Integer getIfIndex(int nodeID, String ipaddr); @Override Interface getInterface(int ipInterfaceId); @Override Interface getInterface(int nodeId, String ipAddress); @Override Interface getInterface(int nodeId, String ipAddress, int ifIndex); @Override Interface getSnmpInterface(int nodeId, int ifIndex); @Override Interface[] getInterfacesWithIpAddress(String ipAddress); @Override Interface[] getInterfacesWithIfAlias(int nodeId, String ifAlias); @Override Interface[] getAllInterfacesOnNode(int nodeId); @Override Interface[] getAllSnmpInterfacesOnNode(int nodeId); @Override Interface[] getActiveInterfacesOnNode(int nodeId); @Override Interface[] getAllInterfaces(); @Override Interface[] getAllInterfaces(boolean includeSnmp); @Override Interface[] getAllManagedIpInterfaces(boolean includeSNMP); @Override Service getService(int nodeId, String ipAddress, int serviceId); @Override Service getService(int ifServiceId); @Override Service[] getAllServices(); @Override Service[] getServicesOnInterface(int nodeId, String ipAddress); @Override Service[] getServicesOnInterface(int nodeId, String ipAddress, boolean includeDeletions); @Override Service[] getServicesOnNode(int nodeId); @Override Service[] getServicesOnNode(int nodeId, int serviceId); @Override String getServiceNameFromId(int serviceId); @Override int getServiceIdFromName(String serviceName); @Override Map<Integer, String> getServiceIdToNameMap(); @Override Map<String, Integer> getServiceNameToIdMap(); @Override List<OnmsNode> getNodesLikeAndIpLike(String nodeLabel, String iplike, int serviceId); @Override List<OnmsNode> getNodesLike(String nodeLabel, int serviceId); @Override List<OnmsNode> getNodesWithIpLike(String iplike, int serviceId); @Override List<OnmsNode> getAllNodes(int serviceId); @Override List<OnmsNode> getNodesFromPhysaddr(String AtPhysAddr); @Override AtInterface getAtInterface(int nodeId, String ipAddr); @Override IpRouteInterface[] getIpRoute(int nodeID); @Override boolean isParentNode(int nodeId); @Override boolean isBridgeNode(int nodeID); @Override boolean isRouteInfoNode(int nodeID); @Override Set<Integer> getLinkedNodeIdOnNode(int nodeID); @Override List<LinkInterface> getDataLinksOnNode(int nodeId); @Override List<LinkInterface> getDataLinksOnInterface(int nodeId, String ipAddress); @Override List<LinkInterface> getDataLinksOnInterface(int id); @Override List<LinkInterface> getDataLinksOnInterface(int nodeId, int ifIndex); @Override Vlan[] getVlansOnNode(int nodeID); @Override StpInterface[] getStpInterface(int nodeID); @Override StpInterface[] getStpInterface(int nodeID, int ifindex); @Override StpNode[] getStpNode(int nodeID); @Override List<Integer> getNodeIdsWithIpLike(String iplike); List<OnmsNode> getNodesWithCategories(TransactionTemplate transTemplate, final String[] categories1, final boolean onlyNodesWithDownAggregateStatus); @Override List<OnmsNode> getNodesWithCategories(String[] categories, boolean onlyNodesWithDownAggregateStatus); @Override List<OnmsNode> getNodesWithCategories(TransactionTemplate transTemplate, final String[] categories1, final String[] categories2, final boolean onlyNodesWithDownAggregateStatus); @Override List<OnmsNode> getNodesWithCategories(String[] categories1, String[] categories2, boolean onlyNodesWithDownAggregateStatus); @Override void afterPropertiesSet();  }