From: Hannes Duerr <h.duerr@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-network v4 2/2] ipam: add test cases for nautobot plugin
Date: Tue, 6 May 2025 11:00:39 +0200 [thread overview]
Message-ID: <20250506090041.53080-2-h.duerr@proxmox.com> (raw)
In-Reply-To: <20250506090041.53080-1-h.duerr@proxmox.com>
Co-authored-by: Lou Lecrivain <lou.lecrivain@wdz.de>
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
---
src/test/ipams/nautobot/expected.add_ip | 11 +++++++++
.../ipams/nautobot/expected.add_ip_notgateway | 11 +++++++++
.../ipams/nautobot/expected.add_next_freeip | 11 +++++++++
src/test/ipams/nautobot/expected.add_subnet | 11 +++++++++
src/test/ipams/nautobot/expected.del_ip | 11 +++++++++
src/test/ipams/nautobot/expected.update_ip | 11 +++++++++
src/test/ipams/nautobot/ipam_config | 24 +++++++++++++++++++
src/test/ipams/nautobot/sdn_config | 20 ++++++++++++++++
src/test/ipams/netbox/ipam_config | 8 ++++++-
src/test/ipams/phpipam/ipam_config | 8 ++++++-
10 files changed, 124 insertions(+), 2 deletions(-)
create mode 100644 src/test/ipams/nautobot/expected.add_ip
create mode 100644 src/test/ipams/nautobot/expected.add_ip_notgateway
create mode 100644 src/test/ipams/nautobot/expected.add_next_freeip
create mode 100644 src/test/ipams/nautobot/expected.add_subnet
create mode 100644 src/test/ipams/nautobot/expected.del_ip
create mode 100644 src/test/ipams/nautobot/expected.update_ip
create mode 100644 src/test/ipams/nautobot/ipam_config
create mode 100644 src/test/ipams/nautobot/sdn_config
diff --git a/src/test/ipams/nautobot/expected.add_ip b/src/test/ipams/nautobot/expected.add_ip
new file mode 100644
index 0000000..bec1f3a
--- /dev/null
+++ b/src/test/ipams/nautobot/expected.add_ip
@@ -0,0 +1,11 @@
+bless( {
+ '_content' => '{"address":"10.0.0.1/24","description":"gateway","namespace":"TestNamespace","status":"Active","type":"dhcp"}',
+ '_headers' => bless( {
+ 'accept' => 'application/json',
+ 'authorization' => 'token FAKETESTTOKEN',
+ 'content-type' => 'application/json; charset=UTF-8',
+ }, 'HTTP::Headers' ),
+ '_max_body_size' => undef,
+ '_method' => 'POST',
+ '_uri' => bless( do{\(my $o = 'http://localhost:8080/api/ipam/ip-addresses/')}, 'URI::http' )
+ }, 'HTTP::Request' );
diff --git a/src/test/ipams/nautobot/expected.add_ip_notgateway b/src/test/ipams/nautobot/expected.add_ip_notgateway
new file mode 100644
index 0000000..bae92e6
--- /dev/null
+++ b/src/test/ipams/nautobot/expected.add_ip_notgateway
@@ -0,0 +1,11 @@
+bless( {
+ '_content' => '{"address":"10.0.0.1/24","description":"mac:da:65:8f:18:9b:6f","namespace":"TestNamespace","status":"Active","type":"dhcp"}',
+ '_headers' => bless( {
+ 'accept' => 'application/json',
+ 'authorization' => 'token FAKETESTTOKEN',
+ 'content-type' => 'application/json; charset=UTF-8',
+ }, 'HTTP::Headers' ),
+ '_max_body_size' => undef,
+ '_method' => 'POST',
+ '_uri' => bless( do{\(my $o = 'http://localhost:8080/api/ipam/ip-addresses/')}, 'URI::http' )
+ }, 'HTTP::Request' );
diff --git a/src/test/ipams/nautobot/expected.add_next_freeip b/src/test/ipams/nautobot/expected.add_next_freeip
new file mode 100644
index 0000000..0181719
--- /dev/null
+++ b/src/test/ipams/nautobot/expected.add_next_freeip
@@ -0,0 +1,11 @@
+bless( {
+ '_content' => '{"description":"mac:da:65:8f:18:9b:6f","namespace":"TestNamespace","status":"Active","type":"dhcp"}',
+ '_headers' => bless( {
+ 'accept' => 'application/json',
+ 'authorization' => 'token FAKETESTTOKEN',
+ 'content-type' => 'application/json; charset=UTF-8',
+ }, 'HTTP::Headers' ),
+ '_max_body_size' => undef,
+ '_method' => 'POST',
+ '_uri' => bless( do{\(my $o = 'http://localhost:8080/api/ipam/prefixes/1/available-ips/')}, 'URI::http' )
+ }, 'HTTP::Request' );
diff --git a/src/test/ipams/nautobot/expected.add_subnet b/src/test/ipams/nautobot/expected.add_subnet
new file mode 100644
index 0000000..78f911d
--- /dev/null
+++ b/src/test/ipams/nautobot/expected.add_subnet
@@ -0,0 +1,11 @@
+bless({
+ '_content' => '{"namespace":"TestNamespace","prefix":"10.0.0.0/24","status":"Active"}',
+ '_headers' => bless({
+ 'accept' => 'application/json',
+ 'authorization' => 'token FAKETESTTOKEN',
+ 'content-type' => 'application/json; charset=UTF-8',
+ }, 'HTTP::Headers'),
+ '_max_body_size' => undef,
+ '_method' => 'POST',
+ '_uri' => bless(do{\(my $o = 'http://localhost:8080/api/ipam/prefixes/')}, 'URI::http'),
+}, 'HTTP::Request');
diff --git a/src/test/ipams/nautobot/expected.del_ip b/src/test/ipams/nautobot/expected.del_ip
new file mode 100644
index 0000000..eaa133e
--- /dev/null
+++ b/src/test/ipams/nautobot/expected.del_ip
@@ -0,0 +1,11 @@
+bless( {
+ '_content' => '',
+ '_headers' => bless( {
+ 'accept' => 'application/json',
+ 'authorization' => 'token FAKETESTTOKEN',
+ 'content-type' => 'application/json; charset=UTF-8',
+ }, 'HTTP::Headers' ),
+ '_max_body_size' => undef,
+ '_method' => 'DELETE',
+ '_uri' => bless( do{\(my $o = 'http://localhost:8080/api/ipam/ip-addresses/1/')}, 'URI::http' )
+ }, 'HTTP::Request' );
diff --git a/src/test/ipams/nautobot/expected.update_ip b/src/test/ipams/nautobot/expected.update_ip
new file mode 100644
index 0000000..be6df47
--- /dev/null
+++ b/src/test/ipams/nautobot/expected.update_ip
@@ -0,0 +1,11 @@
+bless( {
+ '_content' => '{"address":"10.0.0.1/24","description":"gateway","namespace":"TestNamespace","status":"Active","type":"dhcp"}',
+ '_headers' => bless( {
+ 'accept' => 'application/json',
+ 'authorization' => 'token FAKETESTTOKEN',
+ 'content-type' => 'application/json; charset=UTF-8',
+ }, 'HTTP::Headers' ),
+ '_max_body_size' => undef,
+ '_method' => 'PATCH',
+ '_uri' => bless( do{\(my $o = 'http://localhost:8080/api/ipam/ip-addresses/1/')}, 'URI::http' )
+ }, 'HTTP::Request' );
diff --git a/src/test/ipams/nautobot/ipam_config b/src/test/ipams/nautobot/ipam_config
new file mode 100644
index 0000000..014d6b1
--- /dev/null
+++ b/src/test/ipams/nautobot/ipam_config
@@ -0,0 +1,24 @@
+{
+ 'ids' => {
+ 'phpipam' => {
+ 'url' => 'https://localhost/api/apiadmin',
+ 'type' => 'phpipam',
+ 'section' => 1,
+ 'token' => 'JPHkPSLB4O_XL-GQz4qtEFmNpx-99Htw'
+ },
+ 'pve' => {
+ 'type' => 'pve'
+ },
+ 'netbox' => {
+ 'token' => '0123456789abcdef0123456789abcdef01234567',
+ 'type' => 'netbox',
+ 'url' => 'http://localhost:8000/api'
+ },
+ 'nautobot' => {
+ 'url' => 'http://localhost:8080/api',
+ 'type' => 'nautobot',
+ 'token' => 'FAKETESTTOKEN',
+ 'namespace' => 'TestNamespace'
+ }
+ },
+}
diff --git a/src/test/ipams/nautobot/sdn_config b/src/test/ipams/nautobot/sdn_config
new file mode 100644
index 0000000..784cd95
--- /dev/null
+++ b/src/test/ipams/nautobot/sdn_config
@@ -0,0 +1,20 @@
+{
+ version => 1,
+ vnets => {
+ ids => {
+ myvnet => { type => "vnet", zone => "myzone" },
+ },
+ },
+
+ zones => {
+ ids => { myzone => { ipam => "nautobot" } },
+ },
+
+ subnets => {
+ ids => { 'myzone-10.0.0.0-24' => {
+ 'type' => 'subnet',
+ 'vnet' => 'myvnet',
+ }
+ }
+ }
+}
diff --git a/src/test/ipams/netbox/ipam_config b/src/test/ipams/netbox/ipam_config
index a33be30..6a6fe44 100644
--- a/src/test/ipams/netbox/ipam_config
+++ b/src/test/ipams/netbox/ipam_config
@@ -13,6 +13,12 @@
'token' => '0123456789abcdef0123456789abcdef01234567',
'type' => 'netbox',
'url' => 'http://localhost:8000/api'
- }
+ },
+ 'nautobot' => {
+ 'url' => 'http://localhost:8080/api',
+ 'type' => 'nautobot',
+ 'token' => 'FAKETESTTOKEN',
+ 'namespace' => 'TestNamespace'
+ }
},
}
diff --git a/src/test/ipams/phpipam/ipam_config b/src/test/ipams/phpipam/ipam_config
index a33be30..014d6b1 100644
--- a/src/test/ipams/phpipam/ipam_config
+++ b/src/test/ipams/phpipam/ipam_config
@@ -13,6 +13,12 @@
'token' => '0123456789abcdef0123456789abcdef01234567',
'type' => 'netbox',
'url' => 'http://localhost:8000/api'
- }
+ },
+ 'nautobot' => {
+ 'url' => 'http://localhost:8080/api',
+ 'type' => 'nautobot',
+ 'token' => 'FAKETESTTOKEN',
+ 'namespace' => 'TestNamespace'
+ }
},
}
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-05-06 9:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 9:00 [pve-devel] [PATCH pve-network v4 1/2] ipam: add Nautobot plugin Hannes Duerr
2025-05-06 9:00 ` Hannes Duerr [this message]
2025-05-06 9:00 ` [pve-devel] [PATCH pve-docs v4 1/1] add documentation for nautobot ipam plugin Hannes Duerr
2025-05-06 9:00 ` [pve-devel] [PATCH pve-manager v4 1/1] ipam: add UI dialog " Hannes Duerr
2025-05-07 9:17 ` [pve-devel] [PATCH pve-network v4 1/2] ipam: add Nautobot plugin - range workaround questions Lou Lecrivain via pve-devel
[not found] ` <FR2PPF45D006270C594040B87F6E418E7548588A@FR2PPF45D006270.DEUP281.PROD.OUTLOOK.COM>
2025-05-09 8:46 ` [pve-devel] SPAM: " Hannes Duerr
2025-05-09 9:34 ` [pve-devel] [!!ACHTUNG extern!!] - " Lou Lecrivain via pve-devel
[not found] ` <FR2PPF45D0062706987369A6C23E8E8DF74858AA@FR2PPF45D006270.DEUP281.PROD.OUTLOOK.COM>
2025-05-12 8:38 ` [pve-devel] SPAM: " Hannes Duerr
2025-05-14 14:00 ` [pve-devel] [!!ACHTUNG extern!!] - " Lou Lecrivain via pve-devel
2025-05-26 12:14 [pve-devel] [PATCH pve-network v4 1/2] ipam: add Nautobot plugin Hannes Duerr
2025-05-26 12:14 ` [pve-devel] [PATCH pve-network v4 2/2] ipam: add test cases for nautobot plugin Hannes Duerr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250506090041.53080-2-h.duerr@proxmox.com \
--to=h.duerr@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal