Skip to content

feat(network::cisco::standard::snmp): new port-security and list-port-security modes - #6542

Open
rmorandell-pgum wants to merge 3 commits into
centreon:developfrom
i-Vertix:network-cisco-standard-snmp-port-security
Open

rmorandell-pgum wants to merge 3 commits into
centreon:developfrom
i-Vertix:network-cisco-standard-snmp-port-security

Conversation

@rmorandell-pgum

Copy link
Copy Markdown
Contributor

Community contributors

Description

Port security monitoring for Cisco Catalyst switches (CISCO-PORT-SECURITY-MIB cpsIfConfigTable), tested with a C9200L on IOS-XE 17.15.

  • New mode port-security (centreon::common::cisco::standard::snmp::mode::portsecurity), per interface:
    • port security state (enabled/disabled) compared with a reference value given with --expected-port-security: CRITICAL by default when the state differs, no comparison when the option is empty. This lets a service store the state found when it was created (e.g. by a service discovery) and alarm when it changes; to accept a new state, the reference value is updated.
    • port security status (secureup/securedown/shutdown): WARNING by default on shutdown (port err-disabled by a violation).
    • violation action, admin and operational status of the interface (available in the status expressions).
    • secure MAC addresses (current, with the configured maximum as max): interface.portsecurity.secure.mac.addresses.count.
    • security violations since the last check (statefile, cache name with sha256_hex): interface.portsecurity.violations.count.
    • interfaces selected with --include-interface/--exclude-interface on the name chosen with --oid-display (ifName by default, ifDescr or ifAlias).
  • New mode list-port-security (centreon::common::cisco::standard::snmp::mode::listportsecurity): interfaces of the port security table with name, description, alias, index, port security state, status, violation action, admin and operational status; supports --disco-format/--disco-show for service discovery.
  • Both modes are added to network::cisco::standard::snmp::plugin.

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Functionality enhancement or optimization (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

How this pull request can be tested ?

Robot tests with an anonymized walk of a C9200L and a fault variant (one port in shutdown with violations, one port whose port security was disabled):

robot -e notauto tests/network/cisco/standard/snmp/port-security.robot tests/network/cisco/standard/snmp/list-port-security.robot
  • port-security.robot (13 cases, they share a statefile and must run in order): default output, violations delta between two runs (buffer creation, then delta, then counter reset), --critical-violations, reference value matching and differing in both directions, custom --critical-status, --oid-display=ifDescr, include/exclude filters, secure MAC addresses threshold, no interface found, invalid --expected-port-security.
  • list-port-security.robot (4 cases): list with include and exclude filters, --disco-show, --disco-format.

Example:

perl centreon_plugins.pl --plugin=network::cisco::standard::snmp::plugin --mode=port-security --hostname=127.0.0.1 --snmp-port=2024 --snmp-community=network/cisco/standard/snmp/cisco-catalyst-port-security --include-interface='^Gi1/0/9$' --expected-port-security=disabled
CRITICAL: Interface 'Gi1/0/9' port security: enabled (expected: disabled), status: securedown, violation action: dropNotify | 'Gi1/0/9#interface.portsecurity.secure.mac.addresses.count'=1;;;0;1

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (develop).
  • I have provide data or shown output displaying the result of this code in the plugin area concerned.

Centreon team (internal PR)

Description

PLEASE MAKE SURE THAT THE BRANCH PR INCLUDES JIRA TICKET ID

Please include a short resume of the changes and what is the purpose of this pull request.
Any relevant information should be added to help reviewers to understand what are the stakes
of the pull request.

Fixes # (issue)
If you are fixing a github Issue already existing, mention it here.
If you are fixing one or more JIRA ticket, mention it here too.

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Functionality enhancement or optimization (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

How this pull request can be tested ?

Please describe the procedure to verify that the goal of the PR is matched.
Provide clear instructions so that it can be correctly tested.
Mention the automated tests included in this FOR (what they test like mode/option combinations).

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (develop).
  • In case of a new plugin, I have created the new packaging directory accordingly.
  • I have implemented automated tests related to my commits.
    • Data used for automated tests are anonymized.
  • I have reviewed all the help messages in all the .pm files I have modified.
    • All sentences begin with a capital letter.
    • All sentences end with a period.
    • I am able to understand all the help messages, if not, exchange with the PO or TW to rewrite them.
  • After having created the PR, I will make sure that all the tests provided in this PR have run and passed.

rmorandell-pgum and others added 3 commits November 13, 2026 13:55
…-security modes

Port security monitoring for Catalyst switches (CISCO-PORT-SECURITY-MIB,
tested with a C9200L on IOS-XE 17.15).

- port-security: per interface, port security state (enabled/disabled)
  compared with --expected-port-security (CRITICAL when different, no
  comparison when empty), port security status (WARNING on shutdown),
  violation action, secure MAC addresses (current/max) and security
  violations since the last check (statefile). Interfaces selected with
  --include-interface/--exclude-interface on ifName, ifDescr or ifAlias
  (--oid-display).
- list-port-security: interfaces of cpsIfConfigTable with their port security
  state, for service discovery (the discovered state becomes the reference
  value of the service).
- Robot tests with an anonymized walk and a fault variant (17 cases).
@rmorandell-pgum
rmorandell-pgum requested review from a team as code owners November 13, 2026 14:10
@rmorandell-pgum
rmorandell-pgum requested review from lucie-tirand and sdepassio and removed request for a team November 13, 2026 14:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant