Open huaanlzy opened 8 months ago
Hi, I also had a similar issue. What I found is that you need to store those prefixes in the form of IPaddress objects, not in string format. Example:
from ipaddress import IPv6Address, IPv6Network, IPv4Network pyt = pytricia.PyTricia(128) pyt.insert(IPv4Network(pfx)) # If prefix is IPv4. pyt.insert(IPv6Network(pfx)) # If prefix is IPv6.
Hi, I am running into some weird things. this is a set of cidr I am trying to add into the tree, and a cidr is lost or somehow deleted during that time.
['10.98.20.0/22', '10.98.20.0/24', '10.98.21.0/24', '10.98.22.0/24', '10.98.23.0/27', '10.98.23.32/27', '10.98.23.64/27', '10.98.24.0/22', '10.98.24.0/24', '10.98.25.0/24', '10.98.26.0/24', '10.98.27.0/24', '10.98.28.0/27', '10.98.29.0/24', '10.108.0.0/16', '10.108.0.0/24', '10.108.2.0/24', '10.108.17.0/24', '10.108.18.0/24', '10.108.19.0/24', '10.108.20.0/24', '10.108.21.0/24', '10.108.23.0/24', '10.108.25.0/24', '10.108.26.0/24', '10.108.27.0/24', '10.108.28.0/24', '10.108.29.0/24', '10.108.30.0/24', '10.108.31.0/24', '10.108.32.0/24', '10.108.33.0/24', '10.108.128.0/24', '10.108.130.0/24', '10.108.132.0/24', '10.108.135.0/24', '10.108.136.0/24', '10.108.137.0/24', '10.108.138.0/24', '10.108.139.0/24', '10.108.140.0/24', '10.108.141.0/24', '10.108.142.0/24', '10.108.143.0/24', '10.108.144.0/24', '10.108.145.0/24', '10.108.146.0/24', '10.108.147.0/24', '10.108.148.0/24', '10.108.149.0/24', '10.108.151.0/24', '10.108.153.0/24', '10.108.154.0/24', '10.108.155.0/24', '10.108.156.0/24', '10.108.166.0/24', '10.108.220.0/24', '10.108.222.0/24', '10.108.232.0/24', '10.108.233.0/24', '10.108.234.0/24', '10.108.236.0/24', '10.108.239.0/24', '10.108.240.0/24', '10.108.242.0/24', '10.108.244.0/24', '10.108.245.0/24', '10.108.246.0/24', '10.108.247.0/24', '10.108.248.0/24', '10.108.249.0/24', '10.108.250.0/24', '10.108.252.0/24', '10.108.254.0/24', '10.108.255.0/24', '10.112.0.0/16', '10.112.0.0/22', '10.112.4.0/22', '10.112.8.0/22', '10.112.12.0/22', '10.112.16.0/22', '10.112.20.0/22', '10.112.24.0/22', '10.112.28.0/22', '10.112.32.0/22', '10.112.36.0/22', '10.112.40.0/22', '10.112.44.0/22', '10.112.48.0/22', '10.112.52.0/22', '10.112.56.0/22', '10.112.60.0/22', '10.112.64.0/22', '10.112.68.0/22', '10.112.72.0/22', '10.112.76.0/22', '10.112.80.0/22', '10.112.84.0/22', '10.112.88.0/22', '10.112.92.0/22', '10.112.96.0/22', '10.112.100.0/22', '10.112.104.0/22', '10.112.108.0/22', '10.112.112.0/22', '10.112.116.0/22', '10.112.120.0/22', '10.112.124.0/22', '10.112.128.0/22', '10.112.132.0/22', '10.112.136.0/22', '10.112.140.0/22', '10.112.144.0/22', '10.112.148.0/22', '10.112.152.0/22', '10.112.156.0/22', '10.112.160.0/22', '10.112.164.0/22', '10.112.168.0/22', '10.112.172.0/22', '10.112.176.0/22', '10.112.180.0/22', '10.112.184.0/22', '10.112.188.0/22', '10.112.192.0/22', '10.112.196.0/22', '10.124.0.0/24', '10.124.1.0/24', '10.124.4.0/22', '10.124.4.0/24', '10.124.5.0/24', '10.124.6.0/24', '10.124.7.0/24', '10.124.8.0/22', '10.124.8.0/24', '10.124.9.0/24', '10.124.10.0/24', '10.124.11.0/24', '10.124.12.0/22', '10.124.12.0/24', '10.124.13.0/24', '10.124.14.0/24', '10.124.15.0/24', '10.124.16.0/22', '10.124.16.0/24', '10.124.17.0/24', '10.124.18.0/24', '10.124.19.0/24', '10.124.20.0/24', '10.124.24.0/22', '10.124.24.0/24', '10.124.25.0/24', '10.124.26.0/24', '10.124.27.0/24', '10.124.28.0/22', '10.124.28.0/24', '10.124.29.0/24', '10.124.30.0/24', '10.124.31.0/24', '10.124.32.0/22', '10.124.32.0/24', '10.124.48.0/22', '10.124.48.0/24', '10.124.49.0/24', '10.124.50.0/24', '10.124.51.0/24', '10.124.148.0/22', '10.124.148.0/24', '10.124.149.0/24', '10.124.150.0/24', '10.124.168.0/22', '10.124.168.0/24', '10.200.12.0/22', '10.200.16.0/22', '2403:28c0:30a:2:a111:cb5d:c7c7:a332/127', '2403:28c0:30a:2::/64', '2408:4002:1025:1008::/64', '2408:4002:1025:100c::/64', '2408:4003:10f3:d20c::/64', '2408:4003:10f3:d208::/64', '2408:4005:384:1208::/64', '2408:4005:384:120c::/64', '2408:400a:400::/56', '2408:400a:c0:e510::/64', '2408:400a:c0:e514::/64', '2408:400a:c0:e50c::/64', '2605:340:cdb1:504::/64', '2605:340:cdb1:500::/56', '2605:340:cdb1:506::/64', '2605:340:cdb1:703::/64', '2605:340:cdb1:b00::/64', '2605:340:cdb1:706::/64', '2605:340:cdb1:600::/64', '2605:340:cdb1:29b::/64', '2605:340:cdb1:2fe::/64', '100.118.58.0/24', '100.118.167.0/24', '100.118.170.0/24', '100.118.171.0/24', '100.118.172.0/24', '100.118.173.0/24', '100.118.173.128/25', '100.118.173.128/32', '100.118.173.128/26']
it seems that a previously inserted cidr : '2605:340:cdb1:b00::/64' is somehow deleted from the tree, when inserting other cidrs.