Example #1
0
    def create(self, context):
        """Create database models for an IPAM subnet.

        This method creates a subnet resource for the IPAM driver and
        associates it with its neutron identifier, if specified.

        :param context: neutron api request context
        :returns: the idenfier of created IPAM subnet
        """
        if not self._ipam_subnet_id:
            self._ipam_subnet_id = uuidutils.generate_uuid()
        ipam_objs.IpamSubnet(
            context,
            id=self._ipam_subnet_id,
            neutron_subnet_id=self._neutron_subnet_id).create()
        return self._ipam_subnet_id
Example #2
0
 def _create_test_ipam_subnet(self):
     attrs = self.get_random_object_fields(obj_cls=ipam.IpamSubnet)
     self._ipam_subnet = ipam.IpamSubnet(self.context, **attrs)
     self._ipam_subnet.create()