@@ -6,10 +6,280 @@ ETSI is organizing the 4th mWT (millimetre Wave Transmission) SDN (Software Defi
Contact: plugtests@etsi.org.
## Content
## lncc.py Tutorial
*
*
### Script launch & first steps
The Lightweight NETCONF Controller is build on top of _cmd2_ Python package : it benefits from all [built-in features](https://cmd2.readthedocs.io/en/stable/features/index.html): [help](https://cmd2.readthedocs.io/en/stable/features/help.html), [history](https://cmd2.readthedocs.io/en/stable/features/history.html), [script](https://cmd2.readthedocs.io/en/stable/features/scripting.html) and more...
Start as any script: `python3 lncc.py` or `./lncc.py`.
* You will get help using the `help` command. More verbose will be available in future, using `help <command>` or `command --help`.
* You will exit using `quit` command or EOF (Ctrl+D).
New tables 'get' in each NE, build from XML stored in 'get'
(Cmd) table concat
Table 'get' available for group
(Cmd) table to_excel interfaces.xlsx
Wrote Excel file interfaces.xlsx, with 1 tabs: args.tables
```
### Creating a script
If the commands you can convert
We rely on _cmd2_ build-in commands: [`history --script`](https://cmd2.readthedocs.io/en/stable/features/history.html#for-users) then `run_script`.
Once the set of command make a interesting scenario, you can save it as TXT script file. You can edit this TXT script with you usual editor (type `edit` build-in command to start vim).
```
(Cmd) history --script > get_interface_inventory_script2.txt
(Cmd)
```
Then let's play again the same command sequence, using `run_script` command. You may see errors if you keep adding NEs taht exists.
NETCONF <get> operation completed: 2 NEs, stored in 'get'
New tables 'get' in each NE, build from XML stored in 'get'
Table 'get' available for group
Wrote Excel file interfaces.xlsx, with 1 tabs: args.tables
```
### Creating a transcript
Transcripts enable us to compare the script behavior from different NEs. Transcript records both the commands input and their ouputs. Transcript are created with the ['--transcript' argument of the 'run_script'](https://cmd2.readthedocs.io/en/stable/features/transcripts.html) command.
In order to compare the behavior, we need to redirect the feedback (~stderr) to the ouput (~stdout), using the `set feedback_to_output true`command.
7 commands and their outputs saved to transcript file '/home/jean/lncc/get_interface_inventory_transcript2.txt'
```
### Test a transcript
[Transcipt](https://cmd2.readthedocs.io/en/stable/features/transcripts.html#running-a-transcript) have to be run from your shell (not inside the lncc.py!).
It will play the commands and will compare the output of these commands with the content of the transcript.