Browse Source

Move API from /map/api/ to /api/v1/

master
Sebastian Lohff 2 years ago
parent
commit
15f4971bde
  1. 21
      bgpdata/api_urls.py
  2. 4
      bgpdata/templates/bgpdata/map.html
  3. 18
      bgpdata/urls.py
  4. 3
      dnmapper/urls.py

21
bgpdata/api_urls.py

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
# This file is part of dnmapper, an AS--level mapping tool
# Licensed under GNU General Public License v3 or later
# Written by Sebastian Lohff (seba@someserver.de)
from django.conf.urls import url, include
from bgpdata.api import ASResource, CrawlResource, CrawlGraphResource, BorderRouterResource, AnnouncementResource
asResource = ASResource()
crawlResource = CrawlResource()
crawlGraphResource = CrawlGraphResource()
borderRouterResource = BorderRouterResource()
announcementResource = AnnouncementResource()
urlpatterns = (
url('', include(asResource.urls)),
url('', include(crawlResource.urls)),
url('', include(crawlGraphResource.urls)),
url('', include(borderRouterResource.urls)),
url('', include(announcementResource.urls)),
)

4
bgpdata/templates/bgpdata/map.html

@ -238,12 +238,12 @@ function click(d) { @@ -238,12 +238,12 @@ function click(d) {
//});
if(d.crawled) {
$.ajax({url: "/map/api/borderrouter/?AS__crawl={{crawl.pk}}&AS__number=" + d.asnumber, success: function(result) {
$.ajax({url: "/api/v1/borderrouter/?AS__crawl={{crawl.pk}}&AS__number=" + d.asnumber, success: function(result) {
$("#infowin").html('');
$("#infowin").fadeIn('fast', function() {});
for(var i=0; i<result.objects.length; i++) {
(function(currRouter) {
$.ajax({url:"/map/api/announcement/?router="+currRouter.id, success: function(result2) {
$.ajax({url:"/api/v1/announcement/?router="+currRouter.id, success: function(result2) {
astable = 'Table for AS'+d.asnumber+' router ID ' + currRouter.routerID;
astable += '<table class="table table-bordered">';
astable += '<tr><th>Network</th><th>Next Hop</th><th>AS Path</th></tr>';

18
bgpdata/urls.py

@ -1,28 +1,12 @@ @@ -1,28 +1,12 @@
# This file is part of dnmapper, an AS--level mapping tool
# Licensed under GNU General Public License v3 or later
# Written by Sebastian Lohff (seba@someserver.de)
from django.conf.urls import url
from django.conf.urls import url, include
from bgpdata.api import ASResource, CrawlResource, CrawlGraphResource, BorderRouterResource, AnnouncementResource
from bgpdata import views as bgpdata_views
asResource = ASResource()
crawlResource = CrawlResource()
crawlGraphResource = CrawlGraphResource()
borderRouterResource = BorderRouterResource()
announcementResource = AnnouncementResource()
urlpatterns = (
url(r'^$', bgpdata_views.overview),
url(r'^([0-9]+)/$', bgpdata_views.showMap),
url(r'^new/([0-9]+|live)/$', bgpdata_views.show_new_map),
# url(r'^api/crawl/(?P<crawlID>\d+)/asses/$', 'bgpdata.api.asses'),
# (r'^api/', include(asResource.urls)),
url(r'^api/', include(asResource.urls)),
url(r'^api/', include(crawlResource.urls)),
url(r'^api/', include(crawlGraphResource.urls)),
url(r'^api/', include(borderRouterResource.urls)),
url(r'^api/', include(announcementResource.urls)),
)

3
dnmapper/urls.py

@ -5,7 +5,9 @@ @@ -5,7 +5,9 @@
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import RedirectView
import bgpdata.urls
import bgpdata.api_urls
urlpatterns = (
# Examples:
@ -13,6 +15,7 @@ urlpatterns = ( @@ -13,6 +15,7 @@ urlpatterns = (
# url(r'^blog/', include('blog.urls')),
url(r'^$', RedirectView.as_view(url='/map/')),
url(r'^map/', include(bgpdata.urls)),
url(r'^api/v1/', include(bgpdata.api_urls)),
url(r'^admin/', admin.site.urls),
)

Loading…
Cancel
Save