def test_TraceQuery_targetClass_write(self): dnStr1 = 'uni' klass1 = 'topSystem' klass2 = 'polUni' tq = TraceQuery(dnStr1, klass1) tq.targetClass = klass2 assert tq.targetClass == klass2
def test_TraceQuery_options(self): tid = '1234567890' klass = 'fvTenant' tq = TraceQuery('uni', 'fvTenant') expectedOptions = 'target-class=' + klass tq.id = tid expectedOptions += '&_dc=' + tid assert tq.options == expectedOptions
def test_TraceQuery_getUrl(self, sessionUrl, dc, requestType): session = LoginSession(sessionUrl, 'admin', 'password', requestFormat=requestType) dnStr = 'uni' klass = 'fvTenant' cq = TraceQuery(dnStr, klass) expected = sessionUrl + '/api/trace/' + dnStr + '.' + requestType expected += '?target-class=' + klass cq.id = dc expected += '&_dc=' + dc assert cq.getUrl(session) == expected
def getAncestorDnStrFromDnString(md, input, level): fvAEPg_dnStr = str(Dn.fromString(input).getAncestor(level)) tq = TraceQuery(fvAEPg_dnStr, 'fvBD') tq.subtree = 'children' fvBD = md.query(tq)[0] bd = tDnToBdCtx(str(fvBD.dn), 'BD') ctx = tDnToBdCtx((fvBD.rsctx._childObjects[None].tDn), 'ctx') if bd and ctx: return bd, ctx else: return 'na', 'na'
def getAncestorDnStrFromDnString(md, input, level): fvAEPg_dnStr = str(Dn.fromString(input).getAncestor(level)) tq = TraceQuery(fvAEPg_dnStr, 'fvBD') tq.subtree = 'children' fvBD = md.query(tq)[0] bd=tDnToBdCtx(str(fvBD.dn),'BD') ctx=tDnToBdCtx((fvBD.rsctx._childObjects[None].tDn),'ctx') if bd and ctx: return bd,ctx else: return 'na','na'
def test_TraceQuery_dnStr_read(self): dnStr = 'uni' klass = 'topSystem' tq = TraceQuery(dnStr, klass) assert tq.dnStr == dnStr
def test_TraceQuery_targetClass_read(self): dnStr = 'uni' klass = 'topSystem' tq = TraceQuery(dnStr, klass) assert tq.targetClass == klass
def test_TraceQuery_init(self): assert isinstance(TraceQuery('fabric', 'fvTenant'), TraceQuery)