Пример #1
0
 def _get_router_assoc(self, context, assoc_id, bgpvpn_id):
     try:
         query = self._model_query(context, BGPVPNRouterAssociation)
         return query.filter(BGPVPNRouterAssociation.id == assoc_id,
                             BGPVPNRouterAssociation.bgpvpn_id == bgpvpn_id
                             ).one()
     except exc.NoResultFound:
         raise bgpvpn_ext.BGPVPNRouterAssocNotFound(id=assoc_id,
                                                    bgpvpn_id=bgpvpn_id)
Пример #2
0
 def get_router_assoc(self, context, assoc_id, bgpvpn_id, fields=None):
     try:
         bgpvpn_obj = self._vnc_api.bgpvpn_read(
             id=bgpvpn_id, fields=['logical_router_back_refs'])
     except vnc_exc.NoIdError:
         raise bgpvpn_ext.BGPVPNNotFound(id=bgpvpn_id)
     associated_routers = [
         lr_ref['uuid']
         for lr_ref in bgpvpn_obj.get_logical_router_back_refs() or []
     ]
     if assoc_id not in associated_routers:
         raise bgpvpn_ext.BGPVPNRouterAssocNotFound(id=assoc_id,
                                                    bgpvpn_id=bgpvpn_id)
     return bgpvpn_utils.make_router_assoc_dict(
         assoc_id, bgpvpn_obj.parent_uuid.replace('-', ''), bgpvpn_id,
         assoc_id)