58d4ce17cc28cdd8b11b95bf62696b50019fa7a6
[public/netxms.git] / src / java / netxms-client / src / test / java / org / netxms / client / TopologyTest.java
1 /**
2 * NetXMS - open source network management system
3 * Copyright (C) 2003-2013 Victor Kirhenshtein
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 package org.netxms.client;
20
21 import java.util.List;
22 import org.netxms.client.maps.NetworkMapLink;
23 import org.netxms.client.maps.NetworkMapPage;
24 import org.netxms.client.maps.elements.NetworkMapElement;
25 import org.netxms.client.topology.Route;
26
27
28 /**
29 * Tests for network topology functions
30 */
31 public class TopologyTest extends SessionTest
32 {
33 private static final long SUBNET_ID = 796;
34 private static final long NODE_ID = 100;
35
36 public void testAddressMap() throws Exception
37 {
38 final NXCSession session = connect();
39
40 long[] map = session.getSubnetAddressMap(SUBNET_ID);
41 for(int i = 0; i < map.length; i++)
42 System.out.println(i + ": " + map[i]);
43
44 session.disconnect();
45 }
46
47 public void testLinkLayerTopology() throws Exception
48 {
49 final NXCSession session = connect();
50
51 NetworkMapPage page = session.queryLayer2Topology(NODE_ID);
52 for(NetworkMapElement e : page.getElements())
53 System.out.println(e.toString());
54 for(NetworkMapLink l : page.getLinks())
55 System.out.println(l.toString());
56
57 session.disconnect();
58 }
59
60 public void testRoutingTable() throws Exception
61 {
62 final NXCSession session = connect();
63
64 List<Route> rt = session.getRoutingTable(NODE_ID);
65 for(Route r : rt)
66 System.out.println(r.toString());
67
68 session.disconnect();
69 }
70 }