use of org.opennms.netmgt.model.ncs.NCSBuilder in project opennms by OpenNMS.
the class NCSListFormattingTest method testMarshallComponent.
@Test
public void testMarshallComponent() throws JAXBException, UnsupportedEncodingException, TransformerConfigurationException {
NCSComponent svc = new NCSBuilder("Service", "NA-Service", "123").setName("CokeP2P").pushComponent("ServiceElement", "NA-ServiceElement", "8765").setName("PE1:SE1").setNodeIdentity("space", "1111-PE1").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765:jnxVpnIf").setName("jnxVpnIf").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfDown").setAttribute("jnxVpnIfVpnType", "5").setAttribute("jnxVpnIfVpnName", "ge-1/0/2.50").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765:link").setName("link").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/linkUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/linkDown").setAttribute("linkName", "ge-1/0/2").popComponent().popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765:jnxVpnPw-vcid(50)").setName("jnxVpnPw-vcid(50)").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwDown").setAttribute("jnxVpnPwVpnType", "5").setAttribute("jnxVpnPwVpnName", "ge-1/0/2.50").setDependenciesRequired(DependencyRequirements.ANY).pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765:lspA-PE1-PE2").setName("lspA-PE1-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspA-PE1-PE2").popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765:lspB-PE1-PE2").setName("lspB-PE1-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspB-PE1-PE2").popComponent().popComponent().popComponent().pushComponent("ServiceElement", "NA-ServiceElement", "9876").setName("PE2:SE1").setNodeIdentity("space", "2222-PE2").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876:jnxVpnIf").setName("jnxVpnIf").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfDown").setAttribute("jnxVpnIfVpnType", "5").setAttribute("jnxVpnIfVpnName", "ge-3/1/4.50").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876:link").setName("link").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/linkUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/linkDown").setAttribute("linkName", "ge-3/1/4").popComponent().popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876:jnxVpnPw-vcid(50)").setName("jnxVpnPw-vcid(50)").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwDown").setAttribute("jnxVpnPwVpnType", "5").setAttribute("jnxVpnPwVpnName", "ge-3/1/4.50").setDependenciesRequired(DependencyRequirements.ANY).pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876:lspA-PE2-PE1").setName("lspA-PE2-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspA-PE2-PE1").popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876:lspB-PE2-PE1").setName("lspB-PE2-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspB-PE2-PE1").popComponent().popComponent().popComponent().get();
String result = "<ul>\n" + getComponentHTML(svc) + "</ul>";
assertEquals(getExpectedList(), result);
}
use of org.opennms.netmgt.model.ncs.NCSBuilder in project opennms by OpenNMS.
the class MonolithicDependencyRulesIT method setUp.
@Before
public void setUp() {
NetworkBuilder bldr = new NetworkBuilder();
// Make sure that the default OnmsMonitoringLocation is saved
m_locationDao.saveOrUpdate(bldr.getLocation());
bldr.addNode("PE1").setForeignSource("space").setForeignId("1111-PE1");
m_nodeDao.save(bldr.getCurrentNode());
m_pe1NodeId = bldr.getCurrentNode().getId();
bldr.addNode("PE2").setForeignSource("space").setForeignId("2222-PE2");
m_nodeDao.save(bldr.getCurrentNode());
m_pe2NodeId = bldr.getCurrentNode().getId();
NCSComponent svc = new NCSBuilder("Service", "NA-Service", "123").setName("CokeP2P").pushComponent("ServiceElement", "NA-ServiceElement", "8765").setName("PE1,SE1").setNodeIdentity("space", "1111-PE1").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,jnxVpnIf").setName("jnxVpnIf").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfDown").setAttribute("jnxVpnIfVpnType", "5").setAttribute("jnxVpnIfVpnName", "ge-1/0/2.50").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,link").setName("link").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/linkUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/linkDown").setAttribute("linkName", "ge-1/0/2").popComponent().popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,jnxVpnPw-vcid(50)").setName("jnxVpnPw-vcid(50)").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwDown").setAttribute("jnxVpnPwVpnType", "5").setAttribute("jnxVpnPwVpnName", "ge-1/0/2.50").setDependenciesRequired(DependencyRequirements.ANY).pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,lspA-PE1-PE2").setName("lspA-PE1-PE2").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspA-PE1-PE2").popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,lspB-PE1-PE2").setName("lspB-PE1-PE2").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspB-PE1-PE2").popComponent().popComponent().popComponent().pushComponent("ServiceElement", "NA-ServiceElement", "9876").setName("PE2,SE1").setNodeIdentity("space", "2222-PE2").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnIf").setName("jnxVpnIf").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfDown").setAttribute("jnxVpnIfVpnType", "5").setAttribute("jnxVpnIfVpnName", "ge-3/1/4.50").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,link").setName("link").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/linkUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/linkDown").setAttribute("linkName", "ge-3/1/4").popComponent().popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnPw-vcid(50)").setName("jnxVpnPw-vcid(50)").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwDown").setAttribute("jnxVpnPwVpnType", "5").setAttribute("jnxVpnPwVpnName", "ge-3/1/4.50").setDependenciesRequired(DependencyRequirements.ANY).pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,lspA-PE2-PE1").setName("lspA-PE2-PE1").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspA-PE2-PE1").popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,lspB-PE2-PE1").setName("lspB-PE2-PE1").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspB-PE2-PE1").popComponent().popComponent().popComponent().get();
m_repository.save(svc);
}
use of org.opennms.netmgt.model.ncs.NCSBuilder in project opennms by OpenNMS.
the class NCSComponentDaoIT method setUp.
@Before
public void setUp() {
NetworkBuilder bldr = new NetworkBuilder();
// Make sure that the default OnmsMonitoringLocation is saved
m_locationDao.saveOrUpdate(bldr.getLocation());
bldr.addNode("PE1").setForeignSource("space").setForeignId("1111-PE1");
m_nodeDao.save(bldr.getCurrentNode());
m_pe1NodeId = bldr.getCurrentNode().getId();
bldr.addNode("PE2").setForeignSource("space").setForeignId("2222-PE2");
m_nodeDao.save(bldr.getCurrentNode());
m_pe2NodeId = bldr.getCurrentNode().getId();
NCSComponent svc = new NCSBuilder("Service", "NA-Service", "123").setName("CokeP2P").pushComponent("ServiceElement", "NA-ServiceElement", "8765").setName("PE1,SE1").setNodeIdentity("space", "1111-PE1").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,jnxVpnIf").setName("jnxVpnIf").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfDown").setAttribute("jnxVpnIfVpnType", "5").setAttribute("jnxVpnIfVpnName", "ge-1/0/2.50").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,link").setName("link").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/linkUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/linkDown").setAttribute("linkName", "ge-1/0/2").popComponent().popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,jnxVpnPw-vcid(50)").setName("jnxVpnPw-vcid(50)").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwDown").setAttribute("jnxVpnPwVpnType", "5").setAttribute("jnxVpnPwVpnName", "ge-1/0/2.50").setDependenciesRequired(DependencyRequirements.ANY).pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,lspA-PE1-PE2").setName("lspA-PE1-PE2").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspA-PE1-PE2").popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,lspB-PE1-PE2").setName("lspB-PE1-PE2").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspB-PE1-PE2").popComponent().popComponent().popComponent().pushComponent("ServiceElement", "NA-ServiceElement", "9876").setName("PE2,SE1").setNodeIdentity("space", "2222-PE2").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnIf").setName("jnxVpnIf").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfDown").setAttribute("jnxVpnIfVpnType", "5").setAttribute("jnxVpnIfVpnName", "ge-3/1/4.50").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,link").setName("link").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/linkUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/linkDown").setAttribute("linkName", "ge-3/1/4").popComponent().popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnPw-vcid(50)").setName("jnxVpnPw-vcid(50)").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwDown").setAttribute("jnxVpnPwVpnType", "5").setAttribute("jnxVpnPwVpnName", "ge-3/1/4.50").setDependenciesRequired(DependencyRequirements.ANY).pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,lspA-PE2-PE1").setName("lspA-PE2-PE1").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspA-PE2-PE1").popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,lspB-PE2-PE1").setName("lspB-PE2-PE1").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspB-PE2-PE1").popComponent().popComponent().popComponent().get();
m_repository.save(svc);
}
use of org.opennms.netmgt.model.ncs.NCSBuilder in project opennms by OpenNMS.
the class NCSListFormattingTest method testRecursiveMethod.
@Test
public void testRecursiveMethod() {
NCSComponent svc = new NCSBuilder("Service", "NA-Service", "123").setName("CokeP2P").pushComponent("ServiceElement", "NA-ServiceElement", "8765").setName("PE1:SE1").setNodeIdentity("space", "1111-PE1").popComponent().pushComponent("ServiceElement", "NA-ServiceElement", "8766").setName("PE2:SE2").popComponent().get();
String expected = "<ul>\n" + "<li>CokeP2P<ul>\n" + "<li>PE1:SE1</li>\n" + "<li>PE2:SE2</li>\n" + "</ul>" + "</li>\n" + "</ul>";
String result = "<ul>\n" + getComponentHTML(svc) + "</ul>";
assertEquals(expected, result);
System.err.println("recursive: " + result);
}
use of org.opennms.netmgt.model.ncs.NCSBuilder in project opennms by OpenNMS.
the class DependencyRulesIT method setUp.
@Before
public void setUp() {
NetworkBuilder bldr = new NetworkBuilder();
// Make sure that the default OnmsMonitoringLocation is saved
m_locationDao.saveOrUpdate(bldr.getLocation());
bldr.addNode("PE1").setForeignSource("space").setForeignId("1111-PE1");
m_nodeDao.save(bldr.getCurrentNode());
m_pe1NodeId = bldr.getCurrentNode().getId();
bldr.addNode("PE2").setForeignSource("space").setForeignId("2222-PE2");
m_nodeDao.save(bldr.getCurrentNode());
m_pe2NodeId = bldr.getCurrentNode().getId();
m_svc = new NCSBuilder("Service", "NA-Service", "123").setName("CokeP2P").pushComponent("ServiceElement", "NA-ServiceElement", "8765").setName("PE1,SE1").setNodeIdentity("space", "1111-PE1").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,jnxVpnIf").setName("jnxVpnIf").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfDown").setAttribute("jnxVpnIfVpnType", "5").setAttribute("jnxVpnIfVpnName", "ge-1/0/2.50").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,link").setName("link").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/linkUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/linkDown").setAttribute("linkName", "ge-1/0/2").popComponent().popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,jnxVpnPw-vcid(50)").setName("jnxVpnPw-vcid(50)").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwDown").setAttribute("jnxVpnPwVpnType", "5").setAttribute("jnxVpnPwVpnName", "ge-1/0/2.50").setDependenciesRequired(DependencyRequirements.ANY).pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,lspA-PE1-PE2").setName("lspA-PE1-PE2").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspA-PE1-PE2").popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "8765,lspB-PE1-PE2").setName("lspB-PE1-PE2").setNodeIdentity("space", "1111-PE1").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspB-PE1-PE2").popComponent().popComponent().popComponent().pushComponent("ServiceElement", "NA-ServiceElement", "9876").setName("PE2,SE1").setNodeIdentity("space", "2222-PE2").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnIf").setName("jnxVpnIf").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnIfDown").setAttribute("jnxVpnIfVpnType", "5").setAttribute("jnxVpnIfVpnName", "ge-3/1/4.50").pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,link").setName("link").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/linkUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/linkDown").setAttribute("linkName", "ge-3/1/4").popComponent().popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnPw-vcid(50)").setName("jnxVpnPw-vcid(50)").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/jnxVpnPwDown").setAttribute("jnxVpnPwVpnType", "5").setAttribute("jnxVpnPwVpnName", "ge-3/1/4.50").setDependenciesRequired(DependencyRequirements.ANY).pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,lspA-PE2-PE1").setName("lspA-PE2-PE1").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspA-PE2-PE1").popComponent().pushComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,lspB-PE2-PE1").setName("lspB-PE2-PE1").setNodeIdentity("space", "2222-PE2").setUpEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathUp").setDownEventUei("uei.opennms.org/vendor/Juniper/traps/mplsLspPathDown").setAttribute("mplsLspName", "lspB-PE2-PE1").popComponent().popComponent().popComponent().get();
m_repository.save(m_svc);
}
Aggregations