class Card(Gdtstruct): gdtstruct_properties([ ('ModuleName', Gdtstr, "Test doc string"), ('Type', Gdtstr, "Test doc string"), ('IoPort', Gdtstr, "Test doc string"), ('IoPort1', Gdtstr, "Test doc string"), ('IoPort2', Gdtstr, "Test doc string"), ('Options', Gdtstr, "Test doc string"), ('Mem', Gdtstr, "Test doc string"), ('IRQ', Gdtstr, "Test doc string"), ('DMA0', Gdtint, "Test doc string"), ('DMA1', Gdtint, "Test doc string"), ('ChannelProtocol', Gdtstr, "Test doc string"), ('Firmware', Gdtstr, "Test doc string"), ('DriverId', Gdtstr, "Test doc string"), ('VendorId', Gdtstr, "Test doc string"), ('DeviceId', Gdtstr, "Test doc string"), ]) def __init__(self): super(Card, self).__init__() self.ModuleName = None self.Type = None self.IoPort = None self.IoPort1 = None self.IoPort2 = None self.Mem = None self.IRQ = None self.DMA0 = None self.DMA1 = None self.ChannelProtocol = None self.Firmware = None self.DriverId = None self.VendorId = None self.DeviceId = None
class Wireless_base(Gdtstruct): gdtstruct_properties([ ('Mode', Gdtstr, "Test doc string"), ('EssId', Gdtstr, "Test doc string"), ('Channel', Gdtstr, "Test doc string"), ('Rate', Gdtstr, "Test doc string"), ('Key', Gdtstr, "Test doc string"), ])
class Device_base(Gdtstruct): gdtstruct_properties([ ('DeviceId', Gdtstr, "Test doc string"), ('NMControlled', Gdtbool, "Test doc string"), ('Device', Gdtstr, "Test doc string"), ('Alias', Gdtint, "Test doc string"), ('Type', Gdtstr, "Test doc string"), ('SubType', Gdtstr, "Test doc string"), ('OnBoot', Gdtbool, "Test doc string"), ('OnParent', Gdtbool, "Test doc string"), ('AllowUser', Gdtbool, "Test doc string"), ('BootProto', Gdtstr, "Test doc string"), ('IP', Gdtstr, "Test doc string"), ('Netmask', Gdtstr, "Test doc string"), ('Gateway', Gdtstr, "Test doc string"), ('IPv6Init', Gdtbool, "Test doc string"), ('Hostname', Gdtstr, "Test doc string"), ('Domain', Gdtstr, "Test doc string"), ('AutoDNS', Gdtbool, "Test doc string"), ('HardwareAddress', Gdtstr, "Test doc string"), ('Mtu', Gdtint, "Test doc string"), ('Slave', Gdtbool, "Test doc string"), ('StaticRoutes', StaticRoutes, "test"), ('PrimaryDNS', Gdtstr, "Test doc string"), ('SecondaryDNS', Gdtstr, "Test doc string"), ]) def __init__(self): super(Device_base, self).__init__() self.DeviceId = None self.NMControlled = None self.Device = None self.Alias = None self.Type = None self.SubType = None self.OnBoot = None self.OnParent = None self.AllowUser = None self.BootProto = None self.IP = None self.Netmask = None self.Gateway = None self.IPv6Init = None self.Hostname = None self.Domain = None self.AutoDNS = None self.HardwareAddress = None self.Mtu = None self.Slave = None self.StaticRoutes = None self.PrimaryDNS = None self.SecondaryDNS = None def createStaticRoutes(self): if not self.StaticRoutes: self.StaticRoutes = StaticRoutes() return self.StaticRoutes
class DevADSL(Device): gdtstruct_properties([ ('Dialup', DslDialup, "Test doc string"), ]) def __init__(self): super(DevADSL, self).__init__() self.Type = DSL self.Dialup = DslDialup() self.setunmodified() def load(self, name): super(DevADSL, self).load(name) conf = ConfDevice(name) self.Dialup.load(conf, self) def save(self): super(DevADSL, self).save() conf = ConfDevice(self.DeviceId) self.Dialup.save(conf, self.DeviceId, self.oldname) conf.write() def createDialup(self): if (self.Dialup == None) \ or not isinstance(self.Dialup, DslDialup): self.Dialup = DslDialup() return self.Dialup def getDialog(self): if not _devADSLDialog: return None dialog = _devADSLDialog(self) if hasattr(dialog, "xml"): return dialog.xml.get_widget("Dialog") return dialog def getWizard(self): return _devADSLWizard def isType(self, device): if device.Type == DSL: return True if getDeviceType(device.Device) == DSL: return True return False def getHWDevice(self): if self.Dialup: return self.Dialup.EthDevice return None
class Route_base(Gdtstruct): gdtstruct_properties([ ('Address', Gdtstr, "Test doc string"), ('Netmask', Gdtstr, "Test doc string"), ('Gateway', Gdtstr, "Test doc string"), ('GatewayDevice', Gdtstr, "Test doc string"), ]) def __init__(self): super(Route_base, self).__init__() self.Address = None self.Netmask = None self.Gateway = None self.GatewayDevice = None
class HwModem(Hardware): gdtstruct_properties([ ('Modem', Modem, "Test doc string"), ]) def __init__(self): super(HwModem, self).__init__() self.Modem = Modem() self.Type = MODEM def createModem(self): return self.Modem def getDialog(self): if _hwModemDialog == None: return None return _hwModemDialog(self).xml.get_widget("Dialog") def getWizard(self): return _hwModemWizard def isType(self, hardware): if hardware.Type == MODEM: return True if getHardwareType(hardware.Hardware) == MODEM: return True return False def save(self, *args, **kwargs): # pylint: disable-msg=W0613 from netconfpkg.NCHardwareList import getMyWvDial wvdial = getMyWvDial(create_if_missing=True) wvdial[self.Name]['Modem'] = self.Modem.DeviceName if self.Modem.BaudRate: wvdial[self.Name]['Baud'] = str(self.Modem.BaudRate) if not self.Modem.ModemVolume: self.Modem.ModemVolume = 0 wvdial[self.Name]['SetVolume'] = str(self.Modem.ModemVolume) if self.Modem.DialCommand: wvdial[self.Name]['Dial Command'] = str(self.Modem.DialCommand) if not self.Modem.InitString: self.Modem.InitString = 'ATZ' wvdial[self.Name]['Init1'] = str(self.Modem.InitString) if self.Modem.ModemVolume == 0: wvdial[self.Name]['Init3'] = 'ATM0' else: wvdial[self.Name]['Init3'] = 'ATM1L' + str(self.Modem.ModemVolume) if self.Modem.FlowControl: wvdial[self.Name]['FlowControl'] = str(self.Modem.FlowControl)
class Host_base(Gdtstruct): gdtstruct_properties([ ('IP', Gdtstr, "Test doc string"), ('Hostname', Gdtstr, "Test doc string"), ('AliasList', AliasList, "Test doc string"), ]) def __init__(self): super(Host_base, self).__init__() self.IP = None self.Hostname = None self.AliasList = AliasList() def createAliasList(self): if not self.AliasList: self.AliasList = AliasList() return self.AliasList
class DevWireless(Device): gdtstruct_properties([ ('Wireless', Wireless, "Test doc string"), ]) def __init__(self): super(DevWireless, self).__init__() self.Type = WIRELESS self.Wireless = Wireless() def load(self, name): super(DevWireless, self).load(name) conf = ConfDevice(name) self.Wireless.load(conf, self.DeviceId) del conf def save(self): super(DevWireless, self).save() conf = ConfDevice(self.DeviceId) conf.fsf() self.Wireless.save(conf, self.DeviceId) conf.write() del conf def createWireless(self): return self.Wireless def getDialog(self): if not _devWirelessDialog: return None dialog = _devWirelessDialog(self) if hasattr(dialog, "xml"): return dialog.xml.get_widget("Dialog") return dialog def getWizard(self): return _devWirelessWizard def isType(self, device): if device.Type == WIRELESS: return True if getDeviceType(device.Device) == WIRELESS: return True return False
class Modem(Gdtstruct): gdtstruct_properties([ ('DeviceName', Gdtstr, "Test doc string"), ('BaudRate', Gdtint, "Test doc string"), ('FlowControl', Gdtstr, "Test doc string"), ('ModemVolume', Gdtint, "Test doc string"), ('DialCommand', Gdtstr, "Test doc string"), ('InitString', Gdtstr, "Test doc string"), ]) def __init__(self): super(Modem, self).__init__() self.DeviceName = None self.BaudRate = None self.FlowControl = None self.ModemVolume = None self.DialCommand = None self.InitString = None
class IPsec_base(Gdtstruct): gdtstruct_properties([ ('IPsecId', Gdtstr, "Test doc string"), ('Address', Gdtstr, "Test doc string"), ('ConnectionType', Gdtstr, "Test doc string"), ('EncryptionMode', Gdtstr, "Test doc string"), ('LocalNetwork', Gdtstr, "Test doc string"), ('LocalNetmask', Gdtstr, "Test doc string"), ('LocalGateway', Gdtstr, "Test doc string"), ('RemoteNetwork', Gdtstr, "Test doc string"), ('RemoteNetmask', Gdtstr, "Test doc string"), ('RemoteGateway', Gdtstr, "Test doc string"), ('RemoteIPAddress', Gdtstr, "Test doc string"), ('SPI_AH_IN', Gdtstr, "Test doc string"), ('SPI_AH_OUT', Gdtstr, "Test doc string"), ('SPI_ESP_IN', Gdtstr, "Test doc string"), ('SPI_ESP_OUT', Gdtstr, "Test doc string"), ('AHKey', Gdtstr, "Test doc string"), ('ESPKey', Gdtstr, "Test doc string"), ('IKEKey', Gdtstr, "Test doc string"), ('OnBoot', Gdtbool, "Test doc string"), ]) def __init__(self): super(IPsec_base, self).__init__() self.IPsecId = None self.Address = None self.ConnectionType = None self.EncryptionMode = None self.LocalNetwork = None self.LocalNetmask = None self.LocalGateway = None self.RemoteNetwork = None self.RemoteNetmask = None self.RemoteGateway = None self.RemoteIPAddress = None self.SPI_AH_IN = None self.SPI_AH_OUT = None self.SPI_ESP_IN = None self.SPI_ESP_OUT = None self.AHKey = None self.ESPKey = None self.IKEKey = None self.OnBoot = None
class DNS(Gdtstruct): "DNS setup of a profile" gdtstruct_properties([ ('Hostname', Gdtstr, "Test doc string"), ('Domainname', Gdtstr, "Test doc string"), ('PrimaryDNS', Gdtstr, "Test doc string"), ('SecondaryDNS', Gdtstr, "Test doc string"), ('TertiaryDNS', Gdtstr, "Test doc string"), ('SearchList', SearchList, "Test doc string"), ]) def __init__(self): super(DNS, self).__init__() self.Hostname = None self.Domainname = None self.PrimaryDNS = None self.SecondaryDNS = None self.TertiaryDNS = None self.SearchList = SearchList()
class Compression_base(Gdtstruct): "Compression structure" gdtstruct_properties([ ('VJTcpIp', Gdtbool, "Test doc string"), ('VJID', Gdtbool, "Test doc string"), ('AdressControl', Gdtbool, "Test doc string"), ('ProtoField', Gdtbool, "Test doc string"), ('BSD', Gdtbool, "Test doc string"), ('CCP', Gdtbool, "Test doc string"), ]) def __init__(self): super(Compression_base, self).__init__() self.VJTcpIp = None self.VJID = None self.AdressControl = None self.ProtoField = None self.BSD = None self.CCP = None
class Callback_base(Gdtstruct): "Callback structure" gdtstruct_properties([ ('Delay', Gdtint, 'VALUE="3"'), ('Hup', Gdtbool, "Test doc string"), ('Compression', Gdtbool, "Test doc string"), ('Type', Gdtstr, 'VALUE="on"'), ('MSN', Gdtstr, "Test doc string"), ]) def __init__(self): super(Callback_base, self).__init__() # self.Delay = 3 self.Delay = None self.Hup = None self.Compression = None # self.Type = "on" self.Type = None self.MSN = None
class Profile(Gdtstruct): "Profile for s-c-network" gdtstruct_properties([ ('ProfileName', Gdtstr, "Test doc string"), ('Active', Gdtbool, "Test doc string"), ('ActiveDevices', ActiveDevices, "Test doc string"), ('ActiveIPsecs', ActiveIPsecs, "Test doc string"), ('DNS', DNS, "Test doc string"), ('HostsList', HostsList, "Test doc string"), ]) def __init__(self): super(Profile, self).__init__() self.ProfileName = None self.Active = None self.DNS = DNS() self.ActiveDevices = ActiveDevices() self.ActiveIPsecs = ActiveIPsecs() self.HostsList = HostsList()
class Hardware_base(Gdtstruct): gdtstruct_properties([ ('Name', Gdtstr, "Test doc string"), ('Description', Gdtstr, "Test doc string"), ('Type ', Gdtstr, "Test doc string"), ('Status', Gdtstr, "Test doc string"), ('MacAddress', Gdtstr, "Test doc string"), ('Card', Card, "Test doc string"), ]) def __init__(self): super(Hardware_base, self).__init__() self.Name = None self.Description = None self.Type = None self.Card = None self.Status = HW_INACTIVE def createCard(self): if self.Card == None: self.Card = Card() return self.Card
class DevModem(Device): gdtstruct_properties([ ('Dialup', ModemDialup, "Test doc string"), ]) def __init__(self): super(DevModem, self).__init__() self.Type = MODEM self.Dialup = ModemDialup() def load(self, name): # pylint: disable-msg=W0613 """ load(devicename) load a modem definition """ conf = ConfDevice(name) Device.load(self, name) self.Dialup.load(conf, self) def save(self): super(DevModem, self).save() conf = ConfDevice(self.DeviceId) self.Dialup.save(conf, self.DeviceId, self.oldname) conf.write() def createDialup(self): """ create a ModemDialup instance for self.Dialup """ if (self.Dialup == None or (not isinstance(self.Dialup, ModemDialup))): self.Dialup = ModemDialup() return self.Dialup def getDialog(self): """ returns a gtk dialog """ dialog = _devModemDialog(self) if hasattr(dialog, "xml"): return dialog.xml.get_widget("Dialog") return dialog def getWizard(self): """ returns a gtk wizard """ return _devModemWizard def isType(self, device): """ check if device is of type MODEM """ if device.Type == MODEM: return True if getDeviceType(device.Device) == MODEM: return True return False def getHWDevice(self): """ get the Hardware Device this Interface belongs to """ if self.Dialup: return self.Dialup.Inherits return None
class Dialup_base(Gdtstruct): "Dialup structure" gdtstruct_properties([ ('Hostname', Gdtstr, "Test doc string"), ('ProviderName', Gdtstr, "Test doc string"), ('Login', Gdtstr, "Test doc string"), ('Password', Gdtstr, "Test doc string"), ('Authentication', Gdtstr, "Test doc string"), ('MSN', Gdtstr, 'VALUE="0"'), ('Prefix', Gdtstr, "Test doc string"), ('Areacode', Gdtstr, "Test doc string"), ('Regioncode', Gdtstr, "Test doc string"), ('PhoneNumber', Gdtstr, "Test doc string"), ('LocalIP', Gdtstr, "Test doc string"), ('RemoteIP', Gdtstr, "Test doc string"), ('Persist', Gdtbool, "Test doc string"), ('DefRoute', Gdtbool, "Test doc string"), ('Inherits', Gdtstr, "Test doc string"), ('ChargeHup', Gdtstr, "Test doc string"), ('ChargeInt', Gdtstr, "Test doc string"), ('Ihup', Gdtstr, "Test doc string"), ('DialMax', Gdtint, 'VALUE="3"'), ('Layer2', Gdtstr, 'VALUE="hdlc"'), ('Layer3', Gdtstr, 'VALUE="trans"'), ('Mru', Gdtint, 'VALUE="0"'), ('PPPOptions', PPPOptions, "Test doc string"), ('StupidMode', Gdtbool, "Test doc string"), ('DialinServer', Gdtbool, "Test doc string"), ('ChannelBundling', Gdtbool, "Test doc string"), ('EncapMode', Gdtstr, "Test doc string"), ('HangupTimeout', Gdtint, 'VALUE="600"'), ('DialMode', Gdtstr, 'VALUE="manual"'), ('SlaveDevice', Gdtstr, "Test doc string"), ('EthDevice', Gdtstr, "Test doc string"), ('ServiceName', Gdtstr, "Test doc string"), ('AcName', Gdtstr, "Test doc string"), ('SyncPPP', Gdtbool, "Test doc string"), ('InitString', Gdtstr, "Test doc string"), ('Secure', Gdtbool, "Test doc string"), ('PhoneInNumber', Gdtstr, "Test doc string"), ('Callback', Callback, "Test doc string"), ('Compression', Compression, "Test doc string"), ]) def __init__(self): super(Dialup_base, self).__init__() self.Hostname = None self.ProviderName = None self.Login = None self.Password = None self.Authentication = None # self.MSN = "0" self.MSN = None self.Prefix = None self.Areacode = None self.Regioncode = None self.PhoneNumber = None self.LocalIP = None self.RemoteIP = None self.Persist = None self.DefRoute = None self.Inherits = None self.ChargeHup = None self.ChargeInt = None self.Ihup = None # self.DialMax = "3" self.DialMax = None # self.Layer2 = "hdlc" self.Layer2 = None # self.Layer3 = "trans" self.Layer3 = None self.Mru = None self.PPPOptions = PPPOptions() self.StupidMode = None self.DialinServer = None self.ChannelBundling = None self.EncapMode = None self.HangupTimeout = 600 # self.HangupTimeout = None # self.DialMode = "manual" self.DialMode = None self.SlaveDevice = None self.EthDevice = None self.ServiceName = None self.AcName = None self.SyncPPP = None self.InitString = None self.Secure = None self.PhoneInNumber = None self.Callback = Callback() self.Compression = Compression() def createCallback(self): if not self.Callback: self.Callback = Callback() return self.Callback def createCompression(self): if not self.Compression: self.Compression = Compression() return self.Compression def createPPPOptions(self): if not self.PPPOptions: self.PPPOptions = PPPOptions() return self.PPPOptions