Sunteți pe pagina 1din 11

Automatizacin de Pruebas de Conectividad y Ampliaciones de Enlace

junio 11

2013
Centro de Gestin Corporativo

Automatizacin de Scripts de Mantenimiento y Demos de Ampliacin por Saturacin y por Demanda. Neffer Yacyd Gutierrez Cordoba Jorge Enrique Oviedo Samaniego

Contenido
AutoDemo1.0.1 y AutoDemoCon1.0.1 ............................................................................................... 2 Introduccin .................................................................................................................................... 2 Preparacin ..................................................................................................................................... 2 Pasos para realizar un Demo de Ampliacin con AutoDemo1.0.1 ................................................. 2 Paso 1. Se Ingresa el Nodo. ......................................................................................................... 2 Paso 2. Se Ingresa la Interface..................................................................................................... 3 Paso 3. Se Ingresa el CAR. ........................................................................................................... 3 Resultados ................................................................................................................................... 3 Pasos para realizar un Demo de Ampliacin con AutoDemoCon1.0.1 ........................................... 4 Paso 1. Se Ingresa el Nodo. ......................................................................................................... 4 Paso 2. Se Ingresa la Interface..................................................................................................... 4 Paso 3. Se Ingresa la Clase a aplicar el Demo. ............................................................................. 4 Paso 4. Se Ingresa el CAR. ........................................................................................................... 5 Resultados ................................................................................................................................... 5 Recomendaciones ........................................................................................................................... 5 Pruebas de PING, antes de la realizacin de un mantenimiento .................................................... 6 Forma del documento en Excel ................................................................................................... 6 Script y resultados ....................................................................................................................... 6 ANEXOS ............................................................................................................................................... 8 Cdigo AutoDemo1.0.1 ................................................................................................................... 8 Cdigo AutoDemoCon1.0.1............................................................................................................. 9 Cdigo Pruebas PING .................................................................................................................... 10

AutoDemo1.0.1 y AutoDemoCon1.0.1
Introduccin
En la siguiente gua se explicar cmo realizar demos de ampliacin por saturacin a travs de los programa AutoDemo1.0.1 (Demos Normales) y AutoDemoCon1.0.1 (Demos Car Contenidos), desarrollados sobre el lenguaje VB Script. Estos programas se crean con el fin de mejorar la gestin de los demos de ampliacin, disminuyendo los tiempos de gestin de los mismos y proponiendo una alternativa viable para optimizar recursos.

Preparacin
Antes de poder realizar cualquier demo de ampliacin, se deben configurar los programas para que siempre lean la contrasea de Tacacs, cada vez que se ejecuten:

Para ingresar la contrasea Tacacs, primero se abre el programa en el Bloc de Notas de Windows y luego se digita la contrasea en el espacio indicado. Se deben guardar los cambios realizados y hecho esto; el programa ya se encuentra listo para ejecutar los demos de ampliacin.

Pasos para realizar un Demo de Ampliacin con AutoDemo1.0.1


Paso 1. Se Ingresa el Nodo. Lo primero que se debe hacer es ingresar el nodo en el cual se encuentra configurado el servicio.

Paso 2. Se Ingresa la Interface. Inmediatamente despus de ingresar el Nodo, el programa pedir ingresar tambin la interfaz lgica del servicio.

Paso 3. Se Ingresa el CAR. Por ltimo se debe ingresar el CAR al que se desea ampliar el servicio; es decir el CAR que corresponde al doble de ancho de banda que se encuentre configurado; o tambin se puede ingresar el CAR deseado para retirar el Demo en caso de que ya se encuentre aplicado.

Resultados El programa arrojar automticamente un sh run del servicio, para que la persona pueda verificar que efectivamente el demo qued configurado y tambin la hora de aplicacin del Demo, con el fin de documentarlo en el ticket correspondiente. Finalmente el programa arrojar una ventana confirmando la ejecucin del Demo:

Pasos para realizar un Demo de Ampliacin con AutoDemoCon1.0.1


Paso 1. Se Ingresa el Nodo. Lo primero que se debe hacer es ingresar el nodo en el cual se encuentra configurado el servicio.

Paso 2. Se Ingresa la Interface. Inmediatamente despus de ingresar el Nodo, el programa pedir ingresar tambin la interfaz lgica del servicio.

Paso 3. Se Ingresa la Clase a aplicar el Demo. El programa pedir que se le indique la clase en la cual se va a aplicar el demo, dentro del servicio CAR Contenido. Ej: Class class-default.

Paso 4. Se Ingresa el CAR. Por ltimo se debe ingresar el CAR al que se desea ampliar o disminuir el servicio; Para el caso de los servicios CAR Contenidos, se debe ingresar el valor del BW en bytes, Ej: Si se quiere un Bw de 9 GB entonces se debe ingresar el numero 9000000000.

Resultados El programa arrojar automticamente un sh policy-map del servicio, para que la persona pueda verificar que efectivamente el demo qued configurado y tambin la hora de aplicacin del Demo, con el fin de documentarlo en el ticket correspondiente. Finalmente el programa arrojar una ventana confirmando la ejecucin del Demo:

Recomendaciones
Los Programas se crearon tanto para aplicar los Demos de Ampliacin, como tambin para retirarlos. En Cualquier etapa del proceso la persona puede oprimir el botn CANCELAR para detener la ejecucin y/o aplicacin del Demo. Por Favor Verificar la informacin ingresada antes de oprimir OK, con el fin de evitar problemas y fallas del programa. En caso de Fallas o ingresos errneos de informacin; Los Programas fueron creados para que solo se modifique el ancho de banda del servicio, por lo que no existirn fallas que generen otro tipo de modificaciones. En Caso de Anomalas; Por Favor cancelar el script y seguir con el proceso Manualmente.

Pruebas de PING, antes de la realizacin de un mantenimiento


Este documento se hizo para tomar los cdigos de servicio previamente escritos en las descripciones de las interfaces de un router, manejado a travs de una conexin ssh. Forma del documento en Excel El siguiente script se hizo para leer un archivo de Excel con un listado de los cdigos que identifica cada interfaz lgica, y el nombre del router en donde estn ubicadas de la siguiente manera:

Script y resultados La idea es que el script escriba sobre el documento, la ID de la interfaz lgica y diga si el ping fue fallido o exitoso sobre la misma. En esta primera etapa del script se logra una prueba inicial de conectividad que es el ping. A travs de un cdigo en VB Script, se leer cada lnea y se har la prueba de ping. El resultado en la herramienta SecureCRT dnde se puede ejecutar este script es el siguiente:

Finalmente pedir que se guarden los cambios del archivo y se podr ver el resultado en el archivo:

ANEXOS
Cdigo AutoDemo1.0.1
#$language = "VBScript" #$interface = "1.0" crt.Screen.Synchronous = True ' This automatically generated script may need to be Sub Main dim inter,nodo,carnew,caractual,caractualin,caractualout,fila,inter2 nodo = crt.Dialog.Prompt("Ingresa el Nodo") if nodo = "" then exit sub inter = crt.Dialog.prompt("Ingresa la Interface") if inter = "" then exit sub crt.Screen.Send "ssh " & nodo & chr(13) crt.Screen.WaitForString "assword:" crt.Screen.Send "Colombia123*" & chr(13) 'POR FAVOR; INGRESA DENTRO DE LAS COMILLAS ("Colombia123*") TU CLAVE TACACS Y GUARDA CAMBIOS. crt.Screen.WaitForString "#" crt.Screen.Send "show run interface " & inter & " | include interface|CAR" & chr(13) crt.Screen.WaitForString "#" carnew = crt.dialog.prompt("Nuevo CAR") if carnew = "" then exit sub fila = crt.screen.CurrentRow - 3 inter2 = crt.Screen.Get(fila, 1, fila, 60 ) fila = crt.screen.CurrentRow - 2 caractualin = crt.Screen.Get(fila, 16, fila, 60 ) fila = crt.screen.CurrentRow - 1 caractualout = crt.Screen.Get(fila, 16, fila, 60 ) crt.screen.send "conf terminal" & chr(13) crt.Screen.WaitForString "ig)#" crt.screen.send inter2 & chr(13) crt.Screen.WaitForString "(config-subif)#" crt.screen.send "no service-policy" & caractualin & chr(13) crt.Screen.WaitForString "(config-subif)#" crt.screen.send "no service-policy" & caractualout & chr(13) crt.Screen.WaitForString "(config-subif)#" crt.screen.send "service-policy input " & carnew & chr(13) crt.Screen.WaitForString "(config-subif)#" crt.screen.send "service-policy output " & carnew & chr(13) crt.Screen.WaitForString "(config-subif)#" crt.Screen.Send chr(26) & chr(13) crt.Screen.WaitForString "#" crt.Screen.Send chr(13) crt.Screen.WaitForString "#" crt.Screen.Send chr(13) crt.Screen.WaitForString "#" crt.Screen.Send chr(13) crt.Screen.WaitForString "#" crt.Screen.Send "show run " & inter2 & chr(13) crt.Screen.WaitForString "#" crt.Screen.Send chr(13) crt.Screen.WaitForString "#" crt.Screen.Send "show clock" & chr(13) crt.Screen.Send "q" & chr(13) crt.Screen.WaitForString "$" msgbox "Demo Realizado con Exito, Gracias por Utilizar AutoDemo ;)" End Sub

Cdigo AutoDemoCon1.0.1
#$language = "VBScript" #$interface = "1.0" crt.Screen.Synchronous = True ' This automatically generated script may need to be ' edited in order to work correctly. Sub Main dim inter,nodo,carnew,caractual,fila,filao,ope,ola,caractualo nodo = crt.Dialog.Prompt("Ingresa el Nodo") if nodo = "" then exit sub inter = crt.Dialog.prompt("Ingresa la Interface") if inter = "" then exit sub crt.Screen.Send "ssh " & nodo & chr(13) crt.Screen.WaitForString "assword:" crt.Screen.Send "Colombia123*" & chr(13) 'POR FAVOR; INGRESA DENTRO DE LAS COMILLAS ("Colombia123*") TU CLAVE TACACS Y GUARDA CAMBIOS. crt.Screen.WaitForString "#" crt.Screen.Send "show run interface " & inter & " | include interface|CAR" & chr(13) crt.Screen.WaitForString "#" fila = crt.screen.CurrentRow - 2 filao = crt.screen.CurrentRow - 1 caractual = crt.screen.get(fila, 22, fila, 60) caractualo = crt.screen.get(filao, 23, filao, 60) crt.Screen.Send "show policy-map " & caractual & chr(13) crt.Screen.WaitForString "#" crt.Screen.Send "show policy-map " & caractualo & chr(13) crt.Screen.WaitForString "#" ola= crt.dialog.prompt("Clase a Aplicar el Demo") if ola = "" then exit sub carnew = crt.dialog.prompt("Nuevo CAR") if carnew = "" then exit sub ope = carnew /8 crt.screen.send "conf terminal" & chr(13) crt.Screen.WaitForString "ig)#" crt.screen.send "policy-map " & caractual & chr(13) crt.Screen.WaitForString "(config-pmap)#" crt.screen.send ola & chr(13) crt.Screen.WaitForString "(config-pmap-c)#" crt.screen.send "police cir " & carnew & " bc " & ope & " be " & ope & chr(13) crt.Screen.WaitForString "(config-pmap-c-police)#" crt.Screen.Send chr(26) & chr(13) crt.Screen.WaitForString "#" crt.Screen.Send "show policy-map " & caractual & chr(13) crt.Screen.WaitForString "#" crt.Screen.Send chr(13) crt.Screen.WaitForString "#" crt.Screen.Send "show clock" & chr(13) crt.Screen.Send "q" & chr(13) crt.Screen.WaitForString "$" msgbox "Demo Realizado con Exito, Gracias por Utilizar AutoDemo ;)" End Sub

Cdigo Pruebas PING


#$language = "VBScript" #$interface = "1.0" crt.Screen.Synchronous = True Sub Main dim nodo, introw, inter, vrf, ip, ipc, str, digi, numero, shift, fist Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("D:\Jorge\chklist\prueba.xlsx") introw = 2 nodo = objExcel.Cells(1,1).Value crt.screen.send "ssh " & nodo & chr(13) crt.screen.waitforstring "#" do until objExcel.Cells(intRow,1).Value = "" crt.Screen.send "sh inter desc | inc " & objExcel.Cells(introw,1).Value & chr(13) crt.Screen.waitforstring "#" inter = crt.Screen.Get(crt.Screen.currentRow - 1,1,crt.Screen.currentRow - 1, 20) crt.Screen.send "sh run inter " & inter & " | inc vrf | ip addr" & chr(13) crt.Screen.waitforstring "#" vrf = crt.Screen.Get(crt.Screen.currentRow - 2,20,crt.Screen.currentRow - 2, 50) digi = 0 do until ipc = 3 do until str = "." str = crt.Screen.Get(crt.Screen.currentRow - 1,13 + digi,crt.Screen.currentRow - 1,13 + digi) ip = ip & str digi = digi + 1 'msgbox str 'str = crt.Dialog.Prompt("Nodo") if digi > 15 then objExcel.Quit end if Loop str = "" ipc = ipc + 1 Loop fist = 0 do until str = " " str = crt.Screen.Get(crt.Screen.currentRow - 1,13+digi+fist,crt.Screen.currentRow - 1,13+digi+fist) fist = fist+1 loop numero = crt.Screen.Get(crt.Screen.currentRow - 1,13 + digi,crt.Screen.currentRow - 1,13+digi+fist-2)+1 if numero = 255 then ip = crt.Screen.Get(crt.Screen.currentRow - 1,13,crt.Screen.currentRow - 1,13+digi-4) shift = crt.Screen.Get(crt.Screen.currentRow - 1,13 + digi -3,crt.Screen.currentRow - 1,13+digi+2-3)+1 numero = shift & "." & "1" end if crt.Screen.send "ping vrf " & vrf & " " & ip & numero & chr(13) crt.Screen.waitforstring "#" objExcel.Cells(introw,2).Value = inter if crt.Screen.Get(crt.Screen.currentRow - 2,1,crt.Screen.currentRow - 2,3) = "!!!" then objExcel.Cells(introw,3).Value = "Exitoso" else objExcel.Cells(introw,3).Value = "Fallido" end if introw = introw + 1 ipc = 0 ip = "" loop objExcel.Quit End Sub

S-ar putea să vă placă și