Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix add functions no longer functional with NetBox 4.2.1 #668

Open
rtrcwby5183 opened this issue Feb 11, 2025 · 0 comments
Open

Prefix add functions no longer functional with NetBox 4.2.1 #668

rtrcwby5183 opened this issue Feb 11, 2025 · 0 comments
Labels
type: bug A confirmed report of unexpected behavior in the application

Comments

@rtrcwby5183
Copy link

pynetbox version

v7.4.1

NetBox version

v4.2.1

Python version

3.12

Steps to Reproduce

Using PyNetbox is conjunction with Ansible to manage prefixes for a deployment. This worked under NetBox v4.0.8. NetBox v4.2.1 changed from prefix having a "site" field to a scope definition.

  • name: Add Prefix to Netbox
    netbox.netbox.netbox_prefix:
    netbox_url: "{{ netbox_url }}"
    netbox_token: "{{ netbox_api_token }}"
    data:
    prefix: "{{ item.network }}"
    site: "{{ item.site_name }}"
    description: "{{ item.description }}"
    tenant: WAN
    prefix_role: "{{ item.role | upper }}"
    vlan:
    name: "VL{{ item.vlan_id }}"
    site: "{{ item.site_name }}"
    vlan_group: "{{ item.vlan_group }}-{{ item.site_name }}"
    custom_fields:
    agency: "{{ item.agency }}"
    carrier_vrf: "{{ item.carrier_side_vrf | upper }}"
    e911_zone: "{{ item.e911_zone }}"
    tags:
    - ansible_created
    state: present
    validate_certs: false
    loop: "{{ new_csv_data }}"
    tags:

    • prefix
      When the prefix is added using the Netbox v4.0.8 "Site" definition:
      failed: [localhost] (item={'site_name': 'xxxxxx', 'network': '', 'agency': 'XXXX', 'vlan_id': '999', 'vlan_group': 'sr', 'role': 'mgt', 'carrier_side_vrf': 'xxxx', 'e911_zone': '', 'description': 'xxxxxx'}) => {"ansible_loop_var": "item", "changed": false, "item": {"agency": "XXXX", "carrier_side_vrf": "xxxx", "description": "xxxxxx", "e911_zone": "", "network": "", "role": "mgt", "site_name": "xxxxxx", "vlan_group": "sr", "vlan_id": "999"}, "msg": "site does not exist on existing object. Check to make sure valid field."}
  • name: Add Prefix to Netbox
    netbox.netbox.netbox_prefix:
    netbox_url: "{{ netbox_url }}"
    netbox_token: "{{ netbox_api_token }}"
    data:
    prefix: "{{ item.network }}"
    scope_type: dcim.site
    scope:
    site: "{{ item.site_name }}"
    description: "{{ item.description }}"
    tenant: WAN
    prefix_role: "{{ item.role | upper }}"
    vlan:
    name: "VL{{ item.vlan_id }}"
    site: "{{ item.site_name }}"
    vlan_group: "{{ item.vlan_group }}-{{ item.site_name }}"
    custom_fields:
    agency: "{{ item.agency }}"
    carrier_vrf: "{{ item.carrier_side_vrf | upper }}"
    e911_zone: "{{ item.e911_zone }}"
    tags:
    - ansible_created
    state: present
    validate_certs: false
    loop: "{{ new_csv_data }}"
    tags:

    • prefix
      When the same prefix is added using the new "Scope" based definition:
      failed: [localhost] (item={'site_name': 'xxxxxx', 'network': '', 'agency': 'XXXX', 'vlan_id': '999', 'vlan_group': 'sr', 'role': 'mgt', 'carrier_side_vrf': 'xxxx', 'e911_zone': '', 'description': 'xxxxxx'}) => {"ansible_loop_var": "item", "changed": false, "item": {"agency": "XXXX", "carrier_side_vrf": "xxxx", "description": "xxxxxx", "e911_zone": "", "network": "", "role": "mgt", "site_name": "xxxxxx", "vlan_group": "sr", "vlan_id": "999"}, "msg": "Unsupported parameters for (netbox.netbox.netbox_prefix) module: data.scope, data.scope_type. Supported parameters include: comments, custom_fields, description, family, is_pool, mark_utilized, parent, prefix, prefix_length, prefix_role, site, status, tags, tenant, vlan, vrf."}

Expected Behavior

The prefixes should add to NetBox with site association through one of those two methods.

Observed Behavior

"Unsupported parameters for (netbox.netbox.netbox_prefix) module: data.scope, data.scope_type. Supported parameters include: comments, custom_fields, description, family, is_pool, mark_utilized, parent, prefix, prefix_length, prefix_role, site, status, tags, tenant, vlan, vrf."

@rtrcwby5183 rtrcwby5183 added the type: bug A confirmed report of unexpected behavior in the application label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

1 participant