Control script or XML script?

Post Reply
oker
Member
Posts: 2
Joined: 25 Jun 2014 16:41

Control script or XML script?

Post by oker » 25 Jun 2014 17:08

We plan to update port description on around 150 ports of RE on SAM, using script. My ideal is to load spreadsheet which contains updated port description on SAM, then get the content (here updated port description) from the file line by line and put them in an array, then assign the value in the array to $sap.description. My question is: do we need control script to do this in this case? I just load the spreadsheet from a FTP server to SAM, do not invoke any scripts. But the load command "#set( $loadResult = $alCtrl.loadURLFile[/color]("file:///Input.csv") )" is a control script command? Can I use it in xml script? Is there simpler way to accomplish this task? Thanks.

oker
Member
Posts: 2
Joined: 25 Jun 2014 16:41

Re: Control script or XML script?

Post by oker » 16 Jul 2014 21:32

Some updates about the port description project. I didn't use control script to load text file which contains new port description, but only used CLI script. I used the control script command #set( $loadResult = $alCtrl.loadURLFile("file:///Input.csv") )" to load this text file. There was no parse error, but it seems that the file was not loaded. Then I tried to use #include to load file, but it gave parse error. Following is the code. I don't know 1. if the file resource configuration is correct. 2. why the #include command is wrong? Anyone has any ideas? Thanks.

#resource.loader = file
#file.resource.loader.description = Velocity File Resource Loader
#file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
#file.resource.loader.path = /opt/nn/scripting/
#file.resource.loader.cache = false
#file.resource.loader.modificationCheckInterval = 0

#set ($portdescArray = [])

#set ($loadResult = #include("/opt/nn/scripting/portdesctest2"))

#set( $portdescFile = $loadResult.getFile())

#set( $lineIterator = $portdescFile.lineIterator() )

#foreach( $line in $lineIterator )

#set($portdescArray=$line.getLine())

#end

#$lineIterator.close()

#set ($i = 0)

#foreach ( $port in $portList )

#if (!($i == 2))

#set ( $portName = $port.PortIdentifyingName )

configure port $portName

description $portdescArray[$i]

#set ($i = $i +1)

#else

$alUtil.userError("error")

#end

#end

aviviis
Member
Posts: 23
Joined: 01 Feb 2018 16:19

Re: Control script or XML script?

Post by aviviis » 16 Mar 2018 12:14

Hi
I also have some question on xml script on sam5620 can you send your email

Post Reply

Return to “5620 SAM”