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

Cvp open ports #11

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions eos_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ def get_file_list(image, img):
filename.append(image[:4] + "rpm-installer-" + image[4:])
elif img == 'upgrade':
filename.append(image[:4] + "upgrade-" + image[4:] + ".tgz")
elif img == 'ports':
filename.append("CloudVision-" + image[4:] + "-Open-Ports-")
else: # otherwise it's a normal EOS image they're after
index = 'EOS' # corresponds to "EOS" top level folder
if img == 'cEOS':
Expand Down Expand Up @@ -228,7 +230,7 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve,
else:
return True
# next check CVP images
if img == ('ova') or img == ('kvm') or img == ('upgrade') or img == ('rpm'):
if img == ('ova') or img == ('kvm') or img == ('upgrade') or img == ('rpm') or img == ('ports'):
test = re.compile('^cvp-[0-9][0-9][0-9][0-9]\.[0-9]\.[0-9]$')
cvp_valid = test.match(image)
if not cvp_valid:
Expand Down Expand Up @@ -343,6 +345,9 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve,
path = grandchild.attrib['path']
elif grandchild.text == (filename_list[0] + '.md5'):
sha512_path = grandchild.attrib['path'] # corresponds to the download path of the MD5 checksum
elif ('Open-Ports' in grandchild.text) and (filename_list[0] in grandchild.text):
filename_list[0] = grandchild.text
path = grandchild.attrib['path'] # corresponds to the download path
elif child.attrib == {'label': "CVP IPAM Application"} and img == "ipam":
for grandchild in child.iter('file'):
#print(grandchild.text)
Expand Down Expand Up @@ -403,7 +408,7 @@ def check_arguments(api, file_list, img, cvp, rootpw, cvp_user, cvp_passwd, eve,
download_file(download_link, filename_list[1])


if (img != 'source') and (img != 'RN'):
if (img != 'source') and (img != 'RN') and (img != 'ports'):
jsonpost = {'sessionCode': session_code, 'filePath': sha512_path}
sha512_result = requests.post(download_link_url, data=json.dumps(jsonpost))
sha512_download_link = (sha512_result.json()["data"]["url"])
Expand Down