33
33
# Disable SSL Warnings
34
34
urllib3 .disable_warnings (urllib3 .exceptions .InsecureRequestWarning )
35
35
36
- # Identifies the interface on the device used for management access
37
- # Used to ensure the script isn't used to update the IP leveraged to manage device
38
- MANAGEMENT_INTERFACE = "GigabitEthernet1"
39
-
40
36
# Identify yang+json as the data formats
41
37
headers = {'Content-Type' : 'application/yang-data+json' ,
42
38
'Accept' : 'application/yang-data+json' }
@@ -130,15 +126,15 @@ def print_interface_details(url_base, interface, username, password):
130
126
131
127
# Ask the user to select an interface to configure. Ensures input is valid and
132
128
# NOT the management interface
133
- def interface_selection (interfaces ):
129
+ def interface_selection (interfaces , mgmt_if ):
134
130
# Ask User which interface to configure
135
131
sel = input ("Which Interface do you want to configure? " )
136
132
137
133
# Validate interface input
138
134
# Must be an interface on the device AND NOT be the Management Interface
139
- while sel == MANAGEMENT_INTERFACE or not sel in [intf ["name" ] for intf in interfaces ]:
135
+ while sel == mgmt_if or not sel in [intf ["name" ] for intf in interfaces ]:
140
136
print ("INVALID: Select an available interface." )
141
- print (" " + MANAGEMENT_INTERFACE + " is used for management." )
137
+ print (" " + mgmt_if + " is used for management." )
142
138
print (" Choose another Interface" )
143
139
sel = input ("Which Interface do you want to configure? " )
144
140
@@ -166,6 +162,11 @@ def main():
166
162
default = 'ios-xe-mgmt.cisco.com' )
167
163
parser .add_argument ('--username' , '-u' , type = str ,
168
164
help = 'sandbox username' , default = 'developer' )
165
+ # Identifies the interface on the device used for management access
166
+ # Used to ensure the script isn't used to update the IP leveraged to manage
167
+ # device
168
+ parser .add_argument ('--management_if' , '-m' , type = str ,
169
+ help = 'management interface' , default = 'GigabitEthernet1' )
169
170
parser .add_argument ('--port' , '-P' , type = int ,
170
171
help = 'sandbox web port' , default = 443 )
171
172
args = parser .parse_args ()
@@ -186,7 +187,7 @@ def main():
186
187
print ("" )
187
188
188
189
# Ask User which interface to configure
189
- selected_interface = interface_selection (interfaces )
190
+ selected_interface = interface_selection (interfaces , args . management_if )
190
191
print (selected_interface )
191
192
192
193
# Print Starting Interface Details
0 commit comments