2022-09-19 12:11:55 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2022-09-18 16:07:59 +00:00
|
|
|
|
2022-09-19 12:11:55 +00:00
|
|
|
from .base import BaseType
|
2022-09-18 16:07:59 +00:00
|
|
|
|
2022-09-19 12:11:55 +00:00
|
|
|
|
|
|
|
class DeviceTypes(BaseType):
|
2022-09-21 11:03:06 +00:00
|
|
|
GENERAL = 'general', _("General")
|
2022-09-18 16:07:59 +00:00
|
|
|
SWITCH = 'switch', _("Switch")
|
|
|
|
ROUTER = 'router', _("Router")
|
|
|
|
FIREWALL = 'firewall', _("Firewall")
|
|
|
|
|
|
|
|
@classmethod
|
2022-09-19 12:11:55 +00:00
|
|
|
def _get_base_constrains(cls) -> dict:
|
|
|
|
return {
|
|
|
|
'*': {
|
2022-09-21 11:03:06 +00:00
|
|
|
'charset_enabled': False,
|
2022-09-19 12:11:55 +00:00
|
|
|
'domain_enabled': True,
|
2023-03-22 08:43:00 +00:00
|
|
|
'su_enabled': True,
|
2023-03-27 10:06:30 +00:00
|
|
|
'su_methods': ['enable', 'super', 'super_level']
|
2022-09-19 12:11:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _get_protocol_constrains(cls) -> dict:
|
|
|
|
return {
|
|
|
|
'*': {
|
2023-08-21 07:20:58 +00:00
|
|
|
'choices': ['ssh', 'telnet', 'sftp']
|
2022-09-19 12:11:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _get_automation_constrains(cls) -> dict:
|
2022-09-18 16:07:59 +00:00
|
|
|
return {
|
2022-09-19 12:11:55 +00:00
|
|
|
'*': {
|
2023-04-14 10:31:09 +00:00
|
|
|
'ansible_enabled': True,
|
2022-09-26 10:03:48 +00:00
|
|
|
'ansible_config': {
|
|
|
|
'ansible_connection': 'local',
|
2023-04-14 10:31:09 +00:00
|
|
|
'first_conn_delay_time': 0.5,
|
2022-09-26 10:03:48 +00:00
|
|
|
},
|
2023-04-14 10:31:09 +00:00
|
|
|
'ping_enabled': True,
|
2022-09-19 12:11:55 +00:00
|
|
|
'gather_facts_enabled': False,
|
|
|
|
'gather_accounts_enabled': False,
|
2023-04-14 10:31:09 +00:00
|
|
|
'verify_account_enabled': True,
|
|
|
|
'change_secret_enabled': True,
|
2023-01-16 11:02:09 +00:00
|
|
|
'push_account_enabled': False
|
2022-09-19 12:11:55 +00:00
|
|
|
}
|
2022-09-18 16:07:59 +00:00
|
|
|
}
|
2022-09-22 07:24:32 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def internal_platforms(cls):
|
|
|
|
return {
|
|
|
|
cls.GENERAL: [{'name': 'General'}, {'name': 'Cisco'}, {'name': 'Huawei'}, {'name': 'H3C'}],
|
|
|
|
cls.SWITCH: [],
|
|
|
|
cls.ROUTER: [],
|
|
|
|
cls.FIREWALL: []
|
|
|
|
}
|
2022-12-19 03:35:50 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def get_community_types(cls):
|
2022-12-22 05:50:22 +00:00
|
|
|
return [
|
|
|
|
cls.GENERAL, cls.SWITCH, cls.ROUTER, cls.FIREWALL
|
|
|
|
]
|