Alter "pseudowires" table to change "cpwVcID" from type INT to BIGINT

Pseudowires (xconnect) VC ID value can range from 1-4294967295, but the “cpwVcID” value maxes out at 2147483648 due to MariaDB INT type value limitations. If a pseudowire value is greater than 2147483648, the “cpwVcID” will be entered as 2147483648 instead of the actual value of the pseudowire VC ID.

Example:

!!! Cisco Router !!!
!
interface GigabitEthernet1/14
no ip address
load-interval 30
xconnect 10.250.250.1 2723500018 encapsulation mpls
hold-queue 4096 out
!

2723500018 is greater than 2147483648

When the “cisco-pw” discovery module runs it will send 2723500018 to MariaDB, but because it exceeds the maximum integer value of 2147483648, it will be entered as 2147483648 instead of the actual VC ID. As a result, every time discovery.php runs against that device, the pseudowire will be entered into the database again because the module checks for the existence of 2723500018 which doesn’t exist. When it doesn’t find 2723500018 in the database it inserts it into the database thus creating another entry with a value of 2147483648 for the same reason explained previously. Now there are two entries for the same pseudowire with a “cpwVcID” value of 2147483648. This will continue to happen every time discovery.php runs against the device.

In my case, I didn’t figure out what the issue was until there were over 8000 entries. Some symptoms that will be noticeable in the UI if this occurs are multiple pseudowire entries under the Pseudowires tab of a device. It also will be visible under the Ports tab for a device. On the right side of the page where the linked ports are shown, multiple entries for the same connection will appear.

To fix this, the “cpwVcID” column in the “pseudowires” table should be changed to type BIGINT instead of INT. This would allow it to support values larger than 2147483648.

After discussing with @murrant in the Discord #devel channel, the INT type should not be changed to BIGINT, rather it should remain INT but be marked as “UNSIGNED”. This will change the range of acceptable values from the default ,SIGNED -2147483648 to 2147483647, to UNSIGNED with a range of 0 to 4294967295. 4294967295 is the same as the max VC ID value so it seems Cisco is using the INT UNSIGNED type in their database on the device itself. I’ll be creating a Pull Request shortly to alter the “pseudowires” table column “cpwVcID” from type INT SIGNED to INT UNSIGNED.

1 Like

Pull Request can be found here.

If you are experiencing multiple entries in the “pseudowires” table with a “cpwVcID” value of 2147483647, you’ll have to manually delete them from the database after the PR has been applied to your LibreNMS instance. The next run of “discovery.php” will input the correct VC ID and future runs of “discovery.php” will no longer duplicate entries.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.