diff --git a/deploy/single-node/config.cue b/deploy/single-node/config.cue index 5af056e..549d848 100644 --- a/deploy/single-node/config.cue +++ b/deploy/single-node/config.cue @@ -123,6 +123,9 @@ _deviceAddressTest: { // Human-readable interface description to show in the frontend description: string + + // Groups in which this interface should take place + groups: [...string] } vlan: [ID=string]: { diff --git a/deploy/single-node/k8s/clickhouse/clickhouse.cue b/deploy/single-node/k8s/clickhouse/clickhouse.cue index e3ff809..5e465fc 100644 --- a/deploy/single-node/k8s/clickhouse/clickhouse.cue +++ b/deploy/single-node/k8s/clickhouse/clickhouse.cue @@ -14,6 +14,7 @@ import ( interface: [string]: { id: int description: string + groups: [...string] } vlan: [string]: { id: int diff --git a/deploy/single-node/k8s/clickhouse/files.cue b/deploy/single-node/k8s/clickhouse/files.cue index bd9aa81..ef5d122 100644 --- a/deploy/single-node/k8s/clickhouse/files.cue +++ b/deploy/single-node/k8s/clickhouse/files.cue @@ -40,7 +40,7 @@ ClickHouseInstallation: netmeta: spec: configuration: files: { // Dictionary for user-defined interface name lookup _files: InterfaceNames: { data: strings.Join([ for s in #Config.sampler for i in s.interface { - strings.Join([s.device, "\(i.id)", i.description], "\t") + strings.Join([s.device, "\(i.id)", i.description, "[\(strings.Join([for s in i.groups {"'\(s)'"}], ","))]"], "\t") }], "\n") cfg: { diff --git a/deploy/single-node/tests/base.cue b/deploy/single-node/tests/base.cue index f5075f9..b0aa0ef 100644 --- a/deploy/single-node/tests/base.cue +++ b/deploy/single-node/tests/base.cue @@ -94,7 +94,7 @@ test: "clickhouse: sampler with interface": T={ } } - asserts: T.out.k8s.ClickHouseInstallation.netmeta.spec.configuration.files."InterfaceNames.tsv" == "::ffff:100.0.0.1\t858\tTRANSIT-ABC" + asserts: T.out.k8s.ClickHouseInstallation.netmeta.spec.configuration.files."InterfaceNames.tsv" == "::ffff:100.0.0.1\t858\tTRANSIT-ABC\t[]" asserts: T.out.k8s.ClickHouseInstallation.netmeta.spec.configuration.files."SamplerConfig.tsv" == "::ffff:100.0.0.1\tNULL\tNULL\tfalse" } @@ -109,6 +109,22 @@ test: "clickhouse: sampler with desc and interfaces": T={ } } - asserts: T.out.k8s.ClickHouseInstallation.netmeta.spec.configuration.files."InterfaceNames.tsv" == "::ffff:100.0.0.1\t858\tTRANSIT-ABC" + asserts: T.out.k8s.ClickHouseInstallation.netmeta.spec.configuration.files."InterfaceNames.tsv" == "::ffff:100.0.0.1\t858\tTRANSIT-ABC\t[]" + asserts: T.out.k8s.ClickHouseInstallation.netmeta.spec.configuration.files."SamplerConfig.tsv" == "::ffff:100.0.0.1\tNULL\tfoo\tfalse" +} + + +test: "clickhouse: sampler with desc,interfaces,groups": T={ + config: { + _requiredDefaults + letsencryptMode: "off" + + sampler: "::ffff:100.0.0.1": { + description: "foo" + interface: "858": {description: "TRANSIT-ABC", groups: ["A", "B"]} + } + } + + asserts: T.out.k8s.ClickHouseInstallation.netmeta.spec.configuration.files."InterfaceNames.tsv" == "::ffff:100.0.0.1\t858\tTRANSIT-ABC\t['A','B']" asserts: T.out.k8s.ClickHouseInstallation.netmeta.spec.configuration.files."SamplerConfig.tsv" == "::ffff:100.0.0.1\tNULL\tfoo\tfalse" }