1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-05 19:47:12 +00:00

Move modules and module_utils unit tests to correct place (#81)

* Move modules and module_utils unit tests to correct place.

* Update ignore.txt

* Fix imports.

* Fix typos.

* Fix more typos.
This commit is contained in:
Felix Fontein 2020-03-31 10:42:38 +02:00 committed by GitHub
parent ab3c2120fb
commit be191cce6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1170 changed files with 732 additions and 751 deletions

View file

@ -0,0 +1,107 @@
General Info :
SysDescr : VSP-4450GSX-PWR+ (7.0.0.0_B015)
SysName : VSP-4450GSX-PWR+
SysUpTime : 5 day(s), 17:13:09
SysContact : http://www.extremenetworks.com/contact/
SysLocation :
Chassis Info:
Chassis : 4450GSX-PWR+
ModelName : 4450GSX-PWR+
BrandName : Extreme Networks.
Serial# : 14JP512E0001
H/W Revision : 01
H/W Config : none
Part Number :
NumSlots : 1
NumPorts : 50
BaseMacAddr : b4:47:5e:00:00:00
MacAddrCapacity : 256
System MTU : 1950
Card Info :
Slot# CardType Serial# Part# Oper Admin Power
Status Status State
1 4450GSX-PWR+ 14JP512E0001 -- up up on
Temperature Info :
Chassis Temperature
30
Power Supply Info :
Ps#1 Status : UP
Ps#1 Type : AC
Ps#1 Description : AC-DC-54V-1000W
Ps#1 Serial Number: LBNNTMPL20180R
Ps#1 Version : --
Ps#1 Part Number : 325220-A.01
Ps#2 Status : empty
Total Power Available : 1000 watts
Total Power Usage : 127 watts
Fan Info :
Description OperStatus OperSpeed AirflowDir
Tray 1 Fan 1 up mediumSpeed left-right
Tray 1 Fan 2 up mediumSpeed left-right
Tray 1 Fan 3 up mediumSpeed left-right
LED Info :
LED#1 Label : PWR
LED#1 Status : GreenSteady
LED#2 Label : Status
LED#2 Status : GreenSteady
LED#3 Label : Rps
LED#3 Status : Off
LED#4 Label : Up
LED#4 Status : UnSupported
LED#5 Label : Down
LED#5 Status : UnSupported
LED#6 Label : Base
LED#6 Status : UnSupported
System Error Info :
Send Login Success Trap : false
Send Authentication Trap : false
Error Code : 0
Error Severity : 0
Port Lock Info :
Status : off
LockedPorts :
Message Control Info :
Action : suppress-msg
Control-Interval : 5
Max-msg-num : 5
Status : disable
Configuration Operation Info Since Boot Up:
Last Change: 0 day(s), 08:31:10 (5 day(s), 08:41:59 ago)
Last Vlan Change: 0 day(s), 08:27:35 (5 day(s), 08:45:34 ago)
Last Statistic Reset: 5 day(s), 16:56:45 (0 day(s), 00:16:24 ago)
Current Uboot Info :
----------------------------------------------------------------------------------------------------
VU-Boot 2012.04-00002-g6fb1c26 (Apr 26 2017 - 13:37:44) bld=17042617

View file

@ -0,0 +1,16 @@
prompt "VSP300"
interface GigabitEthernet 1/1
name "ServerA"
vlacp enable
exit
interface GigabitEthernet 1/2
name "ServerB"
vlacp enable
no shutdown
exit
interface loopback 1
ip address 1 1.1.1.1/255.255.255.255
exit
interface loopback 1
ipv6 interface address 2011:0:0:0:0:0:0:1/128
exit

View file

@ -0,0 +1,6 @@
interface loopback 1
ip address 1 2.2.2.2/255.255.255.255
exit
interface loopback 1
ipv6 interface address 2011:0:0:0:0:0:0:2/128
exit

View file

@ -0,0 +1,10 @@
prompt "VSP8K"
interface GigabitEthernet 1/1
name "UNUSED"
vlacp enable
exit
interface GigabitEthernet 1/2
name "ServerB"
vlacp enable
no shutdown
exit

View file

@ -0,0 +1,93 @@
==========================================================================================
Port Interface
==========================================================================================
PORT LINK PORT PHYSICAL STATUS
NUM INDEX DESCRIPTION TRAP LOCK MTU ADDRESS ADMIN OPERATE
------------------------------------------------------------------------------------------
1/1 192 10GbNone true false 1950 00:51:00:16:40:00 down down
1/2 193 10GbNone true false 1950 00:51:00:16:40:01 down down
1/3 194 10GbNone true false 1950 00:51:00:16:40:02 down down
1/4 195 10GbNone true false 1950 00:51:00:16:40:03 down down
1/5 196 10GbNone true false 1950 00:51:00:16:40:04 down down
1/6 197 10GbNone true false 1950 00:51:00:16:40:05 down down
1/7 198 10GbNone true false 1950 00:51:00:16:40:06 down down
1/8 199 10GbNone true false 1950 00:51:00:16:40:07 down down
1/9 200 10GbNone true false 1950 00:51:00:16:40:08 down down
1/10 201 10GbNone true false 1950 00:51:00:16:40:09 down down
1/11 202 10GbNone true false 1950 00:51:00:16:40:0a down down
1/12 203 10GbNone true false 1950 00:51:00:16:40:0b down down
1/13 204 10GbNone true false 1950 00:51:00:16:40:0c down down
1/14 205 10GbNone true false 1950 00:51:00:16:40:0d down down
1/15 206 10GbNone true false 1950 00:51:00:16:40:0e down down
1/16 207 10GbNone true false 1950 00:51:00:16:40:0f down down
1/17 208 10GbNone true false 1950 00:51:00:16:40:10 down down
1/18 209 10GbNone true false 1950 00:51:00:16:40:11 down down
1/19 210 10GbNone true false 1950 00:51:00:16:40:12 down down
1/20 211 10GbNone true false 1950 00:51:00:16:40:13 down down
1/21 212 10GbNone true false 1950 00:51:00:16:40:14 down down
1/22 213 10GbNone true false 1950 00:51:00:16:40:15 down down
1/23 214 10GbNone true false 1950 00:51:00:16:40:16 down down
1/24 215 10GbNone true false 1950 00:51:00:16:40:17 down down
1/25 216 10GbNone true false 1950 00:51:00:16:40:18 down down
1/26 217 10GbNone true false 1950 00:51:00:16:40:19 down down
1/27 218 10GbNone true false 1950 00:51:00:16:40:1a down down
1/28 219 10GbNone true false 1950 00:51:00:16:40:1b down down
1/29 220 10GbNone true false 1950 00:51:00:16:40:1c down down
1/30 221 10GbNone true false 1950 00:51:00:16:40:1d down down
1/31 222 10GbNone true false 1950 00:51:00:16:40:1e down down
1/32 223 10GbNone true false 1950 00:51:00:16:40:1f down down
1/33 224 10GbNone true false 1950 00:51:00:16:40:20 down down
1/34 225 10GbNone true false 1950 00:51:00:16:40:21 down down
1/35 226 10GbNone true false 1950 00:51:00:16:40:22 down down
1/36 227 10GbNone true false 1950 00:51:00:16:40:23 down down
1/37 228 10GbNone true false 1950 00:51:00:16:40:24 down down
1/38 229 10GbNone true false 1950 00:51:00:16:40:25 down down
1/39 230 10GbNone true false 1950 00:51:00:16:40:26 down down
1/40 231 10GbNone true false 1950 00:51:00:16:40:27 down down
1/41 232 40GbNone true false 1950 00:51:00:16:40:28 down down
1/42 236 40GbNone true false 1950 00:51:00:16:40:2c down down
2/1 256 10GbNone true false 1950 00:51:00:16:40:40 down down
2/2 257 10GbNone true false 1950 00:51:00:16:40:41 down down
2/3 258 10GbNone true false 1950 00:51:00:16:40:42 down down
2/4 259 10GbNone true false 1950 00:51:00:16:40:43 down down
2/5 260 10GbNone true false 1950 00:51:00:16:40:44 down down
2/6 261 10GbNone true false 1950 00:51:00:16:40:45 down down
2/7 262 10GbNone true false 1950 00:51:00:16:40:46 down down
2/8 263 10GbNone true false 1950 00:51:00:16:40:47 down down
2/9 264 10GbNone true false 1950 00:51:00:16:40:48 down down
2/10 265 10GbNone true false 1950 00:51:00:16:40:49 down down
2/11 266 10GbNone true false 1950 00:51:00:16:40:4a down down
2/12 267 10GbNone true false 1950 00:51:00:16:40:4b down down
2/13 268 10GbNone true false 1950 00:51:00:16:40:4c down down
2/14 269 10GbNone true false 1950 00:51:00:16:40:4d down down
2/15 270 10GbNone true false 1950 00:51:00:16:40:4e down down
2/16 271 10GbNone true false 1950 00:51:00:16:40:4f down down
2/17 272 10GbNone true false 1950 00:51:00:16:40:50 down down
2/18 273 10GbNone true false 1950 00:51:00:16:40:51 down down
2/19 274 10GbNone true false 1950 00:51:00:16:40:52 down down
2/20 275 10GbNone true false 1950 00:51:00:16:40:53 down down
2/21 276 10GbNone true false 1950 00:51:00:16:40:54 down down
2/22 277 10GbNone true false 1950 00:51:00:16:40:55 down down
2/23 278 10GbNone true false 1950 00:51:00:16:40:56 down down
2/24 279 10GbNone true false 1950 00:51:00:16:40:57 down down
2/25 280 10GbNone true false 1950 00:51:00:16:40:58 down down
2/26 281 10GbNone true false 1950 00:51:00:16:40:59 down down
2/27 282 10GbNone true false 1950 00:51:00:16:40:5a down down
2/28 283 10GbNone true false 1950 00:51:00:16:40:5b down down
2/29 284 10GbNone true false 1950 00:51:00:16:40:5c down down
2/30 285 10GbNone true false 1950 00:51:00:16:40:5d down down
2/31 286 10GbNone true false 1950 00:51:00:16:40:5e down down
2/32 287 10GbNone true false 1950 00:51:00:16:40:5f down down
2/33 288 10GbNone true false 1950 00:51:00:16:40:60 down down
2/34 289 10GbNone true false 1950 00:51:00:16:40:61 down down
2/35 290 10GbNone true false 1950 00:51:00:16:40:62 down down
2/36 291 10GbNone true false 1950 00:51:00:16:40:63 down down
2/37 292 10GbNone true false 1950 00:51:00:16:40:64 down down
2/38 293 10GbNone true false 1950 00:51:00:16:40:65 down down
2/39 294 10GbNone true false 1950 00:51:00:16:40:66 down down
2/40 295 10GbNone true false 1950 00:51:00:16:40:67 down down
2/41 296 40GbNone true false 1950 00:51:00:16:40:68 down down
2/42 300 40GbNone true false 1950 00:51:00:16:40:6c down down

View file

@ -0,0 +1,93 @@
==========================================================================================
Port Name
==========================================================================================
PORT OPERATE OPERATE OPERATE
NUM NAME DESCRIPTION STATUS DUPLX SPEED VLAN
----------------------------------------------------------------------------------------------------
1/1 serverA 10GbNone down full 0 Access
1/2 10GbNone down full 0 Access
1/3 10GbNone down full 0 Access
1/4 10GbNone down full 0 Access
1/5 10GbNone down full 0 Access
1/6 10GbNone down full 0 Access
1/7 10GbNone down full 0 Access
1/8 10GbNone down full 0 Access
1/9 10GbNone down full 0 Access
1/10 10GbNone down full 0 Access
1/11 10GbNone down full 0 Access
1/12 10GbNone down full 0 Access
1/13 10GbNone down full 0 Access
1/14 10GbNone down full 0 Access
1/15 10GbNone down full 0 Access
1/16 10GbNone down full 0 Access
1/17 10GbNone down full 0 Access
1/18 10GbNone down full 0 Access
1/19 10GbNone down full 0 Access
1/20 10GbNone down full 0 Access
1/21 10GbNone down full 0 Access
1/22 10GbNone down full 0 Access
1/23 10GbNone down full 0 Access
1/24 10GbNone down full 0 Access
1/25 10GbNone down full 0 Access
1/26 10GbNone down full 0 Access
1/27 10GbNone down full 0 Access
1/28 10GbNone down full 0 Access
1/29 10GbNone down full 0 Access
1/30 10GbNone down full 0 Access
1/31 10GbNone down full 0 Access
1/32 10GbNone down full 0 Access
1/33 10GbNone down full 0 Access
1/34 10GbNone down full 0 Access
1/35 10GbNone down full 0 Access
1/36 10GbNone down full 0 Access
1/37 10GbNone down full 0 Access
1/38 10GbNone down full 0 Access
1/39 10GbNone down full 0 Access
1/40 10GbNone down full 0 Access
1/41 40GbNone down half 0 Access
1/42 40GbNone down half 0 Access
2/1 10GbNone down full 0 Access
2/2 10GbNone down full 0 Access
2/3 10GbNone down full 0 Access
2/4 10GbNone down full 0 Access
2/5 10GbNone down full 0 Access
2/6 10GbNone down full 0 Access
2/7 10GbNone down full 0 Access
2/8 10GbNone down full 0 Access
2/9 10GbNone down full 0 Access
2/10 10GbNone down full 0 Access
2/11 10GbNone down full 0 Access
2/12 10GbNone down full 0 Access
2/13 10GbNone down full 0 Access
2/14 10GbNone down full 0 Access
2/15 10GbNone down full 0 Access
2/16 10GbNone down full 0 Access
2/17 10GbNone down full 0 Access
2/18 10GbNone down full 0 Access
2/19 10GbNone down full 0 Access
2/20 10GbNone down full 0 Access
2/21 10GbNone down full 0 Access
2/22 10GbNone down full 0 Access
2/23 10GbNone down full 0 Access
2/24 10GbNone down full 0 Access
2/25 10GbNone down full 0 Access
2/26 10GbNone down full 0 Access
2/27 10GbNone down full 0 Access
2/28 10GbNone down full 0 Access
2/29 10GbNone down full 0 Access
2/30 10GbNone down full 0 Access
2/31 10GbNone down full 0 Access
2/32 10GbNone down full 0 Access
2/33 10GbNone down full 0 Access
2/34 10GbNone down full 0 Access
2/35 10GbNone down full 0 Access
2/36 10GbNone down full 0 Access
2/37 10GbNone down full 0 Access
2/38 10GbNone down full 0 Access
2/39 10GbNone down full 0 Access
2/40 10GbNone down full 0 Access
2/41 40GbNone down half 0 Access
2/42 40GbNone down half 0 Access

View file

@ -0,0 +1,12 @@
====================================================================================================
IP Interface - GlobalRouter
====================================================================================================
INTERFACE IP NET BCASTADDR REASM VLAN BROUTER IPSEC
ADDRESS MASK FORMAT MAXSIZE ID PORT STATE
----------------------------------------------------------------------------------------------------
Clip1 1.1.1.1 255.255.255.255 ones 1500 -- false disable
Vlan1 10.10.10.10 255.255.255.0 ones 1500 1 false disable
All 2 out of 2 Total Num of IP interfaces displayed

View file

@ -0,0 +1,12 @@
=======================================================================================================
Address Information - GlobalRouter
=======================================================================================================
IPV6 ADDRESS/PREFIX LENGTH VID/BID/TID TYPE ORIGIN STATUS VALID PREF
LIFETIME LIFETIME
-------------------------------------------------------------------------------------------------------
2011:0:0:0:0:0:0:1/128 C-1 UNICAST MANUAL PREFERRED INF INF
2001:0:0:0:0:0:0:1/64 V-1 UNICAST MANUAL INACCESSIBLE INF INF
2002:0:0:0:0:0:0:1/64 V-1 UNICAST MANUAL INACCESSIBLE INF INF
fe80:0:0:0:251:ff:fe16:4100/64 V-1 UNICAST LINKLAYER INACCESSIBLE INF INF
4 out of 4 Total Num of Address Entries displayed.

View file

@ -0,0 +1,14 @@
Slot:1
Used: 386164 (KB)
Free: 639868 (KB)
Current utilization: 37 %
5-minute average utilization: 37 %
5-minute high water mark: 37 (%)
10-minute average utilization: 37 %
10-minute high water mark: 37 (%)
1-Hour average utilization: 37 %
1-Hour high water mark: 37 (%)
1-Day average utilization: 36 %
1-Month average utilization: 0 %
1-Year average utilization: 0 %

View file

@ -0,0 +1,12 @@
Port: 1/1 Index : 1
PortId : IfName 5
SysName : X690-48t-2q-4c
PortDescr:
Port: 1/2 Index : 2
PortId : IfName 1/2
SysName : VSP2
PortDescr: Extreme Networks Virtual Services Platform 4450GSX-PWR+ - 1000BaseTX Port 1/2
Port: 1/12 Index : 2
PortId : IfName 1/12
SysName : VSP2
PortDescr: Extreme Networks Virtual Services Platform 4450GSX-PWR+ - 1000BaseTX Port 1/12

View file

@ -0,0 +1,903 @@
Preparing to Display Configuration...
#
# Wed Aug 15 05:20:06 2018 UTC
# box type : VSP-8284XSQ
# software version : 7.0.0.0_B015
# cli mode : ECLI
#
#Card Info :
# Slot 1 :
# CardType : 8242XSQ
# CardDescription : 8242XSQ
# CardSerial# :
# CardPart# :
# CardAssemblyDate :
# CardHWRevision :
# CardHWConfig :
# AdminStatus : up
# OperStatus : up
# Slot 2 :
# CardType : 8242XSQ
# CardDescription : 8242XSQ
# CardSerial# :
# CardPart# :
# CardAssemblyDate :
# CardHWRevision :
# CardHWConfig :
# AdminStatus : up
# OperStatus : up
#
#!end
#
config terminal
#
# BOOT CONFIGURATION
#
boot config flags block-snmp
boot config flags sshd
# end boot flags
#
# CLI CONFIGURATION
#
cli timeout 3600
password password-history 3
#
# SYSTEM CONFIGURATION
#
#
# LOG CONFIGURATION
#
#
# LINK-FLAP-DETECT CONFIGURATION
#
#
# IEEE VLAN AGING CONFIGURATION
#
#
# ACCESS-POLICY CONFIGURATION
#
#
# SSH CONFIGURATION
#
ssh keyboard-interactive-auth
ssh secure
#
# ASG CONFIGURATION
#
#
# MCAST SOFTWARE FORWARDING CONFIGURATION
#
#
# MCAST SMLT CONFIGURATION
#
#
# SNMP V3 GLOBAL CONFIGURATION
#
#
# SNMP V3 GROUP MEMBERSHIP CONFIGURATION
#
#
# SNMP V3 NOTIFY FILTER CONFIGURATION
#
#
# SNMP V3 MIB VIEW CONFIGURATION
#
#
# SNMP V3 GROUP CONFIGURATION
#
#
# SNMP V3 TARGET ADDRESS CONFIGURATION
#
#
# DDI CONFIGURATION
#
#
# SLOT CONFIGURATION
#
#
# MAC AGING CONFIGURATION
#
#
# SMTP CONFIGURATION
#
#
# WEB CONFIGURATION
#
web-server enable
#
# GLOBAL FDB FILTER CONFIGURATION
#
#
# QOS CONFIGURATION - PHASE I
#
#
# LACP CONFIGURATION
#
#
# VRF CONFIGURATION
#
ip vrf dmz vrfid 1
#
# MAINTENANCE-DOMAIN CONFIGURATION
#
#
# MAINTENANCE-ASSOCIATION CONFIGURATION
#
#
# MAINTENANCE-ENDPOINT CONFIGURATION
#
#
# PORT CHANNELIZE CONFIGURATION
#
#
# PORT CONFIGURATION - PHASE I
#
#
# ISIS SPBM CONFIGURATION
#
#
# SPB-PIM-GW CONFIGURATION
#
#
# MLT CONFIGURATION
#
#
# IP PREFIX LIST CONFIGURATION - GlobalRouter
#
#
# IP PREFIX LIST CONFIGURATION - VRF
#
#
# IPv6 PREFIX LIST CONFIGURATION - GlobalRouter
#
#
# RMON CONFIGURATION
#
#
# DVR CONFIGURATION
#
#
# VLAN CONFIGURATION
#
interface Vlan 1
ip address 10.10.10.10 255.255.255.0 0
ipv6 interface mac-offset 0
ipv6 interface address 2001:0:0:0:0:0:0:1/64
ipv6 interface address 2002:0:0:0:0:0:0:1/64
exit
vlan create 3 type port-mstprstp 0
#
# MSTP CONFIGURATION
#
#
# NLS CONFIGURATION
#
#
# FHS CONFIGURATION
#
#
# MAC ACL CONFIGURATION
#
#
# IPv6 FHS ACL CONFIGURATION
#
#
# RA-GUARD CONFIGURATION
#
#
# DHCP-GUARD CONFIGURATION
#
#
# FHS SNOOPING CONFIGURATION
#
#
# SFLOW CONFIGURATION
#
#
# DHCP SNOOPING CONFIGURATION
#
#
# DHCP SNOOPING BINDING CONFIGURATION
#
#
# LINK-STATE TRACKING
#
#
# VIRTUAL IST CONFIGURATION
#
#
# MLT INTERFACE CONFIGURATION
#
#
# PORT CONFIGURATION - PHASE II
#
interface mgmtEthernet mgmt
auto-negotiate
ip address 192.168.8.10 255.255.255.0
exit
interface GigabitEthernet 1/1
name "serverA"
exit
#
# IP CONFIGURATION
#
#
# IP AS LIST CONFIGURATION - GlobalRouter
#
#
# IP AS LIST CONFIGURATION - VRF
#
#
# IP COMMUNITY LIST CONFIGURATION - GlobalRouter
#
#
# IP COMMUNITY LIST CONFIGURATION - VRF
#
#
# IP EXTENDED COMMUNITY LIST CONFIGURATION - GlobalRouter
#
#
# IP EXTENDED COMMUNITY LIST CONFIGURATION - VRF
#
#
# IP ROUTE MAP CONFIGURATION - GlobalRouter
#
#
# IP ROUTE MAP CONFIGURATION - VRF
#
#
# IP CONFIGURATION - GlobalRouter
#
#
# IP CONFIGURATION - VRF
#
#
# CIRCUITLESS IP INTERFACE CONFIGURATION - GlobalRouter
#
interface loopback 1
ip address 1 1.1.1.1/255.255.255.255
exit
#
# CIRCUITLESS IP INTERFACE CONFIGURATION - VRF
#
interface loopback 2
ip address 2 4.4.4.4/255.255.255.255 vrf dmz
exit
#
# TOPOLOGY-CLIP-IP
#
#
# MSDP CONFIGURATION - GlobalRouter
#
#
# CIRCUITLESS IPV6 INTERFACE CONFIGURATION - GlobalRouter
#
interface loopback 1
ipv6 interface address 2011:0:0:0:0:0:0:1/128
exit
#
# CIRCUITLESS IPV6 INTERFACE CONFIGURATION - VRF
#
#
# VRRP CONFIGURATION - GlobalRouter
#
#
# VRRP CONFIGURATION - VRF
#
#
# UDP FORWARDING CONFIGURATION - GlobalRouter
#
#
# UDP FORWARDING CONFIGURATION - VRF
#
#
# UDP FORWARDING VLAN CONFIGURATION
#
#
# DHCP CONFIGURATION - GlobalRouter
#
#
# DHCP CONFIGURATION - VRF
#
#
# RIP CONFIGURATION - GlobalRouter
#
#
# RIP CONFIGURATION - VRF
#
#
# RIP VLAN CONFIGURATION
#
#
# IGMP CONFIGURATION - GlobalRouter
#
#
# IGMP CONFIGURATION - VRF
#
#
# MROUTE CONFIGURATION
#
#
# MCAST RESOURCE USAGE CONFIGURATION - GlobalRouter
#
#
# MCAST RESOURCE USAGE CONFIGURATION - VRF
#
#
# TIMED PRUNE CONFIGURATION - GlobalRouter
#
#
# TIMED PRUNE CONFIGURATION - VRF
#
#
# RSMLT CONFIGURATION
#
#
# IPV6 CONFIGURATION - GlobalRouter
#
#
# IPV6 CONFIGURATION - VRF
#
#
# MLD CONFIGURATION - GlobalRouter
#
#
# MROUTE6 CONFIGURATION
#
#
# ISIS CONFIGURATION
#
#
# VTEP CONFIGURATION
#
#
# REMOTE VTEP CONFIGURATIONS
#
#
# VLAN NODAL MEP/MIP CONFIGURATION
#
#
# QOS CONFIGURATION - PHASE II
#
qos queue-profile 1 member add 1/1-1/42,2/1-2/42
#
# CFM CONFIGURATION - PHASE II
#
#
# DIAG CONFIGURATION
#
#
# NTP CONFIGURATION
#
no ntp
#
# OSPF CONFIGURATION - GlobalRouter
#
router ospf
exit
#
# OSPF CONFIGURATION - VRF
#
#
# OSPF ACCEPT CONFIGURATION - GlobalRouter
#
#
# OSPF ACCEPT CONFIGURATION - VRF
#
#
# BGP CONFIGURATION - GlobalRouter
#
#
# BGP CONFIGURATION - VRF
#
#
# ISIS SPBM IPVPN CONFIGURATION
#
#
# IP ISID LIST CONFIGURATION - GlobalRouter
#
#
# IP ISID LIST CONFIGURATION - VRF
#
#
# ISIS ACCEPT CONFIGURATION - GlobalRouter
#
#
# ISIS ACCEPT CONFIGURATION - VRF
#
#
# IP REDISTRIBUTION CONFIGURATION - GlobalRouter
#
#
# IP REDISTRIBUTION CONFIGURATION - VRF
#
#
# OSPF VLAN CONFIGURATION
#
#
# OSPF PORT CONFIGURATION
#
#
# OSPF LOOPBACK CONFIGURATION
#
#
# RIP PORT CONFIGURATION
#
#
# IPVPN CONFIGURATION
#
#
# SLPP CONFIGURATION
#
#
# FILTER CONFIGURATION
#
#
# IPV6 TUNNEL CONFIGURATION
#
#
# IPV6 OSPFV3 CONFIGURATION
#
router ospf
exit
#
# IPV6 RIPng CONFIGURATION
#
router rip
exit
#
# IPV6 STATIC ROUTE CONFIGURATION - GlobalRouter
#
#
# IPV6 STATIC ROUTE CONFIGURATION - VRF
#
#
# IPV6 MGMT INTERFACE CONFIGURATION
#
#
# IPV6 OSPF VLAN CONFIGURATION
#
#
# IPV6 OSPF PORT CONFIGURATION
#
#
# IPV6 RIP VLAN CONFIGURATION
#
#
# IPV6 RIP PORT CONFIGURATION
#
#
# IPV6 VRRP VLAN CONFIGURATION
#
#
# IPV6 VRRP PORT CONFIGURATION
#
#
# IPV6 NEIGHBOR CONFIGURATION - GlobalRouter
#
#
# IPV6 NEIGHBOR CONFIGURATION - VRF
#
#
# IPV6 DHCP CONFIGURATION - GlobalRouter
#
#
# IPV6 DHCP CONFIGURATION - VRF
#
#
# I-SID CONFIGURATION
#
#
# VNID CONFIGURATION
#
#
# RADIUS CONFIGURATION
#
#
# TACACS CONFIGURATION
#
#
# LLDP CONFIGURATION
#
#
# EAP CONFIGURATION
#
#
# MACSEC CONFIGURATION
#
#
# FABRIC ATTACH CONFIGURATION
#
#
# SPB-PIM-GW CONFIGURATION
#
#
# SOFTWARE CONFIGURATION
#
#
# APPLICATION CONFIGURATION
#
#
# OVSDB CONFIGURATION
#
#
# IPSEC CONFIGURATION
#
#
# IPSEC POLICY TABLE CONFIGURATION
#
#
# IPSEC SA TABLE CONFIGURATION
#
#
# IPSEC SA POLICY LINK TABLE CONFIGURATION
#
#
# IPV6 OSPFV3 IPSEC CONFIGURATION
#
#
# IPV6 IPSEC INTERFACE CONFIGURATION
#
#
# IP IPSEC INTERFACE CONFIGURATION
#
#
# IKE CONFIGURATION
#
#
# IP REDISTRIBUTE APPLY CONFIGURATIONS
#
#
#
# IP ECMP APPLY CONFIGURATIONS
end

View file

@ -0,0 +1,107 @@
General Info :
SysDescr : VSP-4450GSX-PWR+ (7.0.0.0_B015)
SysName : VSP-4450GSX-PWR+
SysUpTime : 5 day(s), 17:13:09
SysContact : http://www.extremenetworks.com/contact/
SysLocation :
Chassis Info:
Chassis : 4450GSX-PWR+
ModelName : 4450GSX-PWR+
BrandName : Extreme Networks.
Serial# : 14JP512E0001
H/W Revision : 01
H/W Config : none
Part Number :
NumSlots : 1
NumPorts : 50
BaseMacAddr : b4:47:5e:00:00:00
MacAddrCapacity : 256
System MTU : 1950
Card Info :
Slot# CardType Serial# Part# Oper Admin Power
Status Status State
1 4450GSX-PWR+ 14JP512E0001 -- up up on
Temperature Info :
Chassis Temperature
30
Power Supply Info :
Ps#1 Status : UP
Ps#1 Type : AC
Ps#1 Description : AC-DC-54V-1000W
Ps#1 Serial Number: LBNNTMPL20180R
Ps#1 Version : --
Ps#1 Part Number : 325220-A.01
Ps#2 Status : empty
Total Power Available : 1000 watts
Total Power Usage : 127 watts
Fan Info :
Description OperStatus OperSpeed AirflowDir
Tray 1 Fan 1 up mediumSpeed left-right
Tray 1 Fan 2 up mediumSpeed left-right
Tray 1 Fan 3 up mediumSpeed left-right
LED Info :
LED#1 Label : PWR
LED#1 Status : GreenSteady
LED#2 Label : Status
LED#2 Status : GreenSteady
LED#3 Label : Rps
LED#3 Status : Off
LED#4 Label : Up
LED#4 Status : UnSupported
LED#5 Label : Down
LED#5 Status : UnSupported
LED#6 Label : Base
LED#6 Status : UnSupported
System Error Info :
Send Login Success Trap : false
Send Authentication Trap : false
Error Code : 0
Error Severity : 0
Port Lock Info :
Status : off
LockedPorts :
Message Control Info :
Action : suppress-msg
Control-Interval : 5
Max-msg-num : 5
Status : disable
Configuration Operation Info Since Boot Up:
Last Change: 0 day(s), 08:31:10 (5 day(s), 08:41:59 ago)
Last Vlan Change: 0 day(s), 08:27:35 (5 day(s), 08:45:34 ago)
Last Statistic Reset: 5 day(s), 16:56:45 (0 day(s), 00:16:24 ago)
Current Uboot Info :
----------------------------------------------------------------------------------------------------
VU-Boot 2012.04-00002-g6fb1c26 (Apr 26 2017 - 13:37:44) bld=17042617

View file

@ -0,0 +1,120 @@
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible_collections.community.general.tests.unit.compat.mock import patch
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
from ansible_collections.community.general.plugins.modules.network.voss import voss_command
from .voss_module import TestVossModule, load_fixture
class TestVossCommandModule(TestVossModule):
module = voss_command
def setUp(self):
super(TestVossCommandModule, self).setUp()
self.mock_run_commands = patch('ansible_collections.community.general.plugins.modules.network.voss.voss_command.run_commands')
self.run_commands = self.mock_run_commands.start()
def tearDown(self):
super(TestVossCommandModule, self).tearDown()
self.mock_run_commands.stop()
def load_fixtures(self, commands=None):
def load_from_file(*args, **kwargs):
module, commands = args
output = list()
for item in commands:
try:
obj = json.loads(item['command'])
command = obj['command']
except ValueError:
command = item['command']
filename = str(command).replace(' ', '_')
output.append(load_fixture(filename))
return output
self.run_commands.side_effect = load_from_file
def test_voss_command_simple(self):
set_module_args(dict(commands=['show sys-info']))
result = self.execute_module()
self.assertEqual(len(result['stdout']), 1)
self.assertTrue(result['stdout'][0].startswith('General Info'))
def test_voss_command_multiple(self):
set_module_args(dict(commands=['show sys-info', 'show sys-info']))
result = self.execute_module()
self.assertEqual(len(result['stdout']), 2)
self.assertTrue(result['stdout'][0].startswith('General Info'))
def test_voss_command_wait_for(self):
wait_for = 'result[0] contains "General Info"'
set_module_args(dict(commands=['show sys-info'], wait_for=wait_for))
self.execute_module()
def test_voss_command_wait_for_fails(self):
wait_for = 'result[0] contains "test string"'
set_module_args(dict(commands=['show sys-info'], wait_for=wait_for))
self.execute_module(failed=True)
self.assertEqual(self.run_commands.call_count, 10)
def test_voss_command_retries(self):
wait_for = 'result[0] contains "test string"'
set_module_args(dict(commands=['show sys-info'], wait_for=wait_for, retries=2))
self.execute_module(failed=True)
self.assertEqual(self.run_commands.call_count, 2)
def test_voss_command_match_any(self):
wait_for = ['result[0] contains "General Info"',
'result[0] contains "test string"']
set_module_args(dict(commands=['show sys-info'], wait_for=wait_for, match='any'))
self.execute_module()
def test_voss_command_match_all(self):
wait_for = ['result[0] contains "General Info"',
'result[0] contains "Chassis Info"']
set_module_args(dict(commands=['show sys-info'], wait_for=wait_for, match='all'))
self.execute_module()
def test_voss_command_match_all_failure(self):
wait_for = ['result[0] contains "General Info"',
'result[0] contains "test string"']
commands = ['show sys-info', 'show sys-info']
set_module_args(dict(commands=commands, wait_for=wait_for, match='all'))
self.execute_module(failed=True)
def test_voss_command_configure_error(self):
commands = ['configure terminal']
set_module_args({
'commands': commands,
'_ansible_check_mode': True,
})
result = self.execute_module(failed=True)
self.assertEqual(
result['msg'],
'voss_command does not support running config mode commands. Please use voss_config instead'
)

View file

@ -0,0 +1,272 @@
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible_collections.community.general.tests.unit.compat.mock import patch, MagicMock
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
from ansible_collections.community.general.plugins.modules.network.voss import voss_config
from ansible_collections.community.general.plugins.cliconf.voss import Cliconf
from .voss_module import TestVossModule, load_fixture
class TestVossConfigModule(TestVossModule):
module = voss_config
def setUp(self):
super(TestVossConfigModule, self).setUp()
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.voss.voss_config.get_config')
self.get_config = self.mock_get_config.start()
self.mock_get_connection = patch('ansible_collections.community.general.plugins.modules.network.voss.voss_config.get_connection')
self.get_connection = self.mock_get_connection.start()
self.conn = self.get_connection()
self.conn.edit_config = MagicMock()
self.mock_run_commands = patch('ansible_collections.community.general.plugins.modules.network.voss.voss_config.run_commands')
self.run_commands = self.mock_run_commands.start()
self.cliconf_obj = Cliconf(MagicMock())
self.running_config = load_fixture('voss_config_config.cfg')
def tearDown(self):
super(TestVossConfigModule, self).tearDown()
self.mock_get_config.stop()
self.mock_run_commands.stop()
self.mock_get_connection.stop()
def load_fixtures(self, commands=None):
config_file = 'voss_config_config.cfg'
self.get_config.return_value = load_fixture(config_file)
self.get_connection.edit_config.return_value = None
def test_voss_config_unchanged(self):
src = load_fixture('voss_config_config.cfg')
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(src, src))
set_module_args(dict(src=src))
self.execute_module()
def test_voss_config_src(self):
src = load_fixture('voss_config_src.cfg')
set_module_args(dict(src=src))
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(src, self.running_config))
commands = ['prompt "VSP8K"', 'interface GigabitEthernet 1/1',
'name "UNUSED"', 'exit']
self.execute_module(changed=True, commands=commands)
def test_voss_config_backup(self):
set_module_args(dict(backup=True))
result = self.execute_module()
self.assertIn('__backup__', result)
def test_voss_config_save_always(self):
self.run_commands.return_value = "Hostname foo"
set_module_args(dict(save_when='always'))
self.execute_module(changed=True)
self.assertEqual(self.run_commands.call_count, 1)
self.assertEqual(self.get_config.call_count, 0)
self.assertEqual(self.conn.edit_config.call_count, 0)
args = self.run_commands.call_args[0][1]
self.assertIn('save config\r', args)
def test_voss_config_save_changed_true(self):
src = load_fixture('voss_config_src.cfg')
set_module_args(dict(src=src, save_when='changed'))
commands = ['prompt "VSP8K"', 'interface GigabitEthernet 1/1',
'name "UNUSED"', 'exit']
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(src, self.running_config))
self.execute_module(changed=True, commands=commands)
self.assertEqual(self.run_commands.call_count, 1)
self.assertEqual(self.get_config.call_count, 1)
self.assertEqual(self.conn.edit_config.call_count, 1)
args = self.run_commands.call_args[0][1]
self.assertIn('save config\r', args)
def test_voss_config_save_changed_false(self):
set_module_args(dict(save_when='changed'))
self.execute_module(changed=False)
self.assertEqual(self.run_commands.call_count, 0)
self.assertEqual(self.get_config.call_count, 0)
self.assertEqual(self.conn.edit_config.call_count, 0)
def test_voss_config_lines_wo_parents(self):
lines = ['prompt "VSP8K"']
set_module_args(dict(lines=lines))
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config))
commands = ['prompt "VSP8K"']
self.execute_module(changed=True, commands=commands)
def test_voss_config_lines_w_parents(self):
lines = ['no shutdown']
parents = ['interface GigabitEthernet 1/1']
set_module_args(dict(lines=lines, parents=parents))
module = MagicMock()
module.params = {'lines': lines, 'parents': parents, 'src': None}
candidate_config = voss_config.get_candidate_config(module)
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config))
commands = ['interface GigabitEthernet 1/1', 'no shutdown']
self.execute_module(changed=True, commands=commands)
def test_voss_config_before(self):
lines = ['prompt "VSP8K"']
set_module_args(dict(lines=lines, before=['test1', 'test2']))
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines),
self.running_config))
commands = ['test1', 'test2', 'prompt "VSP8K"']
self.execute_module(changed=True, commands=commands, sort=False)
def test_voss_config_after(self):
lines = ['prompt "VSP8K"']
set_module_args(dict(lines=lines, after=['test1', 'test2']))
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines),
self.running_config))
commands = ['prompt "VSP8K"', 'test1', 'test2']
self.execute_module(changed=True, commands=commands, sort=False)
def test_voss_config_before_after_no_change(self):
lines = ['prompt "VSP300"']
set_module_args(dict(lines=lines,
before=['test1', 'test2'],
after=['test3', 'test4']))
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config))
self.execute_module()
def test_voss_config_config(self):
config = 'prompt "VSP300"'
lines = ['prompt router']
set_module_args(dict(lines=lines, config=config))
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), config))
commands = ['prompt router']
self.execute_module(changed=True, commands=commands)
def test_voss_config_replace_block(self):
lines = ['name "ServerB"', 'test string']
parents = ['interface GigabitEthernet 1/2']
set_module_args(dict(lines=lines, replace='block', parents=parents))
module = MagicMock()
module.params = {'lines': lines, 'parents': parents, 'src': None}
candidate_config = voss_config.get_candidate_config(module)
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_replace='block', path=parents))
commands = parents + lines
self.execute_module(changed=True, commands=commands)
def test_voss_config_match_none(self):
lines = ['prompt router']
set_module_args(dict(lines=lines, match='none'))
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config, diff_match='none'))
self.execute_module(changed=True, commands=lines)
def test_voss_config_match_none_parents(self):
lines = ['name ServerA', 'vlacp enable']
parents = ['interface GigabitEthernet 1/1']
set_module_args(dict(lines=lines, parents=parents, match='none'))
module = MagicMock()
module.params = {'lines': lines, 'parents': parents, 'src': None}
candidate_config = voss_config.get_candidate_config(module)
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_match='none', path=parents))
commands = parents + lines
self.execute_module(changed=True, commands=commands, sort=False)
def test_voss_config_match_strict(self):
lines = ['name "ServerA"', 'vlacp enable',
'no shutdown']
parents = ['interface GigabitEthernet 1/1']
set_module_args(dict(lines=lines, parents=parents, match='strict'))
module = MagicMock()
module.params = {'lines': lines, 'parents': parents, 'src': None}
candidate_config = voss_config.get_candidate_config(module)
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_match='strict', path=parents))
commands = parents + ['no shutdown']
self.execute_module(changed=True, commands=commands, sort=False)
def test_voss_config_match_exact(self):
lines = ['name "ServerA"', 'vlacp enable', 'no shutdown']
parents = ['interface GigabitEthernet 1/1']
set_module_args(dict(lines=lines, parents=parents, match='exact'))
module = MagicMock()
module.params = {'lines': lines, 'parents': parents, 'src': None}
candidate_config = voss_config.get_candidate_config(module)
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_match='exact', path=parents))
commands = parents + lines
self.execute_module(changed=True, commands=commands, sort=False)
def test_voss_config_src_and_lines_fails(self):
args = dict(src='foo', lines='foo')
set_module_args(args)
self.execute_module(failed=True)
def test_voss_config_src_and_parents_fails(self):
args = dict(src='foo', parents='foo')
set_module_args(args)
self.execute_module(failed=True)
def test_voss_config_match_exact_requires_lines(self):
args = dict(match='exact')
set_module_args(args)
self.execute_module(failed=True)
def test_voss_config_match_strict_requires_lines(self):
args = dict(match='strict')
set_module_args(args)
self.execute_module(failed=True)
def test_voss_config_replace_block_requires_lines(self):
args = dict(replace='block')
set_module_args(args)
self.execute_module(failed=True)
def test_voss_config_replace_config_requires_src(self):
args = dict(replace='config')
set_module_args(args)
self.execute_module(failed=True)
def test_voss_config_ipv6(self):
lines = ['ip address 1 1.1.1.1/255.255.255.255',
'ipv6 interface address 2011:0:0:0:0:0:0:1/128']
parents = ['interface loopback 1']
set_module_args(dict(lines=lines, parents=parents))
module = MagicMock()
module.params = {'lines': lines, 'parents': parents, 'src': None}
candidate_config = voss_config.get_candidate_config(module)
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config))
self.execute_module(changed=False)
def test_voss_config_src_ipv6(self):
src = load_fixture('voss_config_ipv6.cfg')
set_module_args(dict(src=src))
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(src, self.running_config))
commands = ['interface loopback 1', 'ip address 1 2.2.2.2/255.255.255.255',
'ipv6 interface address 2011:0:0:0:0:0:0:2/128', 'exit']
self.execute_module(changed=True, commands=commands)

View file

@ -0,0 +1,86 @@
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible_collections.community.general.tests.unit.compat.mock import patch
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
from ansible_collections.community.general.plugins.modules.network.voss import voss_facts
from .voss_module import TestVossModule, load_fixture
class TestVossFactsModule(TestVossModule):
module = voss_facts
def setUp(self):
super(TestVossFactsModule, self).setUp()
self.mock_run_commands = patch('ansible_collections.community.general.plugins.modules.network.voss.voss_facts.run_commands')
self.run_commands = self.mock_run_commands.start()
def tearDown(self):
super(TestVossFactsModule, self).tearDown()
self.mock_run_commands.stop()
def load_fixtures(self, commands=None):
def load_from_file(*args, **kwargs):
module = args
commands = kwargs['commands']
output = list()
for command in commands:
filename = str(command).split(' | ')[0].replace(' ', '_')
output.append(load_fixture('voss_facts_%s' % filename))
return output
self.run_commands.side_effect = load_from_file
def test_voss_facts_default(self):
set_module_args(dict(gather_subset='default'))
result = self.execute_module()
self.assertEqual(
result['ansible_facts']['ansible_net_model'], '4450GSX-PWR+'
)
self.assertEqual(
result['ansible_facts']['ansible_net_serialnum'], '14JP512E0001'
)
self.assertEqual(
result['ansible_facts']['ansible_net_version'], '7.0.0.0_B015'
)
def test_voss_facts_interfaces(self):
set_module_args(dict(gather_subset='interfaces'))
result = self.execute_module()
self.assertEqual(
result['ansible_facts']['ansible_net_interfaces']['1/1']['description'], 'serverA'
)
self.assertEqual(
result['ansible_facts']['ansible_net_interfaces']['Clip1']['ipv4'][0]['address'], '1.1.1.1'
)
self.assertEqual(
result['ansible_facts']['ansible_net_neighbors']['1/1'][0]['host'], 'X690-48t-2q-4c'
)
def test_voss_facts_hardware(self):
set_module_args(dict(gather_subset='hardware'))
result = self.execute_module()
self.assertEqual(
result['ansible_facts']['ansible_net_memfree_mb'], 625
)
self.assertEqual(
result['ansible_facts']['ansible_net_memtotal_mb'], 1002
)

View file

@ -0,0 +1,88 @@
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
def load_fixture(name):
path = os.path.join(fixture_path, name)
if path in fixture_data:
return fixture_data[path]
with open(path) as f:
data = f.read()
try:
data = json.loads(data)
except Exception:
pass
fixture_data[path] = data
return data
class TestVossModule(ModuleTestCase):
def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False):
self.load_fixtures(commands)
if failed:
result = self.failed()
self.assertTrue(result['failed'], result)
else:
result = self.changed(changed)
self.assertEqual(result['changed'], changed, result)
if commands is not None:
if sort:
self.assertEqual(sorted(commands), sorted(result['commands']), result['commands'])
else:
self.assertEqual(commands, result['commands'], result['commands'])
return result
def failed(self):
with self.assertRaises(AnsibleFailJson) as exc:
self.module.main()
result = exc.exception.args[0]
self.assertTrue(result['failed'], result)
return result
def changed(self, changed=False):
with self.assertRaises(AnsibleExitJson) as exc:
self.module.main()
result = exc.exception.args[0]
self.assertEqual(result['changed'], changed, result)
return result
def load_fixtures(self, commands=None):
pass