TeemIp / teemip-core-ip-mgmt

Core modules of TeemIP, a WEB based IP Address Management tool
https://www.teemip.net
GNU Affero General Public License v3.0
19 stars 12 forks source link

Expand Subnet will delete all IP Addresses In the Subnet #6

Closed annProg closed 4 years ago

annProg commented 4 years ago

From document: https://wiki.teemip.net/doku.php?id=2_x:datamodel:subnets

This action may change the IP of the subnet:

  • Expanding subnet 10.129.2.0/25 by 2 will produce subnet 10.129.2.0/24
  • Expanding subnet 10.129.2.128/25 by 2 will produce same subnet 10.129.2.0/24
  • Expanding subnet 10.129.3.0/25 by 4 will produce subnet 10.129.2.0/23 All subnets contained within the border of the new subnet will be absorbed, i.e. they will be deleted and all their IP Ranges and IPs will be kept and integrated in the new subnet.

But in actual operation,after expand a subnet, all it's IPs will be deleted. The picture below shows that after each expand operation, the IP address is deleted.

version info

xtophe38 commented 4 years ago

Well, no. I do confirm that no IP belonging to a given subnet will be deleted when the subnet is expanded. You may try that by looking at the "Registered IPs" tab of the subnet.

Your picture shows the history of a physical interface named "test" attached to network device "Router 1". We see that both 192.168.0.10 and 192.168.0.6 have been deleted (and therefore removed from the interface) at a point in time. Right. But there is no link with the changes that you applied on you subnet's size.

Anyway, I tried to reproduce you problem with different configuations but I haven't been able to do so. You'd need to provide more details... and captures in English if possible :-)

Thanks!

annProg commented 4 years ago

screen capture for my operation: itop-subnet-expand-screencap.zip

use api, I can see these IPs had been deleted:

# python3 ip.py 
2020-07-16 09:34:56
{
    "code": 0,
    "message": "Found: 3",
    "objects": {
        "CMDBChangeOpDelete::1544": {
            "code": 0,
            "message": "",
            "class": "CMDBChangeOpDelete",
            "key": "1544",
            "fields": {
                "change": "544",
                "date": "2020-07-16 09:37:34",
                "userinfo": "My first name My last name",
                "objclass": "IPObject",
                "objkey": "22",
                "fclass": "IPv4Address",
                "fname": "192.168.0.2",
                "finalclass": "CMDBChangeOpDelete",
                "friendlyname": "544",
                "change_friendlyname": "2020-07-16 09:37:34"
            }
        },
        "CMDBChangeOpDelete::1545": {
            "code": 0,
            "message": "",
            "class": "CMDBChangeOpDelete",
            "key": "1545",
            "fields": {
                "change": "544",
                "date": "2020-07-16 09:37:34",
                "userinfo": "My first name My last name",
                "objclass": "IPObject",
                "objkey": "23",
                "fclass": "IPv4Address",
                "fname": "192.168.0.3",
                "finalclass": "CMDBChangeOpDelete",
                "friendlyname": "544",
                "change_friendlyname": "2020-07-16 09:37:34"
            }
        },
        "CMDBChangeOpDelete::1546": {
            "code": 0,
            "message": "",
            "class": "CMDBChangeOpDelete",
            "key": "1546",
            "fields": {
                "change": "544",
                "date": "2020-07-16 09:37:34",
                "userinfo": "My first name My last name",
                "objclass": "IPObject",
                "objkey": "24",
                "fclass": "IPv4Address",
                "fname": "192.168.0.4",
                "finalclass": "CMDBChangeOpDelete",
                "friendlyname": "544",
                "change_friendlyname": "2020-07-16 09:37:34"
            }
        }
    },
    "item_key": [
        "1544",
        "1545",
        "1546"
    ]
}
annProg commented 4 years ago

I found the reason. When a IP's Usage was set to "Network IP", it will be deleted. Now I know that "Network IP" is a special IP Address for subnet. I will closed the issue.

xtophe38 commented 4 years ago

Indeed. Network IP is the subnet IP itself (like 10.124.50.0 in subnet 10.124.50.0/24). According to global IP parameter "Reserve Subnet, Gateway and Broadcast IPs at Subnet Creation", this IP is automatically created /deleted when subnet is created / modified /deleted.