def _link_default_netpartition(self, netpart_name, l2template, l3template,
                                   l3isolated, l3shared):
        params = {
            'name': netpart_name,
            'l3template': l3template,
            'l2template': l2template
        }
        (np_id, l3dom_tid,
         l2dom_tid) = self.vsdclient.link_default_netpartition(params)
        # verify that the provided zones have been created already
        shared_match, isolated_match = self.vsdclient.validate_zone_create(
            l3dom_tid, l3isolated, l3shared)
        if not shared_match or not isolated_match:
            msg = ('Default zone names must be provided for '
                   'default net-partiton')
            raise n_exc.BadRequest(resource='net_partition', msg=msg)

        # basic verifications passed. add default netpartition to the DB
        session = lib_db_api.get_writer_session()
        netpartition = nuagedb.get_net_partition_by_name(session, netpart_name)

        with session.begin():
            if netpartition:
                nuagedb.delete_net_partition(session, netpartition)
            nuagedb.add_net_partition(session, np_id, l3dom_tid, l2dom_tid,
                                      netpart_name, l3isolated, l3shared)
        self._default_np_id = np_id
 def _add_net_partition(session, netpart, netpart_name):
     l3dom_id = netpart['l3dom_tid']
     l3isolated = constants.DEF_NUAGE_ZONE_PREFIX + '-' + l3dom_id
     l3shared = constants.DEF_NUAGE_ZONE_PREFIX + '-pub-' + l3dom_id
     return nuagedb.add_net_partition(session, netpart['np_id'], l3dom_id,
                                      netpart['l2dom_tid'], netpart_name,
                                      l3isolated, l3shared)
 def _add_net_partition(session, netpart, netpart_name):
     l3dom_id = netpart['l3dom_tid']
     if netpart_name == constants.SHARED_INFRASTRUCTURE:
         l3isolated = None
         l3shared = constants.SHARED_ZONE_TEMPLATE
     else:
         l3isolated = constants.DEF_NUAGE_ZONE_PREFIX + '-' + l3dom_id
         l3shared = constants.DEF_NUAGE_ZONE_PREFIX + '-pub-' + l3dom_id
     return nuagedb.add_net_partition(session, netpart['np_id'], l3dom_id,
                                      netpart['l2dom_tid'], netpart_name,
                                      l3isolated, l3shared)
Пример #4
0
 def _add_net_partition(session, netpartition):
     return nuagedb.add_net_partition(session, netpartition['id'], None,
                                      None, netpartition['name'], None,
                                      None)
 def _add_net_partition(self, session, netpartition):
     return nuagedb.add_net_partition(
         session, netpartition['id'], None, None,
         netpartition['name'], None, None)