Skip to content

Commit 67586e7

Browse files
committed
network: add support for internal network
1 parent 184847c commit 67586e7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

docs/config/tests-set.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Each bridged network should consist of the following settings:
4242
* `gateway`: the gateway that should be used, mandatory (example: `192.168.52.1`)
4343
* `device`: the name of the device, optional, and if missing the `name` of the
4444
bridge is assumed
45+
* `internal`: whether the bridge should run only internally, or can allow
46+
external inbound traffic
4547

4648
### Bridge Example
4749

sipssert/network/bridged.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@ def __init__(self, controller, network_config):
4545
self.subnet = network_config["subnet"]
4646
self.gateway = network_config["gateway"]
4747
self.created = False
48+
self.internal = False
4849
except KeyError as exc:
4950
raise BridgedNetworkBadConfig("invalid setting") from exc
5051

5152
if "device" in network_config.keys():
5253
self.device = network_config["device"]
5354
else:
5455
self.device = self.name
56+
if "internal" in network_config.keys():
57+
self.internal = network_config["internal"]
5558
self.setup()
5659

5760
def setup(self):
@@ -67,6 +70,7 @@ def setup(self):
6770
self.controller.docker.networks.create(self.name,
6871
driver="bridge",
6972
ipam=ipam_config,
73+
internal=self.internal,
7074
options=options)
7175
self.created = True
7276
except docker.errors.APIError as err:

0 commit comments

Comments
 (0)