Jump to content

FileWrite Loop Issues


Go to solution Solved by 0xdefea7,

Recommended Posts

Added the @error message as suggested and now the variables aren't being written any more.

>Running:(3.3.8.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\tcovert\Desktop\array loop test 7-6-2013.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
First Line Test
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
Last Line Test
+>00:39:00 AutoIT3.exe ended.rc:0
>Exit code: 0    Time: 9.340
Edited by atnextc
Link to comment
Share on other sites

 

This is where all of my information is coming from for all of the functions that I have in my much bigger script.  Currently I have the above at the start of every function, is there a way that I can have this be "global" so that I don't have to have all these multiple lines of code bundling up my script

 

Absolutely:

Func WhateverYouWantToNameThisFunction($iNumberOfProjects)

    ConsoleWrite("First Line Test" & @CRLF)

    Do
        $oIE = _IECreate("https://internalsite/mediawiki/index.php?title=" & GUICtrlRead($ProjectNameInputBox) & "&action=edit", 0, 0, 1, 1)
        _IELinkClickByText($oIE, "Continue to this website (not recommended).")
        If @error Then ContinueLoop
        $string = _IEBodyReadHTML($oIE)
        $data = $oIE
        _IEQuit($oIE)

        Local $asideinterface = _StringBetween($string, '|AInterface=', @CRLF)
        Local $zsideinterface = _StringBetween($string, '|ZInterface=', @CRLF)
        Local $asiderouter = _StringBetween($string, '|ALocation=', @CRLF)
        Local $zsiderouter = _StringBetween($string, '|ZLocation=', @CRLF)
        Local $asidetransport = _StringBetween($string, '|ATransportLocation=', @CRLF)
        Local $zsidetransport = _StringBetween($string, '|ZTransportLocation=', @CRLF)
        Local $asidefpc = _StringBetween($string, '|AFPC=', @CRLF)
        Local $zsidefpc = _StringBetween($string, '|ZFPC=', @CRLF)
        Local $asidepic = _StringBetween($string, '|APIC=', @CRLF)
        Local $zsidepic = _StringBetween($string, '|ZPIC=', @CRLF)
        Local $asideoptics = _StringBetween($string, '|AOptics=', @CRLF)
        Local $zsideoptics = _StringBetween($string, '|ZOptics=', @CRLF)
        Local $asidetam = _StringBetween($string, '|ATAM=', @CRLF)
        Local $zsidetam = _StringBetween($string, '|ZTAM=', @CRLF)
        Local $asidetom = _StringBetween($string, '|ATOM=', @CRLF)
        Local $zsidetom = _StringBetween($string, '|ZTOM=', @CRLF)
        Local $asidetestip = _StringBetween($string, '|ATestingIP=', @CRLF)
        Local $zsidetestip = _StringBetween($string, '|ZTestingIP=', @CRLF)
        Local $aprojincr = StringRegExp(GUICtrlRead($ProjectNameInputBox), "(?<=-\d{2})([A-Z])(?=-Q)", 3)
        Local $aprojincr = StringRegExp(GUICtrlRead($ProjectNameInputBox), "(?<=-\d{2})([A-Z])(?=-Q)", 3)
        Local $incr_char = Chr(Asc($aprojincr[0]) + 1)

        GUICtrlSetData($ProjectNameInputBox, StringRegExpReplace(GUICtrlRead($ProjectNameInputBox), _
                "(?<=-\d{2})([A-Z])(?=-Q)", $incr_char))

        $I += 1

        ConsoleWrite($asideinterface[0] & @CRLF)
        ConsoleWrite($zsideinterface[0] & @CRLF)

    Until $I = $iNumberOfProjects
        ConsoleWrite("Last Line Test" & @CRLF)

EndFunc   ;==>WhateverYouWantToNameThisFunction
Link to comment
Share on other sites

 

Added the @error message as suggested and now the variables aren't being written any more.

>Running:(3.3.8.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\tcovert\Desktop\array loop test 7-6-2013.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
First Line Test
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
Last Line Test
+>00:39:00 AutoIT3.exe ended.rc:0
>Exit code: 0    Time: 9.340

 

My bad on that one. Should be:

If Not @error = 0 Then ContinueLoop
Link to comment
Share on other sites

new code as suggested.

ConsoleWrite("First Line Test" & @CRLF)

            Do

                $oIE = _IECreate("https://internal/mediawiki/index.php?title=" & GUICtrlRead($ProjectNameInputBox) & "&action=edit", 0, 0, 1, 1)
                _IELinkClickByText($oIE, "Continue to this website (not recommended).")
                If not @error = 0 Then ContinueLoop
                $string = _IEBodyReadHTML($oIE)
                $data = $oIE
                _IEQuit($oIE)

                Local $asideinterface = _StringBetween($string, '|AInterface=', @CRLF)
                Local $zsideinterface = _StringBetween($string, '|ZInterface=', @CRLF)
                Local $asiderouter = _StringBetween($string, '|ALocation=', @CRLF)
                Local $zsiderouter = _StringBetween($string, '|ZLocation=', @CRLF)
                Local $asidetransport = _StringBetween($string, '|ATransportLocation=', @CRLF)
                Local $zsidetransport = _StringBetween($string, '|ZTransportLocation=', @CRLF)
                Local $asidefpc = _StringBetween($string, '|AFPC=', @CRLF)
                Local $zsidefpc = _StringBetween($string, '|ZFPC=', @CRLF)
                Local $asidepic = _StringBetween($string, '|APIC=', @CRLF)
                Local $zsidepic = _StringBetween($string, '|ZPIC=', @CRLF)
                Local $asideoptics = _StringBetween($string, '|AOptics=', @CRLF)
                Local $zsideoptics = _StringBetween($string, '|ZOptics=', @CRLF)
                Local $asidetam = _StringBetween($string, '|ATAM=', @CRLF)
                Local $zsidetam = _StringBetween($string, '|ZTAM=', @CRLF)
                Local $asidetom = _StringBetween($string, '|ATOM=', @CRLF)
                Local $zsidetom = _StringBetween($string, '|ZTOM=', @CRLF)
                Local $asidetestip = _StringBetween($string, '|ATestingIP=', @CRLF)
                Local $zsidetestip = _StringBetween($string, '|ZTestingIP=', @CRLF)
                Local $aprojincr = StringRegExp(GUICtrlRead($ProjectNameInputBox), "(?<=-\d{2})([A-Z])(?=-Q)", 3)
                Local $aprojincr = StringRegExp(GUICtrlRead($ProjectNameInputBox), "(?<=-\d{2})([A-Z])(?=-Q)", 3)
                Local $incr_char = Chr(Asc($aprojincr[0]) + 1)

                GUICtrlSetData($ProjectNameInputBox, StringRegExpReplace(GUICtrlRead($ProjectNameInputBox), _
                        "(?<=-\d{2})([A-Z])(?=-Q)", $incr_char))

                $I += 1

                ConsoleWrite($asideinterface[0] & @CRLF)
                ConsoleWrite($zsideinterface[0] & @CRLF)

            Until $I = $C
ExitLoop
    EndSwitch

WEnd

This is still looping continually until there is an error and is no longer stopping the loop when the number of iterations as been reached.

 

Console output

>Running:(3.3.8.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\tcovert\Desktop\array loop test 7-6-2013.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
First Line Test
et-0/0/11
xe-3/0/0
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
et-0/0/13
xe-3/1/0
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
et-1/0/11
xe-3/0/2
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
et-1/0/13
xe-3/1/2
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
et-2/0/11
xe-3/0/4
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
et-2/0/13
xe-3/1/4
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
C:\Users\tcovert\Desktop\array loop test 7-6-2013.au3 (105) : ==> Subscript used with non-Array variable.:
ConsoleWrite($asideinterface[0] & @CRLF)
ConsoleWrite($asideinterface^ ERROR
->00:45:02 AutoIT3.exe ended.rc:1
>Exit code: 1    Time: 36.075
Link to comment
Share on other sites

ah ok hang on.

|NextStep=Hardware/Testing
|TargetCompletionDate=July 2013
|CircuitID=13019.GE10P.ASBNVACYJBW.FLCHVA19JBW
|ProjectOverview=
|ProjectNotes=Z side Hardware/Testing completed on May 21, 2013
|ProjectType=C4 Hardware
||Priority=79%
|ProjectOpenDate= 2013-Q2
|FailureResponse=N/A
|Fatesharing=
|ProjectType=C4 Hardware
|LinktoCaridenPlan=
|ASideAssignedEngineer=
|ZSideAssignedEngineer= 
|ASideNextStep=
|ZSideNextStep=Traffic Add
|ALocation=ASHBBBRJ02
|ZLocation=MRFDBBRJ02
|ARouter=ASHBBBRJ02
|ZRouter=MRFDBBRJ02
|AInterface=et-0/0/11
|ZInterface=xe-3/0/0
|AOSPFMetric=
|ZOSPFMetric=
|AIPAddress=10.50.48.2
|ZIPAddress=10.50.48.1
|ATransportLocation=ASH-4-A-5-1-1
|ZTransportLocation=MRFD-5-A-5-1-1
|APOC=
|ZPOC= Chris Nicolai
|AChassisType=PTX
|ZChassisType=T1600
|AFPC=
|AFPCSerialNumber=
|ZFPC=T1600 FPC
|ZFPCSerialNumber=BBAJ4084
|ZFPC=T1600 FPC
|APIC=
|APICSerialNumber=
|ZPIC=10 x 10GE (LAN/WAN) SFPP
|ZPICSerialNumber=EN4605
|AOptics=
|AOpticsSerialNumber=
|ZOptics=SFPP-10G-LR
|ZOpticsSerialNumber=SAP31C73
|AConnector=
|ZConnector=LC
|AFiber=
|ZFiber=
|Ahardware=
|Zhardware=
|ATAM=MOVE
|ZTAM=MOVE
|ATOM=NONE
|ZTOM=NONE
|ABudgetCode=
|ZBudgetCode=
|ATransportSerialNumbers=
|ZTransportSerialNumbers=
|ATestingIP=192.168.55.2/30
|ZTestingIP=192.168.55.1/30
|ATransportNotes=BBOPS-TR:
|ZTransportNotes=BBOPS-TR:
|BypassName=
|BypassIP=
|BypassAConnector=
|BypassZConnector=
|DPIName=
|DPIIP=
|DPIAConnector=
|DPIZConnector=
|AInstallECM=
|AInstallDate=
|ZInstallECM=
|ZInstallDate=May 21, 2013
|ATrafficDate=
|ZTrafficDate=
|ATrafficECM=
|ZTrafficECM=
|AShipmentOneTracking=
|ZShipmentOneTracking=
|AShipmentTwoTracking=
|ZShipmentTwoTracking=( Fibers)
|AShipmentThreeTracking=
|ZShipmentThreeTracking=
|APeeringMaintenanceTicket=
|ZPeeringMaintenanceTicket=
|AInboundShipmentTicket=
|ZInboundShipmentTicket=
|}}

Here is the data that the script is reading from our wiki, and pulling the data after the "=" sign for the variables noted in the script.

Edited by atnextc
Link to comment
Share on other sites

To help put some things into better perspective here is what i'm trying to automate.  I've included the $variables in the script where I would for them to be replaced by what is pulled from the URL.

 

ROUTER CONFIGURATION TEMPLATE:

====================={ A Side }===================== 

$RouterA

Pre-Snap Shot:

show interface description | no-more
show rsvp interface | no-more
show mpls interface| no-more
show ospf neighbor| no-more
show pim neighbors| no-more
show bgp summary| no-more
show ldp interface| no-more
show ldp session | no-more
show ldp neighbor | no-more
show mpls lsp | match down
show igmp interface | no-more 
show bfd session summary
show log messages | last 300 


;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;


show interface extensive $ASideinterface | no-more 
show interface extensive $ASideAEinterface | no-more
show interface diagnostics optics $ASideinterface | match "Laser output power|Receiver signal average optical power"
ping rapid count 5000 $ZSideTestIP

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;

========================================================================================================================
Configuration Commands:

edit exclusive

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;


delete interfaces $ASideinterface

set interfaces $ASideinterface description "Cox;;C4 $ZSideRouter;$ZSideAEinterface;MR;10GE To $ZSideRouter;"
set interfaces gigether-options 802.3ad ae$AEinterface
set interfaces disable $ASideinterface

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;

show | compare 
commit check 
commit sync and quit 


====================={ Z Side }=====================

$RouterZ


Pre-snapshots

show interface description | no-more
show rsvp interface | no-more
show mpls interface| no-more
show ospf neighbor| no-more
show pim neighbors| no-more
show bgp summary| no-more
show ldp interface| no-more
show ldp session | no-more
show ldp neighbor | no-more
show mpls lsp | match down
show igmp interface | no-more 
show bfd session summary
show log messages | last 300 

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;

show interface extensive $ZSideinterface | no-more 
show interface extensive $ZsideAEinterface | no-more
show interface diagnostics optics $ZSideinterface | match "Laser output power|Receiver signal average optical power"
ping rapid count 5000 $ASideTestIP

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;


========================================================================================================================
Configuration Commands:


edit exclusive

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;

delete interfaces ZSideinterface

set interfaces $ZSideinterface description "Cox;;C4 $ZSideRouter;$ZSideAEinterface;MR;10GE To $ZSideRouter;"
set interfaces gigether-options 802.3ad 

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;


show | compare 
commit check 
commit sync and quit 



====================={ A Side }===================== 

$RouterA

========================================================================================================================

Configuration Commands:


;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;

delete interface $ASideinterface disable 

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;

show | compare 
commit check 
commit sync and quit 


Verification Commands:

show interface description | no-more
show rsvp interface | no-more
show mpls interface| no-more
show ospf neighbor| no-more
show pim neighbors| no-more
show bgp summary| no-more
show ldp interface| no-more
show ldp session | no-more
show ldp neighbor | no-more
show mpls lsp | match down
show igmp interface | no-more 
show bfd session summary

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;

show interface extensive $ASideinterface | no-more 
show interface extensive $ASideAEinterface | no-more
show interface extensive $ASideAEinterface | match put

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;
show log messages | last 300 



====================={ Z Side }===================== 

Verification Commands:

show interface description | no-more
show rsvp interface | no-more
show mpls interface| no-more
show ospf neighbor| no-more
show pim neighbors| no-more
show bgp summary| no-more
show ldp interface| no-more
show ldp session | no-more
show ldp neighbor | no-more
show mpls lsp | match down
show igmp interface | no-more 
show bfd session summary

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;

show interface extensive $ZSideinterface | no-more 
show interface extensive $ZSideAEinterface | no-more
show interface extensive $ZSideAEinterface | match put

;;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;

show log messages | last 300

Everything that's within the ";;;;;THIS IS PART THAT WILL BE LOOPED BASED ON THE NUMBER OF PROJECTS ENTERED;;;" lines will as noted need to be written in a loop.  Everything out side of those comments will only need to be written 1 time to my file so that it looks clean and concise.

 

Here is an actual config to give a better idea of what i'm looking for with actual data in place if it helps.

Thanks again everyone for all the help.

 

What I'm Trying To Automate:


Please Always verify your configs before committing!!!!!! 


====================={ A Side }===================== 



------Pre-flight A checks------


show interface description | no-more
show rsvp interface
show mpls interface
show ospf neighbor
show pim neighbors
show bgp summary
show ldp interface
show ldp session 
show ldp neighbor | no-more
show mpls lsp | match down
show igmp interface | no-more 
show bfd session summary
show log messages | last 300 | no-more
show interface 5 extensive | no-more 
show interface 5 extensive | no-more | match "l3"
show interface 1/0/0 extensive | no-more 
show interfaces diagnostics optics 1/0/0 | match " laser output | receiver"
show interface 1/0/0 extensive | no-more | match "l3"
show interface 1/1/1 extensive | no-more 
show interfaces diagnostics optics 1/1/1 | match " laser output | receiver"
show interface 1/1/1 extensive | no-more | match "l3"
show interface 1/1/2 extensive | no-more 
show interfaces diagnostics optics 1/1/2 | match " laser output | receiver"
show interface 1/1/2 extensive | no-more | match "l3"
show interface 1/1/3 extensive | no-more 
show interfaces diagnostics optics 1/1/3 | match " laser output | receiver"
show interface 1/1/3 extensive | no-more | match "l3"
show interface 1/1/4 extensive | no-more 
show interfaces diagnostics optics 1/1/4 | match " laser output | receiver"
show interface 1/1/4 extensive | no-more | match "l3"
show interface 1/1/5 extensive | no-more 
show interfaces diagnostics optics 1/1/5 | match " laser output | receiver"
show interface 1/1/5 extensive | no-more | match "l3"


Configurations


1) Configure new interfaces 

edit exclusive
delete interfaces 1/0/0
set interfaces 1/0/0 description ";;CID2134562;C4 BTNRBBRJ01;2/0/0;MR;10ge To BTNRBBRJ01;"
set interfaces 1/0/0 gigether-options 802.3ad 5 
set interfaces 1/0/0 disable 



delete interfaces 1/1/1
set interfaces 1/1/1 description ";;CID2134561;C4 BTNRBBRJ01;2/1/1;MR;10ge To BTNRBBRJ01;"
set interfaces 1/1/1 gigether-options 802.3ad 5 
set interfaces 1/1/1 disable 



delete interfaces 1/1/2
set interfaces 1/1/2 description ";;CID213456200;C4 BTNRBBRJ01;2/1/2;MR;10ge To BTNRBBRJ01;"
set interfaces 1/1/2 gigether-options 802.3ad 5 
set interfaces 1/1/2 disable 


delete interfaces 1/1/3
set interfaces 1/1/3 description ";;CID2134562456;C4 BTNRBBRJ01;2/1/3;MR;10ge To BTNRBBRJ01;"
set interfaces 1/1/3 gigether-options 802.3ad 5 
set interfaces 1/1/3 disable 



delete interfaces 1/1/4
set interfaces 1/1/4 description ";;CID2134562433;C4 BTNRBBRJ01;2/1/4;MR;10ge To BTNRBBRJ01;"
set interfaces 1/1/4 gigether-options 802.3ad 5 
set interfaces 1/1/4 disable 



delete interfaces 1/1/5
set interfaces 1/1/5 description ";;CID213452232;C4 BTNRBBRJ01;2/1/5;MR;10ge To BTNRBBRJ01;"
set interfaces 1/1/5 gigether-options 802.3ad 5 
set interfaces 1/1/5 disable 



2.Check and Save Configurations 

show | compare 
commit check 
commit sync and quit 





====================={ Z Side }=====================


show interface description | no-more
show rsvp interface
show mpls interface
show ospf neighbor
show pim neighbors
show bgp summary
show ldp interface
show ldp session 
show ldp neighbor | no-more
show mpls lsp | match down
show igmp interface | no-more 
show bfd session summary
show log messages | last 300 | no-more
show interface 6 extensive | no-more 
show interface 6 extensive | no-more | match "l3"
show interface 2/0/0 extensive | no-more 
show interfaces diagnostics optics 2/0/0 | match " laser output | receiver"
show interface 2/0/0 extensive | no-more | match "l3"
show interface 2/1/1 extensive | no-more 
show interfaces diagnostics optics 2/1/1 | match " laser output | receiver"
show interface 2/1/1 extensive | no-more | match "l3"
show interface 2/1/2 extensive | no-more 
show interfaces diagnostics optics 2/1/2 | match " laser output | receiver"
show interface 2/1/2 extensive | no-more | match "l3"
show interface 2/1/3 extensive | no-more 
show interfaces diagnostics optics 2/1/3 | match " laser output | receiver"
show interface 2/1/3 extensive | no-more | match "l3"
show interface 2/1/4 extensive | no-more 
show interfaces diagnostics optics 2/1/4 | match " laser output | receiver"
show interface 2/1/4 extensive | no-more | match "l3"
show interface 2/1/5 extensive | no-more 
show interfaces diagnostics optics 2/1/5 | match " laser output | receiver"
show interface 2/1/5 extensive | no-more | match "l3"




Configurations

1) Configure new interfaces 

edit exclusive
delete interfaces 2/0/0
set interfaces 2/0/0 description ";;CID2134562;C4 ASHBBBRJ02;1/0/0;MR;10ge To ASHBBBRJ02;"
set interfaces 2/0/0 gigether-options 802.3ad 6 



delete interfaces 2/1/1
set interfaces 2/1/1 description ";;CID2134561;C4 ASHBBBRJ02;1/1/1;MR;10ge To ASHBBBRJ02;"
set interfaces 2/1/1 gigether-options 802.3ad 6 



delete interfaces 2/1/2
set interfaces 2/1/2 description ";;CID213456200;C4 ASHBBBRJ02;1/1/2;MR;10ge To ASHBBBRJ02;"
set interfaces 2/1/2 gigether-options 802.3ad 6 



delete interfaces 2/1/3
set interfaces 2/1/3 description ";;CID2134562456;C4 ASHBBBRJ02;1/1/3;MR;10ge To ASHBBBRJ02;"
set interfaces 2/1/3 gigether-options 802.3ad 6 



delete interfaces 2/1/4
set interfaces 2/1/4 description ";;CID2134562433;C4 ASHBBBRJ02;1/1/4;MR;10ge To ASHBBBRJ02;"
set interfaces 2/1/4 gigether-options 802.3ad 6 



delete interfaces 2/1/5
set interfaces 2/1/5 description ";;CID213452232;C4 ASHBBBRJ02;1/1/5;MR;10ge To ASHBBBRJ02;"
set interfaces 2/1/5 gigether-options 802.3ad 6 


show | compare 
commit check 
commit sync and quit 





ASHBBBRJ02



delete interface 1/0/0 disable 
delete interface 1/1/1 disable 
delete interface 1/1/2 disable 
delete interface 1/1/3 disable 
delete interface 1/1/4 disable 
delete interface 1/1/5 disable 

show | compare 
commit check 
commit sync and quit 

------------------------Verification A Side ----------------------- 


show interface description | no-more
show rsvp interface
show mpls interface
show ospf neighbor
show pim neighbors
show bgp summary
show ldp interface
show ldp session 
show ldp neighbor | no-more
show mpls lsp | match down
show igmp interface | no-more 
show bfd session summary
show log messages | last 300 | no-more

show interface 5 extensive | no-more 
show interface 5 extensive | no-more | match "l3"

show interface 1/0/0 extensive | no-more 
show interfaces diagnostics optics 1/0/0 | match " laser output | receiver"
show interface 1/0/0 extensive | no-more | match "l3"

show interface 1/1/1 extensive | no-more 
show interfaces diagnostics optics 1/1/1 | match " laser output | receiver"
show interface 1/1/1 extensive | no-more | match "l3"

show interface 1/1/2 extensive | no-more 
show interfaces diagnostics optics 1/1/2 | match " laser output | receiver"
show interface 1/1/2 extensive | no-more | match "l3"

show interface 1/1/3 extensive | no-more 
show interfaces diagnostics optics 1/1/3 | match " laser output | receiver"
show interface 1/1/3 extensive | no-more | match "l3"

show interface 1/1/4 extensive | no-more 
show interfaces diagnostics optics 1/1/4 | match " laser output | receiver"
show interface 1/1/4 extensive | no-more | match "l3"

show interface 1/1/5 extensive | no-more 
show interfaces diagnostics optics 1/1/5 | match " laser output | receiver"
show interface 1/1/5 extensive | no-more | match "l3"


show log messages | last 






------------------------Verification Z Side ----------------------- 


show interface description | no-more
show rsvp interface
show mpls interface
show ospf neighbor
show pim neighbors
show bgp summary
show ldp interface
show ldp session 
show ldp neighbor | no-more
show mpls lsp | match down
show igmp interface | no-more 
show bfd session summary
show log messages | last 300 | no-more

show interface 6 extensive | no-more 
show interface 6 extensive | no-more | match "l3"

show interface 2/0/0 extensive | no-more 
show interfaces diagnostics optics 2/0/0 | match " laser output | receiver"
show interface 2/0/0 extensive | no-more | match "l3"

show interface 2/1/1 extensive | no-more 
show interfaces diagnostics optics 2/1/1 | match " laser output | receiver"
show interface 2/1/1 extensive | no-more | match "l3"

show interface 2/1/2 extensive | no-more 
show interfaces diagnostics optics 2/1/2 | match " laser output | receiver"
show interface 2/1/2 extensive | no-more | match "l3"

show interface 2/1/3 extensive | no-more 
show interfaces diagnostics optics 2/1/3 | match " laser output | receiver"
show interface 2/1/3 extensive | no-more | match "l3"

show interface 2/1/4 extensive | no-more 
show interfaces diagnostics optics 2/1/4 | match " laser output | receiver"
show interface 2/1/4 extensive | no-more | match "l3"

show interface 2/1/5 extensive | no-more 
show interfaces diagnostics optics 2/1/5 | match " laser output | receiver"
show interface 2/1/5 extensive | no-more | match "l3"



----------------END----------------------
Link to comment
Share on other sites

  • Solution

It is really large. I would work on breaking it down to chunks in smaller functions to handle each different scenario. I built one for you already, it looks like you need 6 or 7 different ones, all called from within your "do..while" loop. You can replace the FileWriteLine to ConsoleWrite if you want as well for testing:

Func WriteChunk($ASideinterface, $ZSideRouter, $ZSideAEinterface)

    FileWriteLine($hFile, 'delete interfaces ' & $ASideinterface)
    FileWriteLine($hFile, 'set interfaces ' & $ASideinterface & ' description " Cox;;C4 ' & $ZSideRouter & ';' & $ZSideAEinterface & ';MR;10GE To ' & $ZSideRouter & ';"')
    FileWriteLine($hFile, 'set interfaces ' & $ASideinterface & ' gigether-options 802.3ad 6')

EndFunc   ;==>WriteChunk
Link to comment
Share on other sites

Thanks I was thinking I was going to have to go that route as well..

Would the variables that are getting pulled from the URL link have to be delcared within each seperate function as well?  I would imagine so as it wouldn't know what those variables would be.

Link to comment
Share on other sites

No they would not need to be declared in the function. Here is how it works:

Local $a = "Some string", $b = 5 ; Here we initialize 2 variables

MyFunction($a, $b) ;Here we call the function, passing our initialized variables as parameters (note we are not using $sString or $iDigit here)

;~ Below just defines the function, above initializes the variables and calls the function
Func MyFunction($sString, $iDigit) 

    ConsoleWrite("I am using the $sString parameter here: " & $sString & @CRLF)
    ConsoleWrite("I am using the $iDigit parameter here: " & $iDigit & @CRLF)

EndFunc

You should see this if my example does not make sense: http://www.autoitscript.com/autoit3/docs/intro/lang_functions.htm

Edited by 0xdefea7
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...