Module Import alias ImportFrom alias Import alias FunctionDef arguments args defaults body Return Str decorator_list FunctionDef arguments args defaults body ImportFrom alias Assign NameStore Call NameLoad keyword Call NameLoad Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword BinOpAdd BinOpAdd Str Str Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword BinOpAdd BinOpAdd Str Str Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword NameLoad keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword BinOpAdd BinOpAdd Str Str Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword BinOpAdd BinOpAdd Str Str Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str keyword Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num If AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call NameLoad Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Print Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Print Str For NameStore NameLoad body For NameStore NameLoad body For NameStore SubscriptLoad NameLoad Index Str body Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index Str Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If BoolOpAnd CompareIsNot AttributeLoad NameLoad attr NameLoad CompareIs AttributeLoad NameLoad attr NameLoad body Print Str For NameStore NameLoad body If BoolOpOr CompareEq AttributeLoad NameLoad attr Str CompareEq AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str body Print Str SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If BoolOpAnd CompareIsNot AttributeLoad NameLoad attr NameLoad CompareIs AttributeLoad NameLoad attr NameLoad body Print AttributeLoad NameLoad attr For NameStore NameLoad body If BoolOpOr CompareEq AttributeLoad NameLoad attr Str CompareEq AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str body Print Str SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Print Call NameLoad Expr Call AttributeLoad NameLoad attr Num decorator_list If CompareEq NameLoad Str body TryExcept body Expr Call NameLoad handlers ExceptHandler type NameLoad body Pass
N/A N/A pprint planetlab session N/A sys usage N/A N/A N/A N/A N/A 
    plsync.py takes static configurations stored in sites.py and slices.py
        and applies them to the PLC database adding or updating objects, 
        tags, and other values when appropriate.

    Add a New Site:
        ./plsync.py --dryrun ....
                Only perform Get* api calls.  Absolutely no changes are made
                to the PLC DB. HIGHLY recommended before changes.

        ./plsync.py --syncsite nuq01 --allsteps --getbootimages
                Creating a new site requires admin permission.  First, edit
                sites.py to add details for nuq01. Next, run this command to
                create site, nodes, PCUs and configuration.  As well, this
                command downloads the boot images for the new site to PWD.
                Downloading the boot image should occur *only once*.  Every
                time you download the boot image, the node key in the PLC db
                is re-written. If the key in the db is out of sync with the
                key on the server, then nodes will fail to authenticate or
                boot.

        ./plsync.py --syncslice all --on nuq01 --allsteps
                Use the standard set of slices defined in slices.py and add
                their configuration to the servers at site 'nuq01'.  Perform
                all configuration steps (i.e. add slice ips, and add
                whitelist).

    Add New Operator (rare):
        ./plsync.py --syncsite all --addusers
                Adding a new operator to all M-Lab sites requires admin
                permission.  Add the new operator email address to sites.py in
                the variable 'pi_list'.  Finally, run this command.  The
                operator account should already exist in the PlanetLab
                database, and after completion will have permission to act on
                M-Lab servers or PCUs at all M-Lab sites.

    Alternate Boot Server:
        ./plsync.py --url https://boot-test.measurementlab.net/PLCAPI/ ...
                The default API target for plsync is PlanetLab's PLCAPI server.
                To direct plsync to a different target use '--url <url>'

    Configure a Single Slice:
        ./plsync.py --syncslice <slicename> --allsteps
                Add the new slice specification to slices.py. Next, run this
                command.  By default, syncslice will apply to *all* sites. If
                you would like to limit the sites, specify "--on <sitename>'

                Also, useful to update slice attributes for a single slice.  For
                instance, to disable a slice prior to deletion from M-Lab, you
                could add the attribute 'enabled=0' to slices.py and run this
                command.  Or, to increase the disk quota. disk_max='80000000'

    Add IPv6 to Slice on a Single Server:
        ./plsync.py --syncslice iupui_ndt --allstesps \
                    --on mlab1.nuq0t.measurement-lab.org --allsteps
                In slices.py update Slice() definition to include ipv6="all".
                Then, resync the slice configuration for a given hostname.
                This command is useful for staging updates, rather than
                applying them globally.

    Other Examples:
        ./plsync.py --syncslice all --on nuq01
                Associates all slices with machines at given site. Also, 
                updates global slice attributes.  Should only be run after 
                setting up the site with '--syncsite'

        ./plsync.py --syncsite all
                Syncs all sites. Verifies existing sites & slices, creates
                sites that do not exist.  This will take a very long time
                due to the delays for every RPC call to the PLC api.

                This command would be useful once migrating to a new
                boot-server.  This would populate the entire db based on the
                current configuration in sites.py & slices.py (which should be
                identical to PlanetLab's db).

    Future Notes:
        Since an external sites & slices list was necessary while M-Lab was
        part of PlanetLab to differentiate mlab from non-mlab, 
        it may be possible to eliminate sites.py and slices.py. That really only
        needs to run once and subsequent slice operations could query the DB
        for a list of current sites or hosts.  More intelligent update 
        functions could re-assign nodes to nodegroups, assign which hosts
        are in the ipv6 pool, etc. just a thought.

        Keeping slices.py as a concise description of what and how slices
        are deployed to M-Lab is probably still helpful to see everything in
        one place.  But, this could be saved in the form of a list of commands
        to plsync.py with explicit arguments for the values currently
        contained in slices.py.  This would make plsync.py just another
        command line tool and separate config from function more clearly.
 N/A main N/A N/A N/A N/A optparse OptionParser N/A parser N/A OptionParser usage N/A usage N/A N/A N/A parser add_option --dryrun dest debug action store_true default False help only issues 'Get*' calls to the API. Commits nothing. N/A N/A N/A parser add_option --verbose dest verbose action store_true default False help print all the PLC API calls being made. N/A N/A N/A parser add_option --url dest url default N/A session API_URL help PLC url to contact N/A N/A N/A parser add_option --plcconfig dest plcconfig default N/A session PLC_CONFIG help path to file containing plc login information. N/A N/A N/A parser add_option --on metavar hostname dest ondest default None help only act on the given hostname (or sitename) N/A N/A N/A parser add_option --syncsite metavar site dest syncsite default None help sync the given site, nodes, and pcus. Can be 'all' N/A N/A N/A parser add_option --syncslice metavar slice dest syncslice default None help sync the given slice and its attributes. Can be 'all' N/A N/A N/A parser add_option -A --allsteps dest allsteps action store_true default False help perform all the following 'add' steps (in context) N/A N/A N/A parser add_option --addnodes dest addnodes action store_true default False help [syncsite] create nodes during site sync N/A N/A N/A parser add_option --addinterfaces dest addinterfaces action store_true default False help N/A N/A [syncsite] create/update ipv4 Interfaces. Omitting  this option only syncs ipv6 configuration (which is  treated differently in the DB) N/A N/A N/A parser add_option --addusers dest addusers action store_true default False help [syncsite] add PIs to sites N/A N/A N/A parser add_option --createusers action store_true dest createusers default False help N/A N/A normally, users are assumed to exist. This option  creates them first and gives them a default password.  Useful for testing. Users are not assigned to slices. N/A N/A N/A parser add_option --addwhitelist dest addwhitelist action store_true default False help [syncslice] add the given slice to whitelists. N/A N/A N/A parser add_option --addsliceips dest addsliceips default False action store_true help [syncslice] assign IPs (v4 and/or v6) to slices N/A N/A N/A parser add_option --createslice action store_true dest createslice default False help N/A N/A normally, slices are assumed to exist. This option  creates them first. Useful for testing. Users are not  assigned to new slices. N/A N/A N/A parser add_option --getbootimages dest getbootimages action store_true default False help N/A N/A download the ISO boot images for Nodes. This is a  destructive operation if ISOs have previously been  downloaded. N/A N/A N/A parser add_option --sitesname metavar sites dest sitesname default sites help the name of the module with Site() definitions N/A N/A N/A parser add_option --slicesname metavar slices dest slicesname default slices help the name of the module with Slice() definitions N/A N/A N/A parser add_option --sitelist metavar site_list dest sitelist default site_list help the site list variable name. N/A N/A N/A parser add_option --slicelist metavar slice_list dest slicelist default slice_list help the slice list variable name. N/A N/A options args N/A N/A parser parse_args N/A N/A N/A len N/A sys argv 1 N/A N/A N/A N/A parser print_help N/A N/A N/A sys exit 1 N/A N/A options allsteps N/A N/A N/A options addwhitelist True N/A N/A options addsliceips True N/A N/A options addinterfaces True N/A N/A options addnodes True N/A N/A options addusers True N/A site_list N/A getattr N/A __import__ N/A options sitesname N/A options sitelist N/A slice_list N/A getattr N/A __import__ N/A options slicesname N/A options slicelist N/A setup plc session N/A N/A N/A session setup_global_session N/A options url N/A options debug N/A options verbose N/A options plcconfig N/A loading slice & site configuration N/A sslice slice_list N/A N/A site site_list N/A N/A host N/A site N/A nodes N/A N/A h N/A N/A site N/A nodes N/A host N/A N/A N/A sslice add_node_address h N/A N/A N/A N/A options syncsite None N/A N/A options syncslice None N/A N/A sync site N/A site site_list N/A N/A N/A N/A N/A options syncsite all N/A N/A options syncsite N/A site N/A name N/A N/A Syncing: site N/A site N/A name N/A N/A N/A site sync N/A options ondest N/A options addusers N/A options addnodes N/A options addinterfaces N/A options getbootimages N/A options createusers N/A N/A N/A N/A N/A options syncslice None N/A N/A options syncsite None N/A N/A N/A options syncslice N/A sslice slice_list N/A N/A N/A N/A N/A options syncslice all N/A N/A options syncslice N/A sslice N/A name N/A N/A Syncing: slice N/A sslice N/A name N/A N/A N/A sslice sync N/A options ondest N/A options addwhitelist N/A options addsliceips N/A options addusers N/A options createslice N/A N/A N/A usage N/A N/A N/A sys exit 1 N/A N/A N/A __name__ __main__ N/A N/A N/A N/A N/A main N/A N/A N/A KeyboardInterrupt N/A N/A