def delete_instance(self, instance_name):
        url = "%s/%s/%s/%s/%s/%s" % (self.paasmanager_url, "envInst/org/FIWARE",
                                     "vdc", self.vdc, "environmentInstance", instance_name)
        headers = {'X-Auth-Token': self.token, 'Tenant-Id': self.vdc,
                   'Content-Type': "application/xml", 'Accept': "application/json"}
        world.response = http.delete(url, headers)

        """Remove it from the world too"""
        try:
            world.instances.remove(instance_name)
        except:
            pass

        if world.response.status == 200:
            """Wait for the associated task to finish and store its data"""
            world.task_data = http.wait_for_task(json.loads(world.response.read()), headers)
    def add_instance(self, environment_instance):
        url = "%s/%s/%s/%s/%s" % (self.paasmanager_url, "envInst/org/FIWARE",
                                  "vdc", self.vdc, "environmentInstance")
        headers = {'X-Auth-Token': self.token, 'Tenant-Id': self.vdc,
                   'Content-Type': "application/xml", 'Accept': "application/json"}
        payload = tostring(environment_instance.to_xml())
        world.response = http.post(url, headers, payload)

        """Store it in the world to tear it down later"""
        try:
            world.instances.append(environment_instance.blueprint_name)
        except AttributeError:
            world.instances = [environment_instance.blueprint_name]

        if world.response.status == 200:
            """Wait for the associated task to finish and store its data"""
            world.task_data = http.wait_for_task(json.loads(world.response.read()), headers)
Пример #3
0
    def delete_instance(self, instance_name):
        url = "%s/%s/%s/%s/%s/%s" % (self.paasmanager_url,
                                     "envInst/org/FIWARE", "vdc", self.vdc,
                                     "environmentInstance", instance_name)
        headers = {
            'X-Auth-Token': self.token,
            'Tenant-Id': self.vdc,
            'Content-Type': "application/xml",
            'Accept': "application/json"
        }
        world.response = http.delete(url, headers)
        """Remove it from the world too"""
        try:
            world.instances.remove(instance_name)
        except:
            pass

        if world.response.status == 200:
            """Wait for the associated task to finish and store its data"""
            world.task_data = http.wait_for_task(
                json.loads(world.response.read()), headers)
Пример #4
0
    def add_instance(self, environment_instance):
        url = "%s/%s/%s/%s/%s" % (self.paasmanager_url, "envInst/org/FIWARE",
                                  "vdc", self.vdc, "environmentInstance")
        headers = {
            'X-Auth-Token': self.token,
            'Tenant-Id': self.vdc,
            'Content-Type': "application/xml",
            'Accept': "application/json"
        }
        payload = tostring(environment_instance.to_xml())
        world.response = http.post(url, headers, payload)
        """Store it in the world to tear it down later"""
        try:
            world.instances.append(environment_instance.blueprint_name)
        except AttributeError:
            world.instances = [environment_instance.blueprint_name]

        if world.response.status == 200:
            """Wait for the associated task to finish and store its data"""
            world.task_data = http.wait_for_task(
                json.loads(world.response.read()), headers)