Cisco SPA 112 & GenieACS 1.1

I have a Cisco SPA 112 with a couple of problems.

This particular one keeps saying “Cannot read property ‘attr’ of undefined”. This is the answer of Genie 1.1.3 after the CPE sending a

    <SOAP-ENV:Body
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <cwmp:GetParameterValuesResponse>
            <ParameterList
                SOAP-ENC:arrayType="cwmp:ParameterValueStruct[1]">
                <ParameterValueStruct>
                    <Name>
                        Device.DeviceInfo.DeviceLog
                        </Name>
                    </ParameterValueStruct>
                </ParameterList>
            </cwmp:GetParameterValuesResponse>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

There is a workaround but I don’t know why the issues at Github are disabled. There was a ton of info there and now I feel lost. The answer was supposedly here: http://lists.genieacs.com/pipermail/users/2015-February/000111.html

Thanks

At least we should have used the “WayBack Machine” so we don’t lose that precious data. Or something else, but the issues are gone and we’re left stranded, making the same questions again

The device response is missing Value element. IIRC that’s an unsupported device so you’ll need to patch GenieACS. See soap.coffee and look up the function that parses GetParameterValuesResponse and make it fallback to empty string if the element is missing.

You mean soap.js, right?
Is there any way to update it in case it is installed via npm?
Thanks

Ok, this solved the issue…

function GetParameterValuesResponse(xml) {
  try {
    const a = parameterValueList(xml.get("ParameterList"));
    return {
      name: "GetParameterValuesResponse",
      parameterList: a
    };
  }
  catch(err){
    return {
      name: "GetParameterValuesResponse",
      parameterList: ""
    };
  } 
}

And now another error… What a bad implementation… And it’s Cisco…

In the logs:

2019-09-04T15:07:12.718Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: Inform; cpeRequestId="97" informEvent="2 PERIODIC" informRetryCount=0
2019-09-04T15:07:13.065Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b7910000" acsRequestName="GetParameterNames"
2019-09-04T15:07:13.126Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b7910001" acsRequestName="GetParameterNames"
2019-09-04T15:07:13.170Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b7910002" acsRequestName="GetParameterNames"
2019-09-04T15:07:13.215Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b7910003" acsRequestName="GetParameterNames"
2019-09-04T15:07:13.262Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b7910004" acsRequestName="GetParameterNames"
2019-09-04T15:07:13.316Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b7910005" acsRequestName="GetParameterNames"
2019-09-04T15:07:13.363Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b7910006" acsRequestName="GetParameterNames"
2019-09-04T15:07:13.407Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b7910007" acsRequestName="GetParameterNames"
2019-09-04T15:07:13.452Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b7910008" acsRequestName="GetParameterNames"
2019-09-04T15:07:13.501Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b7910009" acsRequestName="GetParameterNames"
2019-09-04T15:07:14.521Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b791000a" acsRequestName="GetParameterNames"
2019-09-04T15:07:14.562Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b791000b" acsRequestName="GetParameterNames"
2019-09-04T15:07:14.606Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b791000c" acsRequestName="GetParameterNames"
2019-09-04T15:07:14.650Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b791000d" acsRequestName="GetParameterNames"
2019-09-04T15:07:14.699Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b791000e" acsRequestName="GetParameterNames"
2019-09-04T15:07:14.740Z [INFO] 185.120.X.X 701F53-SPA112-CCQ2221031O: ACS request; acsRequestId="16cfcd0b791000f" acsRequestName="GetParameterNames"
2019-09-04T15:07:14.779Z [ERROR] 185.120.X.X 701F53-SPA112-CCQ2221031O: XML parse error; parseError="Cannot read property 'find' of undefined"
2019-09-04T15:07:14.964Z [ERROR] 185.120.X.X: XML parse error; parseError="Unrecognized CWMP version"

In the debug, the last two interactions:

# REQUEST Wed Sep 04 2019 15:07:14 GMT+0000 (UTC)
{"host":"X.com:7547","user-agent":"gSOAP/2.6","content-type":"text/xml; charset=utf-8","content-length":"747","connection":"keep-alive","cookie":"session=b6cf9bea4790504d","soapaction":""}
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cwmp="urn:dslforum-org:cwmp-1-0"><SOAP-ENV:Header><cwmp:ID SOAP-ENV:mustUnderstand="1">16cfcd0b791000e</cwmp:ID></SOAP-ENV:Header><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><cwmp:GetParameterNamesResponse><ParameterList SOAP-ENC:arrayType="cwmp:ParameterInfoStruct[1]"><ParameterInfoStruct><Name>Device.Ethernet.Interface.1.Status</Name><Writable>0</Writable></ParameterInfoStruct></ParameterList></cwmp:GetParameterNamesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

# RESPONSE Wed Sep 04 2019 15:07:14 GMT+0000 (UTC)
{"Server":"GenieACS/1.1.3","SOAPServer":"GenieACS/1.1.3","Content-Type":"text/xml; charset=\"utf-8\""}
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cwmp="urn:dslforum-org:cwmp-1-0"><soap-env:Header><cwmp:ID soap-env:mustUnderstand="1">16cfcd0b791000f</cwmp:ID></soap-env:Header><soap-env:Body><cwmp:GetParameterNames><ParameterPath>Device.LAN.TraceRouteDiagnostics.RouteHops.</ParameterPath><NextLevel>1</NextLevel></cwmp:GetParameterNames></soap-env:Body></soap-env:Envelope>

The message that failed to parse isn’t in the debug log unfortunately. Can you try Wireshark or tcpdump?

There was a problem also because the ATA was sending a faulty GetParameterNamesResponse. I patched it as follows:

function GetParameterNamesResponse(xml) {
  try {
    const b = parameterInfoList(xml.get("ParameterList"));
    return {
      name: "GetParameterNamesResponse",
      parameterList: b
    };
  } 
  catch(err){
    return {
      name: "GetParameterNamesResponse",
      parameterList: ""
    };
  }
}

Now the next problem is that Genie asks for Device.Services.VoiceService and the CPE returns a 9005 FAULTSTRING: Invalid parameter Name
How can I prevent GenieACS from asking that precise parameter? I don’t know in fact why is it asking for it, because it’s just a node without info, where the objects .1. .2. … get created as SIP lines.
I suspect we must modify cwmp.coffee but well… I don’t know exactly where.

I have tried to modify the cwmp.js directly, around these lines:

    switch (task.name) {
      case 'getParameterValues':
        sessionContext.channels["task_" + task._id] = 0;
        ref2 = task.parameterNames;
        for (m = 0, len1 = ref2.length; m < len1; m++) {
          p = ref2[m];
          if (p == "Device.Services.VoiceService") break;
          session.addProvisions(sessionContext, "task_" + task._id, [['refresh', p]]);
        }
        break;

I’ve added the line if (p == "Device.Services.VoiceService") break; but it only works when querying it manually, that is, if you refresh this param through genieacs-gui. But if you refresh the entire tree since the root Device then somehow the script doesn’t go through the same piece of code.
I still need some clues

Finally… The solution was to patch soap.js again. This is the new patched function:

function GetParameterValues(xml, methodRequest) {
  const el = xml.node("cwmp:GetParameterValues").node("ParameterNames");
  el.attr({
    "soap-enc:arrayType": `xsd:string[${methodRequest.parameterNames.length}]`
  });

  for (const p of methodRequest.parameterNames) {
    if (p == "Device.Services.VoiceService") continue;
    el.node("string").text(p);
  }
}

Anyway, after that, I had a Session Timeout problem, that I solved thanks to this post: ACK Timeout / Session Timeout

It’s acually a rebranded Linksys SPA. We ditched Ciscos ATAs when TR-069 wouldn’t work with HTTPS and for us important parameters were missing.