diff options
author | hagbard <vyosdev@derith.de> | 2019-07-08 12:15:09 -0700 |
---|---|---|
committer | hagbard <vyosdev@derith.de> | 2019-07-08 12:45:06 -0700 |
commit | 14b4fa607f37b051957abc9cbe01014a610adc81 (patch) | |
tree | 55574fd39c9f41a3d053f2e0228b92fe70e7f7cd | |
parent | 209163351c8bbd25050a6541070aa94aaff3ce08 (diff) | |
download | vyos-1x-14b4fa607f37b051957abc9cbe01014a610adc81.tar.gz vyos-1x-14b4fa607f37b051957abc9cbe01014a610adc81.zip |
[IPoE] - T1510: vlan-mon option implementation
-rw-r--r-- | interface-definitions/ipoe-server.xml | 19 | ||||
-rwxr-xr-x | src/conf_mode/ipoe_server.py | 16 |
2 files changed, 33 insertions, 2 deletions
diff --git a/interface-definitions/ipoe-server.xml b/interface-definitions/ipoe-server.xml index 46ac2357a..6c93d3699 100644 --- a/interface-definitions/ipoe-server.xml +++ b/interface-definitions/ipoe-server.xml @@ -90,6 +90,25 @@ </leafNode> </children> </node> + <leafNode name="vlan-id"> + <properties> + <help>VLAN monitor for the automatic creation of vlans (user per vlan)</help> + <constraint> + <validator name="numeric" argument="--range 1-4096"/> + </constraint> + <constraintErrorMessage>VLAN ID needs to be between 1 and 4096</constraintErrorMessage> + <multi /> + </properties> + </leafNode> + <leafNode name="vlan-range"> + <properties> + <help>VLAN monitor for the automatic creation of vlans (user per vlan)</help> + <constraint> + <regex>(409[0-6]|40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{0,2})-(409[0-6]|40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{0,2})</regex> + </constraint> + <multi /> + </properties> + </leafNode> </children> </tagNode> <node name="dns-server"> diff --git a/src/conf_mode/ipoe_server.py b/src/conf_mode/ipoe_server.py index 45c64c617..ca6b423e5 100755 --- a/src/conf_mode/ipoe_server.py +++ b/src/conf_mode/ipoe_server.py @@ -81,6 +81,13 @@ username=ifname password=csid {% endif %} +{%- for intfc in interfaces %} +{% if (interfaces[intfc]['shared'] == '0') and (interfaces[intfc]['vlan_mon']) %} +vlan_mon={{interfaces[intfc]['vlan_mon']|join(',')}} +interface=re:{{intfc}}\.(409[0-6]|40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{0,2}) +{% endif %} +{% endfor %} + {% if (dns['server1']) or (dns['server2']) %} [dns] {% if dns['server1'] %} @@ -230,7 +237,8 @@ def get_config(): 'shared' : '1', 'sess_start' : 'dhcpv4', ### may need a conifg option, can be dhcpv4 or up for unclassified pkts 'range' : None, - 'ifcfg' : '1' + 'ifcfg' : '1', + 'vlan_mon' : [] } config_data['dns'] = { 'server1' : None, @@ -258,6 +266,10 @@ def get_config(): config_data['interfaces'][intfc]['mode'] = c.return_value('interface ' + intfc + ' network-mode') if c.return_value('interface ' + intfc + ' network') == 'vlan': config_data['interfaces'][intfc]['shared'] = '0' + if c.exists('interface ' + intfc + ' vlan-id'): + config_data['interfaces'][intfc]['vlan_mon'] += c.return_values('interface ' + intfc + ' vlan-id') + if c.exists('interface ' + intfc + ' vlan-range'): + config_data['interfaces'][intfc]['vlan_mon'] += c.return_values('interface ' + intfc + ' vlan-range') if c.exists('interface ' + intfc + ' client-subnet'): config_data['interfaces'][intfc]['range'] = c.return_value('interface ' + intfc + ' client-subnet') if c.exists('dns-server server-1'): @@ -321,7 +333,7 @@ def get_config(): config_data['ipv6']['prfx'] = c.return_values('client-ipv6-pool prefix') if c.exists('client-ipv6-pool delegate-prefix'): config_data['ipv6']['pd'] = c.return_values('client-ipv6-pool delegate-prefix') - + return config_data def generate(c): |