def add_flowspace(fv, change):
    import re
    slice_re = re.compile(r"Slice:(?P<name>.+)=(?P<perms>\d+)")
    axn_matches = slice_re.findall(change['actions'])
    for axn in axn_matches:
        try:
            slice = DummyFVSlice.objects.filter(
                fv=fv).get(name=axn.group("name"))
        except DummyFVSlice.DoesNotExist:
            raise Exception("Tried to add flowspace for non-existing " +\
                            axn.group("name") % "slice %s")
    rule = DummyFVRule(
        fv=fv,
        match=change['match'],
        priority=int(change['priority']),
        dpid=change['dpid'],
        actions=change['actions'],
    )
    rule.save()
    return rule.id
dataset/ETHPy150Open fp7-ofelia/ocf/optin_manager/src/python/openflow/optin_manager/dummyfv/rpc.py/add_flowspace/swapped operands of `%`