def test_parse_slice(self):
        from openflow.plugin.gapi.rspec import parse_slice
        
        # get the resources
        slice_urn, cred = self.create_ch_slice()
        options = dict(geni_compressed=False, geni_available=True)
        rspec = wrap_xmlrpc_call(
            self.am_client.ListResources,
            [cred, options], {}, settings.TIMEOUT)
        
        logger.debug("Got RSpec\n%s" % rspec)
        
        # Create switches and links
        self.switches, self.links = parse_rspec(rspec)
        
        # create a random reservation
        vals = dict(
           firstname="John", lastname="Doe",
           email="john.doe@geni.net", password="slice_pass",
           proj_name="Stanford Networking",
           proj_desc="Making the world better.",
           slice_name="Crazy Load Balancer",
           slice_desc="Does this and that...",
           ctrl_url="tcp:controller.stanford.edu:6633")
        resv_rspec, flowspaces = create_random_resv(2, self.switches, **vals)
        
        project_name, project_desc, slice_name, slice_desc,\
        controller_url, email, password, iface_fs_map = parse_slice(resv_rspec)
        
        self.assertEqual(project_name, vals["proj_name"])
        self.assertEqual(project_desc, vals["proj_desc"])
        self.assertEqual(slice_name, vals["slice_name"])
        self.assertEqual(slice_desc, vals["slice_desc"])
        self.assertEqual(controller_url, vals["ctrl_url"])
        self.assertEqual(email, vals["email"])
        self.assertEqual(password, vals["password"])
        
        dpid_fs_map = {} # map dpid to requested fs
        for fs in flowspaces:
            for sw in fs.switches:
                if dpid_fs_map not in sw.dpid:
                    dpid_fs_map[sw.dpid] = []
                dpid_fs_map[sw.dpid].append(fs)
        
        logger.debug(iface_fs_map)
#        # check that all slivers parsed are correct
#        for iface, fs_set in iface_fs_map.items():
#            
#        found_dpids = []
#        for sliver in slivers:
#            for sliver in slivers:
#                found_dpids.append(sliver['datapath_id'])
#                
#                fs_set_requested = dpid_fs_map[sliver['datapath_id']]
#                fs_set_found = sliver['flowspace']
#                
#                # make sure that all the parsed flowspace was requested
#                for fs_found in fs_set_found:
#                    found = False
#                    for fs_req in fs_set_requested:
#                        if fs_req.compare_to_sliver_fs(fs_found):
#                            found = True
#                            break
#                    self.assertTrue(found,
#                        "Didn't request flowspace %s for dpid %s\n" %\
#                        (pformat(fs_found), sliver['datapath_id']) +
#                        "Flowspaces parsed:\n%s\nFlowspaces requested:\n%s"
#                        % (pformat(fs_set_found),
#                           pformat( [f.get_full_attrs()
#                                     for f in fs_set_requested]))
#                    )
#                    
#                # make sure that all requested flowspace was parsed
#                for fs_req in fs_set_requested:
#                    found = False
#                    for fs_found in fs_set_found:
#                        if fs_req.compare_to_sliver_fs(fs_found):
#                            found = True
#                            break
#                    self.assertTrue(found,
#                        "Didn't find requested flowspace %s for dpid %s" %\
#                        (fs_found, sliver['datapath_id']))
                    
#        # Check that each dpid is used only once
#        self.assertTrue(len(found_dpids) == len(set(found_dpids)),
#                        "Some dpids are used more than once.")
#            
#        # check that all requested slivers have been indeed parsed
#        found_dpids = set(found_dpids)
#        requested_dpids = set(dpid_fs_map.keys())
#        self.assertEqual(found_dpids, requested_dpids)
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/plugins/openflow/tests/gapi/gapi.py/GAPITests.test_parse_slice/swapped operands of `not in`