CloudGenix / cloudgenix_config

Configuration exporting and Continuous Integration (CI) capable configuration importing for the CloudGenix Cloud Controller.
MIT License
12 stars 22 forks source link

do_site fails to decouple bypasspair on ION 3000 #82

Closed rpollard00 closed 2 years ago

rpollard00 commented 2 years ago

I've been attempting to find a way to decouple a bypass pair during the run of do_site.py.

I did a pull_site on an Site that I want to use as a template for deploying additional sites. In our configuration we uncouple the wan 3lan 3 bypass pair to use lan 3 as a dhcp server. YAML configuration pulled with pull_site.py has no configuration for the bypasspair wan 3lan 3. It has individual configuration for lan 3, and wan 3.

A default configured ION3000 has wan 3lan 3 coupled, so would expect do_site targeting said device to successfully decouple said bypasspair given the YAML template made from the above configuration.

It looks to me like when there's no provided wan 3lan 3 configuration, that it attempts to set a default configuration, but there is an issue in the default configuration that sets "type" to "port", which is invalid for a bypasspair. Would expect, based on tracing GUI behavior of decoupling that it would HTTP DELETE to the bypasspair endpoint, which looks to be what decouples the interfaces.

Receive this error:

RESPONSE: 400 Bad Request
RESPONSE HEADERS:
        Date: Wed, 10 Aug 2022 18:59:55 GMT
        Content-Length: 336
        Connection: keep-alive
        Server: nginx
RESPONSE DATA:
{
    "_etag": 0,
    "_content_length": "0",
    "_schema": 0,
    "_created_on_utc": 0,
    "_updated_on_utc": 0,
    "_status_code": "400",
    "_request_id": "1660157995054012799993096857044812616835",
    "_error": [
        {
            "code": "INTERFACE_CONFIG_INVALID_INTERFACE_TYPE_UPDATE_NOT_ALLOWED",
            "message": "Invalid interface config. Interface type bypasspair cannot be modified to port."
        }
    ]

Easy to Reproduce

  1. Decouple bypasspair (wan 3lan 3 in my case), through the GUI,
  2. Run pull_site.py, targeting this site
  3. Couple the bypasspair through GUI.
  4. Run do_site, targeting this exact same site, using the configuration pulled in step 2.
  5. Should result in the error above.

Verbose 2 output... Verbose 3 crashes: (scrubbed sensitive info):

 Element: Code is at correct version 5.6.5-b16.
  No Change for Element MERIONX3001.
   Setting Bypasspair wan 3lan 3 to default.
ERROR: Interface update failed: 
REQUEST: PUT /v4.11/api/tenants/XXXX/sites/XXXXXXXXXXXXX/elements/XXXXXXXXXXXXXX/interfaces/XXXXXXXXXXXXXXX
REQUEST HEADERS:
        User-Agent: python-requests/2.28.1 (CGX SDK v5.6.1b2)
        Accept-Encoding: gzip, deflate
        Accept: application/json
        Connection: keep-alive
        X-Auth-Token: <SENSITIVE - NOT SHOWN BY DEFAULT>
        Content-Type: application/json
        Cookie: AUTH_TOKEN="<SENSITIVE - NOT SHOWN BY DEFAULT>"
        Content-Length: 1104
REQUEST BODY:
{
    "id": "XXXXXXXXXXXXXXXX",
    "_etag": 1,
    "_content_length": "0",
    "_schema": 4,
    "_created_on_utc": 16601579802350106,
    "_updated_on_utc": 16601579802350106,
    "_status_code": "200",
    "_request_id": "1660158836670002499998246869148421731882",
    "_debug": null,
    "_info": null,
    "_warning": null,
    "_error": null,
    "name": "wan 3lan 3",
    "description": null,
    "type": "port",
    "attached_lan_networks": null,
    "site_wan_interface_ids": null,
    "mac_address": null,
    "mtu": 1500,
    "ipv4_config": null,
    "dhcp_relay": null,
    "ethernet_port": {
        "full_duplex": false,
        "speed": 0
    },
    "admin_up": true,
    "nat_address": null,
    "nat_port": 0,
    "used_for": "none",
    "bound_interfaces": null,
    "sub_interface": null,
    "pppoe_config": null,
    "parent": null,
    "network_context_id": null,
    "bypass_pair": null,
    "service_link_config": null,
    "scope": "local",
    "tags": null,
    "nat_zone_id": null,
    "devicemgmt_policysetstack_id": null,
    "nat_pools": null,
    "directed_broadcast": false,
    "ipfixcollectorcontext_id": null,
    "ipfixfiltercontext_id": null,
    "secondary_ip_configs": null,
    "static_arp_configs": null,
    "cellular_config": null,
    "multicast_config": null
}

RESPONSE: 400 Bad Request
RESPONSE HEADERS:
        Date: Wed, 10 Aug 2022 19:13:56 GMT
        Content-Length: 336
        Connection: keep-alive
        Server: nginx
RESPONSE DATA:
{
    "_etag": 0,
    "_content_length": "0",
    "_schema": 0,
    "_created_on_utc": 0,
    "_updated_on_utc": 0,
    "_status_code": "400",
    "_request_id": "1660158836804004699996670444739754992054",
    "_error": [
        {
            "code": "INTERFACE_CONFIG_INVALID_INTERFACE_TYPE_UPDATE_NOT_ALLOWED",
            "message": "Invalid interface config. Interface type bypasspair cannot be modified to port."
        }
    ]
}
rpollard00 commented 2 years ago

Closing this as the new version that released just after I posted this resolved the issue.

ktanushree commented 2 years ago

That's right, @rpollard00! We fixed the issue in 1.7.0b1. Please refer to our release notes for 1.7.0b1 for info on the new parameters in the YAML. https://github.com/CloudGenix/cloudgenix_config/blob/master/release_notes/170b1.md