def saveConnection(set_conn): if set_conn: # create connection / update device comlink.call(self.link.script, "Net.Link", "setConnection", name, self.device_uid) if "net" in self.link.modes: # set address address = str(self.address.text()) netmask = str(self.netmask.currentText()) gateway = str(self.gateway.text()) if self.r1.isChecked(): mode = "auto" address = "" netmask = "" gateway = "" else: mode = "manual" comlink.call(self.link.script, "Net.Link", "setAddress", name, mode, address, netmask, gateway) # set name servers nameserver = "" if self.dns1.isChecked(): namemode = "default" elif self.dns2.isChecked(): namemode = "auto" elif self.dns3.isChecked(): namemode = "custom" nameserver = str(self.dns_text.text()) comlink.call(self.link.script, "Net.Link", "setNameService", name, namemode, nameserver) if "devicemode" in self.link.modes: from string import lower selected_device_mode = str(lower(self.selected_device_mode.currentText())) comlink.call(self.link.script, "Net.Link", "setConnectionMode", name, selected_device_mode) if "remote" in self.link.modes: # set remote address remote = str(self.remote.text()) comlink.call(self.link.script, "Net.Link", "setRemote", name, remote, self.apmac) if "auth" in self.link.modes: i = self.auth_mode.currentItem() if i == 0: comlink.call(self.link.script, "Net.Link", "setAuthentication", name, "none", "", "") else: mode = self.link.auth_modes[i-1] if mode.type == "pass": pw = unicode(self.auth_passphrase.text()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, "", pw) elif mode.type == "login": u = unicode(self.auth_user.text()) pw = unicode(self.auth_password.text()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, u, pw) # close dialog self.parent().setEnabled(True) self.cleanup() self.parent().parent().close(True)
def saveConnection(set_conn): if set_conn: # create connection / update device comlink.call(self.link.script, "Net.Link", "setConnection", name, self.device_uid) if "net" in self.link.modes: # set address address = str(self.address.text()) netmask = str(self.netmask.text()) gateway = str(self.gateway.text()) if self.r1.isChecked(): mode = "auto" address = "" netmask = "" gateway = "" else: mode = "manual" comlink.call(self.link.script, "Net.Link", "setAddress", name, mode, address, netmask, gateway) # set name servers nameserver = "" if self.dns1.isChecked(): namemode = "default" elif self.dns2.isChecked(): namemode = "auto" elif self.dns3.isChecked(): namemode = "custom" nameserver = str(self.dns_text.text()) comlink.call(self.link.script, "Net.Link", "setNameService", name, namemode, nameserver) if "remote" in self.link.modes: # set remote address remote = str(self.remote.text()) comlink.call(self.link.script, "Net.Link", "setRemote", name, remote, self.apmac) if "auth" in self.link.modes: i = self.auth_mode.currentItem() if i == 0: comlink.call(self.link.script, "Net.Link", "setAuthentication", name, "none", "", "") else: mode = self.link.auth_modes[i-1] if mode.type == "pass": pw = unicode(self.auth_passphrase.text()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, "", pw) elif mode.type == "login": u = unicode(self.auth_user.text()) pw = unicode(self.auth_password.text()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, u, pw) if "vpn" in self.link.modes: domain = str(self.domain.text()) port = str(self.port.text()) protocol = str(self.protocol.currentText()).lower() chipher = str(self.chipher.currentText()) if self.chipher.currentText() == "-": chipher = str("") ca = str(self.ca) cert = str(self.cert) key = str(self.key) comlink.call(self.link.script,"Net.Link","setVpn", name, domain, port, protocol, ca, cert, key, chipher) # close dialog self.parent().setEnabled(True) self.cleanup() self.parent().parent().close(True)
def saveConnection(set_conn): if set_conn: # create connection / update device comlink.call(self.link.script, "Net.Link", "setConnection", name, self.device_uid) if "net" in self.link.modes: # set address address = str(self.address.text()) netmask = str(self.netmask.currentText()) gateway = str(self.gateway.text()) if self.r1.isChecked(): mode = "auto" if not self.auto_addr.isChecked(): address = "" netmask = "" if not self.auto_gate.isChecked(): gateway = "" else: mode = "manual" comlink.call(self.link.script, "Net.Link", "setAddress", name, mode, address, netmask, gateway) # set name servers nameserver = "" if self.dns1.isChecked(): namemode = "default" elif self.dns2.isChecked(): namemode = "auto" elif self.dns3.isChecked(): namemode = "custom" nameserver = str(self.dns_text.text()) comlink.call(self.link.script, "Net.Link", "setNameService", name, namemode, nameserver) if "remote" in self.link.modes: # set remote address remote = str(self.remote.text()) comlink.call(self.link.script, "Net.Link", "setRemote", name, remote, self.apmac) if self.channel != None: print "setting channel to : ", self.channel print "name : ", name comlink.call(self.link.script, "Net.Link", "setChannel", name, self.channel) if "auth" in self.link.modes: i = self.security_mode_combo.currentItem() if i == 0: comlink.call(self.link.script, "Net.Link", "setAuthentication", name, "none", "", "", "", "", "", "", "", "", "") else: mode = self.link.auth_modes[i - 1] if mode.type == "pass": pw = unicode(self.auth_passphrase_line.text()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, "", pw, "", "", "", "", "", "", "") elif mode.type == "login": if mode.id == "802.1x": u = unicode(self.auth_user_line.text()) pw = unicode(self.auth_passphrase_line.text()) an = unicode(self.auth_anon_id_line.text()) au = unicode(self.auth_mode_combo.currentText()) p2 = unicode(self.auth_inner_combo.currentText()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, u, pw, au, an, p2,\ str(self.auth_client_cert), str(self.auth_ca_cert), str(self.auth_private_key), str(self.auth_private_key_pass_line.text())) else: u = unicode(self.auth_user_line.text()) pw = unicode(self.auth_passphrase_line.text()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, u, pw, "", "", "", "", "", "", "") # close dialog self.parent().setEnabled(True) self.cleanup() self.parent().parent().close(True)
def saveConnection(set_conn): if set_conn: # create connection / update device comlink.call(self.link.script, "Net.Link", "setConnection", name, self.device_uid) if "net" in self.link.modes: # set address address = str(self.address.text()) netmask = str(self.netmask.currentText()) gateway = str(self.gateway.text()) if self.r1.isChecked(): mode = "auto" if not self.auto_addr.isChecked(): address = "" netmask = "" if not self.auto_gate.isChecked(): gateway = "" else: mode = "manual" comlink.call(self.link.script, "Net.Link", "setAddress", name, mode, address, netmask, gateway) # set name servers nameserver = "" if self.dns1.isChecked(): namemode = "default" elif self.dns2.isChecked(): namemode = "auto" elif self.dns3.isChecked(): namemode = "custom" nameserver = str(self.dns_text.text()) comlink.call(self.link.script, "Net.Link", "setNameService", name, namemode, nameserver) if "remote" in self.link.modes: # set remote address remote = str(self.remote.text()) comlink.call(self.link.script, "Net.Link", "setRemote", name, remote, self.apmac) if self.channel != None: print "setting channel to : ", self.channel print "name : ", name comlink.call(self.link.script, "Net.Link", "setChannel", name, self.channel) if "auth" in self.link.modes: i = self.security_mode_combo.currentItem() if i == 0: comlink.call(self.link.script, "Net.Link", "setAuthentication", name, "none", "", "", "", "", "", "", "", "","") else: mode = self.link.auth_modes[i-1] if mode.type == "pass": pw = unicode(self.auth_passphrase_line.text()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, "", pw, "", "", "", "", "", "", "") elif mode.type == "login": if mode.id == "802.1x": u = unicode(self.auth_user_line.text()) pw = unicode(self.auth_passphrase_line.text()) an = unicode(self.auth_anon_id_line.text()) au = unicode(self.auth_mode_combo.currentText()) p2 = unicode(self.auth_inner_combo.currentText()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, u, pw, au, an, p2,\ str(self.auth_client_cert), str(self.auth_ca_cert), str(self.auth_private_key), str(self.auth_private_key_pass_line.text())) else: u = unicode(self.auth_user_line.text()) pw = unicode(self.auth_passphrase_line.text()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, u, pw, "", "", "", "", "", "", "") # close dialog self.parent().setEnabled(True) self.cleanup() self.parent().parent().close(True)
def saveConnection(set_conn): if set_conn: # create connection / update device comlink.call(self.link.script, "Net.Link", "setConnection", name, self.device_uid) if "net" in self.link.modes: # set address address = str(self.address.text()) netmask = str(self.netmask.text()) gateway = str(self.gateway.text()) if self.r1.isChecked(): mode = "auto" address = "" netmask = "" gateway = "" else: mode = "manual" comlink.call(self.link.script, "Net.Link", "setAddress", name, mode, address, netmask, gateway) # set name servers nameserver = "" if self.dns1.isChecked(): namemode = "default" elif self.dns2.isChecked(): namemode = "auto" elif self.dns3.isChecked(): namemode = "custom" nameserver = str(self.dns_text.text()) comlink.call(self.link.script, "Net.Link", "setNameService", name, namemode, nameserver) if "remote" in self.link.modes: # set remote address remote = str(self.remote.text()) comlink.call(self.link.script, "Net.Link", "setRemote", name, remote, self.apmac) if "auth" in self.link.modes: i = self.auth_mode.currentItem() if i == 0: comlink.call(self.link.script, "Net.Link", "setAuthentication", name, "none", "", "") else: mode = self.link.auth_modes[i - 1] if mode.type == "pass": pw = unicode(self.auth_passphrase.text()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, "", pw) elif mode.type == "login": u = unicode(self.auth_user.text()) pw = unicode(self.auth_password.text()) comlink.call(self.link.script, "Net.Link", "setAuthentication", name, mode.id, u, pw) if "vpn" in self.link.modes: domain = str(self.domain.text()) port = str(self.port.text()) protocol = str(self.protocol.currentText()).lower() chipher = str(self.chipher.currentText()) if self.chipher.currentText() == "-": chipher = str("") ca = str(self.ca) cert = str(self.cert) key = str(self.key) comlink.call(self.link.script, "Net.Link", "setVpn", name, domain, port, protocol, ca, cert, key, chipher) # close dialog self.parent().setEnabled(True) self.cleanup() self.parent().parent().close(True)