|
| 1 | +# coding=utf-8 |
| 2 | +# |
| 3 | +# Copyright 2014-2016 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® SNMP submodule. |
| 19 | +
|
| 20 | +REST URI |
| 21 | + ``http://localhost/mgmt/tm/sys/snmp/`` |
| 22 | +
|
| 23 | +GUI Path |
| 24 | + ``System --> SNMP`` |
| 25 | +
|
| 26 | +REST Kind |
| 27 | + ``tm:snmp:*`` |
| 28 | +""" |
| 29 | + |
| 30 | +from f5.bigip.resource import Collection |
| 31 | +from f5.bigip.resource import Resource |
| 32 | +from f5.bigip.resource import UnnamedResource |
| 33 | + |
| 34 | + |
| 35 | +class Snmp(UnnamedResource): |
| 36 | + def __init__(self, sys): |
| 37 | + super(Snmp, self).__init__(sys) |
| 38 | + self._meta_data['required_load_parameters'] = set() |
| 39 | + self._meta_data['required_json_kind'] = 'tm:sys:snmp:snmpstate' |
| 40 | + self._meta_data['allowed_lazy_attributes'] = [ |
| 41 | + Communities_s, |
| 42 | + Traps_s, |
| 43 | + Users_s |
| 44 | + ] |
| 45 | + self._meta_data['attribute_registry'] = { |
| 46 | + 'tm:sys:snmp:communities:communitiescollectionstate': |
| 47 | + Communities_s, |
| 48 | + 'tm:sys:snmp:traps:trapscollectionstate': Traps_s, |
| 49 | + 'tm:sys:snmp:users:userscollectionstate': Users_s |
| 50 | + } |
| 51 | + |
| 52 | + |
| 53 | +class Communities_s(Collection): |
| 54 | + """BIG-IP® SNMP Communities collection.""" |
| 55 | + def __init__(self, snmp): |
| 56 | + super(Communities_s, self).__init__(snmp) |
| 57 | + self._meta_data['required_json_kind'] = \ |
| 58 | + 'tm:sys:snmp:communities:communitiescollectionstate' |
| 59 | + self._meta_data['allowed_lazy_attributes'] = [Community] |
| 60 | + self._meta_data['attribute_registry'] = \ |
| 61 | + {'tm:sys:snmp:communities:communitiesstate': Community} |
| 62 | + |
| 63 | + |
| 64 | +class Community(Resource): |
| 65 | + """BIG-IP® SNMP Community resource.""" |
| 66 | + def __init__(self, communities_s): |
| 67 | + super(Community, self).__init__(communities_s) |
| 68 | + self._meta_data['required_json_kind'] = \ |
| 69 | + 'tm:sys:snmp:communities:communitiesstate' |
| 70 | + self._meta_data['required_creation_parameters']\ |
| 71 | + .update(('communityName',)) |
| 72 | + |
| 73 | + |
| 74 | +class Traps_s(Collection): |
| 75 | + """BIG-IP® SNMP Traps collection.""" |
| 76 | + def __init__(self, snmp): |
| 77 | + super(Traps_s, self).__init__(snmp) |
| 78 | + self._meta_data['required_json_kind'] = \ |
| 79 | + 'tm:sys:snmp:traps:trapscollectionstate' |
| 80 | + self._meta_data['allowed_lazy_attributes'] = [Trap] |
| 81 | + self._meta_data['attribute_registry'] = \ |
| 82 | + {'tm:sys:snmp:traps:trapsstate': Trap} |
| 83 | + |
| 84 | + |
| 85 | +class Trap(Resource): |
| 86 | + """BIG-IP® SNMP Trap resource.""" |
| 87 | + def __init__(self, traps_s): |
| 88 | + super(Trap, self).__init__(traps_s) |
| 89 | + self._meta_data['required_json_kind'] = \ |
| 90 | + 'tm:sys:snmp:traps:trapsstate' |
| 91 | + |
| 92 | + |
| 93 | +class Users_s(Collection): |
| 94 | + """BIG-IP® SNMP Users collection.""" |
| 95 | + def __init__(self, snmp): |
| 96 | + super(Users_s, self).__init__(snmp) |
| 97 | + self._meta_data['required_json_kind'] = \ |
| 98 | + 'tm:sys:snmp:users:userscollectionstate' |
| 99 | + self._meta_data['allowed_lazy_attributes'] = [User] |
| 100 | + self._meta_data['attribute_registry'] = \ |
| 101 | + {'tm:sys:snmp:users:usersstate': User} |
| 102 | + |
| 103 | + |
| 104 | +class User(Resource): |
| 105 | + """BIG-IP® SNMP User resource.""" |
| 106 | + def __init__(self, users_s): |
| 107 | + super(User, self).__init__(users_s) |
| 108 | + self._meta_data['required_json_kind'] = \ |
| 109 | + 'tm:sys:snmp:users:usersstate' |
| 110 | + self._meta_data['required_creation_parameters'] \ |
| 111 | + .update(('authProtocol',)) |
0 commit comments