Exa Api

442 views
Skip to first unread message

Scap

unread,
May 25, 2015, 3:59:43 AM5/25/15
to exabgp...@googlegroups.com
I setup Exabgp and it's work with static route without any problem.

I need to use API for send remote route records to exabgp. I searched whole net about a simple documentation about this but I don't find any simple example about how I send request to exabgp api

from exabgp.conf :

process parsed-route-backend {
parse-routes;
peer-updates;
run /home/injector/go/bin/bgpapi;
}

When I try access from web I can see api page from http://10.4.4.9:8080

I use a PHP code to send simple command but it doesn't work

$postData = array(
'neighbor' =>
array('ip' => '10.4.4.3','state' => 'Down','reason' => ''),
);

$ch = curl_init('http://10.4.4.9:8080/api/');
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_POSTFIELDS => json_encode($postData)
));

Do you help me about a simple example for sending a route to exabgp

Thomas Mangin

unread,
May 26, 2015, 3:13:47 AM5/26/15
to exabgp...@googlegroups.com, dag...@uzgur.net
Hello Scap, 

You will find many examples in the ./qa folder ( please note that the 
syntax in master has changed ) 
   https://github.com/Exa-Networks/exabgp/tree/3.4/qa/conf 
   https://github.com/Exa-Networks/exabgp/tree/3.4/qa/self 

You may also want to to have a look at the healthcheck.py program by 
Vicent Bernat included in ExaBGP. 
  http://vincent.bernat.im/en/blog/2013-exabgp-highavailability.html 

For information, the example below use an old syntax, parse-routes an 
peer-updates are deprecated options. 

        process name-for-this-section { 
                receive { 
                        parsed; 
                        update; 
                } 
                encoder json; 
                run “./my-program.py"; 
        } 

Hopefully this is what you are looking for. And I am terrible at 
documentation, I will invite you to update the wiki if you can :-) 

Thomas 

Scap

unread,
May 26, 2015, 10:24:57 AM5/26/15
to exabgp...@googlegroups.com
I started to write my own with PHP but I need little help about 

app.php
----------------
#!/usr/bin/env php
<?php
sleep(2);
echo"announce route 10.1.1.3/32 next-hop 10.0.0.2\n";

sleep(100000);

exabgp.conf
--------------------
process injector-api {
       run /home/injector/app.php
       }


I'm getting error 

Tue, 26 May 2015 14:09:59 | ERROR    | 19744  | configuration | Problem with the configuration file, no change done
Tue, 26 May 2015 14:09:59 | ERROR    | 19744  | configuration | 
Tue, 26 May 2015 14:09:59 | ERROR    | 19744  | configuration | syntax error in section process
Tue, 26 May 2015 14:09:59 | ERROR    | 19744  | configuration | line 15 : run /home/injector/app.ph p
Tue, 26 May 2015 14:09:59 | ERROR    | 19744  | configuration | 
Tue, 26 May 2015 14:09:59 | ERROR    | 19744  | configuration | 

Thomas Mangin

unread,
May 27, 2015, 8:55:57 AM5/27/15
to exabgp...@googlegroups.com, dag...@uzgur.net
run /home/injector/app.php;

add a semi-colon.

Thomas
Reply all
Reply to author
Forward
0 new messages