summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorDmitriyEshenko <snooppy@mail.ua>2019-08-23 22:00:57 +0000
committerDmitriyEshenko <snooppy@mail.ua>2019-08-23 22:00:57 +0000
commit84957a3418db23716b9e80f38733ed5e0bd4252e (patch)
tree2c30e32e15c049703c120b69ee9495700efa3624 /src/conf_mode
parent87be8bbd814f2e387c3b60fbd3f44e55a21b2bce (diff)
downloadvyos-1x-84957a3418db23716b9e80f38733ed5e0bd4252e.tar.gz
vyos-1x-84957a3418db23716b9e80f38733ed5e0bd4252e.zip
[dummy] T1609 migrate to vyos.interfaceconfig, adding check ip-cidr, adding vyos.interfaceconfig common ipv4/ipv6 functions
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interface-dummy.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/conf_mode/interface-dummy.py b/src/conf_mode/interface-dummy.py
index 8c939ce95..c7c5ac99c 100755
--- a/src/conf_mode/interface-dummy.py
+++ b/src/conf_mode/interface-dummy.py
@@ -20,8 +20,6 @@ import os
import sys
import copy
-import vyos.configinterface as VyIfconfig
-
from vyos.interfaceconfig import Interface
from vyos.config import Config
from vyos import ConfigError
@@ -86,20 +84,23 @@ def generate(dummy):
def apply(dummy):
# Remove dummy interface
if dummy['deleted']:
- VyIfconfig.remove_interface(dummy['intf'])
+ Interface(dummy['intf']).remove_interface()
else:
# Interface will only be added if it yet does not exist
- VyIfconfig.add_interface('dummy', dummy['intf'])
+ Interface(dummy['intf'], 'dummy')
# update interface description used e.g. within SNMP
- VyIfconfig.set_description(dummy['intf'], dummy['description'])
+ if dummy['description']:
+ Interface(dummy['intf']).ifalias = dummy['description']
# Configure interface address(es)
- for addr in dummy['address_remove']:
- VyIfconfig.remove_interface_address(dummy['intf'], addr)
+ if len(dummy['address_remove']) > 0:
+ Interface(dummy['intf']).del_addr(dummy['address_remove'])
- for addr in dummy['address']:
- VyIfconfig.add_interface_address(dummy['intf'], addr)
+ if len(dummy['address']) > 0:
+ # delete already existing addreses from list
+ addresess = diff(dummy['address'], Interface(dummy['intf']).get_addr(1))
+ Interface(dummy['intf']).add_addr(addresess)
if dummy['disable']:
Interface(dummy['intf']).linkstate = 'down'