Debian Codegraph @

docs/labs/lab04-container-management/create_container.py

raw
1 # Copyright (c) 2020 Arista Networks, Inc.
2 # Use of this source code is governed by the Apache License 2.0
3 # that can be found in the COPYING file.
4
5 from cvprac.cvp_client import CvpClient
6 import ssl
7 ssl._create_default_https_context = ssl._create_unverified_context
8 import requests.packages.urllib3
9 requests.packages.urllib3.disable_warnings()
10
11 # Create connection to CloudVision
12 clnt = CvpClient()
13 clnt.connect(['cvp1'],'username', 'password')
14
15 # Get parent container information
16 parent = clnt.api.get_container_by_name("ContainerA")
17
18 # Create new container ContainerB under ContainerA
19
20 clnt.api.add_container("ContainerB",parent["name"],parent["key"])