Skip to content

Commit

Permalink
Move models out of tests (#1576)
Browse files Browse the repository at this point in the history
* Move models out of tests

* fix duplicate type definitions
  • Loading branch information
itdependsnetworks committed Mar 17, 2022
1 parent 75c6f7c commit 6177042
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 36 deletions.
5 changes: 2 additions & 3 deletions napalm/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
from napalm.base import constants as c
from napalm.base import validate
from napalm.base.exceptions import ConnectionException
from napalm.base.test import models
from napalm.base.test.models import NTPStats
from napalm.base import models


class NetworkDriver(object):
Expand Down Expand Up @@ -938,7 +937,7 @@ def get_ntp_servers(self) -> Dict[str, models.NTPServerDict]:

raise NotImplementedError

def get_ntp_stats(self) -> List[NTPStats]:
def get_ntp_stats(self) -> List[models.NTPStats]:

"""
Returns a list of NTP synchronization statistics.
Expand Down
2 changes: 1 addition & 1 deletion napalm/base/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# local modules
import napalm.base.exceptions
from napalm.base import constants
from napalm.base.test.models import ConfigDict
from napalm.base.models import ConfigDict
from napalm.base.utils.jinja_filters import CustomJinjaFilters
from napalm.base.canonical_map import base_interfaces, reverse_mapping

Expand Down
2 changes: 1 addition & 1 deletion napalm/base/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from pydoc import locate

from napalm.base.test import models
from napalm.base import models


def raise_exception(result): # type: ignore
Expand Down
25 changes: 0 additions & 25 deletions napalm/base/test/models.py → napalm/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,31 +400,6 @@

ConfigDict = TypedDict("ConfigDict", {"running": str, "startup": str, "candidate": str})

TracerouteResultDictEntry = TypedDict(
"TracerouteResultDictEntry", {"probes": Dict[int, TracerouteDict]}
)

OpticsStateDict = TypedDict(
"OpticsStateDict", {"instant": float, "avg": float, "min": float, "max": float}
)

OpticsStatePerChannelDict = TypedDict(
"OpticsStatePerChannelDict",
{
"input_power": OpticsStateDict,
"output_power": OpticsStateDict,
"laser_bias_current": OpticsStateDict,
},
)

OpticsPerChannelDict = TypedDict(
"OpticsPerChannelDict", {"index": int, "state": OpticsStatePerChannelDict}
)

OpticsPhysicalChannelsDict = TypedDict(
"OpticsPhysicalChannelsDict", {"channels": OpticsPerChannelDict}
)

NetworkInstanceDict = TypedDict(
"NetworkInstanceDict", {"name": str, "type": str, "state": dict, "interfaces": dict}
)
Expand Down
2 changes: 1 addition & 1 deletion napalm/base/test/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# the License.
import difflib
from napalm.base import exceptions
from napalm.base.test import models
from napalm.base import models
from unittest import SkipTest


Expand Down
2 changes: 1 addition & 1 deletion napalm/base/test/getters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import pytest
from napalm.base.test import helpers
from napalm.base.test import models
from napalm.base import models
from napalm.base import NetworkDriver
from napalm.base.test import conftest

Expand Down
2 changes: 1 addition & 1 deletion napalm/base/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if TYPE_CHECKING:
from napalm.base import NetworkDriver
from napalm.base.exceptions import ValidationException
from napalm.base.test import models
from napalm.base import models


# We put it here to compile it only once
Expand Down
2 changes: 1 addition & 1 deletion napalm/nxos/nxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
from napalm.base.helpers import as_number
from napalm.base.helpers import generate_regex_or
from napalm.base.netmiko_helpers import netmiko_args
from napalm.base.test import models
from napalm.base import models
from napalm.nxapi_plumbing import Device as NXOSDevice
from napalm.nxapi_plumbing import (
NXAPIAuthError,
Expand Down
2 changes: 1 addition & 1 deletion test/nxos/test_getters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from napalm.base.test.getters import BaseTestGetters, wrap_test_cases
from napalm.base.test import helpers
from napalm.base.test import models
from napalm.base import models

import pytest
from mock import patch
Expand Down
2 changes: 1 addition & 1 deletion test/nxos_ssh/test_getters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from napalm.base.test.getters import BaseTestGetters, wrap_test_cases
from napalm.base.test import helpers
from napalm.base.test import models
from napalm.base import models

import pytest
from mock import patch
Expand Down

0 comments on commit 6177042

Please sign in to comment.