aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2024-04-23 14:31:32 +0200
committerpmikus <peter.mikus@protonmail.ch>2024-04-23 14:31:32 +0200
commit1d4d17afa26688a37f6e7100f7653aec21dd2948 (patch)
tree9bb36f9a362b2dddb9579eb8c7d1b7a09129addf
parent5ba25d499683ba5fa8e0e14ede051fcd4643e008 (diff)
feat(etl): SOAK
Signed-off-by: Peter Mikus <peter.mikus@protonmail.ch> Change-Id: Ic8cd4cc6de271ca39b2b9d4e07da2718772e9a38
-rw-r--r--fdio.infra.terraform/terraform-nomad-pyspark-etl/conf/nomad/etl-trending-soak.hcl.tftpl55
-rw-r--r--fdio.infra.terraform/terraform-nomad-pyspark-etl/fdio/main.tf361
2 files changed, 245 insertions, 171 deletions
diff --git a/fdio.infra.terraform/terraform-nomad-pyspark-etl/conf/nomad/etl-trending-soak.hcl.tftpl b/fdio.infra.terraform/terraform-nomad-pyspark-etl/conf/nomad/etl-trending-soak.hcl.tftpl
new file mode 100644
index 0000000000..6d77a898df
--- /dev/null
+++ b/fdio.infra.terraform/terraform-nomad-pyspark-etl/conf/nomad/etl-trending-soak.hcl.tftpl
@@ -0,0 +1,55 @@
+job "${job_name}" {
+ datacenters = "${datacenters}"
+ type = "${type}"
+ periodic {
+ cron = "${cron}"
+ prohibit_overlap = "${prohibit_overlap}"
+ time_zone = "${time_zone}"
+ }
+ group "${job_name}" {
+ restart {
+ mode = "fail"
+ }
+ constraint {
+ attribute = "$${attr.cpu.arch}"
+ operator = "!="
+ value = "arm64"
+ }
+ constraint {
+ attribute = "$${node.class}"
+ value = "builder"
+ }
+ task "${job_name}" {
+ artifact {
+ source = "git::https://github.com/FDio/csit"
+ destination = "local/csit"
+ }
+ driver = "docker"
+ config {
+ image = "${image}"
+ command = "gluesparksubmit"
+ args = [
+ "--driver-memory", "30g",
+ "--executor-memory", "30g",
+ "--executor-cores", "2",
+ "--master", "local[2]",
+ "trending_soak.py"
+ ]
+ work_dir = "/local/csit/csit.infra.etl"
+ }
+ env {
+ AWS_ACCESS_KEY_ID = "${aws_access_key_id}"
+ AWS_SECRET_ACCESS_KEY = "${aws_secret_access_key}"
+ AWS_DEFAULT_REGION = "${aws_default_region}"
+ OUT_AWS_ACCESS_KEY_ID = "${out_aws_access_key_id}"
+ OUT_AWS_SECRET_ACCESS_KEY = "${out_aws_secret_access_key}"
+ OUT_AWS_DEFAULT_REGION = "${out_aws_default_region}"
+ ${ envs }
+ }
+ resources {
+ cpu = ${cpu}
+ memory = ${memory}
+ }
+ }
+ }
+}
diff --git a/fdio.infra.terraform/terraform-nomad-pyspark-etl/fdio/main.tf b/fdio.infra.terraform/terraform-nomad-pyspark-etl/fdio/main.tf
index 6b5edb79b7..aac81d9b78 100644
--- a/fdio.infra.terraform/terraform-nomad-pyspark-etl/fdio/main.tf
+++ b/fdio.infra.terraform/terraform-nomad-pyspark-etl/fdio/main.tf
@@ -76,7 +76,7 @@ module "etl-trending-ndrpdr" {
memory = 60000
}
-module "etl-iterative-hoststack-rls2402" {
+module "etl-trending-soak" {
providers = {
nomad = nomad.yul1
}
@@ -90,175 +90,194 @@ module "etl-iterative-hoststack-rls2402" {
out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
cron = "0 30 0 * * * *"
datacenters = ["yul1"]
- job_name = "etl-iterative-hoststack-rls2402"
-}
-
-module "etl-iterative-mrr-rls2402" {
- providers = {
- nomad = nomad.yul1
- }
- source = "../"
-
- aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
- aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
- aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
- out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
- out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
- out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
- cron = "0 30 0 * * * *"
- datacenters = ["yul1"]
- job_name = "etl-iterative-mrr-rls2402"
-}
-
-module "etl-iterative-ndrpdr-rls2402" {
- providers = {
- nomad = nomad.yul1
- }
- source = "../"
-
- aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
- aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
- aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
- out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
- out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
- out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
- cron = "0 30 0 * * * *"
- datacenters = ["yul1"]
- job_name = "etl-iterative-ndrpdr-rls2402"
-}
-
-module "etl-iterative-reconf-rls2402" {
- providers = {
- nomad = nomad.yul1
- }
- source = "../"
-
- aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
- aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
- aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
- out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
- out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
- out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
- cron = "0 30 0 * * * *"
- datacenters = ["yul1"]
- job_name = "etl-iterative-reconf-rls2402"
-}
-
-module "etl-iterative-soak-rls2402" {
- providers = {
- nomad = nomad.yul1
- }
- source = "../"
-
- aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
- aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
- aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
- out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
- out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
- out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
- cron = "0 30 0 * * * *"
- datacenters = ["yul1"]
- job_name = "etl-iterative-soak-rls2402"
-}
-
-module "etl-coverage-device-rls2402" {
- providers = {
- nomad = nomad.yul1
- }
- source = "../"
-
- aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
- aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
- aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
- out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
- out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
- out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
- cron = "0 30 0 * * * *"
- datacenters = ["yul1"]
- job_name = "etl-coverage-device-rls2402"
-}
-
-module "etl-coverage-hoststack-rls2402" {
- providers = {
- nomad = nomad.yul1
- }
- source = "../"
-
- aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
- aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
- aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
- out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
- out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
- out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
- cron = "0 30 0 * * * *"
- datacenters = ["yul1"]
- job_name = "etl-coverage-hoststack-rls2402"
-}
-
-module "etl-coverage-mrr-rls2402" {
- providers = {
- nomad = nomad.yul1
- }
- source = "../"
-
- aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
- aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
- aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
- out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
- out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
- out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
- cron = "0 30 0 * * * *"
- datacenters = ["yul1"]
- job_name = "etl-coverage-mrr-rls2402"
-}
-
-module "etl-coverage-ndrpdr-rls2402" {
- providers = {
- nomad = nomad.yul1
- }
- source = "../"
-
- aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
- aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
- aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
- out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
- out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
- out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
- cron = "0 30 0 * * * *"
- datacenters = ["yul1"]
- job_name = "etl-coverage-ndrpdr-rls2402"
-}
-
-module "etl-coverage-reconf-rls2402" {
- providers = {
- nomad = nomad.yul1
- }
- source = "../"
-
- aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
- aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
- aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
- out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
- out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
- out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
- cron = "0 30 0 * * * *"
- datacenters = ["yul1"]
- job_name = "etl-coverage-reconf-rls2402"
+ job_name = "etl-trending-soak"
+ memory = 60000
}
-module "etl-coverage-soak-rls2402" {
- providers = {
- nomad = nomad.yul1
- }
- source = "../"
-
- aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
- aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
- aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
- out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
- out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
- out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
- cron = "0 30 0 * * * *"
- datacenters = ["yul1"]
- job_name = "etl-coverage-soak-rls2402"
-}
+#module "etl-iterative-hoststack-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-iterative-hoststack-rls2402"
+#}
+#
+#module "etl-iterative-mrr-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-iterative-mrr-rls2402"
+#}
+#
+#module "etl-iterative-ndrpdr-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-iterative-ndrpdr-rls2402"
+#}
+#
+#module "etl-iterative-reconf-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-iterative-reconf-rls2402"
+#}
+#
+#module "etl-iterative-soak-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-iterative-soak-rls2402"
+#}
+#
+#module "etl-coverage-device-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-coverage-device-rls2402"
+#}
+#
+#module "etl-coverage-hoststack-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-coverage-hoststack-rls2402"
+#}
+#
+#module "etl-coverage-mrr-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-coverage-mrr-rls2402"
+#}
+#
+#module "etl-coverage-ndrpdr-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-coverage-ndrpdr-rls2402"
+#}
+#
+#module "etl-coverage-reconf-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-coverage-reconf-rls2402"
+#}
+#
+#module "etl-coverage-soak-rls2402" {
+# providers = {
+# nomad = nomad.yul1
+# }
+# source = "../"
+#
+# aws_access_key_id = data.vault_generic_secret.fdio_logs.data["access_key"]
+# aws_secret_access_key = data.vault_generic_secret.fdio_logs.data["secret_key"]
+# aws_default_region = data.vault_generic_secret.fdio_logs.data["region"]
+# out_aws_access_key_id = data.vault_generic_secret.fdio_docs.data["access_key"]
+# out_aws_secret_access_key = data.vault_generic_secret.fdio_docs.data["secret_key"]
+# out_aws_default_region = data.vault_generic_secret.fdio_docs.data["region"]
+# cron = "0 30 0 * * * *"
+# datacenters = ["yul1"]
+# job_name = "etl-coverage-soak-rls2402"
+#}
+# \ No newline at end of file
.function = punt_test_pg1_ip6, .name = "punt-test-pg1-ip6", .vector_size = sizeof (u32), .format_trace = format_punt_trace, }; /* *INDENT-ON* */ typedef struct punt_feat_trace_t_ { vlib_punt_reason_t pt_reason; } punt_feat_trace_t; always_inline uword punt_test_feat_inline (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame, u8 is_ip4) { u32 n_left_from, *from, *to_next, next_index; from = vlib_frame_vector_args (frame); n_left_from = frame->n_vectors; next_index = node->cached_next_index; while (n_left_from > 0) { u32 n_left_to_next; vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); while (n_left_from > 0 && n_left_to_next > 0) { vlib_buffer_t *b0; u32 bi0, next0; bi0 = to_next[0] = from[0]; from += 1; to_next += 1; n_left_to_next -= 1; n_left_from -= 1; next0 = 0; b0 = vlib_get_buffer (vm, bi0); if (is_ip4) b0->punt_reason = punt_reason_v4; else b0->punt_reason = punt_reason_v6; if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED)) { punt_feat_trace_t *t; b0 = vlib_get_buffer (vm, bi0); t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->pt_reason = b0->punt_reason; } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, n_left_to_next, bi0, next0); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); } return frame->n_vectors; } static u8 * format_punt_feat_trace (u8 * s, va_list * args) { CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *); punt_feat_trace_t *t = va_arg (*args, punt_feat_trace_t *); s = format (s, "reason: %U", format_vlib_punt_reason, t->pt_reason); return s; } always_inline uword punt_test_feat_ip4 (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { return (punt_test_feat_inline (vm, node, frame, 1)); } always_inline uword punt_test_feat_ip6 (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { return (punt_test_feat_inline (vm, node, frame, 0)); } /* *INDENT-OFF* */ VLIB_REGISTER_NODE (punt_test_feat_ip6_node) = { .function = punt_test_feat_ip6, .name = "punt-test-feat-ip6", .vector_size = sizeof (u32), .format_trace = format_punt_feat_trace, .n_next_nodes = 1, .next_nodes = { [0] = "punt-dispatch" } }; VLIB_REGISTER_NODE (punt_test_feat_ip4_node) = { .function = punt_test_feat_ip4, .name = "punt-test-feat-ip4", .vector_size = sizeof (u32), .format_trace = format_punt_feat_trace, .n_next_nodes = 1, .next_nodes = { [0] = "punt-dispatch" } }; VNET_FEATURE_INIT (punt_test_feat_ip6_feature, static) = { .arc_name = "ip6-unicast", .node_name = "punt-test-feat-ip6", }; VNET_FEATURE_INIT (punt_test_feat_ip4_feature, static) = { .arc_name = "ip4-unicast", .node_name = "punt-test-feat-ip4", }; /* *INDENT-ON* */ static clib_error_t * punt_test (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd_arg) { ip46_address_t ip46 = ip46_address_initializer; fib_protocol_t fproto; vnet_main_t *vnm; u32 sw_if_index; int rc; vnm = vnet_get_main (); fproto = FIB_PROTOCOL_IP4; if (unformat (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index)) { vlib_node_t *from; if (unformat (input, "%U", unformat_ip4_address, &ip46.ip4)) { fproto = FIB_PROTOCOL_IP4; } else if (unformat (input, "%U", unformat_ip6_address, &ip46.ip6)) { fproto = FIB_PROTOCOL_IP6; } else if (unformat (input, "clear")) { vnet_feature_enable_disable ("ip4-unicast", "punt-test-feat-ip4", sw_if_index, 0, NULL, 0); vnet_feature_enable_disable ("ip6-unicast", "punt-test-feat-ip6", sw_if_index, 0, NULL, 0); return NULL; } else { /* * allocate a client and a reason */ punt_hdl = vlib_punt_client_register ("test"); rc = vlib_punt_reason_alloc (punt_hdl, "reason-v4", NULL, NULL, &punt_reason_v4); rc |= vlib_punt_reason_alloc (punt_hdl, "reason-v6", NULL, NULL, &punt_reason_v6); ASSERT (!rc); vnet_feature_enable_disable ("ip4-unicast", "punt-test-feat-ip4", sw_if_index, 1, NULL, 0); vnet_feature_enable_disable ("ip6-unicast", "punt-test-feat-ip6", sw_if_index, 1, NULL, 0); return NULL; } if (SW_IF_INDEX_PG0 == sw_if_index) { if (FIB_PROTOCOL_IP4 == fproto) { /* * register the node that will forward the punted packet */ vlib_punt_register (punt_hdl, punt_reason_v4, "punt-test-pg0-ip4"); from = vlib_get_node_by_name (vm, (u8 *) "punt-test-pg0-ip4"); } else { vlib_punt_register (punt_hdl, punt_reason_v6, "punt-test-pg0-ip6"); from = vlib_get_node_by_name (vm, (u8 *) "punt-test-pg0-ip6"); } } else { if (FIB_PROTOCOL_IP4 == fproto) { vlib_punt_register (punt_hdl, punt_reason_v4, "punt-test-pg1-ip4"); from = vlib_get_node_by_name (vm, (u8 *) "punt-test-pg1-ip4"); } else { vlib_punt_register (punt_hdl, punt_reason_v6, "punt-test-pg1-ip6"); from = vlib_get_node_by_name (vm, (u8 *) "punt-test-pg1-ip6"); } } vlib_node_add_next (vm, from->index, vnet_tx_node_index_for_sw_interface (vnm, sw_if_index)); vec_validate (adjs[fproto], sw_if_index); adjs[fproto][sw_if_index] = adj_nbr_find (fproto, fib_proto_to_link (fproto), &ip46, sw_if_index); } return (NULL); } /* *INDENT-OFF* */ VLIB_CLI_COMMAND (test_fib_command, static) = { .path = "test punt", .short_help = "punt unit tests - DO NOT RUN ON A LIVE SYSTEM", .function = punt_test, }; /* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */