IWhat you are doing here... response = dashboard.switch.updateDeviceSwitchPort(
serial, port_id,
name = port_name,
enabled = enable,
type = port_type,
vlan = d_vlan,
voiceVlan = v_vlan,
allowedVlans = v_allowed,
rstpEnables = rstp_enabled,
stpGuard = stp_guard,
accessPolicyType = access_policy,
macAllowedList = mac_allowed,
stickyMacAllowedList = sticky_mac_allowed,
stickyMacAllowListLimit = mac_allowed_limit,
poeEnabled = poe_enabled,
) ...is pass the function arguments irrespective of whether they have a value, which causes the problem. Instead, you need to build the argument list on the fly, only including things that have a value. You have the two mandatory positional arguments, serial and portId, the rest are optional keyword arguments in the form kwarg=value, I'd think if you build the keyword arguments in a dictionary, you could then pass it to the call. Something like... #create an empty disctionary
the_args = {}
#for each keyword arg, if it isn't empty/None add the keyword and value
# note for numeric values this test would call 0 false, so you need to
# make sure the way you test is appropriate for each keyword value type!
if v_allowed:
#add the keyword and value to the dictionary
the_args["allowedVlans"] = v_allowed
#repeat for every keyword, then make the call
response = dashboard.switch.updateDeviceSwitchPort(
serial, port_id,
the_args
)
... View more