def setUpClass(cls): super(BaseVitrageTempest, cls).setUpClass() warnings.filterwarnings(action="ignore", message="unclosed", category=ResourceWarning) TempestClients.class_init(cls.os_primary.credentials) cls.vitrage_client = TempestClients.vitrage() cls.vitrage_client_for_demo_user = \ TempestClients.vitrage_client_for_user() cls.num_default_networks = \ len(TempestClients.neutron().list_networks()['networks']) cls.num_default_ports = cls._get_num_default_ports() cls.num_default_entities = 3 cls.num_default_edges = 2 cls.num_demo_tenant_networks = cls._calc_num_tenant_networks()
def setUpClass(cls): super(BaseVitrageTempest, cls).setUpClass() warnings.filterwarnings(action="ignore", message="unclosed", category=ResourceWarning) cls.conf = service.prepare_service([]) TempestClients.class_init(cls.conf) cls.vitrage_client = TempestClients.vitrage() cls.vitrage_client_for_demo_user = \ TempestClients.vitrage_client_for_user( cls.DEMO_USERNAME, cls.USER_DOMAIN_ID, cls.DEMO_PROJECT_NAME, cls.PROJECT_DOMAIN_ID) cls.num_default_networks = \ len(TempestClients.neutron().list_networks()['networks']) cls.num_default_ports = cls._get_num_default_ports() cls.num_default_entities = 3 cls.num_default_edges = 2 cls.num_demo_tenant_networks = cls._calc_num_demo_tenant_networks()
def _calc_num_admin_tenant_networks(): neutron_client = TempestClients.neutron() admin_creds = common_creds.get_configured_admin_credentials() tenant_networks = neutron_client.list_networks( tenant_id=admin_creds.project_id)['networks'] return len(tenant_networks)
def _get_num_default_ports(cls): ports = TempestClients.neutron().list_ports()['ports'] nova_ports = general_utils.all_matches(ports, device_owner='compute:nova') LOG.debug('ports: %s, nova_ports: %s', ports, nova_ports) return len(nova_ports)
def get_shared_network(): nets = TempestClients.neutron().list_networks() return g_utils.first_match(nets['networks'], name='shared')
def get_public_network(): nets = TempestClients.neutron().list_networks() return g_utils.first_match(nets['networks'], name='public')