meraki/dashboard-api-python

Parameter 'defaultGateway' to be set once and is already configured with a different layer 3 interface

koladiya opened this issue · 5 comments

meraki==1.18.2 & 1.19.0

While updating network switch stack routing interface using the below function it is throwing an error.

def updateNetworkSwitchStackRoutingInterface(self, networkId: str, switchStackId: str, interfaceId: str, **kwargs):

Error:

Meraki API error: switch, updateNetworkSwitchStackRoutingInterface - 400 Bad Request, {'errors': ["Parameter 'defaultGateway' to be set once and is already configured with a different layer 3 interface."]}
status code = 400
reason = Bad Request
error = {'errors': ["Parameter 'defaultGateway' to be set once and is already configured with a different layer 3 interface."]}

Reason:

  • This function accepts the payload as keyword arguments. When I pass defaultgateway as keyword arguments, it throws that error.
  • body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ipv6', ]
  • In the previous version of Meraki(1.12.0), this function was not accepting defaultgateway as keyword arguments so it was fine.

Solution:

  • Now I have to remove the key defaultgateway before passing it to this function.

Thanks for reporting this @koladiya !

We do expect the error to be thrown when trying to add a default gateway to more than one interface--you can only have a default gateway on one interface. If one already has it, and that's the interface you're updating, then we do expect that update command to succeed.

Are you seeing this when trying to update the default gateway on the interface that already has one, or something else?

@TKIPisalegacycipher

We do expect the error to be thrown when trying to add a default gateway to more than one interface. you can only have a default gateway on one interface --> that is clear, it is not allowed. but this is not the case here.

Are you seeing this when trying to update the default gateway on the interface that already has one? --> YES

Meraki API error: switch, updateNetworkSwitchStackRoutingInterface - 400 Bad Request, {'errors':
["Parameter 'defaultGateway' to be set once and is already configured with a different layer 3 interface."]}
status code = 400
reason = Bad Request
error = {'errors': ["Parameter 'defaultGateway' to be set once and is already configured with a different layer 3 interface."]}

@koladiya could you let me know if you are still having this issue?

@TKIPisalegacycipher the issue still persists. (I don't see any changes on this code)

again tested with meraki==1.18.2, 1.19.0 & 1.20.0

e.g. I have an existing layer 3 routing interface for stack devices that has a default gateway configured. If I want to update that interface, it fails as follows:

import meraki

meraki_api = meraki.DashboardAPI(suppress_logging=True)

network_id = <network_id>
stack_id = <stack_id>
interface_id = <interface_id>

data = {
    "name": "vlan99",
    "subnet": "10.10.10.0/24",
    "interfaceIp": "10.10.10.10",
    "multicastRouting": "disabled",
    "vlanId": 99,
    "defaultGateway": "10.10.10.1",
}

try:

    response = meraki_api.switch.updateNetworkSwitchStackRoutingInterface(
        networkId=network_id, switchStackId=stack_id, interfaceId=interface_id, **data
    )
    print(response)
except meraki.APIError as e:
    print(f"    Meraki API error: {e}")
    print(f"    status code = {e.status}")
    print(f"    reason = {e.reason}")
    print(f"    error = {e.message}")

errors:

    Meraki API error: switch, updateNetworkSwitchStackRoutingInterface - 400 Bad Request, {'errors': ["Parameter 'defaultGateway' to be set once and is already configured with a different layer 3 interface."]}
    status code = 400
    reason = Bad Request
    error = {'errors': ["Parameter 'defaultGateway' to be set once and is already configured with a different layer 3 interface."]}

If I simply removed "defaultGateway": "10.10.10.1", from data, it works fine.

Please open a ticket with Meraki support. This seems to be an API issue and not specific to the library.