diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index eb3751d1..0d7de397 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -18,7 +18,7 @@ body: attributes: label: NetBox version description: What version of NetBox are you currently running? - placeholder: v3.5.8 + placeholder: v3.6.0 validations: required: true - type: dropdown diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index d25842a3..a38ac5c3 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -21,7 +21,7 @@ body: attributes: label: NetBox version description: What version of NetBox are you currently running? - placeholder: v3.5.8 + placeholder: v3.6.0 validations: required: true - type: dropdown diff --git a/.github/workflows/py3.yml b/.github/workflows/py3.yml index f9b65a99..5feec341 100644 --- a/.github/workflows/py3.yml +++ b/.github/workflows/py3.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: python: ["3.8", "3.9", "3.10", "3.11"] - netbox: ["3.3", "3.4", "3.5"] + netbox: ["3.3", "3.4", "3.5", "3.6"] steps: - uses: actions/checkout@v2 diff --git a/pynetbox/core/app.py b/pynetbox/core/app.py index 677dd451..cc88c91a 100644 --- a/pynetbox/core/app.py +++ b/pynetbox/core/app.py @@ -75,7 +75,7 @@ def config(self): {'tables': {'DeviceTable': {'columns': ['name', 'status', 'tenant', - 'device_role', + 'role', 'site', 'primary_ip', 'tags']}}} diff --git a/pynetbox/core/endpoint.py b/pynetbox/core/endpoint.py index 9bbffc24..a0369a7f 100644 --- a/pynetbox/core/endpoint.py +++ b/pynetbox/core/endpoint.py @@ -323,7 +323,7 @@ def create(self, *args, **kwargs): >>> device = netbox.dcim.devices.create( ... name='test', - ... device_role=1, + ... role=1, ... ) >>> @@ -344,14 +344,14 @@ def create(self, *args, **kwargs): >>> nb.dcim.devices.create([ ... { ... "name": "test1-core3", - ... "device_role": 3, + ... "role": 3, ... "site": 1, ... "device_type": 1, ... "status": 1 ... }, ... { ... "name": "test1-core4", - ... "device_role": 3, + ... "role": 3, ... "site": 1, ... "device_type": 1, ... "status": 1 diff --git a/pynetbox/core/response.py b/pynetbox/core/response.py index 066a5785..d6651b9f 100644 --- a/pynetbox/core/response.py +++ b/pynetbox/core/response.py @@ -226,7 +226,7 @@ class Record: 'config_context': {}, 'created': '2018-04-01', 'custom_fields': {}, - 'device_role': {'id': 1, + 'role': {'id': 1, 'name': 'Test Switch', 'slug': 'test-switch', 'url': 'http://localhost:8000/api/dcim/device-roles/1/'}, diff --git a/tests/conftest.py b/tests/conftest.py index ee66593d..03f80a51 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,7 +4,7 @@ from packaging import version -DEFAULT_NETBOX_VERSIONS = "3.3" +DEFAULT_NETBOX_VERSIONS = "3.6" def pytest_addoption(parser): @@ -39,7 +39,7 @@ def pytest_addoption(parser): action="store", help=( "Overrides the URL to run tests to. This allows for testing to the same" - " containers for seperate runs." + " containers for separate runs." ), ) diff --git a/tests/fixtures/dcim/device.json b/tests/fixtures/dcim/device.json index b29fe44d..89d473ef 100644 --- a/tests/fixtures/dcim/device.json +++ b/tests/fixtures/dcim/device.json @@ -14,7 +14,7 @@ "model": "MX960", "slug": "mx960" }, - "device_role": { + "role": { "id": 1, "url": "http://localhost:8000/api/dcim/device-roles/1/", "name": "Router", diff --git a/tests/fixtures/dcim/device_bulk_create.json b/tests/fixtures/dcim/device_bulk_create.json index 62672d9a..a42a870b 100644 --- a/tests/fixtures/dcim/device_bulk_create.json +++ b/tests/fixtures/dcim/device_bulk_create.json @@ -3,7 +3,7 @@ "id": 1, "name": "test1-core3", "device_type": 1, - "device_role": 3, + "role": 3, "tenant": null, "platform": null, "serial": "", @@ -22,7 +22,7 @@ "id": 2, "name": "test1-core4", "device_type": 1, - "device_role": 3, + "role": 3, "tenant": null, "platform": null, "serial": "", diff --git a/tests/fixtures/dcim/devices.json b/tests/fixtures/dcim/devices.json index c76026a3..12103d63 100644 --- a/tests/fixtures/dcim/devices.json +++ b/tests/fixtures/dcim/devices.json @@ -19,7 +19,7 @@ "model": "EX9214", "slug": "ex9214" }, - "device_role": { + "role": { "id": 3, "url": "http://localhost:8000/api/dcim/device-roles/3/", "name": "Core Switch", @@ -88,7 +88,7 @@ "model": "EX9214", "slug": "ex9214" }, - "device_role": { + "role": { "id": 3, "url": "http://localhost:8000/api/dcim/device-roles/3/", "name": "Core Switch", @@ -157,7 +157,7 @@ "model": "MX960", "slug": "mx960" }, - "device_role": { + "role": { "id": 1, "url": "http://localhost:8000/api/dcim/device-roles/1/", "name": "Router", @@ -226,7 +226,7 @@ "model": "MX960", "slug": "mx960" }, - "device_role": { + "role": { "id": 1, "url": "http://localhost:8000/api/dcim/device-roles/1/", "name": "Router", @@ -295,7 +295,7 @@ "model": "QFX5100-48S", "slug": "qfx5100-48s" }, - "device_role": { + "role": { "id": 4, "url": "http://localhost:8000/api/dcim/device-roles/4/", "name": "Leaf Switch", @@ -354,7 +354,7 @@ "model": "QFX5100-48S", "slug": "qfx5100-48s" }, - "device_role": { + "role": { "id": 4, "url": "http://localhost:8000/api/dcim/device-roles/4/", "name": "Leaf Switch", @@ -413,7 +413,7 @@ "model": "CM4148", "slug": "cm4148" }, - "device_role": { + "role": { "id": 5, "url": "http://localhost:8000/api/dcim/device-roles/5/", "name": "OOB Switch", @@ -472,7 +472,7 @@ "model": "CWG-24VYM415C9", "slug": "cwg-24vym415c9" }, - "device_role": { + "role": { "id": 6, "url": "http://localhost:8000/api/dcim/device-roles/6/", "name": "PDU", @@ -523,7 +523,7 @@ "model": "CWG-24VYM415C9", "slug": "cwg-24vym415c9" }, - "device_role": { + "role": { "id": 6, "url": "http://localhost:8000/api/dcim/device-roles/6/", "name": "PDU", @@ -574,7 +574,7 @@ "model": "QFX5100-24Q", "slug": "qfx5100-24q" }, - "device_role": { + "role": { "id": 2, "url": "http://localhost:8000/api/dcim/device-roles/2/", "name": "Spine Switch", @@ -633,7 +633,7 @@ "model": "QFX5100-24Q", "slug": "qfx5100-24q" }, - "device_role": { + "role": { "id": 2, "url": "http://localhost:8000/api/dcim/device-roles/2/", "name": "Spine Switch", diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index cee972c1..d0485f92 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -33,6 +33,8 @@ def get_netbox_docker_version_tag(netbox_version): tag = "2.5.3" elif (major, minor) == (3, 5): tag = "2.6.1" + elif (major, minor) == (3, 6): + tag = "2.7.0" else: raise NotImplementedError( "Version %s is not currently supported" % netbox_version @@ -479,14 +481,14 @@ def device_type(api, manufacturer): @pytest.fixture(scope="session") -def device_role(api): - device_role = api.dcim.device_roles.create( +def role(api): + role = api.dcim.device_roles.create( name="test-device-role", slug="test-device-role", color="000000", ) - yield device_role - device_role.delete() + yield role + role.delete() def pytest_generate_tests(metafunc): diff --git a/tests/integration/test_dcim.py b/tests/integration/test_dcim.py index 0f60bdc7..3a208f47 100644 --- a/tests/integration/test_dcim.py +++ b/tests/integration/test_dcim.py @@ -12,14 +12,23 @@ def rack(api, site): @pytest.fixture(scope="module") -def device(api, site, device_type, device_role): - device = api.dcim.devices.create( - name="test-device", - device_role=device_role.id, - device_type=device_type.id, - site=site.id, - color="000000", - ) +def device(api, site, device_type, role): + if version.parse(api.version) >= version.parse("3.6"): + device = api.dcim.devices.create( + name="test-device", + role=role.id, + device_type=device_type.id, + site=site.id, + color="000000", + ) + else: + device = api.dcim.devices.create( + name="test-device", + device_role=role.id, + device_type=device_type.id, + site=site.id, + color="000000", + ) yield device device.delete() @@ -188,13 +197,21 @@ def init(self, request, interface): class TestPowerCable(BaseTest): @pytest.fixture(scope="class") - def power_outlet(self, api, device_type, device_role, site): - pdu = api.dcim.devices.create( - name="test-pdu", - device_role=device_role.id, - device_type=device_type.id, - site=site.id, - ) + def power_outlet(self, api, device_type, role, site): + if version.parse(api.version) >= version.parse("3.6"): + pdu = api.dcim.devices.create( + name="test-pdu", + role=role.id, + device_type=device_type.id, + site=site.id, + ) + else: + pdu = api.dcim.devices.create( + name="test-pdu", + device_role=role.id, + device_type=device_type.id, + site=site.id, + ) outlet = api.dcim.power_outlets.create(name="outlet", device=pdu.id) yield outlet pdu.delete() @@ -230,13 +247,21 @@ def init(self, request, power_cable): class TestConsoleCable(BaseTest): @pytest.fixture(scope="class") - def console_server_port(self, api, device_type, device_role, site): - device = api.dcim.devices.create( - name="test-console-server", - device_role=device_role.id, - device_type=device_type.id, - site=site.id, - ) + def console_server_port(self, api, device_type, role, site): + if version.parse(api.version) >= version.parse("3.6"): + device = api.dcim.devices.create( + name="test-console-server", + role=role.id, + device_type=device_type.id, + site=site.id, + ) + else: + device = api.dcim.devices.create( + name="test-console-server", + device_role=role.id, + device_type=device_type.id, + site=site.id, + ) ret = api.dcim.console_server_ports.create(name="Port 1", device=device.id) yield ret device.delete() @@ -275,13 +300,21 @@ def init(self, request, console_cable): class TestInterfaceCable(BaseTest): @pytest.fixture(scope="class") - def interface_b(self, api, device_type, device_role, site): - device = api.dcim.devices.create( - name="test-device-2", - device_role=device_role.id, - device_type=device_type.id, - site=site.id, - ) + def interface_b(self, api, device_type, role, site): + if version.parse(api.version) >= version.parse("3.6"): + device = api.dcim.devices.create( + name="test-device-2", + role=role.id, + device_type=device_type.id, + site=site.id, + ) + else: + device = api.dcim.devices.create( + name="test-device-2", + device_role=role.id, + device_type=device_type.id, + site=site.id, + ) ret = api.dcim.interfaces.create( name="Ethernet1", type="1000base-t", device=device.id )