a0faef37eb228790914588b038ad132f55822abf
[nepi.git] / src / nepi / testbeds / netns / metadata_v01.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 from nepi.core.description import AF_INET
5 from nepi.core.attributes import Attribute
6 from nepi.util import validation
7
8 def get_metadata():
9     return dict({
10              "Node": dict({
11                     "factory_type": "routing",
12                     "display_name": "Node",
13                     "help": "Node",
14                     "category": "topology",
15                     "connector_types": [
16                         ("netns_node_apps", 
17                             "Connector from node to applications", 
18                             "apps", -1, 0,
19                             ["netns_application_node"]),
20                         ("netns_node_devs", 
21                             "Connector from node to network interfaces", 
22                             "devs", -1, 0,
23                             [   
24                                 "netns_nodeiface_node", 
25                                 "netns_tapiface_node", 
26                                 "netns_p2piface_node"
27                             ])
28                         ],
29                     "box_attributes": [
30                         ("forward_X11", 
31                             "Forward x11 from main namespace to the node", 
32                             Attribute.BOOL, 
33                             False, None, None, False, 
34                             validation.is_bool)
35                         ]
36                 }),
37             "P2PInterface": dict({
38                     "factory_type": "addressable",
39                     "family": AF_INET,
40                     "max_addresses": 1,
41                     "display_name": "P2PInterface",
42                     "help": "Point to point network interface",
43                     "category": "devices",
44                     "connector_types": [
45                             ("netns_p2piface_node", 
46                                 "Connector from P2PInterface to Node", 
47                                 "node", 1, 1, 
48                                 ["netns_node_devs"]),
49                             ("netns_p2pinterface_p2p", 
50                                 "Connector to another P2PInterface", 
51                                 "p2p", 1, 0, 
52                                 ["netns_p2piface_p2p"])
53                         ],
54                     "box_attributes": [
55                         ("lladdr", "Mac address", Attribute.STRING, 
56                             None, None, None, False, 
57                             validation.is_mac_address),
58                         ("up", "Link up", Attribute.BOOL, 
59                             False, None, None, False, 
60                             validation.is_bool),
61                         ("name", "Device name", Attribute.STRING, 
62                             None, None, None, False, 
63                             validation.is_string),
64                         ("mtu", "Maximmum transmition unit for device", 
65                             Attribute.INTEGER,
66                             None, None, None, False, 
67                             validation.is_integer),
68                         ("broadcast", "Broadcast address", 
69                             Attribute.STRING, 
70                             None, None, None, False, 
71                             validation.is_string),
72                         ("multicast", "Is multicast enabled", 
73                             Attribute.BOOL, 
74                             False, None, None, False, 
75                             validation.is_bool),
76                         ("arp", "Is ARP enabled", Attribute.BOOL, 
77                             True, None, None, False, 
78                             validation.is_bool),
79                     ]
80                 }),
81                 "TapNodeInterface": dict({
82                     "factory_type": "addressable",
83                     "family": AF_INET,
84                     "max_addresses": 1,
85                     "display_name": "TapNodeInterface",
86                     "help": "Tap device network interface",
87                     "category": "devices",
88                     "connector_types": [
89                         ("netns_tapiface_node", 
90                             "Connector to a Node", 
91                             "node", 1, 1, 
92                             ["netns_node_devs"]),
93                        ("netns_tapiface_fd", 
94                            "Connector to a network interface that can receive a file descriptor", 
95                            "fd", 1, 0, 
96                             # TODO: Doesn't exist yet!
97                            ["ns3_fdnetdev_fd"])
98                        ],
99                     "box_attributes": [
100                         ("lladdr", "Mac address", Attribute.STRING, 
101                             None, None, None, False, 
102                             validation.is_mac_address),
103                         ("up", "Link up", Attribute.BOOL, 
104                             False, None, None, False, 
105                             validation.is_bool),
106                         ("name", "Device name", Attribute.STRING, 
107                             None, None, None, False, 
108                             validation.is_string),
109                         ("mtu", "Maximmum transmition unit for device", 
110                             Attribute.INTEGER, 
111                             None, None, None, False, 
112                             validation.is_integer),
113                         ("broadcast", "Broadcast address", 
114                             Attribute.STRING, 
115                             None, None, None, False, 
116                             validation.is_string),
117                         ("multicast", "Is multicast enabled", 
118                             Attribute.BOOL, 
119                             False, None, None, False, 
120                             validation.is_bool),
121                         ("arp", "Is ARP enabled", Attribute.BOOL, 
122                             True, None, None, False, 
123                             validation.is_bool),
124                     ]
125                 }),
126             "NodeInterface": dict({
127                     "factory_type": "addressable",
128                     "family": AF_INET,
129                     "max_addresses": 1,
130                     "display_name": "NodeInterface",
131                     "help": "Node network interface",
132                     "category": "devices",
133                     "connector_types": [
134                         ("netns_nodeiface_node", "Connector to a node",
135                             "node", 1, 1, 
136                             ["netns_node_devs"]),
137                         ("netns_nodeiface_switch", "Connector to a switch", 
138                             "switch", 1, 0,
139                             ["netns_switch_devs"])
140                         ],
141                     "box_attributes": [
142                         ("lladdr", "Mac address", Attribute.STRING, 
143                             None, None, None, False, 
144                             validation.is_mac_address),
145                         ("up", "Link up", Attribute.BOOL, 
146                             False, None, None, False, 
147                             validation.is_bool),
148                         ("name", "Device name", Attribute.STRING, 
149                             None, None, None, False, 
150                             validation.is_string),
151                         ("mtu", "Maximmum transmition unit for device", 
152                             Attribute.INTEGER, 
153                             None, None, None, False, 
154                             validation.is_integer),
155                         ("broadcast", "Broadcast address", 
156                             Attribute.STRING,
157                             None, None, None, False, 
158                             validation.is_string),
159                         ("multicast", "Is multicast enabled", 
160                             Attribute.BOOL, 
161                             False, None, None, False, 
162                             validation.is_bool),
163                         ("arp", "Is ARP enabled", Attribute.BOOL, 
164                             True, None, None, False, 
165                             validation.is_bool),
166                     ]
167                 }),
168             "Switch": dict({
169                     "display_name": "Switch",
170                     "help": "Switch interface",
171                     "category": "devices",
172                     "connector_types": [
173                         ("netns_switch_devs", "Connector to network interfaces", 
174                             "devs", -1, 0, 
175                             ["netns_nodeiface_switch"])
176                         ],
177                     "box_attributes": [
178                         ("up", "Link up", Attribute.BOOL, 
179                             False, None, None, False,
180                             validation.is_bool),
181                         ("name", "Device name", Attribute.STRING, 
182                             None, None, None, False,
183                             validation.is_string),
184                         ("mtu", "Maximmum transmition unit for device", 
185                             Attribute.INTEGER, 
186                             None, None, None, False,
187                             validation.is_integer),
188                         ("multicast", "Is multicast enabled", 
189                             Attribute.BOOL,
190                             None, None, None, False, 
191                             validation.is_bool),
192                         #TODO:("Stp", help, type, value, range, allowed, readonly, validation_function),
193                         #TODO:("ForwarddDelay", help, type, value, range, allowed, readonly, validation_function),
194                         #TODO:("HelloTime", help, type, value, range, allowed, readonly, validation_function),
195                         #TODO:("AgeingTime", help, type, value, range, allowed, readonly, validation_function),
196                         #TODO:("MaxAge", help, type, value, range, allowed, readonly, validation_function)
197                         ]
198                 }),
199                "Application": dict({
200                     "display_name": "Application",
201                     "help": "Generic executable command line application",
202                     "category": "applications",
203                     "connector_types": [
204                             ("netns_application_node", "Connector to a node",
205                                 "node", 1, 1, 
206                                 ["netns_node_apps"])
207                         ],
208                     "traces": [
209                             ("StdoutTrace", "Standard output"),
210                             ("StderrTrace", "Standard error")
211                         ],
212                     "box_attributes": [
213                         ("command", "Command line",
214                             Attribute.STRING,
215                             None, None, None, False,
216                             validation.is_string),
217                         ("user", "System user", 
218                             Attribute.STRING, 
219                             None, None, None, False,
220                             validation.is_string),
221                         ("stdin", "Standard input", 
222                             Attribute.STRING,
223                             None, None, None, False,
224                             validation.is_string)
225                         ]
226                 }),
227         })