File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929
3030from f5 .bigip .resource import OrganizingCollection
3131from f5 .bigip .tm .sys .application import Application
32+ from f5 .bigip .tm .sys .clock import Clock
3233from f5 .bigip .tm .sys .config import Config
3334from f5 .bigip .tm .sys .crypto import Crypto
3435from f5 .bigip .tm .sys .daemon_log_settings import Daemon_Log_Settings
@@ -62,6 +63,7 @@ def __init__(self, tm):
6263 super (Sys , self ).__init__ (tm )
6364 self ._meta_data ['allowed_lazy_attributes' ] = [
6465 Application ,
66+ Clock ,
6567 Config ,
6668 Crypto ,
6769 Daemon_Log_Settings ,
Original file line number Diff line number Diff line change 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+ """BIG-IP® system clock module
19+
20+ REST URI
21+ ``https://localhost/mgmt/tm/sys/clock``
22+
23+ GUI Path
24+ ``N/A``
25+
26+ REST Kind
27+ ``tm:sys:clock:*``
28+ """
29+
30+ from f5 .bigip .resource import UnnamedResource
31+
32+
33+ class Clock (UnnamedResource ):
34+ """BIG-IP® license unnamed resource"""
35+ def __init__ (self , sys ):
36+ super (Clock , self ).__init__ (sys )
37+ self ._meta_data ['required_json_kind' ] = \
38+ "tm:sys:clock:clockstats"
Original file line number Diff line number Diff line change 1+ # Copyright 2018 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+ from datetime import datetime
16+ from f5 .utils .responses .handlers import Stats
17+
18+
19+ def test_clock_load (request , mgmt_root ):
20+ # Load
21+ bigipclock = str (Stats (mgmt_root .tm .sys .clock .load ()).stat .fullDate ['description' ])
22+ bigipdate = bigipclock .split ("T" )[0 ]
23+
24+ assert bigipdate == datetime .strptime (bigipdate , "%Y-%m-%d" ).strftime ('%Y-%m-%d' )
Original file line number Diff line number Diff line change 1+ # Copyright 2018 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+ import mock
18+ import pytest
19+
20+ from f5 .bigip .tm .sys import Clock
21+ from f5 .sdk_exception import UnsupportedMethod
22+
23+
24+ @pytest .fixture
25+ def FakeClock ():
26+ fake_sys = mock .MagicMock ()
27+ return Clock (fake_sys )
28+
29+
30+ def test_create_raises (FakeClock ):
31+ with pytest .raises (UnsupportedMethod ) as EIO :
32+ FakeClock .create ()
33+ assert str (EIO .value ) == "Clock does not support the create method"
34+
35+
36+ def test_delete_raises (FakeClock ):
37+ with pytest .raises (UnsupportedMethod ) as EIO :
38+ FakeClock .delete ()
39+ assert str (EIO .value ) == "Clock does not support the delete method"
You can’t perform that action at this time.
0 commit comments