cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
437
Views
0
Helpful
2
Replies

nct commands gives error

kbarve
Cisco Employee
Cisco Employee

Hi,

I am exploring the nct tool for NSO upgrade procedure.

I referred the admin and man NSO doc. I am facing issue with nct commands, not sure if any configuration is needed to use nct commands

$ nct check --hostsfile hostsfile

ERROR : internal error

error: function_clause

[{nct_ssh,run,

          ["/opt/ncs/current/bin/ncs --version","127.0.0.1","2024","admin",

           [{password,"admin"}],

           infinity,0],

          [{file,"nct_ssh.erl"},{line,66}]},

{nct_lib,ssh,3,[{file,"nct_lib.erl"},{line,202}]},

{nct_check,request,3,[{file,"nct_check.erl"},{line,266}]},

{nct_check,'-request/3-fun-0-',4,[{file,"nct_check.erl"},{line,135}]},

{lists,foldr,3,[{file,"lists.erl"},{line,1261}]},

{lists,map,2,[{file,"lists.erl"},{line,1224}]},

{nct_check,run,1,[{file,"nct_check.erl"},{line,102}]},

{escript,run,2,[{file,"escript.erl"},{line,747}]}]

$ nct packages --hostsfile hostsfile

Package Info at 127.0.0.1:"8888"

  REST ERROR : {error,{failed_connect,[{to_address,{"127.0.0.1",8888}},

                        {inet,[inet],econnrefused}]}}

$ nct ssh-cmd -c 'ls' --hostsfile hostsfile

ERROR : internal error

error: function_clause

[{nct_ssh,run,

          ["ls","127.0.0.1","2024","admin",[{password,"admin"}],infinity,0],

          [{file,"nct_ssh.erl"},{line,66}]},

{nct_lib,ssh,3,[{file,"nct_lib.erl"},{line,202}]},

{nct_ssh_cmd,request,2,[{file,"nct_ssh_cmd.erl"},{line,97}]},

{lists,map,2,[{file,"lists.erl"},{line,1224}]},

{nct_ssh_cmd,run,1,[{file,"nct_ssh_cmd.erl"},{line,76}]},

{escript,run,2,[{file,"escript.erl"},{line,747}]},

{escript,start,1,[{file,"escript.erl"},{line,277}]},

{init,start_it,1,[]}]

$ cat hostsfile

{"127.0.0.1", [{ssh_user,"admin"},

           {ssh_pass, "admin"},

           {ssh_port, "2024"},

           {rest_user,"admin"},

           {rest_pass, "admin"},

           {rest_port, "8080"}]}.      (Tried 8888 ports as well)

cat ncs.conf

<ssh>
  <enabled>true</enabled>
  <ip>0.0.0.0</ip>
  <port>2024</port>
</ssh>

<transport>
  <ssh>
    <enabled>true</enabled>
    <ip>0.0.0.0</ip>
    <port>2022</port>
 

</ssh>

2 Replies 2

kbarve
Cisco Employee
Cisco Employee

Now I am getting below error now.

Please let me know if I am missing anything in configuration.

Tried on same m/c

KBARVE-M-J2Y4:ncs-run kbarve$ nct check --hostsfile hostsfile

nct_lib(792): HTTP Request = "http://127.0.0.1:8080/api/operational/ncs-state/ha"

nct_lib(803): HTTP(401) Reply = {"HTTP/1.1",401,"Unauthorized"}

nct_lib(804): HTTP(401) Reply Body = <<"\n<html>\n<body>\n<h1>401 authentication needed</h1></body></html>">>

nct_lib(823): xmerl_scan error : function_clause

nct_lib(199): SSH /home/ec2-user/ncs-run/current/bin/ncs --version

nct_ssh(97): Address = "127.0.0.1", Error = "Install alg failed"

nct_lib(208): SSH ERROR = "Install alg failed"

nct_ssh(148): Address: "127.0.0.1" , Error = "Install alg failed"

nct_lib(304): NETCONF ERROR = "Install alg failed"

nct_lib(792): HTTP Request = "http://127.0.0.1:8080/api"

nct_lib(803): HTTP(401) Reply = {"HTTP/1.1",401,"Unauthorized"}

nct_lib(804): HTTP(401) Reply Body = <<"\n<html>\n<body>\n<h1>401 authentication needed</h1></body></html>">>

nct_lib(199): SSH df -h /var /opt

nct_ssh(97): Address = "127.0.0.1", Error = "Install alg failed"

nct_lib(208): SSH ERROR = "Install alg failed"

nct_lib(199): SSH sudo -v

nct_ssh(97): Address = "127.0.0.1", Error = "Install alg failed"

nct_lib(208): SSH ERROR = "Install alg failed"

nct_lib(199): SSH ssh

nct_ssh(97): Address = "127.0.0.1", Error = "Install alg failed"

nct_lib(208): SSH ERROR = "Install alg failed"

ALL Check to 127.0.0.1:2024

SSH ERROR : Install alg failed

SSH+SUDO ERROR : failed to run 'sudo -v'

DISK-USAGE ERROR : failed to run 'df -h /var /opt'

REST OK

NETCONF ERROR : failed to run netconf

NCS-VSN ERROR : failed to run '/home/ec2-user/ncs-run/current/bin/ncs --version'

HA ERROR : ha call failed

KBARVE-M-J2Y4:ncs-run kbarve$ cat hostsfile

{"127.0.0.1", [

                    {cmd,"all"},

                    {host,"127.0.0.1"},

                    {verbose,5},

                    {rest_pass,"admin"},

                    {ssh_pass,"admin"},

                    {ssh_port,2024},

                    {install_dir,"/home/ec2-user/ncs-run"},

                    {ssh_user,"admin"},

                    {ssh_cmd,"ssh"},

                    {disk_limit,80},

                    {concurrent," true"},

                    {groupoper,"or"},

                    {timeout,infinity},

                    {progress,false},

                    {ssh_timeout,infinity},

                    {rest_user,"ec2-user"},

                    {rest_port,8080},

                    {rest_ssl,"false"},

                    {netconf_user,"admin"},

                    {netconf_port,2022},

                    {netconf_proto,"ssh"}

                    ]}.

Tried on a separate m/c

[ec2-user@ip-20-20-10-202 ncs-run]$ nct check --hostsfile hostsfile

nct_lib(792): HTTP Request = "http://20.20.10.121:8080/api/operational/ncs-state/ha"

nct_lib(803): HTTP(401) Reply = {"HTTP/1.1",401,"Unauthorized"}

nct_lib(804): HTTP(401) Reply Body = <<"\n<html>\n<body>\n<h1>401 authentication needed</h1></body></html>">>

nct_lib(823): xmerl_scan error : function_clause

nct_lib(199): SSH /home/ec2-user/ncs-run/current/bin/ncs --version

nct_ssh(97): Address = "20.20.10.121", Error = "Install alg failed"

nct_lib(208): SSH ERROR = "Install alg failed"

nct_ssh(148): Address: "20.20.10.121" , Error = "Install alg failed"

nct_lib(304): NETCONF ERROR = "Install alg failed"

nct_lib(792): HTTP Request = "http://20.20.10.121:8080/api"

nct_lib(803): HTTP(401) Reply = {"HTTP/1.1",401,"Unauthorized"}

nct_lib(804): HTTP(401) Reply Body = <<"\n<html>\n<body>\n<h1>401 authentication needed</h1></body></html>">>

nct_lib(199): SSH df -h /var /opt

nct_ssh(97): Address = "20.20.10.121", Error = "Install alg failed"

nct_lib(208): SSH ERROR = "Install alg failed"

nct_lib(199): SSH sudo -v

nct_ssh(97): Address = "20.20.10.121", Error = "Install alg failed"

nct_lib(208): SSH ERROR = "Install alg failed"

nct_lib(199): SSH ssh

nct_ssh(97): Address = "20.20.10.121", Error = "Install alg failed"

nct_lib(208): SSH ERROR = "Install alg failed"

ALL Check to 20.20.10.121:2024

SSH ERROR : Install alg failed

SSH+SUDO ERROR : failed to run 'sudo -v'

DISK-USAGE ERROR : failed to run 'df -h /var /opt'

REST OK

NETCONF ERROR : failed to run netconf

NCS-VSN ERROR : failed to run '/home/ec2-user/ncs-run/current/bin/ncs --version'

HA ERROR : ha call failed

cat ncs-run/hostsfile

{"20.20.10.121", [

                    {cmd,"all"},

                    {host,"20.20.10.121"},

                    {verbose,5},

                    {rest_pass,"admin"},

                    {ssh_pass,"admin"},

                    {ssh_port,2024},

                    {install_dir,"/home/ec2-user/ncs-run"},

                    {ssh_user,"admin"},

                    {ssh_cmd,"ssh"},

                    {disk_limit,80},

                    {concurrent," true"},

                    {groupoper,"or"},

                    {timeout,infinity},

                    {progress,false},

                    {ssh_timeout,infinity},

                    {rest_user,"ec2-user"},

                    {rest_port,8080},

                    {rest_ssl,"false"},

                    {netconf_user,"admin"},

                    {netconf_port,2022},

                    {netconf_proto,"ssh"}

                    ]}.

kbarve
Cisco Employee
Cisco Employee

Now NCT for rest api is working fine.

Can someone plz help to resolve this error?

[ec2-user@ip-20-20-10-202 ncs-run]$ nct ssh-cmd -c 'sudo id'  --hostsfile hostsfile -vvvv

nct_lib(125): Opts=[{cmd,"sudo id"},

                    {hostsfile,"hostsfile"},

                    {verbose,4},

                    {concurrent," true"},

                    {groupoper,"or"},

                    {timeout,infinity},

                    {progress,false},

                    {ssh_user,"ec2-user"},

                    {ssh_port,22},

                    {ssh_timeout,infinity}] , Crap=[]

nct_ssh_cmd(64): Updated Opts=[{hosts_opts,

                                   [{"20.20.10.121",

                                     [{cmd,"all"},

                                      {host,"20.20.10.121"},

                                      {verbose,5},

                                      {rest_pass,"admin"},

                                      {ssh_pass,"admin"},

                                      {ssh_port,2024},

                                      {install_dir,"/home/ec2-user/ncs-4.3.1"},

                                      {ssh_user,"admin"},

                                      {ssh_cmd,"ssh"},

                                      {disk_limit,80},

                                      {concurrent," true"},

                                      {groupoper,"or"},

                                      {timeout,infinity},

                                      {progress,false},

                                      {ssh_timeout,infinity},

                                      {rest_user,"admin"},

                                      {rest_port,8080},

                                      {rest_ssl,"false"},

                                      {netconf_user,"admin"},

                                      {netconf_port,2022},

                                      {netconf_proto,"ssh"}]}]},

                               {cmd,"sudo id"},

                               {hostsfile,"hostsfile"},

                               {verbose,4},

                               {concurrent," true"},

                               {groupoper,"or"},

                               {timeout,infinity},

                               {progress,false},

                               {ssh_user,"ec2-user"},

                               {ssh_port,22},

                               {ssh_timeout,infinity}]

nct_lib(199): SSH all

nct_ssh(97): Address = "20.20.10.121", Error = "Install alg failed"

nct_lib(208): SSH ERROR = "Install alg failed"

SSH command to 20.20.10.121:2024

SSH ERROR : Install alg failed