Exemplo n.º 1
0
 def upload_config(self, amp, loadbalancer_id, config, timeout_dict=None):
     r = self.put(
         amp,
         'loadbalancer/{amphora_id}/{loadbalancer_id}/haproxy'.format(
             amphora_id=amp.id, loadbalancer_id=loadbalancer_id),
         timeout_dict, data=config)
     return exc.check_exception(r)
Exemplo n.º 2
0
 def get_listener_status(self, amp, listener_id):
     r = self.get(
         amp,
         'listeners/{listener_id}'.format(listener_id=listener_id))
     if exc.check_exception(r):
         return r.json()
     return None
Exemplo n.º 3
0
 def upload_udp_config(self, amp, listener_id, config, timeout_dict=None):
     r = self.put(
         amp,
         'listeners/{amphora_id}/{listener_id}/udp_listener'.format(
             amphora_id=amp.id, listener_id=listener_id), timeout_dict,
         data=config)
     return exc.check_exception(r)
Exemplo n.º 4
0
 def get_cert_md5sum(self, amp, listener_id, pem_filename, ignore=tuple()):
     r = self.get(
         amp, 'listeners/{listener_id}/certificates/{filename}'.format(
             listener_id=listener_id, filename=pem_filename))
     if exc.check_exception(r, ignore):
         return r.json().get("md5sum")
     return None
Exemplo n.º 5
0
 def upload_cert_pem(self, amp, listener_id, pem_filename, pem_file):
     r = self.put(
         amp,
         'listeners/{listener_id}/certificates/{filename}'.format(
             listener_id=listener_id, filename=pem_filename),
         data=pem_file)
     return exc.check_exception(r)
Exemplo n.º 6
0
 def get_listener_status(self, amp, listener_id):
     r = self.get(
         amp,
         'listeners/{listener_id}'.format(listener_id=listener_id))
     if exc.check_exception(r):
         return r.json()
     return None
Exemplo n.º 7
0
 def upload_udp_config(self, amp, listener_id, config, timeout_dict=None):
     r = self.put(
         amp,
         'listeners/{amphora_id}/{listener_id}/udp_listener'.format(
             amphora_id=amp.id, listener_id=listener_id), timeout_dict,
         data=config)
     return exc.check_exception(r)
Exemplo n.º 8
0
 def get_interface(self, amp, ip_addr, timeout_dict=None):
     r = self.get(amp,
                  'interface/{ip_addr}'.format(ip_addr=ip_addr),
                  timeout_dict=timeout_dict)
     if exc.check_exception(r):
         return r.json()
     return None
Exemplo n.º 9
0
 def upload_config(self, amp, listener_id, config):
     r = self.put(
         amp,
         'listeners/{amphora_id}/{listener_id}/haproxy'.format(
             amphora_id=amp.id, listener_id=listener_id),
         data=config)
     return exc.check_exception(r)
Exemplo n.º 10
0
 def upload_cert_pem(self, amp, listener_id, pem_filename, pem_file):
     r = self.put(
         amp,
         'listeners/{listener_id}/certificates/{filename}'.format(
             listener_id=listener_id, filename=pem_filename),
         data=pem_file)
     return exc.check_exception(r)
Exemplo n.º 11
0
 def upload_config(self, amp, listener_id, config):
     r = self.put(
         amp,
         'listeners/{amphora_id}/{listener_id}/haproxy'.format(
             amphora_id=amp.id, listener_id=listener_id),
         data=config)
     return exc.check_exception(r)
Exemplo n.º 12
0
 def get_cert_md5sum(self, amp, listener_id, pem_filename, ignore=tuple()):
     r = self.get(
         amp, 'listeners/{listener_id}/certificates/{filename}'.format(
             listener_id=listener_id, filename=pem_filename))
     if exc.check_exception(r, ignore):
         return r.json().get("md5sum")
     return None
Exemplo n.º 13
0
 def delete_cert_pem(self, amp, listener_id, pem_filename):
     r = self.delete(
         amp,
         'listeners/{listener_id}/certificates/{filename}'.format(
             listener_id=listener_id, filename=pem_filename))
     return exc.check_exception(r)
Exemplo n.º 14
0
 def get_details(self, amp):
     r = self.get(amp, "details")
     if exc.check_exception(r):
         return r.json()
Exemplo n.º 15
0
 def delete_listener(self, amp, listener_id):
     r = self.delete(
         amp, 'listeners/{listener_id}'.format(listener_id=listener_id))
     return exc.check_exception(r)
Exemplo n.º 16
0
 def _vrrp_action(self, action, amp):
     r = self.put(amp, 'vrrp/{action}'.format(action=action))
     return exc.check_exception(r)
Exemplo n.º 17
0
 def plug_vip(self, amp, vip, net_info):
     r = self.post(amp, 'plug/vip/{vip}'.format(vip=vip), json=net_info)
     return exc.check_exception(r)
Exemplo n.º 18
0
 def get_all_listeners(self, amp):
     r = self.get(amp, "listeners")
     if exc.check_exception(r):
         return r.json()
     return None
Exemplo n.º 19
0
 def get_info(self, amp):
     r = self.get(amp, "info")
     if exc.check_exception(r):
         return r.json()
     return None
Exemplo n.º 20
0
 def plug_vip(self, amp, vip, net_info):
     r = self.post(amp,
                   'plug/vip/{vip}'.format(vip=vip),
                   json=net_info)
     return exc.check_exception(r)
Exemplo n.º 21
0
 def get_interface(self, amp, ip_addr, timeout_dict=None):
     r = self.get(amp, 'interface/{ip_addr}'.format(ip_addr=ip_addr),
                  timeout_dict=timeout_dict)
     if exc.check_exception(r):
         return r.json()
     return None
Exemplo n.º 22
0
 def _action(self, action, amp, listener_id, timeout_dict=None):
     r = self.put(amp, 'listeners/{listener_id}/{action}'.format(
         listener_id=listener_id, action=action), timeout_dict=timeout_dict)
     return exc.check_exception(r)
Exemplo n.º 23
0
 def _vrrp_action(self, action, amp):
     r = self.put(amp, 'vrrp/{action}'.format(action=action))
     return exc.check_exception(r)
Exemplo n.º 24
0
 def update_agent_config(self, amp, agent_config, timeout_dict=None):
     r = self.put(amp, 'config', timeout_dict, data=agent_config)
     return exc.check_exception(r)
Exemplo n.º 25
0
 def delete_listener(self, amp, object_id):
     r = self.delete(amp,
                     'listeners/{object_id}'.format(object_id=object_id))
     return exc.check_exception(r, (404, ))
Exemplo n.º 26
0
 def register_to_distributor(self, amp):
     r = self.put(amp, 'bgp/register_amphora')
     return exc.check_exception(r)
Exemplo n.º 27
0
 def get_details(self, amp):
     r = self.get(amp, "details")
     if exc.check_exception(r):
         return r.json()
     return None
Exemplo n.º 28
0
 def _vrrp_action(self, action, amp, timeout_dict=None):
     r = self.put(amp,
                  'vrrp/{action}'.format(action=action),
                  timeout_dict=timeout_dict)
     return exc.check_exception(r)
Exemplo n.º 29
0
 def plug_network(self, amp, port):
     r = self.post(amp, 'plug/network', json=port)
     return exc.check_exception(r)
Exemplo n.º 30
0
 def get_interface(self, amp, ip_addr, timeout_dict=None, log_error=True):
     r = self.get(amp,
                  'interface/{ip_addr}'.format(ip_addr=ip_addr),
                  timeout_dict=timeout_dict)
     return exc.check_exception(r, log_error=log_error).json()
Exemplo n.º 31
0
 def upload_vrrp_config(self, amp, config):
     r = self.put(amp, 'vrrp/upload', data=config)
     return exc.check_exception(r)
Exemplo n.º 32
0
 def get_info(self, amp, raise_retry_exception=False):
     r = self.get(amp, "info", raise_retry_exception=raise_retry_exception)
     if exc.check_exception(r):
         return r.json()
     return None
Exemplo n.º 33
0
 def update_agent_config(self, amp, agent_config, timeout_dict=None):
     r = self.put(amp, 'config', timeout_dict, data=agent_config)
     return exc.check_exception(r)
Exemplo n.º 34
0
 def delete_cert_pem(self, amp, listener_id, pem_filename):
     r = self.delete(
         amp, 'listeners/{listener_id}/certificates/{filename}'.format(
             listener_id=listener_id, filename=pem_filename))
     return exc.check_exception(r)
Exemplo n.º 35
0
 def _action(self, action, amp, listener_id):
     r = self.put(amp, 'listeners/{listener_id}/{action}'.format(
         listener_id=listener_id, action=action))
     return exc.check_exception(r)
Exemplo n.º 36
0
 def _action(self, action, amp, listener_id):
     r = self.put(
         amp,
         'listeners/{listener_id}/{action}'.format(listener_id=listener_id,
                                                   action=action))
     return exc.check_exception(r)
Exemplo n.º 37
0
 def update_cert_for_rotation(self, amp, pem_file):
     r = self.put(amp, 'certificate', data=pem_file)
     return exc.check_exception(r)
Exemplo n.º 38
0
 def get_interface(self, amp, ip_addr):
     r = self.get(amp, 'interface/{ip_addr}'.format(ip_addr=ip_addr))
     if exc.check_exception(r):
         return r.json()
Exemplo n.º 39
0
 def get_info(self, amp):
     r = self.get(amp, "info")
     if exc.check_exception(r):
         return r.json()
Exemplo n.º 40
0
 def _action(self, action, amp, listener_id, timeout_dict=None):
     r = self.put(amp,
                  'listeners/{listener_id}/{action}'.format(
                      listener_id=listener_id, action=action),
                  timeout_dict=timeout_dict)
     return exc.check_exception(r)
Exemplo n.º 41
0
 def get_all_listeners(self, amp):
     r = self.get(amp, "listeners")
     if exc.check_exception(r):
         return r.json()
Exemplo n.º 42
0
 def delete_listener(self, amp, listener_id):
     r = self.delete(
         amp, 'listeners/{listener_id}'.format(listener_id=listener_id))
     return exc.check_exception(r, (404, ))
Exemplo n.º 43
0
 def plug_network(self, amp, port):
     r = self.post(amp, 'plug/network',
                   json=port)
     return exc.check_exception(r)
Exemplo n.º 44
0
 def _action(self, action, amp, object_id, timeout_dict=None):
     r = self.put(amp,
                  'loadbalancer/{object_id}/{action}'.format(
                      object_id=object_id, action=action),
                  timeout_dict=timeout_dict)
     return exc.check_exception(r)
Exemplo n.º 45
0
 def upload_vrrp_config(self, amp, config):
     r = self.put(amp, 'vrrp/upload', data=config)
     return exc.check_exception(r)
Exemplo n.º 46
0
 def delete_cert_pem(self, amp, loadbalancer_id, pem_filename):
     r = self.delete(
         amp,
         'loadbalancer/{loadbalancer_id}/certificates/{filename}'.format(
             loadbalancer_id=loadbalancer_id, filename=pem_filename))
     return exc.check_exception(r, (404, ))
Exemplo n.º 47
0
 def get_interface(self, amp, ip_addr):
     r = self.get(amp, 'interface/{ip_addr}'.format(ip_addr=ip_addr))
     if exc.check_exception(r):
         return r.json()
Exemplo n.º 48
0
 def update_cert_for_rotation(self, amp, pem_file):
     r = self.put(amp, 'certificate', data=pem_file)
     return exc.check_exception(r)