def get_config(): conf = Config() conf.set_level("service broadcast-relay id") relay_id = conf.list_nodes("") relays = [] for id in relay_id: interface_list = [] address = conf.return_value("{0} address".format(id)) description = conf.return_value("{0} description".format(id)) port = conf.return_value("{0} port".format(id)) # split the interface name listing and form a list if conf.exists("{0} interface".format(id)): intfs_names = conf.return_values("{0} interface".format(id)) intfs_names = intfs_names.replace("'", "") intfs_names = intfs_names.split() for name in intfs_names: interface_list.append(name) relay = { "id": id, "address": address, "description": description, "interfaces": interface_list, "port": port } relays.append(relay) return relays
def get_config(): salt = deepcopy(default_config_data) conf = Config() base = ['service', 'salt-minion'] if not conf.exists(base): return None else: conf.set_level(base) if conf.exists(['hash']): salt['hash'] = conf.return_value(['hash']) if conf.exists(['master']): salt['master'] = conf.return_values(['master']) if conf.exists(['id']): salt['salt_id'] = conf.return_value(['id']) if conf.exists(['user']): salt['user'] = conf.return_value(['user']) if conf.exists(['interval']): salt['interval'] = conf.return_value(['interval']) if conf.exists(['master-key']): salt['master_key'] = conf.return_value(['master-key']) salt['verify_master_pubkey_sign'] = 'true' return salt
def get_config(): conf = Config() mroute = {'old_mroute': {}, 'mroute': {}} base_path = "protocols static multicast" if not (conf.exists(base_path) or conf.exists_effective(base_path)): return None conf.set_level(base_path) # Get multicast effective routes for route in conf.list_effective_nodes('route'): mroute['old_mroute'][route] = {} for next_hop in conf.list_effective_nodes( 'route {0} next-hop'.format(route)): mroute['old_mroute'][route].update({ next_hop: conf.return_value('route {0} next-hop {1} distance'.format( route, next_hop)) }) # Get multicast effective interface-routes for route in conf.list_effective_nodes('interface-route'): if not route in mroute['old_mroute']: mroute['old_mroute'][route] = {} for next_hop in conf.list_effective_nodes( 'interface-route {0} next-hop-interface'.format(route)): mroute['old_mroute'][route].update({ next_hop: conf.return_value( 'interface-route {0} next-hop-interface {1} distance'. format(route, next_hop)) }) # Get multicast routes for route in conf.list_nodes('route'): mroute['mroute'][route] = {} for next_hop in conf.list_nodes('route {0} next-hop'.format(route)): mroute['mroute'][route].update({ next_hop: conf.return_value('route {0} next-hop {1} distance'.format( route, next_hop)) }) # Get multicast interface-routes for route in conf.list_nodes('interface-route'): if not route in mroute['mroute']: mroute['mroute'][route] = {} for next_hop in conf.list_nodes( 'interface-route {0} next-hop-interface'.format(route)): mroute['mroute'][route].update({ next_hop: conf.return_value( 'interface-route {0} next-hop-interface {1} distance'. format(route, next_hop)) }) return mroute
def get_config(): config = Config() data = {"install_routes": "yes"} if config.exists("vpn ipsec options disable-route-autoinstall"): data["install_routes"] = "no" if config.exists("vpn ipsec ipsec-interfaces interface"): data["ipsec_interfaces"] = config.return_values("vpn ipsec ipsec-interfaces interface") # Init config variables data["delim_ipsec_l2tp_begin"] = delim_ipsec_l2tp_begin data["delim_ipsec_l2tp_end"] = delim_ipsec_l2tp_end data["ipsec_ra_conn_file"] = ipsec_ra_conn_file data["ra_conn_name"] = ra_conn_name # Get l2tp ipsec settings data["ipsec_l2tp"] = False conf_ipsec_command = "vpn l2tp remote-access ipsec-settings " #last space is useful if config.exists(conf_ipsec_command): data["ipsec_l2tp"] = True # Authentication params if config.exists(conf_ipsec_command + "authentication mode"): data["ipsec_l2tp_auth_mode"] = config.return_value(conf_ipsec_command + "authentication mode") if config.exists(conf_ipsec_command + "authentication pre-shared-secret"): data["ipsec_l2tp_secret"] = config.return_value(conf_ipsec_command + "authentication pre-shared-secret") # mode x509 if config.exists(conf_ipsec_command + "authentication x509 ca-cert-file"): data["ipsec_l2tp_x509_ca_cert_file"] = config.return_value(conf_ipsec_command + "authentication x509 ca-cert-file") if config.exists(conf_ipsec_command + "authentication x509 crl-file"): data["ipsec_l2tp_x509_crl_file"] = config.return_value(conf_ipsec_command + "authentication x509 crl-file") if config.exists(conf_ipsec_command + "authentication x509 server-cert-file"): data["ipsec_l2tp_x509_server_cert_file"] = config.return_value(conf_ipsec_command + "authentication x509 server-cert-file") data["server_cert_file_copied"] = server_cert_path+"/"+re.search('\w+(?:\.\w+)*$', config.return_value(conf_ipsec_command + "authentication x509 server-cert-file")).group(0) if config.exists(conf_ipsec_command + "authentication x509 server-key-file"): data["ipsec_l2tp_x509_server_key_file"] = config.return_value(conf_ipsec_command + "authentication x509 server-key-file") data["server_key_file_copied"] = server_key_path+"/"+re.search('\w+(?:\.\w+)*$', config.return_value(conf_ipsec_command + "authentication x509 server-key-file")).group(0) if config.exists(conf_ipsec_command + "authentication x509 server-key-password"): data["ipsec_l2tp_x509_server_key_password"] = config.return_value(conf_ipsec_command + "authentication x509 server-key-password") # Common l2tp ipsec params if config.exists(conf_ipsec_command + "ike-lifetime"): data["ipsec_l2tp_ike_lifetime"] = config.return_value(conf_ipsec_command + "ike-lifetime") else: data["ipsec_l2tp_ike_lifetime"] = "3600" if config.exists(conf_ipsec_command + "lifetime"): data["ipsec_l2tp_lifetime"] = config.return_value(conf_ipsec_command + "lifetime") else: data["ipsec_l2tp_lifetime"] = "3600" if config.exists("vpn l2tp remote-access outside-address"): data['outside_addr'] = config.return_value('vpn l2tp remote-access outside-address') return data
def get_config(): conf = Config() igmp_conf = {'igmp_conf': False, 'old_ifaces': {}, 'ifaces': {}} if not (conf.exists('protocols igmp') or conf.exists_effective('protocols igmp')): return None if conf.exists('protocols igmp'): igmp_conf['igmp_conf'] = True conf.set_level('protocols igmp') # # Get interfaces for iface in conf.list_effective_nodes('interface'): igmp_conf['old_ifaces'].update({ iface: { 'version': conf.return_effective_value( 'interface {0} version'.format(iface)), 'query_interval': conf.return_effective_value( 'interface {0} query-interval'.format(iface)), 'query_max_resp_time': conf.return_effective_value( 'interface {0} query-max-response-time'.format(iface)), 'gr_join': {} } }) for gr_join in conf.list_effective_nodes( 'interface {0} join'.format(iface)): igmp_conf['old_ifaces'][iface]['gr_join'][ gr_join] = conf.return_effective_values( 'interface {0} join {1} source'.format(iface, gr_join)) for iface in conf.list_nodes('interface'): igmp_conf['ifaces'].update({ iface: { 'version': conf.return_value('interface {0} version'.format(iface)), 'query_interval': conf.return_value( 'interface {0} query-interval'.format(iface)), 'query_max_resp_time': conf.return_value( 'interface {0} query-max-response-time'.format(iface)), 'gr_join': {} } }) for gr_join in conf.list_nodes('interface {0} join'.format(iface)): igmp_conf['ifaces'][iface]['gr_join'][ gr_join] = conf.return_values( 'interface {0} join {1} source'.format(iface, gr_join)) return igmp_conf
def get_config(): geneve = deepcopy(default_config_data) conf = Config() # determine tagNode instance if 'VYOS_TAGNODE_VALUE' not in os.environ: raise ConfigError('Interface (VYOS_TAGNODE_VALUE) not specified') geneve['intf'] = os.environ['VYOS_TAGNODE_VALUE'] # Check if interface has been removed if not conf.exists('interfaces geneve ' + geneve['intf']): geneve['deleted'] = True return geneve # set new configuration level conf.set_level('interfaces geneve ' + geneve['intf']) # retrieve configured interface addresses if conf.exists('address'): geneve['address'] = conf.return_values('address') # retrieve interface description if conf.exists('description'): geneve['description'] = conf.return_value('description') # Disable this interface if conf.exists('disable'): geneve['disable'] = True # ARP cache entry timeout in seconds if conf.exists('ip arp-cache-timeout'): geneve['ip_arp_cache_tmo'] = int( conf.return_value('ip arp-cache-timeout')) # Enable proxy-arp on this interface if conf.exists('ip enable-proxy-arp'): geneve['ip_proxy_arp'] = 1 # Maximum Transmission Unit (MTU) if conf.exists('mtu'): geneve['mtu'] = int(conf.return_value('mtu')) # Remote address of GENEVE tunnel if conf.exists('remote'): geneve['remote'] = conf.return_value('remote') # Virtual Network Identifier if conf.exists('vni'): geneve['vni'] = conf.return_value('vni') return geneve
def get_config(): relay = deepcopy(default_config_data) conf = Config() base = ['service', 'broadcast-relay'] if not conf.exists(base): return None else: conf.set_level(base) # Service can be disabled by user if conf.exists('disable'): relay['disabled'] = True return relay # Parse configuration of each individual instance if conf.exists('id'): for id in conf.list_nodes('id'): conf.set_level(base + ['id', id]) config = { 'id': id, 'disabled': False, 'address': '', 'description': '', 'interfaces': [], 'port': '' } # Check if individual broadcast relay service is disabled if conf.exists(['disable']): config['disabled'] = True # Source IP of forwarded packets, if empty original senders address is used if conf.exists(['address']): config['address'] = conf.return_value(['address']) # A description for each individual broadcast relay service if conf.exists(['description']): config['description'] = conf.return_value(['description']) # UDP port to listen on for broadcast frames if conf.exists(['port']): config['port'] = conf.return_value(['port']) # Network interfaces to listen on for broadcast frames to be relayed if conf.exists(['interface']): config['interfaces'] = conf.return_values(['interface']) relay['instances'].append(config) return relay
def get_config(): opts = copy.deepcopy(default_config_data) conf = Config() if not conf.exists('firewall options'): # bail out early return opts else: conf.set_level('firewall options') # Parse configuration of each individual instance if conf.exists('interface'): for intf in conf.list_nodes('interface'): conf.set_level('firewall options interface {0}'.format(intf)) config = { 'intf': intf, 'disabled': False, 'mss4': '', 'mss6': '' } # Check if individual option is disabled if conf.exists('disable'): config['disabled'] = True # # Get MSS value IPv4 # if conf.exists('adjust-mss'): config['mss4'] = conf.return_value('adjust-mss') # We need a marker that a new iptables chain needs to be generated if not opts['new_chain4']: opts['new_chain4'] = True # # Get MSS value IPv6 # if conf.exists('adjust-mss6'): config['mss6'] = conf.return_value('adjust-mss6') # We need a marker that a new ip6tables chain needs to be generated if not opts['new_chain6']: opts['new_chain6'] = True # Append interface options to global list opts['intf_opts'].append(config) return opts
def get_config(): loopback = deepcopy(default_config_data) conf = Config() # determine tagNode instance if 'VYOS_TAGNODE_VALUE' not in os.environ: raise ConfigError('Interface (VYOS_TAGNODE_VALUE) not specified') loopback['intf'] = os.environ['VYOS_TAGNODE_VALUE'] # Check if interface has been removed if not conf.exists('interfaces loopback ' + loopback['intf']): loopback['deleted'] = True # set new configuration level conf.set_level('interfaces loopback ' + loopback['intf']) # retrieve configured interface addresses if conf.exists('address'): loopback['address'] = conf.return_values('address') # retrieve interface description if conf.exists('description'): loopback['description'] = conf.return_value('description') # Determine interface addresses (currently effective) - to determine which # address is no longer valid and needs to be removed from the interface eff_addr = conf.return_effective_values('address') act_addr = conf.return_values('address') loopback['address_remove'] = list_diff(eff_addr, act_addr) return loopback
def get_config(): tz = deepcopy(default_config_data) conf = Config() if conf.exists('system time-zone'): tz['name'] = conf.return_value('system time-zone') return tz
def get_config(): relay = default_config_data conf = Config() if not conf.exists(['service', 'dhcp-relay']): return None else: conf.set_level(['service', 'dhcp-relay']) # Network interfaces to listen on if conf.exists(['interface']): relay['interface'] = conf.return_values(['interface']) # Servers equal to the address of the DHCP server(s) if conf.exists(['server']): relay['server'] = conf.return_values(['server']) conf.set_level(['service', 'dhcp-relay', 'relay-options']) if conf.exists(['hop-count']): count = '-c ' + conf.return_value(['hop-count']) relay['options'].append(count) # Specify the maximum packet size to send to a DHCPv4/BOOTP server. # This might be done to allow sufficient space for addition of relay agent # options while still fitting into the Ethernet MTU size. # # Available in DHCPv4 mode only: if conf.exists(['max-size']): size = '-A ' + conf.return_value(['max-size']) relay['options'].append(size) # Control the handling of incoming DHCPv4 packets which already contain # relay agent options. If such a packet does not have giaddr set in its # header, the DHCP standard requires that the packet be discarded. However, # if giaddr is set, the relay agent may handle the situation in four ways: # It may append its own set of relay options to the packet, leaving the # supplied option field intact; it may replace the existing agent option # field; it may forward the packet unchanged; or, it may discard it. # # Available in DHCPv4 mode only: if conf.exists(['relay-agents-packets']): pkt = '-a -m ' + conf.return_value(['relay-agents-packets']) relay['options'].append(pkt) return relay
def get_config(): """Get configuration""" conf = Config() hostname = conf.return_value("system host-name") domain = conf.return_value("system domain-name") # No one likes fixups, but we really don't want VyOS fail to boot # if hostname is not in the config if not hostname: hostname = "vyos" if domain: fqdn = "{0}.{1}".format(hostname, domain) else: fqdn = hostname return {"hostname": hostname, "domain": domain, "fqdn": fqdn}
def get_config(): # determine tagNode instance if 'VYOS_TAGNODE_VALUE' not in os.environ: raise ConfigError('Interface (VYOS_TAGNODE_VALUE) not specified') ifname = os.environ['VYOS_TAGNODE_VALUE'] conf = Config() # Check if interface has been removed cfg_base = ['interfaces', 'pseudo-ethernet', ifname] if not conf.exists(cfg_base): peth = deepcopy(default_config_data) peth['deleted'] = True return peth # set new configuration level conf.set_level(cfg_base) peth, disabled = intf_to_dict(conf, default_config_data) # ARP cache entry timeout in seconds if conf.exists(['ip', 'arp-cache-timeout']): peth['ip_arp_cache_tmo'] = int( conf.return_value(['ip', 'arp-cache-timeout'])) # Enable private VLAN proxy ARP on this interface if conf.exists(['ip', 'proxy-arp-pvlan']): peth['ip_proxy_arp_pvlan'] = 1 # Physical interface if conf.exists(['source-interface']): peth['source_interface'] = conf.return_value(['source-interface']) tmp = conf.return_effective_value(['source-interface']) if tmp != peth['source_interface']: peth['source_interface_changed'] = True # MACvlan mode if conf.exists(['mode']): peth['mode'] = conf.return_value(['mode']) add_to_dict(conf, disabled, peth, 'vif', 'vif') add_to_dict(conf, disabled, peth, 'vif-s', 'vif_s') return peth
def get_config(): dummy = deepcopy(default_config_data) conf = Config() # determine tagNode instance if 'VYOS_TAGNODE_VALUE' not in os.environ: raise ConfigError('Interface (VYOS_TAGNODE_VALUE) not specified') dummy['intf'] = os.environ['VYOS_TAGNODE_VALUE'] # check if we are a member of any bridge dummy['is_bridge_member'] = is_member(conf, dummy['intf'], 'bridge') # Check if interface has been removed if not conf.exists('interfaces dummy ' + dummy['intf']): dummy['deleted'] = True return dummy # set new configuration level conf.set_level('interfaces dummy ' + dummy['intf']) # retrieve configured interface addresses if conf.exists('address'): dummy['address'] = conf.return_values('address') # retrieve interface description if conf.exists('description'): dummy['description'] = conf.return_value('description') # Disable this interface if conf.exists('disable'): dummy['disable'] = True # Determine interface addresses (currently effective) - to determine which # address is no longer valid and needs to be removed from the interface eff_addr = conf.return_effective_values('address') act_addr = conf.return_values('address') dummy['address_remove'] = list_diff(eff_addr, act_addr) # retrieve VRF instance if conf.exists('vrf'): dummy['vrf'] = conf.return_value('vrf') return dummy
def get_config(): igmp_proxy = deepcopy(default_config_data) conf = Config() base = ['protocols', 'igmp-proxy'] if not conf.exists(base): return None else: conf.set_level(base) # Network interfaces to listen on if conf.exists(['disable']): igmp_proxy['disable'] = True # Option to disable "quickleave" if conf.exists(['disable-quickleave']): igmp_proxy['disable_quickleave'] = True for intf in conf.list_nodes(['interface']): conf.set_level(base + ['interface', intf]) interface = { 'name': intf, 'alt_subnet': [], 'role': 'downstream', 'threshold': '1', 'whitelist': [] } if conf.exists(['alt-subnet']): interface['alt_subnet'] = conf.return_values(['alt-subnet']) if conf.exists(['role']): interface['role'] = conf.return_value(['role']) if conf.exists(['threshold']): interface['threshold'] = conf.return_value(['threshold']) if conf.exists(['whitelist']): interface['whitelist'] = conf.return_values(['whitelist']) # Append interface configuration to global configuration list igmp_proxy['interfaces'].append(interface) return igmp_proxy
def get_config(): c = Config() if not c.exists('system proxy'): return None c.set_level('system proxy') cnf = {'url': None, 'port': None, 'usr': None, 'passwd': None} if c.exists('url'): cnf['url'] = c.return_value('url') if c.exists('port'): cnf['port'] = c.return_value('port') if c.exists('username'): cnf['usr'] = c.return_value('username') if c.exists('password'): cnf['passwd'] = c.return_value('password') return cnf
def get_config(): conf = Config() conf.set_level("system task-scheduler task") task_names = conf.list_nodes("") tasks = [] for name in task_names: interval = conf.return_value("{0} interval".format(name)) spec = conf.return_value("{0} crontab-spec".format(name)) executable = conf.return_value("{0} executable path".format(name)) args = conf.return_value("{0} executable arguments".format(name)) task = { "name": name, "interval": interval, "spec": spec, "executable": executable, "args": args } tasks.append(task) return tasks
def get_config(): opt = deepcopy(default_config_data) conf = Config() conf.set_level('system options') if conf.exists(''): if conf.exists('ctrl-alt-del-action'): opt['ctrl_alt_del'] = conf.return_value('ctrl-alt-del-action') opt['beep_if_fully_booted'] = conf.exists('beep-if-fully-booted') opt['reboot_on_panic'] = conf.exists('reboot-on-panic') return opt
def get_config(): c = Config() if not c.exists('protocols static arp'): return None c.set_level('protocols static') config_data = {} for ip_addr in c.list_nodes('arp'): config_data.update( {ip_addr: c.return_value('arp ' + ip_addr + ' hwaddr')}) return config_data
def get_config(): tftpd = deepcopy(default_config_data) conf = Config() base = ['service', 'tftp-server'] if not conf.exists(base): return None else: conf.set_level(base) if conf.exists(['directory']): tftpd['directory'] = conf.return_value(['directory']) if conf.exists(['allow-upload']): tftpd['allow_upload'] = True if conf.exists(['port']): tftpd['port'] = conf.return_value(['port']) if conf.exists(['listen-address']): tftpd['listen'] = conf.return_values(['listen-address']) return tftpd
def get_config(): regdom = deepcopy(default_config_data) conf = Config() base = ['system', 'wifi-regulatory-domain'] # Check if interface has been removed if not conf.exists(base): regdom['deleted'] = True return regdom else: regdom['regdom'] = conf.return_value(base) return regdom
def get_config(): banner = default_config_data conf = Config() base_level = ['system', 'login', 'banner'] if not conf.exists(base_level): return banner else: conf.set_level(base_level) # Post-Login banner if conf.exists(['post-login']): tmp = conf.return_value(['post-login']) # post-login banner can be empty as well if tmp: tmp = tmp.replace('\\n', '\n') tmp = tmp.replace('\\t', '\t') # always add newline character tmp += '\n' else: tmp = '' banner['motd'] = tmp # Pre-Login banner if conf.exists(['pre-login']): tmp = conf.return_value(['pre-login']) # pre-login banner can be empty as well if tmp: tmp = tmp.replace('\\n', '\n') tmp = tmp.replace('\\t', '\t') # always add newline character tmp += '\n' else: tmp = '' banner['issue'] = banner['issue_net'] = tmp return banner
def get_config(): http_api = deepcopy(vyos.defaults.api_data) x = http_api.get('api_keys') if x is None: default_key = None else: default_key = x[0] keys_added = False conf = Config() if not conf.exists('service https api'): return None else: conf.set_level('service https api') if conf.exists('strict'): http_api['strict'] = 'true' if conf.exists('debug'): http_api['debug'] = 'true' if conf.exists('port'): port = conf.return_value('port') http_api['port'] = port if conf.exists('keys'): for name in conf.list_nodes('keys id'): if conf.exists('keys id {0} key'.format(name)): key = conf.return_value('keys id {0} key'.format(name)) new_key = {'id': name, 'key': key} http_api['api_keys'].append(new_key) keys_added = True if keys_added and default_key: if default_key in http_api['api_keys']: http_api['api_keys'].remove(default_key) return http_api
def get_config(): relay = deepcopy(default_config_data) conf = Config() if not conf.exists('service dhcpv6-relay'): return None else: conf.set_level('service dhcpv6-relay') # Network interfaces/address to listen on for DHCPv6 query(s) if conf.exists('listen-interface'): interfaces = conf.list_nodes('listen-interface') for intf in interfaces: if conf.exists('listen-interface {0} address'.format(intf)): addr = conf.return_value( 'listen-interface {0} address'.format(intf)) listen = addr + '%' + intf relay['listen_addr'].append(listen) # Upstream interface/address for remote DHCPv6 server if conf.exists('upstream-interface'): interfaces = conf.list_nodes('upstream-interface') for intf in interfaces: addresses = conf.return_values( 'upstream-interface {0} address'.format(intf)) for addr in addresses: server = addr + '%' + intf relay['upstream_addr'].append(server) # Maximum hop count. When forwarding packets, dhcrelay discards packets # which have reached a hop count of COUNT. Default is 10. Maximum is 255. if conf.exists('max-hop-count'): count = '-c ' + conf.return_value('max-hop-count') relay['options'].append(count) if conf.exists('use-interface-id-option'): relay['options'].append('-I') return relay
def get_config(): conf = Config() hosts = copy.deepcopy(default_config_data) if conf.exists("system host-name"): hosts['hostname'] = conf.return_value("system host-name") # This may happen if the config is not loaded yet, # e.g. if run by cloud-init if not hosts['hostname']: hosts['hostname'] = default_config_data['hostname'] if conf.exists("system domain-name"): hosts['domain_name'] = conf.return_value("system domain-name") hosts['domain_search'].append(hosts['domain_name']) for search in conf.return_values("system domain-search domain"): hosts['domain_search'].append(search) if conf.exists("system name-server"): hosts['nameserver'] = conf.return_values("system name-server") if conf.exists("system disable-dhcp-nameservers"): hosts['no_dhcp_ns'] = True # system static-host-mapping hosts['static_host_mapping'] = [] if conf.exists('system static-host-mapping host-name'): for hn in conf.list_nodes('system static-host-mapping host-name'): mapping = {} mapping['host'] = hn mapping['address'] = conf.return_value( 'system static-host-mapping host-name {0} inet'.format(hn)) mapping['aliases'] = conf.return_values( 'system static-host-mapping host-name {0} alias'.format(hn)) hosts['static_host_mapping'].append(mapping) return hosts
def get_config(): vyos_cert = vyos.defaults.vyos_cert_data conf = Config() if not conf.exists( 'service https certificates system-generated-certificate'): return None else: conf.set_level( 'service https certificates system-generated-certificate') if conf.exists('lifetime'): lifetime = conf.return_value('lifetime') vyos_cert['lifetime'] = lifetime return vyos_cert
def get_config(): conf = Config() if not conf.exists('service https certificates certbot'): return None else: conf.set_level('service https certificates certbot') cert = {} if conf.exists('domain-name'): cert['domains'] = conf.return_values('domain-name') if conf.exists('email'): cert['email'] = conf.return_value('email') return cert
def get_config(): ip_opt = deepcopy(default_config_data) conf = Config() conf.set_level('system ip') if conf.exists(''): if conf.exists('arp table-size'): ip_opt['arp_table'] = int(conf.return_value('arp table-size')) if conf.exists('disable-forwarding'): ip_opt['ipv4_forward'] = '0' if conf.exists('multipath ignore-unreachable-nexthops'): ip_opt['mp_unreach_nexthop'] = '1' if conf.exists('multipath layer4-hashing'): ip_opt['mp_layer4_hashing'] = '1' return ip_opt
def get_config(): ip_opt = deepcopy(default_config_data) conf = Config() conf.set_level('system ipv6') if conf.exists(''): ip_opt['disable_addr_assignment'] = conf.exists('disable') if conf.exists_effective('disable') != conf.exists('disable'): ip_opt['reboot_message'] = True if conf.exists('disable-forwarding'): ip_opt['ipv6_forward'] = '0' if conf.exists('multipath layer4-hashing'): ip_opt['mp_layer4_hashing'] = '1' if conf.exists('neighbor table-size'): ip_opt['neighbor_cache'] = int( conf.return_value('neighbor table-size')) if conf.exists('strict-dad'): ip_opt['strict_dad'] = 2 return ip_opt
def get_config(): salt = default_config_data conf = Config() if not conf.exists('service salt-minion'): return None else: conf.set_level('service salt-minion') if conf.exists('hash_type'): salt['hash_type'] = conf.return_value('hash_type') if conf.exists('log_file'): salt['log_file'] = conf.return_value('log_file') if conf.exists('log_level'): salt['log_level'] = conf.return_value('log_level') if conf.exists('master'): master = conf.return_values('master') salt['master'] = master if conf.exists('ID'): salt['salt_id'] = conf.return_value('ID') if conf.exists('user'): salt['user'] = conf.return_value('user') if conf.exists('mine_interval'): salt['mine_interval'] = conf.return_value('mine_interval') salt['master-key'] = None if conf.exists('master-key'): salt['master-key'] = conf.return_value('master-key') salt['verify_master_pubkey_sign'] = 'true' return salt