Skip to content
Snippets Groups Projects
OpenVPN_DM.json 5.08 KiB
Newer Older
{
	"Device.{BBF_VENDOR_PREFIX}OpenVPN.": {
		"type": "object",
		"protocols": [
			"usp"
		],
		"access": false,
		"array": false,
		"ImportOvpn()": {
			"type": "command",
			"async": true,
			"protocols": [
				"usp"
			],
			"input": {
				"Name": {
					"type": "string",
					"read": "true",
					"write": "true",
					"protocol": [
						"usp"
					]
				},
				"URL": {
					"type": "string",
					"read": "true",
					"write": "true",
					"protocol": [
						"usp"
					]
				},
				"Username": {
					"type": "string",
					"read": "true",
					"write": "true",
					"protocol": [
						"usp"
					]
				},
				"Password": {
					"type": "string",
					"read": "true",
					"write": "true",
					"protocol": [
						"usp"
					]
					"type": "string",
					"read": "true",
					"write": "true",
					"protocol": [
						"usp"
					]
				},
				"Status": {
					"type": "string",
					"read": "true",
					"write": "true",
					"protocol": [
						"usp"
					]
				}
			},
			"mapping": [
				{
					"type": "ubus",
					"ubus": {
						"object": "openvpn",
						"method": "import_ovpn",
						"args": {
							"name": "@Input.Name",
							"url": "@Input.URL",
							"user": "@Input.Username",
							"pass": "@Input.Password"
		"ClientNumberOfEntries": {
			"type": "unsignedInt",
			"read": true,
			"write": false,
			"version": "2.14",
			"protocols": [
				"usp"
			],
			"description": "<<numentries>>",
			"mapping": [
				{
					"type": "uci",
					"uci": {
						"file": "openvpn",
						"section": {
							"type": "openvpn"
						},
						"option": {
							"name": "@Count"
						}
					}
				}
			]	
		},
		"Device.{BBF_VENDOR_PREFIX}OpenVPN.Client.{i}.": {
			"type": "object",
			"protocols": [
				"usp"
			],
			"access": true,
			"array": true,
			"mapping": {
				"type": "uci",
				"uci": {
					"file": "openvpn",
					"section": {
						"type": "openvpn"
					},
					"dmmapfile": "dmmap_openvpn"
				}
			},
			"Enable": {
				"type": "boolean",
				"read": true,
				"write": true,
				"protocols": [
					"usp"
				],
				"mapping": [
					{
						"type": "uci",
						"uci": {
							"file": "openvpn",
							"section": {
								"type": "openvpn"
							},
							"option": {
								"name": "enabled"
							}
						}
					}
				]
			},
			"Name": {
				"type": "string",
				"read": true,
				"write": false,
				"protocols": [
					"usp"
				],
				"mapping": [
					{
						"type": "uci",
						"uci": {
							"file": "openvpn",
							"section": {
								"type": "openvpn"
							},
							"option": {
								"name": "@Name"
							}
						}
					}
				]
			},
			"Status": {
				"type": "string",
				"read": true,
				"write": false,
				"protocols": [
					"usp"
				],
				"mapping": [
					{
						"type": "ubus",
						"ubus": {
							"object": "openvpn",
							"method": "status",
							"args": {
								"instance": "@Name"
							},
							"key": "Status"
						}
					}
				]
			},
			"Username": {
				"type": "string",
				"read": true,
				"write": true,
				"protocols": [
					"usp"
				],
				"mapping": [
					{
						"type": "uci",
						"uci": {
							"file": "openvpn",
							"section": {
								"type": "openvpn"
							},
							"option": {
								"name": "username"
							}
						}
					}
				]
			},
			"Password": {
				"type": "string",
				"read": true,
				"write": true,
				"protocols": [
					"usp"
				],
				"flags": [
					"Secure"
				],
				"mapping": [
					{
						"type": "uci",
						"uci": {
							"file": "openvpn",
							"section": {
								"type": "openvpn"
							},
							"option": {
								"name": "password"
							}
						}
					}
				]
			},
			"Connect()": {
				"type": "command",
				"async": true,
				"protocols": [
					"usp"
				],
				"input": {
					"Username": {
						"type": "string",
						"read": "true",
						"write": "true",
						"protocol": [
							"usp"
						]
					},
					"Password": {
						"type": "string",
						"read": "true",
						"write": "true",
						"protocol": [
							"usp"
						]
					},
					"Store": {
						"type": "boolean",
						"read": "true",
						"write": "true",
						"protocol": [
							"usp"
						]
					}
				},
				"output": {
					"Status": {
						"type": "string",
						"read": "true",
						"write": "true",
						"protocol": [
							"usp"
						]
					}
				},
				"mapping": [
					{
						"type": "ubus",
						"ubus": {
							"object": "openvpn",
							"method": "connect",
							"args": {
								"instance": "@Name",
								"username": "@Input.Username",
								"password": "@Input.Password",
								"store": "@Input.Store"
							}
						}
					}
				]
			},
			"Disconnect()": {
				"type": "command",
				"async": true,
				"protocols": [
					"usp"
				],
				"input": {},
				"output": {
					"Status": {
						"type": "string",
						"read": "true",
						"write": "true",
						"protocol": [
							"usp"
						]
					}
				},
				"mapping": [
					{
						"type": "ubus",
						"ubus": {
							"object": "openvpn",
							"method": "disconnect",
							"args": {
								"instance": "@Name"
							}
						}
					}
				]
			}
		}
	}
}