+++ /dev/null
-# The software in this package is distributed under the GNU General
-# Public License version 2 (with a special exception described below).
-#
-# A copy of GNU General Public License (GPL) is included in this distribution,
-# in the file COPYING.GPL.
-#
-# As a special exception, if other files instantiate templates or use macros
-# or inline functions from this file, or you compile this file and link it
-# with other works to produce a work based on this file, this file
-# does not by itself cause the resulting work to be covered
-# by the GNU General Public License.
-#
-# However the source code for this file must still be made available
-# in accordance with section (3) of the GNU General Public License.
-#
-# This exception does not invalidate any other reasons why a work based
-# on this file might be covered by the GNU General Public License.
-#
-# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
-
-from .build_cnfvar import BuildCnfVar
-"""Class to create user cnfvar objects on the fly"""
-
-
-class BuildNIC(BuildCnfVar):
-
- def __init__(self, data='', instance=0, line_no=1):
- BuildCnfVar.__init__(self, 'NIC', instance, '', line_no)
-
- # the bare defaults the UI adds upon
- # creation of new groups
- defaults = {
- 'NIC_COMMENT': data,
- 'NIC_DRIVER': 'virtio_net',
- 'NIC_LAN_DNS_RELAYING_ALLOWED': "0",
- 'NIC_LAN_EMAIL_RELAYING_ALLOWED': "0",
- 'NIC_LAN_FIREWALL_RULESET_REF': "1",
- 'NIC_LAN_IP': "192.168.1.1",
- 'NIC_LAN_NAT_INTO': "0",
- 'NIC_LAN_NETMASK': "255.255.255.0",
- 'NIC_LAN_PROXY_PROFILE_REF': "-1",
- 'NIC_MAC': '02:00:00:00:20:00',
- 'NIC_TYPE': 'DSLROUTER',
- }
-
- self.add_defaults(defaults)
-
- def comment(self, comment):
- self.update_cnf('NIC_COMMENT', 0, comment)
- return self
-
- def nic_type(self, nic_type):
- self.update_cnf('NIC_TYPE', 0, nic_type)
- return self
-
- def lan_ip(self, lan_ip):
- self.update_cnf('NIC_LAN_IP', 0, lan_ip)
- return self
-
- def add_group_member_ref(self, group_ref):
- self.add_cnf('USER_GROUP_MEMBER_REF', -1, group_ref)
- return self