Esempio n. 1
0
def _raw_exchange_id(c, name, verf=None, cred=None, protect=None, flags=0):
    if verf is None:
        verf = c.verifier
    owner = client_owner4(verf, name)
    if protect is None:
        protect = state_protect4_a(SP4_NONE)
    return c.compound([op.exchange_id(owner, flags, protect,
                                            [c.impl_id])], cred)
Esempio n. 2
0
def _simple_ops(t, env):
    """Produce a simple, valid ops sequence"""
    owner = client_owner4(env.c1.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    return [
        op.exchange_id(owner, EXCHGID4_FLAG_USE_NON_PNFS, protect,
                       [env.c1.impl_id])
    ]
Esempio n. 3
0
def _raw_exchange_id(c, name, verf=None, cred=None, protect=None, flags=0):
    if verf is None:
        verf = c.verifier
    owner = client_owner4(verf, name)
    if protect is None:
        protect = state_protect4_a(SP4_NONE)
    return c.compound([op.exchange_id(owner, flags, protect, [c.impl_id])],
                      cred)
Esempio n. 4
0
def testSupported1a(t, env):
    """EXCHANGE_ID with server only flag 

    FLAGS: exchange_id all
    CODE: EID7
    """
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([op.exchange_id(owner, EXCHGID4_FLAG_USE_NON_PNFS | EXCHGID4_FLAG_CONFIRMED_R, protect, [c.impl_id])])
    check(res, NFS4ERR_INVAL)
Esempio n. 5
0
def testNoImplId(t, env):
    """Do a simple EXCHANGE_ID w/o setting client impl_id

    FLAGS: exchange_id all
    CODE: EID2
    """
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([op.exchange_id(owner, 0, protect, [])])
    check(res)
Esempio n. 6
0
def testNoImplId(t, env):
    """Do a simple EXCHANGE_ID w/o setting client impl_id

    FLAGS: exchange_id all
    CODE: EID2
    """
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([op.exchange_id(owner, 0, protect, [])])
    check(res)
Esempio n. 7
0
def testNotOnlyOp(t, env):
    """Check for NFS4ERR_NOT_ONLY_OP

    FLAGS: exchange_id all
    CODE: EID8
    """
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([op.exchange_id(owner, 0, protect, [c.impl_id]), op.putrootfh()])
    # per draft 21 18.35.3, server MUST return NFS4ERR_NOT_ONLY_OP
    check(res, NFS4ERR_NOT_ONLY_OP)
Esempio n. 8
0
def testUpdateNonexistant(t, env):
    """Do an EXCHANGE_ID update of a non-existant record

    FLAGS: exchange_id all
    CODE: EID6
    """
    # This is part of case 7 of draft 21
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([op.exchange_id(owner, EXCHGID4_FLAG_UPD_CONFIRMED_REC_A,
                                     protect, [c.impl_id])])
    check(res, NFS4ERR_NOENT, "Update a non-existant record")
Esempio n. 9
0
def testNotOnlyOp(t, env):
    """Check for NFS4ERR_NOT_ONLY_OP

    FLAGS: exchange_id all
    CODE: EID8
    """
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound(
        [op.exchange_id(owner, 0, protect, [c.impl_id]),
         op.putrootfh()])
    # per draft 21 18.35.3, server MUST return NFS4ERR_NOT_ONLY_OP
    check(res, NFS4ERR_NOT_ONLY_OP)
Esempio n. 10
0
def testSupported(t, env):
    """Do a simple EXCHANGE_ID - no flags

    FLAGS: exchange_id all
    CODE: EID1
    """
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([op.exchange_id(owner, 0, protect, [c.impl_id])])
    check(res)
    # per draft 21 13.1, server MUST set one of these bits
    if not (res.resarray[0].eir_flags & EXCHGID4_FLAG_MASK_PNFS):
        fail("server did not set any EXCHGID4_FLAG_USE_* bits")
Esempio n. 11
0
def testSupported1a(t, env):
    """Do a simple EXCHANGE_ID - simple flag

    FLAGS: exchange_id all
    CODE: EID1a
    """
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([op.exchange_id(owner, EXCHGID4_FLAG_USE_NON_PNFS, protect, [c.impl_id])])
    check(res)
    # per draft 21 13.1, server MUST set one of these bits
    if not (res.resarray[0].eir_flags & EXCHGID4_FLAG_MASK_PNFS):
        fail("server did not set any EXCHGID4_FLAG_USE_* bits")
Esempio n. 12
0
def testUpdateNonexistant(t, env):
    """Do an EXCHANGE_ID update of a non-existant record

    FLAGS: exchange_id all
    CODE: EID6
    """
    # This is part of case 7 of draft 21
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([
        op.exchange_id(owner, EXCHGID4_FLAG_UPD_CONFIRMED_REC_A, protect,
                       [c.impl_id])
    ])
    check(res, NFS4ERR_NOENT, "Update a non-existant record")
Esempio n. 13
0
def testSupported1a(t, env):
    """EXCHANGE_ID with server only flag 

    FLAGS: exchange_id all
    CODE: EID7
    """
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([
        op.exchange_id(owner,
                       EXCHGID4_FLAG_USE_NON_PNFS | EXCHGID4_FLAG_CONFIRMED_R,
                       protect, [c.impl_id])
    ])
    check(res, NFS4ERR_INVAL)
Esempio n. 14
0
def testSupported2(t, env):
    """Do an EXCHANGE_ID from within a session

    FLAGS: exchange_id all
    CODE: EID1b
    """
    c1 = env.c1.new_client("%s_1" % env.testname(t))
    sess1 = c1.create_session()
    owner = client_owner4(sess1.c.verifier, "%s_2" % env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = sess1.compound([op.exchange_id(owner, EXCHGID4_FLAG_USE_PNFS_DS, protect, [sess1.c.impl_id])])
    check(res)
    # per draft 21 13.1, server MUST set one of these bits
    if not (res.resarray[0].eir_flags & EXCHGID4_FLAG_MASK_PNFS):
        fail("server did not set any EXCHGID4_FLAG_USE_* bits")
Esempio n. 15
0
def testBadFlags(t, env):
    """Using an undefined flag bit should return _INVAL

    draft21 18.35.3 line 26458:
    Bits not defined above should not be set in the eia_flags field.  If
    they are, the server MUST reject the operation with NFS4ERR_INVAL.

    FLAGS: exchange_id all
    CODE: EID4
    """
    # STUB - want to send with various flags set
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([op.exchange_id(owner, 4, protect, [c.impl_id])])
    check(res, NFS4ERR_INVAL, "Using undefined flag bit 0x4")
Esempio n. 16
0
 def new_client(self, name, verf=None, cred=None, protect=None, flags=0,
                expect=NFS4_OK):
     """Establish a new client_id with the server"""
     if verf is None:
         verf = self.verifier
     owner = client_owner4(verf, name)
     if protect is None:
         protect = state_protect4_a(SP4_NONE)
     res = self.compound([op.exchange_id(owner, flags, protect,
                                         [self.impl_id])],
                         cred)
     nfs4lib.check(res, expect)
     if expect == NFS4_OK:
         return ClientRecord(res.resarray[0], self, cred, protect)
     else:
         return None
Esempio n. 17
0
def testBadFlags(t, env):
    """Using an undefined flag bit should return _INVAL

    draft21 18.35.3 line 26458:
    Bits not defined above should not be set in the eia_flags field.  If
    they are, the server MUST reject the operation with NFS4ERR_INVAL.

    FLAGS: exchange_id all
    CODE: EID4
    """
    # STUB - want to send with various flags set
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = c.compound([op.exchange_id(owner, 4, protect, [c.impl_id])])
    check(res, NFS4ERR_INVAL, "Using undefined flag bit 0x4")
Esempio n. 18
0
 def new_client(self, name, verf=None, cred=None, protect=None, flags=0,
                expect=NFS4_OK):
     """Establish a new client_id with the server"""
     if verf is None:
         verf = self.verifier
     owner = client_owner4(verf, name)
     if protect is None:
         protect = state_protect4_a(SP4_NONE)
     res = self.compound([op.exchange_id(owner, flags, protect,
                                         [self.impl_id])],
                         cred)
     nfs4lib.check(res, expect)
     if expect == NFS4_OK:
         return ClientRecord(res.resarray[0], self, cred, protect)
     else:
         return None
Esempio n. 19
0
def testSupported2(t, env):
    """Do an EXCHANGE_ID from within a session

    FLAGS: exchange_id all
    CODE: EID1b
    """
    c1 = env.c1.new_client("%s_1" % env.testname(t))
    sess1 = c1.create_session()
    owner = client_owner4(sess1.c.verifier, "%s_2" % env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    res = sess1.compound([
        op.exchange_id(owner, EXCHGID4_FLAG_USE_PNFS_DS, protect,
                       [sess1.c.impl_id])
    ])
    check(res)
    # per draft 21 13.1, server MUST set one of these bits
    if not (res.resarray[0].eir_flags & EXCHGID4_FLAG_MASK_PNFS):
        fail("server did not set any EXCHGID4_FLAG_USE_* bits")
Esempio n. 20
0
def testLongArray(t, env):
    """Do a simple EXCHANGE_ID while setting impl_id array too long

    FLAGS: exchange_id all
    CODE: EID3
    """
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    ops = [op.exchange_id(owner, 0, protect, [c.impl_id, c.impl_id])]
    xid = c.compound_async(ops, checks=False)
    try:
        res = c.listen(xid)
        print res
    except RPCAcceptError, e:
        if e.stat == GARBAGE_ARGS:
            # Legitimate return
            return
        else:
            raise
Esempio n. 21
0
def testLongArray(t, env):
    """Do a simple EXCHANGE_ID while setting impl_id array too long

    FLAGS: exchange_id all
    CODE: EID3
    """
    c = env.c1
    owner = client_owner4(c.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    ops = [op.exchange_id(owner, 0, protect, [c.impl_id, c.impl_id])]
    xid = c.compound_async(ops, checks=False)
    try:
        res = c.listen(xid)
        print res
    except RPCAcceptError, e:
        if e.stat == GARBAGE_ARGS:
            # Legitimate return
            return
        else:
            raise
Esempio n. 22
0
def _simple_ops(t, env):
    """Produce a simple, valid ops sequence"""
    owner = client_owner4(env.c1.verifier, env.testname(t))
    protect = state_protect4_a(SP4_NONE)
    return [op.exchange_id(owner, EXCHGID4_FLAG_USE_NON_PNFS, protect,
                           [env.c1.impl_id])]