diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/configsession.py | 6 | ||||
| -rw-r--r-- | python/vyos/defaults.py | 1 | ||||
| -rw-r--r-- | python/vyos/ifconfig.py | 30 | 
3 files changed, 35 insertions, 2 deletions
diff --git a/python/vyos/configsession.py b/python/vyos/configsession.py index acbdd3d5f..09fae78a1 100644 --- a/python/vyos/configsession.py +++ b/python/vyos/configsession.py @@ -145,7 +145,8 @@ class ConfigSession(object):          self.__run_command([COMMENT] + path + value)      def commit(self): -        self.__run_command([COMMIT]) +        out = self.__run_command([COMMIT]) +        return out      def discard(self):          self.__run_command([DISCARD]) @@ -157,4 +158,5 @@ class ConfigSession(object):              return config_data      def load_config(self, file_path): -        self.__run_command(LOAD_CONFIG + [file_path]) +        out = self.__run_command(LOAD_CONFIG + [file_path]) +        return out diff --git a/python/vyos/defaults.py b/python/vyos/defaults.py index 85d27d60d..dedb929b4 100644 --- a/python/vyos/defaults.py +++ b/python/vyos/defaults.py @@ -20,6 +20,7 @@ directories = {    "config": "/opt/vyatta/etc/config",    "current": "/opt/vyatta/etc/config-migrate/current",    "migrate": "/opt/vyatta/etc/config-migrate/migrate", +  "log": "/var/log/vyatta",  }  cfg_group = 'vyattacfg' diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 0793fad39..750a7cc70 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -1057,6 +1057,36 @@ class BondIf(EthernetIf):      def __init__(self, ifname):          super().__init__(ifname, type='bond') +    def remove(self): +        """ +        Remove interface from operating system. Removing the interface +        deconfigures all assigned IP addresses and clear possible DHCP(v6) +        client processes. +        Example: +        >>> from vyos.ifconfig import Interface +        >>> i = Interface('eth0') +        >>> i.remove() +        """ +        # when a bond member gets deleted, all members are placed in A/D state +        # even when they are enabled inside CLI. This will make the config +        # and system look async. +        slave_list = [] +        for s in self.get_slaves(): +            slave = { +                'ifname' : s, +                'state': Interface(s).state +            } +            slave_list.append(slave) + +        # remove bond master which places members in disabled state +        super().remove() + +        # replicate previous interface state before bond destruction back to +        # physical interface +        for slave in slave_list: +             i = Interface(slave['ifname']) +             i.state = slave['state'] +      @property      def xmit_hash_policy(self):          """  | 
