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

[REVIEW] - Adds test for switch config types #784

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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: 9 additions & 0 deletions facts/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ def isvalidtype(val):
return True
return False

def isvalidport(val):
""""test for valid port config [FIBER, RSRVD, TRUNK, VLAN, VVBB, VVLAN]"""
return val in ["FIBER", "RSRVD", "TRUNK", "VLAN", "VVBB", "VVLAN"]

def isvalidlink(val):
""""test for valid link type [Uplink, Downlink, AP, MassFlash]"""
return val in ["Uplink", "Downlink", "AP", "MassFlash", "-"]

def test_csvfile(meta):
"""csv wrapper for test_datafile"""
Expand Down Expand Up @@ -210,6 +217,8 @@ def test_datafile(delimiter, meta):
continue
# run the validators for each column
for i, val in enumerate(elems):
if val.startswith("//"):
continue
if not meta["cols"][i](val.rstrip("\n")):
return False, "invalid field " + val + " failed " + meta["cols"][
i
Expand Down
20 changes: 20 additions & 0 deletions facts/test_datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,26 @@ def test_switchtypes_tsv():
result, err = ds.test_tsvfile(meta)
assert result, err

def test_switchconfigs_tsv():
"""test switchconfigs"""

directory = "../switch-configuration/config/types/"
for filename in os.listdir(directory):
meta = {
"file": directory + filename,
"header": False,
"count": "1+",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the count here should be 4+ since it looks like we have a mix of 4-6 columns for the config types

"cols": [
ds.isvalidport,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having isvalidport and isvalidlink is definitely a great start to testing these switch config types, nice work!

ds.isuntested,
ds.isuntested,
ds.isuntested,
ds.isvalidlink,
ds.isuntested,
],
}
result, err = ds.test_tsvfile(meta)
assert result, err

def test_vlansd_tsv():
"""test vlans.d/"""
Expand Down
6 changes: 2 additions & 4 deletions switch-configuration/config/types/Booth
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Expo Booth Area switch Template
TRUNK ge-0/0/0 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra,exAVLAN, \
exSigns,exVmVendor,vendor_backbone - Uplink
TRUNK ge-0/0/1 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra,exAVLAN, \
exSigns,exVmVendor,vendor_backbone - Downlink
TRUNK ge-0/0/0 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra,exAVLAN, exSigns,exVmVendor,vendor_backbone - Uplink
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id prefer it we update test_datafile to support the \ for multiline entries. Would you mind seeing how feasible that approach would be?

TRUNK ge-0/0/1 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra,exAVLAN, exSigns,exVmVendor,vendor_backbone - Downlink
RSRVD 6
TRUNK ge-0/0/8 exInfra,exSCALE-SLOW,exSCALE-FAST POE AP
TRUNK ge-0/0/9 exInfra,exSCALE-SLOW,exSCALE-FAST POE AP
Expand Down
156 changes: 48 additions & 108 deletions switch-configuration/config/types/Catwalk
Original file line number Diff line number Diff line change
@@ -1,109 +1,49 @@
// Expo Center Catwalk Switch Configuration
TRUNK ge-0/0/0 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Uplink
TRUNK ge-0/0/1 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/2 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/3 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/4 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/5 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/6 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/7 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/8 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/9 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/10 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/11 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/12 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/13 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/14 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/15 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/16 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/17 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/18 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/19 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/20 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/21 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/22 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/23 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/24 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/25 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/26 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/27 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/28 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/29 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, \
exAVLAN,vendor_backbone,exVmVendor \
exSigns,exVmVendor,HAM_BRIDGE - Downlink
TRUNK ge-0/0/30 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/31 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/32 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/33 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/34 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/35 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/36 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/37 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/38 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/39 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/40 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/41 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/42 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/43 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/44 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/45 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/46 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/47 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/0 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Uplink
TRUNK ge-0/0/1 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/2 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/3 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/4 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/5 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/6 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/7 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/8 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/9 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/10 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/11 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/12 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/13 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/14 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/15 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/16 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/17 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/18 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/19 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/20 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/21 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/22 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/23 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/24 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/25 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/26 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/27 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/28 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,HAM_BRIDGE - Downlink
TRUNK ge-0/0/29 exSCALE-SLOW,exSCALE-FAST,exSpeaker,exInfra, exAVLAN,vendor_backbone,exVmVendor exSigns,exVmVendor,HAM_BRIDGE - Downlink
TRUNK ge-0/0/30 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/31 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/32 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/33 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/34 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/35 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/36 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/37 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/38 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/39 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/40 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/41 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/42 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/43 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/44 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/45 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/46 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
TRUNK ge-0/0/47 exSCALE-SLOW,exSCALE-FAST,exInfra POE AP // for Game Night
8 changes: 3 additions & 5 deletions switch-configuration/config/types/cfIDF
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Conference Center IDF Switch Configuration
TRUNK ge-0/0/0 cfSCALE-SLOW,cfSCALE-FAST,cfSpeaker,cfInfra,cfCTF,cfAVLAN,cfNOC, \
cfSigns,cfHam_N6S,HAM_BRIDGE - Uplink
TRUNK ge-0/0/1 cfSCALE-SLOW,cfSCALE-FAST,cfSpeaker,cfInfra,cfCTF,cfAVLAN,cfNOC, \
cfSigns,cfHam_N6S,HAM_BRIDGE - Uplink
TRUNK ge-0/0/0 cfSCALE-SLOW,cfSCALE-FAST,cfSpeaker,cfInfra,cfCTF,cfAVLAN,cfNOC, cfSigns,cfHam_N6S,HAM_BRIDGE - Uplink
TRUNK ge-0/0/1 cfSCALE-SLOW,cfSCALE-FAST,cfSpeaker,cfInfra,cfCTF,cfAVLAN,cfNOC, cfSigns,cfHam_N6S,HAM_BRIDGE - Uplink
TRUNK ge-0/0/2 cfSCALE-SLOW,cfSCALE-FAST,cfSpeaker,cfInfra,cfAVLAN,cfSigns - Downlink
TRUNK ge-0/0/3 cfSCALE-SLOW,cfSCALE-FAST,cfSpeaker,cfInfra,cfAVLAN,cfSigns - Downlink
TRUNK ge-0/0/4 cfSCALE-SLOW,cfSCALE-FAST,cfSpeaker,cfInfra,cfAVLAN,cfSigns - Downlink
Expand Down Expand Up @@ -37,7 +35,7 @@ TRUNK ge-0/0/32 cfSCALE-SLOW,cfSCALE-FAST,cfInfra POE AP
TRUNK ge-0/0/33 cfSCALE-SLOW,cfSCALE-FAST,cfInfra POE AP
TRUNK ge-0/0/34 cfSCALE-SLOW,cfSCALE-FAST,cfInfra POE AP
TRUNK ge-0/0/35 cfSCALE-SLOW,cfSCALE-FAST,cfInfra POE AP
VLAN cfCTF 10 - / ge-0/0/{36-45}
VLAN cfCTF 10 - // ge-0/0/{36-45}
VLAN cfInfra 1 - // ge-0/0/46 -- Conference Center Bhyve Server
VLAN cfAVLAN 1 - // ge-0/0/47 -- Conference Center AV Server

Loading
Loading