'Pack and unpack a bunch of actions'

def test_action_pack_unpack(self):

    for name in dir(nx):
        a = getattr(nx, name)
        if (not nx._issubclass(a, of.ofp_action_vendor_base)):
            continue
        print 'Trying', name, '...',
        init = getattr(self, ('_init_action_' + name), (lambda c: c()))
        original = init(a)
        original_packed = original.pack()
        unoriginal = a()
        offset = unoriginal.unpack(original_packed, 0)
        self.assertEqual(offset, len(original_packed), ("Didn't    unpack    entire    entry    " + name))
        unoriginal_packed = unoriginal.pack()
        self.assertEqual(original, unoriginal, ('Pack/Unpack    failed    for    ' + name))
        print 'Success!'
