Exemplo n.º 1
0
def testReplayCache002(t, env):
    """Send two successful non-idempotent compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9b
    """
    sess1 = env.c1.new_client_session(env.testname(t))
    res = create_file(sess1, "%s_1" % env.testname(t))
    fh = res.resarray[-1].object
    stateid = res.resarray[-2].stateid

    check(res)
    ops = env.home + [op.savefh(),\
          op.rename("%s_1" % env.testname(t), "%s_2" % env.testname(t))]
    res1 = sess1.compound(ops, cache_this=True)
    check(res1)
    res2 = sess1.compound(ops, seq_delta=0)
    check(res2)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")

    # Cleanup
    res = sess1.compound([op.putfh(fh), op.close(0, stateid)])
    check(res)
Exemplo n.º 2
0
def testReplayCache002(t, env):
    """Send two successful non-idempotent compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9b
    """
    sess1 = env.c1.new_client_session(env.testname(t))
    res = create_file(sess1, "%s_1" % env.testname(t))
    fh = res.resarray[-1].object
    stateid = res.resarray[-2].stateid

    check(res)
    ops = env.home + [op.savefh(),\
          op.rename("%s_1" % env.testname(t), "%s_2" % env.testname(t))]
    res1 = sess1.compound(ops, cache_this=True)
    check(res1)
    res2 = sess1.compound(ops, seq_delta=0)
    check(res2)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")

    # Cleanup
    res = sess1.compound([op.putfh(fh), op.close(0, stateid)])
    check(res)
Exemplo n.º 3
0
def testCsr_sequence(t, env):
    """The corresponding result of csa_sequence is csr_sequence,
       which MUST be equal to csa_sequence.

    FLAGS: create_session all
    CODE: CSESS24
    """
    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION
    chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
    csa_sequence = c.seqid
    sess1 = c.create_session(fore_attrs=chan_attrs)
    if not nfs4lib.test_equal(sess1.seqid, csa_sequence, "int"):
        fail("Server returns bad csr_sequence which not equal to csa_sequence")
Exemplo n.º 4
0
def testSessionidSequenceidSlotid(t, env):
    """ The sr_sessionid result MUST equal sa_sessionid.
        The sr_slotid result MUST equal sa_slotid.
        The sr_sequenceid result MUST equal sa_sequenceid.
        rfc5661 18.46.3

    FLAGS: sequence all
    CODE: SEQ12
    """
    c = env.c1.new_client(env.testname(t))
    sess1 = c.create_session()

    # SEQUENCE
    sid = sess1.sessionid
    res = c.c.compound([op.sequence(sid, 1, 2, 3, True)])
    if not nfs4lib.test_equal(res.resarray[0].sr_sessionid, sid, "opaque"):
        fail("server return bad sessionid")

    if not nfs4lib.test_equal(res.resarray[0].sr_sequenceid, 1, "int"):
        fail("server return bad sequenceid")

    if not nfs4lib.test_equal(res.resarray[0].sr_slotid, 2, "int"):
        fail("server return bad slotid")
Exemplo n.º 5
0
def testSessionidSequenceidSlotid(t, env):
    """ The sr_sessionid result MUST equal sa_sessionid.
        The sr_slotid result MUST equal sa_slotid.
        The sr_sequenceid result MUST equal sa_sequenceid.
        rfc5661 18.46.3

    FLAGS: sequence all
    CODE: SEQ12
    """
    c = env.c1.new_client(env.testname(t))
    sess1 = c.create_session()

    # SEQUENCE
    sid = sess1.sessionid
    res = c.c.compound([op.sequence(sid, 1, 2, 3, True)])
    if not nfs4lib.test_equal(res.resarray[0].sr_sessionid, sid, "opaque"):
        fail("server return bad sessionid")

    if not nfs4lib.test_equal(res.resarray[0].sr_sequenceid, 1, "int"):
        fail("server return bad sequenceid")

    if not nfs4lib.test_equal(res.resarray[0].sr_slotid, 2, "int"):
        fail("server return bad slotid")
Exemplo n.º 6
0
def testCsr_sequence(t, env):
    """The corresponding result of csa_sequence is csr_sequence,
       which MUST be equal to csa_sequence.

    FLAGS: create_session all
    CODE: CSESS24
    """
    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION
    chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
    csa_sequence = c.seqid
    sess1 = c.create_session(fore_attrs=chan_attrs)
    if not nfs4lib.test_equal(sess1.seqid, csa_sequence, "int"):
        fail("Server returns bad csr_sequence which not equal to csa_sequence")
Exemplo n.º 7
0
def testReplayCache005(t, env):
    """Send two unsupported compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9e
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    res1 = sess1.compound([op.illegal()], cache_this=True)
    check(res1, NFS4ERR_OP_ILLEGAL)
    res2 = sess1.compound([op.illegal()], seq_delta=0)
    check(res2, NFS4ERR_OP_ILLEGAL)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 8
0
def testReplayCache003(t, env):
    """Send two unsuccessful idempotent compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9c
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    res1 = sess1.compound([op.putrootfh(), op.lookup("")], cache_this=True)
    check(res1, NFS4ERR_INVAL)
    res2 = sess1.compound([op.putrootfh(), op.lookup("")], seq_delta=0)
    check(res2, NFS4ERR_INVAL)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 9
0
def testReplayCache006(t, env):
    """Send two solo sequence compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9f
    """
    c = env.c1.new_client(env.testname(t))
    sess = c.create_session()
    res1 = sess.compound([])
    check(res1)
    res2 = sess.compound([], seq_delta=0)
    check(res2)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 10
0
def testReplayCache006(t, env):
    """Send two solo sequence compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9f
    """
    c = env.c1.new_client(env.testname(t))
    sess = c.create_session()
    res1 = sess.compound([])
    check(res1)
    res2 = sess.compound([], seq_delta=0)
    check(res2)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 11
0
def testReplayCache005(t, env):
    """Send two unsupported compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9e
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    res1 = sess1.compound([op.illegal()], cache_this=True)
    check(res1, NFS4ERR_OP_ILLEGAL)
    res2 = sess1.compound([op.illegal()], seq_delta=0)
    check(res2, NFS4ERR_OP_ILLEGAL)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 12
0
def testReplayCache003(t, env):
    """Send two unsuccessful idempotent compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9c
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    res1 = sess1.compound([op.putrootfh(), op.lookup("")], cache_this=True)
    check(res1, NFS4ERR_INVAL)
    res2 = sess1.compound([op.putrootfh(), op.lookup("")], seq_delta=0)
    check(res2, NFS4ERR_INVAL)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 13
0
def testReplayCache004(t, env):
    """Send two unsuccessful non-idempotent compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9d
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    ops = env.home
    ops += [op.savefh(), op.rename("", "foo")]
    res1 = sess1.compound(ops, cache_this=True)
    check(res1, NFS4ERR_INVAL)
    res2 = sess1.compound(ops, seq_delta=0)
    check(res2, NFS4ERR_INVAL)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 14
0
def testReplay2(t, env):
    """Replay a unsuccessful CREATE_SESSION
    
    FLAGS: create_session all
    DEPEND: CSESS9
    CODE: CSESS6
    """
    c = env.c1.new_client(env.testname(t), cred=env.cred1)
    res1 = create_session(c.c, c.clientid, c.seqid, cred=env.cred2)
    check(res1, NFS4ERR_CLID_INUSE)
    # REPLAY
    res2 = create_session(c.c, c.clientid, c.seqid, cred=env.cred2)
    check(res2, NFS4ERR_CLID_INUSE)
    # Test results are equal (ignoring tags)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 15
0
def testReplay2(t, env):
    """Replay a unsuccessful CREATE_SESSION
    
    FLAGS: create_session all
    DEPEND: CSESS9
    CODE: CSESS6
    """
    c = env.c1.new_client(env.testname(t), cred=env.cred1)
    res1 = create_session(c.c, c.clientid, c.seqid, cred=env.cred2)
    check(res1, NFS4ERR_CLID_INUSE)
    # REPLAY
    res2 = create_session(c.c, c.clientid, c.seqid, cred=env.cred2)
    check(res2, NFS4ERR_CLID_INUSE)
    # Test results are equal (ignoring tags)
    res1.tag = res2.tag = b""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 16
0
def testReplayCache004(t, env):
    """Send two unsuccessful non-idempotent compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9d
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    ops = env.home
    ops += [op.savefh(), op.rename("", "foo")]
    res1 = sess1.compound(ops, cache_this=True)
    check(res1, NFS4ERR_INVAL)
    res2 = sess1.compound(ops, seq_delta=0)
    check(res2, NFS4ERR_INVAL)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 17
0
def testReplay1(t, env):
    """Replay a successful CREATE_SESSION
    
    FLAGS: create_session all
    CODE: CSESS5
    """
    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION
    res1 = create_session(c.c, c.clientid, c.seqid)
    check(res1)
    # REPLAY
    res2 = create_session(c.c, c.clientid, c.seqid)
    check(res2)
    # Test results are equal (ignoring tags)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 18
0
def testReplay1(t, env):
    """Replay a successful CREATE_SESSION
    
    FLAGS: create_session all
    CODE: CSESS5
    """
    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION
    res1 = create_session(c.c, c.clientid, c.seqid)
    check(res1)
    # REPLAY
    res2 = create_session(c.c, c.clientid, c.seqid)
    check(res2)
    # Test results are equal (ignoring tags)
    res1.tag = res2.tag = b""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 19
0
def testMaxreqs(t, env):
    """A CREATE_SESSION with maxreqs too large should return
       a modified value

    FLAGS: create_session all
    CODE: CSESS22
    """
    # Assuming this is too large for any server; increase if necessary:
    # but too huge will eat many memory for replay_cache, be careful!
    TOO_MANY_SLOTS = 500

    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION with fore_channel = TOO_MANY_SLOTS
    chan_attrs = channel_attrs4(0,8192,8192,8192,128, TOO_MANY_SLOTS, [])
    sess1 = c.create_session(fore_attrs=chan_attrs)
    if nfs4lib.test_equal(sess1.fore_channel.maxrequests,
                          chan_attrs.ca_maxrequests, "count4"):
        fail("Server allows surprisingly large fore_channel maxreqs")
Exemplo n.º 20
0
def testMaxreqs(t, env):
    """A CREATE_SESSION with maxreqs too large should return
       a modified value

    FLAGS: create_session all
    CODE: CSESS22
    """
    # Assuming this is too large for any server; increase if necessary:
    # but too huge will eat many memory for replay_cache, be careful!
    TOO_MANY_SLOTS = 500

    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION with fore_channel = TOO_MANY_SLOTS
    chan_attrs = channel_attrs4(0,8192,8192,8192,128, TOO_MANY_SLOTS, [])
    sess1 = c.create_session(fore_attrs=chan_attrs)
    if nfs4lib.test_equal(sess1.fore_channel.maxrequests,
                          chan_attrs.ca_maxrequests, "count4"):
        fail("Server allows surprisingly large fore_channel maxreqs")
Exemplo n.º 21
0
def testReplayCache002(t, env):
    """Send two successful non-idempotent compounds with same seqid

    FLAGS: sequence all
    CODE: SEQ9b
    """
    c1 = env.c1.new_client(env.testname(t))
    sess1 = c1.create_session()
    res = create_file(sess1, "%s_1" % env.testname(t))
    check(res)
    ops = env.home + [op.savefh(),\
          op.rename("%s_1" % env.testname(t), "%s_2" % env.testname(t))]
    res1 = sess1.compound(ops, cache_this=True)
    check(res1)
    res2 = sess1.compound(ops, seq_delta=0)
    check(res2)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 22
0
def testReplay1b(t, env):
    """Replay a successful SEQUENCE:CREATE_SESSION without a preceeding SEQUENCE

    FLAGS: create_session all
    CODE: CSESS5b
    """
    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION
    sess1 = c.create_session()
    # another CREATE_SESSION with SEQUENCE from first session
    c.seqid = 2
    chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
    cs_op = op.create_session(c.clientid, c.seqid, 0,
                              chan_attrs, chan_attrs, c.c.prog, [])
    res1 = sess1.compound([cs_op])
    check(res1)
    # REPLAY second CREATE_SESSION without SEQUENCE
    res2 = create_session(c.c, c.clientid, c.seqid)
    check(res2)
    # Test results are equal (ignoring tags)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 23
0
def testReplay1b(t, env):
    """Replay a successful SEQUENCE:CREATE_SESSION without a preceeding SEQUENCE

    FLAGS: create_session all
    CODE: CSESS5b
    """
    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION
    sess1 = c.create_session()
    # another CREATE_SESSION with SEQUENCE from first session
    c.seqid = 2
    chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
    cs_op = op.create_session(c.clientid, c.seqid, 0,
                              chan_attrs, chan_attrs, c.c.prog, [])
    res1 = sess1.compound([cs_op])
    check(res1)
    # REPLAY second CREATE_SESSION without SEQUENCE
    res2 = create_session(c.c, c.clientid, c.seqid)
    check(res2)
    # Test results are equal (ignoring tags)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 24
0
def testReplay1a(t, env):
    """Replay a successful CREATE_SESSION with a SEQUENCE from a different session

    FLAGS: create_session all
    CODE: CSESS5a
    """
    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION
    sess1 = c.create_session()
    # another CREATE_SESSION
    c.seqid = 2
    chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
    sec = [callback_sec_parms4(0)]
    res1 = create_session(c.c, c.clientid, c.seqid)
    check(res1)
    # REPLAY first CREATE_SESSION with SEQUENCE from 2nd session
    cs_op = op.create_session(c.clientid, c.seqid, 0,
                              chan_attrs, chan_attrs, c.c.prog, sec)
    res2 = sess1.compound([cs_op])
    check(res2)
    # Test results are equal (ignoring tags)
    res1.tag = res2.tag = b""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")
Exemplo n.º 25
0
def testReplay1a(t, env):
    """Replay a successful CREATE_SESSION with a SEQUENCE from a different session

    FLAGS: create_session all
    CODE: CSESS5a
    """
    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION
    sess1 = c.create_session()
    # another CREATE_SESSION
    c.seqid = 2
    chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
    sec = [callback_sec_parms4(0)]
    res1 = create_session(c.c, c.clientid, c.seqid)
    check(res1)
    # REPLAY first CREATE_SESSION with SEQUENCE from 2nd session
    cs_op = op.create_session(c.clientid, c.seqid, 0,
                              chan_attrs, chan_attrs, c.c.prog, sec)
    res2 = sess1.compound([cs_op])
    check(res2)
    # Test results are equal (ignoring tags)
    res1.tag = res2.tag = ""
    if not nfs4lib.test_equal(res1, res2):
        fail("Replay results not equal")