Beispiel #1
0
 def _save_trunk_interface(interface: manage.Interface, native_vlan: int,
                           trunk_vlans: Sequence[int]):
     """Updates the Interface entry in the database with trunk config"""
     interface.trunk = True
     interface.vlan = native_vlan
     allowedvlan, _ = manage.SwPortAllowedVlan.objects.get_or_create(
         interface=interface)
     allowedvlan.set_allowed_vlans(trunk_vlans)
     allowedvlan.save()
     interface.save()
Beispiel #2
0
 def _save_access_interface(interface: manage.Interface, access_vlan: int):
     """Updates the Interface entry in the database with access config"""
     interface.trunk = False
     interface.vlan = access_vlan
     try:
         allowedvlans = interface.swportallowedvlan
         allowedvlans.save()
     except manage.SwPortAllowedVlan.DoesNotExist:
         pass
     interface.save()