Exemplo n.º 1
0
    def _assert_test_network_doesnt_exist(self):
        logging.info("Checking that the test network doesn't exist on the "
                     "Arista test fixture...")

        for attempt in tenacity.Retrying(
                wait=tenacity.wait_fixed(10),  # seconds
                stop=tenacity.stop_after_attempt(12),
                reraise=True):
            with attempt:
                actual_network_names = arista_utils.query_fixture_networks(
                    arista_utils.fixture_ip_addr())
                self.assertEqual(actual_network_names, [])

        super(NeutronCreateAristaNetworkTest,
              self)._assert_test_network_doesnt_exist()
Exemplo n.º 2
0
def test_fixture():
    """Pass arista-virt-test-fixture's IP address to Neutron."""
    fixture_ip_addr = arista_utils.fixture_ip_addr()
    logging.info(
        "{}'s IP address is '{}'. Passing it to neutron-api-plugin-arista...".
        format(arista_utils.FIXTURE_APP_NAME, fixture_ip_addr))
    zaza.model.set_application_config('neutron-api-plugin-arista',
                                      {'eapi-host': fixture_ip_addr})

    logging.info('Waiting for {} to become ready...'.format(
        arista_utils.FIXTURE_APP_NAME))
    for attempt in tenacity.Retrying(
            wait=tenacity.wait_fixed(10),  # seconds
            stop=tenacity.stop_after_attempt(30),
            reraise=True):
        with attempt:
            arista_utils.query_fixture_networks(fixture_ip_addr)
Exemplo n.º 3
0
    def _assert_test_network_exists_and_return_id(self):
        logging.info('Checking that the test network exists on the Arista '
                     'test fixture...')

        # Sometimes the API call from Neutron to Arista fails and Neutron
        # retries a couple of seconds later, which is why the newly created
        # test network may not be immediately visible on Arista's API.
        # NOTE(lourot): I experienced a run where it took 53 seconds.
        for attempt in tenacity.Retrying(
                wait=tenacity.wait_fixed(10),  # seconds
                stop=tenacity.stop_after_attempt(12),
                reraise=True):
            with attempt:
                actual_network_names = arista_utils.query_fixture_networks(
                    arista_utils.fixture_ip_addr())
                self.assertEqual(actual_network_names, [self._TEST_NET_NAME])

        return super(NeutronCreateAristaNetworkTest,
                     self)._assert_test_network_exists_and_return_id()
Exemplo n.º 4
0
 def _assert_test_network_doesnt_exist(self):
     actual_network_names = arista_utils.query_fixture_networks(
         arista_utils.fixture_ip_addr())
     self.assertEqual(actual_network_names, [])
     super(NeutronCreateAristaNetworkTest,
           self)._assert_test_network_doesnt_exist()
Exemplo n.º 5
0
 def _assert_test_network_exists_and_return_id(self):
     actual_network_names = arista_utils.query_fixture_networks(
         arista_utils.fixture_ip_addr())
     self.assertEqual(actual_network_names, [self._TEST_NET_NAME])
     return super(NeutronCreateAristaNetworkTest,
                  self)._assert_test_network_exists_and_return_id()