Hi all,
I started few days ago to develop some functions to have posibility from
CLI to change the output of the information.
Taking in account that for example in BGP you have a lot of prefixes
received and you want to filter the output for a particular match, or a
big config from which you need a specific part of it I decided to modify
Quagga sources to add those output modifiers like CIsco IOS.
For the moment only the include filter is done and the next one will be
exclude because is the reverse of include.
Here is an example for the first command modified:
quagga-router# show running-config | include interface
Building configuration...
Current configuration:
!
interface bond0
interface bond0.100
interface eth0
interface eth1
interface lo
interface vpn
end
quagga-router# show running-config | include link-detect
Building configuration...
Current configuration:
!
no link-detect
no link-detect
no link-detect
no link-detect
no link-detect
no link-detect
end
quagga-router# exit
The idea was like this:
1. Changed the format_parser_handle_pipe function in lib to permit the
pipe outside the keywords and multiple.
2. Adding 2 fields to vty structure
3. Adding a macro which is parsing the output modifiers and is calling
the original function like this
DEFUN (vtysh_write_terminal,
vtysh_write_terminal_cmd,
"write terminal",
"Write running configuration to memory, network, or terminal\n"
"Write to terminal\n")
{
..
}
ALIAS (vtysh_write_terminal,
vtysh_show_running_config_cmd,
"show running-config",
SHOW_STR
"Current operating configuration\n")
ALIAS_FILTER (vtysh_write_terminal_cmd,
vtysh_write_terminal_config_filter,
vtysh_show_running_config_filter_cmd,
"show running-config | (include|exclude|section) .LINE",
SHOW_STR
"Current operating configuration\n"
"Output modifiers\n"
"Include lines that match\n"
"Exclude lines that match\n"
"Regular Expression\n")
4. Changing the original function to accept or not the output modifiers.
I've tried to be minimum invasive in the lib source codes and I think I
success to do it. The rest of the work (the filtering of the output) is
done in the daemon/vtysh.
What I need to know if is OK for developers to add this feature to the
Quagga after I will add the output modifiers to the all daemons and I
will release the final version.
I'm not a very experienced programmer so my code perhaps will not be so
clean and optimized.
--
Kind regards,
Adrian Ban
--
This mail was scanned by BitDefender
For more information please visit http://www.bitdefender.com/
_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev