Bonjour
j'ai un tableau où je stock les interfaces d'un routeur cisco
alors je veux ensuite lancer la commande "show running-config interface..."
sur chaque interface du tableau
par exemple le tableau myData contient:
Fa0
FA6
fa7
..
la commande doit se lancée comme celà
show running-config interface Fa0
show running-config interface Fa6
...
j'ai essayer avec le code suivant mais rien ne marche
S'il vous plait aidez moi
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 if(myData.get(0)!=null){ String data=myData.get(0).toString(); System.out.println("Data at 0th element is "+data); write("show running-config interface "+data); fichierUntil(data); // le fichierUntil est une fonction qui contient le traitement du résultat de la commande public String fichierUntil(String device) throws IOException { StringBuffer sb = new StringBuffer(); char ch; try { readUntil1("show running-config interface "+device); while (true) { do { ch = (char) in.read(); sb.append(ch); } while(ch!='#');
Partager