Changeset 5e1fb7b
- Timestamp:
- May 27, 2010 7:40:12 AM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- a65a65a
- Parents:
- 1962a5b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/emulab_access.py
r1962a5b r5e1fb7b 97 97 self.cleanup = not config.getboolean("access", "leave_tmpfiles") 98 98 self.access_type = config.get("access", "type") 99 99 100 self.dragon_endpoint = config.get("access", "dragon") 101 self.dragon_vlans = config.get("access", "dragon_vlans") 102 self.deter_internal = config.get("access", "deter_internal") 103 104 self.tunnel_config = config.getboolean("access", "tunnel_config") 105 self.portal_command = config.get("access", "portal_command") 106 self.portal_image = config.get("access", "portal_image") 107 self.portal_type = config.get("access", "portal_type") or "pc" 108 self.portal_startcommand = config.get("access", "portal_startcommand") 109 self.node_startcommand = config.get("access", "node_startcommand") 110 100 111 self.federation_software = software_list(self.federation_software) 101 112 self.portal_software = software_list(self.portal_software) … … 113 124 self.stop_segment = None 114 125 115 self.attrs = { }116 126 self.access = { } 117 127 self.restricted = [ ] … … 258 268 259 269 restricted_re = re.compile("restricted:\s*(.*)", re.IGNORECASE) 260 attr_re = re.compile('attribute:\s*([\._\-a-z0-9]+)\s+value:\s*(.*)',261 re.IGNORECASE)262 270 access_re = re.compile('\('+key_name+'\s*,\s*'+key_name+'\s*,\s*'+ 263 271 key_name+'\s*\)\s*->\s*\('+access_proj + '\s*,\s*' + … … 280 288 line = line.strip(); 281 289 if len(line) == 0 or line.startswith('#'): 282 continue283 284 # Extended (attribute: x value: y) attribute line285 m = attr_re.match(line)286 if m != None:287 attr, val = m.group(1,2)288 self.attrs[attr] = val289 290 continue 290 291 … … 717 718 ] 718 719 } 719 if len(self.attrs) > 0: 720 msg['fedAttr'].extend( 721 [ { 'attribute': x, 'value' : y } \ 722 for x,y in self.attrs.iteritems()]) 720 721 if self.dragon_endpoint: 722 msg['fedAttr'].append({'attribute': 'dragon', 723 'value': self.dragon_endpoint}) 724 if self.deter_internal: 725 print 'adding internal' 726 msg['fedAttr'].append({'attribute': 'deter_internal', 727 'value': self.deter_internal}) 728 else: print "internal: %s" % self.deter_internal 729 #XXX: ?? 730 if self.dragon_vlans: 731 msg['fedAttr'].append({'attribute': 'vlans', 732 'value': self.dragon_vlans}) 723 733 724 734 if services: … … 735 745 736 746 def gateway_hardware(h): 737 if h == 'GWTYPE': return self. attrs.get('connectorType', 'GWTYPE')747 if h == 'GWTYPE': return self.portal_type or 'GWTYPE' 738 748 else: return h 739 749 … … 1194 1204 1195 1205 cfn = "%s/%s.gw.conf" % (tmpdir, myname.lower()) 1196 tunnelconfig = self. attrs.has_key('TunnelCfg')1206 tunnelconfig = self.tunnel_config 1197 1207 try: 1198 1208 f = open(cfn, "w") … … 1318 1328 "Missing connectivity info") 1319 1329 1320 # The startcmds for master and slave testbeds1321 if master:1322 gate_cmd = self.attrs.get('MasterConnectorStartCmd', '/bin/true')1323 node_cmd = self.attrs.get('MasterNodeStartCmd', 'bin/true')1324 else:1325 gate_cmd = self.attrs.get('SlaveConnectorStartCmd', '/bin/true')1326 node_cmd = self.attrs.get('SlaveNodeStartCmd', 'bin/true')1327 1328 1330 # Weed out the things we aren't going to instantiate: Segments, portal 1329 1331 # substrates, and portal interfaces. (The copy in the for loop allows … … 1337 1339 if isinstance(e, topdl.Computer): 1338 1340 self.add_kit(e, self.federation_software) 1339 if e.get_attribute('portal') and gate_cmd:1341 if e.get_attribute('portal') and self.portal_startcommand: 1340 1342 # Add local portal support software 1341 1343 self.add_kit(e, self.portal_software) 1342 1344 # Portals never have a user-specified start command 1343 e.set_attribute('startup', gate_cmd)1344 elif node_cmd:1345 e.set_attribute('startup', self.portal_startcommand) 1346 elif self.node_startcommand: 1345 1347 if e.get_attribute('startup'): 1346 1348 e.set_attribute('startup', "%s \\$USER '%s'" % \ 1347 (node_cmd, e.get_attribute('startup'))) 1349 (self.node_startcommand, 1350 e.get_attribute('startup'))) 1348 1351 else: 1349 e.set_attribute('startup', node_cmd)1352 e.set_attribute('startup', self.node_startcommand) 1350 1353 1351 1354 dinf = [i[0] for i in dragon_map.get(e.name, []) ] … … 1363 1366 filters = [] 1364 1367 1365 # NB: these are extra commands issued for the node, not the startcmds 1366 if master: cmd = self.attrs.get('MasterConnectorCmd', '') 1367 else: cmd = self.attrs.get('SlaveConnectorCmd', '') 1368 1369 if self.attrs.has_key('dragon'): 1368 if self.dragon_endpoint: 1370 1369 add_filter = not_dragon(dragon_map) 1371 1370 filters.append(dragon_commands(dragon_map)) … … 1373 1372 add_filter = None 1374 1373 1375 if cmd:1376 filters.append(topdl.generate_portal_command_filter( cmd,1377 add_filter=add_filter))1378 1379 if self. attrs.has_key('connectorImage'):1374 if self.portal_command: 1375 filters.append(topdl.generate_portal_command_filter( 1376 self.portal_command, add_filter=add_filter)) 1377 1378 if self.portal_image: 1380 1379 filters.append(topdl.generate_portal_image_filter( 1381 self. attrs.get('connectorImage')))1382 1383 if self. attrs.has_key('connectorType'):1380 self.portal_image)) 1381 1382 if self.portal_type: 1384 1383 filters.append(topdl.generate_portal_hardware_filter( 1385 self. attrs.get('connectorType')))1384 self.portal_type)) 1386 1385 1387 1386 # Convert to ns and write it out
Note: See TracChangeset
for help on using the changeset viewer.