use of org.opennms.netmgt.model.BridgeBridgeLink in project opennms by OpenNMS.
the class Nms7918EnIT method checkTopology.
private void checkTopology(OnmsNode asw01, OnmsNode stcasw01, OnmsNode samasw01) {
assertEquals(3, m_bridgeElementDao.countAll());
assertEquals(0, m_bridgeStpLinkDao.countAll());
assertEquals(2, m_bridgeBridgeLinkDao.countAll());
//the final size of bridgemaclink is
// 76 =
// 63 = 21 * 3 (21 mac are learned on the common shared and entry for each port, the ports are 3
//+ 5 = macs learned on port 1 of asw01
//+ 1 = mac learned on port 3 of asw01
//+ 4 = mac learned on port 4 of asw01
//+ 1 = mac learned on port 23 of sam
//+ 1 = mac learned on port 19 of stc
//+ 1 = mac learned on port 24 of stc
assertEquals(76, m_bridgeMacLinkDao.countAll());
for (BridgeBridgeLink bblink : m_bridgeBridgeLinkDao.findAll()) {
assertNotNull(bblink);
assertEquals(asw01.getId(), bblink.getDesignatedNode().getId());
assertEquals(2, bblink.getDesignatedPort().intValue());
assertEquals(1002, bblink.getDesignatedPortIfIndex().intValue());
if (stcasw01.getId().intValue() == bblink.getNode().getId().intValue()) {
assertEquals(11, bblink.getBridgePort().intValue());
assertEquals(1011, bblink.getBridgePortIfIndex().intValue());
} else if (samasw01.getId().intValue() == bblink.getNode().getId().intValue()) {
assertEquals(3, bblink.getBridgePort().intValue());
assertEquals(3, bblink.getBridgePortIfIndex().intValue());
} else {
assertTrue(false);
}
}
for (String mac : asw01port1bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(1, links.size());
BridgeMacLink link = links.iterator().next();
assertEquals(asw01.getId(), link.getNode().getId());
assertEquals(1, link.getBridgePort().intValue());
assertEquals(1001, link.getBridgePortIfIndex().intValue());
assertEquals(mac, link.getMacAddress());
}
for (String mac : asw01port2bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : asw01port3bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(1, links.size());
BridgeMacLink link = links.iterator().next();
assertEquals(asw01.getId(), link.getNode().getId());
assertEquals(3, link.getBridgePort().intValue());
assertEquals(1003, link.getBridgePortIfIndex().intValue());
assertEquals(mac, link.getMacAddress());
}
for (String mac : asw01port4bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(1, links.size());
BridgeMacLink link = links.iterator().next();
assertEquals(asw01.getId(), link.getNode().getId());
assertEquals(4, link.getBridgePort().intValue());
assertEquals(1004, link.getBridgePortIfIndex().intValue());
assertEquals(mac, link.getMacAddress());
}
for (String mac : samport3bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : samport23bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(1, links.size());
BridgeMacLink link = links.iterator().next();
assertEquals(samasw01.getId(), link.getNode().getId());
assertEquals(23, link.getBridgePort().intValue());
assertEquals(23, link.getBridgePortIfIndex().intValue());
assertEquals(mac, link.getMacAddress());
}
for (String mac : stcport11bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : stcport19bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(1, links.size());
BridgeMacLink link = links.iterator().next();
assertEquals(stcasw01.getId(), link.getNode().getId());
assertEquals(19, link.getBridgePort().intValue());
assertEquals(1019, link.getBridgePortIfIndex().intValue());
assertEquals(mac, link.getMacAddress());
}
for (String mac : stcport24bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(1, links.size());
BridgeMacLink link = links.iterator().next();
assertEquals(stcasw01.getId(), link.getNode().getId());
assertEquals(24, link.getBridgePort().intValue());
assertEquals(1024, link.getBridgePortIfIndex().intValue());
assertEquals(mac, link.getMacAddress());
}
for (String mac : samasw01shared) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : stcasw01shared) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : stcsamshared) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : allshared) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(3, links.size());
for (BridgeMacLink link : links) {
assertEquals(mac, link.getMacAddress());
if (stcasw01.getId().intValue() == link.getNode().getId()) {
assertEquals(11, link.getBridgePort().intValue());
assertEquals(1011, link.getBridgePortIfIndex().intValue());
} else if (samasw01.getId().intValue() == link.getNode().getId()) {
assertEquals(3, link.getBridgePort().intValue());
assertEquals(3, link.getBridgePortIfIndex().intValue());
} else if (asw01.getId().intValue() == link.getNode().getId()) {
assertEquals(2, link.getBridgePort().intValue());
assertEquals(1002, link.getBridgePortIfIndex().intValue());
} else {
assertTrue(false);
}
}
}
}
use of org.opennms.netmgt.model.BridgeBridgeLink in project opennms by OpenNMS.
the class Nms7918EnIT method checkAsw01SamAsw01Topology.
private void checkAsw01SamAsw01Topology(OnmsNode asw01, OnmsNode samasw01) {
assertEquals(2, m_bridgeElementDao.countAll());
assertEquals(0, m_bridgeStpLinkDao.countAll());
assertEquals(1, m_bridgeBridgeLinkDao.countAll());
//the final size of bridgemaclink is
// 61 =
// 50 = 21 + 3 + 1 * 2 (21 mac are learned on the common shared, 3 are shared on the port and 1 is the mac address learned on port 19 of stc)
//+ 5 = macs learned on port 1 of asw01
//+ 1 = mac learned on port 3 of asw01
//+ 4 = mac learned on port 4 of asw01
//+ 1 = mac learned on port 23 of sam
assertEquals(61, m_bridgeMacLinkDao.countAll());
for (BridgeBridgeLink bblink : m_bridgeBridgeLinkDao.findAll()) {
assertNotNull(bblink);
assertEquals(asw01.getId(), bblink.getDesignatedNode().getId());
assertEquals(2, bblink.getDesignatedPort().intValue());
assertEquals(1002, bblink.getDesignatedPortIfIndex().intValue());
if (samasw01.getId().intValue() == bblink.getNode().getId().intValue()) {
assertEquals(3, bblink.getBridgePort().intValue());
assertEquals(3, bblink.getBridgePortIfIndex().intValue());
} else {
assertTrue(false);
}
}
for (String mac : asw01port1bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(1, links.size());
BridgeMacLink link = links.iterator().next();
assertEquals(asw01.getId(), link.getNode().getId());
assertEquals(1, link.getBridgePort().intValue());
assertEquals(1001, link.getBridgePortIfIndex().intValue());
assertEquals(mac, link.getMacAddress());
}
for (String mac : asw01port2bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : asw01port3bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(1, links.size());
BridgeMacLink link = links.iterator().next();
assertEquals(asw01.getId(), link.getNode().getId());
assertEquals(3, link.getBridgePort().intValue());
assertEquals(1003, link.getBridgePortIfIndex().intValue());
assertEquals(mac, link.getMacAddress());
}
for (String mac : asw01port4bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(1, links.size());
BridgeMacLink link = links.iterator().next();
assertEquals(asw01.getId(), link.getNode().getId());
assertEquals(4, link.getBridgePort().intValue());
assertEquals(1004, link.getBridgePortIfIndex().intValue());
assertEquals(mac, link.getMacAddress());
}
for (String mac : samport3bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : samport23bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(1, links.size());
BridgeMacLink link = links.iterator().next();
assertEquals(samasw01.getId(), link.getNode().getId());
assertEquals(23, link.getBridgePort().intValue());
assertEquals(23, link.getBridgePortIfIndex().intValue());
assertEquals(mac, link.getMacAddress());
}
for (String mac : stcport11bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : stcport19bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(2, links.size());
for (BridgeMacLink link : links) {
assertEquals(mac, link.getMacAddress());
if (samasw01.getId().intValue() == link.getNode().getId()) {
assertEquals(3, link.getBridgePort().intValue());
assertEquals(3, link.getBridgePortIfIndex().intValue());
} else if (asw01.getId().intValue() == link.getNode().getId()) {
assertEquals(2, link.getBridgePort().intValue());
assertEquals(1002, link.getBridgePortIfIndex().intValue());
} else {
assertTrue(false);
}
}
}
for (String mac : stcport24bft) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : samasw01shared) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(2, links.size());
for (BridgeMacLink link : links) {
assertEquals(mac, link.getMacAddress());
if (samasw01.getId().intValue() == link.getNode().getId()) {
assertEquals(3, link.getBridgePort().intValue());
assertEquals(3, link.getBridgePortIfIndex().intValue());
} else if (asw01.getId().intValue() == link.getNode().getId()) {
assertEquals(2, link.getBridgePort().intValue());
assertEquals(1002, link.getBridgePortIfIndex().intValue());
} else {
assertTrue(false);
}
}
}
for (String mac : stcasw01shared) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : stcsamshared) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(0, links.size());
}
for (String mac : allshared) {
List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac);
assertEquals(2, links.size());
for (BridgeMacLink link : links) {
assertEquals(mac, link.getMacAddress());
if (samasw01.getId().intValue() == link.getNode().getId()) {
assertEquals(3, link.getBridgePort().intValue());
assertEquals(3, link.getBridgePortIfIndex().intValue());
} else if (asw01.getId().intValue() == link.getNode().getId()) {
assertEquals(2, link.getBridgePort().intValue());
assertEquals(1002, link.getBridgePortIfIndex().intValue());
} else {
assertTrue(false);
}
}
}
}
use of org.opennms.netmgt.model.BridgeBridgeLink in project opennms by OpenNMS.
the class SharedSegment method getBridgeBridgeLink.
private BridgeBridgeLink getBridgeBridgeLink(BridgePort bp) {
BridgeBridgeLink link = new BridgeBridgeLink();
link.setNode(bp.getNode());
link.setBridgePort(bp.getBridgePort());
link.setBridgePortIfIndex(bp.getBridgePortIfIndex());
link.setBridgePortIfName(bp.getBridgePortIfName());
link.setVlan(bp.getVlan());
link.setDesignatedNode(m_designatedBridge.getNode());
link.setDesignatedPort(m_designatedBridge.getBridgePort());
link.setDesignatedPortIfIndex(m_designatedBridge.getBridgePortIfIndex());
link.setDesignatedPortIfName(m_designatedBridge.getBridgePortIfName());
link.setDesignatedVlan(m_designatedBridge.getVlan());
link.setBridgeBridgeLinkCreateTime(m_designatedBridge.getCreateTime());
link.setBridgeBridgeLinkLastPollTime(m_designatedBridge.getPollTime());
return link;
}
use of org.opennms.netmgt.model.BridgeBridgeLink in project opennms by OpenNMS.
the class EnhancedLinkdServiceImpl method store.
@Override
public void store(BroadcastDomain domain, Date now) {
for (SharedSegment segment : domain.getTopology()) {
for (BridgeBridgeLink link : segment.getBridgeBridgeLinks()) {
link.setBridgeBridgeLinkLastPollTime(new Date());
saveBridgeBridgeLink(link);
}
for (BridgeMacLink link : segment.getBridgeMacLinks()) {
link.setBridgeMacLinkLastPollTime(new Date());
saveBridgeMacLink(link);
}
}
for (Integer nodeid : domain.getBridgeNodesOnDomain()) {
m_bridgeMacLinkDao.deleteByNodeIdOlderThen(nodeid, now);
m_bridgeMacLinkDao.flush();
m_bridgeBridgeLinkDao.deleteByNodeIdOlderThen(nodeid, now);
m_bridgeBridgeLinkDao.deleteByDesignatedNodeIdOlderThen(nodeid, now);
m_bridgeBridgeLinkDao.flush();
}
}
Aggregations