Пример #1
0
    def ShowIPAddress(self, initial_load=False):
        Inter = Int()
        with open(f'{HOME_DIR}/data/config.json', 'r') as settings:
            setting = json.load(settings)
        interface_settings = setting['settings']['interface']
        default_wan_mac = interface_settings['wan']['default_mac']
        configured_wan_mac = interface_settings['wan']['configured_mac']
        dhcp = interface_settings['wan']['dhcp']
        wan_int = interface_settings['outside']
        if (not configured_wan_mac):
            configured_wan_mac = default_wan_mac
        if (dhcp):
            wan_mode = 'dhcp'
        else:
            wan_mode = 'static'

        wan_ip = Inter.IP(wan_int)
        wan_netmask = Inter.Netmask(wan_int)
        wan_dfg = Inter.DefaultGateway(wan_int)
        if (initial_load):
            self.interface_settings_pending['mode'].update(
                {'setting': wan_mode})
        else:
            self.Standard.ShowSend('ip-address', wan_ip)
            self.Standard.ShowSend('netmask', wan_netmask)
            self.Standard.ShowSend('default-gateway', wan_dfg)
            self.Standard.ShowSend('mode', wan_mode)
Пример #2
0
 def InterfaceInfo(self):
     Int = Interface()
     insideip = Int.IP(self.insideint)
     netmask = Int.Netmask(self.insideint)
     broadcast = Int.Broadcast(self.insideint)
     mtu = Int.MTU(self.insideint)
     
     return(insideip, netmask, broadcast, mtu)
Пример #3
0
    def InterfaceInfo(self):
        Interface = Int()
        insideip = Interface.IP(self.lan_int)
        netmask = Interface.Netmask(self.lan_int)
        broadcast = Interface.Broadcast(self.lan_int)
        mtu = Interface.MTU(self.lan_int)

        return(insideip, netmask, broadcast, mtu)