mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Refactors bigip_vlan (#33489)
This patch adds tests and refactors the code to be inline with current f5 coding standards
This commit is contained in:
424
test/units/modules/network/f5/fixtures/load_net_interfaces.json
Normal file
424
test/units/modules/network/f5/fixtures/load_net_interfaces.json
Normal file
@@ -0,0 +1,424 @@
|
||||
[
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "1.1",
|
||||
"fullPath": "1.1",
|
||||
"generation": 7767,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/1.1?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 176,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:02",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "1000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "1.2",
|
||||
"fullPath": "1.2",
|
||||
"generation": 7770,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/1.2?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 192,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:03",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "1000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "1.3",
|
||||
"fullPath": "1.3",
|
||||
"generation": 7773,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/1.3?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 208,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:04",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "1000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "1.4",
|
||||
"fullPath": "1.4",
|
||||
"generation": 7776,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/1.4?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 224,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:05",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "1000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "2.1",
|
||||
"fullPath": "2.1",
|
||||
"generation": 7859,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/2.1?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 240,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:06",
|
||||
"mediaActive": "10000SR-FD",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "10000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"moduleDescription": "F5 compatible optics",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"serial": "ARP2LGU",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto",
|
||||
"vendor": "F5 NETWORKS INC.",
|
||||
"vendorOui": "009065",
|
||||
"vendorPartnum": "OPT-0016",
|
||||
"vendorRevision": "A0"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "2.2",
|
||||
"fullPath": "2.2",
|
||||
"generation": 7746,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/2.2?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 256,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:07",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "10000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "2.3",
|
||||
"fullPath": "2.3",
|
||||
"generation": 7749,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/2.3?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 272,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:08",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "10000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "2.4",
|
||||
"fullPath": "2.4",
|
||||
"generation": 7752,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/2.4?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 288,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:09",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "10000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "2.5",
|
||||
"fullPath": "2.5",
|
||||
"generation": 7755,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/2.5?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 304,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:0a",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "10000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "2.6",
|
||||
"fullPath": "2.6",
|
||||
"generation": 7758,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/2.6?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 320,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:0b",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "10000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "2.7",
|
||||
"fullPath": "2.7",
|
||||
"generation": 7761,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/2.7?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 336,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:0c",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "10000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "2.8",
|
||||
"fullPath": "2.8",
|
||||
"generation": 7764,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/2.8?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 352,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:0d",
|
||||
"mediaActive": "none",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "10000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 9198,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
},
|
||||
{
|
||||
"kind": "tm:net:interface:interfacestate",
|
||||
"name": "mgmt",
|
||||
"fullPath": "mgmt",
|
||||
"generation": 7651,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/interface/mgmt?ver=12.1.0",
|
||||
"bundle": "not-supported",
|
||||
"bundleSpeed": "not-supported",
|
||||
"enabled": true,
|
||||
"flowControl": "tx-rx",
|
||||
"forceGigabitFiber": "disabled",
|
||||
"forwardErrorCorrection": "not-supported",
|
||||
"ifIndex": 96,
|
||||
"lldpAdmin": "txonly",
|
||||
"lldpTlvmap": 130943,
|
||||
"macAddress": "00:23:e9:f1:e4:01",
|
||||
"mediaActive": "1000T-FD",
|
||||
"mediaFixed": "auto",
|
||||
"mediaMax": "1000T-FD",
|
||||
"mediaSfp": "auto",
|
||||
"mtu": 1500,
|
||||
"preferPort": "sfp",
|
||||
"qinqEthertype": "0x8100",
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes"
|
||||
},
|
||||
"stp": "enabled",
|
||||
"stpAutoEdgePort": "enabled",
|
||||
"stpEdgePort": "true",
|
||||
"stpLinkType": "auto"
|
||||
}
|
||||
]
|
||||
30
test/units/modules/network/f5/fixtures/load_vlan.json
Normal file
30
test/units/modules/network/f5/fixtures/load_vlan.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"kind": "tm:net:vlan:vlanstate",
|
||||
"name": "somevlan",
|
||||
"partition": "Common",
|
||||
"fullPath": "/Common/somevlan",
|
||||
"generation": 1,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/vlan/~Common~somevlan?ver=12.1.0",
|
||||
"autoLasthop": "default",
|
||||
"cmpHash": "default",
|
||||
"dagRoundRobin": "disabled",
|
||||
"dagTunnel": "outer",
|
||||
"failsafe": "disabled",
|
||||
"failsafeAction": "failover-restart-tm",
|
||||
"failsafeTimeout": 90,
|
||||
"ifIndex": 480,
|
||||
"learning": "enable-forward",
|
||||
"mtu": 1500,
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes",
|
||||
"samplingRate": 0,
|
||||
"samplingRateGlobal": "yes"
|
||||
},
|
||||
"sourceChecking": "disabled",
|
||||
"tag": 4094,
|
||||
"interfacesReference": {
|
||||
"link": "https://localhost/mgmt/tm/net/vlan/~Common~somevlan/interfaces?ver=12.1.0",
|
||||
"isSubcollection": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"kind": "tm:net:vlan:interfaces:interfacesstate",
|
||||
"name": "1.2",
|
||||
"fullPath": "1.2",
|
||||
"generation": 2,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/vlan/~Common~internal/interfaces/1.2?ver=12.1.0",
|
||||
"tagMode": "none",
|
||||
"tagged": true
|
||||
}
|
||||
|
||||
]
|
||||
@@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"kind": "tm:net:vlan:interfaces:interfacesstate",
|
||||
"name": "1.1",
|
||||
"fullPath": "1.1",
|
||||
"generation": 1,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/vlan/~Common~internal/interfaces/1.1?ver=12.1.0",
|
||||
"tagMode": "none",
|
||||
"untagged": true
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"kind": "tm:net:vlan:vlanstate",
|
||||
"name": "somevlan",
|
||||
"partition": "Common",
|
||||
"fullPath": "/Common/somevlan",
|
||||
"description": "changed_this",
|
||||
"generation": 1,
|
||||
"selfLink": "https://localhost/mgmt/tm/net/vlan/~Common~somevlan?ver=12.1.0",
|
||||
"autoLasthop": "default",
|
||||
"cmpHash": "default",
|
||||
"dagRoundRobin": "disabled",
|
||||
"dagTunnel": "outer",
|
||||
"failsafe": "disabled",
|
||||
"failsafeAction": "failover-restart-tm",
|
||||
"failsafeTimeout": 90,
|
||||
"ifIndex": 480,
|
||||
"learning": "enable-forward",
|
||||
"mtu": 1500,
|
||||
"sflow": {
|
||||
"pollInterval": 0,
|
||||
"pollIntervalGlobal": "yes",
|
||||
"samplingRate": 0,
|
||||
"samplingRateGlobal": "yes"
|
||||
},
|
||||
"sourceChecking": "disabled",
|
||||
"tag": 4094,
|
||||
"interfacesReference": {
|
||||
"link": "https://localhost/mgmt/tm/net/vlan/~Common~somevlan/interfaces?ver=12.1.0",
|
||||
"isSubcollection": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user