Esempio n. 1
0
 def loadbalancer_get(self,
                      name_or_id,
                      ignore_missing=True,
                      show_deleted=False):
     if name_or_id in (self.fake_lb["id"], self.fake_lb["name"]):
         return sdk.FakeResourceObject(self.fake_lb)
     return None
Esempio n. 2
0
 def pool_member_create(self, pool_id, address, protocol_port, subnet_id,
                        weight=None, admin_state_up=True):
     # pool_id is ignored
     self.fake_member["address"] = address
     self.fake_member["protocol_port"] = protocol_port
     self.fake_member["subnet_id"] = subnet_id
     self.fake_member["admin_state_up"] = admin_state_up
     if weight:
         self.fake_member["weight"] = weight
     return sdk.FakeResourceObject(self.fake_member)
Esempio n. 3
0
 def pool_create(self, lb_algorithm, listener_id, protocol,
                 admin_state_up=True, name=None, description=None):
     self.fake_pool["lb_algorithm"] = lb_algorithm
     self.fake_pool["listeners"] = [{"id": listener_id}]
     self.fake_pool["protocol"] = protocol
     self.fake_pool["admin_state_up"] = admin_state_up
     if name:
         self.fake_pool["name"] = name
     if description:
         self.fake_pool["description"] = description
     return sdk.FakeResourceObject(self.fake_pool)
Esempio n. 4
0
 def loadbalancer_create(self, vip_subnet_id, vip_address=None,
                         admin_state_up=True, name=None, description=None):
     self.fake_lb["vip_subnet_id"] = vip_subnet_id
     self.fake_lb["admin_state_up"] = admin_state_up
     if vip_address:
         self.fake_lb["vip_address"] = vip_address
     if name:
         self.fake_lb["name"] = name
     if description:
         self.fake_lb["description"] = description
     return sdk.FakeResourceObject(self.fake_lb)
Esempio n. 5
0
    def server_create(self, **attrs):
        server_id = uuidutils.generate_uuid()
        self.fake_server_create['id'] = server_id
        self.fake_server_get['id'] = server_id

        # save simulated wait time if it was set in metadata
        if ('metadata' in attrs
                and 'simulated_wait_time' in attrs['metadata']):
            simulated_wait = attrs['metadata']['simulated_wait_time']
            if (isinstance(simulated_wait, int) and simulated_wait > 0):
                self.simulated_waits[server_id] = simulated_wait

        return sdk.FakeResourceObject(self.fake_server_create)
Esempio n. 6
0
    def server_rebuild(self,
                       server,
                       imageref,
                       name=None,
                       admin_password=None,
                       **attrs):
        if imageref:
            attrs['image'] = {'id': imageref}
        if name:
            attrs['name'] = name
        if admin_password:
            attrs['adminPass'] = admin_password
        self.fake_server_get.update(attrs)

        return sdk.FakeResourceObject(self.fake_server_get)
Esempio n. 7
0
    def listener_create(self, loadbalancer_id, protocol, protocol_port,
                        connection_limit=None, admin_state_up=True,
                        name=None, description=None):
        self.fake_listener["loadbalancers"] = [{"id": loadbalancer_id}]
        self.fake_listener["protocol"] = protocol
        self.fake_listener["protocol_port"] = protocol_port
        self.fake_listener["admin_state_up"] = admin_state_up
        if connection_limit:
            self.fake_listener["connection_limit"] = connection_limit
        if name:
            self.fake_listener["name"] = name
        if description:
            self.fake_listener["description"] = description

        return sdk.FakeResourceObject(self.fake_listener)
Esempio n. 8
0
    def healthmonitor_create(self, hm_type, delay, timeout, max_retries,
                             pool_id, admin_state_up=True, http_method=None,
                             url_path=None, expected_codes=None):
        self.fake_hm["type"] = hm_type
        self.fake_hm["delay"] = delay
        self.fake_hm["timeout"] = timeout
        self.fake_hm["max_retries"] = max_retries
        self.fake_hm["pools"] = [{"id": pool_id}]
        self.fake_hm["admin_state_up"] = admin_state_up
        if http_method:
            self.fake_hm["http_method"] = http_method
        if url_path:
            self.fake_hm["url_path"] = url_path
        if expected_codes:
            self.fake_hm["expected_codes"] = expected_codes

        return sdk.FakeResourceObject(self.fake_hm)
Esempio n. 9
0
 def service_list(self):
     return sdk.FakeResourceObject(self.fake_service_list)
Esempio n. 10
0
 def stack_create(self, **params):
     return sdk.FakeResourceObject(self.fake_stack_create)
Esempio n. 11
0
 def server_metadata_update(self, server, metadata):
     new_server = copy.deepcopy(self.fake_server_get)
     new_server['metadata'] = metadata
     server = sdk.FakeResourceObject(new_server)
     return server
Esempio n. 12
0
 def stack_update(self, stack_id, **params):
     self.fake_stack_get["status"] = "UPDATE_COMPLETE"
     return sdk.FakeResourceObject(self.fake_stack_get)
Esempio n. 13
0
 def server_update(self, server, **attrs):
     self.fake_server_get.update(attrs)
     return sdk.FakeResourceObject(self.fake_server_get)
Esempio n. 14
0
 def port_create(self, **attr):
     return sdk.FakeResourceObject(self.fake_port)
Esempio n. 15
0
 def server_create(self, **attrs):
     self.fake_server_create['id'] = uuidutils.generate_uuid()
     self.fake_server_get['id'] = self.fake_server_create['id']
     return sdk.FakeResourceObject(self.fake_server_create)
Esempio n. 16
0
 def message_post(self, queue_name, message):
     return sdk.FakeResourceObject(self.fake_message)
Esempio n. 17
0
 def keypair_list(self, details=True, **query):
     return [sdk.FakeResourceObject(self.fake_keypair)]
Esempio n. 18
0
 def flavor_list(self, details=True, **query):
     return [sdk.FakeResourceObject(self.fake_flavor)]
Esempio n. 19
0
 def image_find(self, name_or_id, ignore_missing=False):
     return sdk.FakeResourceObject(self.fake_image)
Esempio n. 20
0
 def execution_create(self, name, inputs):
     return sdk.FakeResourceObject(self.fake_execution)
Esempio n. 21
0
 def workflow_find(self, name_or_id, ignore_missing=True):
     return sdk.FakeResourceObject(self.fake_workflow)
Esempio n. 22
0
 def workflow_create(self, definition, scope):
     return sdk.FakeResourceObject(self.fake_workflow)
Esempio n. 23
0
 def availability_zone_list(self, **query):
     return [sdk.FakeResourceObject(self.availability_zone)]
Esempio n. 24
0
 def keypair_find(self, name_or_id, ignore_missing=False):
     return sdk.FakeResourceObject(self.keypair)
Esempio n. 25
0
 def subnet_get(self, name_or_id, ignore_missing=False):
     return sdk.FakeResourceObject(self.fake_subnet)
Esempio n. 26
0
 def stack_get(self, stack_id):
     return sdk.FakeResourceObject(self.fake_stack_get)
Esempio n. 27
0
 def network_get(self, value, ignore_missing=False):
     return sdk.FakeResourceObject(self.fake_network)
Esempio n. 28
0
 def server_get(self, server):
     return sdk.FakeResourceObject(self.fake_server_get)
Esempio n. 29
0
 def image_list(self, details=True, **query):
     return [sdk.FakeResourceObject(self.fake_image)]
Esempio n. 30
0
 def stack_find(self, name_or_id):
     return sdk.FakeResourceObject(self.fake_stack_get)