moeller0 / lantiq_dsl_parser

Simple parser for the output of intel/lantiq dsl modem diagnostics/statistics
Other
9 stars 1 forks source link

script fails - BT Home Hub 5A #1

Open abajk opened 4 years ago

abajk commented 4 years ago

Hi, on my router this script doesn't work. Router BT Home Hub 5A. Line support VDSL2. I just changed IP address:

$ git diff
diff --git a/lantiq_dsl_parser.m b/lantiq_dsl_parser.m
index 9341ad4..d11c7e7 100644
--- a/lantiq_dsl_parser.m
+++ b/lantiq_dsl_parser.m
@@ -122,7 +122,7 @@ end

 %ssh root@192.168.100.1 '. /lib/functions/lantiq_dsl.sh ; dsl_cmd g997racg 0 0'
-ssh_dsl_cfg.lantiq_IP = '192.168.100.1';
+ssh_dsl_cfg.lantiq_IP = '192.168.2.2';
 ssh_dsl_cfg.lantig_user = 'root';
 ssh_dsl_cfg.lantig_dsl_cmd_prefix = '. /lib/functions/lantiq_dsl.sh ; dsl_cmd';
 ssh_dsl_cfg.ssh_command_stem = ['ssh ', ssh_dsl_cfg.lantig_user, '@', ssh_dsl_cfg.lantiq_IP];

Log:

$ octave
GNU Octave, version 4.4.1
Copyright (C) 2018 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-pc-linux-gnu".

Additional information about Octave is available at https://www.octave.org.

Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html

Read https://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> lantiq_dsl_parser()
/home/aleksander/workspace/lantiq_dsl_parser
Defaulting to data_source dsl_cmd
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd help  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd acog  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd asecg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd asg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd aufg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd bpstg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd bpsg  ' 
fn_convert_and_add_nData_to_struct: Encountered unhandled format string: (nBandPlan(dec),nProfile(dec),bSupported(dec)) no auto generation of .Data and .Data_xvec.
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd vig  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd vpcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd ptsg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd dsmsg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd dsmcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd pmcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd pmlictg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd llcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd lsg  ' 
error: value on right hand side of assignment is undefined
error: called from
    lantiq_dsl_parser>fn_call_dsl_cmd_via_ssh at line 957 column 43
    lantiq_dsl_parser at line 202 column 72
octave:1>
moeller0 commented 4 years ago

Thanks for the report. What do you get when you run:

ssh root@192.168.2.2 '. /lib/functions/lantiq_dsl.sh ; dsl_cmd lsg'

from a terminal? I see:

laptop:lantiq_dsl_parser user$ ssh root@192.168.100.1 '. /lib/functions/lantiq_dsl.sh ; dsl_cmd lsg'
nReturn=0 nLineState=0x801
laptop:lantiq_dsl_parser user$ 

This might be caused by a line state code that currently is not handled...

abajk commented 4 years ago

It looks the same:

aleksander:~$ ssh root@192.168.2.2 '. /lib/functions/lantiq_dsl.sh ; dsl_cmd lsg'
nReturn=0 nLineState=0x801
aleksander@LAPTOP-OLEK:~$

Should I pass any parameter to the function?

moeller0 commented 4 years ago

Mmmh, I can not re-create that condition here. So I just pushed a commit that will hopefully be a bit more verbose and help over the issue. If you would be willing to test again, I would be quite happy...

abajk commented 4 years ago

Output:

$ git pull
...
$ octave
GNU Octave, version 4.4.1
Copyright (C) 2018 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-pc-linux-gnu".

Additional information about Octave is available at https://www.octave.org.

Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html

Read https://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> lantiq_dsl_parser()
/home/aleksander/workspace/lantiq_dsl_parser
Defaulting to data_source dsl_cmd
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd help  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd acog  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd asecg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd asg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd aufg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd bpstg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd bpsg  ' 
fn_convert_and_add_nData_to_struct: Encountered unhandled format string: (nBandPlan(dec),nProfile(dec),bSupported(dec)) no auto generation of .Data and .Data_xvec.
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd vig  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd vpcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd ptsg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd dsmsg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd dsmcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd pmcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd pmlictg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd llcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd lsg  ' 
error: value on right hand side of assignment is undefined
error: called from
    lantiq_dsl_parser>fn_call_dsl_cmd_via_ssh at line 960 column 44
    lantiq_dsl_parser at line 204 column 72

Maybe it will help. It fails, because 'parsed_dsl_output_struct.LineState' contains NaN:

$ git diff
diff --git a/lantiq_dsl_parser.m b/lantiq_dsl_parser.m
index f33ebb9..cd07f60 100644
--- a/lantiq_dsl_parser.m
+++ b/lantiq_dsl_parser.m
@@ -124,7 +124,7 @@ end

 %ssh root@192.168.100.1 '. /lib/functions/lantiq_dsl.sh ; dsl_cmd g997racg 0 0'
-ssh_dsl_cfg.lantiq_IP = '192.168.100.1';
+ssh_dsl_cfg.lantiq_IP = '192.168.2.2';
 ssh_dsl_cfg.lantig_user = 'root';
 ssh_dsl_cfg.lantig_dsl_cmd_prefix = '. /lib/functions/lantiq_dsl.sh ; dsl_cmd';
 ssh_dsl_cfg.ssh_command_stem = ['ssh ', ssh_dsl_cfg.lantig_user, '@', ssh_dsl_cfg.lantiq_IP];
@@ -957,6 +957,7 @@ switch dsl_sub_cmd_string
        case 'lsg'
                % get a human readable name for the LineState
                if isfield(parsed_dsl_output_struct, 'LineState')
+                       disp(parsed_dsl_output_struct.LineState);
                        parsed_dsl_output_struct.LineState_name = fn_find_dsl_state_name_by_value( parsed_dsl_output_struct.LineState );
                else
                        disp('ERROR: Expected parsed_dsl_output_struct.LineState field does not seem to exist');
$ octave lantiq_dsl_parser.m
/home/aleksander/workspace/lantiq_dsl_parser
Defaulting to data_source dsl_cmd
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd help  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd acog  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd asecg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd asg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd aufg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd bpstg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd bpsg  ' 
fn_convert_and_add_nData_to_struct: Encountered unhandled format string: (nBandPlan(dec),nProfile(dec),bSupported(dec)) no auto generation of .Data and .Data_xvec.
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd vig  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd vpcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd ptsg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd dsmsg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd dsmcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd pmcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd pmlictg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd llcg  ' 
fn_call_dsl_cmd_via_ssh:  ' . /lib/functions/lantiq_dsl.sh ; dsl_cmd lsg  ' 
 NaN
error: value on right hand side of assignment is undefined
error: called from
    lantiq_dsl_parser>fn_call_dsl_cmd_via_ssh at line 961 column 44
    lantiq_dsl_parser at line 204 column 72
moeller0 commented 4 years ago

Thanks for the analysis. I added a check for NaN, hopefully this will run through this part. I am really puzzled why there is a NaN in this field on your machine....