@@ -2820,22 +2820,6 @@ def warm_restart_bgp_eoiu(ctx, enable):
2820
2820
db = ctx .obj ['db' ]
2821
2821
db .mod_entry ('WARM_RESTART' , 'bgp' , {'bgp_eoiu' : enable })
2822
2822
2823
- def mvrf_restart_services ():
2824
- """Restart interfaces-config service and NTP service when mvrf is changed"""
2825
- """
2826
- When mvrf is enabled, eth0 should be moved to mvrf; when it is disabled,
2827
- move it back to default vrf. Restarting the "interfaces-config" service
2828
- will recreate the /etc/network/interfaces file and restart the
2829
- "networking" service that takes care of the eth0 movement.
2830
- NTP service should also be restarted to rerun the NTP service with or
2831
- without "cgexec" accordingly.
2832
- """
2833
- cmd = "service ntp stop"
2834
- os .system (cmd )
2835
- cmd = "systemctl restart interfaces-config"
2836
- os .system (cmd )
2837
- cmd = "service ntp start"
2838
- os .system (cmd )
2839
2823
2840
2824
def vrf_add_management_vrf (config_db ):
2841
2825
"""Enable management vrf in config DB"""
@@ -2845,22 +2829,7 @@ def vrf_add_management_vrf(config_db):
2845
2829
click .echo ("ManagementVRF is already Enabled." )
2846
2830
return None
2847
2831
config_db .mod_entry ('MGMT_VRF_CONFIG' , "vrf_global" , {"mgmtVrfEnabled" : "true" })
2848
- mvrf_restart_services ()
2849
- """
2850
- The regular expression for grep in below cmd is to match eth0 line in /proc/net/route, sample file:
2851
- $ cat /proc/net/route
2852
- Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
2853
- eth0 00000000 01803B0A 0003 0 0 202 00000000 0 0 0
2854
- """
2855
- cmd = r"cat /proc/net/route | grep -E \"eth0\s+00000000\s+[0-9A-Z]+\s+[0-9]+\s+[0-9]+\s+[0-9]+\s+202\" | wc -l"
2856
- proc = subprocess .Popen (cmd , shell = True , stdout = subprocess .PIPE )
2857
- output = proc .communicate ()
2858
- if int (output [0 ]) >= 1 :
2859
- cmd = "ip -4 route del default dev eth0 metric 202"
2860
- proc = subprocess .Popen (cmd , shell = True , stdout = subprocess .PIPE )
2861
- proc .communicate ()
2862
- if proc .returncode != 0 :
2863
- click .echo ("Could not delete eth0 route" )
2832
+
2864
2833
2865
2834
def vrf_delete_management_vrf (config_db ):
2866
2835
"""Disable management vrf in config DB"""
@@ -2870,7 +2839,7 @@ def vrf_delete_management_vrf(config_db):
2870
2839
click .echo ("ManagementVRF is already Disabled." )
2871
2840
return None
2872
2841
config_db .mod_entry ('MGMT_VRF_CONFIG' , "vrf_global" , {"mgmtVrfEnabled" : "false" })
2873
- mvrf_restart_services ()
2842
+
2874
2843
2875
2844
@config .group (cls = clicommon .AbbreviationGroup )
2876
2845
@click .pass_context
@@ -4106,20 +4075,6 @@ def _get_all_mgmtinterface_keys():
4106
4075
config_db .connect ()
4107
4076
return list (config_db .get_table ('MGMT_INTERFACE' ).keys ())
4108
4077
4109
- def mgmt_ip_restart_services ():
4110
- """Restart the required services when mgmt inteface IP address is changed"""
4111
- """
4112
- Whenever the eth0 IP address is changed, restart the "interfaces-config"
4113
- service which regenerates the /etc/network/interfaces file and restarts
4114
- the networking service to make the new/null IP address effective for eth0.
4115
- "ntp-config" service should also be restarted based on the new
4116
- eth0 IP address since the ntp.conf (generated from ntp.conf.j2) is
4117
- made to listen on that particular eth0 IP address or reset it back.
4118
- """
4119
- cmd = "systemctl restart interfaces-config"
4120
- os .system (cmd )
4121
- cmd = "systemctl restart ntp-config"
4122
- os .system (cmd )
4123
4078
4124
4079
#
4125
4080
# 'mtu' subcommand
@@ -4267,7 +4222,6 @@ def add(ctx, interface_name, ip_addr, gw):
4267
4222
config_db .set_entry ("MGMT_INTERFACE" , (interface_name , str (ip_address )), {"NULL" : "NULL" })
4268
4223
else :
4269
4224
config_db .set_entry ("MGMT_INTERFACE" , (interface_name , str (ip_address )), {"gwaddr" : gw })
4270
- mgmt_ip_restart_services ()
4271
4225
4272
4226
return
4273
4227
@@ -4307,7 +4261,6 @@ def remove(ctx, interface_name, ip_addr):
4307
4261
4308
4262
if interface_name == 'eth0' :
4309
4263
config_db .set_entry ("MGMT_INTERFACE" , (interface_name , str (ip_address )), None )
4310
- mgmt_ip_restart_services ()
4311
4264
return
4312
4265
4313
4266
table_name = get_interface_table_name (interface_name )
0 commit comments