Esempio n. 1
0
    def setUp(self):
        super(TestOpencontrailClient, self).setUp()
        self.client = client.Client('http://127.0.0.1:8081', {'arg1': 'aaa'})

        self.get_resp = mock.MagicMock()
        self.get = mock.patch('requests.get',
                              return_value=self.get_resp).start()
        self.get_resp.raw_version = 1.1
        self.get_resp.status_code = 200
Esempio n. 2
0
    def _prepare_cache(self, endpoint, params, cache):

        if 'network.statistics.opencontrail' in cache:
            return cache['network.statistics.opencontrail']

        data = {
            'o_client': client.Client(self.conf, endpoint),
            'n_client': neutron_client.Client(self.conf)
        }

        cache['network.statistics.opencontrail'] = data

        return data
Esempio n. 3
0
    def setUp(self):
        super(TestOpencontrailClient, self).setUp()
        self.conf = self.useFixture(config_fixture.Config())
        ceilometer_service.prepare_service([])
        self.client = client.Client('http://127.0.0.1:8081', {'arg1': 'aaa'})

        self.get_resp = mock.MagicMock()
        self.get = mock.patch('requests.get',
                              return_value=self.get_resp).start()
        self.get_resp.raw.version = 1.1
        self.get_resp.status_code = 200
        self.get_resp.reason = 'OK'
        self.get_resp.content = ''
Esempio n. 4
0
    def _prepare_cache(endpoint, params, cache):

        if 'network.statistics.opencontrail' in cache:
            return cache['network.statistics.opencontrail']

        data = {
            'o_client':
            client.Client(endpoint, params['username'], params['password'],
                          params.get('domain'),
                          params.get('verify_ssl') == 'true'),
            'n_client':
            neutron_client.Client()
        }

        cache['network.statistics.opencontrail'] = data

        return data
Esempio n. 5
0
    def setUp(self):
        super(TestOpencontrailClient, self).setUp()
        self.client = client.Client('http://127.0.0.1:8143',
                                    'admin', 'admin', None, False)

        self.post_resp = mock.MagicMock()
        self.post = mock.patch('requests.post',
                               return_value=self.post_resp).start()

        self.post_resp.raw.version = 1.1
        self.post_resp.status_code = 302
        self.post_resp.reason = 'Moved'
        self.post_resp.headers = {}
        self.post_resp.cookies = {'connect.sid': 'aaa'}
        self.post_resp.content = 'dummy'

        self.get_resp = mock.MagicMock()
        self.get = mock.patch('requests.get',
                              return_value=self.get_resp).start()
        self.get_resp.raw_version = 1.1
        self.get_resp.status_code = 200
        self.post_resp.content = 'dqs'