New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Teldat support #166
Comments
On Tue, Feb 1, 2022 at 3:34 AM Nicolás Victorero ***@***.***> wrote:
This is a plea for help, not an issue with netdot.
I'm trying to improve functionalities with Teldat routers.
As for SNMP teldat routers give interface information and most things
quite nicely. But ip/mask information is missing, to obtain it for vrfs you
need to use different communities/contexts, and this also give you access
to a subset of the snmp trees with only ip/mask information for the
interfaces present in relevant VRF. So I cannot just add each vrf as
separate devices becouse snmp_info will fail (no descr etc). Also I
counln't found a OID to retrieve the configured VRFs from the "general"
no-VRF device either (so i could somehow walk the information on the
different VRFs). So I gave up on the SNMP approach.
I'm trying to use the CLI for getting ARP and FWT, to prior add there a
function to extract the ip/mask information and populate it in netdot
database for that device, then get arp and fwt data for the now ip-enabled
interfaces).
Maybe this could be made with something like it is done on Aironet.pm but
to me all that is SNMP-based, so with my limited knowledge I'd thought to
append my modifications on a Device/CLI/teldat.pm script.
As I'm making slow progess, now I'm stuck becouse as part of the Teldat
privilege de-escalation i need to send CONTROL-P and I don't know how to do
it.
Explanation:
Teldat has 4 different privilege levels with different commands.
Witch an example of a teldat session after just entering the generic
un-privileged prompt:
ADM020 *p 4
ADM020 Config>feature vrf
-- VRF user configuration --
ADM020 VRF config>show config
; Showing Menu and Submenus Configuration for access-level 15 ...
; ATLAS60Router PMC 28 65 Version 11.01.00.20.24
vrf VoIP
vrf VPN_ADM
ADM020 VRF config>
****HERE YOU NEED TO SEND Control-p to get back to generic prompt and
change privelege level to issue different commands
ADM020 *p 3
Console Operator
[...]
My question is I guess about Net::CLI::Interact probably, how can I send
control characters?.
I've tried with several variances of:
$s->cmd('\xa');
$s->cmd('\010);
$s->cmd('\cP');
First try to send control characters in a regular perl script.
Maybe use, "chr". ie:
my $t = chr(10);
print("$t\n");
will print two new-lines.
Control characters map to ASCII code points. From wikipedia we see the
"caret notation" just counts up from Control-A at ASCII 0x01. ASCII 0x02 is
then Control-B, etc.
So Control-P is 0x10 (decimal 16), Data Link Escape.
Maybe try something like:
s->cmd(chr(16));
[image: image.png]
…-m
Message ID: ***@***.***>
|
Thank you Brian and mzgrave for the help. I closed this too fast. Now I can send control-p using $s->cmd("\cP") just fine, problem is I cannot send it from macros.
Error being:
Just noticed yesterday that _cli_cmd is a "one line" command, handles change of privilege if needed, but every call to the function opens and closes Net::Appliance::Session session, so every call to it is atomic and unrelated to the last one. To talk to teldat this doesn't suit my needs, as it needs several commands to get for example ip address. I've made some modifications to _cli_cmd, to alllow the execution of custom macros and to be able to pass parameter (one for now) to that macros, with that I can make more or less complex macros to get to the point where i can execute my commands. Like for example:
Just commited the new code to my repo on teldat branch. |
I've make it to the point where I can add the ip information to the interfaces and get the relevant networks created using the update_ip function in Interface.pm. |
Solved the mac to IP thing with:
What still drives me crazy is how to enter a new sitesubnet relation. In Ipblock.pm:search_like there are some references to site to subnet mapping but I cannot guess how to manipulate them from that code...
Any help or pointers to documentation explaining how that parts works appreciated. |
For those walking on my shoes, it seems that "hidden" methods corresponds to the DBI abstraction and how it converts data from the database into objects. Relations are defined on etc/netdot.meta |
This is a plea for help, not an issue with netdot.
I'm trying to improve functionalities with Teldat routers.
As for SNMP teldat routers give interface information and most things quite nicely. But ip/mask information is missing, to obtain it for vrfs you need to use different communities/contexts, and this also give you access to a subset of the snmp trees with only ip/mask information for the interfaces present in relevant VRF. So I cannot just add each vrf as separate devices becouse snmp_info will fail (no descr etc). Also I counln't found a OID to retrieve the configured VRFs from the "general" no-VRF device either (so i could somehow walk the information on the different VRFs). So I gave up on the SNMP approach.
I'm trying to use the CLI for getting ARP and FWT, to prior add there a function to extract the ip/mask information and populate it in netdot database for that device, then get arp and fwt data for the now ip-enabled interfaces).
Maybe this could be made with something like it is done on Aironet.pm but to me all that is SNMP-based, so with my limited knowledge I'd thought to append my modifications on a Device/CLI/teldat.pm script.
As I'm making slow progess, now I'm stuck becouse as part of the Teldat privilege de-escalation i need to send CONTROL-P and I don't know how to do it.
Explanation:
Teldat has 4 different privilege levels with different commands.
Witch an example of a teldat session after just entering the generic un-privileged prompt:
****HERE YOU NEED TO SEND Control-p to get back to generic prompt and change privelege level to issue different commands
[...]
My question is I guess about Net::CLI::Interact probably, how can I send control characters?.
I've tried with several variances of:
but does not work. always get something like:
Edit: Found the solution to this, just needed to use " instead of '.
$s->cmd("\cP");
Does work. :-)
Also, is there an easy way to use phrasebook macros from Netdot CLI implementation?. If not... how can I change the prompt after changing a privilege level?.
ie:
$self->_cli_cmd(%$args, host=>$host, cmd=>'p 4', personality=>'teldat');
will change the prompt from generic to Config. But netdot keeps trying to match generic prompt, which fails.
I've done tests using Net::Appliance::Session directly and I'm doing this using:
$s->macro('begin_pfour');
And on teldat/pb
But without access to macros I don't know how to make my code aware of the prompt change.
About this I'm thinking about modifying CLI.pm either adding a new parameter $macro to _cli_cmd or maybe adding a new sub _cli_macro(), what do you think?.
Edit: I've make test adding $macro parameter to _cli_cmd and doing this (if $macro is present $cmd is ignored):
So far it seems to be working, and not breaking anything but will need more testing.
My work in progess is in my own netdot fork , which contains a fork of latest cvicente repo + a merge of latest vink78 repo (to include PaloAlto API which I use). My changes include CLI supoprt for some more devices and my current tries at teldat, all of which I don't see ready for a pull request.
Thank you very much.
The text was updated successfully, but these errors were encountered: