Passed
Pull Request — master (#87)
by Gleyberson
01:50
created

build.models.Topology.__init__()   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 3
cp 0
cc 1
nop 3
crap 2
1
"""Most relevant classes to be used on the topology."""
2
3
4
__all__ = ('Host', 'Topology')
5
6
7
class Topology:
8
    """Represent the topology with links and switches."""
9
10
    def __init__(self, switches, links):
11
        """Create a instance of Topology."""
12
        self.switches = switches
13
        self.links = links
14
15
16
class Host:
17
    """Represents the Host."""
18
19
    def __init__(self, mac):
20
        """Create a instance of Host."""
21
        self.mac = mac
22
23
    @property
24
    def id(self):  # pylint: disable=invalid-name
25
        """Return the host id."""
26
        return self.mac
27
28
    def as_dict(self):
29
        """Return a dict representation of a Host."""
30
        return {'mac': self.mac,
31
                'type': 'host'}
32