Skip to content

Commit

Permalink
[openwisp] Fixed openvpn integration (partially backward incompatible)
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Sep 5, 2016
1 parent 7bc283a commit afbc3a3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
4 changes: 1 addition & 3 deletions netjsonconfig/backends/openwisp/openwisp.py
Expand Up @@ -9,8 +9,7 @@
class OpenWisp(OpenWrt):
""" OpenWisp 1.x Backend """
schema = schema
openwisp_env = Environment(loader=PackageLoader('netjsonconfig.backends.openwisp',
'templates'),
openwisp_env = Environment(loader=PackageLoader('netjsonconfig.backends.openwisp', 'templates'),
trim_blocks=True)

def validate(self):
Expand Down Expand Up @@ -48,7 +47,6 @@ def _get_install_context(self):
if vpn.get('dev_type') != 'tap':
continue
tap = vpn.copy()
tap['name'] = tap['config_value']
l2vpn.append(tap)
# bridge list
bridges = []
Expand Down
50 changes: 27 additions & 23 deletions tests/openwisp/test_backend.py
Expand Up @@ -64,34 +64,38 @@ class TestBackend(unittest.TestCase, _TabsMixin):
],
"openvpn": [
{
"config_name": "openvpn",
"config_value": "2693",
"enabled": "1",
"client": "1",
"ca": "/tmp/owispmanager/openvpn/x509/ca_1_service.pem",
"cert": "/tmp/owispmanager/openvpn/x509/l2vpn_client_2693.pem",
"cipher": "AES-128-CBC",
"comp_lzo": "yes",
"dev": "tap0",
"dev_type": "tap",
"proto": "tcp-client",
"remote": "vpn.openwisp.org 12128",
"nobind": "1",
"down": "/tmp/owispmanager/openvpn/vpn_2693_script_down.sh",
"enabled": True,
"keepalive": "5 40",
"ns_cert_type": "server",
"resolv_retry": "infinite",
"comp_lzo": "yes",
"tls_client": "1",
"ca": "/tmp/owispmanager/openvpn/x509/ca_1_service.pem",
"key": "/tmp/owispmanager/openvpn/x509/l2vpn_client_2693.pem",
"cert": "/tmp/owispmanager/openvpn/x509/l2vpn_client_2693.pem",
"log": "/tmp/openvpn_2693.log",
"mode": "client",
"mute": 10,
"mute_replay_warnings": True,
"name": "2693",
"nobind": True,
"ns_cert_type": "server",
"persist_tun": True,
"proto": "tcp-client",
"remote": [
{
"host": "vpn.openwisp.org",
"port": 12128
}
],
"resolv_retry": True,
"script_security": 1,
"tls_client": True,
"up": "/tmp/owispmanager/openvpn/vpn_2693_script_up.sh",
"down": "/tmp/owispmanager/openvpn/vpn_2693_script_down.sh",
"cipher": "AES-128-CBC",
"script_security": "3",
"up_delay": "1",
"up_restart": "1",
"persist_tun": "1",
"mute_replay_warnings": "1",
"verb": "1",
"mute": "10",
"log": "/tmp/openvpn_2693.log"
"up_delay": 1,
"up_restart": True,
"verb": 1
}
],
"tc_options": [
Expand Down

0 comments on commit afbc3a3

Please sign in to comment.