diff options
author | Adrian Villin <avillin@cisco.com> | 2024-06-14 09:32:39 +0200 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2024-06-14 18:10:26 +0000 |
commit | 4677d920c0b0ff1f1aae81fb2f0052d939a2e89c (patch) | |
tree | 9c1adf90f6c1a977b622c1d0211e0e86d1bef985 /extras/hs-test/infra/topo.go | |
parent | 2aa0f0da5dedcf6301c74a39b5e3749359e07e6d (diff) |
hs-test: separate infra from tests
- most functions and vars now start with a capital letter:
needed to access them outside the package that declares
them
- updated README.md
- very minor changes in MAKEFILE
Type: test
Change-Id: I4b5a194f08f09d59e372e57da6451fbb5a1de4da
Signed-off-by: Adrian Villin <avillin@cisco.com>
Diffstat (limited to 'extras/hs-test/infra/topo.go')
-rw-r--r-- | extras/hs-test/infra/topo.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/extras/hs-test/infra/topo.go b/extras/hs-test/infra/topo.go new file mode 100644 index 00000000000..f9c6528ba93 --- /dev/null +++ b/extras/hs-test/infra/topo.go @@ -0,0 +1,25 @@ +package hst + +import ( + "fmt" +) + +type NetDevConfig map[string]interface{} +type ContainerConfig map[string]interface{} +type VolumeConfig map[string]interface{} + +type YamlTopology struct { + Devices []NetDevConfig `yaml:"devices"` + Containers []ContainerConfig `yaml:"containers"` + Volumes []VolumeConfig `yaml:"volumes"` +} + +func addAddress(device, address, ns string) error { + c := []string{"ip", "addr", "add", address, "dev", device} + cmd := appendNetns(c, ns) + err := cmd.Run() + if err != nil { + return fmt.Errorf("failed to set ip address for %s: %v", device, err) + } + return nil +} |