Esempio n. 1
0
 def _fake_db_network_get_all(self, context, project_only="allow_none"):
     project_id = context.project_id
     nets = self.networks
     if nova.context.is_user_context(context) and project_only:
         if project_only == 'allow_none':
             nets = [n for n in self.networks
                     if (n['project_id'] == project_id or
                         n['project_id'] is None)]
         else:
             nets = [n for n in self.networks
                     if n['project_id'] == project_id]
     objs = [objects.Network._from_db_object(context,
                                             objects.Network(),
                                             net)
             for net in nets]
     return objects.NetworkList(objects=objs)
Esempio n. 2
0
 def get_all(context):
     ret = objects.NetworkList(context=context, objects=[])
     net = objects.Network(cidr='10.0.0.0/23')
     ret.objects.append(net)
     return ret