-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.py
57 lines (48 loc) · 1.64 KB
/
node.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import signal_information
import lightpath
class Node(object):
def __init__(self, node_dict):
self._label = node_dict['label']
self._position = node_dict['position']
self._connected_nodes = node_dict['connected_nodes']
self._successive = {}
self._transceiver=""
@property
def label(self):
return self._label
@property
def position(self):
return self._position
@property
def connected_nodes(self):
return self._connected_nodes
@property
def transceiver(self):
return self._transceiver
@transceiver.setter
def transceiver(self, transceiver):
self._transceiver = transceiver
@property
def successive(self):
return self._successive
@successive.setter
def successive(self, successive):
self._successive = successive
def probe(self, signal_information,busy=False):
path = signal_information.path
if len(path) > 1:
line_label = path[:2]
linestr=""
line = self.successive[linestr.join(line_label)] # line_label = path[:2] da una list
signal_information.next()
signal_information = line.propagate(signal_information,busy)
return signal_information
def propagate(self, lightpath,busy=False):
path = lightpath.path
if len(path) > 1:
line_label = path[:2]
linestr=""
line = self.successive[linestr.join(line_label)] # line_label = path[:2] da una list
lightpath.next()
lightpath = line.propagate(lightpath,busy)
return lightpath