Changeset 9252414 for fedd


Ignore:
Timestamp:
Dec 3, 2010 11:20:14 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
a6a3f93
Parents:
262328f
Message:

Add helper for access controlers to extract topology.

Fixes #5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/topdl.py

    r262328f r9252414  
    740740
    741741    return Topology(**p.current[top])
     742
     743def topology_from_startsegment(req):
     744    """
     745    Generate a topology from a StartSegment request to an access controller.
     746    This is a little helper to avoid some gross looking syntax.  It accepts
     747    either a request enclosed in the StartSegmentRequestBody, or one with that
     748    outer dict removed.
     749    """
     750
     751    if 'StartSegmentRequestBody' in req: r = req['StartSegmentRequestBody']
     752    else: r = req
     753   
     754    if 'segmentdescription' in r and \
     755            'topdldescription' in r['segmentdescription']:
     756        return Topology(**r['segmentdescription']['topdldescription'])
     757    else:
     758        return None
    742759
    743760def topology_to_xml(t, top=None):
Note: See TracChangeset for help on using the changeset viewer.