Join the Conversation

To sign in, use your existing MySonicWall account. To create a free MySonicWall account click "Register".

SonicOS API 7.0 PUT /interfaces/ipv4 Removing VLAN Interfaces

When I PUT a change to an interface it removes all VLAN interfaces.

If I make this same change on a 6.5 device this doesn't happen.

Is there a bug in 7.0 or should I be doing this differently?

Currently working on TZ 570 SonicOS 7.0.0-R906

I have any number of VLAN interfaces assigned to X:0

I make a change to X1 interface and all VLAN interfaces are removed.

Category: Developer Hub
Reply

Best Answer

  • CORRECT ANSWER
    JaimeJaime SonicWall Employee
    Answer ✓

    Thank you for the info.

    To create a VLAN interface, you can send a POST to /api/sonicos/interfaces/ipv4.

    To edit a specific physical interface's configuration, send a PUT to /api/sonicos/interfaces/ipv4/name/{NAME} (X0, X1, U0, etc.).

    To edit a VLAN's configuration, you can send a PUT /api/sonicos/interfaces/ipv4/name/{NAME}/vlan/{VLANTAG}, where NAME is the physical parent interface and VLANTAG is just the VLAN tag number.

    By sending a PUT to /interfaces/ipv4/, you are editing the interface configuration as a whole. This can be useful if you wanted to pull all of that configuration at once, edit something (perhaps on multiple interfaces), and then put it all back with the edits in place in one PUT.

Answers

  • JaimeJaime SonicWall Employee

    Hi @CTaylor,

    Can you please upgrade the TZ 570 to the latest release (7.0.1-5023) and re-try?

    Would you mind sharing the JSON you are sending in the PUT request? Please replace the real values with dummy values.

    Thanks.

    Jaime

  • CTaylorCTaylor Newbie ✭

    Thanks for the quick response. Sorry for the delay had to go fix some devices, was pushed out to a few devices before the issue was discovered.

    I have switched to a TZ 270 on firmware SonicOS 7.0.1-5023 for further testing.

    PUT interfaces/ipv4

    {
        "interfaces":  [
                           {
                               "ipv4":  {
                                            "name":  "U0",
                                            "https_redirect":  false
                                        }
                           }
                       ]
    }
    


  • CTaylorCTaylor Newbie ✭

    Thank you for the response.

    If I was editing the interfaces as a whole wouldn't ALL my interfaces be reset with the PUT listed earlier?

    All my interface settings stay correct except the removal of the VLAN interfaces.

    There is no mention of that in the documentation.


  • CTaylorCTaylor Newbie ✭
    edited October 2021

    Your suggestion is working as expected.

    PUT /interface/ipv4/name/{NAME}

    {
        "interfaces":  [
                           {
                               "ipv4":  {
                                            "https_redirect":  false
                                        }
                           }
                       ]
    }
    

    Just a case of the endpoint not being documented.

  • JaimeJaime SonicWall Employee


    It is technically not editing them but trying to delete them since they are not part of the JSON in the PUT request. You cannot delete physical interfaces so nothing happens to them. You can delete VLAN interfaces, so there's potential those could be removed. If there's configuration the prevents removal of the VLAN (such as the VLAN interface being used in an active VPN policy), the command will fail and an error message will be in the response.

  • CTaylorCTaylor Newbie ✭

    /interface/ipv4/name/{NAME} doesn't work with 6.5

    Is sending a PUT request to /interface/ipv4 the correct method for 6.5?

    Seems as though things are working as expected but want to make sure I am not missing another undocumented endpoint.

  • CTaylorCTaylor Newbie ✭

    And you must supply the whole interface object, not just the value you want changed as I did in my example.

  • JaimeJaime SonicWall Employee

    Hi @CTaylor,

    Sorry for the delay. This week has been hectic.

    The 6.5.4.x API endpoint for editing an existing physical interface is /interfaces/ipv4/name/{NAME}. I noticed that if you send the following JSON, the command fails as you described.

    {

      "interface": {

        "ipv4": {

          "https_redirect": true

        }

      }

    }


    But if you include the interface name in the JSON, it succeeds. It appears you don't have to send the whole interface configuration at once, but it seems to expect the name.

    {

      "interface": {

        "ipv4": {

          "name": "X2",

          "https_redirect": true

        }

      }

    }


    Hope that helps.

    Have a great weekend!

Sign In or Register to comment.