Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rm-pythonScripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
network-tools
rm-pythonScripts
Commits
e112d105
Commit
e112d105
authored
2 years ago
by
rick.mollard
Browse files
Options
Downloads
Patches
Plain Diff
updates
parent
2a08aeed
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
arubaModels.py
+74
-0
74 additions, 0 deletions
arubaModels.py
with
74 additions
and
0 deletions
arubaModels.py
0 → 100644
+
74
−
0
View file @
e112d105
from
netmiko
import
(
ConnectHandler
,
NetmikoTimeoutException
)
from
getpass
import
getpass
import
requests
import
urllib3
import
re
import
time
import
getpass
urllib3
.
disable_warnings
(
urllib3
.
exceptions
.
InsecureRequestWarning
)
#
# This script will look to see which ports are in a "failed" state and try to reathenticate the port.
#
#
###########################################################################
print
(
"
1 = UNL-City
\n
2 = UNL-East
\n
3 = UNO
\n
4 = UNK
\n
Select Campus:
"
)
campus
=
input
()
print
(
f
"
Campus Selected:
{
campus
}
"
)
print
(
"
----------------------------------
"
)
if
campus
==
"
1
"
:
file
=
[
line
.
strip
()
for
line
in
open
(
"
unlCitySwitches-cx.txt
"
,
'
r
'
)]
if
campus
==
"
2
"
:
file
=
[
line
.
strip
()
for
line
in
open
(
"
unlEastSwitches-cx.txt
"
,
'
r
'
)]
if
campus
==
"
3
"
:
file
=
[
line
.
strip
()
for
line
in
open
(
"
unoSwitches-cx.txt
"
,
'
r
'
)]
if
campus
==
"
4
"
:
file
=
[
line
.
strip
()
for
line
in
open
(
"
unkSwitches-cx.txt
"
,
'
r
'
)]
#print(file[])
#file.close()
Switches48port
=
[
"
JL661A
"
,
"
JL659A
"
]
##########################################################################
print
(
"
Enter Username:
"
)
Ausername
=
input
()
print
(
"
Enter Password:
"
)
Apassword
=
getpass
.
getpass
()
creds
=
{
"
username
"
:
{
Ausername
},
"
password
"
:
{
Apassword
}}
for
selectIP
in
file
:
ip_add
=
selectIP
print
(
ip_add
)
try
:
net_connect
=
ConnectHandler
(
device_type
=
"
aruba_procurve
"
,
host
=
ip_add
,
username
=
Ausername
,
password
=
Apassword
,
)
###############################################################################
output
=
net_connect
.
send_command
(
f
"
show vsf
"
)
to1
=
output
.
split
(
"
\n
"
)
for
to
in
to1
:
to
=
to
.
lstrip
()
if
"
JL661A
"
in
to
:
# Checks for 48 port switch
print
(
to
)
#checks for
elif
"
JL659A
"
in
to
:
# Checks for CL6 48 port Switch
print
(
to
)
to
=
to
.
split
(
"
"
)[
0
]
net_connect
.
disconnect
()
except
(
NetmikoTimeoutException
)
as
error
:
print
(
"
Switch is not responding----->
"
+
ip_add
)
print
(
"
Switch is not responding----->
"
+
ip_add
)
print
(
"
Switch is not responding----->
"
+
ip_add
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment