Mar-28-2020, 01:51 PM
(Mar-28-2020, 01:39 PM)CMR Wrote: Voicevlan is part of the add interface section and is not entered in the Add VLAN sectionI am bit confused, because you pass
result['vlanname']
, i.e. it looks like you omit result['datavlan']At the moment
result['vlanname']
is the value you pass for datavlan
parameter(Mar-28-2020, 01:39 PM)CMR Wrote: but the addVLAN section is looking for itI am bid confused
It looks like you have some misunderstanding about the functions/class methods.
your class.__init__() takes only positional arguments, i.e. no default values, so all arguments are required. You cannot just skip
You can change it to take some default values, e.g. (just an example, it's up to you to decide which params and what default values)
def __init__(self,device_type,ip,username,password,port,interface,datavlan=None,voicevlan=None):in this case you can skip datavlan and/or voicevlan.
Look also at this one:
https://python-forum.io/Thread-init-ques...#pid108442
here is the method signature:
def __init__(self,device_type,ip,username,password,port,interface,datavlan,voicevlan):and here is how you call it:
addvlan = router('cisco_ios', result['hostname'], result['username'], result['password'], result['port'], result['number'], result['vlanname'])so you have 9 params and when match with the arguments you pass
- self - instance it self. it is passed automatically
- device_type = 'cisco_ios'
- ip = result['hostname']
- username = result['username']
- password = result['password']
- port = result['port']
- interface = result['number']
- datavlan = result['vlanname']
- voicevlan - NO VALUE THUS THE ERROR
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs