def __init__(self, args_str=None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if self._args.rec_ttl < 0 or self._args.rec_ttl > 2147483647: print 'Invalid ttl value ', self._args.rec_ttl return if not DnsProvisioner.is_valid_ipv4_address(self._args.api_server_ip): print 'Invalid IPv4 address ', self._args.api_server_ip return rec_name = self._args.rec_name if self._args.rec_type == 'A': vstr = self._args.rec_name if not DnsProvisioner.is_valid_ipv4_address(self._args.rec_data): print 'Invalid Ipv4 address ', self._args.rec_data return elif self._args.rec_type == 'AAAA': vstr = self._args.rec_name if not DnsProvisioner.is_valid_ipv6_address(self._args.rec_data): print 'Invalid Ipv6 address ', self._args.rec_data return elif self._args.rec_type == 'PTR': vstr = self._args.rec_data if (not rec_name.endswith('.in-addr.arpa') and not rec_name.endswith('.ip6.arpa')): if (not DnsProvisioner.is_valid_ipv4_address(rec_name) and not DnsProvisioner.is_valid_ipv6_address(rec_name)): print 'Invalid PTR record name ', self._args.rec_name return elif self._args.rec_type == 'NS' or self._args.rec_type == 'MX' or self._args.rec_type == 'CNAME': vstr = self._args.rec_name if not DnsProvisioner.is_valid_dns_name(vstr): print 'DNS name requirements are not satisfied by ', vstr return try: dp_obj = DnsProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) except ConnectionError: print 'Connection to API server failed ' return dp_obj.add_virtual_dns_record(self._args.name, self._args.vdns_fqname, rec_name, self._args.rec_type, self._args.rec_class, self._args.rec_data, self._args.rec_ttl)
def __init__(self, args_str=None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if self._args.ipam_dns_method == "none" or self._args.ipam_dns_method == "default-dns-server": if self._args.vdns_fqname: print( 'vdns_fqname should not be configured when ipam_dns_method is none/default-dns-server' ) return if self._args.tenant_dns_servers: print( 'tenant_dns_servers should not be configured when ipam_dns_method is none/default-dns-server' ) return ipam_dns_srv_obj = None if self._args.ipam_dns_method == "virtual-dns-server": if not self._args.vdns_fqname: print( 'vdns_fqname is mandatory for ipam method of virtual-dns-server' ) return ipam_dns_srv_obj = IpamDnsAddressType( virtual_dns_server_name=self._args.vdns_fqname) elif self._args.ipam_dns_method == "tenant-dns-server": if not self._args.tenant_dns_servers: print( 'tenant-dns-servers is mandatory for ipam method of tenant-dns-server' ) return dict_servers = {} dict_servers['ip_address'] = self._args.tenant_dns_servers ipam_dns_srv_obj = IpamDnsAddressType( tenant_dns_server_address=dict_servers, virtual_dns_server_name=None) try: dp_obj = DnsProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) except ConnectionError: print('Connection to API server failed ') return dp_obj.associate_vdns_with_ipam(self._args.ipam_fqname, self._args.ipam_dns_method, ipam_dns_srv_obj)
def __init__(self, args_str = None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if not self._args.ttl: self._args.ttl = 86400 if self._args.ttl < 0 or self._args.ttl > 2147483647: print 'Invalid ttl value ' , self._args.ttl return if not DnsProvisioner.is_valid_ipv4_address(self._args.api_server_ip): print 'Invalid IPv4 address ', self._args.api_server_ip return if not DnsProvisioner.is_valid_dns_name(self._args.dns_domain): print 'Domain name does not satisfy DNS name requirements: ', self._args.dns_domain return try: dp_obj = DnsProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) except ConnectionError: print 'Connection to API server failed ' return if self._args.dyn_updates: dyn_updates = 'true' else: dyn_updates = 'false' if self._args.external_visible: external_visible = 'true' else: external_visible = 'false' if self._args.reverse_resolution: reverse_resolution = 'true' else: reverse_resolution = 'false' dp_obj.add_virtual_dns(self._args.name, self._args.domain_name, self._args.dns_domain, dyn_updates, self._args.record_order, self._args.ttl, self._args.next_vdns, self._args.floating_ip_record, external_visible, reverse_resolution)
def __init__(self, args_str = None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) try: dp_obj = DnsProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) except ConnectionError: print 'Connection to API server failed ' return dp_obj.del_virtual_dns_record(self._args.fq_name)
def __init__(self, args_str = None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) try: dp_obj = DnsProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) except ConnectionError: print('Connection to API server failed ') return dp_obj.disassociate_vdns_from_ipam(self._args.ipam_fqname, self._args.vdns_fqname)
def __init__(self, args_str = None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) try: dp_obj = DnsProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) except ConnectionError: print 'Connection to API server failed ' return dp_obj.disassociate_vdns_from_ipam(self._args.ipam_fqname, self._args.vdns_fqname)
def __init__(self, args_str = None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if self._args.rec_ttl < 0 or self._args.rec_ttl > 2147483647: print 'Invalid ttl value ' , self._args.rec_ttl return if not DnsProvisioner.is_valid_ipv4_address(self._args.api_server_ip): print 'Invalid IPv4 address ', self._args.api_server_ip return rec_name = self._args.rec_name if self._args.rec_type == 'A': vstr = self._args.rec_name if not DnsProvisioner.is_valid_ipv4_address(self._args.rec_data): print 'Invalid Ipv4 address ', self._args.rec_data return elif self._args.rec_type == 'AAAA': vstr = self._args.rec_name if not DnsProvisioner.is_valid_ipv6_address(self._args.rec_data): print 'Invalid Ipv6 address ', self._args.rec_data return elif self._args.rec_type == 'PTR': vstr = self._args.rec_data if (not rec_name.endswith('.in-addr.arpa') and not rec_name.endswith('.ip6.arpa')): if (not DnsProvisioner.is_valid_ipv4_address(rec_name) and not DnsProvisioner.is_valid_ipv6_address(rec_name)): print 'Invalid PTR record name ', self._args.rec_name return elif self._args.rec_type == 'NS' or self._args.rec_type == 'MX' or self._args.rec_type == 'CNAME': vstr = self._args.rec_name if not DnsProvisioner.is_valid_dns_name(vstr): print 'DNS name requirements are not satisfied by ', vstr return try: dp_obj = DnsProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) except ConnectionError: print 'Connection to API server failed ' return dp_obj.add_virtual_dns_record(self._args.name, self._args.vdns_fqname, rec_name, self._args.rec_type, self._args.rec_class, self._args.rec_data, self._args.rec_ttl)
def __init__(self, args_str=None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) try: dp_obj = DnsProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) except ConnectionError: print('Connection to API server failed ') return dp_obj.del_virtual_dns_record(self._args.fq_name)
def __init__(self, args_str = None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if self._args.ipam_dns_method == "none" or self._args.ipam_dns_method == "default-dns-server": if self._args.vdns_fqname: print 'vdns_fqname should not be configured when ipam_dns_method is none/default-dns-server' return if self._args.tenant_dns_servers: print 'tenant_dns_servers should not be configured when ipam_dns_method is none/default-dns-server' return ipam_dns_srv_obj = None if self._args.ipam_dns_method == "virtual-dns-server": if not self._args.vdns_fqname: print 'vdns_fqname is mandatory for ipam method of virtual-dns-server' return ipam_dns_srv_obj = IpamDnsAddressType(virtual_dns_server_name=self._args.vdns_fqname) elif self._args.ipam_dns_method == "tenant-dns-server": if not self._args.tenant_dns_servers: print 'tenant-dns-servers is mandatory for ipam method of tenant-dns-server' return dict_servers = {} dict_servers['ip_address']=self._args.tenant_dns_servers ipam_dns_srv_obj = IpamDnsAddressType(tenant_dns_server_address=dict_servers, virtual_dns_server_name=None) try: dp_obj = DnsProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) except ConnectionError: print 'Connection to API server failed ' return dp_obj.associate_vdns_with_ipam(self._args.ipam_fqname, self._args.ipam_dns_method, ipam_dns_srv_obj)
def __init__(self, args_str=None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if not self._args.ttl: self._args.ttl = 86400 if self._args.ttl < 0 or self._args.ttl > 2147483647: print('Invalid ttl value ', self._args.ttl) return if not DnsProvisioner.is_valid_ipv4_address(self._args.api_server_ip): print('Invalid IPv4 address ', self._args.api_server_ip) return if not DnsProvisioner.is_valid_dns_name(self._args.dns_domain): print('Domain name does not satisfy DNS name requirements: ', self._args.dns_domain) return try: dp_obj = DnsProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) except ConnectionError: print('Connection to API server failed ') return if self._args.dyn_updates: dyn_updates = True else: dyn_updates = False if self._args.external_visible: external_visible = True else: external_visible = False if self._args.reverse_resolution: reverse_resolution = True else: reverse_resolution = False dp_obj.add_virtual_dns(self._args.name, self._args.domain_name, self._args.dns_domain, dyn_updates, self._args.record_order, self._args.ttl, self._args.next_vdns, self._args.floating_ip_record, external_visible, reverse_resolution)