Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,378 changes: 1,378 additions & 0 deletions src/components/common/dialog.tsx

Large diffs are not rendered by default.

398 changes: 178 additions & 220 deletions src/components/vm/nics/nicAdd.tsx

Large diffs are not rendered by default.

476 changes: 235 additions & 241 deletions src/components/vm/nics/nicBody.tsx

Large diffs are not rendered by default.

344 changes: 135 additions & 209 deletions src/components/vm/nics/nicEdit.tsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/vm/nics/vmNicsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { DialogsContext } from 'dialogs.jsx';

import cockpit from 'cockpit';
import { getIfaceSourceName, rephraseUI, vmId, addNotification } from "../../../helpers.js";
import AddNIC from './nicAdd.jsx';
import { AddNIC } from './nicAdd.jsx';
import { EditNICModal } from './nicEdit.jsx';
import { portForwardText } from './nicBody';
import { needsShutdownIfaceModel, needsShutdownIfaceSource, needsShutdownIfaceType, needsShutdownIfaceBackend, needsShutdownIfacePortForward, NeedsShutdownTooltip } from '../../common/needsShutdown.jsx';
Expand Down
58 changes: 31 additions & 27 deletions test/check-machines-networks
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import xml.etree.ElementTree as ET

import machineslib
import testlib
from dialoglib import DialogHelpers
from machinesxmls import (
TEST_NETWORK2_CLASH_XML,
TEST_NETWORK2_XML,
Expand Down Expand Up @@ -547,6 +548,7 @@ class TestMachinesNetworks(machineslib.VirtualMachinesCase):

def testNetworkSettings(self):
b = self.browser
d = DialogHelpers(b)
m = self.machine

self.createVm("subVmTest1")
Expand Down Expand Up @@ -581,7 +583,7 @@ class TestMachinesNetworks(machineslib.VirtualMachinesCase):
b.wait_not_present("#vm-subVmTest1-network-1-edit-dialog-idle-message")

# Cancel dialog
b.click("#vm-subVmTest1-network-1-edit-dialog-cancel")
b.click(d.cancel_button())
b.wait_not_present("#vm-subVmTest1-network-1-edit-dialog-modal-window")

# Fetch current NIC model type
Expand All @@ -592,15 +594,15 @@ class TestMachinesNetworks(machineslib.VirtualMachinesCase):
b.click("#vm-subVmTest1-network-2-edit-dialog")

# Change network model type of a running domain
b.select_from_dropdown("#vm-subVmTest1-network-2-edit-dialog-model", "e1000e")
b.select_from_dropdown(d.field("model"), "e1000e")
# Wait for the dialog warning to appear
b.wait_visible("#vm-subVmTest1-network-2-edit-dialog-idle-message")
# Change network type and source of a running domain
b.wait_val("#vm-subVmTest1-network-2-edit-dialog-type", "network")
b.wait_val("#vm-subVmTest1-network-2-edit-dialog-source", "default")
b.select_from_dropdown("#vm-subVmTest1-network-2-edit-dialog-source", "test_network")
b.wait_val(d.field("type_and_source.type"), "network")
b.wait_val(d.field("type_and_source.source"), "default")
b.select_from_dropdown(d.field("type_and_source.source"), "test_network")
# Save the network settings
b.click("#vm-subVmTest1-network-2-edit-dialog-save")
b.click(d.apply_button())
b.wait_not_present("#vm-subVmTest1-network-2-edit-dialog-modal-window")
# Wait for the tooltips to appear next to the elements we changed
b.wait_in_text("#vm-subVmTest1-network-2-model", current_model_type)
Expand Down Expand Up @@ -642,12 +644,12 @@ class TestMachinesNetworks(machineslib.VirtualMachinesCase):
# Open the modal dialog
b.click("#vm-subVmTest1-network-1-edit-dialog")

b.wait_val("#vm-subVmTest1-network-1-edit-dialog-type", "bridge")
b.select_from_dropdown("#vm-subVmTest1-network-1-edit-dialog-type", "direct")
source = b.val("#vm-subVmTest1-network-1-edit-dialog-source")
b.wait_val(d.field("type_and_source.type"), "bridge")
b.select_from_dropdown(d.field("type_and_source.type"), "direct")
source = b.val(d.field("type_and_source.source"))

# Save the network settings
b.click("#vm-subVmTest1-network-1-edit-dialog-save")
b.click(d.apply_button())
b.wait_not_present("#vm-subVmTest1-network-1-edit-dialog-modal-window")

b.wait_in_text("#vm-subVmTest1-network-1-type", "direct")
Expand All @@ -657,33 +659,33 @@ class TestMachinesNetworks(machineslib.VirtualMachinesCase):
# Open the modal dialog
b.click("#vm-subVmTest1-network-1-edit-dialog")

b.wait_val("#vm-subVmTest1-network-1-edit-dialog-type", "direct")
b.select_from_dropdown("#vm-subVmTest1-network-1-edit-dialog-type", "bridge")
b.select_from_dropdown("#vm-subVmTest1-network-1-edit-dialog-source", "virbr0")
b.wait_val(d.field("type_and_source.type"), "direct")
b.select_from_dropdown(d.field("type_and_source.type"), "bridge")
b.select_from_dropdown(d.field("type_and_source.source"), "virbr0")

# Save the network settings
b.click("#vm-subVmTest1-network-1-edit-dialog-save")
b.click(d.apply_button())
b.wait_not_present("#vm-subVmTest1-network-1-edit-dialog-modal-window")

b.wait_in_text("#vm-subVmTest1-network-1-type", "bridge")
b.wait_in_text("#vm-subVmTest1-network-1-source", "virbr0")

b.click("#vm-subVmTest1-network-1-edit-dialog")
b.wait_in_text("#vm-subVmTest1-network-1-edit-dialog-source", "virbr0")
b.click("#vm-subVmTest1-network-1-edit-dialog-save")
b.wait_in_text(d.field("type_and_source.source"), "virbr0")
b.click(d.apply_button())
b.wait_not_present("#vm-subVmTest1-network-1-edit-dialog-modal-window")
b.wait_in_text("#vm-subVmTest1-network-1-source", "virbr0")

# Change interface type to network
# Open the modal dialog
b.click("#vm-subVmTest1-network-1-edit-dialog")

b.wait_val("#vm-subVmTest1-network-1-edit-dialog-type", "bridge")
b.select_from_dropdown("#vm-subVmTest1-network-1-edit-dialog-type", "network")
b.select_from_dropdown("#vm-subVmTest1-network-1-edit-dialog-source", "test_network")
b.wait_val(d.field("type_and_source.type"), "bridge")
b.select_from_dropdown(d.field("type_and_source.type"), "network")
b.select_from_dropdown(d.field("type_and_source.source"), "test_network")

# Save the network settings
b.click("#vm-subVmTest1-network-1-edit-dialog-save")
b.click(d.apply_button())
b.wait_not_present("#vm-subVmTest1-network-1-edit-dialog-modal-window")

b.wait_in_text("#vm-subVmTest1-network-1-type", "network")
Expand Down Expand Up @@ -723,10 +725,12 @@ class TestMachinesNetworks(machineslib.VirtualMachinesCase):
b.click("#vm-subVmTest1-network-1-edit-dialog")

# And ensure that the network sources dropdown is disabled
b.wait_val("#vm-subVmTest1-network-1-edit-dialog-type", "bridge")
b.select_from_dropdown("#vm-subVmTest1-network-1-edit-dialog-type", "network")
b.wait_visible("#vm-subVmTest1-network-1-edit-dialog-save:disabled")
b.click(".pf-v6-c-modal-box__footer button:contains(Cancel)")
b.wait_val(d.field("type_and_source.type"), "bridge")
b.select_from_dropdown(d.field("type_and_source.type"), "network")
b.click(d.apply_button())
b.wait_in_text(d.validation("type_and_source.source"), "No sources available")
b.wait_visible(d.apply_button() + ":disabled")
b.click(d.cancel_button())

# Ensure that when the source of a NIC was removed we can still change it

Expand All @@ -746,9 +750,9 @@ class TestMachinesNetworks(machineslib.VirtualMachinesCase):
# Try to edit the interface changing the source to a non deleted network
b.click("#vm-subVmTest1-network-1-edit-dialog")
b.wait_visible("#vm-subVmTest1-network-1-edit-dialog-modal-window")
b.select_from_dropdown("#vm-subVmTest1-network-1-edit-dialog-type", "network")
b.select_from_dropdown("#vm-subVmTest1-network-1-edit-dialog-source", "test_network")
b.click("#vm-subVmTest1-network-1-edit-dialog-save")
b.select_from_dropdown(d.field("type_and_source.type"), "network")
b.select_from_dropdown(d.field("type_and_source.source"), "test_network")
b.click(d.apply_button())
b.wait_not_present("#vm-subVmTest1-network-1-edit-dialog-modal-window")
self.expandNicRow(1)
b.wait_in_text("#vm-subVmTest1-network-1-source", "test_network")
Expand Down
Loading