Hello Morten,

I try to explain.
We have several switch stacks with N2048P and N2048 units.

for example this:
Unit 2 (serial: XXXXXXXXXXXXXXXXXXXXXXX, model: N2048P , software: 6.5.4.4)
Unit 9 (serial: XXXXXXXXXXXXXXXXXXXXXXX, model: N2048P , software: 6.5.4.4)
*Unit 4 (serial: XXXXXXXXXXXXXXXXXXXXXXX, model: N2048 , software: 6.5.4.4)*
Unit 8 (serial: XXXXXXXXXXXXXXXXXXXXXXX, model: N2048P , software: 6.5.4.4)
Unit 3 (serial: XXXXXXXXXXXXXXXXXXXXXXX, model: N2048P , software: 6.5.4.4)
Unit 1 (serial: XXXXXXXXXXXXXXXXXXXXXXX, model: N2048P , software: 6.5.4.4)
Unit 6 (serial: XXXXXXXXXXXXXXXXXXXXXXX, model: N2048P , software: 6.5.4.4)
Unit 5 (serial: XXXXXXXXXXXXXXXXXXXXXXX, model: N2048P , software: 6.5.4.4)
*Unit 7 (serial: XXXXXXXXXXXXXXXXXXXXXXX, model: N2048 , software: 6.5.4.4)*

When this switch is defined in Nav, it generates the next message into ipdevpool log file.

Last manager = DefaultManager(<class 'nav.ipdevpoll.shadows.POEPort'>, 'ContainerRepository'(...)). Last model = <class 'nav.ipdevpoll.shadows.POEPort'>
Traceback (most recent call last):
File "/opt/venvs/nav/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.NotNullViolation: null value in column "classification" of relation "poeport" violates not-null constraint
DETAIL: Failing row contains (88341, 134, 127, null, 100, t, 2, 4, null).

When it occurs, the statuscheck of the switch is red.

I tried to remove the constraint into the database definition, but the statuscheck was still red.

I resolved this problem by adding the next trigger into the databases. It changes del Null values of classification attribute for zero before updating or inserting the value into the table poeport :
CREATE OR REPLACE FUNCTION actualitzar_classification()
RETURNS TRIGGER AS $$
BEGIN
    -- Verificar si l'atribut és null i canviar-lo a zero
    IF NEW.classification IS NULL THEN
        NEW.classification := 0;
    END IF;
    RETURN NEW;
END;
$$ LANGUAGE plpgsql;

-- Afegir el trigger abans de l'acció d'inserció o update
CREATE TRIGGER actualitzar_classification_trigger
before INSERT OR UPDATE ON poeport
FOR EACH ROW
EXECUTE FUNCTION actualitzar_classification();

Now, the statuscheck of the switch is green and Nav shows the Poe information of N2048P switches .

Please let me know if you need more information.

Best regards,

PD: our current Nav version is 5.8.3, and if the trigger is undefined the problem persists.
Carles Perarnau i Sabés 
Unitat d'Infraestructures i Seguretat TIC - Servei d'Informàtica
Universitat Pompeu Fabra, Barcelona




Missatge de Morten Brekkevold <morten.brekkevold@sikt.no> del dia dj., 14 de des. 2023 a les 13:47:
On Thu, 23 Nov 2023 13:34:37 -0000 (2 weeks, 6 days, 23 hours ago) carles.perarnau@upf.edu wrote:

> I have NAV 5.7.1 and I have the same problem.
> There is any workaround to resolve it?
>
> The status check of the switches that have this problem is shown as failed.

What errors are reported for these devices in `ipdevpoll.log`?

--
Sincerely,
Morten Brekkevold

Sikt – Norwegian Agency for Shared Services in Education and Research