Connect to API via Rest Connecor, and create filter entry, check the added filter entry (and delete the filter entry). This will check if the filter entry exists, or not to make sure REST API is properly done.
No python knowledge required. All is done in YAML by using Blitz
(Quick Trigger).
Please check trigger_datafile.yaml
. The test is written in YAML. So, easy to find corresponding steps in the YAML.
- Check Filter Entry doesn't exist
- Check Filter Entry doesn't exist under tenant
- Create Filter Entry under tenant
- Check Filter Entry exists
- Check Filter Entry exists under tenant
- Delete Filter Entry (Optional)
Install pyATS|Genie and Rest Connector.
pip install 'pyats[full]' rest.connector
By pyats run job command
pyats run job job.py --testbed-file aci_devnet_sandbox.yaml
By pyats run genie command (without job.py
)
pyats run genie --testbed-file aci_devnet_sandbox.yaml --trigger-datafile trigger_datafile.yaml --trigger-groups "And('tenant')" --subsection-datafile subsection_datafile.yaml
Above example keeps the filter entry on APIC. So, let's enable delete
section.
Please uncomment section delete_filter_entry
in trigger_datafile.yaml
.
- delete_filter_entry:
- api:
device: uut
function: apic_rest_post
arguments:
dn: "/api/node/mo/uni/tn-%{vars.tenant}/flt-%{vars.filter}/e-%{vars.filter_entry}.json"
payload: |
{
"vzEntry": {
"attributes": {
"dn": "uni/tn-%{vars.tenant}/flt-%{vars.filter}/e-%{vars.filter_entry}",
"status": "deleted"
},
"children": []
}
}
include:
- contains_key_value("totalCount", '0')
The deletion can be checked on APIC.