Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exabgpcli with multiple configuration files with different named pipes #1214

Open
JamesTuMarines opened this issue Jun 22, 2024 · 6 comments
Assignees

Comments

@JamesTuMarines
Copy link

JamesTuMarines commented Jun 22, 2024

Hi Team,

I run exabgp with two different configuration files but both configuration files use different named pipes.

When I run the command "exabgpcli show neighbor summary" to see the status of all the neighbors, it randomly sends the command to different pipes so I can only get half of the result I want.

Is there a way that I can control which pipe that exabgpcli sends to?

Thank you.

Exabgp Version

[root@localhost ~]# exabgpcli version
exabgp 4.2.21

PIPE Files created like this

/bin/bash -c "/usr/bin/mkfifo -m 0777 /var/run/exabgp_clean.cmd"
/bin/bash -c "/usr/bin/mkfifo -m 0777 /var/run/exabgp_clean.{in,out}"
/bin/bash -c "/usr/bin/mkfifo -m 0777 /var/run/exabgp_rtbh.cmd"
/bin/bash -c "/usr/bin/mkfifo -m 0777 /var/run/exabgp_rtbh.{in,out}"

Configuration File 1
exabgp_clean.conf

process announce-routes {
run /usr/bin/socat stdout pipe:/var/run/exabgp_clean.cmd;
encoder json;
}

template {
    neighbor clean {
        router-id 172.31.250.119;  
        local-as 65000;   # local AS number
        peer-as 65000;   # remote AS number
        group-updates false;
        family {
                ipv4 flow;
                ipv4 unicast;
        }               # 啟用的AFI
        api {
                processes [ announce-routes ];
        }
    }
}

neighbor 172.31.250.118{
        local-address 172.31.250.119;
        inherit clean;
}

Configuration File 2
exabgp_rtbh.conf

process announce-routes {
run /usr/bin/socat stdout pipe:/var/run/exabgp_rtbh.cmd;
encoder json;
}

template {
    neighbor rtbh {
        router-id 172.31.250.143;   
        local-as 65000;   # local AS number
        peer-as 65000;   # remote AS number
        group-updates false;
        family {
                ipv4 flow;
                ipv4 unicast;
        }               # 啟用的AFI
        api {
                processes [ announce-routes ];
        }
    }
}

neighbor 172.31.250.142{
        local-address 172.31.250.143;
        inherit rtbh;
}```
@JamesTuMarines JamesTuMarines changed the title Exabgpcli with multiple configuration file with different named pipe Exabgpcli with multiple configuration files with different named pipes Jun 22, 2024
@thomas-mangin
Copy link
Member

The PIPE location can be controlled by env name if I recall how I did it correctly (and if it does not now it could). This name could be passed via another env variable and changed by the forking version of ExaBGP. This would be a feature and is not available ATM.

@JamesTuMarines
Copy link
Author

JamesTuMarines commented Jun 24, 2024

Hi @thomas-mangin,

Thank you for the hint.
I created two env files and set the different exabgp.api.pipename for two configuration files.

cat exabgp_rtbh.env
[exabgp.api]
pipename = 'exabgp_rtbh'
cat exabgp_clean.env
[exabgp.api]
pipename = 'exabgp_clean'

Run exabgp like this.

exabgp -e /root/exabgp_rtbh.env /root/exabgp_rtbh.conf
exabgp -e /root/exabgp_clean.env /root/exabgp_clean.conf

Run the API like this.
I wrote a script to run the command about 500 times and no random output anymore.
I think the problem is solved now.

env exabgp.api.pipename=exabgp_rtbh exabgpcli show neighbor summary
env exabgp.api.pipename=exabgp_clean exabgpcli show neighbor summary

However, if I tried to run exabgpcli with --env and it shows timeout.
Did I run the API in the wrong way?

exabgpcli --env exabgp_rtbh.env show nei sum
command: show neighbor summary
could not send command to ExaBGP (command timeout)

Thank you.

@thomas-mangin
Copy link
Member

What I suggested requires code change. What you suggested should have worked for me. Please use ./sbin/exabgp env -d to check if the settings are correctly loaded.

@JamesTuMarines
Copy link
Author

Hi @thomas-mangin

I tried the command and it shows this.

09:56:26 | 5783 | configuration | one of the arguments passed as configuration is not a file (env)

Is what I should expect?

Thank you.

@thomas-mangin
Copy link
Member

The command I gave you is for master, for 4.2, it may be -di - and no need for env ?

@JamesTuMarines
Copy link
Author

Oh, I see I understand what you mean.

The output is like this.

[root@localhost ~]# exabgp --di --env /root/exabgp_clean.env

[exabgp.api]
pipename = 'exabgp_clean'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants