summaryrefslogtreecommitdiff
path: root/src/test_commit_data.ml
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-02-11 07:12:13 -0600
committerGitHub <noreply@github.com>2025-02-11 07:12:13 -0600
commit41cbac4d6467c8bd62eeb247d2e28efa359e4a1c (patch)
tree035f46c458e3100284e19f737d6cbdce19b40fca /src/test_commit_data.ml
parenta375860a302a224722d254c31a1cb210cb12d972 (diff)
parentf5152b3de2a52b7a8d05c3cdc18d5f690c76bfba (diff)
downloadvyconf-41cbac4d6467c8bd62eeb247d2e28efa359e4a1c.tar.gz
vyconf-41cbac4d6467c8bd62eeb247d2e28efa359e4a1c.zip
Merge pull request #14 from jestabro/commit-alg
T6946: add calculation of commit priority queues
Diffstat (limited to 'src/test_commit_data.ml')
-rw-r--r--src/test_commit_data.ml30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test_commit_data.ml b/src/test_commit_data.ml
new file mode 100644
index 0000000..81b6c19
--- /dev/null
+++ b/src/test_commit_data.ml
@@ -0,0 +1,30 @@
+module CT = Vyos1x.Config_tree
+module FP = FilePath
+
+let active_config_file = ref ""
+let working_config_file = ref ""
+
+let usage = "Usage: " ^ Sys.argv.(0) ^ " [options]"
+
+let args = [
+ ("--running-config", Arg.String (fun s -> active_config_file:= s), "running config file");
+ ("--proposed-config", Arg.String (fun s -> working_config_file := s), "proposed config file");
+ ]
+
+let parse_ct file_name =
+ match file_name with
+ | "" -> CT.make ""
+ | _ ->
+ let ic = open_in file_name in
+ let s = really_input_string ic (in_channel_length ic) in
+ let ct = Vyos1x.Parser.from_string s in
+ close_in ic; ct
+
+let () =
+ let () = Arg.parse args (fun _ -> ()) usage in
+ let af = !active_config_file in
+ let wf = !working_config_file in
+ let at = parse_ct af in
+ let wt = parse_ct wf in
+ let out = Vyconfd_config.Commit.show_commit_data at wt
+ in print_endline out