Changeset 9a52a80
- Timestamp:
- Feb 1, 2013 1:25:11 PM (12 years ago)
- Branches:
- master
- Children:
- 328e93f
- Parents:
- 5bd8f1b
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/deter/__init__.py
r5bd8f1b r9a52a80 5 5 from ip_allocator import * 6 6 from ip_addr import * 7 from topdl_to_route import * -
fedd/federation/emulab_access.py
r5bd8f1b r9a52a80 691 691 """ 692 692 configs = ('hosts', 'ssh_pubkey', 'ssh_secretkey', 693 'seer_ca_pem', 'seer_node_pem' )693 'seer_ca_pem', 'seer_node_pem', 'route.tgz') 694 694 ename = None 695 695 pubkey_base = None -
fedd/federation/experiment_control.py
r5bd8f1b r9a52a80 44 44 from deter import ip_allocator 45 45 from deter import ip_addr 46 from deter import topology_to_route_file 46 47 import list_log 47 48 … … 137 138 or 'legacy' 138 139 self.auth_dir = config.get('experiment_control', 'auth_dir') 140 self.routing = config.get('experiment_control', 'routing') 139 141 # XXX: document this! 140 142 self.info_cache_limit = \ … … 1204 1206 1205 1207 for p, a in attrs: 1206 # PNNL Debug1207 self.log.debug("Append auth: %s %s" % (p, a))1208 1208 if p and a: 1209 1209 # Improperly configured overrides can add bad principals. … … 1623 1623 """ 1624 1624 1625 # XXX: PNNL debug1626 self.log.debug("calling wrangle software")1627 1625 # Copy the rpms and tarfiles to a distribution directory from 1628 1626 # which the federants can retrieve them … … 1637 1635 pkgs.update([x.location for e in top.elements for x in e.software]) 1638 1636 try: 1639 # XXX: PNNL debug1640 self.log.debug("wrangle software: makedirs")1641 1637 os.makedirs(softdir) 1642 # XXX: PNNL debug1643 self.log.debug("wrangle software: makedirs success")1644 1638 except EnvironmentError, e: 1645 1639 raise service_error( … … 1961 1955 Create the ssh keys necessary for interconnecting the portal nodes and 1962 1956 the global hosts file for letting each segment know about the IP 1963 addresses in play. Save these into the repo. Add attributes to the 1964 autorizer allowing access controllers to download them and return a set 1965 of attributes that inform the segments where to find this stuff. May 1957 addresses in play. If we have computed static routes, copy them into 1958 the repo. Save these into the repo. Add attributes to the autorizer 1959 allowing access controllers to download them and return a set of 1960 attributes that inform the segments where to find this stuff. May 1966 1961 raise service_errors in if there are problems. 1967 1962 """ … … 1971 1966 gw_pubkey = os.path.join(keydir, gw_pubkey_base) 1972 1967 gw_secretkey = os.path.join(keydir, gw_secretkey_base) 1968 route = os.path.join(tmpdir, 'route.tgz') 1973 1969 1974 1970 try: … … 1985 1981 # The config file system location 1986 1982 configdir ="%s%s" % ( self.repodir, configpath) 1983 route_conf = os.path.join(configdir, 'route.tgz') 1987 1984 try: 1988 1985 os.makedirs(configdir) … … 1998 1995 "Cannot write hosts file: %s" % e) 1999 1996 try: 1997 if os.path.exists(route): 1998 copy_file(route, route_conf) 1999 2000 2000 copy_file(gw_pubkey, os.path.join(configdir, gw_pubkey_base)) 2001 2001 copy_file(gw_secretkey, os.path.join(configdir, gw_secretkey_base)) … … 2014 2014 (tbparams[tb].allocID, "%s/%s" % (configpath, f)) \ 2015 2015 for tb in tbparams.keys() \ 2016 for f in ("hosts", 'ca.pem', 'node.pem', 2016 for f in ("hosts", 'ca.pem', 'node.pem', 'route.tgz', 2017 2017 gw_secretkey_base, gw_pubkey_base)])) 2018 2018 … … 2044 2044 }, 2045 2045 ] 2046 # Add info about static routes if we have some 2047 if os.path.exists(route_conf): 2048 attrs.append( 2049 { 2050 'attribute': 'route.tgz', 2051 'value': '%s/%s/config/%s' % \ 2052 (self.repo_url, expid, 'route.tgz') 2053 } 2054 ) 2046 2055 return attrs 2047 2056 … … 2170 2179 raise service_error(service_error.req, "No such experiment") 2171 2180 2181 @staticmethod 2182 def needs_route_computation(req): 2183 ''' 2184 Walk the request services looking for a static routing request 2185 ''' 2186 for s in req.get('service', []): 2187 if s.get('name', '') == 'static_routing': 2188 return True 2189 return False 2190 2191 def compute_static_routes(self, tmpdir, top): 2192 ''' 2193 Compute a set of static routes for the topology. The result is a file 2194 called route.tgz in tmpdir that contains a dinrectory, route, with a 2195 file per node in the topology that lists the prefix and router for all 2196 the routes in that node's routing table. Exceptions from the route 2197 calculation program and the tar creation call are not caught. 2198 ''' 2199 if self.routing is None: 2200 raise service_error(service_error.server, 2201 'Cannot provide staticroutes, no routing program specified') 2202 rg = tempfile.NamedTemporaryFile() 2203 outdir = os.path.join(tmpdir, 'route') 2204 tarfile = os.path.join(tmpdir, 'route.tgz') 2205 topology_to_route_file(top, file=rg) 2206 os.mkdir(outdir) 2207 try: 2208 for cmd in ( 2209 [self.routing, '--input', rg.name,'--output', outdir], 2210 ['tar', '-C', tmpdir, '-czf', tarfile, 'route']): 2211 subprocess.check_call(cmd) 2212 except subprocess.CalledProcessError, e: 2213 raise service_error(service_error.internal, 2214 'Cannot call %s: %s' % (' '.join(cmd), e.returncode)) 2215 rg.close() 2216 shutil.rmtree(outdir) 2217 2218 2172 2219 2173 2220 def save_federant_information(self, allocated, tbparams, eid, top): … … 2279 2326 # Assign the IPs 2280 2327 hosts, ip_allocator = self.allocate_ips_to_topo(top) 2328 if self.needs_route_computation(req): 2329 self.compute_static_routes(tmpdir, top) 2281 2330 # Find the testbeds to look up 2282 2331 tb_hosts = { } … … 2284 2333 for e in top.elements: 2285 2334 if isinstance(e, topdl.Computer): 2286 tb = e.get_attribute('testbed') or 'default' 2335 tb = e.get_attribute('testbed') 2336 # Put nodes not in a testbed into the 'default' testbed if 2337 # 'default' is in the fedd map, the instantiation will 2338 # work. 2339 if tb is None: 2340 tb = 'default' 2341 e.set_attribute('testbed', tb) 2287 2342 if tb in tb_hosts: tb_hosts[tb].append(e.name) 2288 2343 else: … … 2306 2361 2307 2362 attrs = self.generate_keys_and_hosts(tmpdir, expid, hosts, tbparams) 2308 # XXX: PNNL debug2309 self.log.debug("Back from generate keys")2310 2363 2311 2364 part = experiment_partition(self.auth, self.store_url, tbmap, … … 2313 2366 part.add_portals(top, topo, eid, pmasters, tbparams, ip_allocator, 2314 2367 connInfo, expid) 2315 # XXX: PNNL debug2316 self.log.debug("Back from add portals")2317 2368 2318 2369 auth_attrs = set() 2319 2370 # Now get access to the dynamic testbeds (those added above) 2320 2371 for tb in [ t for t in topo if t not in allocated]: 2321 # XXX: PNNL debug2322 self.log.debug("dynamic testbeds %s" %tb)2323 2372 self.get_access(tb, tbparams, fid, masters, tbmap, 2324 2373 expid, expcert_file) … … 2331 2380 for sk in store_keys.split(" ")])) 2332 2381 2333 # XXX: PNNL debug2334 self.log.debug("done with dynamic testbeds %s" % auth_attrs)2335 2382 if auth_attrs: 2336 2383 self.append_experiment_authorization(expid, auth_attrs) -
fedkit/Makefile
r5bd8f1b r9a52a80 3 3 config_from_tunnelip.pl active_config.pl combo.pl \ 4 4 prep_gateway.pl port_forward.pl setup_bridge.pl import_key.pl \ 5 gated_routing.pl start_seer.pl ospf_routing.pl quagga_routing.pl 5 gated_routing.pl start_seer.pl ospf_routing.pl quagga_routing.pl \ 6 static_routing.pl 6 7 7 8 LIBRARIES=gateway_lib.pm -
fedkit/federate.pl
r5bd8f1b r9a52a80 88 88 89 89 foreach my $fn ("seer.conf", "client.conf", "userconf", "hosts", 90 "ca.pem", "node.pem" ) {90 "ca.pem", "node.pem", "route.tgz") { 91 91 copy("$shared_config_dir/$fn", $local_config_dir ) 92 92 if -e "$shared_config_dir/$fn"; 93 93 } 94 # If there are static routes, unpack them 95 system("tar -C $local_config_dir -xzf $local_config_dir/route.tgz") 96 if -e "$local_config_dir/route.tgz"; 94 97 95 98 # Copy seer authorization files into the location that standard SEER … … 169 172 170 173 if ($uname =~ /Linux/ ) { 171 system("$perl /usr/local/federation/bin/gated_routing.pl") 172 if -r "/usr/local/federation/bin/gated_routing.pl"; 174 system("$perl /usr/local/federation/bin/static_routing.pl") 175 if -r "/usr/local/federation/bin/static_routing.pl"; 176 if ($?) { 177 system("$perl /usr/local/federation/bin/gated_routing.pl") 178 if -r "/usr/local/federation/bin/gated_routing.pl"; 179 } 173 180 if ($?) { 174 181 system("$perl /usr/local/federation/bin/quagga_routing.pl") … … 177 184 } 178 185 elsif ($uname =~/FreeBSD/ ) { 179 # FreeBSD needs to have ospfs installed and a router config created and 180 # run. 181 system("$perl /usr/local/federation/bin/ospf_routing.pl") 182 if -r "/usr/local/federation/bin/ospf_routing.pl"; 186 system("$perl /usr/local/federation/bin/static_routing.pl") 187 if -r "/usr/local/federation/bin/static_routing.pl"; 188 if ($?) { 189 # FreeBSD needs to have ospfs installed and a router config created and 190 # run. 191 system("$perl /usr/local/federation/bin/ospf_routing.pl") 192 if -r "/usr/local/federation/bin/ospf_routing.pl"; 193 } 183 194 } 184 195
Note: See TracChangeset
for help on using the changeset viewer.