#NEWLINE# def replace_static_route( ns , setting , address , prefix , metric = None , next_hop = None ) : #NEWLINE# #INDENT# '\n    Remove all static routes and add given static route to the given setting.\n\n    :param LMI_IPAssignmentSettingData setting: network setting.\n    :param str address: IPv4 or IPv6 address.\n    :param int prefix: network prefix.\n    :param metric: metric for the route or None\n    :type gateway: int or None\n    :param next_hop: IPv4 or IPv6 address for the next hop of the route or None\n    :type next_hop: str or None\n    ' #NEWLINE# ( address , version ) = util . address_check ( address ) #NEWLINE# while 1 : #NEWLINE# #INDENT# settingData = setting . first_associator ( AssocClass = 'LMI_OrderedIPAssignmentComponent' , ResultClass = 'LMI_IPRouteSettingData' ) #NEWLINE# if ( settingData is None ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# settingData . delete ( ) #NEWLINE# #UNINDENT# LOG ( ) . info ( 'Static routes replaced with route to %s/%d in setting %s' , address , prefix , setting . Caption ) #NEWLINE# return add_static_route ( ns , setting , address , prefix , metric , next_hop )