Example #1
0
 def create_router(self, context, router):
     net_partition = self._get_net_partition_for_router(context, router)
     neutron_router = super(NuagePlugin,
                            self).create_router(context, router)
     params = {
         'net_partition': net_partition,
         'tenant_id': neutron_router['tenant_id']
     }
     try:
         nuage_router = self.nuageclient.create_router(
             neutron_router, router['router'], params)
     except Exception:
         with excutils.save_and_reraise_exception():
             super(NuagePlugin, self).delete_router(context,
                                                    neutron_router['id'])
     if nuage_router:
         user_id = nuage_router['nuage_userid']
         group_id = nuage_router['nuage_groupid']
         with context.session.begin(subtransactions=True):
             nuagedb.add_entrouter_mapping(context.session,
                                           net_partition['id'],
                                           neutron_router['id'],
                                           nuage_router['nuage_domain_id'])
             nuagedb.add_rtrzone_mapping(context.session,
                                         neutron_router['id'],
                                         nuage_router['nuage_def_zone_id'],
                                         nuage_user_id=user_id,
                                         nuage_group_id=group_id)
     return neutron_router
Example #2
0
 def create_router(self, context, router):
     net_partition = self._get_net_partition_for_router(context, router)
     neutron_router = super(NuagePlugin, self).create_router(context,
                                                             router)
     params = {
         'net_partition': net_partition,
         'tenant_id': neutron_router['tenant_id']
     }
     try:
         nuage_router = self.nuageclient.create_router(neutron_router,
                                                       router['router'],
                                                       params)
     except Exception:
         with excutils.save_and_reraise_exception():
             super(NuagePlugin, self).delete_router(context,
                                                    neutron_router['id'])
     if nuage_router:
         user_id = nuage_router['nuage_userid']
         group_id = nuage_router['nuage_groupid']
         with context.session.begin(subtransactions=True):
             nuagedb.add_entrouter_mapping(context.session,
                                           net_partition['id'],
                                           neutron_router['id'],
                                           nuage_router['nuage_domain_id'])
             nuagedb.add_rtrzone_mapping(context.session,
                                         neutron_router['id'],
                                         nuage_router['nuage_def_zone_id'],
                                         nuage_user_id=user_id,
                                         nuage_group_id=group_id)
     return neutron_router