def test_tagged_dhcp_discovery(self, *args, **kwargs): self.test_tagged_dhcp() nn = NodeNetwork() nn.all_ifnames = lambda: ["eth0", "eth0.42"] nics = nn.nics() assert nics.keys() == ["eth0"] assert type(nics["eth0"]) is TaggedNIC
def test_static_discovery(self, *args, **kwargs): self.test_static() nn = NodeNetwork() nn.all_ifnames = lambda: ["ens1"] nics = nn.nics() assert nics.keys() == ["ens1"] assert type(nics["ens1"]) is NIC
def test_bridged_dhcp_discovery(self, *args, **kwargs): self.test_bridged_dhcp() nn = NodeNetwork() nn.all_ifnames = lambda: ["ens1", "ens2", "ens3", "bond0"] nics = nn.nics() assert nics.keys() == ["bond0"] assert type(nics["bond0"]) is BridgedNIC
def test_no_bond_and_clean_discovery(self, *args, **kwargs): self.test_no_bond_and_clean() nn = NodeNetwork() nn.all_ifnames = lambda: ["ens1", "ens2", "ens3"] nics = nn.nics() assert sorted(nics.keys()) == ["ens1", "ens2", "ens3"] assert all(type(n) is NIC for n in nics.values())
def test_dhcp_discovery(self, *args, **kwargs): self.test_dhcp() nn = NodeNetwork() nn.all_ifnames = lambda: ["eth0", "breth0"] nics = nn.nics() print nics.keys() assert sorted(nics.keys()) == ["breth0", "eth0"] assert type(nics["eth0"]) is BridgedNIC
def test_clean(self, *args, **kwargs): ifnames = ["ens1", "ens2", "brens3", "bond007", "ens4.42"] nn = NodeNetwork() nn.all_ifnames = lambda: ifnames nics = nn.nics() print nics assert sorted(nics.keys()) == ["bond007", "brens3", "ens1", "ens2"] assert all(type(n) is NIC for n in nics.values())
def test_tagged_bridged_dhcp_discovery(self, *args, **kwargs): self.test_tagged_bridged_dhcp() nn = NodeNetwork() nn.all_ifnames = lambda: ["ens1", "ens2", "ens3", "bond0"] nics = nn.nics() bridge_nic = nics["bond0"] assert nics.keys() == ["bond0"] assert type(bridge_nic) is BridgedNIC assert bridge_nic.slave_nic.vlan_nic.ifname == "bond0.42"
def test_tagged_dhcp_discovery(self, *args, **kwargs): self.test_tagged_dhcp() nn = NodeNetwork() nn.all_ifnames = lambda: ["p1p2"] nics = nn.nics() print nics bridge_nic = nics["p1p2"] assert nics.keys() == ["p1p2"] assert type(bridge_nic) is BridgedNIC
def on_change(self, changes): net_is_configured = NodeNetwork().is_configured() if "rhn.type" in changes and net_is_configured: if (changes["rhn.type"] == "sam" or changes["rhn.type"] == "satellite"): if not self._fields_enabled: self._fields_enabled = True self.widgets["rhn.url"].enabled(True) self.widgets["rhn.ca"].enabled(True) self.widgets["rhn.org"].enabled(True) self.widgets["rhn.environment"].enabled(True) self.widgets["rhn.activation_key"].enabled(True) self.stash_pop_change("rhn.url", reuse_old=True) self.stash_pop_change("rhn.ca", reuse_old=True) else: self._fields_enabled = False self.widgets["rhn.url"].enabled(False) self.widgets["rhn.ca"].enabled(False) self.stash_change("rhn.url") self.stash_change("rhn.ca") # Don't run a transaction yet, just close it out, save if the # normal save button is triggered if "proxy.save" in changes: self._dialog.close() return
def on_change(self, changes): net_is_configured = NodeNetwork().is_configured() if "rhn.type" in changes and net_is_configured: self.widgets["rhn.url"].enabled(False) self.widgets["rhn.ca"].enabled(False) if (changes["rhn.type"] == "sam" or changes["rhn.type"] == "satellite"): self.widgets["rhn.url"].enabled(True) self.widgets["rhn.ca"].enabled(True) else: self.widgets["rhn.url"].text("") self.widgets["rhn.ca"].text("")
def ui_content(self): if self.application.args.dry: net_is_configured = True else: net_is_configured = NodeNetwork().is_configured() if not net_is_configured: ws = ([ ui.Divider("notice.divider"), ui.Notice( "network.notice", "Networking is not configured, please " + "configure it before configuring RHN"), ui.Divider("notice.divider") ]) else: status, rhn_type = get_rhn_status() if status == 0: rhn_msg = ("RHN Registration is required only if you wish " + "to use Red Hat Enterprise Linux with virtual " + "guests subscriptions for your guests.") else: rhn_msg = "RHN Registration\n\nRegistration Status: %s" \ % rhn_type ws = [ ui.Header("header[0]", rhn_msg), ui.Entry("rhn.user", "Login:"******"rhn.password", "Password:"******"rhn.profilename", "Profile Name (optional):"), ui.Divider("divider[0]"), ui.Options("rhn.type", "Type", self._rhn_types), ui.Entry("rhn.url", "URL:"), ui.Entry("rhn.ca", "CA URL:"), ui.Header("header[0]", "HTTP Proxy Configuration"), ui.Entry("rhn.proxyhost", "Server:"), ui.Entry("rhn.proxyport", "Port:"), ui.Entry("rhn.proxyuser", "Username:"******"rhn.proxypassword", "Password:"******"divider[1]"), ] page = ui.Page("page", ws) self.widgets.add(ws) return page
def ui_content(self): """Describes the UI this plugin requires This is an ordered list of (path, widget) tuples. """ # _types needs to be rebuild on every page view, as the network # state can change between page views # NodeNetwork relies on runtime information which is N/A in dev mode if self.application.args.dry: net_is_configured = True else: net_is_configured = NodeNetwork().is_configured() ws = [ui.Header("kdump._header", _("Configure Kdump"))] if not net_is_configured: self._types = self._types_local ws.extend([ ui.Notice( _("network.notice"), _("Networking is not configured, ") + _("please configure it before NFS ") + _("or SSH-based kdump")), ui.Divider("notice.divider") ]) ws.extend([ui.Options("kdump.type", _("Type"), self._types)]) else: self._types = self._types_local + self._types_remote ws.extend([ui.Options("kdump.type", _("Type"), self._types)]) ws.extend([ ui.Divider("divider[0]"), ui.Entry("kdump.nfs_location", _("NFS Location ") + _("(example.com:/var/crash):"), align_vertical=True), ui.Divider("divider[1]"), ui.Entry("kdump.ssh_location", _("SSH Location ") + _("([email protected]):"), align_vertical=True), ui.Entry("kdump.ssh_key", "SSH Key URL (optional):", align_vertical=True) ]) page = ui.Page("page", ws) self.widgets.add(page) return page
def ui_content(self): # Update the status on a page refresh self._model["hosted_engine.status"] = self.__get_vm_status() network_up = NodeNetwork().is_configured() ws = [ui.Header("header[0]", "Hosted Engine Setup")] if network_up: ws.extend([ui.KeywordLabel("hosted_engine.enabled", ("Hosted Engine: "))]) else: ws.extend([ui.Notice("network.notice", "Networking is not " + "configured please configure it before " + "setting up hosted engine")]) if self._configured(): ws.extend([ui.Divider("divider[0]"), ui.KeywordLabel("hosted_engine.vm", ("Engine VM: ")), ui.KeywordLabel("hosted_engine.status", ("Engine Status: ")), ui.Button("button.status", "Hosted Engine VM status"), ui.Button("button.maintenance", "Set Hosted Engine maintenance")]) if network_up: ws.extend([ui.Divider("divider.button"), ui.Button("button.dialog", "Deploy Hosted Engine")]) if self._show_progressbar: if "progress" in self._model: ws.append(ui.ProgressBar("download.progress", int(self._model["progress"]))) else: ws.append(ui.ProgressBar("download.progress", 0)) ws.append(ui.KeywordLabel("download.status", "")) page = ui.Page("page", ws) page.buttons = [] self.widgets.add(page) return page
def ui_content(self): cfg = rhn_model.RHN().retrieve() if self.application.args.dry: net_is_configured = True else: net_is_configured = NodeNetwork().is_configured() if not net_is_configured: ws = ([ ui.Divider("notice.divider"), ui.Notice( "network.notice", "Networking is not configured, please " + "configure it before configuring RHSM"), ui.Divider("notice.divider") ]) else: rhn_msg = ("RHSM Registration is required only if you wish " + "to use Red Hat Enterprise Linux with virtual " + "guests subscriptions for your guests.") if cfg["rhntype"] and self._get_status(cfg) is not None: rhn_msg = self._get_status(cfg) ws = [ ui.Header("header[0]", rhn_msg), ui.Entry("rhn.username", "Login:"******"rhn.password", "Password:"******"rhn.profilename", "Profile Name (optional):"), ui.Divider("divider[0]"), ui.Options("rhn.type", "Type", self._rhn_types), ui.Entry("rhn.url", "URL:"), ui.Entry("rhn.ca", "CA URL:"), ui.Entry("rhn.org", "Organization:"), ui.Entry("rhn.environment", "Environment:"), ui.Entry("rhn.activation_key", "Activation Key:"), ui.Button("button.proxy", "HTTP Proxy Configuration"), ] page = ui.Page("page", ws) self.widgets.add(ws) return page