netsplit 0.3.7__tar.gz → 0.3.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netsplit-0.3.8/.gitignore +7 -0
- netsplit-0.3.8/.pre-commit-config.yaml +19 -0
- netsplit-0.3.8/CHANGELOG.md +51 -0
- netsplit-0.3.8/Makefile +30 -0
- {netsplit-0.3.7 → netsplit-0.3.8}/PKG-INFO +8 -16
- netsplit-0.3.8/examples/img/netsplit-multicloud.png +0 -0
- netsplit-0.3.8/examples/netsplit-complex.toml +43 -0
- netsplit-0.3.8/examples/netsplit-k8s.toml +59 -0
- netsplit-0.3.8/examples/netsplit-multicloud.toml +32 -0
- netsplit-0.3.8/examples/netsplit-simple.toml +7 -0
- netsplit-0.3.8/pyproject.toml +42 -0
- netsplit-0.3.8/setup.cfg +3 -0
- netsplit-0.3.8/tests/__init__.py +0 -0
- netsplit-0.3.8/tests/plans/MultiCloud.json +62 -0
- netsplit-0.3.8/tests/plans/MultiCloud.toml +31 -0
- netsplit-0.3.8/tests/plans/Simple-nets.json +7 -0
- netsplit-0.3.8/tests/plans/Simple-nets.toml +6 -0
- netsplit-0.3.8/tests/plans/Simple.json +7 -0
- netsplit-0.3.8/tests/plans/Simple.toml +5 -0
- netsplit-0.3.8/tests/test_get_subnets.py +35 -0
- netsplit-0.3.8/uv.lock +798 -0
- netsplit-0.3.7/pyproject.toml +0 -37
- {netsplit-0.3.7 → netsplit-0.3.8}/LICENSE +0 -0
- {netsplit-0.3.7 → netsplit-0.3.8}/README.md +0 -0
- {netsplit-0.3.7 → netsplit-0.3.8}/netsplit/__init__.py +0 -0
- {netsplit-0.3.7 → netsplit-0.3.8}/netsplit/cli.py +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v4.5.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: check-yaml
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: trailing-whitespace
|
|
8
|
+
- repo: https://github.com/PyCQA/flake8
|
|
9
|
+
rev: 6.1.0
|
|
10
|
+
hooks:
|
|
11
|
+
- id: flake8
|
|
12
|
+
- repo: local
|
|
13
|
+
hooks:
|
|
14
|
+
- id: pytest
|
|
15
|
+
name: pytest
|
|
16
|
+
entry: "uv run pytest"
|
|
17
|
+
language: system
|
|
18
|
+
pass_filenames: false
|
|
19
|
+
types: [python]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
## v0.3.8 (2026-09-30)
|
|
2
|
+
|
|
3
|
+
### Fix
|
|
4
|
+
|
|
5
|
+
- update dependencies
|
|
6
|
+
|
|
7
|
+
## v0.3.7 (2026-08-21)
|
|
8
|
+
|
|
9
|
+
### Fix
|
|
10
|
+
|
|
11
|
+
- Poetry update
|
|
12
|
+
|
|
13
|
+
## v0.3.6 (2025-09-02)
|
|
14
|
+
|
|
15
|
+
### Fix
|
|
16
|
+
|
|
17
|
+
- Poetry update
|
|
18
|
+
|
|
19
|
+
## v0.3.5 (2025-01-14)
|
|
20
|
+
|
|
21
|
+
### Fix
|
|
22
|
+
|
|
23
|
+
- Poetry update
|
|
24
|
+
|
|
25
|
+
## v0.3.4 (2024-06-25)
|
|
26
|
+
|
|
27
|
+
### Fix
|
|
28
|
+
|
|
29
|
+
- Poetry updates
|
|
30
|
+
|
|
31
|
+
## v0.3.3 (2023-12-24)
|
|
32
|
+
|
|
33
|
+
### Fix
|
|
34
|
+
|
|
35
|
+
- **testing**: testing commitizen
|
|
36
|
+
|
|
37
|
+
## v0.3.2 (2023-12-24)
|
|
38
|
+
|
|
39
|
+
### Fix
|
|
40
|
+
|
|
41
|
+
- testing commitizen
|
|
42
|
+
|
|
43
|
+
## v0.3.1 (2023-12-24)
|
|
44
|
+
|
|
45
|
+
### Fix
|
|
46
|
+
|
|
47
|
+
- testing commitizen
|
|
48
|
+
|
|
49
|
+
## v0.3.0 (2023-12-24)
|
|
50
|
+
|
|
51
|
+
## v0.2.0 (2023-12-23)
|
netsplit-0.3.8/Makefile
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.PHONY: help ## Print this help
|
|
2
|
+
help:
|
|
3
|
+
@grep -E '^\.PHONY: [a-zA-Z_-]+ .*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = "(: |##)"}; {printf "\033[36m%-30s\033[0m %s\n", $$2, $$3}'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
.PHONY: init ## Initialize for development
|
|
7
|
+
init:
|
|
8
|
+
@uv sync
|
|
9
|
+
@uv run prek install
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
.PHONY: test ## Run tests
|
|
13
|
+
test:
|
|
14
|
+
@uv run pytest
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
.PHONY: clean ## Cleanup generated files
|
|
18
|
+
clean:
|
|
19
|
+
@rm -rf *.egg-info build dist docs/_build .coverage results.xml
|
|
20
|
+
@find . -type d -name __pycache__ -exec rm -r {} \+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
.PHONY: release ## Make release
|
|
24
|
+
release:
|
|
25
|
+
uv run cz bump;
|
|
26
|
+
VERSION=`uv version --short`; \
|
|
27
|
+
git push; \
|
|
28
|
+
git tag -a v$$VERSION -m "Tagged version $$VERSION"; \
|
|
29
|
+
git push --tags; \
|
|
30
|
+
uv build --clear && uv publish --token ${UV_PUBLISH_TOKEN}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: netsplit
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.8
|
|
4
4
|
Summary: Netsplit can help slice and dice your IP space
|
|
5
|
+
Author-email: Nikos Chasiotis <hasiotis@gmail.com>
|
|
5
6
|
License-File: LICENSE
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Requires-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
-
Requires-Dist: click (>=8.0,<9.0)
|
|
16
|
-
Requires-Dist: ipaddress (>=1.0.23,<2.0.0)
|
|
17
|
-
Requires-Dist: rich (>=13.7.0,<14.0.0)
|
|
18
|
-
Requires-Dist: tomli (>=2.0.1,<3.0.0)
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Requires-Dist: click<9,>=8.0
|
|
9
|
+
Requires-Dist: ipaddress<2,>=1.0.23
|
|
10
|
+
Requires-Dist: rich<16,>=15.0.0
|
|
11
|
+
Requires-Dist: tomli<3,>=2.0.1
|
|
19
12
|
Description-Content-Type: text/markdown
|
|
20
13
|
|
|
21
14
|
# Netsplit: Slice and dice your IP space
|
|
@@ -64,4 +57,3 @@ Make sure to check examples for complex network plans:
|
|
|
64
57
|
# Similar projects:
|
|
65
58
|
|
|
66
59
|
* [Visual Subnet Calculator](https://github.com/ckabalan/visualsubnetcalc)
|
|
67
|
-
|
|
Binary file
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[netsplit]
|
|
2
|
+
description = "Global / Cloud / VPC / Net"
|
|
3
|
+
network = "10.8.0.0/16"
|
|
4
|
+
|
|
5
|
+
[plan]
|
|
6
|
+
options = { slots = 4 }
|
|
7
|
+
|
|
8
|
+
[plan.members]
|
|
9
|
+
[plan.members.cloud01]
|
|
10
|
+
options = { index = 2, slots = 4 }
|
|
11
|
+
|
|
12
|
+
[plan.members.cloud01.members]
|
|
13
|
+
[plan.members.cloud01.members.vpc01]
|
|
14
|
+
options = { extend = 1, slots = 4 }
|
|
15
|
+
members = ["Net1", "Net2", "Net3"]
|
|
16
|
+
|
|
17
|
+
[plan.members.cloud01.members.vpc02]
|
|
18
|
+
options = { slots = 4 }
|
|
19
|
+
members = ["Net1", "Net2", "Net3"]
|
|
20
|
+
|
|
21
|
+
[plan.members.cloud02]
|
|
22
|
+
options = { slots = 4 }
|
|
23
|
+
|
|
24
|
+
[plan.members.cloud02.members]
|
|
25
|
+
[plan.members.cloud02.members.vpc01]
|
|
26
|
+
options = { slots = 4 }
|
|
27
|
+
members = ["Net1", "Net2", "Net3"]
|
|
28
|
+
|
|
29
|
+
[plan.members.cloud02.members.vpc02]
|
|
30
|
+
options = { slots = 4 }
|
|
31
|
+
members = ["Net1", "Net2", "Net3"]
|
|
32
|
+
|
|
33
|
+
[plan.members.cloud03]
|
|
34
|
+
options = { slots = 8 }
|
|
35
|
+
|
|
36
|
+
[plan.members.cloud03.members]
|
|
37
|
+
[plan.members.cloud03.members.vpc01]
|
|
38
|
+
options = { extend = 2, slots = 4 }
|
|
39
|
+
members = ["Net1", "Net2", "Net3"]
|
|
40
|
+
|
|
41
|
+
[plan.members.cloud03.members.vpc02]
|
|
42
|
+
options = { extend = 1, slots = 2 }
|
|
43
|
+
members = ["Net1", "Net2"]
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[netsplit]
|
|
2
|
+
description = "Root / Cluster"
|
|
3
|
+
network = "192.168.0.0/16"
|
|
4
|
+
|
|
5
|
+
[plan]
|
|
6
|
+
options = { slots = 4 }
|
|
7
|
+
|
|
8
|
+
[plan.members]
|
|
9
|
+
[plan.members.cluster01]
|
|
10
|
+
options = { slots = 16 }
|
|
11
|
+
|
|
12
|
+
[plan.members.cluster01.members]
|
|
13
|
+
[plan.members.cluster01.members.control]
|
|
14
|
+
options = { slots = 1 }
|
|
15
|
+
|
|
16
|
+
[plan.members.cluster01.members.pods]
|
|
17
|
+
options = { extend = 3, slots = 1 }
|
|
18
|
+
|
|
19
|
+
[plan.members.cluster01.members.services]
|
|
20
|
+
options = { extend = 1, slots = 1 }
|
|
21
|
+
|
|
22
|
+
[plan.members.cluster02]
|
|
23
|
+
options = { slots = 16 }
|
|
24
|
+
|
|
25
|
+
[plan.members.cluster02.members]
|
|
26
|
+
[plan.members.cluster02.members.control]
|
|
27
|
+
options = { slots = 1 }
|
|
28
|
+
|
|
29
|
+
[plan.members.cluster02.members.pods]
|
|
30
|
+
options = { extend = 3, slots = 1 }
|
|
31
|
+
|
|
32
|
+
[plan.members.cluster02.members.services]
|
|
33
|
+
options = { extend = 1, slots = 1 }
|
|
34
|
+
|
|
35
|
+
[plan.members.cluster03]
|
|
36
|
+
options = { slots = 16 }
|
|
37
|
+
|
|
38
|
+
[plan.members.cluster03.members]
|
|
39
|
+
[plan.members.cluster03.members.control]
|
|
40
|
+
options = { slots = 1 }
|
|
41
|
+
|
|
42
|
+
[plan.members.cluster03.members.pods]
|
|
43
|
+
options = { extend = 3, slots = 1 }
|
|
44
|
+
|
|
45
|
+
[plan.members.cluster03.members.services]
|
|
46
|
+
options = { extend = 1, slots = 1 }
|
|
47
|
+
|
|
48
|
+
[plan.members.cluster04]
|
|
49
|
+
options = { slots = 16 }
|
|
50
|
+
|
|
51
|
+
[plan.members.cluster04.members]
|
|
52
|
+
[plan.members.cluster04.members.control]
|
|
53
|
+
options = { slots = 1 }
|
|
54
|
+
|
|
55
|
+
[plan.members.cluster04.members.pods]
|
|
56
|
+
options = { extend = 3, slots = 1 }
|
|
57
|
+
|
|
58
|
+
[plan.members.cluster04.members.services]
|
|
59
|
+
options = { extend = 1, slots = 1 }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[netsplit]
|
|
2
|
+
description = "Global / Cloud / Environment / Subnet"
|
|
3
|
+
network = "10.0.0.0/8"
|
|
4
|
+
|
|
5
|
+
[plan]
|
|
6
|
+
options = { slots = 8 }
|
|
7
|
+
|
|
8
|
+
[plan.members]
|
|
9
|
+
[plan.members.aws]
|
|
10
|
+
options = { index = 3, extend = 2, slots = 4 }
|
|
11
|
+
|
|
12
|
+
[plan.members.aws.members]
|
|
13
|
+
[plan.members.aws.members.production]
|
|
14
|
+
options = { extend = 1, slots = 8 }
|
|
15
|
+
members = ["Lan1", "Lan2", "Lan3"]
|
|
16
|
+
|
|
17
|
+
[plan.members.aws.members.staging]
|
|
18
|
+
options = { extend = 1, slots = 16 }
|
|
19
|
+
members = ["Lan1", "Lan2", "Lan3"]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
[plan.members.gcp]
|
|
23
|
+
options = { slots = 4 }
|
|
24
|
+
|
|
25
|
+
[plan.members.gcp.members]
|
|
26
|
+
[plan.members.gcp.members.production]
|
|
27
|
+
options = { extend = 1, slots = 8 }
|
|
28
|
+
members = ["Lan1", "Lan2", "Lan3", "Lan4"]
|
|
29
|
+
|
|
30
|
+
[plan.members.gcp.members.staging]
|
|
31
|
+
options = { extend = 1, slots = 16 }
|
|
32
|
+
members = ["Lan1", "Lan2", "Lan3", "Lan4"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "netsplit"
|
|
3
|
+
version = "0.3.8"
|
|
4
|
+
description = "Netsplit can help slice and dice your IP space"
|
|
5
|
+
authors = [{ name = "Nikos Chasiotis", email = "hasiotis@gmail.com" }]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
requires-python = ">=3.10"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"tomli>=2.0.1,<3",
|
|
10
|
+
"ipaddress>=1.0.23,<2",
|
|
11
|
+
"rich>=15.0.0,<16",
|
|
12
|
+
"click>=8.0,<9",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[project.scripts]
|
|
16
|
+
netsplit = "netsplit.cli:cli"
|
|
17
|
+
|
|
18
|
+
[dependency-groups]
|
|
19
|
+
dev = [
|
|
20
|
+
"pytest>=9.1.1,<10",
|
|
21
|
+
"jsonpickle>=4.1.2,<5",
|
|
22
|
+
"commitizen>=4.2,<5",
|
|
23
|
+
"prek>=0.5.4,<0.6",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[tool.pytest.ini_options]
|
|
27
|
+
addopts = "-ra -q"
|
|
28
|
+
|
|
29
|
+
[tool.commitizen]
|
|
30
|
+
name = "cz_conventional_commits"
|
|
31
|
+
tag_format = "v$version"
|
|
32
|
+
version_scheme = "semver"
|
|
33
|
+
version_provider = "uv"
|
|
34
|
+
update_changelog_on_bump = true
|
|
35
|
+
major_version_zero = true
|
|
36
|
+
|
|
37
|
+
[build-system]
|
|
38
|
+
requires = ["hatchling"]
|
|
39
|
+
build-backend = "hatchling.build"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.sdist]
|
|
42
|
+
exclude = [".claude", ".github"]
|
netsplit-0.3.8/setup.cfg
ADDED
|
File without changes
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[
|
|
2
|
+
{ "level": 0, "slots": 1, "index": 0, "extend": 0, "name": "MultiCloud", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.0.0.0/8" ] } ] } },
|
|
3
|
+
{ "level": 1, "slots": 8, "index": 1, "extend": 0, "name": "MultiCloud / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.0.0.0/11" ] } ] } },
|
|
4
|
+
{ "level": 1, "slots": 8, "index": 2, "extend": 0, "name": "MultiCloud / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.32.0.0/11" ] } ] } },
|
|
5
|
+
{ "level": 1, "slots": 8, "index": 3, "extend": 1, "name": "MultiCloud / aws", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.64.0.0/10" ] } ] } },
|
|
6
|
+
{ "level": 2, "slots": 4, "index": 1, "extend": 1, "name": "MultiCloud / aws / production", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.64.0.0/11" ] } ] } },
|
|
7
|
+
{ "level": 3, "slots": 8, "index": 1, "extend": 0, "name": "MultiCloud / aws / production / Lan1", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.64.0.0/14" ] } ] } },
|
|
8
|
+
{ "level": 3, "slots": 8, "index": 2, "extend": 0, "name": "MultiCloud / aws / production / Lan2", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.68.0.0/14" ] } ] } },
|
|
9
|
+
{ "level": 3, "slots": 8, "index": 3, "extend": 0, "name": "MultiCloud / aws / production / Lan3", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.72.0.0/14" ] } ] } },
|
|
10
|
+
{ "level": 3, "slots": 8, "index": 4, "extend": 0, "name": "MultiCloud / aws / production / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.76.0.0/14" ] } ] } },
|
|
11
|
+
{ "level": 3, "slots": 8, "index": 5, "extend": 0, "name": "MultiCloud / aws / production / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.80.0.0/14" ] } ] } },
|
|
12
|
+
{ "level": 3, "slots": 8, "index": 6, "extend": 0, "name": "MultiCloud / aws / production / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.84.0.0/14" ] } ] } },
|
|
13
|
+
{ "level": 3, "slots": 8, "index": 7, "extend": 0, "name": "MultiCloud / aws / production / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.88.0.0/14" ] } ] } },
|
|
14
|
+
{ "level": 3, "slots": 8, "index": 8, "extend": 0, "name": "MultiCloud / aws / production / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.92.0.0/14" ] } ] } },
|
|
15
|
+
{ "level": 2, "slots": 4, "index": 3, "extend": 1, "name": "MultiCloud / aws / staging", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.96.0.0/11" ] } ] } },
|
|
16
|
+
{ "level": 3, "slots": 16, "index": 1, "extend": 0, "name": "MultiCloud / aws / staging / Lan1", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.96.0.0/15" ] } ] } },
|
|
17
|
+
{ "level": 3, "slots": 16, "index": 2, "extend": 0, "name": "MultiCloud / aws / staging / Lan2", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.98.0.0/15" ] } ] } },
|
|
18
|
+
{ "level": 3, "slots": 16, "index": 3, "extend": 0, "name": "MultiCloud / aws / staging / Lan3", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.100.0.0/15" ] } ] } },
|
|
19
|
+
{ "level": 3, "slots": 16, "index": 4, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.102.0.0/15" ] } ] } },
|
|
20
|
+
{ "level": 3, "slots": 16, "index": 5, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.104.0.0/15" ] } ] } },
|
|
21
|
+
{ "level": 3, "slots": 16, "index": 6, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.106.0.0/15" ] } ] } },
|
|
22
|
+
{ "level": 3, "slots": 16, "index": 7, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.108.0.0/15" ] } ] } },
|
|
23
|
+
{ "level": 3, "slots": 16, "index": 8, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.110.0.0/15" ] } ] } },
|
|
24
|
+
{ "level": 3, "slots": 16, "index": 9, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.112.0.0/15" ] } ] } },
|
|
25
|
+
{ "level": 3, "slots": 16, "index": 10, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.114.0.0/15" ] } ] } },
|
|
26
|
+
{ "level": 3, "slots": 16, "index": 11, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.116.0.0/15" ] } ] } },
|
|
27
|
+
{ "level": 3, "slots": 16, "index": 12, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.118.0.0/15" ] } ] } },
|
|
28
|
+
{ "level": 3, "slots": 16, "index": 13, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.120.0.0/15" ] } ] } },
|
|
29
|
+
{ "level": 3, "slots": 16, "index": 14, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.122.0.0/15" ] } ] } },
|
|
30
|
+
{ "level": 3, "slots": 16, "index": 15, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.124.0.0/15" ] } ] } },
|
|
31
|
+
{ "level": 3, "slots": 16, "index": 16, "extend": 0, "name": "MultiCloud / aws / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.126.0.0/15" ] } ] } },
|
|
32
|
+
{ "level": 1, "slots": 8, "index": 5, "extend": 0, "name": "MultiCloud / gcp", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.128.0.0/11" ] } ] } },
|
|
33
|
+
{ "level": 2, "slots": 4, "index": 1, "extend": 1, "name": "MultiCloud / gcp / production", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.128.0.0/12" ] } ] } },
|
|
34
|
+
{ "level": 3, "slots": 8, "index": 1, "extend": 0, "name": "MultiCloud / gcp / production / Lan1", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.128.0.0/15" ] } ] } },
|
|
35
|
+
{ "level": 3, "slots": 8, "index": 2, "extend": 0, "name": "MultiCloud / gcp / production / Lan2", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.130.0.0/15" ] } ] } },
|
|
36
|
+
{ "level": 3, "slots": 8, "index": 3, "extend": 0, "name": "MultiCloud / gcp / production / Lan3", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.132.0.0/15" ] } ] } },
|
|
37
|
+
{ "level": 3, "slots": 8, "index": 4, "extend": 0, "name": "MultiCloud / gcp / production / Lan4", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.134.0.0/15" ] } ] } },
|
|
38
|
+
{ "level": 3, "slots": 8, "index": 5, "extend": 0, "name": "MultiCloud / gcp / production / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.136.0.0/15" ] } ] } },
|
|
39
|
+
{ "level": 3, "slots": 8, "index": 6, "extend": 0, "name": "MultiCloud / gcp / production / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.138.0.0/15" ] } ] } },
|
|
40
|
+
{ "level": 3, "slots": 8, "index": 7, "extend": 0, "name": "MultiCloud / gcp / production / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.140.0.0/15" ] } ] } },
|
|
41
|
+
{ "level": 3, "slots": 8, "index": 8, "extend": 0, "name": "MultiCloud / gcp / production / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.142.0.0/15" ] } ] } },
|
|
42
|
+
{ "level": 2, "slots": 4, "index": 3, "extend": 1, "name": "MultiCloud / gcp / staging", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.144.0.0/12" ] } ] } },
|
|
43
|
+
{ "level": 3, "slots": 16, "index": 1, "extend": 0, "name": "MultiCloud / gcp / staging / Lan1", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.144.0.0/16" ] } ] } },
|
|
44
|
+
{ "level": 3, "slots": 16, "index": 2, "extend": 0, "name": "MultiCloud / gcp / staging / Lan2", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.145.0.0/16" ] } ] } },
|
|
45
|
+
{ "level": 3, "slots": 16, "index": 3, "extend": 0, "name": "MultiCloud / gcp / staging / Lan3", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.146.0.0/16" ] } ] } },
|
|
46
|
+
{ "level": 3, "slots": 16, "index": 4, "extend": 0, "name": "MultiCloud / gcp / staging / Lan4", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.147.0.0/16" ] } ] } },
|
|
47
|
+
{ "level": 3, "slots": 16, "index": 5, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.148.0.0/16" ] } ] } },
|
|
48
|
+
{ "level": 3, "slots": 16, "index": 6, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.149.0.0/16" ] } ] } },
|
|
49
|
+
{ "level": 3, "slots": 16, "index": 7, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.150.0.0/16" ] } ] } },
|
|
50
|
+
{ "level": 3, "slots": 16, "index": 8, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.151.0.0/16" ] } ] } },
|
|
51
|
+
{ "level": 3, "slots": 16, "index": 9, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.152.0.0/16" ] } ] } },
|
|
52
|
+
{ "level": 3, "slots": 16, "index": 10, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.153.0.0/16" ] } ] } },
|
|
53
|
+
{ "level": 3, "slots": 16, "index": 11, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.154.0.0/16" ] } ] } },
|
|
54
|
+
{ "level": 3, "slots": 16, "index": 12, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.155.0.0/16" ] } ] } },
|
|
55
|
+
{ "level": 3, "slots": 16, "index": 13, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.156.0.0/16" ] } ] } },
|
|
56
|
+
{ "level": 3, "slots": 16, "index": 14, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.157.0.0/16" ] } ] } },
|
|
57
|
+
{ "level": 3, "slots": 16, "index": 15, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.158.0.0/16" ] } ] } },
|
|
58
|
+
{ "level": 3, "slots": 16, "index": 16, "extend": 0, "name": "MultiCloud / gcp / staging / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.159.0.0/16" ] } ] } },
|
|
59
|
+
{ "level": 1, "slots": 8, "index": 6, "extend": 0, "name": "MultiCloud / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.160.0.0/11" ] } ] } },
|
|
60
|
+
{ "level": 1, "slots": 8, "index": 7, "extend": 0, "name": "MultiCloud / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.192.0.0/11" ] } ] } },
|
|
61
|
+
{ "level": 1, "slots": 8, "index": 8, "extend": 0, "name": "MultiCloud / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "10.224.0.0/11" ] } ] } }
|
|
62
|
+
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[netsplit]
|
|
2
|
+
network = "10.0.0.0/8"
|
|
3
|
+
|
|
4
|
+
[plan]
|
|
5
|
+
options = { slots = 8 }
|
|
6
|
+
|
|
7
|
+
[plan.members]
|
|
8
|
+
[plan.members.aws]
|
|
9
|
+
options = { index = 3, extend = 1, slots = 4 }
|
|
10
|
+
|
|
11
|
+
[plan.members.aws.members]
|
|
12
|
+
[plan.members.aws.members.production]
|
|
13
|
+
options = { extend = 1, slots = 8 }
|
|
14
|
+
members = ["Lan1", "Lan2", "Lan3"]
|
|
15
|
+
|
|
16
|
+
[plan.members.aws.members.staging]
|
|
17
|
+
options = { extend = 1, slots = 16 }
|
|
18
|
+
members = ["Lan1", "Lan2", "Lan3"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
[plan.members.gcp]
|
|
22
|
+
options = { slots = 4 }
|
|
23
|
+
|
|
24
|
+
[plan.members.gcp.members]
|
|
25
|
+
[plan.members.gcp.members.production]
|
|
26
|
+
options = { extend = 1, slots = 8 }
|
|
27
|
+
members = ["Lan1", "Lan2", "Lan3", "Lan4"]
|
|
28
|
+
|
|
29
|
+
[plan.members.gcp.members.staging]
|
|
30
|
+
options = { extend = 1, slots = 16 }
|
|
31
|
+
members = ["Lan1", "Lan2", "Lan3", "Lan4"]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[
|
|
2
|
+
{ "level": 0, "slots": 1, "index": 0, "extend": 0, "name": "Simple-nets", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "192.168.0.0/24" ] } ] } },
|
|
3
|
+
{ "level": 1, "slots": 4, "index": 1, "extend": 0, "name": "Simple-nets / NetA", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "192.168.0.0/26" ] } ] } },
|
|
4
|
+
{ "level": 1, "slots": 4, "index": 2, "extend": 0, "name": "Simple-nets / NetB", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "192.168.0.64/26" ] } ] } },
|
|
5
|
+
{ "level": 1, "slots": 4, "index": 3, "extend": 0, "name": "Simple-nets / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "192.168.0.128/26" ] } ] } },
|
|
6
|
+
{ "level": 1, "slots": 4, "index": 4, "extend": 0, "name": "Simple-nets / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "192.168.0.192/26" ] } ] } }
|
|
7
|
+
]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[
|
|
2
|
+
{ "level": 0, "slots": 1, "index": 0, "extend": 0, "name": "Simple", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "192.168.0.0/24" ] } ] } },
|
|
3
|
+
{ "level": 1, "slots": 4, "index": 1, "extend": 0, "name": "Simple / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "192.168.0.0/26" ] } ] } },
|
|
4
|
+
{ "level": 1, "slots": 4, "index": 2, "extend": 0, "name": "Simple / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "192.168.0.64/26" ] } ] } },
|
|
5
|
+
{ "level": 1, "slots": 4, "index": 3, "extend": 0, "name": "Simple / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "192.168.0.128/26" ] } ] } },
|
|
6
|
+
{ "level": 1, "slots": 4, "index": 4, "extend": 0, "name": "Simple / RESERVED", "prefix": { "py/reduce": [ { "py/type": "ipaddress.IPv4Network" }, { "py/tuple": [ "192.168.0.192/26" ] } ] } }
|
|
7
|
+
]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import glob
|
|
2
|
+
import json
|
|
3
|
+
import tomli
|
|
4
|
+
import ipaddress
|
|
5
|
+
import jsonpickle
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from netsplit.cli import get_subnets
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def load_plan(plan):
|
|
12
|
+
name = Path(plan).stem
|
|
13
|
+
with open(plan, "rb") as f:
|
|
14
|
+
cfg = tomli.load(f)
|
|
15
|
+
|
|
16
|
+
options = cfg['netsplit']
|
|
17
|
+
network = ipaddress.IPv4Network(options['network'])
|
|
18
|
+
return get_subnets(name, cfg['plan'], network)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_plans():
|
|
22
|
+
plans = glob.glob('tests/plans/*.toml')
|
|
23
|
+
for plan in plans:
|
|
24
|
+
networks = load_plan(plan)
|
|
25
|
+
jsonfile = plan.replace('toml', 'json')
|
|
26
|
+
if Path(jsonfile).exists():
|
|
27
|
+
with open(jsonfile, "rb") as f:
|
|
28
|
+
result = jsonpickle.decode(f.read(), keys=True)
|
|
29
|
+
else: # Here is our trick to autogenerate the expected output
|
|
30
|
+
frozen = jsonpickle.encode(networks)
|
|
31
|
+
with open(jsonfile, "w") as f:
|
|
32
|
+
j = json.loads(frozen)
|
|
33
|
+
json.dump(j, f, ensure_ascii=False, indent=4)
|
|
34
|
+
result = []
|
|
35
|
+
assert networks == result
|