Skip to content

Commit 1a7dea5

Browse files
committed
sync L1 sample
1 parent 264d5ec commit 1a7dea5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

automation_api_scripts/sync_L1.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from cloudshell.api.cloudshell_api import CloudShellAPISession
2+
3+
api = CloudShellAPISession(host="localhost",
4+
username="admin",
5+
password="admin",
6+
domain="Global")
7+
8+
RESOURCE_NAME = "<MY_RESOURCE"
9+
10+
# the raw api calls
11+
sync_from_response = api.SyncResourceFromDevice(resourceFullPath=RESOURCE_NAME)
12+
sync_to_response = api.SyncResourceToDevice(resourceFullPath=RESOURCE_NAME)
13+
14+
# to sync child resources, use get resource details, then iterate over desired resources
15+
root_resource_details = api.GetResourceDetails(RESOURCE_NAME)
16+
child_resources = root_resource_details.ChildResources
17+
18+
for resource in child_resources:
19+
print("syncing resource {}".format(resource.Name))
20+
api.SyncResourceFromDevice(resource.Name)
21+
22+
print("done")

0 commit comments

Comments
 (0)