summaryrefslogtreecommitdiff
path: root/src/conf_mode/interface-bridge.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-24 22:09:07 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-24 22:09:07 +0200
commitc24eb48c54b562fe7f78cdda82f2e245e9ab8506 (patch)
treee51f4d72af89d7918ba5cd2adca01f4b4e5040b8 /src/conf_mode/interface-bridge.py
parent6b828200e698dbff5a3ee61a0c6c9906b0a8493f (diff)
parent0588f5409f57a8d8577bc9bd23c393487fd2987b (diff)
downloadvyos-1x-c24eb48c54b562fe7f78cdda82f2e245e9ab8506.tar.gz
vyos-1x-c24eb48c54b562fe7f78cdda82f2e245e9ab8506.zip
Merge branch 'ifconfig-api-change' of github.com:c-po/vyos-1x into current
* 'ifconfig-api-change' of github.com:c-po/vyos-1x: (26 commits) Python/ifconfig: T1557: add STPIf class (spanning tree) bridge member Python/ifconfig: T1557: bugfix removing Q-in-Q VLAN interfaces openvpn: T1548: setup interface alias Python/ifconfig: T1557: refactor BondIf 'mode' property to set_mode() Python/ifconfig: T1557: refactor BondIf 'arp_interval' property to set_arp_interval() Python/ifconfig: T1557: refactor BondIf 'arp_ip_target' property to set_arp_ip_target()/get_arp_ip_target() Python/ifconfig: T1557: refactor BondIf 'arp_interval' property to set_arp_interval() Python/ifconfig: T1557: refactor BondIf 'xmit_hash_policy' property to set_hash_policy() Python/ifconfig: T1557: remove unused has_autoneg() from EthernetIf Python/ifconfig: T1557: refactor Interface 'state' property to set_state()/get_state() Python/ifconfig: T1557: refactor Interface 'arp_cache_tmo' property to set_set_arp_cache_tmo() Python/ifconfig: T1557: refactor Interface 'proxy_arp_pvlan' property to set_proxy_arp_pvlan() Python/ifconfig: T1557: refactor Interface 'proxy_arp' property to set_proxy_arp() Python/ifconfig: T1557: loopback: implement derived remove() Python/ifconfig: T1557: refactor Interface 'ifalias' property to set_alias() Python/ifconfig: T1557: refactor Interface 'link_detect' property to set_link_detect() Python/ifconfig: T1557: refactor BridgeIf 'stp_state' property to set_stp() Python/ifconfig: T1557: refactor BridgeIf 'priority' property to set_priority() Python/ifconfig: T1557: refactor BridgeIf 'ageing_time' property to set_ageing_time() Python/ifconfig: T1557: refactor BridgeIf 'hello_time' property to set_hello_time() ...
Diffstat (limited to 'src/conf_mode/interface-bridge.py')
-rwxr-xr-xsrc/conf_mode/interface-bridge.py41
1 files changed, 19 insertions, 22 deletions
diff --git a/src/conf_mode/interface-bridge.py b/src/conf_mode/interface-bridge.py
index 62589c798..37b5c4979 100755
--- a/src/conf_mode/interface-bridge.py
+++ b/src/conf_mode/interface-bridge.py
@@ -13,8 +13,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#
import os
@@ -22,7 +20,7 @@ from copy import deepcopy
from sys import exit
from netifaces import interfaces
-from vyos.ifconfig import BridgeIf, Interface
+from vyos.ifconfig import BridgeIf, STPIf
from vyos.configdict import list_diff
from vyos.config import Config
from vyos import ConfigError
@@ -187,27 +185,27 @@ def apply(bridge):
br.remove()
else:
# enable interface
- br.state = 'up'
+ br.set_state('up')
# set ageing time
- br.ageing_time = bridge['aging']
+ br.set_ageing_time(bridge['aging'])
# set bridge forward delay
- br.forward_delay = bridge['forwarding_delay']
+ br.set_forward_delay(bridge['forwarding_delay'])
# set hello time
- br.hello_time = bridge['hello_time']
+ br.set_hello_time(bridge['hello_time'])
# set max message age
- br.max_age = bridge['max_age']
+ br.set_max_age(bridge['max_age'])
# set bridge priority
- br.priority = bridge['priority']
+ br.set_priority(bridge['priority'])
# turn stp on/off
- br.stp_state = bridge['stp']
+ br.set_stp(bridge['stp'])
# enable or disable IGMP querier
- br.multicast_querier = bridge['igmp_querier']
+ br.set_multicast_querier(bridge['igmp_querier'])
# update interface description used e.g. within SNMP
- br.ifalias = bridge['description']
+ br.set_alias(bridge['description'])
# Change interface MAC address
if bridge['mac']:
- br.mac = bridge['mac']
+ br.set_mac(bridge['mac'])
# remove interface from bridge
for intf in bridge['member_remove']:
@@ -219,7 +217,7 @@ def apply(bridge):
# up/down interface
if bridge['disable']:
- br.state = 'down'
+ br.set_state('down')
# Configure interface address(es)
# - not longer required addresses get removed first
@@ -231,16 +229,15 @@ def apply(bridge):
# configure additional bridge member options
for member in bridge['member']:
- # set bridge port cost
- br.set_cost(member['name'], member['cost'])
- # set bridge port priority
- br.set_priority(member['name'], member['priority'])
-
- i = Interface(member['name'])
+ i = STPIf(member['name'])
# configure ARP cache timeout
- i.arp_cache_tmo = bridge['arp_cache_tmo']
+ i.set_arp_cache_tmo(bridge['arp_cache_tmo'])
# ignore link state changes
- i.link_detect = bridge['disable_link_detect']
+ i.set_link_detect(bridge['disable_link_detect'])
+ # set bridge port path cost
+ i.set_path_cost(member['cost'])
+ # set bridge port path priority
+ i.set_path_priority(member['priority'])
return None