File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,11 @@ def run(self):
147
147
data = self .data
148
148
149
149
if self .endpoint == "ip_addresses" :
150
+ if data .get ("address" ):
151
+ try :
152
+ data ["address" ] = to_text (ipaddress .ip_network (data ["address" ]))
153
+ except ValueError :
154
+ pass
150
155
name = data .get ("address" )
151
156
elif self .endpoint in ["aggregates" , "prefixes" ]:
152
157
name = data .get ("prefix" )
Original file line number Diff line number Diff line change 432
432
netbox_url : http://localhost.org:32768
433
433
netbox_token : 0123456789abcdef0123456789abcdef01234567
434
434
data :
435
- address : 192.168.1.10
435
+ address : 192.168.1.10/30
436
436
state : absent
437
437
register : test_three
438
438
442
442
- test_three is changed
443
443
- test_three['diff']['before']['state'] == "present"
444
444
- test_three['diff']['after']['state'] == "absent"
445
- - test_three['msg'] == "ip_address 192.168.1.10 deleted"
445
+ - test_three['msg'] == "ip_address 192.168.1.10/30 deleted"
446
446
447
447
- name : " 4 - Create IP in global VRF - 192.168.1.20/30 - State: Present"
448
448
netbox_ip_address :
687
687
- test_fourteen['ip_address']['address'] == "10.188.1.100/24"
688
688
- test_fourteen['ip_address']['family'] == 4
689
689
- test_fourteen['ip_address']['interface'] == 3
690
+
691
+ - name : " 15 - Create IP address with no mask - State: Present"
692
+ netbox_ip_address :
693
+ netbox_url : http://localhost.org:32768
694
+ netbox_token : 0123456789abcdef0123456789abcdef01234567
695
+ data :
696
+ address : 10.120.10.1
697
+ state : present
698
+ register : test_fifteen
699
+
700
+ - name : " 15 - ASSERT"
701
+ assert :
702
+ that :
703
+ - test_fifteen is changed
704
+ - test_fifteen['diff']['before']['state'] == "absent"
705
+ - test_fifteen['diff']['after']['state'] == "present"
706
+ - test_fifteen['msg'] == "ip_address 10.120.10.1/32 created"
707
+ - test_fifteen['ip_address']['address'] == "10.120.10.1/32"
708
+
690
709
# #
691
710
# #
692
711
# ## NETBOX_PREFIX
You can’t perform that action at this time.
0 commit comments