else: path = ['core/switch', 'applications/bigtap/interface-config'] run_config.post_paths(context, path, detail) switch_running_config_tuple = ( ( { 'optional' : False, 'field' : 'running-config', 'type' : 'enum', 'values' : 'switch', 'short-help' : 'Configuration for switches', 'doc' : 'running-config|show-switch', }, { 'field' : 'word', 'type' : 'dpid', 'completion' : 'complete-from-another', 'other-path' : 'core/switch|dpid', 'action' : 'legacy-cli', 'data-handler' : 'alias-to-value', 'optional' : True, } ), ) run_config.register_running_config('switch', 3000, None, running_config_switch, switch_running_config_tuple)
tech_support_entries = context.get_table_from_store( 'tech-support-config') except Exception, e: tech_support_entries = [] t_config = [] for ts_entry in tech_support_entries: t_config.append( "tech-support-config %s '%s'\n" % (ts_entry['cmd-type'], utif.quote_string(ts_entry['cmd']))) if len(t_config) > 0: config.append('!\n') config += t_config tag_running_config_tuple = (({ 'optional': False, 'field': 'running-config', 'type': 'enum', 'values': 'tech-support', 'short-help': 'Configuration for tech support', 'doc': 'running-config|show-tech-support', }, ), ) # # Register with run_config module, our callback to process running configs for # address-space configuration items # run_config.register_running_config('tech-support', 20000, None, running_config_tech_support, tag_running_config_tuple)
if len(topology_config) > 1: print 'running_config_topology: more than one topology record' if len(topology_config) == 0: return topology_config = topology_config[0] if run_config.not_default_value(t_obj_type, 'autoportfast', topology_config.get('autoportfast')): config.append('\nno topology autoportfast\n') # # -------------------------------------------------------------------------------- topology_running_config_tuple = ( ( { 'optional' : False, 'field' : 'running-config', 'type' : 'enum', 'values' : 'topology', 'short-help' : 'Topology Configuration', 'doc' : 'running-config|show-topology', }, ), ) run_config.register_running_config('topology', 2100, None, running_config_topology, topology_running_config_tuple)
""" Add host details, including tags. """ detail = data.get('detail', False) run_config.post_paths('core/device', detail) host_running_config_tuple = (({ 'optional': False, 'field': 'running-config', 'type': 'enum', 'values': 'host', 'short-help': 'Configuration for hosts', 'doc': 'running-config|show-host', }, { 'field': 'word', 'type': 'host', 'completion': 'complete-from-another', 'other': 'host|mac', 'parent-field': None, 'data-handler': 'alias-to-value', 'action': 'legacy-cli', 'optional': True, }), ) # device manager enabled? run_config.register_running_config('host', 5000, lambda x: False, running_config_host, host_running_config_tuple)
if run_config.not_default_value(s_obj_type, 'contact', snmp_config.get('contact')): s_config.append('snmp-server contact %s\n' % utif.quote_string(snmp_config['contact'])) if run_config.not_default_value(s_obj_type, 'server-enable', snmp_config['server-enable']): s_config.append('snmp-server enable\n') if len(s_config): config.append('!\n') config += s_config # # -------------------------------------------------------------------------------- snmp_running_config_tuple = ( ( { 'optional' : False, 'field' : 'running-config', 'type' : 'enum', 'values' : 'snmp', 'short-help' : 'Configuration for SNMP', 'doc' : 'running-config|show-snmp', }, ), ) run_config.register_running_config('snmp', 2300, None, running_config_snmp, snmp_running_config_tuple)
forwarding_config = forwarding_table[0] newline_printed = False if run_config.not_default_value(t_obj_type, "access-priority", forwarding_config.get("access-priority")): if newline_printed is False: newline_printed = True config.append("!\n") config.append("forwarding access-priority %s\n" % forwarding_config.get("access-priority")) if run_config.not_default_value(t_obj_type, "core-priority", forwarding_config.get("core-priority")): if newline_printed is False: newline_printed = True config.append("!\n") config.append("forwarding core-priority %s\n" % forwarding_config.get("core-priority")) forwarding_running_config_tuple = ( ( { "optional": False, "field": "running-config", "type": "enum", "values": "forwarding", "short-help": "Forwarding Configuration", "doc": "running-config|forwarding-show", }, ), ) run_config.register_running_config("forwarding", 2200, None, running_config_forwarding, forwarding_running_config_tuple) # --------------------------------------------------------------------------------
host_running_config_tuple = ( ( { 'optional' : False, 'field' : 'running-config', 'type' : 'enum', 'values' : 'host', 'short-help' : 'Configuration for hosts', 'doc' : 'running-config|show-host', }, { 'field' : 'word', 'type' : 'host', 'completion' : 'complete-from-another', 'other' : 'host|mac', 'parent-field' : None, 'data-handler' : 'alias-to-value', 'action' : 'legacy-cli', 'optional' : True, } ), ) # device manager enabled? run_config.register_running_config('host', 5000, lambda x: False, running_config_host, host_running_config_tuple)
# { 'optional': False, 'field': 'running-config', 'type': 'enum', 'values': 'address-space', 'short-help': 'Configuration for address spaces', 'doc': 'running-config|show-address-space', }, # # show running-configuration address-space <address-space> # { 'field': 'word', 'type': 'identifier', 'completion': 'complete-from-another', 'other': 'address-space|name', 'parent-field': None, 'action': 'legacy-cli', 'optional': True, }), ) # # Register with run_config module, our callback to process running configs for # address-space configuration items # run_config.register_running_config('address-space', 4000, None, running_config_address_space, address_space_running_config_tuple)
tech_support_entries = [] t_config = [] for ts_entry in tech_support_entries: t_config.append("tech-support-config %s '%s'\n" % (ts_entry['cmd-type'], utif.quote_string(ts_entry['cmd']))) if len(t_config) > 0: config.append('!\n') config += t_config tag_running_config_tuple = ( ( { 'optional' : False, 'field' : 'running-config', 'type' : 'enum', 'values' : 'tech-support', 'short-help' : 'Configuration for tech support', 'doc' : 'running-config|show-tech-support', }, ), ) # # Register with run_config module, our callback to process running configs for # address-space configuration items # run_config.register_running_config('tech-support', 20000, None, running_config_tech_support, tag_running_config_tuple)
key = ' key %s' % utif.quote_string(h['key']) else: key = '' t_config.append('tacacs server host %s%s\n' % (h['ip'], key)) if len(t_config): config.append('!\n') config += t_config # # -------------------------------------------------------------------------------- tacacs_running_config_tuple = ( ( { 'optional' : False, 'field' : 'running-config', 'type' : 'enum', 'values' : 'tacacs', 'doc' : 'running-config|show-tacacs', 'short-help': 'Configuration for TACACS authentication' }, ), ) run_config.register_running_config('tacacs', 2000, None, running_config_tacacs, tacacs_running_config_tuple)
'field' : 'running-config', 'type' : 'enum', 'values' : 'address-space', 'short-help' : 'Configuration for address spaces', 'doc' : 'running-config|show-address-space', }, # # show running-configuration address-space <address-space> # { 'field' : 'word', 'type' : 'identifier', 'completion' : 'complete-from-another', 'other' : 'address-space|name', 'parent-field' : None, 'action' : 'legacy-cli', 'optional' : True, } ), ) # # Register with run_config module, our callback to process running configs for # address-space configuration items # run_config.register_running_config('address-space', 4000, None, running_config_address_space, address_space_running_config_tuple)
user_running_config_tuple = ( ( { 'optional' : False, 'field' : 'running-config', 'type' : 'enum', 'values' : 'user', 'short-help' : 'Configuration for user accounts', 'doc' : 'running-config|show-user', }, ), ) run_config.register_running_config('user', 1000, None, running_config_user, user_running_config_tuple) # # -------------------------------------------------------------------------------- def running_config_group(context, config, data): detail = data.get('detail') if context.bigdb.enabled(): run_config.post_paths(context, 'core/aaa/group', detail) group_running_config_tuple = ( ( { 'optional' : False,
if len(t_config): config.append('!\n') config += t_config tag_running_config_tuple = (( { 'optional': False, 'field': 'running-config', 'type': 'enum', 'values': 'tag', 'short-help': 'Configuration for controller object metadata', 'doc': 'running-config|show-tag', }, { 'field': 'word', 'type': 'string', 'completion': 'complete-from-another', 'other': 'tag|id', 'action': 'legacy-cli', 'optional': True, }, ), ) # # Register with run_config module, our callback to process running configs for # address-space configuration items # run_config.register_running_config('tag', 4000, None, running_config_tag, tag_running_config_tuple)
def running_config_user(context, config, data): detail = data.get('detail') if context.bigdb.enabled(): run_config.post_paths(context, 'core/aaa/local-user', detail) user_running_config_tuple = (({ 'optional': False, 'field': 'running-config', 'type': 'enum', 'values': 'user', 'short-help': 'Configuration for user accounts', 'doc': 'running-config|show-user', }, ), ) run_config.register_running_config('user', 1000, None, running_config_user, user_running_config_tuple) # # -------------------------------------------------------------------------------- def running_config_group(context, config, data): detail = data.get('detail') if context.bigdb.enabled(): run_config.post_paths(context, 'core/aaa/group', detail) group_running_config_tuple = (({ 'optional': False, 'field': 'running-config', 'type': 'enum',
tag_running_config_tuple = ( ( { 'optional' : False, 'field' : 'running-config', 'type' : 'enum', 'values' : 'tag', 'short-help' : 'Configuration for controller object metadata', 'doc' : 'running-config|show-tag', }, { 'field' : 'word', 'type' : 'string', 'completion' : 'complete-from-another', 'other' : 'tag|id', 'action' : 'legacy-cli', 'optional' : True, }, ), ) # # Register with run_config module, our callback to process running configs for # address-space configuration items # run_config.register_running_config('tag', 4000, None, running_config_tag, tag_running_config_tuple)
config.append( 'forwarding access-priority %s\n' % forwarding_config.get('access-priority')) if run_config.not_default_value( t_obj_type, 'core-priority', forwarding_config.get('core-priority')): if newline_printed is False: newline_printed = True config.append("!\n") config.append( 'forwarding core-priority %s\n' % forwarding_config.get('core-priority')) forwarding_running_config_tuple = ( ( { 'optional' : False, 'field' : 'running-config', 'type' : 'enum', 'values' : 'forwarding', 'short-help' : 'Forwarding Configuration', 'doc' : 'running-config|forwarding-show', }, ), ) run_config.register_running_config('forwarding', 2200, None, running_config_forwarding, forwarding_running_config_tuple) # --------------------------------------------------------------------------------