Exemple #1
0
    def test_direct_dhcp(self, *args, **kwargs):
        mb = defaults.NicBonding()
        mt = defaults.NetworkLayout()
        m = defaults.Network()

        mb.configure_8023ad("bond0", ["ens1", "ens2", "ens3"])
        m.configure_dhcp("bond0")
        mt.configure_direct()

        run_tx_by_name(m.transaction(), "WriteConfiguration")

        assert ifcfg_has_items("ens1",
                               [('DEVICE', 'ens1'),
                                ('HWADDR', 'th:em:ac:ad:dr'),
                                ('MASTER', 'bond0'),
                                ('ONBOOT', 'yes'),
                                ('SLAVE', 'yes')])

        assert ifcfg_has_items("ens2",
                               [('DEVICE', 'ens2'),
                                ('HWADDR', 'th:em:ac:ad:dr'),
                                ('MASTER', 'bond0'),
                                ('ONBOOT', 'yes'),
                                ('SLAVE', 'yes')])

        assert ifcfg_has_items("ens3",
                               [('DEVICE', 'ens3'),
                                ('HWADDR', 'th:em:ac:ad:dr'),
                                ('MASTER', 'bond0'),
                                ('ONBOOT', 'yes'),
                                ('SLAVE', 'yes')])

        assert ifcfg_has_items("bond0",
                               [('BONDING_OPTS', 'mode=4'),
                                ('BOOTPROTO', 'dhcp'),
                                ('DEVICE', 'bond0'),
                                ('ONBOOT', 'yes'),
                                ('PEERNTP', 'yes'),
                                ('TYPE', 'Bond')])
Exemple #2
0
    def test_tagged_dhcp(self, *args, **kwargs):
        mt = defaults.NetworkLayout()
        m = defaults.Network()

        mt.configure_direct()
        m.configure_dhcp("eth0", "42")

        run_tx_by_name(m.transaction(), "WriteConfiguration")

        assert ifcfg_has_items("eth0",
                               [('DEVICE', 'eth0'),
                                ('HWADDR', 'th:em:ac:ad:dr'),
                                ('ONBOOT', 'yes')])

        assert ifcfg_has_items("eth0.42",
                               [('BOOTPROTO', 'dhcp'),
                                ('DEVICE', 'eth0.42'),
                                ('ONBOOT', 'yes'),
                                ('PEERNTP', 'yes'),
                                ('VLAN', 'yes')])

        assert "breth0" not in FakeFs.filemap
Exemple #3
0
    def test_static(self, *args, **kwargs):
        m = defaults.Network()
        mt = defaults.NetworkLayout()

        mt.configure_bridged()
        m.configure_static("ens1", "192.168.122.42", "255.255.255.0",
                           "192.168.122.1", None)

        run_tx_by_name(m.transaction(), "WriteConfiguration")

        assert ifcfg_has_items("ens1", [('BRIDGE', 'brens1'),
                                        ('DEVICE', 'ens1'),
                                        ('HWADDR', 'th:em:ac:ad:dr'),
                                        ('NM_CONTROLLED', 'no'),
                                        ('ONBOOT', 'yes')])
        assert ifcfg_has_items("brens1",
                               [('DELAY', '0'), ('DEVICE', 'brens1'),
                                ('GATEWAY', '192.168.122.1'),
                                ('IPADDR', '192.168.122.42'),
                                ('IPV6INIT', 'no'), ('IPV6_AUTOCONF', 'no'),
                                ('NETMASK', '255.255.255.0'),
                                ('NM_CONTROLLED', 'no'), ('ONBOOT', 'yes'),
                                ('PEERNTP', 'yes'), ('TYPE', 'Bridge')])
Exemple #4
0
    def __init__(self, plugin, ifname):
        super(NicDetailsDialog, self).__init__("dialog.nic",
                                               "NIC Details: %s" % ifname, [])
        self.plugin = plugin

        # Populate model with nic specific informations
        self.logger.debug("Building NIC details dialog for %s" % ifname)

        nic = utils.network.NodeNetwork().nics()[ifname]

        model = defaults.Network().retrieve()
        ip6model = defaults.IPv6().retrieve()
        m_layout = defaults.NetworkLayout().retrieve()

        self.logger.debug("nic: %s" % nic)
        self.logger.debug("model: %s" % model)
        self.logger.debug("ip6model: %s" % ip6model)

        is_primary_interface = model["iface"] == ifname

        if not is_primary_interface:
            # The config contains the information for the primary ifnamee,
            # because this ifnamee is not the primaryifnameme we clear the
            # config
            model = dict((k, "") for k in model.keys())

        ipaddr, netmask, gateway, vlanid = (model["ipaddr"], model["netmask"],
                                            model["gateway"], model["vlanid"])

        ip6addr, ip6netmask, ip6gateway, ip6bootproto = (ip6model["ipaddr"],
                                                         ip6model["netmask"],
                                                         ip6model["gateway"],
                                                         ip6model["bootproto"])

        bootproto = model["bootproto"]
        if model["bootproto"] == "dhcp":
            if nic.exists():
                routes = utils.network.Routes()
                gateway = routes.default()
                ipaddr, netmask = nic.ipv4_address().items()
                vlanid = ",".join(nic.vlanids())
        else:
            if ipaddr:
                bootproto = "static"

        link_status_txt = ("Connected" if nic.has_link() else "Disconnected")
        vendor_txt = nic.vendor[:24] if nic.vendor else ""

        self.plugin._model_extra.update({
            "dialog.nic.driver":
            nic.driver,
            "dialog.nic.vendor":
            vendor_txt,
            "dialog.nic.link_status":
            link_status_txt,
            "dialog.nic.hwaddress":
            nic.hwaddr,
            "dialog.nic.ipv4.bootproto":
            bootproto,
            "dialog.nic.ipv4.address":
            ipaddr,
            "dialog.nic.ipv4.netmask":
            netmask,
            "dialog.nic.ipv4.gateway":
            gateway,
            "dialog.nic.ipv6.bootproto":
            ip6bootproto,
            "dialog.nic.ipv6.address":
            ip6addr,
            "dialog.nic.ipv6.netmask":
            ip6netmask,
            "dialog.nic.ipv6.gateway":
            ip6gateway,
            "dialog.nic.vlanid":
            vlanid,
            "dialog.nic.layout_bridged":
            m_layout["layout"] == "bridged",
        })

        self.logger.debug("model: %s" % self.plugin.model())

        padd = lambda l: l.ljust(12)
        ws = [
            ui.Row("dialog.nic._row[0]", [
                ui.KeywordLabel("dialog.nic.driver", padd("Driver: ")),
                ui.KeywordLabel("dialog.nic.vendor", padd("Vendor: ")),
            ]),
            ui.Row("dialog.nic._row[2]", [
                ui.KeywordLabel("dialog.nic.link_status",
                                padd("Link Status: ")),
                ui.KeywordLabel("dialog.nic.hwaddress", padd("MAC Address: ")),
            ]),
            ui.Divider("dialog.nic._divider[0]"),
            ui.Label("dialog.nic.ipv4._header", "IPv4 Settings"),
            ui.Options("dialog.nic.ipv4.bootproto", "Bootprotocol: ",
                       [("none", "Disabled"), ("dhcp", "DHCP"),
                        ("static", "Static")]),
            ui.Row("dialog.nic._row[4]", [
                ui.Entry("dialog.nic.ipv4.address", padd("IP Address: ")),
                ui.Entry("dialog.nic.ipv4.netmask", padd("  Netmask: "))
            ]),
            ui.Row("dialog.nic._row[5]", [
                ui.Entry("dialog.nic.ipv4.gateway", padd("Gateway: ")),
                ui.Label("dummy[0]", "")
            ]),
            ui.Divider("dialog.nic._divider[1]"),
            ui.Label("dialog.nic.ipv6._header", "IPv6 Settings"),
            ui.Options("dialog.nic.ipv6.bootproto", "Bootprotocol: ",
                       [("none", "Disabled"), ("auto", "Auto"),
                        ("dhcp", "DHCP"), ("static", "Static")]),
            ui.Row("dialog.nic._row[6]", [
                ui.Entry("dialog.nic.ipv6.address", padd("IP Address: ")),
                ui.Entry("dialog.nic.ipv6.netmask", padd("  Prefix Length: "))
            ]),
            ui.Row("dialog.nic._row[7]", [
                ui.Entry("dialog.nic.ipv6.gateway", padd("Gateway: ")),
                ui.Label("dummy[1]", "")
            ]),
            ui.Divider("dialog.nic._divider[2]"),
            ui.Row("dialog.nic._row[8]", [
                ui.Entry("dialog.nic.vlanid", padd("VLAN ID: ")),
                ui.Label("dummy[2]", "")
            ]),
            ui.Divider("dialog.nic._divider[3]"),
            ui.Checkbox("dialog.nic.layout_bridged", "Use Bridge: "),
            ui.Divider("dialog.nic._divider[4]"),
            ui.Button("dialog.nic.identify", "Flash Lights to Identify"),
        ]

        self.plugin.widgets.add(ws)
        self.children = ws
        self.buttons = [
            ui.SaveButton("dialog.nic.save", "Save"),
            ui.CloseButton("dialog.nic.close", "Close")
        ]
        self.plugin._nic_details_group.enabled(False)
        self.plugin.widgets["dialog.nic.vlanid"].enabled(True)
        self.plugin.widgets["dialog.nic.layout_bridged"].enabled(True)
Exemple #5
0
    def _configure_nic(self, bootproto, ipaddr, netmask, gateway,
                       ipv6_bootproto, ipv6_address, ipv6_netmask,
                       ipv6_gateway, vlanid, layout_bridged):
        vlanid = vlanid or None
        iface = self._model_extra["dialog.nic.ifname"]

        model = defaults.Network()
        ipv6model = defaults.IPv6()

        if bootproto == "none":
            self.logger.debug("Configuring no networking")
            model.configure_no_networking(iface)
        elif bootproto == "dhcp":
            self.logger.debug("Configuring dhcp")
            model.configure_dhcp(iface, vlanid)
        elif bootproto == "static":
            self.logger.debug("Configuring static ip")
            model.configure_static(iface, ipaddr, netmask, gateway, vlanid)
        else:
            self.logger.debug("No ipv4 interface configuration found")

        # A hack to also set the BOOTIF when IPv6 is used in a second
        enable_bootif = lambda: model.update(iface=iface)

        if ipv6_bootproto == "none":
            self.logger.debug("Configuring no ipv6 networking")
            ipv6model.disable()

        elif ipv6_bootproto == "dhcp":
            self.logger.debug("Configuring ipv6 dhcp")
            enable_bootif()
            ipv6model.configure_dhcp()

        elif ipv6_bootproto == "auto":
            self.logger.debug("Configuring ipv6 auto")
            enable_bootif()
            ipv6model.configure_auto()

        elif ipv6_bootproto == "static":
            self.logger.debug("Configuring ipv6 static ip")
            enable_bootif()
            ipv6model.configure_static(ipv6_address, ipv6_netmask,
                                       ipv6_gateway)
        else:
            self.logger.debug("No ipv6 interface configuration found")

        mt = defaults.NetworkLayout()
        if layout_bridged:
            mt.configure_bridged()
        else:
            mt.configure_default()

        # Return the resulting transaction
        txs = model.transaction()

        # FIXME the ipv6 transaction is IDENTICAL to the model.tranasaction()
        # (just a call to the legacy code to reconfigure networking)
        # Therefor we don't add it, to not call it twice.
        # But it should be added to the ocmplete transaction when the backend
        # code is more fine granular.
        #txs += ipv6model.transaction()
        return txs
Exemple #6
0
    def on_merge(self, effective_changes):
        self.logger.info("Saving network stuff")
        changes = Changeset(self.pending_changes(False))
        effective_model = Changeset(self.model())
        effective_model.update(effective_changes)

        self.logger.debug("Changes: %s" % changes)
        self.logger.info("Effective changes %s" % effective_changes)
        self.logger.debug("Effective Model: %s" % effective_model)

        # This object will contain all transaction elements to be executed
        txs = utils.Transaction("Network Interface Configuration")

        # Special case: A NIC was selected, display that dialog!
        if "nics" in changes and len(changes) == 1:
            iface = changes["nics"]
            self.logger.debug("Opening NIC Details dialog for '%s'" % iface)
            self._model_extra["dialog.nic.ifname"] = iface
            self._nic_dialog = NicDetailsDialog(self, iface)
            return self._nic_dialog

        if "dialog.nic.close" in changes:
            self._nic_dialog.close()
            return

        if "button.toggle_bond" in changes:
            m_bond = defaults.NicBonding()
            mnet = defaults.Network()
            if m_bond.retrieve()["slaves"]:
                if mnet.retrieve()["iface"] == m_bond.retrieve()["name"]:
                    # Remove network config if primary devce was this
                    # bond
                    mnet.configure_no_networking()
                m_bond.configure_no_bond()
                txs += m_bond.transaction()
                txs += mnet.transaction()
            else:
                self._bond_dialog = CreateBondDialog("dialog.bond")
                self.widgets.add(self._bond_dialog)
                return self._bond_dialog

        if "button.ping" in changes:
            self.logger.debug("Opening ping page")
            self.application.switch_to_plugin(ping.Plugin)
            return

        if "dialog.nic.identify" in changes:
            ifname = self._model_extra["dialog.nic.ifname"]
            utils.network.NIC(ifname).identify()
            self.application.notice("Flashing lights now")
            return

        nameservers = []
        dns_keys = ["dns[0]", "dns[1]"]
        if effective_changes.contains_any(dns_keys):
            nameservers += effective_model.values_for(dns_keys)
        if nameservers:
            self.logger.info("Setting new nameservers: %s" % nameservers)
            model = defaults.Nameservers()
            model.update(nameservers)
            txs += model.transaction()

        timeservers = []
        ntp_keys = ["ntp[0]", "ntp[1]"]
        if effective_changes.contains_any(ntp_keys):
            timeservers += effective_model.values_for(ntp_keys)
        if timeservers:
            self.logger.info("Setting new timeservers: %s" % timeservers)
            model = defaults.Timeservers()
            model.update(timeservers)
            txs += model.transaction()

        hostname_keys = ["hostname"]
        if effective_changes.contains_any(hostname_keys):
            value = effective_model.values_for(hostname_keys)
            self.logger.info("Setting new hostname: %s" % value)
            model = defaults.Hostname()
            model.update(*value)
            txs += model.transaction()

        # For the NIC details dialog:
        if effective_changes.contains_any(self._nic_details_group):
            # If any networking related key was changed, reconfigure networking
            # Fetch the values for the nic keys, they are used as arguments
            args = effective_model.values_for(self._nic_details_group)
            txs += self._configure_nic(*args)

        if effective_changes.contains_any(self._bond_group):
            mb = defaults.NicBonding()
            mnet = defaults.Network()
            args = effective_model.values_for(
                ["bond.name", "bond.slaves.selected", "bond.options"])
            self.logger.debug("args: %s" % args)
            mb.update(*args)
            txs += mb.transaction()
            txs += mnet.transaction()
            self._bond_dialog.close()

        progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self)
        progress_dialog.run()

        if "dialog.nic.save" in changes:
            # Close the remaing details dialog
            self._nic_dialog.close()

        # Behaves like a page reload
        return self.ui_content()
 def commit(self):
     from ovirt.node.config import defaults
     defaults.Network().update(bootproto="dhcp")
Exemple #8
0
    def __init__(self, plugin, iface):
        super(NicDetailsDialog, self).__init__("dialog.nic",
                                               "NIC Details: %s" % iface, [])
        self.plugin = plugin

        # Populate model with nic specific informations
        self.logger.debug("Building NIC details dialog for %s" % iface)

        self.logger.debug("Getting informations for NIC details page")
        live = utils.network.node_nics()[iface]
        cfg = defaults.Network().retrieve()

        self.logger.debug("live: %s" % live)
        self.logger.debug("cfg: %s" % cfg)

        # The primary interface of this Node:
        node_bridge_slave = config.network.node_bridge_slave()

        if node_bridge_slave != iface:
            # The config contains the information for the primary iface,
            # because this iface is not the primary iface we clear the config
            cfg = {k: "" for k in cfg.keys()}

        ipaddr, netmask, gateway, vlanid = (cfg["ipaddr"], cfg["netmask"],
                                            cfg["gateway"], cfg["vlanid"])

        bridge_nic = utils.network.NIC(live["bridge"])
        if cfg["bootproto"] == "dhcp":
            if bridge_nic.exists():
                routes = utils.network.Routes()
                ipaddr, netmask = bridge_nic.ipv4_address().items()
                gateway = routes.default()
                vlanid = bridge_nic.vlanid()
            else:
                self.logger.warning("Bridge assigned but couldn't gather " +
                                    "live info: %s" % bridge_nic)

        self.plugin._model_extra.update({
            "dialog.nic.iface":
            live["name"],
            "dialog.nic.driver":
            live["driver"],
            "dialog.nic.protocol":
            live["bootproto"] or "N/A",
            "dialog.nic.vendor":
            live["vendor"],
            "dialog.nic.link_status":
            "Connected" if live["link_detected"] else "Disconnected",
            "dialog.nic.hwaddress":
            live["hwaddr"],
            "dialog.nic.ipv4.bootproto":
            cfg["bootproto"],
            "dialog.nic.ipv4.address":
            ipaddr,
            "dialog.nic.ipv4.netmask":
            netmask,
            "dialog.nic.ipv4.gateway":
            gateway,
            "dialog.nic.vlanid":
            vlanid,
        })

        self.logger.debug("model: %s" % self.plugin.model())

        padd = lambda l: l.ljust(14)
        ws = [
            ui.Row("dialog.nic._row[0]", [
                ui.KeywordLabel("dialog.nic.iface", padd("Interface: ")),
                ui.KeywordLabel("dialog.nic.driver", padd("Driver: ")),
            ]),
            ui.Row("dialog.nic._row[1]", [
                ui.KeywordLabel("dialog.nic.protocol", padd("Protocol: ")),
                ui.KeywordLabel("dialog.nic.vendor", padd("Vendor: ")),
            ]),
            ui.Row("dialog.nic._row[2]", [
                ui.KeywordLabel("dialog.nic.link_status",
                                padd("Link Status: ")),
                ui.KeywordLabel("dialog.nic.hwaddress", padd("MAC Address: ")),
            ]),
            ui.Divider("dialog.nic._divider[0]"),
            ui.Header("dialog.nic.ipv4._header", "IPv4 Settings"),
            ui.Options("dialog.nic.ipv4.bootproto", "Bootprotocol: ",
                       [("none", "Disabled"), ("dhcp", "DHCP"),
                        ("static", "Static")]),
            ui.Entry("dialog.nic.ipv4.address", padd("IP Address: ")),
            ui.Entry("dialog.nic.ipv4.netmask", padd("Netmask: ")),
            ui.Entry("dialog.nic.ipv4.gateway", padd("Gateway: ")),
            ui.Divider("dialog.nic._divider[1]"),
            ui.Entry("dialog.nic.vlanid", padd("VLAN ID: ")),
        ]
        self.plugin.widgets.add(ws)
        self.children = ws
        self.buttons = [
            ui.SaveButton("dialog.nic.save", "Save"),
            ui.CloseButton("dialog.nic.close", "Close"),
        ]
        self.plugin._nic_details_group.enabled(False)
Exemple #9
0
    def __init__(self, plugin, ifname):
        super(NicDetailsDialog, self).__init__("dialog.nic",
                                               "NIC Details: %s" % ifname, [])
        self.plugin = plugin

        # Populate model with nic specific informations
        self.logger.debug("Building NIC details dialog for %s" % ifname)

        nic = utils.network.NodeNetwork().nics()[ifname]

        model = defaults.Network().retrieve()
        ip6model = defaults.IPv6().retrieve()

        self.logger.debug("nic: %s" % nic)
        self.logger.debug("model: %s" % model)
        self.logger.debug("ip6model: %s" % ip6model)

        is_primary_interface = model["iface"] == ifname

        link_status_txt = ("Connected" if nic.has_link() else "Disconnected")
        vendor_txt = nic.vendor[:24] if nic.vendor else ""

        self.plugin._model_extra.update({
            "dialog.nic.driver": nic.driver,
            "dialog.nic.vendor": vendor_txt,
            "dialog.nic.link_status": link_status_txt,
            "dialog.nic.hwaddress": nic.hwaddr,
        })

        if isinstance(nic, network.BondedNIC):
            self.plugin._model_extra.update({
                "dialog.nic.bond_mode":
                nic.mode,
                "dialog.nic.bond_slaves":
                " ".join(nic.slaves)
            })

        bootproto = model["bootproto"]
        ipaddr = model["ipaddr"]
        netmask = model["netmask"]
        gateway = model["gateway"]
        vlanid = model["vlanid"]

        if model["bootproto"] == "dhcp":
            if nic.exists():
                routes = utils.network.Routes()
                gateway = routes.default()
                ipaddr, netmask = nic.ipv4_address().items()
                vlanid = ",".join(nic.vlanids())
        else:
            if ipaddr:
                bootproto = "static"

        nicfields = {
            "dialog.nic.ipv4.bootproto": bootproto,
            "dialog.nic.ipv4.address": ipaddr,
            "dialog.nic.ipv4.netmask": netmask,
            "dialog.nic.ipv4.gateway": gateway,
            "dialog.nic.ipv6.bootproto": ip6model["bootproto"],
            "dialog.nic.ipv6.address": ip6model["ipaddr"],
            "dialog.nic.ipv6.netmask": ip6model["netmask"],
            "dialog.nic.ipv6.gateway": ip6model["gateway"],
            "dialog.nic.vlanid": vlanid,
        }
        self.plugin._model_extra.update(nicfields)

        if not is_primary_interface:
            # Unset all NIC fields. Because their values are only relevant
            # for the primary interface
            self.plugin._model_extra.update(dict.fromkeys(nicfields.keys()))

        self.logger.debug("model: %s" % self.plugin.model())

        padd = lambda l: l.ljust(12)
        ws = [
            ui.Row("dialog.nic._row[0]", [
                ui.KeywordLabel("dialog.nic.driver", padd(_("Driver: "))),
                ui.KeywordLabel("dialog.nic.vendor", padd(_("Vendor: "))),
            ]),
            ui.Row("dialog.nic._row[2]", [
                ui.KeywordLabel("dialog.nic.link_status",
                                padd("Link Status: ")),
                ui.KeywordLabel("dialog.nic.hwaddress", padd("MAC Address: ")),
            ])
        ]

        if isinstance(nic, network.BondedNIC):
            ws += [
                ui.Row("dialog.nic._row[3]", [
                    ui.KeywordLabel("dialog.nic.bond_mode", _("Bond Mode: ")),
                    ui.KeywordLabel("dialog.nic.bond_slaves",
                                    _("Bond Slaves: "))
                ])
            ]

        ws += [
            ui.Divider("dialog.nic._divider[0]"),
            ui.Label("dialog.nic.ipv4._header", _("IPv4 Settings")),
            ui.Options("dialog.nic.ipv4.bootproto", "Bootprotocol: ",
                       [("none", _("Disabled")), ("dhcp", _("DHCP")),
                        ("static", _("Static"))]),
            ui.Row("dialog.nic._row[4]", [
                ui.Entry("dialog.nic.ipv4.address", padd(_("IP Address: "))),
                ui.Entry("dialog.nic.ipv4.netmask", padd(_("  Netmask: ")))
            ]),
            ui.Row("dialog.nic._row[5]", [
                ui.Entry("dialog.nic.ipv4.gateway", padd(_("Gateway: "))),
                ui.Label("dummy[0]", "")
            ]),
            ui.Divider("dialog.nic._divider[1]"),
            ui.Label("dialog.nic.ipv6._header", _("IPv6 Settings")),
            ui.Options("dialog.nic.ipv6.bootproto", "Bootprotocol: ",
                       [("none", _("Disabled")), ("auto", _("Auto")),
                        ("dhcp", _("DHCP")), ("static", _("Static"))]),
            ui.Row("dialog.nic._row[6]", [
                ui.Entry("dialog.nic.ipv6.address", padd(_("IP Address: "))),
                ui.Entry("dialog.nic.ipv6.netmask", padd(
                    _("  Prefix Length: ")))
            ]),
            ui.Row("dialog.nic._row[7]", [
                ui.Entry("dialog.nic.ipv6.gateway", padd(_("Gateway: "))),
                ui.Label("dummy[1]", "")
            ]),
            ui.Divider("dialog.nic._divider[2]"),
            ui.Row("dialog.nic._row[8]", [
                ui.Entry("dialog.nic.vlanid", padd(_("VLAN ID: "))),
                ui.Label("dummy[2]", "")
            ]),
            ui.Divider("dialog.nic._divider[3]"),
            ui.Divider("dialog.nic._divider[4]"),
            ui.Button("dialog.nic.identify", _("Flash Lights to Identify"))
        ]

        self.plugin.widgets.add(ws)
        self.children = ws
        self.plugin._nic_details_group.enabled(False)
        if isinstance(nic, network.BridgedNIC):
            self.buttons = [ui.CloseButton("dialog.nic.close", _("Close"))]
        else:
            self.plugin.widgets["dialog.nic.vlanid"].enabled(True)
            self.buttons = [
                ui.SaveButton("dialog.nic.save", _("Save")),
                ui.CloseButton("dialog.nic.close", _("Close"))
            ]
Exemple #10
0
 def __init__(self):
     net = defaults.Network()
     net.configure_no_networking()