From 14b4fa607f37b051957abc9cbe01014a610adc81 Mon Sep 17 00:00:00 2001 From: hagbard Date: Mon, 8 Jul 2019 12:15:09 -0700 Subject: [IPoE] - T1510: vlan-mon option implementation --- interface-definitions/ipoe-server.xml | 19 +++++++++++++++++++ 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 @@ + + + VLAN monitor for the automatic creation of vlans (user per vlan) + + + + VLAN ID needs to be between 1 and 4096 + + + + + + VLAN monitor for the automatic creation of vlans (user per vlan) + + (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}) + + + + 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): -- cgit v1.2.3