Exemplo n.º 1
0
def get_subnet_l2dom_by_port_id(session, port_id):
    query = (session.query(nuage_models.SubnetL2Domain).join(
        models_v2.Subnet).join(models_v2.IPAllocation).filter(
            models_v2.IPAllocation.port_id == port_id))
    try:
        return query.one()
    except sql_exc.NoResultFound:
        raise exceptions.SubnetMappingNotFound(resource='port', id=port_id)
    except sql_exc.MultipleResultsFound:
        return query.first()
Exemplo n.º 2
0
 def get_subnet_available_nuage_policy_groups(self, context, filters=None):
     subnet_id = filters.pop('for_subnet')[0]
     vsd_mapping = nuagedb.get_subnet_l2dom_by_id(context.session,
                                                  subnet_id)
     if not vsd_mapping:
         raise exceptions.SubnetMappingNotFound(resource='subnet',
                                                id=subnet_id)
     vsd_filters = self.osfilters_to_vsdfilters(filters)
     return self._get_available_nuage_policy_groups(vsd_mapping,
                                                    vsd_filters)