-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathswitch_manager.py
More file actions
56 lines (54 loc) · 1.72 KB
/
switch_manager.py
File metadata and controls
56 lines (54 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import logging
logger = logging.getLogger(__name__)
def get_switch_ports_status():
"""
Returns sample switch port data for demonstration
"""
try:
# Sample data to demonstrate the interface
return [
{
'name': 'GigabitEthernet1/0/1',
'status': 'connected',
'vlan': '10',
'speed': '1000Mb/s',
'duplex': 'full',
'description': 'Server Room - Main Server'
},
{
'name': 'GigabitEthernet1/0/2',
'status': 'notconnect',
'vlan': '20',
'speed': 'auto',
'duplex': 'auto',
'description': 'Conference Room AP'
},
{
'name': 'GigabitEthernet1/0/3',
'status': 'connected',
'vlan': '30',
'speed': '100Mb/s',
'duplex': 'full',
'description': 'Printer - HR Department'
},
{
'name': 'GigabitEthernet1/0/4',
'status': 'disabled',
'vlan': 'trunk',
'speed': 'auto',
'duplex': 'auto',
'description': 'Unused Port'
},
{
'name': 'GigabitEthernet1/0/5',
'status': 'connected',
'vlan': '10',
'speed': '1000Mb/s',
'duplex': 'full',
'description': 'Development Team Switch'
}
]
except Exception as e:
logger.error(f"Error generating sample data: {str(e)}")
raise Exception(f"Error generating sample data: {str(e)}")