<s> from ncclient import manager <EOL> from ncclient . xml_ import new_ele , sub_ele <EOL> def connect ( host , user , password ) : <EOL> conn = manager . connect ( host = host , <EOL> username = user , <EOL> password = password , <EOL> timeout = <NUM_LIT:10> , <EOL> device_params = { '<STR_LIT:name>' : '<STR_LIT>' } , <EOL> hostkey_verify = False ) <EOL> conn . lock ( ) <EOL> root = new_ele ( '<STR_LIT>' ) <EOL> configuration = sub_ele ( root , '<STR_LIT>' ) <EOL> system = sub_ele ( configuration , '<STR_LIT>' ) <EOL> location = sub_ele ( system , '<STR_LIT:location>' ) <EOL> sub_ele ( location , '<STR_LIT>' ) . text = "<STR_LIT>" <EOL> sub_ele ( location , '<STR_LIT>' ) . text = "<STR_LIT:5>" <EOL> sub_ele ( location , '<STR_LIT>' ) . text = "<STR_LIT>" <EOL> send_config = conn . edit_config ( config = root ) <EOL> print send_config . tostring <EOL> check_config = conn . validate ( ) <EOL> print check_config . tostring <EOL> compare_config = conn . compare_configuration ( ) <EOL> print compare_config . tostring <EOL> conn . commit ( ) <EOL> conn . unlock ( ) <EOL> conn . close_session ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> connect ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) </s>
