{%
    -- 输出SLAAC地址
    local function get_slaac_ipv6_info(addr_list)
        for i = 1, #addr_list do
            echo(string.format("IPv6 Address %-2d           :  %s\n", i + 1, addr_list[i]))
        end
    end

    local function get_net_mode(net_mode)
        if net_mode == 'Automatic' then
            return 'Adaptive'
        end

        if net_mode == 'Fixed' then
            return 'Manual'
        end

        return 'Unknown'
    end

    local function printEthGroupsData(i, eth_group)
        local eth_group_id = i + 1
        echo(string.format('EthGroup ID               :  %d\n', eth_group_id))
        echo(string.format('LAN Channel Number        :  %d\n', eth_group.Channel))
        echo(string.format('Net Mode                  :  %s\n', get_net_mode(eth_group.NetMode)))
        echo(string.format('Net Type                  :  %s\n', eth_group.ActivePort.Type))

        local ethName = "eth" .. tostring(eth_group.ActiveEthId)
        if eth_group.ActivePort.Type == 'Dedicated' then  
            echo('Active Port               :  ' .. ethName .. '\n')
        end
        if eth_group.ActivePort.Type ~= 'Dedicated' then      
            echo('Net Port                  :  ' .. eth_group.ActivePort.DevicePortId .. '\n')
        end
        local ipmode_ipv4 = string.lower(eth_group.IpMode)
        local ipmode_ipv6 = eth_group.Ipv6Mode == 'Static' and 'static' or 'dhcp'
        local Ipv6_addr = ''
        if type(eth_group.Ipv6Addr) == 'string' and string.len(eth_group.Ipv6Addr) > 0 then
            Ipv6_addr = eth_group.Ipv6Addr .. '/' .. eth_group.Ipv6PrefixLength
        end
        echo(string.format('IP Version                :  %s\n', eth_group.IpVersion))
        echo('IPv4 Information\n')
        echo(string.format('IP Mode                   :  %s\n', ipmode_ipv4))
        echo(string.format('IP Address                :  %s\n', eth_group.IpAddr))
        echo(string.format('Subnet Mask               :  %s\n', eth_group.SubnetMask))
        echo(string.format('Default Gateway           :  %s\n', eth_group.DefaultGateway))
        echo(string.format('Backup IP Address         :  %s (%s)\n', eth_group.BackupIpAddr, "Deactivated"))
        echo(string.format('Backup Subnet Mask        :  %s (%s)\n', eth_group.BackupSubnetMask, "Deactivated"))
        echo(string.format('MAC Address               :  %s\n', eth_group.Mac))
        echo('IPv6 Information\n')
        echo(string.format('IPv6 Mode                 :  %s\n', ipmode_ipv6))
        echo(string.format('IPv6 Address 1            :  %s\n', Ipv6_addr))
        echo(string.format('Default Gateway IPv6      :  %s\n', eth_group.Ipv6DefaultGateway))
        echo(string.format('Link-Local Address        :  %s\n', eth_group.LinkLocalAddress))
        get_slaac_ipv6_info(eth_group.SLAACAddressList)
        echo('\n')
    end

    if ActivePort.Type == 'Unknown' then
        echo("EthGroup ID               :  1\n")
        echo(string.format('NetMode                   :  %s\n', get_net_mode(NetMode)))
        echo("Net Type                  :  Unknown\n")
        echo("Net Port                  :  Unknown\n")
        echo("Get activeport failed\n")
        echo("Get IPinformation failed")
    else
        local ipmode_ipv4 = string.lower(IpModeIpv4)
        local ipmode_ipv6 = IpModeIpv6 == 'Static' and 'static' or 'dhcp'
        local Ipv6_addr = ''
        if type(IpAddrIpv6) == 'string' and string.len(IpAddrIpv6) > 0 then
            Ipv6_addr = IpAddrIpv6 .. '/' .. PrefixLength
        end
        local backup_ip_state = 'Deactivated'
        if BackupIpActivated == true then
            backup_ip_state = 'Activated'
        end
        echo('EthGroup ID               :  1\n')
        echo(string.format('LAN Channel Number        :  %d\n', Channel))
        echo(string.format('Net Mode                  :  %s\n', get_net_mode(NetMode)))
        echo(string.format('Net Type                  :  %s\n', ActivePort.Type))
        if ActivePort.Type == 'Dedicated' then  
            echo('Active Port               :  ' .. EthName .. '\n')
        end
        if ActivePort.Type ~= 'Dedicated' then      
            echo('Net Port                  :  ' .. ActivePort.DevicePortId .. '\n')
        end
        echo(string.format('IP Version                :  %s\n', IpVersion))
        echo('IPv4 Information\n')
        echo(string.format('IP Mode                   :  %s\n', ipmode_ipv4))
        echo(string.format('IP Address                :  %s\n', IpAddrIpv4))
        echo(string.format('Subnet Mask               :  %s\n', SubnetMask))
        echo(string.format('Default Gateway           :  %s\n', DefaultGatewayIpv4))
        echo(string.format('Backup IP Address         :  %s (%s)\n', BackupIpAddrIpv4, backup_ip_state))
        echo(string.format('Backup Subnet Mask        :  %s (%s)\n', BackupSubnetMaskIpv4, backup_ip_state))
        echo(string.format('MAC Address               :  %s\n', Mac))
        echo('IPv6 Information\n')
        echo(string.format('IPv6 Mode                 :  %s\n', ipmode_ipv6))
        echo(string.format('IPv6 Address 1            :  %s\n', Ipv6_addr))
        echo(string.format('Default Gateway IPv6      :  %s\n', DefaultGatewayIpv6))
        echo(string.format('Link-Local Address        :  %s\n', LinkLocalAddress))
        get_slaac_ipv6_info(SLAACAddressList)
        echo('\n')

        for i, ethGroup in ipairs(EthernetInterfaceGroups) do
            printEthGroupsData(i, ethGroup)
        end

        echo('VLAN Information\n')
        echo(string.format('NCSI Port VLAN State      :  %s\n', NCSIVLANEnable == true and 'enabled' or 'disabled'))
        if NCSIVLANEnable == true then    
            echo('NCSI Port VLAN ID         :  ' .. NCSIVLANId .. '\n')
        end
        echo(string.format('Dedicated Port VLAN State :  %s\n', DedicatedVLANEnable == true and 'enabled' or 'disabled'))
        if DedicatedVLANEnable == true then 
            echo('Dedicated Port VLAN ID    :  ' .. DedicatedVLANId .. '\n')
        end
        
    end
%}
