Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 10 additions & 27 deletions lib/workflows/create_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from apis.openstack_api.enums.rbac_network_actions import RbacNetworkActions
from apis.openstack_api.enums.user_domains import UserDomains
from apis.openstack_api.openstack_network import (
allocate_floating_ips,
create_network,
create_network_rbac,
)
Expand Down Expand Up @@ -102,13 +101,21 @@ def create_project(
refresh_security_groups(conn, project["id"])

network_type = Networks.from_string(network)

set_quota(
conn,
QuotaDetails(
project_identifier=project.id,
floating_ips=number_of_floating_ips,
security_group_rules=number_of_security_group_rules,
),
)

if network_type in (Networks.EXTERNAL, Networks.JASMIN):
setup_external_networking(
conn,
project,
network_type,
number_of_floating_ips,
number_of_security_group_rules,
)
elif network_type == Networks.INTERNAL:
setup_internal_networking(conn, project)
Expand Down Expand Up @@ -148,8 +155,6 @@ def setup_external_networking(
conn: Connection,
project: Project,
external_network: Networks,
number_of_floating_ips: int,
number_of_security_group_rules: int,
):
"""
Setup the project's external networking.
Expand All @@ -159,10 +164,6 @@ def setup_external_networking(
:type project: Project
:param external_network: External Cloud network
:type external_network: Networks
:param number_of_floating_ips: Floating IP quota for project
:type number_of_floating_ips: int
:param number_of_security_group_rules: Security group quota for project
:type number_of_security_group_rules: int
"""
network = create_network(
conn,
Expand Down Expand Up @@ -230,15 +231,6 @@ def setup_external_networking(
subnet_identifier=subnet.id,
)

set_quota(
conn,
QuotaDetails(
project_identifier=project.id,
floating_ips=number_of_floating_ips,
security_group_rules=number_of_security_group_rules,
),
)

# create default security group rules
if external_network == Networks.EXTERNAL:
create_external_security_group_rules(
Expand All @@ -253,15 +245,6 @@ def setup_external_networking(

logger.info("Created default security group")

allocate_floating_ips(
conn,
network_identifier=external_network.value,
project_identifier=project.id,
number_to_create=number_of_floating_ips,
)

logger.info("Allocated %s floating ips", number_of_floating_ips)


def setup_internal_networking(conn: Connection, project: Project):
"""
Expand Down
Loading