예제 #1
0
 def dhcp_dnsserver_default_router(self, action, service, name, addr):
     if not vld.testip(addr) or not vld.addrvalidation(addr):
         return False
     if service == 'default_router':
         suffix = ["default-router", addr]
     elif service == "dns_server":
         suffix = ["dns-server", addr]
     subnet = self.get_subnet_from_name(name)
     return self.dhcp_subnet(action, name, subnet, suffix)
예제 #2
0
 def define_local_remote_host(self,action,iface,pos,host):
     if pos not in self.pos:
         logger.error("given pos %s is not valid!"%pos)
         return False
     if (pos == 'local' and vld.addrvalidation(host)) or pos == 'remote':
         suffix=[pos+"-host",host]
         return self.openvpn_config(iface,action,suffix)
     else:
         raise AddressError("No such address already configured locally!")
예제 #3
0
 def dhcp_dnsserver_default_router(self,action,service,name,addr):
     if not vld.testip(addr) or not vld.addrvalidation(addr):
         return False
     if service == 'default_router':
         suffix=["default-router",addr]
     elif service == "dns_server":
         suffix=["dns-server",addr]
     subnet=self.get_subnet_from_name(name)
     return self.dhcp_subnet(action,name,subnet,suffix)
예제 #4
0
 def add_addr_route(self, dst_subnet, nexthop=""):
     if not vld.testip(dst_subnet):
         return False
     addr_params = [dst_subnet + "/24"]
     if nexthop == "":
         addr_params.append("blackhole distance 1")
     else:
         if not vld.addrvalidation(nexthop):
             return False
         addr_params.extend(["next-hop", nexthop])
     return self.route("set", "route", addr_params)
예제 #5
0
 def add_addr_route(self,dst_subnet,nexthop=""):
     if not vld.testip(dst_subnet):
         return False
     addr_params=[dst_subnet+"/24"]
     if nexthop=="":
         addr_params.append("blackhole distance 1")
     else:
         if not vld.addrvalidation(nexthop):
             return False
         addr_params.extend(["next-hop",nexthop])
     return self.route("set","route",addr_params)