示例#1
0
 def _make_bgpvpn_dict(self, bgpvpn_db, fields=None):
     net_list = [
         net_assocs.network_id
         for net_assocs in bgpvpn_db.network_associations
     ]
     router_list = [
         router_assocs.router_id
         for router_assocs in bgpvpn_db.router_associations
     ]
     res = {
         'id':
         bgpvpn_db['id'],
         'tenant_id':
         bgpvpn_db['tenant_id'],
         'networks':
         net_list,
         'routers':
         router_list,
         'name':
         bgpvpn_db['name'],
         'type':
         bgpvpn_db['type'],
         'route_targets':
         utils.rtrd_str2list(bgpvpn_db['route_targets']),
         'route_distinguishers':
         utils.rtrd_str2list(bgpvpn_db['route_distinguishers']),
         'import_targets':
         utils.rtrd_str2list(bgpvpn_db['import_targets']),
         'export_targets':
         utils.rtrd_str2list(bgpvpn_db['export_targets'])
     }
     return self._fields(res, fields)
示例#2
0
    def _make_bgpvpn_dict(self, bgpvpn_db, fields=None):
        net_list = [
            net_assocs.network_id
            for net_assocs in bgpvpn_db.network_associations
        ]
        router_list = [
            router_assocs.router_id
            for router_assocs in bgpvpn_db.router_associations
        ]
        port_list = [
            port_assocs.port_id for port_assocs in bgpvpn_db.port_associations
        ]
        res = {
            'id':
            bgpvpn_db['id'],
            'tenant_id':
            bgpvpn_db['tenant_id'],
            'networks':
            net_list,
            'routers':
            router_list,
            'ports':
            port_list,
            'name':
            bgpvpn_db['name'],
            'type':
            bgpvpn_db['type'],
            'route_targets':
            utils.rtrd_str2list(bgpvpn_db['route_targets']),
            'route_distinguishers':
            utils.rtrd_str2list(bgpvpn_db['route_distinguishers']),
            'import_targets':
            utils.rtrd_str2list(bgpvpn_db['import_targets']),
            'export_targets':
            utils.rtrd_str2list(bgpvpn_db['export_targets'])
        }

        plugin = directory.get_plugin(bgpvpn_def.ALIAS)
        if utils.is_extension_supported(plugin, bgpvpn_vni_def.ALIAS):
            res[bgpvpn_vni_def.VNI] = bgpvpn_db.get(bgpvpn_vni_def.VNI)
        if utils.is_extension_supported(plugin, bgpvpn_rc_def.ALIAS):
            res[bgpvpn_rc_def.LOCAL_PREF_KEY] = bgpvpn_db.get(
                bgpvpn_rc_def.LOCAL_PREF_KEY)

        return db_utils.resource_fields(res, fields)
 def _make_bgpvpn_dict(self, bgpvpn, fields=None):
     net_list = [net.id for net in bgpvpn['networks']]
     res = {
         'id': bgpvpn['id'],
         'tenant_id': bgpvpn['tenant_id'],
         'networks': net_list,
         'name': bgpvpn['name'],
         'type': bgpvpn['type'],
         'route_targets':
             utils.rtrd_str2list(bgpvpn['route_targets']),
         'route_distinguishers':
             utils.rtrd_str2list(bgpvpn['route_distinguishers']),
         'import_targets':
             utils.rtrd_str2list(bgpvpn['import_targets']),
         'export_targets':
             utils.rtrd_str2list(bgpvpn['export_targets']),
         'auto_aggregate': bgpvpn['auto_aggregate']
     }
     return self._fields(res, fields)
示例#4
0
 def _make_bgpvpn_dict(self, bgpvpn_db, fields=None):
     net_list = [net_assocs.network_id for net_assocs in
                 bgpvpn_db.network_associations]
     router_list = [router_assocs.router_id for router_assocs in
                    bgpvpn_db.router_associations]
     res = {
         'id': bgpvpn_db['id'],
         'tenant_id': bgpvpn_db['tenant_id'],
         'networks': net_list,
         'routers': router_list,
         'name': bgpvpn_db['name'],
         'type': bgpvpn_db['type'],
         'route_targets':
             utils.rtrd_str2list(bgpvpn_db['route_targets']),
         'route_distinguishers':
             utils.rtrd_str2list(bgpvpn_db['route_distinguishers']),
         'import_targets':
             utils.rtrd_str2list(bgpvpn_db['import_targets']),
         'export_targets':
             utils.rtrd_str2list(bgpvpn_db['export_targets'])
     }
     return self._fields(res, fields)