300-635 · Question #41
Which Python code creates a VRF in an ACI tenant using the Cobra SDK?
The correct answer is B. Ctx(Tenant(uniMo, 'CustA'), 'CustA_VRF'). Option B is correct because the Cobra SDK uses Ctx (short for "Context") as the Python class name for a VRF - ACI internally models VRFs as fvCtx objects, and Cobra exposes this as Ctx - and Tenant as the proper SDK class for fvTenant. A fails on two counts: Vrf is not a valid…
Question
Options
- AVrf(fvTenant(uniMo, 'CustA'), 'CustA_VRF')
- BCtx(Tenant(uniMo, 'CustA'), 'CustA_VRF')
- CVrf(Tenant(uniMo, 'CustA'), 'CustA_VRF')
- DCtx(fvTenant(uniMo, 'CustA'), 'CustA_VRF')
How the community answered
(49 responses)- A2% (1)
- B92% (45)
- C2% (1)
- D4% (2)
Explanation
Option B is correct because the Cobra SDK uses Ctx (short for "Context") as the Python class name for a VRF - ACI internally models VRFs as fvCtx objects, and Cobra exposes this as Ctx - and Tenant as the proper SDK class for fvTenant.
- A fails on two counts:
Vrfis not a valid Cobra SDK class (ACI never uses "VRF" as an object name), andfvTenantis the raw ACI managed object name, not the SDK's Python class. - C uses the correct
Tenantclass but still uses the non-existentVrfclass; ACI/Cobra has no such identifier. - D uses the correct
Ctxclass but passesfvTenant(...)instead ofTenant(...); in Cobra SDK you use the shortened Python class names (Tenant,Ctx), not the raw MO names likefvTenant.
Memory tip: ACI calls a VRF a "Context," so in Cobra SDK it's always Ctx, never Vrf. If you see Vrf in an answer, eliminate it immediately.
Topics
Community Discussion
No community discussion yet for this question.