def create_session(c, cred=None, flags=0): """Send a simple CREATE_SESSION""" chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[]) res = c.c.compound([op.create_session(c.clientid, c.seqid, flags, chan_attrs, chan_attrs, 123, [])], cred) return res
def create_session(c, cred=None, flags=0): """Send a simple CREATE_SESSION""" chan_attrs = channel_attrs4(0, 8192, 8192, 8192, 128, 8, []) res = c.c.compound([ op.create_session(c.clientid, c.seqid, flags, chan_attrs, chan_attrs, 123, []) ], cred) return res
def testBadSlot(t, env): """Send a request with a bad slot FLAGS: sequence all CODE: SEQ8 """ c1 = env.c1.new_client(env.testname(t)) # Session has 8 slots (numbered 0 through 7) attrs = channel_attrs4(0, 8192, 8192, 8192, 128, 8, []) sess1 = c1.create_session(fore_attrs = attrs) # Send sequence on (non-existant) slot number 8 res = env.c1.compound([op.sequence(sess1.sessionid, 1, 8, 8, True)]) check(res, NFS4ERR_BADSLOT)
def testRequestTooBig(t, env): """Send a request bigger than session can handle FLAGS: sequence all CODE: SEQ6 """ c1 = env.c1.new_client(env.testname(t)) # Only allow 512 byte requests attrs = channel_attrs4(0, 512, 8192, 8192, 128, 8, []) sess1 = c1.create_session(fore_attrs = attrs) # Send a lookup request with a very long filename res = sess1.compound([op.putrootfh(), op.lookup("12345"*100)]) # FIXME - NAME_TOO_BIG is valid, don't want it to be check(res, NFS4ERR_REQ_TOO_BIG)
def testTooManyOps(t, env): """Send a request with more ops than the session can handle FLAGS: sequence all CODE: SEQ7 """ c1 = env.c1.new_client(env.testname(t)) # Create session asking for 4 ops max per request attrs = channel_attrs4(0, 8192, 8192, 8192, 4, 8, []) sess1 = c1.create_session(fore_attrs = attrs) # Send the max number of ops allowed by the server lots_of_ops = [op.putrootfh(), op.getfh()] lots_of_ops += [op.getattr(0) for num in xrange(sess1.fore_channel.maxoperations-3)] res = sess1.compound(lots_of_ops) check(res) # Add one more op to exceed the maximum lots_of_ops += [op.getattr(0)] res = sess1.compound(lots_of_ops) check(res, NFS4ERR_TOO_MANY_OPS)