#6 Ports which get shutdown from vmpsd aren't logged to databas

default
open
nobody
5
2006-10-24
2006-10-24
hcccnetadmin
No

When a port is shutdown because of the vlan assignment
I see information regarding it on the console but
nothing is logged into the database. Can this be
added?

Discussion

  • hcccnetadmin
    hcccnetadmin
    2006-10-26

    Logged In: YES
    user_id=1164468

    Below was my solution. I am not a programmer by any means and this is my first attempt at
    modifying any java code so any comments on how to simplify it would be great.
    After pulling my hair out trying to learn an IDE to recompile this code with, I found a
    fix to my problem by sending the mac address from the request packet rather than the
    response packet to the logging thread.

    was: [line 194]
    loggingQueue.put(new LogData(request.getVMPSDomainName(), request.getClientIPAddress(),
    request.getPortName(), response.getMACAddress(), response.getVLANName()));

    now: [line 194]
    loggingQueue.put(new LogData(request.getVMPSDomainName(), request.getClientIPAddress(),
    request.getPortName(), request.response.getVLANName()));

    After that you need to allow the program to log messages with the return code of
    ERROR_SHUTDOWN_PORT. I used an 'if' and 'else if' statement to do this but I'm sure this
    could be simplified. Below is the complete modification.

    was: [line 192 - 199]
    if ((loggingQueue != null) && (response.getErrorCode() == VQPPacket.NO_ERROR)) {
    try {
    loggingQueue.put(new LogData
    (request.getVMPSDomainName(), request.getClientIPAddress(), request.getPortName(),
    response.getMACAddress(), response.getVLANName()));
    }
    catch (InterruptedException e) {
    log.warn("interrupted while enqueuing to
    logging queue", e);
    }
    }

    now: [line 192 - 209]
    if (loggingQueue != null) {
    if (response.getErrorCode() == VQPPacket.NO_ERROR)
    {
    try {
    loggingQueue.put(new LogData
    (request.getVMPSDomainName(), request.getClientIPAddress(), request.getPortName(),
    request.getMACAddress(), response.getVLANName()));
    }
    catch (InterruptedException e) {
    log.warn("interrupted while
    enqueuing to logging queue", e);
    }
    }
    else if (response.getErrorCode() ==
    VQPPacket.ERROR_SHUTDOWN_PORT) {
    try {
    loggingQueue.put(new LogData
    (request.getVMPSDomainName(), request.getClientIPAddress(), request.getPortName(),
    request.getMACAddress(), response.getVLANName()));
    }
    catch (InterruptedException e) {
    log.warn("interrupted while
    enqueuing to logging queue", e);
    }
    }
    }