Skip to content

Commit

Permalink
support init behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
ak1ra24 committed Jan 31, 2020
1 parent 929f293 commit fd9b635
Showing 1 changed file with 70 additions and 22 deletions.
92 changes: 70 additions & 22 deletions internal/pkg/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func GenerateFile() (string, error) {
postinit := PostInit{
Cmds: []Cmd{
Cmd{
Cmd: "",
Cmd: "echo hoge",
},
},
}
Expand All @@ -217,43 +217,91 @@ func GenerateFile() (string, error) {
}

nodes := Node{
Name: "",
Image: "",
Name: "R1",
Image: "slankdev/ubuntu18.04",
NetBase: "",
Interfaces: []Interface{
Interface{
Name: "",
Type: "",
Args: "",
Name: "net0",
Type: "direct",
Args: "C1#net0",
},
Interface{
Name: "net1",
Type: "bridge",
Args: "B0",
},
Interface{
Name: "net2",
Type: "veth",
Args: "peer0",
},
Interface{
Name: "net3",
Type: "phys",
},
},
}

switches := Switch{
Name: "",
Name: "B0",
Interfaces: []Interface{
Interface{
Name: "",
Type: "",
Args: "",
Name: "net0",
Type: "docker",
Args: "R1",
},
Interface{
Name: "net0",
Type: "netns",
Args: "R2",
},
},
}

nodeConfig := NodeConfig{
Name: "",
Cmds: []Cmd{
Cmd{
Cmd: "",
nodeConfigs := []NodeConfig{
NodeConfig{
Name: "C0",
Cmds: []Cmd{
Cmd{
Cmd: "ip link set dev net0 up",
},
},
},
NodeConfig{
Name: "C1",
Cmds: []Cmd{
Cmd{
Cmd: "echo slankdev slankdev",
},
Cmd{
Cmd: "echo slankdev &&\necho slankdev",
},
},
},
}

test := Test{
Name: "",
Cmds: []Cmd{
Cmd{
Cmd: "",
tests := []Test{
Test{
Name: "p2p",
Cmds: []Cmd{
Cmd{
Cmd: "docker exec C0 ping -c2 10.0.0.2",
},
Cmd{
Cmd: "echo hoge",
},
},
},
Test{
Name: "lo",
Cmds: []Cmd{
Cmd{
Cmd: "docker exec C0 ping -c2 10.255.0.1",
},
Cmd{
Cmd: "echo hoge",
},
},
},
}
Expand All @@ -265,8 +313,8 @@ func GenerateFile() (string, error) {
PostFini: []PostFini{postfini},
Nodes: []Node{nodes},
Switches: []Switch{switches},
NodeConfigs: []NodeConfig{nodeConfig},
Test: []Test{test},
NodeConfigs: nodeConfigs,
Test: tests,
}

data, err := yaml.Marshal(tnconfig)
Expand Down

0 comments on commit fd9b635

Please sign in to comment.