@@ -2664,22 +2664,6 @@ def warm_restart_bgp_eoiu(ctx, enable):
2664
2664
db = ctx .obj ['db' ]
2665
2665
db .mod_entry ('WARM_RESTART' , 'bgp' , {'bgp_eoiu' : enable })
2666
2666
2667
- def mvrf_restart_services ():
2668
- """Restart interfaces-config service and NTP service when mvrf is changed"""
2669
- """
2670
- When mvrf is enabled, eth0 should be moved to mvrf; when it is disabled,
2671
- move it back to default vrf. Restarting the "interfaces-config" service
2672
- will recreate the /etc/network/interfaces file and restart the
2673
- "networking" service that takes care of the eth0 movement.
2674
- NTP service should also be restarted to rerun the NTP service with or
2675
- without "cgexec" accordingly.
2676
- """
2677
- cmd = "service ntp stop"
2678
- os .system (cmd )
2679
- cmd = "systemctl restart interfaces-config"
2680
- os .system (cmd )
2681
- cmd = "service ntp start"
2682
- os .system (cmd )
2683
2667
2684
2668
def vrf_add_management_vrf (config_db ):
2685
2669
"""Enable management vrf in config DB"""
@@ -2689,22 +2673,7 @@ def vrf_add_management_vrf(config_db):
2689
2673
click .echo ("ManagementVRF is already Enabled." )
2690
2674
return None
2691
2675
config_db .mod_entry ('MGMT_VRF_CONFIG' , "vrf_global" , {"mgmtVrfEnabled" : "true" })
2692
- mvrf_restart_services ()
2693
- """
2694
- The regular expression for grep in below cmd is to match eth0 line in /proc/net/route, sample file:
2695
- $ cat /proc/net/route
2696
- Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
2697
- eth0 00000000 01803B0A 0003 0 0 202 00000000 0 0 0
2698
- """
2699
- 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"
2700
- proc = subprocess .Popen (cmd , shell = True , stdout = subprocess .PIPE )
2701
- output = proc .communicate ()
2702
- if int (output [0 ]) >= 1 :
2703
- cmd = "ip -4 route del default dev eth0 metric 202"
2704
- proc = subprocess .Popen (cmd , shell = True , stdout = subprocess .PIPE )
2705
- proc .communicate ()
2706
- if proc .returncode != 0 :
2707
- click .echo ("Could not delete eth0 route" )
2676
+
2708
2677
2709
2678
def vrf_delete_management_vrf (config_db ):
2710
2679
"""Disable management vrf in config DB"""
@@ -2714,7 +2683,7 @@ def vrf_delete_management_vrf(config_db):
2714
2683
click .echo ("ManagementVRF is already Disabled." )
2715
2684
return None
2716
2685
config_db .mod_entry ('MGMT_VRF_CONFIG' , "vrf_global" , {"mgmtVrfEnabled" : "false" })
2717
- mvrf_restart_services ()
2686
+
2718
2687
2719
2688
@config .group (cls = clicommon .AbbreviationGroup )
2720
2689
@click .pass_context
@@ -3920,20 +3889,6 @@ def _get_all_mgmtinterface_keys():
3920
3889
config_db .connect ()
3921
3890
return list (config_db .get_table ('MGMT_INTERFACE' ).keys ())
3922
3891
3923
- def mgmt_ip_restart_services ():
3924
- """Restart the required services when mgmt inteface IP address is changed"""
3925
- """
3926
- Whenever the eth0 IP address is changed, restart the "interfaces-config"
3927
- service which regenerates the /etc/network/interfaces file and restarts
3928
- the networking service to make the new/null IP address effective for eth0.
3929
- "ntp-config" service should also be restarted based on the new
3930
- eth0 IP address since the ntp.conf (generated from ntp.conf.j2) is
3931
- made to listen on that particular eth0 IP address or reset it back.
3932
- """
3933
- cmd = "systemctl restart interfaces-config"
3934
- os .system (cmd )
3935
- cmd = "systemctl restart ntp-config"
3936
- os .system (cmd )
3937
3892
3938
3893
#
3939
3894
# 'mtu' subcommand
@@ -4081,7 +4036,6 @@ def add(ctx, interface_name, ip_addr, gw):
4081
4036
config_db .set_entry ("MGMT_INTERFACE" , (interface_name , str (ip_address )), {"NULL" : "NULL" })
4082
4037
else :
4083
4038
config_db .set_entry ("MGMT_INTERFACE" , (interface_name , str (ip_address )), {"gwaddr" : gw })
4084
- mgmt_ip_restart_services ()
4085
4039
4086
4040
return
4087
4041
@@ -4121,7 +4075,6 @@ def remove(ctx, interface_name, ip_addr):
4121
4075
4122
4076
if interface_name == 'eth0' :
4123
4077
config_db .set_entry ("MGMT_INTERFACE" , (interface_name , str (ip_address )), None )
4124
- mgmt_ip_restart_services ()
4125
4078
return
4126
4079
4127
4080
table_name = get_interface_table_name (interface_name )
0 commit comments