Hi

I try to move a subnet to another ipam through vnc_api. I want the subnet-id to 
stay the same (i.e. Not delete and recreate) So far no success. 

I can get my hands on the IPAMSubnetType by matching subnet-id

I then try to delete the subnet from 
default-domain:default-project:default-network-ipam as follows. (Used a 
derivative of VncObjects library so not pure api that you see here,
But I think it is clear enough)

# search through ipam’s and match on cidr
ipam_list = self.obj.get_network_ipam_refs()
        subnet_list = []
        if ipam_list:
    for item in ipam_list:
        if item['to'] == ipam_obj.fq_name_get():
            subnet_list = item['attr'].get_ipam_subnets()
            self.obj.del_network_ipam(ref_obj=ipam_obj.obj)
            break

        for s in subnet_list:
    net = s.get_subnet().get_ip_prefix(),
    masklen = s.get_subnet().get_ip_prefix_len(),
    if '{0}/{1}'.format(net[0], masklen[0]) == subnet:
        subnet_list.remove(s)
        break

        self.obj.add_network_ipam(
    ref_obj=ipam_obj.obj,
    ref_data=vnc_api.VnSubnetsType(subnet_list)
        )

This works well, only a bit too good. It appears that the subnet has completely 
vanioshed from neutron subnet-list. I try to add the IPAMSubnetType that I kept 
aside to another ipam 
With sort of the same code as above, appending it to the subnetlist instead of 
remove I get no errors in the server logs but the subnet does not get added to 
the spam I want


Can anyone point me in the right direction for moving a subnet to another spam

Thnx


Vriendelijke Groeten/Kind Regards

Marcel Kuiper






_______________________________________________
Users mailing list
[email protected]
http://lists.opencontrail.org/mailman/listinfo/users_lists.opencontrail.org

Reply via email to