netbox-community / netbox-bgp

NetBox plugin for BGP related objects documentation
Apache License 2.0
248 stars 51 forks source link

BGP routing-policy object, Custom Match value is represented as list instead of string. #166

Closed vladimirs-git closed 8 months ago

vladimirs-git commented 11 months ago

NetBox version Netbox=v3.5.4 netbox-bgp=v0.11.1

Describe the bug In BGP routing-policy object, Custom Match value is represented as list instead of string. Routing Policy Rules display Custom Match value improperly

To Reproduce

api_path = "http://127.0.0.1:8000/api/plugins/bgp/routing-policy-rule/3/"
data = {
    "id": 3,
    "tags": [],
    "custom_fields": {},
    "display": "rm_prod_univ_in: Rule 10",
    "created": "2023-12-05T08:39:42.274517Z",
    "last_updated": "2023-12-05T08:57:22.580838Z",
    "custom_field_data": {},
    "index": 10,
    "action": "permit",
    "description": "",
    "continue_entry": null,
    "match_custom": {
        "community": "cl_rix1_3_150"
    },
    "set_actions": {
        "local-preference": 150
    },
    "routing_policy": 5,
    "match_community": [],
    "match_ip_address": [],
    "match_ipv6_address": []
}

Expected behavior Expected string value instead of list of characters.

Screenshots rp_rule1 rp_rule2

pl0xym0r commented 10 months ago

From what is written in the code, community (in match custom JSONfield or match community) should be a list. It could make sense because you could match a list of them. Try "match_custom": {"community": ["cl_rix1_3_150", "antoherone", "3215:65001"]}.

vladimirs-git commented 10 months ago

In this case, the example at the bottom of the form is incorrect. Instead of {"ip nexthop": "1.1.1.1"} should be {"ip nexthop": ["1.1.1.1"]} image

pl0xym0r commented 10 months ago

Well, only "community", "ip address" and "ipv6 address" keys are concerned as these 3 parameters are available in the object itself (above the custom match). Goal is to append the object parameters with eventual custom match.