Beispiel #1
0
 def _update_subnetpool_prefixes(self, context, prefix_list, id):
     with context.session.begin(subtransactions=True):
         context.session.query(models_v2.SubnetPoolPrefix).filter_by(
             subnetpool_id=id).delete()
         for prefix in prefix_list:
             model_prefix = models_v2.SubnetPoolPrefix(cidr=prefix,
                                                       subnetpool_id=id)
             context.session.add(model_prefix)
Beispiel #2
0
 def modify_fields_to_db(cls, fields):
     result = super(SubnetPool, cls).modify_fields_to_db(fields)
     if 'prefixes' in result:
         result['prefixes'] = [
             models.SubnetPoolPrefix(cidr=str(prefix),
                                     subnetpool_id=result['id'])
             for prefix in result['prefixes']
         ]
     return result
Beispiel #3
0
 def _create_subnetpool_prefix(self, context, cidr, subnetpool_id):
     prefix_args = {'cidr': cidr, 'subnetpool_id': subnetpool_id}
     subnetpool_prefix = models_v2.SubnetPoolPrefix(**prefix_args)
     context.session.add(subnetpool_prefix)