<s> '''<STR_LIT>''' <EOL> from django . core . urlresolvers import reverse <EOL> from django . test import Client <EOL> from expedient . common . tests . client import test_get_and_post_form <EOL> from django . contrib . auth . models import User <EOL> from pyquery import PyQuery as pq <EOL> from openflow . plugin . models import OpenFlowInterface , NonOpenFlowConnection <EOL> from geni . planetlab . models import PlanetLabNode <EOL> try : <EOL> from setup_expedient_params import SUPERUSER_USERNAME , SUPERUSER_PASSWORD , USER_INFO , PL_AGGREGATE_INFO , OF_AGGREGATE_INFO , OF_PL_CONNECTIONS <EOL> except ImportError : <EOL> print """<STR_LIT>""" <EOL> raise <EOL> def run ( ) : <EOL> client = Client ( ) <EOL> client . login ( username = SUPERUSER_USERNAME , <EOL> password = SUPERUSER_PASSWORD ) <EOL> for pl_agg in PL_AGGREGATE_INFO : <EOL> print "<STR_LIT>" % pl_agg [ "<STR_LIT:url>" ] <EOL> response = test_get_and_post_form ( <EOL> client , <EOL> reverse ( "<STR_LIT>" ) , <EOL> pl_agg , <EOL> ) <EOL> print "<STR_LIT>" % response <EOL> assert response . status_code == <NUM_LIT> <EOL> for of_agg in OF_AGGREGATE_INFO : <EOL> print "<STR_LIT>" % of_agg [ "<STR_LIT:url>" ] <EOL> response = test_get_and_post_form ( <EOL> client , <EOL> reverse ( "<STR_LIT>" ) , <EOL> of_agg , <EOL> del_params = [ "<STR_LIT>" ] , <EOL> ) <EOL> assert response . status_code == <NUM_LIT> <EOL> for cnxn_tuple in OF_PL_CONNECTIONS : <EOL> print "<STR_LIT>" % ( cnxn_tuple , ) <EOL> NonOpenFlowConnection . objects . get_or_create ( <EOL> of_iface = OpenFlowInterface . objects . get ( <EOL> switch__datapath_id = cnxn_tuple [ <NUM_LIT:0> ] , <EOL> port_num = cnxn_tuple [ <NUM_LIT:1> ] , <EOL> ) , <EOL> resource = PlanetLabNode . objects . get ( name = cnxn_tuple [ <NUM_LIT:2> ] ) , <EOL> ) <EOL> client . logout ( ) <EOL> for username , info in USER_INFO . items ( ) : <EOL> User . objects . create_user ( <EOL> username = username , email = info [ "<STR_LIT:email>" ] , password = info [ "<STR_LIT:password>" ] ) <EOL> client . login ( username = username , password = info [ "<STR_LIT:password>" ] ) <EOL> for project in info [ "<STR_LIT>" ] : <EOL> response = test_get_and_post_form ( <EOL> client , reverse ( "<STR_LIT>" ) , <EOL> params = dict ( <EOL> name = project [ "<STR_LIT:name>" ] , <EOL> description = project [ "<STR_LIT:description>" ] , <EOL> ) , <EOL> ) <EOL> assert response . status_code == <NUM_LIT> <EOL> client . logout ( ) </s>
