<s> """<STR_LIT>""" <EOL> from openstack_dashboard . api import base <EOL> from openstack_dashboard . api import neutron <EOL> from openstack_dashboard . api import nova <EOL> class NetworkClient ( object ) : <EOL> def __init__ ( self , request ) : <EOL> neutron_enabled = base . is_service_enabled ( request , '<STR_LIT>' ) <EOL> if neutron_enabled : <EOL> self . floating_ips = neutron . FloatingIpManager ( request ) <EOL> else : <EOL> self . floating_ips = nova . FloatingIpManager ( request ) <EOL> if ( neutron_enabled and <EOL> neutron . is_extension_supported ( request , '<STR_LIT>' ) ) : <EOL> self . secgroups = neutron . SecurityGroupManager ( request ) <EOL> else : <EOL> self . secgroups = nova . SecurityGroupManager ( request ) <EOL> def floating_ip_pools_list ( request ) : <EOL> return NetworkClient ( request ) . floating_ips . list_pools ( ) <EOL> def tenant_floating_ip_list ( request ) : <EOL> return NetworkClient ( request ) . floating_ips . list ( ) <EOL> def tenant_floating_ip_get ( request , floating_ip_id ) : <EOL> return NetworkClient ( request ) . floating_ips . get ( floating_ip_id ) <EOL> def tenant_floating_ip_allocate ( request , pool = None ) : <EOL> return NetworkClient ( request ) . floating_ips . allocate ( pool ) <EOL> def tenant_floating_ip_release ( request , floating_ip_id ) : <EOL> return NetworkClient ( request ) . floating_ips . release ( floating_ip_id ) <EOL> def floating_ip_associate ( request , floating_ip_id , port_id ) : <EOL> return NetworkClient ( request ) . floating_ips . associate ( floating_ip_id , <EOL> port_id ) <EOL> def floating_ip_disassociate ( request , floating_ip_id ) : <EOL> return NetworkClient ( request ) . floating_ips . disassociate ( floating_ip_id ) <EOL> def floating_ip_target_list ( request ) : <EOL> return NetworkClient ( request ) . floating_ips . list_targets ( ) <EOL> def floating_ip_target_get_by_instance ( request , instance_id , cache = None ) : <EOL> return NetworkClient ( request ) . floating_ips . get_target_id_by_instance ( <EOL> instance_id , cache ) <EOL> def floating_ip_target_list_by_instance ( request , instance_id , cache = None ) : <EOL> floating_ips = NetworkClient ( request ) . floating_ips <EOL> return floating_ips . list_target_id_by_instance ( instance_id , cache ) <EOL> def floating_ip_simple_associate_supported ( request ) : <EOL> return NetworkClient ( request ) . floating_ips . is_simple_associate_supported ( ) <EOL> def floating_ip_supported ( request ) : <EOL> return NetworkClient ( request ) . floating_ips . is_supported ( ) <EOL> def security_group_list ( request ) : <EOL> return NetworkClient ( request ) . secgroups . list ( ) <EOL> def security_group_get ( request , sg_id ) : <EOL> return NetworkClient ( request ) . secgroups . get ( sg_id ) <EOL> def security_group_create ( request , name , desc ) : <EOL> return NetworkClient ( request ) . secgroups . create ( name , desc ) <EOL> def security_group_delete ( request , sg_id ) : <EOL> return NetworkClient ( request ) . secgroups . delete ( sg_id ) <EOL> def security_group_update ( request , sg_id , name , desc ) : <EOL> return NetworkClient ( request ) . secgroups . update ( sg_id , name , desc ) <EOL> def security_group_rule_create ( request , parent_group_id , <EOL> direction , ethertype , <EOL> ip_protocol , from_port , to_port , <EOL> cidr , group_id ) : <EOL> return NetworkClient ( request ) . secgroups . rule_create ( <EOL> parent_group_id , direction , ethertype , ip_protocol , <EOL> from_port , to_port , cidr , group_id ) <EOL> def security_group_rule_delete ( request , sgr_id ) : <EOL> return NetworkClient ( request ) . secgroups . rule_delete ( sgr_id ) <EOL> def server_security_groups ( request , instance_id ) : <EOL> return NetworkClient ( request ) . secgroups . list_by_instance ( instance_id ) <EOL> def server_update_security_groups ( request , instance_id , <EOL> new_security_group_ids ) : <EOL> return NetworkClient ( request ) . secgroups . update_instance_security_group ( <EOL> instance_id , new_security_group_ids ) <EOL> def security_group_backend ( request ) : <EOL> return NetworkClient ( request ) . secgroups . backend <EOL> def servers_update_addresses ( request , servers , all_tenants = False ) : <EOL> """<STR_LIT>""" <EOL> neutron_enabled = base . is_service_enabled ( request , '<STR_LIT>' ) <EOL> if neutron_enabled : <EOL> neutron . servers_update_addresses ( request , servers , all_tenants ) </s>
