diff --git a/README.md b/README.md index 91ef0f6f1ae845db1db8ab41642a5c85bc09a242..604763caf3880f8847f03dd33eb9295eca394dca 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[PACKAGE]: ../../raw/master/mkp/nvdct-0.8.7-20240430.mkp "nvdct-0.8.7-20240430.mkp" +[PACKAGE]: ../../raw/master/mkp/nvdct-0.8.8-20240508.mkp "nvdct-0.8.8-20240508.mkp" Network Visualization Data Creation Tool (NVDCT) This script creates the topology data file needed for the [Checkmk Exchange Network visualization](https://exchange.checkmk.com/p/network-visualization) plugin by Andreas Boesl and [schnetz](https://exchange.checkmk.com/u/schnetz).\ diff --git a/mkp/nvdct-0.8.8-20240508.mkp b/mkp/nvdct-0.8.8-20240508.mkp new file mode 100644 index 0000000000000000000000000000000000000000..69ce2a79e9d2f2e4e975b66260adbab25201ceba Binary files /dev/null and b/mkp/nvdct-0.8.8-20240508.mkp differ diff --git a/source/bin/nvdct/lib/settings.py b/source/bin/nvdct/lib/settings.py index 066dd7918e5609db83bf891f4296b6c30c9aeb97..f77f034c5564510b2162b9faec0cbddab08ed7b9 100755 --- a/source/bin/nvdct/lib/settings.py +++ b/source/bin/nvdct/lib/settings.py @@ -58,6 +58,7 @@ class Wildcard(NamedTuple): int_wildcard: int ip_address: str wildcard: str + bit_pattern: int class Settings: @@ -400,11 +401,14 @@ class Settings: ) continue try: + # 0.0.127.0 -> 255.255.128.255 + inverted_wildcard = '.'.join([str(255 - int(octet)) for octet in wildcard.split('.')]) self.__l3v4_ignore_wildcard.append(Wildcard( int_ip_address=int(IPv4Address(ip_address)), - int_wildcard=int(IPv4Address(wildcard)), + int_wildcard=int(IPv4Address(inverted_wildcard)), ip_address=ip_address, wildcard=wildcard, + bit_pattern= int(IPv4Address(ip_address)) & int(IPv4Address(inverted_wildcard)) )) except (AddressValueError, NetmaskValueError): LOGGER.error( diff --git a/source/bin/nvdct/lib/utils.py b/source/bin/nvdct/lib/utils.py index bf093d4bbae5d38d94671b99d5e5693e8d5f364d..4ec081232e5da05a887eeaeb0fceda5266b3cd3c 100755 --- a/source/bin/nvdct/lib/utils.py +++ b/source/bin/nvdct/lib/utils.py @@ -22,7 +22,7 @@ from time import time as now_time from tomllib import loads as toml_loads, TOMLDecodeError from typing import List, Dict, Any, TextIO -NVDCT_VERSION = '0.8.7-20240430' +NVDCT_VERSION = '0.8.8-20240507' @unique diff --git a/source/bin/nvdct/nvdct.py b/source/bin/nvdct/nvdct.py index b6117f776ef152567c981a07cccf8e6de963c878..ffa5fb1141f0157afdb8bc0092bdc6d4f04316b9 100755 --- a/source/bin/nvdct/nvdct.py +++ b/source/bin/nvdct/nvdct.py @@ -101,6 +101,7 @@ # 2024-04-18: added option --skip-l3-ip # added tooltip for --skip-l3-if and --skip-l3-ip # 2024-04-30: automatically create @default if it doesn't exist +# 2024-05-07: fixed handling of ignore wildcard in L3v4 topology # creating topology data json from inventory data # @@ -872,7 +873,7 @@ def is_ignore_ipv4(ip_address: str, ignore_ips: List[IPv4Network]) -> bool: def is_ignore_wildcard(ip_address: str, ignore_wildcard: List[Wildcard]) -> bool: int_ip_address = int(IPv4Address(ip_address)) for wildcard in ignore_wildcard: - if int_ip_address & wildcard.int_wildcard == wildcard.int_ip_address: + if int_ip_address & wildcard.int_wildcard == wildcard.bit_pattern: LOGGER.info( f'IP address {ip_address} matches ignore wildcard ' f'list ({wildcard.ip_address}/{wildcard.wildcard})' diff --git a/source/bin/nvdct/nvdct.toml b/source/bin/nvdct/nvdct.toml index dec7379e69ebcd4e3e9c27afa62560e4b1b01d54..f9d4657ea2bd8873bb919e7dd1467e18246130b8 100755 --- a/source/bin/nvdct/nvdct.toml +++ b/source/bin/nvdct/nvdct.toml @@ -44,9 +44,14 @@ L3V4_IGNORE_IP = [ ] # ignore IPs by wildcard +# if comparing an ip address: +# each 0 bit in the wildcad has to be exacly as in the pattern +# each 1 bit in the wildacrd will be ignored L3V4_IRNORE_WILDCARD = [ - # ["0.0.0.1", "0.0.0.255"], # ignore all IPs ending with 1 - # ["172.17.0.2", "255.255.0.255"], # ignore all IPs ending with 1 from 172.17.0.0/16 + # [ pattern , wildcard ] + # ["172.17.0.1", "0.0.255.0"], # ignore all IPs ending with 1 from 172.17.128.0/16 + # ["172.17.128.0", "0.0.127.3"], # ignore all IPs ending with 0-3 from 172.17.128.0/17 + ["172.17.128.3", "0.0.127.0"], # ignore all IPs ending with 3 from 172.17.128.0/17 ] # networks to summarize diff --git a/source/packages/nvdct b/source/packages/nvdct index 6dd4726521c4761f99796ffd1ea4c5181e3967d2..36a3ef5a3c128ade5fd2d2ae51fc7c400ff452e6 100644 --- a/source/packages/nvdct +++ b/source/packages/nvdct @@ -57,7 +57,7 @@ 'htdocs/images/icons/location_80.png']}, 'name': 'nvdct', 'title': 'Network Visualization Data Creation Tool (NVDCT)', - 'version': '0.8.7-20240430', + 'version': '0.8.8-20240508', 'version.min_required': '2.2.0b1', 'version.packaged': '2.2.0p24', 'version.usable_until': '2.4.0p1'}