@@ -24,7 +24,7 @@ def get(self, request, device_id):
2424
2525 unified_interfaces = [UnifiedInterface (i .id , i .name , i .type , i .get_type_display ()) for i in interfaces ]
2626 unified_interface_templates = [
27- UnifiedInterface (i .id , i .name , i .type , i .get_type_display (), is_template = True ) for i in interface_templates ]
27+ UnifiedInterface (i .id , i .name , i .type , i .get_type_display (), i . mgmt_only , is_template = True ) for i in interface_templates ]
2828
2929 # List of interfaces and interface templates presented in the unified format
3030 overall_interfaces = list (set (unified_interface_templates + unified_interfaces ))
@@ -79,19 +79,19 @@ def post(self, request, device_id):
7979 # Add selected interfaces to the device and count them
8080 add_to_device_interfaces = InterfaceTemplate .objects .filter (id__in = add_to_device )
8181 interfaces_created = len (Interface .objects .bulk_create ([
82- Interface (device = device , name = i .name , type = i .type ) for i in add_to_device_interfaces
82+ Interface (device = device , name = i .name , type = i .type , mgmt_only = i . mgmt_only ) for i in add_to_device_interfaces
8383 ]))
8484
8585 # Getting and validating a list of interfaces to rename
8686 fix_name_interfaces = filter (lambda i : str (i .id ) in request .POST .getlist ("fix_name" ), interfaces )
8787 # Casting interface templates into UnifiedInterface objects for proper comparison with interfaces for renaming
8888 unified_interface_templates = [
89- UnifiedInterface (i .id , i .name , i .type , i .get_type_display ()) for i in interface_templates ]
89+ UnifiedInterface (i .id , i .name , i .type ,i . mgmt_only , i .get_type_display ()) for i in interface_templates ]
9090
9191 # Rename selected interfaces
9292 interfaces_fixed = 0
9393 for interface in fix_name_interfaces :
94- unified_interface = UnifiedInterface (interface .id , interface .name , interface .type , interface .get_type_display ())
94+ unified_interface = UnifiedInterface (interface .id , interface .name , interface .type , interface .mgmt_only , interface . get_type_display ())
9595 try :
9696 # Try to extract an interface template with the corresponding name
9797 corresponding_template = unified_interface_templates [unified_interface_templates .index (unified_interface )]
0 commit comments