Description

This article explains how to export and import content between Apstra servers by using Apstra-CLI.

⚠️ IMPORTANT!  Apstra-CLI is considered experimental with limited support and its use must be under the strict supervision of Juniper JTAC Support. Do not use Apstra-CLI in production networks unless advised by Juniper JTAC. Versions of Apstra-CLI are not intended for certain versions of Apstra. Some Apstra-CLI commands may or may not work between different versions of Apstra. It is always best to test a certain version of Apstra-CLI with a specific version of Apstra in a non-production environment or contact Juniper JTAC Support for assistance.

Solution

Content Export

The  content export Apstra-CLI command will export content to JSON files. Use the " --folder " option to specify the folder location for the exported object. The " --type " option allows users to specify the type of resources to export (for example: blueprints and probes).

apstra-cli>  content export --folder /project/mycontent/ --type blueprints,probes
Exporting blueprints, probes to /project/mycontent
Exporting to /project/mycontent/blueprints/apstra-4-0-0-blueprint-1199a61c-e128-4393-9050-5a0c3890cdb6.json
Exporting to /project/mycontent/probes/lag-imbalance-7c09187a-b1f0-44c5-8dde-57552841ae8f.json
Exporting to /project/mycontent/probes/esi-imbalance-6ed444ab-6963-454c-9c41-8f75f485458c.json
Exporting to /project/mycontent/probes/device-traffic-1b983144-a84b-47cc-971c-2a8900e3f6eb.json
Exporting to /project/mycontent/probes/ecmp-imbalance-fabric-interfaces-1efacb2b-7243-44cd-975b-4f98a1d4f2a0.json
Exporting to /project/mycontent/probes/device-system-health-0af6d3f9-de06-4f86-8941-a422524c08d3.json
 apstra-cli>

 

Content Import

The content import Apstra-CLI command will import content from JSON files into the Apstra server database.

apstra-cli> content import --folder /project/my3302content/
Importing ['gui', 'telemetry-service-definitions', 'packages', 'reference-designs', 'system-agent-profiles', 'offbox-agents', 'property-sets', 'configlets',
'ip-pools', 'ipv6-pools', 'asn-pools', 'vni-pools', 'external-routers', 'device-profiles', 'logical-devices', 'interface-maps', 'rack-types', 'templates',
'blueprints', 'probes', 'widgets', 'dashboards'] resources from /project/my3302content
Importing interface-maps resources
Skipping existing interface-maps resource "Juniper vQFX____spine-ld" with id 2a307fbc-df38-4edd-975c-5dddb41000e1
Skipping existing interface-maps resource "Arista vEOS____leaf-ld" with id 60187a52-c8e7-46d4-94a2-f1e9a006d79b
Importing blueprints resources
Creating new blueprints resource "Apstra 3.3.0.2 Blueprint"
Created new blueprints resource "Apstra 3.3.0.2 Blueprint" and got id 536d968f-2a2e-48c2-8ad1-e33bc1e12cf3
Summary of warnings for content import
blueprints:
None
apstra-cli> 

If the resource exists, the content import command will skip importing the resource.

Note: If the Apstra-CLI " content import " command is unable to load the JSON object, the process will fail.

apstra-cli> content import --folder /project/my3302content/ --type probes Importing ['probes'] resources from /project/my3302content

Importing probes resources
Importing probes resources

Command failed: Unexpected error: Traceback (most recent call last):
  File "/aoscli-venv/local/lib/python2.7/site-packages/aos_cli/command.py", line 416, in run_cmd
    parse_result.cmd.run(parse_result.values, context)
  File "/aoscli-venv/local/lib/python2.7/site-packages/aos_cli/content_cmds.py", line 276, in run
    self._run(root_path, values, context)
  File "/aoscli-venv/local/lib/python2.7/site-packages/aos_cli/content_cmds.py", line 313, in _run
    for r in processor.list_resources(type_spec)
  File "/aoscli-venv/local/lib/python2.7/site-packages/aos_cli/content/probe_processor.py", line 17, in list_resources
    for probe in self.client.blueprints[bp['id']].probes.list() TypeError: 'NoneType' object is not iterable
apstra-ci>

Modification History

AOS-CLI => Apstra-CLI