Exemplo n.º 1
0
 def remove_static_host(self, config):
     '''
     Remove a configured static host
     {'macaddress': 'xxx'}
     [{'macaddress': 'xxx'}, {'macaddress': 'xxx'}]
     '''
     settings = xmlobjects.StaticHostCollection()
     settings.parseXML(self.static_hosts)
     if isinstance(config, list):
         for cfg in config:
             settings.removeHost(cfg['macaddress'])
     else:
         settings.removeHost(config['macaddress'])
     return self.api('dhcp/static-addr-info', settings)
Exemplo n.º 2
0
 def add_static_host(self, config):
     '''
     Set static host IP Addresses
     {'macaddress': 'xxx', 'ipaddress': 'xxx'}
     [{'macaddress': 'xxx', 'ipaddress': 'xxx'}, {'macaddress': 'xxx', 'ipaddress': 'xxx'}]
     '''
     settings = xmlobjects.StaticHostCollection()
     settings.parseXML(self.static_hosts)
     if isinstance(config, list):
         for host in config:
             settings.addHost(host)
     else:
         settings.addHost(config)
     return self.api('dhcp/static-addr-info', settings)
Exemplo n.º 3
0
 def clear_static_hosts(self):
     '''
     Remove all static host settings
     '''
     return self.api('dhcp/static-addr-info',
                     xmlobjects.StaticHostCollection())