-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgraph.py
More file actions
209 lines (194 loc) · 7.39 KB
/
graph.py
File metadata and controls
209 lines (194 loc) · 7.39 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2015 Mag. Christian Tanzer All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. tanzer@swing.co.at
# #*** <License> ************************************************************#
# This module is part of the package GTW.OMP.SRM.
#
# This module is licensed under the terms of the BSD 3-Clause License
# <http://www.c-tanzer.at/license/bsd_3c.html>.
# #*** </License> ***********************************************************#
#
#++
# Name
# CNDB.OMP.graph
#
# Purpose
# Graph describing CNDB (partial) object model
#
# Revision Dates
# 27-Aug-2012 (RS) Creation
# 30-Aug-2012 (CT) Rearrange graph, add more nodes/links
# 31-Aug-2012 (CT) Adapt to MOM.Graph.Spec API change
# 6-Sep-2012 (CT) Add lots more nodes/links, rearrange graph
# 18-Sep-2012 (RS) Put `Node` and `Subject` and descendants in the middle
# for new Id_Entities of `Node`, fixes tanzer constraint
# 19-Sep-2012 (CT) Disentangle links, remove whitespace
# 24-Sep-2012 (CT) Add `Command`
# 18-Oct-2012 (RS) Add `Wired_Interface` and associations
# 18-Oct-2012 (RS) Add `Node` `IS_A` `Subject`
# 22-Nov-2012 (CT) Add `Role.left` to `Wireless_Channel`
# 22-Nov-2012 (RS) Move `Net_Interface_in_IP_Network.right` to South
# 8-Dec-2012 (RS) Add `Antenna_Band`
# 17-Dec-2012 (CT) Remove `Wireless_Mode`
# 17-Dec-2012 (RS) Skip explicit links from children of `Net_Interface`
# 26-Feb-2013 (CT) Remove `Wired_Link` and `Wireless_Link`
# 13-Jun-2013 (CT) Remove `PNS_Aliases`
# 11-Dec-2014 (CT) Fix geometry attributes of `Node.manager`
# 5-Jun-2015 (CT) Remove obsolete link `Node-is_a-Subject`
# 5-Jun-2015 (CT) Simplify layout to prepare for future additions
# 6-Jun-2015 (CT) Add `IP_Network_in_IP_Pool`, `IP_Pool_permits_Group`
# + add `PAP.Adhoc_Group`, re-add `PAP.Person`
# 16-Sep-2015 (CT) Move `import` to `Command.import_all`, `.import_default`
# (from `__main__`)
# ««revision-date»»···
#--
from _MOM import MOM
from _CNDB import CNDB
import _CNDB._OMP
from _MOM._Graph.Spec import Attr, Child, ET, IS_A, Role, Skip
import _MOM._Graph.Command
import _MOM._Graph.Entity
from _TFL import sos
from _TFL._D2 import Cardinal_Direction as CD
from _TFL.I18N import _, _T
def graph (app_type) :
return MOM.Graph.Spec.Graph \
( app_type
, ET.CNDB.Device
( Role.left
( ET.CNDB.Device_Type_made_by_Company
( Role.right
( IS_A.PAP.Group
( IS_A.PAP.Subject
( Child.PAP.Person
( offset = CD.S
)
, offset = CD.S
)
, Child.PAP.Adhoc_Group
( guide_offset = 0.5
, offset = CD.NE
)
, offset = CD.S
)
, offset = CD.NE
, source_side = "E"
, target_side = "W"
)
, offset = CD.E
)
, offset = CD.E
)
, Child.CNDB.Antenna
( Role.left
( IS_A.CNDB.Device_Type
, ET.CNDB.Antenna_Band (offset = CD.E)
, offset = CD.E
)
, offset = CD.N
)
, Child.CNDB.Net_Device
( Role.left
( IS_A.CNDB.Device_Type
, offset = CD.N
)
, Attr.node
( Attr.manager
( guide_offset = 0.75
, source_side = "E"
, target_side = "W"
)
, Attr.owner
( guide_offset = 0.5
, source_side = "E"
, target_side = "W"
)
, offset = CD.N + CD.E
)
, ET.CNDB.Net_Interface (offset = CD.S + CD.E)
, offset = CD.E + CD.S * 2
)
)
, ET.CNDB.Net_Interface
( Role.left (guide_offset = 1.0)
, ET.CNDB.Net_Link (offset = CD.S)
, ET.CNDB._Net_Credentials_
( Role.left (guide_offset = 1.0)
, offset = CD.N
)
, ET.CNDB.Net_Interface_in_IP_Network
( Role.right
( ET.CNDB.IP_Network_in_IP_Pool
( Role.right
( ET.CNDB.IP_Pool_permits_Group
( offset = CD.N
)
, offset = CD.N
)
, offset = CD.N
)
, Child.CNDB.IP4_Network (offset = CD.SW)
, Child.CNDB.IP6_Network (offset = CD.S)
, offset = CD.E
)
, Role.left
( guide_offset = 0.5
)
, offset = CD.E
)
, Child.CNDB.Wireless_Interface
( Skip.left
, ET.CNDB.Wireless_Interface_uses_Antenna
( Role.left
( guide_offset = 1.5
)
, Role.right
( anchor = False
, source_side = "W"
, target_side = "W"
)
, offset = CD.N + CD.W
)
, ET.CNDB.Wireless_Interface_uses_Wireless_Channel
( Role.right
( Role.left
( offset = CD.S
)
, offset = CD.S
)
, offset = CD.W
)
, offset = CD.W
)
, Child.CNDB.Wired_Interface
( Skip.left
, offset = CD.SW
)
)
, desc = _T ("Graph displaying Funkfeuer object model")
, title = _T ("CNDB graph")
)
# end def graph
class Command (MOM.Graph.Command) :
PNS = CNDB.OMP
_defaults = dict \
( name = "nodedb"
)
def import_all (self) :
import _GTW._OMP._PAP.import_PAP
import _GTW._OMP._Auth.import_Auth
self.import_default ()
# end def import_all
def import_default (self) :
import _CNDB._OMP.import_CNDB
# end def import_default
def _app_dir_default (self) :
return sos.path.normpath (sos.path.join (self.app_dir, "../..", "doc"))
# end def _app_dir_default
# end class Command
command = Command ()
if __name__ != "__main__" :
CNDB.OMP._Export_Module ()
else :
command ()
### __END__ CNDB.OMP.graph