Exemple #1
0
def _get_network_id(net_name, project_name):
    am = clients.Manager(credentials.get_configured_admin_credentials())
    net_cl = am.networks_client
    pr_cl = am.projects_client

    networks = net_cl.list_networks()
    project = identity.get_project_by_name(pr_cl, project_name)
    p_id = project['id']
    n_id = None
    for net in networks['networks']:
        if (net['project_id'] == p_id and net['name'] == net_name):
            n_id = net['id']
            break
    return n_id
Exemple #2
0
def _get_network_id(net_name, project_name):
    am = clients.Manager(
        credentials.get_configured_admin_credentials())
    net_cl = am.networks_client
    pr_cl = am.projects_client

    networks = net_cl.list_networks()
    project = identity.get_project_by_name(pr_cl, project_name)
    p_id = project['id']
    n_id = None
    for net in networks['networks']:
        if (net['project_id'] == p_id and net['name'] == net_name):
            n_id = net['id']
            break
    return n_id
Exemple #3
0
    def _init_admin_ids(self):
        pr_cl = self.admin_mgr.projects_client
        rl_cl = self.admin_mgr.roles_v3_client
        rla_cl = self.admin_mgr.role_assignments_client
        us_cl = self.admin_mgr.users_v3_client

        project = identity.get_project_by_name(pr_cl,
                                               CONF.auth.admin_project_name)
        self.admin_project_id = project['id']
        user = identity.get_user_by_project(us_cl, rla_cl,
                                            self.admin_project_id,
                                            CONF.auth.admin_username)
        self.admin_id = user['id']

        roles = rl_cl.list_roles()['roles']
        for role in roles:
            if role['name'] == CONF.identity.admin_role:
                self.admin_role_id = role['id']
                break
Exemple #4
0
    def _init_admin_ids(self):
        pr_cl = self.admin_mgr.projects_client
        rl_cl = self.admin_mgr.roles_v3_client
        rla_cl = self.admin_mgr.role_assignments_client
        us_cl = self.admin_mgr.users_v3_client

        project = identity.get_project_by_name(pr_cl,
                                               CONF.auth.admin_project_name)
        self.admin_project_id = project['id']
        user = identity.get_user_by_project(us_cl, rla_cl,
                                            self.admin_project_id,
                                            CONF.auth.admin_username)
        self.admin_id = user['id']

        roles = rl_cl.list_roles()['roles']
        for role in roles:
            if role['name'] == CONF.identity.admin_role:
                self.admin_role_id = role['id']
                break