summaryrefslogtreecommitdiff
path: root/code/vlanscrape
diff options
context:
space:
mode:
Diffstat (limited to 'code/vlanscrape')
-rwxr-xr-xcode/vlanscrape51
1 files changed, 28 insertions, 23 deletions
diff --git a/code/vlanscrape b/code/vlanscrape
index 25a05da..5da322e 100755
--- a/code/vlanscrape
+++ b/code/vlanscrape
@@ -183,30 +183,35 @@ def is_juniper(hostName):
f = open(inFile)
hostConfig=f.readlines()
f.close()
-
- # find device model
- for l in hostConfig:
- if re.match('^# Chassis', l):
- l = re.sub('[\s]+', ':', l)
- ll = l.split(':')
- model = ll[3]
-
- if "EX" in model:
- vlanList=look_in_juniper_vlans_section(hostName, hostConfig)
- check_out_vs_dst(hostName,vlanList)
- elif "MX" in model:
- vlanList=look_in_juniper_interfaces(hostName, hostConfig)
- check_out_vs_dst(hostName, vlanList)
- elif "SRX" in model:
- vlanListInterfaces=look_in_juniper_interfaces(hostName, hostConfig)
- vlanListVlanSection=look_in_juniper_vlans_section(hostName, hostConfig)
- vlanList=vlanListInterfaces + vlanListVlanSection
- check_out_vs_dst(hostName, vlanList)
- elif "Virtual" in model:
- vlanList=look_in_juniper_vlans_section(hostName, hostConfig)
- check_out_vs_dst(hostName, vlanList)
+ if len(hostConfig) == 0:
+ check_out_vs_dst(hostName, '')
else:
- print "model not recognized, skipping"
+ # find device model
+ model = "unset"
+ for l in hostConfig:
+ if re.match('^# Chassis', l):
+ l = re.sub('[\s]+', ':', l)
+ ll = l.split(':')
+ model = ll[3]
+
+ if "EX" in model:
+ vlanList=look_in_juniper_vlans_section(hostName, hostConfig)
+ check_out_vs_dst(hostName,vlanList)
+ elif "MX" in model:
+ vlanList=look_in_juniper_interfaces(hostName, hostConfig)
+ check_out_vs_dst(hostName, vlanList)
+ elif "SRX" in model:
+ vlanListInterfaces=look_in_juniper_interfaces(hostName, hostConfig)
+ vlanListVlanSection=look_in_juniper_vlans_section(hostName, hostConfig)
+ vlanList=vlanListInterfaces + vlanListVlanSection
+ check_out_vs_dst(hostName, vlanList)
+ elif "Virtual" in model:
+ vlanList=look_in_juniper_vlans_section(hostName, hostConfig)
+ check_out_vs_dst(hostName, vlanList)
+ elif "unset" in model:
+ print "Model info missing for", hostName, "- skipping"
+ else:
+ print "model not recognized, skipping"
try: