@@ -32,10 +32,17 @@ def name(vxlan_name):
32
32
vxlan_map_keys = config_db .keys (config_db .CONFIG_DB ,
33
33
'VXLAN_TUNNEL_MAP{}{}{}*' .format (config_db .KEY_SEPARATOR , vxlan_name , config_db .KEY_SEPARATOR ))
34
34
if vxlan_map_keys :
35
- vxlan_map_mapping = config_db .get_all (config_db .CONFIG_DB , vxlan_map_keys [0 ])
36
- r .append (vxlan_map_keys [0 ].split (config_db .KEY_SEPARATOR , 2 )[2 ])
37
- r .append ("{} -> {}" .format (vxlan_map_mapping .get ('vni' ), vxlan_map_mapping .get ('vlan' )))
38
- table .append (r )
35
+ for key in natsorted (vxlan_map_keys ):
36
+ vxlan_map_mapping = config_db .get_all (config_db .CONFIG_DB , key )
37
+ r .append (key .split (config_db .KEY_SEPARATOR , 2 )[2 ])
38
+ r .append ("{} -> {}" .format (vxlan_map_mapping .get ('vni' ), vxlan_map_mapping .get ('vlan' )))
39
+ table .append (r )
40
+ r = []
41
+ r .append (' ' )
42
+ r .append (' ' )
43
+ r .append (' ' )
44
+ else :
45
+ table .append (r )
39
46
40
47
click .echo (tabulate (table , header ))
41
48
@@ -59,10 +66,17 @@ def tunnel():
59
66
vxlan_map_keys = config_db .keys (config_db .CONFIG_DB ,
60
67
'VXLAN_TUNNEL_MAP{}{}{}*' .format (config_db .KEY_SEPARATOR , k , config_db .KEY_SEPARATOR ))
61
68
if vxlan_map_keys :
62
- vxlan_map_mapping = config_db .get_all (config_db .CONFIG_DB , vxlan_map_keys [0 ])
63
- r .append (vxlan_map_keys [0 ].split (config_db .KEY_SEPARATOR , 2 )[2 ])
64
- r .append ("{} -> {}" .format (vxlan_map_mapping .get ('vni' ), vxlan_map_mapping .get ('vlan' )))
65
- table .append (r )
69
+ for key in natsorted (vxlan_map_keys ):
70
+ vxlan_map_mapping = config_db .get_all (config_db .CONFIG_DB , key )
71
+ r .append (key .split (config_db .KEY_SEPARATOR , 2 )[2 ])
72
+ r .append ("{} -> {}" .format (vxlan_map_mapping .get ('vni' ), vxlan_map_mapping .get ('vlan' )))
73
+ table .append (r )
74
+ r = []
75
+ r .append (' ' )
76
+ r .append (' ' )
77
+ r .append (' ' )
78
+ else :
79
+ table .append (r )
66
80
67
81
click .echo (tabulate (table , header ))
68
82
0 commit comments