support config network in openwrt mgmt_driver

Support config network in openwrt mgmt_driver, and add a sample

Change-Id: Iac71e40711ede3d3c48dca09a5f6b1cdd7824699
Closes-Bug: #1687972
This commit is contained in:
Yan Xing'an 2017-05-05 06:59:52 -07:00
parent f01d81e047
commit 3b1bcfa2d5
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,46 @@
vdus:
VDU1:
config:
network: |
package network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'mgmt_net'
option ifname 'eth0'
option proto 'dhcp'
config interface 'net1'
option ifname 'eth1'
option proto 'dhcp'
config interface 'net2'
option ifname 'eth2'
option proto 'dhcp'
firewall: |
package firewall
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
config zone
option name 'mgmt_net'
option network 'mgmt_net'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'lan'
list network 'net1 net2'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'

View File

@ -86,7 +86,7 @@ class DeviceMgmtOpenWRT(abstract_driver.DeviceMGMTAbstractDriver):
for vdu, vdu_dict in vdus_config_dict.items():
config = vdu_dict.get('config', {})
for key, conf_value in config.items():
KNOWN_SERVICES = ('firewall', )
KNOWN_SERVICES = ('firewall', 'network')
if key not in KNOWN_SERVICES:
continue
mgmt_ip_address = mgmt_url.get(vdu, '')