b354975f78d453f511a142facdbfcf229483cea6
[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 org.netxms.client.maps.NetworkMapLink;
22 import org.netxms.client.maps.NetworkMapPage;
23 import org.netxms.client.maps.elements.NetworkMapElement;
24
25
26 /**
27 * Tests for network topology functions
28 */
29 public class TopologyTest extends SessionTest
30 {
31 private static final long SUBNET_ID = 796;
32 private static final long NODE_ID = 603;
33
34 public void testAddressMap() throws Exception
35 {
36 final NXCSession session = connect();
37
38 long[] map = session.getSubnetAddressMap(SUBNET_ID);
39 for(int i = 0; i < map.length; i++)
40 System.out.println(i + ": " + map[i]);
41
42 session.disconnect();
43 }
44
45 public void testLinkLayerTopology() throws Exception
46 {
47 final NXCSession session = connect();
48
49 NetworkMapPage page = session.queryLayer2Topology(NODE_ID);
50 for(NetworkMapElement e : page.getElements())
51 System.out.println(e.toString());
52 for(NetworkMapLink l : page.getLinks())
53 System.out.println(l.toString());
54
55 session.disconnect();
56 }
57 }