self.assertIn('inet 169.254.133.11/16 metric 2048 brd 169.254.255.255 scope link', output)
def test_dhcp_client_use_dns(self):
- def check(self, ipv4, ipv6):
+ def check(self, ipv4, ipv6, needs_reconfigure=False):
os.makedirs(os.path.join(network_unit_dir, '25-dhcp-client.network.d'), exist_ok=True)
with open(os.path.join(network_unit_dir, '25-dhcp-client.network.d/override.conf'), mode='w', encoding='utf-8') as f:
f.write('[DHCPv4]\nUseDNS=')
f.write('\n[IPv6AcceptRA]\nUseDNS=no')
networkctl_reload()
+ if needs_reconfigure:
+ networkctl_reconfigure('veth99')
self.wait_online('veth99:routable')
# link becomes 'routable' when at least one protocol provide an valid address. Hence, we need to explicitly wait for both addresses.
check(self, True, True)
check(self, True, False)
- check(self, False, True)
+ check(self, False, True, needs_reconfigure=True)
check(self, False, False)
def test_dhcp_client_default_use_domains(self):
check(self, False, False, False)
def test_dhcp_client_use_dnr(self):
- def check(self, ipv4, ipv6):
+ def check(self, ipv4, ipv6, needs_reconfigure=False):
os.makedirs(os.path.join(network_unit_dir, '25-dhcp-client.network.d'), exist_ok=True)
with open(os.path.join(network_unit_dir, '25-dhcp-client.network.d/override.conf'), mode='w', encoding='utf-8') as f:
f.write('[DHCPv4]\nUseDNS=')
f.write('\n[IPv6AcceptRA]\nUseDNS=no')
networkctl_reload()
+ if needs_reconfigure:
+ networkctl_reconfigure('veth99')
self.wait_online('veth99:routable')
# link becomes 'routable' when at least one protocol provide an valid address. Hence, we need to explicitly wait for both addresses.
check(self, True, True)
check(self, True, False)
- check(self, False, True)
+ check(self, False, True, needs_reconfigure=True)
check(self, False, False)
def test_dhcp_client_use_captive_portal(self):
- def check(self, ipv4, ipv6):
+ def check(self, ipv4, ipv6, needs_reconfigure=False):
os.makedirs(os.path.join(network_unit_dir, '25-dhcp-client.network.d'), exist_ok=True)
with open(os.path.join(network_unit_dir, '25-dhcp-client.network.d/override.conf'), mode='w', encoding='utf-8') as f:
f.write('[DHCPv4]\nUseCaptivePortal=')
f.write('\n[IPv6AcceptRA]\nUseCaptivePortal=no')
networkctl_reload()
+ if needs_reconfigure:
+ networkctl_reconfigure('veth99')
self.wait_online('veth99:routable')
# link becomes 'routable' when at least one protocol provide an valid address. Hence, we need to explicitly wait for both addresses.
check(self, True, True)
check(self, True, False)
- check(self, False, True)
+ check(self, False, True, needs_reconfigure=True)
check(self, False, False)
def test_dhcp_client_reject_captive_portal(self):