Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated cvpudater to use ceos-build file #804

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions nested-labvm/atd-docker/cvpUpdater/src/cvpUpdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def checkContainer(cnt):
if cnt not in CVP_CONTAINERS:
CVP_CONTAINERS.append(cnt)

def getEosDevice(topo,eosYaml,cvpMapper):
def getEosDevice(topo,eosYaml,cvpMapper,topoType):
"""
Function that Parses through the YAML file and creates a CVPSWITCH class object for each EOS device in the topo file.
Parameters:
Expand All @@ -54,12 +54,19 @@ def getEosDevice(topo,eosYaml,cvpMapper):
"""
EOS_DEV = []
for dev in eosYaml:
devn = list(dev.keys())[0]
try:
EOS_DEV.append(CVPSWITCH(devn,dev[devn]['ip_addr'],cvpMapper[devn]))
checkContainer(cvpMapper[dev])
except:
EOS_DEV.append(CVPSWITCH(devn,dev[devn]['ip_addr']))
if topoType == "ceos":
try:
EOS_DEV.append(CVPSWITCH(dev["name"], dev["ip_addr"], cvpMapper[dev["name"]]))
checkContainer(cvpMapper[dev])
except:
EOS_DEV.append(CVPSWITCH(dev["name"],dev["ip_addr"]))
else:
devn = list(dev.keys())[0]
try:
EOS_DEV.append(CVPSWITCH(devn,dev[devn]['ip_addr'],cvpMapper[devn]))
checkContainer(cvpMapper[dev])
except:
EOS_DEV.append(CVPSWITCH(devn,dev[devn]['ip_addr']))
return(EOS_DEV)

def eosDeviceMapper(eos_type, eos_yaml):
Expand Down Expand Up @@ -188,20 +195,24 @@ def main():
cvp_yaml = getTopoInfo(cvp_file)
file_counter = 0
while True:
if path.exists(REPO_TOPO + atd_yaml['topology'] + '/topo_build.yml'):
pS("OK", "TOPO_BUILD file is available.")
if path.exists(REPO_TOPO + atd_yaml['topology'] + '/topo_build.yml') or path.exists(REPO_TOPO + atd_yaml['topology'] + '/ceos_build.yml'):
pS("OK", "BUILD file is available.")
break
else:
if file_counter >= 10:
exit('Topo Build timer expired')
else:
file_counter += 1
pS("ERROR", "TOPO_BUILD file is not available...Waiting for {0} seconds".format(sleep_delay))
pS("ERROR", "BUILD file is not available...Waiting for {0} seconds".format(sleep_delay))
sleep(sleep_delay)

build_yaml = getTopoInfo(REPO_TOPO + atd_yaml['topology'] + '/topo_build.yml')
try:
build_yaml = getTopoInfo(REPO_TOPO + atd_yaml['topology'] + '/ceos_build.yml')
topo_type = "ceos"
except:
build_yaml = getTopoInfo(REPO_TOPO + atd_yaml['topology'] + '/topo_build.yml')
topo_type = "veos"
eos_cnt_map = eosContainerMapper(cvp_yaml['cvp_info']['containers'])
eos_info = getEosDevice(atd_yaml['topology'],build_yaml['nodes'],eos_cnt_map)
eos_info = getEosDevice(atd_yaml['topology'],build_yaml['nodes'],eos_cnt_map, topo_type)
eos_dev_map = eosDeviceMapper(atd_yaml['eos_type'], build_yaml['nodes'])
configlet_location = '/opt/atd/topologies/{0}/configlets/'.format(atd_yaml['topology'])
cvpUsername = atd_yaml['login_info']['jump_host']['user']
Expand All @@ -218,7 +229,10 @@ def main():
sleep(sleep_delay)

# Check to see if all nodes have connected to CVP before proceeding
FILE_BUILD = YAML().load(open(REPO_TOPO + atd_yaml['topology'] + '/topo_build.yml', 'r'))
if topo_type == "ceos":
FILE_BUILD = YAML().load(open(REPO_TOPO + atd_yaml['topology'] + '/ceos_build.yml', 'r'))
else:
FILE_BUILD = YAML().load(open(REPO_TOPO + atd_yaml['topology'] + '/topo_build.yml', 'r'))
NODES = FILE_BUILD['nodes']
# ==========================================
# Add Check for configlet import only
Expand Down
2 changes: 1 addition & 1 deletion nested-labvm/atd-docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ services:
- /var/lib/libvirt/images/veos:/var/lib/libvirt/images/veos:rw
cvpupdater:
container_name: atd-cvpupdater
image: us.gcr.io/beta-atds/atddocker_cvpupdater:2.3.1
image: us.gcr.io/beta-atds/atddocker_cvpupdater:2.3.5
user: $ArID:$ArGD
restart: always
environment:
Expand Down