diff --git a/.gitignore b/.gitignore
index 2eda3d592..739bc992b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,5 +8,5 @@ __pycache__
.coverage
.vscode
src/_features.h
-netplan/_features.py
+netplan_cli/_features.py
dbus/io.netplan.Netplan.service
diff --git a/Makefile b/Makefile
index f1f129823..6426ce753 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
DESTDIR ?= ../tmproot
default: _build
- meson compile -C _build
+ meson compile -C _build --verbose
_build:
meson setup _build --prefix=/usr
@@ -12,7 +12,7 @@ _build-cov:
meson setup _build-cov --prefix=/usr -Db_coverage=true
clean:
- rm -f netplan/_features.py src/_features.h src/_features.h.gch
+ rm -f netplan_cli/_features.py src/_features.h src/_features.h.gch
rm -f generate doc/*.html doc/*.[1-9]
rm -f *.o *.so*
rm -f netplan-dbus dbus/*.service
@@ -35,7 +35,7 @@ linting: _build
meson test -C _build --verbose codestyle
pre-coverage: _build-cov
- meson compile -C _build-cov
+ meson compile -C _build-cov --verbose
check-coverage: pre-coverage
meson test -C _build-cov
diff --git a/features_py_generator.sh b/features_py_generator.sh
index bbbe3a4e3..695c304e6 100755
--- a/features_py_generator.sh
+++ b/features_py_generator.sh
@@ -1,6 +1,6 @@
#!/bin/sh
BASE=$(dirname $0)
-OUTPUT=$BASE/netplan/_features.py
+OUTPUT=$BASE/netplan_cli/_features.py
INPUT=$BASE/src/[!_]*.[hc]
echo "# Generated file" > $OUTPUT
echo "NETPLAN_FEATURE_FLAGS = [" >> $OUTPUT
diff --git a/meson.build b/meson.build
index 35974852b..bce385c09 100644
--- a/meson.build
+++ b/meson.build
@@ -39,7 +39,7 @@ inc = include_directories('include')
subdir('include')
subdir('src')
subdir('dbus')
-subdir('netplan')
+subdir('netplan_cli')
subdir('examples')
subdir('doc')
diff --git a/netplan/__init__.py b/netplan_cli/__init__.py
similarity index 95%
rename from netplan/__init__.py
rename to netplan_cli/__init__.py
index 6e4e92240..a54e15f7a 100644
--- a/netplan/__init__.py
+++ b/netplan_cli/__init__.py
@@ -15,6 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from netplan.cli.core import Netplan
+from .cli.core import Netplan
__all__ = [Netplan]
diff --git a/netplan/cli/__init__.py b/netplan_cli/cli/__init__.py
similarity index 100%
rename from netplan/cli/__init__.py
rename to netplan_cli/cli/__init__.py
diff --git a/netplan/cli/commands/__init__.py b/netplan_cli/cli/commands/__init__.py
similarity index 63%
rename from netplan/cli/commands/__init__.py
rename to netplan_cli/cli/commands/__init__.py
index 67541869f..2ac600321 100644
--- a/netplan/cli/commands/__init__.py
+++ b/netplan_cli/cli/commands/__init__.py
@@ -15,16 +15,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from netplan.cli.commands.apply import NetplanApply
-from netplan.cli.commands.generate import NetplanGenerate
-from netplan.cli.commands.ip import NetplanIp
-from netplan.cli.commands.migrate import NetplanMigrate
-from netplan.cli.commands.try_command import NetplanTry
-from netplan.cli.commands.info import NetplanInfo
-from netplan.cli.commands.set import NetplanSet
-from netplan.cli.commands.get import NetplanGet
-from netplan.cli.commands.sriov_rebind import NetplanSriovRebind
-from netplan.cli.commands.status import NetplanStatus
+from .apply import NetplanApply
+from .generate import NetplanGenerate
+from .ip import NetplanIp
+from .migrate import NetplanMigrate
+from .try_command import NetplanTry
+from .info import NetplanInfo
+from .set import NetplanSet
+from .get import NetplanGet
+from .sriov_rebind import NetplanSriovRebind
+from .status import NetplanStatus
__all__ = [
'NetplanApply',
diff --git a/netplan/cli/commands/apply.py b/netplan_cli/cli/commands/apply.py
similarity index 98%
rename from netplan/cli/commands/apply.py
rename to netplan_cli/cli/commands/apply.py
index 49d971d95..59bef4fb9 100644
--- a/netplan/cli/commands/apply.py
+++ b/netplan_cli/cli/commands/apply.py
@@ -28,10 +28,10 @@
import netifaces
import time
-import netplan.cli.utils as utils
-from netplan.configmanager import ConfigManager, ConfigurationError
-from netplan.cli.sriov import apply_sriov_config
-from netplan.cli.ovs import OvsDbServerNotRunning, apply_ovs_cleanup
+from .. import utils
+from ...configmanager import ConfigManager, ConfigurationError
+from ..sriov import apply_sriov_config
+from ..ovs import OvsDbServerNotRunning, apply_ovs_cleanup
OVS_CLEANUP_SERVICE = 'netplan-ovs-cleanup.service'
diff --git a/netplan/cli/commands/generate.py b/netplan_cli/cli/commands/generate.py
similarity index 99%
rename from netplan/cli/commands/generate.py
rename to netplan_cli/cli/commands/generate.py
index f7c645be1..f84b1710e 100644
--- a/netplan/cli/commands/generate.py
+++ b/netplan_cli/cli/commands/generate.py
@@ -23,7 +23,7 @@
import subprocess
import shutil
-import netplan.cli.utils as utils
+from .. import utils
class NetplanGenerate(utils.NetplanCommand):
diff --git a/netplan/cli/commands/get.py b/netplan_cli/cli/commands/get.py
similarity index 88%
rename from netplan/cli/commands/get.py
rename to netplan_cli/cli/commands/get.py
index f4c166917..28bfad3d5 100644
--- a/netplan/cli/commands/get.py
+++ b/netplan_cli/cli/commands/get.py
@@ -1,7 +1,7 @@
#!/usr/bin/python3
#
-# Copyright (C) 2020 Canonical, Ltd.
-# Author: Lukas Märdian
+# Copyright (C) 2020-2023 Canonical, Ltd.
+# Author: Lukas Märdian
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
'''netplan get command line'''
-from netplan.cli.state import NetplanConfigState
-import netplan.cli.utils as utils
+from ..state import NetplanConfigState
+from .. import utils
class NetplanGet(utils.NetplanCommand):
diff --git a/netplan/cli/commands/info.py b/netplan_cli/cli/commands/info.py
similarity index 92%
rename from netplan/cli/commands/info.py
rename to netplan_cli/cli/commands/info.py
index 2b5afe14b..832a87355 100644
--- a/netplan/cli/commands/info.py
+++ b/netplan_cli/cli/commands/info.py
@@ -17,8 +17,8 @@
'''netplan info command line'''
-import netplan.cli.utils as utils
-import netplan._features
+from .. import utils
+from ... import _features
class NetplanInfo(utils.NetplanCommand):
@@ -49,7 +49,7 @@ def command_info(self):
}
}
- flags = netplan._features.NETPLAN_FEATURE_FLAGS
+ flags = _features.NETPLAN_FEATURE_FLAGS
netplan_version['netplan.io'].update({'features': flags})
# Default to output in YAML format.
@@ -64,5 +64,5 @@ def command_info(self):
print('''netplan.io:
website: "{}"
features:'''.format(netplan_version['netplan.io']['website']))
- for feature in netplan._features.NETPLAN_FEATURE_FLAGS:
+ for feature in _features.NETPLAN_FEATURE_FLAGS:
print(' - ' + feature)
diff --git a/netplan/cli/commands/ip.py b/netplan_cli/cli/commands/ip.py
similarity index 99%
rename from netplan/cli/commands/ip.py
rename to netplan_cli/cli/commands/ip.py
index f875794ad..1bc3f8d1b 100644
--- a/netplan/cli/commands/ip.py
+++ b/netplan_cli/cli/commands/ip.py
@@ -23,7 +23,7 @@
import subprocess
from subprocess import CalledProcessError
-import netplan.cli.utils as utils
+from .. import utils
lease_path = {
'networkd': {
diff --git a/netplan/cli/commands/migrate.py b/netplan_cli/cli/commands/migrate.py
similarity index 99%
rename from netplan/cli/commands/migrate.py
rename to netplan_cli/cli/commands/migrate.py
index 94944dd3e..b9629d026 100644
--- a/netplan/cli/commands/migrate.py
+++ b/netplan_cli/cli/commands/migrate.py
@@ -30,7 +30,7 @@
from collections import OrderedDict
import ipaddress
-import netplan.cli.utils as utils
+from .. import utils
class NetplanMigrate(utils.NetplanCommand):
diff --git a/netplan/cli/commands/set.py b/netplan_cli/cli/commands/set.py
similarity index 98%
rename from netplan/cli/commands/set.py
rename to netplan_cli/cli/commands/set.py
index 04d6e5536..2e6ba634b 100644
--- a/netplan/cli/commands/set.py
+++ b/netplan_cli/cli/commands/set.py
@@ -21,8 +21,8 @@
import re
import io
-from netplan.cli.utils import NetplanCommand
-import netplan.libnetplan as libnetplan
+from ..utils import NetplanCommand
+from ... import libnetplan
FALLBACK_FILENAME = '70-netplan-set.yaml'
GLOBAL_KEYS = ['renderer', 'version']
diff --git a/netplan/cli/commands/sriov_rebind.py b/netplan_cli/cli/commands/sriov_rebind.py
similarity index 94%
rename from netplan/cli/commands/sriov_rebind.py
rename to netplan_cli/cli/commands/sriov_rebind.py
index 6a73e1265..373d9c82b 100644
--- a/netplan/cli/commands/sriov_rebind.py
+++ b/netplan_cli/cli/commands/sriov_rebind.py
@@ -19,8 +19,8 @@
import logging
-import netplan.cli.utils as utils
-from netplan.cli.sriov import PCIDevice, bind_vfs, _get_pci_slot_name
+from .. import utils
+from ..sriov import PCIDevice, bind_vfs, _get_pci_slot_name
class NetplanSriovRebind(utils.NetplanCommand):
diff --git a/netplan/cli/commands/status.py b/netplan_cli/cli/commands/status.py
similarity index 99%
rename from netplan/cli/commands/status.py
rename to netplan_cli/cli/commands/status.py
index 9c63d502a..51d7438da 100644
--- a/netplan/cli/commands/status.py
+++ b/netplan_cli/cli/commands/status.py
@@ -24,8 +24,8 @@
from rich.highlighter import RegexHighlighter
from rich.theme import Theme
-import netplan.cli.utils as utils
-from netplan.cli.state import SystemConfigState, JSON
+from .. import utils
+from ..state import SystemConfigState, JSON
class NetplanHighlighter(RegexHighlighter):
diff --git a/netplan/cli/commands/try_command.py b/netplan_cli/cli/commands/try_command.py
similarity index 94%
rename from netplan/cli/commands/try_command.py
rename to netplan_cli/cli/commands/try_command.py
index 1a433b76e..0b6f81df9 100644
--- a/netplan/cli/commands/try_command.py
+++ b/netplan_cli/cli/commands/try_command.py
@@ -25,11 +25,11 @@
import sys
import tempfile
-from netplan.configmanager import ConfigManager
-import netplan.cli.utils as utils
-from netplan.cli.commands.apply import NetplanApply
-import netplan.terminal
-import netplan.libnetplan as libnetplan
+from ...configmanager import ConfigManager
+from .. import utils
+from .apply import NetplanApply
+from ... import terminal
+from ... import libnetplan
# Keep a timeout long enough to allow the network to converge, 60 seconds may
# be slightly short given some complex configs, i.e. if STP must reconverge.
@@ -88,7 +88,7 @@ def command_try(self): # pragma: nocover (requires user input)
try:
fd = sys.stdin.fileno()
- self.t = netplan.terminal.Terminal(fd)
+ self.t = terminal.Terminal(fd)
self.t.save(self.t_settings)
# we really don't want to be interrupted while doing backup/revert operations
@@ -104,10 +104,10 @@ def command_try(self): # pragma: nocover (requires user input)
# ready to accept any Accept/Reject input (like SIGUSR1 or SIGTERM)
self.touch_ready_stamp()
self.t.get_confirmation_input(timeout=self.timeout)
- except netplan.terminal.InputRejected:
+ except terminal.InputRejected:
print("\nReverting.")
self.revert()
- except netplan.terminal.InputAccepted:
+ except terminal.InputAccepted:
print("\nConfiguration accepted.")
except Exception as e:
print("\nAn error occurred: %s" % e)
@@ -196,7 +196,7 @@ def is_revertable(self):
def _signal_handler(self, sig, frame): # pragma: nocover (requires user input)
if sig == signal.SIGUSR1:
- raise netplan.terminal.InputAccepted()
+ raise terminal.InputAccepted()
else:
if self.configuration_changed:
- raise netplan.terminal.InputRejected()
+ raise terminal.InputRejected()
diff --git a/netplan/cli/core.py b/netplan_cli/cli/core.py
similarity index 89%
rename from netplan/cli/core.py
rename to netplan_cli/cli/core.py
index 1843ec8bb..f2e673616 100644
--- a/netplan/cli/core.py
+++ b/netplan_cli/cli/core.py
@@ -21,8 +21,8 @@
import logging
import os
-import netplan.cli.utils as utils
-from netplan.libnetplan import NetplanException, NetplanValidationException, NetplanParserException
+from . import utils
+from ..libnetplan import NetplanException, NetplanValidationException, NetplanParserException
FALLBACK_PATH = '/usr/bin:/snap/bin'
@@ -39,9 +39,9 @@ def __init__(self):
'PATH': os.getenv('PATH', FALLBACK_PATH)})
def parse_args(self):
- import netplan.cli.commands
+ from . import commands as cli_commands
- self._import_subcommands(netplan.cli.commands)
+ self._import_subcommands(cli_commands)
super().parse_args()
diff --git a/netplan/cli/ovs.py b/netplan_cli/cli/ovs.py
similarity index 99%
rename from netplan/cli/ovs.py
rename to netplan_cli/cli/ovs.py
index 80badd355..dde682000 100644
--- a/netplan/cli/ovs.py
+++ b/netplan_cli/cli/ovs.py
@@ -20,7 +20,7 @@
import subprocess
import re
-from netplan.cli.utils import systemctl_is_active
+from .utils import systemctl_is_active
OPENVSWITCH_OVS_VSCTL = '/usr/bin/ovs-vsctl'
OPENVSWITCH_OVSDB_SERVER_UNIT = 'ovsdb-server.service'
diff --git a/netplan/cli/sriov.py b/netplan_cli/cli/sriov.py
similarity index 99%
rename from netplan/cli/sriov.py
rename to netplan_cli/cli/sriov.py
index 34353accf..fbe4f5df2 100644
--- a/netplan/cli/sriov.py
+++ b/netplan_cli/cli/sriov.py
@@ -23,9 +23,9 @@
from collections import defaultdict
-import netplan.cli.utils as utils
-import netplan.libnetplan as libnetplan
-from netplan.configmanager import ConfigurationError
+from . import utils
+from .. import libnetplan
+from ..configmanager import ConfigurationError
import netifaces
diff --git a/netplan/cli/state.py b/netplan_cli/cli/state.py
similarity index 99%
rename from netplan/cli/state.py
rename to netplan_cli/cli/state.py
index ecc3f7ae9..500eaca2c 100644
--- a/netplan/cli/state.py
+++ b/netplan_cli/cli/state.py
@@ -31,8 +31,8 @@
import dbus
-import netplan.cli.utils as utils
-import netplan.libnetplan as libnetplan
+from . import utils
+from .. import libnetplan
JSON = Union[Dict[str, 'JSON'], List['JSON'], int, str, float, bool, Type[None]]
diff --git a/netplan/cli/utils.py b/netplan_cli/cli/utils.py
similarity index 98%
rename from netplan/cli/utils.py
rename to netplan_cli/cli/utils.py
index 3435168c1..1449ee192 100644
--- a/netplan/cli/utils.py
+++ b/netplan_cli/cli/utils.py
@@ -24,9 +24,9 @@
import fnmatch
import re
-import netplan.libnetplan as np
-from netplan.configmanager import ConfigurationError
-from netplan.libnetplan import NetplanException
+from .. import libnetplan as np
+from ..configmanager import ConfigurationError
+from ..libnetplan import NetplanException
NM_SERVICE_NAME = 'NetworkManager.service'
diff --git a/netplan/configmanager.py b/netplan_cli/configmanager.py
similarity index 99%
rename from netplan/configmanager.py
rename to netplan_cli/configmanager.py
index bacbd7f39..ac7c6fee3 100644
--- a/netplan/configmanager.py
+++ b/netplan_cli/configmanager.py
@@ -25,7 +25,7 @@
from typing import Optional
-from netplan import libnetplan
+from . import libnetplan
class ConfigManager(object):
diff --git a/netplan/libnetplan.py b/netplan_cli/libnetplan.py
similarity index 100%
rename from netplan/libnetplan.py
rename to netplan_cli/libnetplan.py
diff --git a/netplan/meson.build b/netplan_cli/meson.build
similarity index 98%
rename from netplan/meson.build
rename to netplan_cli/meson.build
index 952db3cb8..a51578c93 100644
--- a/netplan/meson.build
+++ b/netplan_cli/meson.build
@@ -4,7 +4,7 @@ install_symlink(
pointing_to: '../share/netplan/netplan.script',
install_dir: get_option('sbindir'))
-netplan_module = join_paths(get_option('datadir'), meson.project_name(), 'netplan')
+netplan_module = join_paths(get_option('datadir'), meson.project_name(), 'netplan_cli')
features_py = custom_target(
build_always_stale: true,
output: '_features.py',
diff --git a/netplan/terminal.py b/netplan_cli/terminal.py
similarity index 100%
rename from netplan/terminal.py
rename to netplan_cli/terminal.py
diff --git a/src/netplan.script b/src/netplan.script
index 3c131f608..334970afb 100755
--- a/src/netplan.script
+++ b/src/netplan.script
@@ -17,7 +17,7 @@
'''netplan command line'''
-from netplan import Netplan
+from netplan_cli import Netplan
netplan = Netplan()
netplan.main()
diff --git a/tests/cli/test_get_set.py b/tests/cli/test_get_set.py
index 277dd9653..4deebc141 100644
--- a/tests/cli/test_get_set.py
+++ b/tests/cli/test_get_set.py
@@ -25,8 +25,8 @@
import yaml
-from netplan.cli.commands.set import FALLBACK_FILENAME
-from netplan.libnetplan import NetplanException
+from netplan_cli.cli.commands.set import FALLBACK_FILENAME
+from netplan_cli.libnetplan import NetplanException
from tests.test_utils import call_cli
diff --git a/tests/cli/test_state.py b/tests/cli/test_state.py
index 1b91f4f72..0cf617ecc 100644
--- a/tests/cli/test_state.py
+++ b/tests/cli/test_state.py
@@ -27,7 +27,7 @@
import yaml
from unittest.mock import patch, call, mock_open
-from netplan.cli.state import Interface, NetplanConfigState, SystemConfigState
+from netplan_cli.cli.state import Interface, NetplanConfigState, SystemConfigState
from .test_status import (DNS_ADDRESSES, DNS_IP4, DNS_SEARCH, FAKE_DEV,
IPROUTE2, NETWORKD, NMCLI, ROUTE4, ROUTE6)
@@ -214,14 +214,14 @@ def test_query_online_state_offline(self):
res = SystemConfigState.query_online_state([Interface(FAKE_DEV, [])])
self.assertFalse(res)
- @patch('netplan.cli.utils.systemctl')
- @patch('netplan.cli.state.SystemConfigState.query_iproute2')
- @patch('netplan.cli.state.SystemConfigState.query_networkd')
- @patch('netplan.cli.state.SystemConfigState.query_nm')
- @patch('netplan.cli.state.SystemConfigState.query_routes')
- @patch('netplan.cli.state.SystemConfigState.query_resolved')
- @patch('netplan.cli.state.SystemConfigState.resolvconf_json')
- @patch('netplan.cli.state.SystemConfigState.query_online_state')
+ @patch('netplan_cli.cli.utils.systemctl')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_iproute2')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_networkd')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_nm')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_routes')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_resolved')
+ @patch('netplan_cli.cli.state.SystemConfigState.resolvconf_json')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_online_state')
def test_system_state_config_data_interfaces(self, online_mock, resolvconf_mock, rd_mock,
routes_mock, nm_mock, networkd_mock, iproute2_mock,
systemctl_mock):
@@ -317,8 +317,8 @@ def test_query_networkctl_fail(self, mock):
self.assertIsNone(res)
self.assertIn('WARNING:root:Cannot query networkctl for {}:'.format(dev), cm.output[0])
- @patch('netplan.cli.state.Interface.query_nm_ssid')
- @patch('netplan.cli.state.Interface.query_networkctl')
+ @patch('netplan_cli.cli.state.Interface.query_nm_ssid')
+ @patch('netplan_cli.cli.state.Interface.query_networkctl')
def test_json_nm_wlan0(self, networkctl_mock, nm_ssid_mock):
SSID = 'MYCON'
nm_ssid_mock.return_value = SSID
@@ -351,7 +351,7 @@ def test_json_nm_wlan0(self, networkctl_mock, nm_ssid_mock):
self.assertEqual(len(json.get('dns_search')), 1)
self.assertEqual(len(json.get('routes')), 6)
- @patch('netplan.cli.state.Interface.query_networkctl')
+ @patch('netplan_cli.cli.state.Interface.query_networkctl')
def test_json_nd_enp0s31f6(self, networkctl_mock):
# networkctl mock output reduced to relevant lines
networkctl_mock.return_value = 'Activation Policy: manual'
diff --git a/tests/cli/test_status.py b/tests/cli/test_status.py
index 492f12e9c..23df5a681 100644
--- a/tests/cli/test_status.py
+++ b/tests/cli/test_status.py
@@ -23,8 +23,8 @@
from contextlib import redirect_stdout
from unittest.mock import patch
-from netplan.cli.commands.status import NetplanStatus
-from netplan.cli.state import Interface, SystemConfigState
+from netplan_cli.cli.commands.status import NetplanStatus
+from netplan_cli.cli.state import Interface, SystemConfigState
from tests.test_utils import call_cli
@@ -53,8 +53,8 @@ def _call(self, args):
def _get_itf(self, ifname):
return next((itf for itf in yaml.safe_load(IPROUTE2) if itf['ifname'] == ifname), None)
- @patch('netplan.cli.state.Interface.query_nm_ssid')
- @patch('netplan.cli.state.Interface.query_networkctl')
+ @patch('netplan_cli.cli.state.Interface.query_nm_ssid')
+ @patch('netplan_cli.cli.state.Interface.query_networkctl')
def test_pretty_print(self, networkctl_mock, nm_ssid_mock):
SSID = 'MYCON'
nm_ssid_mock.return_value = SSID
@@ -145,14 +145,14 @@ def test_pretty_print(self, networkctl_mock, nm_ssid_mock):
1 inactive interfaces hidden. Use "--all" to show all.
''')
- @patch('netplan.cli.utils.systemctl')
- @patch('netplan.cli.state.SystemConfigState.query_iproute2')
- @patch('netplan.cli.state.SystemConfigState.query_networkd')
- @patch('netplan.cli.state.SystemConfigState.query_nm')
- @patch('netplan.cli.state.SystemConfigState.query_routes')
- @patch('netplan.cli.state.SystemConfigState.query_resolved')
- @patch('netplan.cli.state.SystemConfigState.resolvconf_json')
- @patch('netplan.cli.state.SystemConfigState.query_online_state')
+ @patch('netplan_cli.cli.utils.systemctl')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_iproute2')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_networkd')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_nm')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_routes')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_resolved')
+ @patch('netplan_cli.cli.state.SystemConfigState.resolvconf_json')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_online_state')
def test_call_cli(self, online_mock, resolvconf_mock, rd_mock, routes_mock, nm_mock, networkd_mock, iproute2_mock,
systemctl_mock):
systemctl_mock.return_value = None
@@ -170,9 +170,9 @@ def test_call_cli(self, online_mock, resolvconf_mock, rd_mock, routes_mock, nm_m
● 42: fakedev0 other DOWN (unmanaged)''')
- @patch('netplan.cli.utils.systemctl')
- @patch('netplan.cli.state.SystemConfigState.query_iproute2')
- @patch('netplan.cli.state.SystemConfigState.query_networkd')
+ @patch('netplan_cli.cli.utils.systemctl')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_iproute2')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_networkd')
def test_fail_cli(self, networkd_mock, iproute2_mock, systemctl_mock):
systemctl_mock.return_value = None
iproute2_mock.return_value = [FAKE_DEV]
@@ -180,14 +180,14 @@ def test_fail_cli(self, networkd_mock, iproute2_mock, systemctl_mock):
with self.assertRaises(SystemExit):
self._call([])
- @patch('netplan.cli.utils.systemctl')
- @patch('netplan.cli.state.SystemConfigState.query_iproute2')
- @patch('netplan.cli.state.SystemConfigState.query_networkd')
- @patch('netplan.cli.state.SystemConfigState.query_nm')
- @patch('netplan.cli.state.SystemConfigState.query_routes')
- @patch('netplan.cli.state.SystemConfigState.query_resolved')
- @patch('netplan.cli.state.SystemConfigState.resolvconf_json')
- @patch('netplan.cli.state.SystemConfigState.query_online_state')
+ @patch('netplan_cli.cli.utils.systemctl')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_iproute2')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_networkd')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_nm')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_routes')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_resolved')
+ @patch('netplan_cli.cli.state.SystemConfigState.resolvconf_json')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_online_state')
def test_call_cli_ifname(self, online_mock, resolvconf_mock, rd_mock, routes_mock, nm_mock, networkd_mock, iproute2_mock,
systemctl_mock):
systemctl_mock.return_value = None
@@ -207,14 +207,14 @@ def test_call_cli_ifname(self, online_mock, resolvconf_mock, rd_mock, routes_moc
1 inactive interfaces hidden. Use "--all" to show all.''')
- @patch('netplan.cli.utils.systemctl')
- @patch('netplan.cli.state.SystemConfigState.query_iproute2')
- @patch('netplan.cli.state.SystemConfigState.query_networkd')
- @patch('netplan.cli.state.SystemConfigState.query_nm')
- @patch('netplan.cli.state.SystemConfigState.query_routes')
- @patch('netplan.cli.state.SystemConfigState.query_resolved')
- @patch('netplan.cli.state.SystemConfigState.resolvconf_json')
- @patch('netplan.cli.state.SystemConfigState.query_online_state')
+ @patch('netplan_cli.cli.utils.systemctl')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_iproute2')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_networkd')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_nm')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_routes')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_resolved')
+ @patch('netplan_cli.cli.state.SystemConfigState.resolvconf_json')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_online_state')
def test_fail_cli_ifname(self, online_mock, resolvconf_mock, rd_mock, routes_mock, nm_mock, networkd_mock, iproute2_mock,
systemctl_mock):
systemctl_mock.return_value = None
@@ -229,14 +229,14 @@ def test_fail_cli_ifname(self, online_mock, resolvconf_mock, rd_mock, routes_moc
with self.assertRaises(SystemExit):
self._call(['notaninteface0'])
- @patch('netplan.cli.utils.systemctl')
- @patch('netplan.cli.state.SystemConfigState.query_iproute2')
- @patch('netplan.cli.state.SystemConfigState.query_networkd')
- @patch('netplan.cli.state.SystemConfigState.query_nm')
- @patch('netplan.cli.state.SystemConfigState.query_routes')
- @patch('netplan.cli.state.SystemConfigState.query_resolved')
- @patch('netplan.cli.state.SystemConfigState.resolvconf_json')
- @patch('netplan.cli.state.SystemConfigState.query_online_state')
+ @patch('netplan_cli.cli.utils.systemctl')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_iproute2')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_networkd')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_nm')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_routes')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_resolved')
+ @patch('netplan_cli.cli.state.SystemConfigState.resolvconf_json')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_online_state')
def test_call_cli_json(self, online_mock, resolvconf_mock, rd_mock, routes_mock, nm_mock, networkd_mock, iproute2_mock,
systemctl_mock):
systemctl_mock.return_value = None
@@ -253,14 +253,14 @@ def test_call_cli_json(self, online_mock, resolvconf_mock, rd_mock, routes_mock,
"netplan-global-state": {"online": false, "nameservers": {"addresses": [], "search": [], "mode": null}}, \
"fakedev0": {"index": 42, "adminstate": "DOWN", "operstate": "DOWN"}}\n''')
- @patch('netplan.cli.utils.systemctl')
- @patch('netplan.cli.state.SystemConfigState.query_iproute2')
- @patch('netplan.cli.state.SystemConfigState.query_networkd')
- @patch('netplan.cli.state.SystemConfigState.query_nm')
- @patch('netplan.cli.state.SystemConfigState.query_routes')
- @patch('netplan.cli.state.SystemConfigState.query_resolved')
- @patch('netplan.cli.state.SystemConfigState.resolvconf_json')
- @patch('netplan.cli.state.SystemConfigState.query_online_state')
+ @patch('netplan_cli.cli.utils.systemctl')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_iproute2')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_networkd')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_nm')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_routes')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_resolved')
+ @patch('netplan_cli.cli.state.SystemConfigState.resolvconf_json')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_online_state')
def test_call_cli_yaml(self, online_mock, resolvconf_mock, rd_mock, routes_mock, nm_mock, networkd_mock, iproute2_mock,
systemctl_mock):
systemctl_mock.return_value = None
@@ -285,15 +285,15 @@ def test_call_cli_yaml(self, online_mock, resolvconf_mock, rd_mock, routes_mock,
search: []
online: false'''.strip())
- @patch('netplan.cli.state.SystemConfigState.query_iproute2')
- @patch('netplan.cli.state.SystemConfigState.query_networkd')
- @patch('netplan.cli.state.SystemConfigState.query_nm')
- @patch('netplan.cli.state.SystemConfigState.query_routes')
- @patch('netplan.cli.state.SystemConfigState.query_resolved')
- @patch('netplan.cli.state.SystemConfigState.resolvconf_json')
- @patch('netplan.cli.state.SystemConfigState.query_online_state')
- @patch('netplan.cli.utils.systemctl_is_active')
- @patch('netplan.cli.utils.systemctl')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_iproute2')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_networkd')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_nm')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_routes')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_resolved')
+ @patch('netplan_cli.cli.state.SystemConfigState.resolvconf_json')
+ @patch('netplan_cli.cli.state.SystemConfigState.query_online_state')
+ @patch('netplan_cli.cli.utils.systemctl_is_active')
+ @patch('netplan_cli.cli.utils.systemctl')
def test_call_cli_no_networkd(self, systemctl_mock, is_active_mock,
online_mock, resolvconf_mock, rd_mock,
routes_mock, nm_mock, networkd_mock,
@@ -313,8 +313,8 @@ def test_call_cli_no_networkd(self, systemctl_mock, is_active_mock,
cm.output[0])
systemctl_mock.assert_called_with('start', ['systemd-networkd.service'], True)
- @patch('netplan.cli.utils.systemctl_is_active')
- @patch('netplan.cli.utils.systemctl_is_masked')
+ @patch('netplan_cli.cli.utils.systemctl_is_active')
+ @patch('netplan_cli.cli.utils.systemctl_is_masked')
def test_call_cli_networkd_masked(self, is_masked_mock, is_active_mock):
is_active_mock.return_value = False
is_masked_mock.return_value = True
diff --git a/tests/cli/test_units.py b/tests/cli/test_units.py
index cfcbe8b62..5d8506eec 100644
--- a/tests/cli/test_units.py
+++ b/tests/cli/test_units.py
@@ -25,9 +25,9 @@
import tempfile
from unittest.mock import patch
-from netplan.cli.commands.apply import NetplanApply
-from netplan.cli.commands.try_command import NetplanTry
-from netplan.cli.core import Netplan
+from netplan_cli.cli.commands.apply import NetplanApply
+from netplan_cli.cli.commands.try_command import NetplanTry
+from netplan_cli.cli.core import Netplan
class TestCLI(unittest.TestCase):
diff --git a/tests/parser/base.py b/tests/parser/base.py
index 944187536..0ef924146 100644
--- a/tests/parser/base.py
+++ b/tests/parser/base.py
@@ -19,7 +19,7 @@
# along with this program. If not, see .
from configparser import ConfigParser
-from netplan.libnetplan import _NetplanError
+from netplan_cli.libnetplan import _NetplanError
import os
import re
import sys
diff --git a/tests/test_configmanager.py b/tests/test_configmanager.py
index e88b9eaf6..f03889282 100644
--- a/tests/test_configmanager.py
+++ b/tests/test_configmanager.py
@@ -21,7 +21,7 @@
import tempfile
import unittest
-from netplan.configmanager import ConfigManager, ConfigurationError
+from netplan_cli.configmanager import ConfigManager, ConfigurationError
class TestConfigManager(unittest.TestCase):
diff --git a/tests/test_libnetplan.py b/tests/test_libnetplan.py
index 9e0e78122..00299465d 100644
--- a/tests/test_libnetplan.py
+++ b/tests/test_libnetplan.py
@@ -28,9 +28,9 @@
from tests.test_utils import MockCmd
from utils import state_from_yaml
-from netplan.cli.commands.set import FALLBACK_FILENAME
+from netplan_cli.cli.commands.set import FALLBACK_FILENAME
-import netplan.libnetplan as libnetplan
+import netplan_cli.libnetplan as libnetplan
lib = libnetplan.lib
rootdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
diff --git a/tests/test_ovs.py b/tests/test_ovs.py
index 0ab46a2ad..a0734aa3e 100644
--- a/tests/test_ovs.py
+++ b/tests/test_ovs.py
@@ -18,9 +18,9 @@
import unittest
from unittest.mock import patch, call
-from netplan.cli.ovs import OPENVSWITCH_OVS_VSCTL as OVS
+from netplan_cli.cli.ovs import OPENVSWITCH_OVS_VSCTL as OVS
-import netplan.cli.ovs as ovs
+import netplan_cli.cli.ovs as ovs
from utils import state_from_yaml
import tempfile
diff --git a/tests/test_sriov.py b/tests/test_sriov.py
index 39a963cb7..2287895c2 100644
--- a/tests/test_sriov.py
+++ b/tests/test_sriov.py
@@ -24,10 +24,10 @@
from collections import defaultdict
from unittest.mock import patch, mock_open, call
-import netplan.cli.sriov as sriov
-import netplan.libnetplan as libnetplan
+import netplan_cli.cli.sriov as sriov
+import netplan_cli.libnetplan as libnetplan
-from netplan.configmanager import ConfigManager, ConfigurationError
+from netplan_cli.configmanager import ConfigManager, ConfigurationError
from generator.base import TestBase
from tests.test_utils import call_cli
@@ -143,8 +143,8 @@ def _prepare_sysfs_dir_structure(self, pf=('enp2', '0000:00:1f.0'),
for i in range(len(vfs)):
os.symlink(os.path.join('../../..', vfs[i][1]), os.path.join(pf_dev_path, 'virtfn'+str(i)))
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_get_vf_count_and_functions(self, gim, gidn):
# we mock-out get_interface_driver_name and get_interface_macaddress
# to return useful values for the test
@@ -214,8 +214,8 @@ def test_get_vf_count_and_functions(self, gim, gidn):
{'enp1': 'enp1', 'enp2': 'enp2', 'enp3': 'enp3',
'enpx': 'enp5', 'enp8': 'enp8'})
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_get_vf_count_and_functions_set_name(self, gim, gidn):
# we mock-out get_interface_driver_name and get_interface_macaddress
# to return useful values for the test
@@ -263,8 +263,8 @@ def test_get_vf_count_and_functions_set_name(self, gim, gidn):
pfs,
{'enp1': 'pf1', 'enp8': 'enp8'})
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_get_vf_count_and_functions_many_match(self, gim, gidn):
# we mock-out get_interface_driver_name and get_interface_macaddress
# to return useful values for the test
@@ -297,8 +297,8 @@ def test_get_vf_count_and_functions_many_match(self, gim, gidn):
self.assertIn('matched more than one interface for a PF device: enpx',
str(e.exception))
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_get_vf_count_and_functions_not_enough_explicit(self, gim, gidn):
# we mock-out get_interface_driver_name and get_interface_macaddress
# to return useful values for the test
@@ -476,12 +476,12 @@ def test_apply_vlan_filter_for_vf_failed_ip_link_set(self, check_call):
str(e.exception))
@patch('netifaces.interfaces')
- @patch('netplan.cli.sriov.get_vf_count_and_functions')
- @patch('netplan.cli.sriov.set_numvfs_for_pf')
- @patch('netplan.cli.sriov.perform_hardware_specific_quirks')
- @patch('netplan.cli.sriov.apply_vlan_filter_for_vf')
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.sriov.get_vf_count_and_functions')
+ @patch('netplan_cli.cli.sriov.set_numvfs_for_pf')
+ @patch('netplan_cli.cli.sriov.perform_hardware_specific_quirks')
+ @patch('netplan_cli.cli.sriov.apply_vlan_filter_for_vf')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_apply_sriov_config(self, gim, gidn, apply_vlan, quirks,
set_numvfs, get_counts, netifs):
# set up the environment
@@ -536,12 +536,12 @@ def test_apply_sriov_config(self, gim, gidn, apply_vlan, quirks,
apply_vlan.assert_called_once_with('enp2', 'enp2s16f1', 'vf1.15', 15)
@patch('netifaces.interfaces')
- @patch('netplan.cli.sriov.get_vf_count_and_functions')
- @patch('netplan.cli.sriov.set_numvfs_for_pf')
- @patch('netplan.cli.sriov.perform_hardware_specific_quirks')
- @patch('netplan.cli.sriov.apply_vlan_filter_for_vf')
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.sriov.get_vf_count_and_functions')
+ @patch('netplan_cli.cli.sriov.set_numvfs_for_pf')
+ @patch('netplan_cli.cli.sriov.perform_hardware_specific_quirks')
+ @patch('netplan_cli.cli.sriov.apply_vlan_filter_for_vf')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_apply_sriov_config_invalid_vlan(self, gim, gidn, apply_vlan, quirks,
set_numvfs, get_counts, netifs):
# set up the environment
@@ -604,12 +604,12 @@ def test_apply_sriov_invalid_link_no_vf(self):
logs.output[0])
@patch('netifaces.interfaces')
- @patch('netplan.cli.sriov.get_vf_count_and_functions')
- @patch('netplan.cli.sriov.set_numvfs_for_pf')
- @patch('netplan.cli.sriov.perform_hardware_specific_quirks')
- @patch('netplan.cli.sriov.apply_vlan_filter_for_vf')
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.sriov.get_vf_count_and_functions')
+ @patch('netplan_cli.cli.sriov.set_numvfs_for_pf')
+ @patch('netplan_cli.cli.sriov.perform_hardware_specific_quirks')
+ @patch('netplan_cli.cli.sriov.apply_vlan_filter_for_vf')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_apply_sriov_config_too_many_vlans(self, gim, gidn, apply_vlan, quirks,
set_numvfs, get_counts, netifs):
# set up the environment
@@ -659,12 +659,12 @@ def test_apply_sriov_config_too_many_vlans(self, gim, gidn, apply_vlan, quirks,
self.assertEqual(apply_vlan.call_count, 1)
@patch('netifaces.interfaces')
- @patch('netplan.cli.sriov.get_vf_count_and_functions')
- @patch('netplan.cli.sriov.set_numvfs_for_pf')
- @patch('netplan.cli.sriov.perform_hardware_specific_quirks')
- @patch('netplan.cli.sriov.apply_vlan_filter_for_vf')
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.sriov.get_vf_count_and_functions')
+ @patch('netplan_cli.cli.sriov.set_numvfs_for_pf')
+ @patch('netplan_cli.cli.sriov.perform_hardware_specific_quirks')
+ @patch('netplan_cli.cli.sriov.apply_vlan_filter_for_vf')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_apply_sriov_config_many_match(self, gim, gidn, apply_vlan, quirks,
set_numvfs, get_counts, netifs):
# set up the environment
@@ -723,7 +723,7 @@ def test_unit_class_PCIDevice(self):
pcidev = sriov.PCIDevice('0000:00:1f.6')
self.assertEqual('/sys', pcidev.sys)
self.assertLessEqual('/sys/bus/pci/devices/0000:00:1f.6', pcidev.path)
- with patch('netplan.cli.sriov.PCIDevice.sys', new_callable=unittest.mock.PropertyMock) as sys_mock:
+ with patch('netplan_cli.cli.sriov.PCIDevice.sys', new_callable=unittest.mock.PropertyMock) as sys_mock:
sys_mock.return_value = os.path.join(self.workdir.name, 'sys_mock')
os.makedirs(os.path.join(self.workdir.name, 'sys_mock/bus/pci/devices/0000:00:1f.6/driver'))
self.assertTrue(pcidev.bound)
@@ -731,13 +731,13 @@ def test_unit_class_PCIDevice(self):
self.assertTrue(pcidev.is_vf)
@patch('netifaces.interfaces')
- @patch('netplan.cli.sriov.get_vf_count_and_functions')
- @patch('netplan.cli.sriov.set_numvfs_for_pf')
- @patch('netplan.cli.sriov.perform_hardware_specific_quirks')
+ @patch('netplan_cli.cli.sriov.get_vf_count_and_functions')
+ @patch('netplan_cli.cli.sriov.set_numvfs_for_pf')
+ @patch('netplan_cli.cli.sriov.perform_hardware_specific_quirks')
@patch('subprocess.check_call')
- @patch('netplan.cli.sriov.PCIDevice.bound', new_callable=unittest.mock.PropertyMock)
- @patch('netplan.cli.sriov.PCIDevice.sys', new_callable=unittest.mock.PropertyMock)
- @patch('netplan.cli.sriov._get_pci_slot_name')
+ @patch('netplan_cli.cli.sriov.PCIDevice.bound', new_callable=unittest.mock.PropertyMock)
+ @patch('netplan_cli.cli.sriov.PCIDevice.sys', new_callable=unittest.mock.PropertyMock)
+ @patch('netplan_cli.cli.sriov._get_pci_slot_name')
def test_apply_sriov_config_eswitch_mode(self, gpsn, pcidevice_sys, pcidevice_bound,
scc, quirks, set_numvfs, get_counts, netifs):
handle = mock_open()
@@ -824,9 +824,9 @@ def driver_mock_open(*args, **kwargs):
call(['/sbin/devlink', 'dev', 'eswitch', 'set', 'pci/0000:03:00.1', 'mode', 'switchdev'])
])
- @patch('netplan.cli.sriov.PCIDevice.bound', new_callable=unittest.mock.PropertyMock)
- @patch('netplan.cli.sriov.PCIDevice.sys', new_callable=unittest.mock.PropertyMock)
- @patch('netplan.cli.commands.sriov_rebind._get_pci_slot_name')
+ @patch('netplan_cli.cli.sriov.PCIDevice.bound', new_callable=unittest.mock.PropertyMock)
+ @patch('netplan_cli.cli.sriov.PCIDevice.sys', new_callable=unittest.mock.PropertyMock)
+ @patch('netplan_cli.cli.commands.sriov_rebind._get_pci_slot_name')
def test_cli_rebind(self, gpsn, sys_mock, bound_mock):
self._prepare_sysfs_dir_structure(pf=('enp3s0f0', '0000:03:00.0'),
vfs=[('enp3s0f0v0', '0000:03:00.2'),
diff --git a/tests/test_terminal.py b/tests/test_terminal.py
index 2c646e5bd..5afd0527b 100644
--- a/tests/test_terminal.py
+++ b/tests/test_terminal.py
@@ -22,14 +22,14 @@
import termios
import unittest
-import netplan.terminal
+import netplan_cli.terminal
@unittest.skipUnless(sys.__stdin__.isatty(), "not supported when run from a script")
class TestTerminal(unittest.TestCase):
def setUp(self):
- self.terminal = netplan.terminal.Terminal(sys.stdin.fileno())
+ self.terminal = netplan_cli.terminal.Terminal(sys.stdin.fileno())
def test_echo(self):
self.terminal.disable_echo()
diff --git a/tests/test_utils.py b/tests/test_utils.py
index f1c1f63a5..349427f14 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -24,9 +24,9 @@
import netifaces
from contextlib import redirect_stdout
-from netplan.cli.core import Netplan
-import netplan.cli.utils as utils
-import netplan.libnetplan as libnetplan
+from netplan_cli.cli.core import Netplan
+import netplan_cli.cli.utils as utils
+import netplan_cli.libnetplan as libnetplan
from unittest.mock import patch
@@ -170,8 +170,8 @@ def test_nm_interfaces_globbing2(self):
self.assertTrue(len(ifaces) == 4)
# For the matching tests, we mock out the functions querying extra data
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_find_matching_iface_too_many(self, gim, gidn):
gidn.side_effect = lambda x: 'foo' if x == 'ens4' else 'bar'
gim.side_effect = lambda x: '00:01:02:03:04:05' if x == 'eth1' else '00:00:00:00:00:00'
@@ -185,8 +185,8 @@ def test_find_matching_iface_too_many(self, gim, gidn):
iface = utils.find_matching_iface(DEVICES, state['netplan-id'])
self.assertEqual(iface, None)
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_find_matching_iface(self, gim, gidn):
# we mock-out get_interface_macaddress to return useful values for the test
gidn.side_effect = lambda x: 'foo' if x == 'ens4' else 'bar'
@@ -202,8 +202,8 @@ def test_find_matching_iface(self, gim, gidn):
iface = utils.find_matching_iface(DEVICES, state['netplan-id'])
self.assertEqual(iface, 'eth1')
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_find_matching_iface_name_and_driver(self, gim, gidn):
gidn.side_effect = lambda x: 'foo' if x == 'ens4' else 'bar'
gim.side_effect = lambda x: '00:01:02:03:04:05' if x == 'eth1' else '00:00:00:00:00:00'
@@ -218,8 +218,8 @@ def test_find_matching_iface_name_and_driver(self, gim, gidn):
iface = utils.find_matching_iface(DEVICES, state['netplan-id'])
self.assertEqual(iface, 'ens4')
- @patch('netplan.cli.utils.get_interface_driver_name')
- @patch('netplan.cli.utils.get_interface_macaddress')
+ @patch('netplan_cli.cli.utils.get_interface_driver_name')
+ @patch('netplan_cli.cli.utils.get_interface_macaddress')
def test_find_matching_iface_name_and_drivers(self, gim, gidn):
# we mock-out get_interface_driver_name to return useful values for the test
gidn.side_effect = lambda x: 'foo' if x == 'ens4' else 'bar'
diff --git a/tests/utils.py b/tests/utils.py
index 07bec4108..d056e91f5 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -1,5 +1,5 @@
import os
-import netplan.libnetplan as libnetplan
+import netplan_cli.libnetplan as libnetplan
def state_from_yaml(confdir, yaml, filename="a.yml"):
diff --git a/tools/keyfile_to_yaml.py b/tools/keyfile_to_yaml.py
index 1e7509798..4f8bf3331 100644
--- a/tools/keyfile_to_yaml.py
+++ b/tools/keyfile_to_yaml.py
@@ -6,7 +6,7 @@
import io
import sys
-from netplan import libnetplan
+from netplan_cli import libnetplan
if len(sys.argv) < 2:
print("Pass the NM keyfile as parameter")