Coder Social home page Coder Social logo

Comments (5)

danielseide avatar danielseide commented on June 3, 2024

I just found https://github.com/YoshiyukiYamauchi/mrtparse/wiki/%5BExaBGP%5D-How-to-send-the-routes-using-the-API and https://github.com/YoshiyukiYamauchi/mrtparse/wiki/%5BExaBGP%5D-How-to-reduce-parsing-by-grouping-updates-with-the-same-attributes. Maybe therefore it's necessary that it doesn't finish.

By the way:
Your approach doesn't scale for multiple calls with huge amounts of prefixes (600k for example). At each call mrtparse has to parse 600k routes again (with python[not pypy] over one hour). Then better parse the routes once to a text file and copy it to the messages section of a python script like this:

#!/usr/bin/env python

import sys
import time

messages = [
'announce route 100.10.0.0/24 next-hop 192.168.0.27',
'announce route 200.20.0.0/24 next-hop 192.168.0.27'
]

time.sleep(2)

while messages:
    message = messages.pop(0)
    sys.stdout.write( message + '\n')
    sys.stdout.flush()
    time.sleep(1)

#Loop endlessly to allow ExaBGP to continue running
while True:
    time.sleep(1)

sys.stdin.readline()

this script could be imported in the config as usual:

...
process route_inject {
    run ./route_inject.run;
    encoder json;
}
...

from mrtparse.

danielseide avatar danielseide commented on June 3, 2024

responsible part of mrt2exabgp.py:

    if flags & FLAG_T['API']:
        while True:
            time.sleep(1)

from mrtparse.

t2mune avatar t2mune commented on June 3, 2024

Maybe therefore it's necessary that it doesn't finish.

it's necessary as you wrote. Without a loop, it would continues processing.

Then better parse the routes once to a text file and copy it to the messages section of a python script like this:

That's right. I will add a support for both ways.

from mrtparse.

t2mune avatar t2mune commented on June 3, 2024

I added "-P" option to output ExaBGP API program😄

pypy mrt2exabgp.py -P -G latest-bview.gz > route_inject.run

And use the generated script as API program in the config.

group route_inject {
    neighbor 192.168.1.101 {
        router-id 127.0.0.2;
        local-address 127.0.0.2;
        local-as 64512;
        peer-as 65000;
        graceful-restart;

        process mrtparse {
            run /usr/bin/pypy ./route_inject.run;
        }
    }   
}

from mrtparse.

danielseide avatar danielseide commented on June 3, 2024

perfect :)

from mrtparse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.