primary_ipv[46] not set via REST/Python #15229
-
Hey everyone, I am trying to get my inventory into netbox. I create a node with a few interfaces for mgmt and a loopback interface with an ipv4 and an ipv6 address. I do this by running four separate calls:
However, the last call does not give the expected result, here as Python: nb.dcim.devices.update([
{
"id": device_id,
"oob_ip" : ipaddress_ids["oob_ip"],
"primary_ipv4": ipaddress_ids["primary_ipv4"],
"primary_ipv6": ipaddress_ids["primary_ipv6"]
}
]) Result pprint(list(nb.dcim.devices.get(name='mynode')))
[('id', 49),
('url', 'http://localhost:50006/api/dcim/devices/49/'),
('display', 'mynode'),
('name', 'mynode'),
('device_type',
{'display': 'acme_model1',
'id': 7,
'manufacturer': {'display': 'acme',
'id': 2,
'name': 'acme',
'slug': 'acme',
'url': 'http://localhost:50006/api/dcim/manufacturers/2/'},
'model': 'acme_model1',
'slug': 'acme_model1',
'url': 'http://localhost:50006/api/dcim/device-types/7/'}),
('role',
{'display': 'myrole',
'id': 18,
'name': 'myrole',
'slug': 'myrole',
'url': 'http://localhost:50006/api/dcim/device-roles/18/'}),
('device_role',
{'display': 'myrole',
'id': 18,
'name': 'myrole',
'slug': 'myrole',
'url': 'http://localhost:50006/api/dcim/device-roles/18/'}),
('tenant', None),
('platform', None),
('serial', ''),
('asset_tag', None),
('site',
{'display': 'mysite',
'id': 60,
'name': 'mysite',
'slug': 'mysite',
'url': 'http://localhost:50006/api/dcim/sites/60/'}),
('location', None),
('rack', None),
('position', None),
('face', None),
('latitude', None),
('longitude', None),
('parent_device', None),
('status', {'label': 'Active', 'value': 'active'}),
('airflow', None),
('primary_ip', None),
('primary_ip4', None),
('primary_ip6', None),
('oob_ip',
{'address': '172.16.0.1/24',
'display': '172.16.0.1/24',
'family': 4,
'id': 125,
'url': 'http://localhost:50006/api/ipam/ip-addresses/125/'}),
('cluster', None),
('virtual_chassis', None),
('vc_position', None),
('vc_priority', None),
('description', ''),
('comments', ''),
('config_template', None),
('config_context', {}),
('local_context_data', None),
('tags', []),
('custom_fields', {'iRID': 666, 'mount_location': None}),
('created', '2024-02-22T18:03:18.711176Z'),
('last_updated', '2024-02-22T18:03:19.155755Z'),
('console_port_count', 0),
('console_server_port_count', 0),
('power_port_count', 0),
('power_outlet_count', 0),
('interface_count', 2),
('front_port_count', 0),
('rear_port_count', 0),
('device_bay_count', 0),
('module_bay_count', 0),
('inventory_item_count', 0)] While setting of oob_ip works I get "None" for primary_ipv[46] from a GET-Req. Only when I go to the webinterface Am I doing something wrong here?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Note the "v" there |
Beta Was this translation helpful? Give feedback.
primary_ip[46] != primary_ipv[46]
Note the "v" there