コード例 #1
0
 def _create_default_net_partition(self, default_net_part):
     self.nuageclient.check_del_def_net_partition(default_net_part)
     session = db.get_session()
     net_partition = nuagedb.get_net_partition_by_name(session,
                                                       default_net_part)
     if net_partition:
         with session.begin(subtransactions=True):
             nuagedb.delete_net_partition(session, net_partition)
     self._create_net_partition(session, default_net_part)
コード例 #2
0
ファイル: plugin.py プロジェクト: kavonm/neutron
    def _create_default_net_partition(self, default_net_part):
        self.nuageclient.check_del_def_net_partition(default_net_part)
        session = db.get_session()
        net_partition = nuagedb.get_net_partition_by_name(session, default_net_part)
        if net_partition:
            with session.begin(subtransactions=True):
                nuagedb.delete_net_partition(session, net_partition)

        self._create_net_partition(session, default_net_part)
コード例 #3
0
ファイル: plugin.py プロジェクト: kavonm/neutron
 def delete_net_partition(self, context, id):
     ent_rtr_mapping = nuagedb.get_ent_rtr_mapping_by_entid(context.session, id)
     if ent_rtr_mapping:
         msg = _("One or more router still attached to " "net_partition %s.") % id
         raise q_exc.BadRequest(resource="net_partition", msg=msg)
     net_partition = nuagedb.get_net_partition_by_id(context.session, id)
     if not net_partition:
         msg = _("NetPartition with %s does not exist") % id
         raise q_exc.BadRequest(resource="net_partition", msg=msg)
     l3dom_tmplt_id = net_partition["l3dom_tmplt_id"]
     l2dom_tmplt_id = net_partition["l2dom_tmplt_id"]
     self.nuageclient.delete_net_partition(net_partition["id"], l3dom_id=l3dom_tmplt_id, l2dom_id=l2dom_tmplt_id)
     with context.session.begin(subtransactions=True):
         nuagedb.delete_net_partition(context.session, net_partition)
コード例 #4
0
ファイル: plugin.py プロジェクト: mshabdiz/neutron
 def delete_net_partition(self, context, id):
     ent_rtr_mapping = nuagedb.get_ent_rtr_mapping_by_entid(
         context.session, id)
     if ent_rtr_mapping:
         msg = (_("One or more router still attached to "
                  "net_partition %s.") % id)
         raise q_exc.BadRequest(resource='net_partition', msg=msg)
     net_partition = nuagedb.get_net_partition_by_id(context.session, id)
     if not net_partition:
         msg = (_("NetPartition with %s does not exist") % id)
         raise q_exc.BadRequest(resource='net_partition', msg=msg)
     l3dom_tmplt_id = net_partition['l3dom_tmplt_id']
     l2dom_tmplt_id = net_partition['l2dom_tmplt_id']
     self.nuageclient.delete_net_partition(net_partition['id'],
                                           l3dom_id=l3dom_tmplt_id,
                                           l2dom_id=l2dom_tmplt_id)
     with context.session.begin(subtransactions=True):
         nuagedb.delete_net_partition(context.session, net_partition)
コード例 #5
0
ファイル: plugin.py プロジェクト: PFZheng/neutron
 def _create_default_net_partition(self, default_net_part):
     def_netpart = self.nuageclient.get_def_netpartition_data(
         default_net_part)
     session = db.get_session()
     if def_netpart:
         net_partition = nuagedb.get_net_partition_by_name(
             session, default_net_part)
         with session.begin(subtransactions=True):
             if net_partition:
                 nuagedb.delete_net_partition(session, net_partition)
             net_part = nuagedb.add_net_partition(session,
                                                  def_netpart['np_id'],
                                                  def_netpart['l3dom_tid'],
                                                  def_netpart['l2dom_tid'],
                                                  default_net_part)
             return self._make_net_partition_dict(net_part)
     else:
         return self._create_net_partition(session, default_net_part)
コード例 #6
0
ファイル: plugin.py プロジェクト: carrierstack/neutron
 def _create_default_net_partition(self, default_net_part):
     def_netpart = self.nuageclient.get_def_netpartition_data(
         default_net_part)
     session = db.get_session()
     if def_netpart:
         net_partition = nuagedb.get_net_partition_by_name(
             session, default_net_part)
         with session.begin(subtransactions=True):
             if net_partition:
                 nuagedb.delete_net_partition(session, net_partition)
             net_part = nuagedb.add_net_partition(session,
                                                  def_netpart['np_id'],
                                                  def_netpart['l3dom_tid'],
                                                  def_netpart['l2dom_tid'],
                                                  default_net_part)
             return self._make_net_partition_dict(net_part)
     else:
         return self._create_net_partition(session, default_net_part)