You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/assets/const/device.py

64 lines
1.8 KiB

2 years ago
from django.utils.translation import gettext_lazy as _
2 years ago
from .base import BaseType
2 years ago
class DeviceTypes(BaseType):
GENERAL = 'general', _("General")
SWITCH = 'switch', _("Switch")
ROUTER = 'router', _("Router")
FIREWALL = 'firewall', _("Firewall")
@classmethod
2 years ago
def _get_base_constrains(cls) -> dict:
return {
'*': {
'charset_enabled': False,
2 years ago
'domain_enabled': True,
'su_enabled': True,
'su_methods': ['enable', 'super', 'super_level']
2 years ago
}
}
@classmethod
def _get_protocol_constrains(cls) -> dict:
return {
'*': {
'choices': ['ssh', 'telnet', 'sftp']
2 years ago
}
}
@classmethod
def _get_automation_constrains(cls) -> dict:
return {
2 years ago
'*': {
'ansible_enabled': True,
'ansible_config': {
'ansible_connection': 'local',
'first_conn_delay_time': 0.5,
},
'ping_enabled': True,
2 years ago
'gather_facts_enabled': False,
'gather_accounts_enabled': False,
'verify_account_enabled': True,
'change_secret_enabled': True,
'push_account_enabled': False,
'remove_account_enabled': False,
2 years ago
}
}
@classmethod
def internal_platforms(cls):
return {
cls.GENERAL: [{'name': 'General'}, {'name': 'Cisco'}, {'name': 'Huawei'}, {'name': 'H3C'}],
cls.SWITCH: [],
cls.ROUTER: [],
cls.FIREWALL: []
}
@classmethod
def get_community_types(cls):
return [
cls.GENERAL, cls.SWITCH, cls.ROUTER, cls.FIREWALL
]