OktopUSP / oktopus

TR-069/CWMP and TR-369/USP Controller to Manage CPEs and IoT Devices
https://oktopus.app.br/controller
Apache License 2.0
48 stars 17 forks source link

USP record version discordancy in code #290

Closed XYuhan8600 closed 1 week ago

XYuhan8600 commented 1 week ago

Hello,

I noticed that the USP record version is "0.1" in _oktopus/backend/services/controller/internal/usp/usputils/utils.go line 11:

func NewUspRecord(p []byte, toId string) usp_record.Record {
    return usp_record.Record{
        Version:         "0.1",
        ToId:            toId,
        FromId:          "oktopusController",
        PayloadSecurity: usp_record.Record_PLAINTEXT,
        RecordType: &usp_record.Record_NoSessionContext{
            NoSessionContext: &usp_record.NoSessionContextRecord{
                Payload: p,
            },
        },
    }
}

However, the USP record version is "1.0" in oktopus/backend/services/mtp/adapter/internal/usp/usp.go line 9:

const VERSION = "1.0"

func NewUspRecord(p []byte, toId, fromId string) usp_record.Record {
    return usp_record.Record{
        Version:         VERSION,
        ToId:            toId,
        FromId:          fromId,
        PayloadSecurity: usp_record.Record_PLAINTEXT,
        RecordType: &usp_record.Record_NoSessionContext{
            NoSessionContext: &usp_record.NoSessionContextRecord{
                Payload: p,
            },
        },
    }
}

I am wandering if this is a bug or it's designed to be so? If it's meant to be like this, may I ask why? If this is a bug, could you please repair it? It seems that local changement of code on my PC doesn't work.

Thank you so much for your amazing project and your time!

leandrofars commented 1 week ago

Hello @XYuhan8600 , thanks for your feedback. It's a bug, have no impact at the messages flow, but don't follow a correct pattern. I'll push a commit to fix this problem. Thanks!