diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-02-23 19:18:40 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-02-23 19:18:40 +0100 |
commit | 54b9b8f80ce1a16362c4ef6e89efc70ef29ae59e (patch) | |
tree | 83511b4bc6c4d143ca1084b23a8867cf64f0778b | |
parent | f4e60d02df629f903fc677ad519fecc3f2e2b7be (diff) | |
download | vyos-1x-54b9b8f80ce1a16362c4ef6e89efc70ef29ae59e.tar.gz vyos-1x-54b9b8f80ce1a16362c4ef6e89efc70ef29ae59e.zip |
pppoe: T1318: set interface description
-rwxr-xr-x | src/conf_mode/interfaces-pppoe.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py index 245f5a4b0..cb09b6f29 100755 --- a/src/conf_mode/interfaces-pppoe.py +++ b/src/conf_mode/interfaces-pppoe.py @@ -20,8 +20,10 @@ from sys import exit from copy import deepcopy from jinja2 import Template from subprocess import Popen, PIPE +from time import sleep from vyos.config import Config +from vyos.ifconfig import Interface from vyos import ConfigError from netifaces import interfaces @@ -240,6 +242,24 @@ def apply(pppoe): cmd = 'systemctl start ppp@{}.service'.format(pppoe['intf']) subprocess_cmd(cmd) + # better late then sorry ... but we can only set interface alias after + # pppd has been launched and created the interface + cnt = 0 + while pppoe['intf'] not in interfaces(): + cnt += 1 + if cnt == 50: + break + + # sleep 250ms + sleep(0.250) + + try: + # we need to catch the exception if the interface is not up due to + # reason stated above + Interface(pppoe['intf']).set_alias(pppoe['description']) + except: + pass + return None if __name__ == '__main__': |