CollFibreSwitch.java
2.51 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.sitech.ismp.coll.centercoll;
import java.util.HashMap;
import java.util.Vector;
import com.sitech.ismp.coll.CollCiscoSwitch;
import com.sitech.ismp.coll.basic.TblATO_KPIDETAIL;
import com.sitech.util.DES3;
public class CollFibreSwitch implements CollFibreSwitchMBean {
public Vector getSys(HashMap params) {
String IP;
int PORT;
String COMMUNITY;
String HOST_NAME;
IP = (String) params.get("IP");
PORT = Integer.parseInt((String) params.get("PORT"));
COMMUNITY = DES3.decrypt((String) params.get("COMMUNITY"));
HOST_NAME = (String) params.get("HOST_NAME");
CollFibreSwitchWithSNMP brocade = new CollFibreSwitchWithSNMP(IP, PORT,
COMMUNITY, HOST_NAME);
Vector kpiVector = new Vector();
kpiVector.add(brocade.getDeviceState());
kpiVector.add(brocade.getPortNum());
kpiVector.add(brocade.getSoftVersion());
kpiVector.add(brocade.getHostName());
kpiVector.add(brocade.getIpAddr());
return kpiVector;
}
public Vector getPort(HashMap params) {
// TODO Auto-generated method stub
String IP;
int PORT;
String COMMUNITY;
String HOST_NAME;
IP = (String) params.get("IP");
PORT = Integer.parseInt((String) params.get("PORT"));
COMMUNITY = DES3.decrypt((String) params.get("COMMUNITY"));
HOST_NAME = (String) params.get("HOST_NAME");
CollFibreSwitchWithSNMP brocade = new CollFibreSwitchWithSNMP(IP, PORT,
COMMUNITY, HOST_NAME);
return brocade.getPortKpi();
}
public static void main(String[] args) {
System.out.println("Brocade Fibre Switch Collection");
if (args.length < 4 || args.length > 4) {
System.out
.println("please input params <IpAdress> <Port> <Community> <HostName>");
System.exit(0);
}
HashMap params = new HashMap();
params.put("IP", args[0]);
params.put("PORT", args[1]);
params.put("COMMUNITY", DES3.encrypt(args[2]));
params.put("HOST_NAME", args[3]);
CollFibreSwitch brocade = new CollFibreSwitch();
Vector vector_ds = brocade.getSys(params);
Vector vector_port = brocade.getPort(params);
for (int i = 0; i < vector_ds.size(); i++) {
TblATO_KPIDETAIL ato = (TblATO_KPIDETAIL) vector_ds.get(i);
System.out.println(ato.UNIT_ID + " | " + ato.KPI_ID + " | "
+ ato.KPI_VALUE + " | " + ato.CLL_TIME);
}
System.out
.println("===================================================================");
for (int i = 0; i < vector_port.size(); i++) {
TblATO_KPIDETAIL ato = (TblATO_KPIDETAIL) vector_port.get(i);
System.out.println(ato.UNIT_ID + " | " + ato.KPI_ID + " | "
+ ato.KPI_VALUE + " | " + ato.CLL_TIME);
}
}
}