blob: 438ad6eca58060ee8e3e0219c04644639c6a6215 [file] [log] [blame]
Srikanth Vavilapalli1725e492014-12-01 17:50:52 -08001#
2# Copyright (c) 2013 Big Switch Networks, Inc.
3#
4# Licensed under the Eclipse Public License, Version 1.0 (the
5# "License"); you may not use this file except in compliance with the
6# License. You may obtain a copy of the License at
7#
8# http://www.eclipse.org/legal/epl-v10.html
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied. See the License for the specific language governing
14# permissions and limitations under the License.
15#
16
17# topology config.
18#
19
20import run_config
21
22#
23# --------------------------------------------------------------------------------
24
25def running_config_topology(context, config, words):
26 t_obj_type = 'topology-config'
27
28 topology_config = context.get_table_from_store(t_obj_type)
29 if len(topology_config) > 1:
30 print 'running_config_topology: more than one topology record'
31 if len(topology_config) == 0:
32 return
33
34 topology_config = topology_config[0]
35
36 if run_config.not_default_value(t_obj_type, 'autoportfast',
37 topology_config.get('autoportfast')):
38 config.append('\nno topology autoportfast\n')
39
40#
41# --------------------------------------------------------------------------------
42
43topology_running_config_tuple = (
44 (
45 {
46 'optional' : False,
47 'field' : 'running-config',
48 'type' : 'enum',
49 'values' : 'topology',
50 'short-help' : 'Topology Configuration',
51 'doc' : 'running-config|show-topology',
52 },
53 ),
54)
55
56run_config.register_running_config('topology', 2100, None,
57 running_config_topology,
58 topology_running_config_tuple)