| |
This section attempts to answer some of the questions people have asked. If you have a question that you feel should be answered here please contact the author.
Will OVM run all my Ozterm scripts ? |
|
| Yes and no. Only Ozterm (or an application very much like it) could run all "Ozterm" scripts. However – any OVM application should be able to run those commands which are not application specific. |
|
Why does OVM stand for Ozterm Virtual Machine if it’s not Ozterm ? |
|
| Ozterm is a DOS based network element maintenance tool developed for use within Network Operations. To acknowledge its history, and its original purpose the O in OVM stands for Ozterm. OVM is a C++ library (Ozterm was written in Borland Pascal and 8088 assembly language) that allows any application to provide a script language that is heavily based on the script language provided by Ozterm. This library can be used by any application (including Ozterm like applications). At the time of writing versions of OVM have been used in the following projects : NECH – Network Element Communications Handler. Each NECH session creates two OVM instances to send, and receive data via NEAS, and to process AXE, and SYS12 commands to determine if they succeeded. NECH runs on the SUN Solaris platform. DCAPTerm – DCAP Terminal. This application is used in Mobile Operations as a cut down Ozterm, until a Windows based Ozterm becomes available. It creates two instances of OVM. One handles data, and the other runs user script files. DCAPTerm runs on Windows NT4. CATL – Centralised Audit Trail Logger . This application extracts command logs from AXE, and SYS12 exchanges. Each instance uses a command line OVM application to communicate, and process exchange commands, and data. It is expected that any new Ozterm will make extensive use of OVM also. |
|
Does OVM support recursion ? |
|
| Yes and no. User defined procedures, functions and subroutines can call themselves. However, all variables (even parameters) are stored statically. This means that true recursion is not supported because "local" variables are not created on each call. This means that most recursive algorithms will not work correctly. |
|
Why doesn’t my application support all possible OVM keywords ? |
|
| Many OVM keywords require the application developer to supply code to support a particular keyword. For some applications – especially those with command line interfaces – many OVM keywords are of no use. So, if your application doesn’t support a keyword – contact your application developer. |
|
Why have some Ozterm keywords been removed ? |
|
| Some DOS Ozterm keywords related to technologies that are no longer in use within Telstra – these have been removed. Some keywords such as next, and endfor have been replaced with generic equivalents such as nextloop, and endloop. |
|
Why can’t I put a comment in an implicit host command line ? |
|
| OVM does not know that the comment is actually a comment. It assumes that everything on a implicit host command line has meaning to the connected network element. You must either place your comments on a separate line, or use the @hostcmd keyword to create an explicit host command which can then be safely followed by a comment. |
|
Why can’t I use {} to refer to a command or label ? |
|
| Ozterm supported {} as means to literally substitute the text contained within a variable into the currently executing script line. This also allowed people to use {} expressions in place of commands. Since OVM scripts are compiled before execution to catch syntax errors there is no way to change the text of a script once it is running. To help those who used {} for labels OVM provides the brackected versions of the commands @goto, and @gosub which allow you to goto / gosub a string. Note that you run the risk of a runtime error however. |
|
What do {} do in an implicit host command line ? |
|
| In Ozterm using {} allowed a user to substitute the contents of a variable to be sent to a connected network element in an implicit host command line. This behaviour has been preserved, and the {} must contain the name of a previously defined variable. However, {} were also used in Ozterm to create variable names on the fly for use as array variables. To attempt to preserve this behaviour when used in normal command lines {} now means that a session variable is being refered to. This allows for the old way of creating arrays to be used with only minor changes required to the users script. |
|
Can I change a line in a script while the script is executing ? |
|
| Yes, but the change will have no effect until the next time the script is compiled, and executed. This is because OVM compiles scripts before execution, and keeps an image of the compiled script in memory while it is being executed. You can change the contents of files that will be @include’d or @run’d, so long as your application is set up to compile "on the fly". |
|
Can I set a breakpoint in an OVM script ? |
|
| Yes - but your application must provide its own user interface to do so. Also, your scripts must be compiled with the savedebuginfo option turned on. |
|
Can I watch a variable in an OVM script ? |
|
| Yes – but your application must provide its own user interface to do so. Also, your scripts must be compiled with the savedebuginfo option turned on. |
|
Why so many compiler errors for sometimes simple mistakes ? |
|
| The OVM compiler will never be as clever as the user writing the script file. What seems like a trivial goof to the user can often throw the compiler completely off track. Remember to always start from the lowest line number when fixing errors, as many subsequent errors will disappear when an earlier error is fixed. |
|
What is a .ovm file ? |
|
| The .ovm file extension is the recommended extension to indicate that a file is a compiled OVM script file. These files are a binary image of the original text scripts file(s) that have been pre-compiled for later use. At runtime a .ovm file can be directly loaded into memory for execution without needing to be recompiled. |
|
What is a .ovl file ? |
|
| The .ovl file extension is the recommended extension to indicate that a file is an OVM library script file. These files are generated from ordinary OVM script files by the OVM compiler which basically encrypts the source file into a .ovl file (after checking that it contains no syntax errors). These files can then be distributed to other users without having to worry that they will alter the contents of the distributed file. NB. These files are not compiled, only encrypted. |
|
Why should I use OVM instead of another scripting langauge ? |
|
| You should use the language that best suits your needs. Many OVM keywords implement features that are at a much higher level than those provided in other langauges. Also, many script languages are not compiled making the detection of syntax errors haphazard. Finally, in many cases an OVM script is easier to maintain than an equivalent script in another language. |
|
How do I get OVM into my application ? |
|
| First, you need to contact the author of this document to get a copy of the OVM Applications Developers Guide. Then you can take it from there. Be warned however that you do need to be familiar with C++ to make use of the OVM library. |
|
Can I return a value from a script to my application ? |
|
| Not directly. There is no specific keyword for this purpose. However, several OVM commands can easily be adapted for this purpose. These include @seterrorflag, @setenv, and @docmdsetattr. Your application must then use this information in a sensible way. |
|
What compiler options does the OVM compiler support ? |
|
| savedebuginfo - This option tells the compiler to store extra information with the compiled file to allow for breakpoints, line number tracing, and the watching of variables. This option is normally on by default. However, if you want your scripts to execute as fast as possible you should turn this option off. warnonimplicithostcmd - This option tells the compiler to throw a warning if it encounters a non comment / whitespace line without a leading @. This option is normally on to remind people to check that implicit host command lines really are. errorononimplicithostcmd - This option upgrade the warning about implicit host command lines to an error. When turned on it overrides the warnonhostlines option. This option is normally off. Turn this option on if your scripts should never contain implicit host command lines. optimiseconstants - This option intructs the compiler to treat @constant symbols as if they were literals during compilation. This allows the compiler to fully evaluate expressions that contain only constants and / or literals at compile time. This option is normally on. Turning this option off will usually result in slower runtime code but can sometimes make the compiled file smaller. allowkeywordhiding - This option when turned on allows the user to use keywords that fall into the OVM_KW_HIDABLE keyword set as variables names etc. This option is normally off, and there is usually no reason to turn this option on, as an overridden keyword prevents the original keyword from being used within the same scope. supportedkeywords - This option is used to select which keywords from predefined sets can be compiled in your script file. This allows application developers to better restrict users to just those keywords that an application actually supports. By default this option is set to OVM_KW_MINIMUM which includes most of the internally implemented keywords plus a few commonly required externally implemented keywords. Note that to be able to change the settings of these options your application must provide its own user interface to do so. |
|
What options does the OVM runtime engine support ? |
|
| debuglevel - This option determines which @debug commands will actually display at compile time. Lower numbers have higher priority with 0 being the highest priority of all. This option is normal set to 0, and can also be changed via the @debuglevel command at runtime. autocompile - This option which is normally on allows script files to be compiled "on the fly" at runtime. This option must be on to be able to use the @include, and @run commands with uncompiled script files. checkcrc - This option which is normally on forces the OVM runtime engine to check pre-compiled script files for signs of having been corrupted. tracelines - This option which is normally off allows script files that were compiled with the savedebuginfo compiler option to report which command line they are about to execute. enablebreakpoints - This option which is normally off enables the processing of breakpoints at runtime. To be able to set a breakpoint the script must have been compiled with the savedebuginfo option turned on. Note that to be able to change the settings of these options your application must provide its own user interface to do so. |
|
Why does the CPU sometimes go to 100% while a script is running ? |
|
| When an OVM script is executing commands not naturally I/O bound the OVM runtime engine will consume as many CPU cycles as possible. In true multitasking environments such as Unix, and Windows NT this is not an indication of a problem, just normal application behaviour. Unless your OVM application prevents other programs from executing normally CPU usage simply reflects how fast your script is running. |
|
Is an OVM script faster than an equivalent Ozterm script file ? |
|
| Generally yes (but not necessarilly by much). For commands that are not bound waiting for I/O an OVM script can be orders of magnitude faster than the same script in Ozterm. However, once embedded into an application the OVM runtime engine is usually required to display data to the user, read, and write files, do serial communications and so on. These I/O operations quickly combine to slow down the average command rate of a script. At best on a fast machine a single OVM runtime engine can execute millions of OVM commands per second. For trivial applications this can be up to 100 faster than Ozterm (mostly because Ozterm has the overhead of interpreting its script language on the fly). It is worth noting that for some applications OVM scripts can actually execute quickly enough to prevent the need for dedicated code to be written. |
|
What OVM documentation is available ? |
|
| The following documents are currently available : OVM Language Guide (this document) OVM Application Developer’s Guide |
|
Who developed OVM ? |
|
| OVM was created by Network Operations – Systems Management Brisbane (currently Global Connect Systems Solutions – Switching, and International) for use by the NECH project. OVM scripts perform the core work of exchange command handling, and response processing for NECH. The original OVM concept was proposed, and developed by Andreas Schlichting. Andreas also developed the Ozterm script file syntax checker, and is also the current Ozterm code maintainer. The original concept of OVM grew from the work carried out for the Ozterm syntax checker, and OVM technology is expected to be used in future versions of Ozterm. |
|
How do I report a bug in OVM ? |
|
| At present email the author of this document with your details, and a description of the bug. In the future an intranet web page will be provided. |
|
How can I get a new feature added to OVM ? |
|
| At present email the author of this document with your details, and a description of the feature you would like. It will then be considered for inclusion into new versions of OVM. In the future an intranet web page will be provided. |
|
Why do some keywords have more than one name ? |
|
| Some keywords, typically those that operate on strings have two names. An example is pos / strpos. This is simply to make it easier to find the keyword you want. If you can remember what the keyword operates on, it is generally easier to find it in the documentation. Another exmaple is @logof / @logoff which people often misspell so OVM provides support for both. |
|
How many lines long can an OVM script file be ? |
|
| The upper limit is approximately 1 million lines. Beyond this it would be no longer possible to enable breakpoints at runtime. |
|
Can an OVM script run another "on the fly" at runtime ? |
|
| Typically yes through the use of the @include, and @run commands. |
|
How can I combine more than one file at compile time ? |
|
| Use the @library, and @uselibraryfile keywords. |
|
Can a string hold ASCII 0 ? |
|
| Yes - as of version 8xx OVM strings can hold ASCII 0. |
|
Can you pass by reference in user defined procedures / functions ? |
|
| Yes – as of version 8xx you can pass by reference to procedures, and functions using the byref keyword. Note that when passing arrays you must use the byref keyword. |
|
Can you clear all the elements of an array at once? |
|
| Yes – use the @clear command which works on all variable types (except individual array elements). |
|
Does OVM support pointers ? |
|
| No. But as of version 8xx you can pass by reference to user defined procedures, and functions using the byref keyword. You can also do an indirect goto / gosub by using a labelref / subroutineref variable. |
|
Does OVM support records / structures / classes ? |
|
| No. OVM does not currently support any of these features. |
|
Does OVM support user defined types ? |
|
| No. OVM only supports its built in types - integer, boolean, string, labelref, and subroutineref. |
|
Can you pass an array to a user defined procedure / function ? |
|
| Yes. As of version 8xx but you pass arrays by reference using the byref keyword. |
|
Can you forward declare a user defined procedure / function ? |
|
| No. At present you must fully define a procedure / function before you can call it. |
|
Do OVM strings support any escape sequences ? |
|
| Yes – but only when enclosed inside backquotes. See the section on string literals for more information. |
|
Can I get the value of an environment variable ? |
|
| Yes. Use the the getenv function. There is currently no way to set the value of an environment variable. |
|
Can I get the arguments that were passed to the script file ? |
|
| Yes. Use the argcount, and argvalue functions. These arguments are not necessarily the same as the arguments your application was started with. |
|
Can I find out the OVM version from a script ? |
|
| Yes. Use the OVMVERSION function. |
|
Can I set the initial value of a variable at compile time ? |
|
| Yes. As of version 890 you can use the defaultvalue keyword to set a variable’s value at compile time. |
|
| |
| This publication has been prepared and written by Telstra Corporation Limited (ACN 051 775 556), and is copyright. Other than for the purposes of and subject to the conditions prescribed under the Copyright Act, no part of it may in any form or by any means (electronic, mechanical, microcopying, photocopying, recording or otherwise) be reproduced, stored in a retrieval system or transmitted without prior written permission from the document controller. Product or company names are trademarks or registered trademarks of their respective holders. Note for non-Telstra readers: The contents of this publication are subject to change without notice. All efforts have been made to ensure the accuracy of this publication. Notwithstanding, Telstra Corporation Limited does not assume responsibility for any errors nor for any consequences arising from any errors in this publication. |