Skip to content

Commit 7afc0ff

Browse files
f5-rahmcaphrim007
authored andcommitted
Issue #1370 - Adding support for Failover Status (#1375)
- Added Endpoint -- f5/bigip/tm/cm/failover_status.py - Added Functional Test -- f5/bigip/tm/cm/test/functional/test_failover_status.py - Updated Init File -- f5/bigip/tm/cm/__init__.py
1 parent 6eb640a commit 7afc0ff

3 files changed

Lines changed: 76 additions & 2 deletions

File tree

f5/bigip/tm/cm/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from f5.bigip.resource import OrganizingCollection
3131
from f5.bigip.tm.cm.device import Devices
3232
from f5.bigip.tm.cm.device_group import Device_Groups
33+
from f5.bigip.tm.cm.failover_status import Failover_Status
3334
from f5.bigip.tm.cm.sync_status import Sync_Status
3435
from f5.bigip.tm.cm.traffic_group import Traffic_Groups
3536
from f5.bigip.tm.cm.trust import Add_To_Trust
@@ -42,7 +43,13 @@ class Cm(OrganizingCollection, CommandExecutionMixin):
4243
def __init__(self, cm):
4344
super(Cm, self).__init__(cm)
4445
self._meta_data['allowed_lazy_attributes'] = [
45-
Devices, Device_Groups, Traffic_Groups, Trust_Domains,
46-
Sync_Status, Add_To_Trust, Remove_From_Trust,
46+
Devices,
47+
Device_Groups,
48+
Traffic_Groups,
49+
Trust_Domains,
50+
Failover_Status,
51+
Sync_Status,
52+
Add_To_Trust,
53+
Remove_From_Trust,
4754
]
4855
self._meta_data['allowed_commands'].append('run')

f5/bigip/tm/cm/failover_status.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# coding=utf-8
2+
#
3+
# Copyright 2018 F5 Networks Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
"""Directory: cm module: failover-status.
19+
20+
REST URI
21+
``https://localhost/mgmt/tm/cm/failover-status``
22+
23+
GUI Path
24+
``XXX``
25+
26+
REST Kind
27+
``tm:cm:failover-status:*``
28+
"""
29+
30+
from f5.bigip.resource import UnnamedResource
31+
32+
33+
class Failover_Status(UnnamedResource):
34+
"""BIG-IP® cluster resource"""
35+
def __init__(self, cm):
36+
super(Failover_Status, self).__init__(cm)
37+
self._meta_data['required_json_kind'] =\
38+
"tm:cm:failover-status:failover-statusstats"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2016 F5 Networks Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
17+
class TestFailoverStatus(object):
18+
def test_get_status(self, request, mgmt_root):
19+
failover_status = mgmt_root.tm.cm.failover_status
20+
assert failover_status._meta_data['uri'].endswith(
21+
"/mgmt/tm/cm/failover-status/")
22+
failover_status.refresh()
23+
des =\
24+
(failover_status.entries['https://localhost/mgmt/tm/cm/failover-status/0']
25+
['nestedStats']
26+
['entries']
27+
['status']
28+
['description'])
29+
assert des == "ACTIVE"

0 commit comments

Comments
 (0)