def _set_interface_hex(interface, trunk_vlans): try: allowedvlan = interface.swportallowedvlan except SwPortAllowedVlan.DoesNotExist: allowedvlan = SwPortAllowedVlan(interface=interface) allowedvlan.set_allowed_vlans(trunk_vlans) allowedvlan.save()
def vlan_list_to_hex(vlans): """Convert a list of VLAN numbers to a hexadecimal string.""" return SwPortAllowedVlan.vlan_list_to_hex(vlans)