diff options
| author | Paul C. Buetow <paul@buetow.org> | 2014-04-13 14:15:19 +0200 |
|---|---|---|
| committer | Paul C. Buetow <paul@buetow.org> | 2014-04-13 14:15:19 +0200 |
| commit | 9ff58e8a7ca7970b419964ea11dc7bde9da5d76e (patch) | |
| tree | 3aeb0bcf92bade7cb2e20446108d7da9de93b9f2 | |
| parent | 1260910a3d6bb99217b25c943eac645ae5701c45 (diff) | |
implement get detail and get nat for vservers
| -rwxr-xr-x | src/fapi.py | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/src/fapi.py b/src/fapi.py index 51355cd..a63b10f 100755 --- a/src/fapi.py +++ b/src/fapi.py @@ -39,13 +39,11 @@ class Fapi(object): username = c.get('fapi', 'username') else: username = getpass.getuser() - if c.has_option('fapi', 'password64'): password = base64.decodestring(c.get('fapi', 'password64')) else: prompt = 'Enter API password for user %s: ' % username password = getpass.getpass(prompt) - self.info('Login to BigIP API with user %s' % username) hostname = c.get('fapi', 'hostname') @@ -76,13 +74,6 @@ class Fapi(object): pp.pprint(result) - #def __help(self, *possible): - # ''' Prints an online help ''' - - # print 'Possible sub commands are:' - # print ' '.join(possible) - - def lookup(self, what): ''' Does a DNS lookup to fetch the FQDN and all the IPs ''' @@ -230,6 +221,53 @@ class Fapi(object): a = self._args + if not a.name: + return lambda: f5().get_list() + + if a.arg == 'get': + if a.arg2 == 'detail': + def detail(f5): + d = {} + d['actual_hardware_acceleration'] = f5().get_actual_hardware_acceleration([a.name]) + d['auto_lasthop'] = f5().get_auto_lasthop([a.name]) + d['bw_controller_policy'] = f5().get_bw_controller_policy([a.name]) + d['clone_pool'] = f5().get_clone_pool([a.name]) + d['connection_limit'] = f5().get_connection_limit([a.name]) + d['description'] = f5().get_description([a.name]) + d['destination'] = f5().get_destination_v2([a.name]) + d['enabled_state'] = f5().get_enabled_state([a.name]) + d['fallback_persistence_profile'] = f5().get_fallback_persistence_profile([a.name]) + d['gtm_score'] = f5().get_gtm_score([a.name]) + d['last_hop_pool'] = f5().get_last_hop_pool([a.name]) + d['object_status'] = f5().get_object_status([a.name]) + d['persistence_profile'] = f5().get_persistence_profile([a.name]) + d['profile'] = f5().get_profile([a.name]) + d['protocol'] = f5().get_protocol([a.name]) + d['rule'] = f5().get_rule([a.name]) + d['translate_address_state'] = f5().get_translate_address_state([a.name]) + d['translate_port_state'] = f5().get_translate_port_state([a.name]) + d['type'] = f5().get_type([a.name]) + d['vlan'] = f5().get_vlan([a.name]) + return d + return lambda: detail(f5) + elif a.arg2 == 'nat': + def nat(f5): + d = {} + d['snat_pool'] = f5().get_snat_pool([a.name]) + d['snat_type'] = f5().get_snat_type([a.name]) + d['source_address'] = f5().get_source_address([a.name]) + d['source_address_translation_lsn_pool'] = f5().get_source_address_translation_lsn_pool([a.name]) + d['source_address_translation_snat_pool'] = f5().get_source_address_translation_snat_pool([a.name]) + d['source_address_translation_type'] = f5().get_source_address_translation_type([a.name]) + d['source_port_behavior'] = f5().get_source_port_behavior([a.name]) + d['translate_address_state'] = f5().get_translate_address_state([a.name]) + d['translate_port_state'] = f5().get_translate_port_state([a.name]) + return d + return lambda: nat(f5) + return lambda: f5().get_object_status([a.name]) + elif a.arg2 == 'status': + return lambda: f5().get_object_status([a.name]) + def run(self): ''' Do the actual stuff. |
