4 Commits

Author SHA1 Message Date
  Sebastian Lohff ec7cbab410 Add protobuf as dependency 1 year ago
  Sebastian Lohff 180e127fff New (temporary) colorscheme for new map 1 year ago
  Sebastian Lohff 841e1d015a Protect crawl converter against broken crawls 1 year ago
  Sebastian Lohff b506c7c8a2 Python3 fixes for old crawler 1 year ago
4 changed files with 17 additions and 7 deletions
  1. 4
    4
      backend/cmk_parser.py
  2. 1
    1
      backend/crawler.py
  3. 11
    2
      bgpdata/templates/bgpdata/new_new_map.html
  4. 1
    0
      requirements.txt

+ 4
- 4
backend/cmk_parser.py View File

@@ -45,7 +45,7 @@ def parseBGPData(raw, asno):
45 45
 
46 46
     # mkify
47 47
     raw = d.group(2).split("\n")
48
-    arr = filter(lambda _z: _z, map(lambda _y: filter(lambda _x: _x, re.split(r"\s+", _y)), raw))
48
+    arr = list(filter(lambda _z: _z, map(lambda _y: list(filter(lambda _x: _x, re.split(r"\s+", _y))), raw)))
49 49
 
50 50
     # parse for bird/quagga
51 51
     result = None
@@ -80,7 +80,7 @@ def parseBird(data, raw, asno):
80 80
     status = _birdFindTable(data, "show status")
81 81
     if status[2][0] != "1011-Router":
82 82
         err("Couldn't find router id in bird output")
83
-    peers = filter(lambda _x: _x["type"] == "BGP", _birdMakeProtocols(data))
83
+    peers = list(filter(lambda _x: _x["type"] == "BGP", _birdMakeProtocols(data)))
84 84
 
85 85
     if asno == None:
86 86
         err("Host is bird")
@@ -135,7 +135,7 @@ def _birdMakeProtocols(info):
135 135
     #   state (established, active)
136 136
     #   if error, last error is avilable
137 137
     protocols = []
138
-    for proto, data in _birdFindProtocols(info).iteritems():
138
+    for proto, data in _birdFindProtocols(info).items():
139 139
         protoInfo = {
140 140
             "name": proto,
141 141
             "type": data[0][1],
@@ -343,7 +343,7 @@ def _quaggaFindRoutes(raw):
343 343
                         d["network"] = lastIP
344 344
 
345 345
                     # "parse" path (everything after 61 chars, but no i)
346
-                    path = filter(lambda _x: _x not in ('', 'i'), line[61:].split(" "))
346
+                    path = list(filter(lambda _x: _x not in ('', 'i'), line[61:].split(" ")))
347 347
 
348 348
                     # currently skip incomplete routes
349 349
                     if '?' not in path:

+ 1
- 1
backend/crawler.py View File

@@ -199,7 +199,7 @@ def convert_crawl(crawl):
199 199
             if path:
200 200
                 net.nodes[path[-1]]['prefixes'].add(prefix)
201 201
                 for path_asn in path:
202
-                    if path_asn not in (path[-1], path[0]):
202
+                    if path_asn in net.nodes and path_asn not in (path[-1], path[0]):
203 203
                         net.nodes[path_asn]['stub'] = False
204 204
 
205 205
     # add neighbor count

+ 11
- 2
bgpdata/templates/bgpdata/new_new_map.html View File

@@ -180,13 +180,22 @@ d3.json("/api/v2/crawlrun/" + elem + "/?with_graph").then((data) => {
180 180
         .attr("rx", d => d.stub ? 34 : (40 + (d.neighbors > 5 ? 5 : 0)))
181 181
         .attr("ry", d => d.stub ? 12 : (20 + (d.neighbors > 5 ? 2 : 0)))
182 182
         .attr("fill", function(d) {
183
+            //if(d.directly_crawled)
184
+            //    return "#94FF70";
185
+            //else if(!d.online)
186
+            //    return "#FFCCCC";
187
+            //else if(d.stub)
188
+            //    return "#3291A8"
189
+            //else
190
+            //    return "#D1FFC2";
183 191
             if(d.directly_crawled)
192
+				//return "#55bc32";
184 193
                 return "#94FF70";
185 194
             else if(!d.online)
186 195
                 return "#FFCCCC";
187
-                // return "#F0FFEB";
188 196
             else if(d.stub)
189
-                return "#3291A8"
197
+                //return "#94FF70";
198
+                return "#E1FFE2";
190 199
             else
191 200
                 return "#D1FFC2";
192 201
         })

+ 1
- 0
requirements.txt View File

@@ -4,3 +4,4 @@ django-rest-framework
4 4
 django-filter
5 5
 networkx
6 6
 grpcio
7
+protobuf

Loading…
Cancel
Save