Telecominfraproject / ols-ucentral-client

OpenLAN/Shasta contribution repo
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Bug in WSS->JSON parser (parent's name appended to child's in some cases) #3

Open Cahb opened 9 months ago

Cahb commented 9 months ago

uCentral uses WSS (LEJP) callbacks to transform TCP/WSS packets from fragmented data batches into single cJSON object. There's (presumably) a bug in the parser, as the following issue is observed: uCentral client wrongfully parses underlying names for port-isolation:

           "downlink": {
             "downlink.interface-list": [

It's not expected for the nested name to include parent's. This is observed only in specific scenarios, and for some reason observed only for "downlink", while "uplink" is parsed OK: ucentral-client: proto_handle:3869: Got cmd: ...

{
"id": 11818,
"jsonrpc": "2.0",
"method": "configure",
"params": {
"config": {
"ethernet": [
{
"duplex": "full",
"enabled": true,
"poe": {
"admin-mode": true
},
"port-isolation": {
"sessions": [
{
"downlink": {
"downlink.interface-list": [
"Ethernet20"
]
},
"id": 1,
"uplink": {
"interface-list": [
"Ethernet20"
]
}
}
]
},
"select-ports": [
"Ethernet*"
],
"speed": 1000
},
{
"duplex": "full",
"enabled": false,
"poe": {
"admin-mode": false
},
"select-ports": [
"Ethernet38"
],
"speed": 1000
}
],
"globals": {
"ipv4-blackhole": [
{
"prefix": "192.168.67.0/24"
}
]
},
"interfaces": [
{
"ethernet": [
{
"select-ports": [
"Ethernet*"
],
"vlan-tag": "un-tagged"
}
],
"name": "mgmt-vlan",
"role": "upstream",
"vlan": {
"id": 1,
"proto": "802.1q"
}
}
],
"metrics": {
"health": {
"interval": 120
},
"statistics": {
"interval": 60,
"types": [
"lldp",
"clients"
]
}
},
"switch": {
"loop-detection": {
"protocol": "none"
}
},
"uuid": 1707239686
},
"serial": "e49d73b476d1",
"uuid": 1707239686,
"when": 0
}
}
Cahb commented 9 months ago

The following snippet, is a sample of port-isolation cfg pushed from cloud:

      "port-isolation": {
        "sessions": [
          {
            "id": 1,
            "uplink": {
              "interface-list": [
                "Ethernet20"
              ]
            },
            "downlink": {
              "interface-list": [
                "Ethernet21"
              ]
            }
          }
        ]
      },
mikehansen1970 commented 9 months ago

Also note that in the full configure message, Ethernet20 is in both uplink and downlink lists, whereas the above snippet has Ethernet20 and Ethernet21 respectively. Only mentioning in case this is another unexpected behaviour/error as the snippet doesn't match the full block content under downlink, as well as having erroneous key/tag