| 315 | self.sat_number, path, self.GS_lat_long) |
| 316 | |
| 317 | def compute_conf(self, sat_node_number, interval, num1, num2, ID, Q, |
| 318 | num_backbone, matrix): |
| 319 | Q.append( |
| 320 | "log \"/var/log/bird.log\" { debug, trace, info, remote, warning, error, auth, fatal, bug };" |
| 321 | ) |
| 322 | Q.append("debug protocols all;") |
| 323 | Q.append("protocol device {") |
| 324 | Q.append("}") |
| 325 | Q.append(" protocol direct {") |
| 326 | Q.append(" disabled; # Disable by default") |
| 327 | Q.append(" ipv4; # Connect to default IPv4 table") |
| 328 | Q.append(" ipv6; # ... and to default IPv6 table") |
| 329 | Q.append("}") |
| 330 | Q.append("protocol kernel {") |
| 331 | Q.append(" ipv4 { # Connect protocol to IPv4 table by channel") |
| 332 | Q.append( |
| 333 | " export all; # Export to protocol. default is export none") |
| 334 | Q.append(" };") |
| 335 | Q.append("}") |
| 336 | # Q.append("protocol kernel {") |
| 337 | # Q.append(" ipv6 { export all; ") |
| 338 | # Q.append(" };") |
| 339 | # Q.append("}") |
| 340 | Q.append("protocol static {") |
| 341 | Q.append(" ipv4; # Again, IPv6 channel with default options") |
| 342 | Q.append("}") |
| 343 | Q.append("protocol ospf{") |
| 344 | Q.append(" ipv4 {") |
| 345 | Q.append(" import all;") |
| 346 | Q.append(" };") |
| 347 | Q.append(" area 0 {") |
| 348 | Q.append(" interface \"B%d-eth0\" {" % ID) |
| 349 | Q.append(" type broadcast; # Detected by default") |
| 350 | Q.append(" cost 256;") |
| 351 | Q.append(" hello " + str(interval) + |
| 352 | "; # Default hello perid 10 is too long") |
| 353 | Q.append(" };") |
| 354 | Q.append(" interface \"inter_machine\" {") |
| 355 | Q.append(" type broadcast; # Detected by default") |
| 356 | Q.append(" cost 256;") |
| 357 | Q.append(" hello " + str(interval) + |
| 358 | "; # Default hello perid 10 is too long") |
| 359 | Q.append(" };") |
| 360 | if num1 <= sat_node_number and num2 <= num_backbone and ID <= sat_node_number: # satellite |
| 361 | for peer in range(num1, num2 + 1): |
| 362 | if (peer == ID) or (int(float(matrix[ID - 1][peer - 1])) == 0): |
| 363 | continue |
| 364 | Q.append(" interface \"B%d-eth%d\" {" % (ID, peer)) |
| 365 | Q.append(" type broadcast; # Detected by default") |
| 366 | Q.append(" cost 256;") |
| 367 | Q.append(" hello " + str(interval) + |
| 368 | "; # Default hello perid 10 is too long") |
| 369 | Q.append(" };") |
| 370 | if num2 > sat_node_number: |
| 371 | for i in range(sat_node_number + 1, |
| 372 | num_backbone + 1): # each ground station |
| 373 | Q.append(" interface \"B%d-eth%d\" {" % (ID, i)) |
| 374 | Q.append(" type broadcast; # Detected by default") |