-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1930 from jemrobinson/1902-remove-sre-index
Remove SRE index
- Loading branch information
Showing
11 changed files
with
204 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,34 @@ | ||
"""Calculate SRE IP address ranges for a given SRE index""" | ||
|
||
from data_safe_haven.exceptions import DataSafeHavenParameterError | ||
from dataclasses import dataclass | ||
|
||
from data_safe_haven.external import AzureIPv4Range | ||
|
||
|
||
@dataclass(frozen=True) | ||
class SREIpRanges: | ||
"""Calculate SRE IP address ranges for a given SRE index""" | ||
|
||
max_index = 256 | ||
|
||
def __init__(self, index: int) -> None: | ||
"""Constructor""" | ||
if index < 1 or index > self.max_index: | ||
msg = f"Index '{index}' must be between 1 and {self.max_index}" | ||
raise DataSafeHavenParameterError(msg) | ||
self.vnet = AzureIPv4Range(f"10.{index}.0.0", f"10.{index}.255.255") | ||
self.application_gateway = self.vnet.next_subnet(256) | ||
self.apt_proxy_server = self.vnet.next_subnet(8) | ||
self.data_configuration = self.vnet.next_subnet(8) | ||
self.data_private = self.vnet.next_subnet(8) | ||
self.firewall = self.vnet.next_subnet(64) # 64 address minimum | ||
self.firewall_management = self.vnet.next_subnet(64) # 64 address minimum | ||
self.guacamole_containers = self.vnet.next_subnet(8) | ||
self.guacamole_containers_support = self.vnet.next_subnet(8) | ||
self.identity_containers = self.vnet.next_subnet(8) | ||
self.monitoring = self.vnet.next_subnet(32) | ||
self.user_services_containers = self.vnet.next_subnet(8) | ||
self.user_services_containers_support = self.vnet.next_subnet(8) | ||
self.user_services_databases = self.vnet.next_subnet(8) | ||
self.user_services_software_repositories = self.vnet.next_subnet(8) | ||
self.workspaces = self.vnet.next_subnet(256) | ||
|
||
|
||
vnet = AzureIPv4Range("10.0.0.0", "10.0.255.255") | ||
application_gateway = vnet.next_subnet(256) | ||
apt_proxy_server = vnet.next_subnet(8) | ||
data_configuration = vnet.next_subnet(8) | ||
data_private = vnet.next_subnet(8) | ||
firewall = vnet.next_subnet(64) # 64 address minimum | ||
firewall_management = vnet.next_subnet(64) # 64 address minimum | ||
guacamole_containers = vnet.next_subnet(8) | ||
guacamole_containers_support = vnet.next_subnet(8) | ||
identity_containers = vnet.next_subnet(8) | ||
monitoring = vnet.next_subnet(32) | ||
user_services_containers = vnet.next_subnet(8) | ||
user_services_containers_support = vnet.next_subnet(8) | ||
user_services_databases = vnet.next_subnet(8) | ||
user_services_software_repositories = vnet.next_subnet(8) | ||
workspaces = vnet.next_subnet(256) | ||
|
||
|
||
@dataclass(frozen=True) | ||
class SREDnsIpRanges: | ||
"""Calculate SRE DNS IP address ranges.""" | ||
|
||
def __init__(self) -> None: | ||
"""Constructor""" | ||
self.vnet = AzureIPv4Range("192.168.0.0", "192.168.0.7") | ||
vnet = AzureIPv4Range("192.168.0.0", "192.168.0.7") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.