Skip to content

Commit 850e308

Browse files
author
Zachery Lantz
committed
tunnel summary support
1 parent beef738 commit 850e308

File tree

5 files changed

+67
-0
lines changed

5 files changed

+67
-0
lines changed

fmcapi/api_objects/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
from .object_services import TimeRanges
113113
from .health import TunnelStatuses
114114
from .health import TunnelDetails
115+
from .health import TunnelSummaries
115116

116117
logging.debug("In the api_objects __init__.py file.")
117118

@@ -222,4 +223,5 @@
222223
"TimeRanges",
223224
"TunnelStatuses",
224225
"TunnelDetails",
226+
"TunnelSummaries",
225227
]

fmcapi/api_objects/health/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from .terminateravpnsessions import TerminateRAVPNSessions
55
from .tunnelstatuses import TunnelStatuses
66
from .tunneldetails import TunnelDetails
7+
from .tunnelsummaries import TunnelSummaries
78

89
logging.debug("In the health __init__.py file.")
910

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
2+
import logging
3+
4+
5+
class TunnelSummaries(APIClassTemplate):
6+
"""The TunnelSummaries Object in the FMC."""
7+
8+
FIRST_SUPPORTED_FMC_VERSION = "7.3"
9+
VALID_JSON_DATA = [
10+
"tunnelCount",
11+
"tunnelUpCount",
12+
"tunnelDownCount",
13+
"tunnelUnknownCount",
14+
"type",
15+
]
16+
VALID_GET_FILTERS = [
17+
"vpnTopologyId", # vpnTopologyId: uuid of vpn topo
18+
"deviceId", # deviceId: uuid of device
19+
"groupBy", # Topology|Device
20+
]
21+
VALID_FOR_KWARGS = VALID_JSON_DATA + VALID_GET_FILTERS + []
22+
23+
URL_SUFFIX = "/health/tunnelsummaries"
24+
25+
def __init__(self, fmc, **kwargs):
26+
"""
27+
Initialize TunnelSummaries object.
28+
29+
:param fmc (object): FMC object
30+
:param **kwargs: Any other values passed during instantiation.
31+
:return: requests response
32+
"""
33+
super().__init__(fmc, **kwargs)
34+
logging.debug("In __init__() for TunnelSummaries class.")
35+
self.parse_kwargs(**kwargs)
36+
37+
def delete(self, **kwargs):
38+
"""DELETE method for API for TunnelSummaries not supported."""
39+
logging.info("DELETE method for API for TunnelSummaries not supported.")
40+
pass
41+
42+
def put(self):
43+
"""PUT method for API for TunnelSummaries not supported."""
44+
logging.info("PUT method for API for TunnelSummaries not supported.")
45+
pass
46+
47+
def post(self, **kwargs):
48+
"""POST method for API for TunnelSummaries not supported."""
49+
logging.info("POST method for API for TunnelSummaries not supported.")
50+
pass

unit_tests/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
from .fqdns import test__fqdns
8282
from .tunnelstatuses import test__tunnelstatuses
8383
from .tunneldetails import test__tunneldetails
84+
from .tunnelsummaries import test__tunnelsummaries
8485

8586
logging.debug("In the unit-tests __init__.py file.")
8687

@@ -166,4 +167,5 @@
166167
"test__fqdns",
167168
"test__tunnelstatuses",
168169
"test__tunneldetails",
170+
"test__tunnelsummaries",
169171
]

unit_tests/tunnelsummaries.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import logging
2+
import fmcapi
3+
4+
5+
def test__tunnelsummaries(fmc):
6+
logging.info("Test TunnelSummaries. Get TunnelSummaries.")
7+
8+
obj1 = fmcapi.TunnelSummaries(fmc=fmc)
9+
tunnel_summaries = obj1.get()
10+
del obj1
11+
12+
logging.info("Test TunnelSummaries done.\n")

0 commit comments

Comments
 (0)