TopoDiscoTest.java
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.sitech.ismp.topo.test;
import java.util.HashMap;
import java.util.Scanner;
import com.sitech.ismp.topo.TopoDisco;
import com.sitech.jmx.manage.MessageSenderManager;
public class TopoDiscoTest {
private static String read(String prompt) {
Scanner scanner = new Scanner(System.in);
System.out.print(prompt);
return scanner.nextLine();
}
public static void main(String[] args) {
System.out.println("***************拓扑发现测试*********************");
String taskId = read("请输入任务ID:\n");
String discoSeed = read("请输入自动发现种子(多个用逗号分割):\n");
String discoRange = read("请输入发现范围,格式[IP:子网掩码,IP:子网掩码]:\n");
String discoCommunity = read("请输入自动发现SNMP通信串(多个用逗号分割):\n");
String isDiscoHost = read("是否发现主机(y/n):\n");
isDiscoHost = isDiscoHost.toLowerCase().equals("y")? "true" : "false";
new MessageSenderManager().startAllMessageSender();
TopoDisco disco = new TopoDisco();
HashMap<String, String> params = new HashMap<String, String>();
params.put("TASK_ID", taskId);
params.put("DISCO_SEED", discoSeed);
params.put("DISCO_RANGE", discoRange);
params.put("DISCO_COMMUNITY", discoCommunity);
params.put("DISCO_HOST_FLAG", isDiscoHost);
disco.run(params);
}
}